Commit 0523cf25 authored by Alessio Netti's avatar Alessio Netti
Browse files

More warning fixes

- Mainly fixes to unsigned-signed comparison warnings
parent 1a79c40c
......@@ -35,8 +35,8 @@ string SensorNavigator::buildTopicForNode(const string& node, const string& suff
throw domain_error("SensorNavigator: node not found in tree!");
string nodePrefix = getNodeTopic(node);
size_t cnt = std::count(nodePrefix.begin(), nodePrefix.end(), '/');
if(nodePrefix.length() + suffix.length() - cnt > len)
int cnt = (int)std::count(nodePrefix.begin(), nodePrefix.end(), '/');
if( (int)nodePrefix.length() + (int)suffix.length() - cnt > len)
throw invalid_argument("SensorNavigator: cannot build topic, too many characters!");
return nodePrefix + string(len - nodePrefix.length() - suffix.length() + cnt, 'F') + suffix;
......@@ -105,7 +105,7 @@ void SensorNavigator::buildTree(const vector<string> *hierarchy, const vector<st
Node rootNode = {-1, set<string>(), set<string>(), "", ""};
_sensorTree->insert(make_pair(rootKey, rootNode));
//We iterate over all sensor names that were supplied and build up the tree
for(int i=0; i<sensors->size(); i++)
for(int i=0; i < (int)sensors->size(); i++)
_addSensor(sensors->at(i), topics ? topics->at(i) : "");
}
......@@ -287,7 +287,7 @@ void SensorNavigator::_addSensor(const string& name, const string& topic) {
int d=0;
//We verify how deep in the hierarchy the input sensor is by progressively matching it with the hierarchical regexes
for(d=0; d<_hierarchy->size(); d++)
for(d=0; d < (int)_hierarchy->size(); d++)
//If we have a match with regex at level d, the sensor belongs to its subtree
if( boost::regex_search(name.c_str(), _match, _hierarchy->at(d)) ) {
//prev contains the name of the parent for the current node in the subtree
......@@ -307,7 +307,7 @@ void SensorNavigator::_addSensor(const string& name, const string& topic) {
//TODO: evaluate alternatives. This system is finnicky and depends too much on user configurations
int pCtr = 0;
Node& target = _sensorTree->at(last);
while( pCtr < topic.length() && pCtr < target.topic.length() && target.topic[pCtr] == topic[pCtr])
while( pCtr < (int)topic.length() && pCtr < (int)target.topic.length() && target.topic[pCtr] == topic[pCtr])
pCtr++;
target.topic = target.topic.substr(0, pCtr);
}
......
......@@ -12,7 +12,7 @@ AverageAnalyzer::~AverageAnalyzer() {
}
void AverageAnalyzer::compute(int unitID) {
unsigned long long max=0, sum=0, avg=0;
long long max=0, sum=0, avg=0;
for(const auto& in : _units[unitID]->getInputs()) {
// Getting the most recent values as specified in _window
......
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