From 3357e9c9ca08a1ac689ad51b5841747722cc05f4 Mon Sep 17 00:00:00 2001 From: Ankur Date: Tue, 23 Dec 2014 18:52:50 +0530 Subject: [PATCH] Removed compiler warning - Comparison between signed and unsigned integers -In client.cpp, the variable was an index for 'for' loop, and was always positive, so can be changed on unsigned. -In sensor_plugin_loader.cpp, the variable was intialized with a variable which was unsigned int, and later was right shifted which will remain positive, so can be changed to unsigned int Change-Id: I9efeea4c4a90186378eefbe24f76eb945ae9a3db --- src/libsensord/client.cpp | 2 +- src/shared/sensor_plugin_loader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsensord/client.cpp b/src/libsensord/client.cpp index 79245d7..de31c85 100755 --- a/src/libsensord/client.cpp +++ b/src/libsensord/client.cpp @@ -413,7 +413,7 @@ API bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *senso *list = (sensor_t *) malloc(sizeof(sensor_info *) * sensor_infos.size()); retvm_if(!*list, false, "Failed to allocate memory"); - for (int i = 0; i < sensor_infos.size(); ++i) + for (unsigned int i = 0; i < sensor_infos.size(); ++i) *(*list + i) = sensor_info_to_sensor(sensor_infos[i]); *sensor_count = sensor_infos.size(); diff --git a/src/shared/sensor_plugin_loader.cpp b/src/shared/sensor_plugin_loader.cpp index 8aa70d1..5a096a9 100755 --- a/src/shared/sensor_plugin_loader.cpp +++ b/src/shared/sensor_plugin_loader.cpp @@ -373,7 +373,7 @@ sensor_base* sensor_plugin_loader::get_sensor(sensor_id_t id) vector sensors; sensor_type_t type = (sensor_type_t) (id & SENSOR_TYPE_MASK); - int index = id >> SENSOR_INDEX_SHIFT; + unsigned int index = id >> SENSOR_INDEX_SHIFT; sensors = get_sensors(type); -- 2.7.4