From 77638a155f75a8e8463acdb6b202f079e7dab9c7 Mon Sep 17 00:00:00 2001 From: Daniel Stein Date: Thu, 11 Sep 2014 17:28:26 +0200 Subject: [PATCH] Changed integer types to unsigned in list devices --- src/main.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cdf454f..3d18153 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,9 +33,9 @@ namespace po = boost::program_options; // number of digit -int numDigits(int number) +unsigned int numDigits(int number) { - int digits = 0; + unsigned int digits = 0; while(number != 0) { number /= 10; @@ -150,11 +150,11 @@ int main(int argc, char **argv) vector devices; devices = pusherInstance.getDevices(); - int titleLength = 5; - int modelLength = 5; - int idLength = 2; + unsigned int titleLength = 5; + unsigned int modelLength = 5; + unsigned int idLength = 2; - for(int i = 0; i < devices.size(); i++) + for(unsigned int i = 0; i < devices.size(); i++) { if(devices[i].title.length() > titleLength) { titleLength = devices[i].title.length(); } if(devices[i].model.length() > modelLength) { modelLength = devices[i].model.length(); } @@ -166,10 +166,10 @@ int main(int argc, char **argv) << "Title\033[" << (titleLength - 5 + 2) << "C" << "Model" << endl; - for(int x = 0; x < (titleLength + modelLength + idLength + 4); x++) { cout << "-"; } + for(unsigned int x = 0; x < (titleLength + modelLength + idLength + 4); x++) { cout << "-"; } cout << endl; - for(int i = 0; i < devices.size(); i++) + for(unsigned int i = 0; i < devices.size(); i++) { cout << devices[i].id << "\033[" << (idLength - numDigits(devices[i].id) + 2) << "C"