Commit 008a403b authored by Jeppe Pihl's avatar Jeppe Pihl

addressing comments

parent c542911c
......@@ -37,7 +37,7 @@
#define TRY_RET(...) \
[&]() { \
auto ret = __VA_ARGS__; \
if ((ssize_t)ret < 0) { \
if (ret < 0) { \
const char *str = #__VA_ARGS__; \
std::ostringstream oss; \
oss << str << ": " << strerror(errno); \
......
......@@ -64,7 +64,6 @@ CacheDirective::delta() const
return std::chrono::seconds(data.minFresh);
default:
throw std::domain_error("Invalid operation on cache directive");
return std::chrono::seconds();
}
}
......
......@@ -6,6 +6,7 @@
#include <fstream>
#include <iterator>
#include <algorithm>
#include <thread>
#include <unistd.h>
#include <fcntl.h>
......@@ -20,14 +21,7 @@ using namespace std;
namespace Pistache {
uint hardware_concurrency() {
std::ifstream cpuinfo("/proc/cpuinfo");
if (cpuinfo) {
return std::count(std::istream_iterator<std::string>(cpuinfo),
std::istream_iterator<std::string>(),
std::string("processor"));
}
return sysconf(_SC_NPROCESSORS_ONLN);
return std::thread::hardware_concurrency();
}
......
......@@ -71,7 +71,7 @@ DynamicStreamBuf::reserve(size_t size)
bool
StreamCursor::advance(size_t count) {
if ((ssize_t)count > buf->in_avail())
if (static_cast<ssize_t>(count) > buf->in_avail())
return false;
for (size_t i = 0; i < count; ++i) {
......
......@@ -222,7 +222,7 @@ Listener::run() {
else {
if (event.flags.hasFlag(Polling::NotifyOn::Read)) {
auto fd = event.tag.value();
if ((ssize_t)fd == listen_fd)
if (static_cast<ssize_t>(fd) == listen_fd)
handleNewConnection();
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment