Commit ea5162ee authored by Alessio Netti's avatar Alessio Netti
Browse files

Compiler warning fixes

parent a7f9b57c
...@@ -198,7 +198,7 @@ bool CacheEntry::checkValid() { ...@@ -198,7 +198,7 @@ bool CacheEntry::checkValid() {
if (_cache.size() > 2) { if (_cache.size() > 2) {
TimeStamp ts; TimeStamp ts;
// Cache element right after cacheIndex is the oldest entry (circular array) // Cache element right after cacheIndex is the oldest entry (circular array)
uint64_t ctr = (_cacheIndex + 1) % _cache.size(); int64_t ctr = (_cacheIndex + 1) % _cache.size();
uint64_t prev = _cache[ctr].timestamp; uint64_t prev = _cache[ctr].timestamp;
// We compute the average sampling period for this specific sensor // We compute the average sampling period for this specific sensor
uint64_t avg = 0; uint64_t avg = 0;
...@@ -230,7 +230,7 @@ int64_t CacheEntry::getAverage(uint64_t avg) { ...@@ -230,7 +230,7 @@ int64_t CacheEntry::getAverage(uint64_t avg) {
} }
double sum = 0; double sum = 0;
uint64_t it, prev; int64_t it, prev;
prev = _cacheIndex; prev = _cacheIndex;
it = older(prev); it = older(prev);
// We compute the weighted average of elements in the cache that fall within the specified window // We compute the weighted average of elements in the cache that fall within the specified window
...@@ -286,8 +286,8 @@ int64_t CacheEntry::getOffset(int64_t t) { ...@@ -286,8 +286,8 @@ int64_t CacheEntry::getOffset(int64_t t) {
if(!_stable || t < 0) if(!_stable || t < 0)
return -1; return -1;
else { else {
int64_t offset = ( ( _cache.size() * t ) / ( getLatest().timestamp - getOldest().timestamp ) ); //- 1; int64_t offset = ( ( (int64_t)_cache.size() * t ) / ( getLatest().timestamp - getOldest().timestamp ) ); //- 1;
if(offset > _cache.size()) if(offset > (int64_t)_cache.size())
return -1; return -1;
return ( _cache.size() + _cacheIndex - offset ) % _cache.size(); return ( _cache.size() + _cacheIndex - offset ) % _cache.size();
} }
......
...@@ -333,7 +333,7 @@ void SimpleMQTTServerMessageThread::run() ...@@ -333,7 +333,7 @@ void SimpleMQTTServerMessageThread::run()
* Apparently, there is work to do... * Apparently, there is work to do...
*/ */
if (numfds > 0) { if (numfds > 0) {
for (int connectionId=0; connectionId<this->_maxConnPerThread; connectionId++) { for (unsigned connectionId=0; connectionId<this->_maxConnPerThread; connectionId++) {
if (fds[connectionId].fd != -1) { if (fds[connectionId].fd != -1) {
#ifdef SimpleMQTTVerbose #ifdef SimpleMQTTVerbose
coutMtx.lock(); coutMtx.lock();
...@@ -486,7 +486,7 @@ void SimpleMQTTServerMessageThread::assignConnections() ...@@ -486,7 +486,7 @@ void SimpleMQTTServerMessageThread::assignConnections()
return; return;
} }
for (int i=0; i<this->_maxConnPerThread; i++) { for (unsigned i=0; i<this->_maxConnPerThread; i++) {
if (fds[i].fd == -1) { if (fds[i].fd == -1) {
fds[i].events = POLLIN | POLLPRI | POLLHUP; fds[i].events = POLLIN | POLLPRI | POLLHUP;
fds[i].revents = 0; fds[i].revents = 0;
......
...@@ -54,7 +54,7 @@ class SimpleMQTTServerMessageThread : SimpleMQTTServerThread ...@@ -54,7 +54,7 @@ class SimpleMQTTServerMessageThread : SimpleMQTTServerThread
{ {
protected: protected:
uint64_t _maxConnPerThread; uint64_t _maxConnPerThread;
int numConnections; unsigned numConnections;
struct pollfd* fds; struct pollfd* fds;
SimpleMQTTMessage** msg; SimpleMQTTMessage** msg;
int *fdQueue; int *fdQueue;
......
Supports Markdown
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