Commit ea5162ee authored by Alessio Netti's avatar Alessio Netti

Compiler warning fixes

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