Removed compiler warning - Comparison between signed and unsigned integers 55/32755/1
authorAnkur <ankur29.garg@samsung.com>
Tue, 23 Dec 2014 13:22:50 +0000 (18:52 +0530)
committerAnkur <ankur29.garg@samsung.com>
Tue, 23 Dec 2014 13:24:40 +0000 (18:54 +0530)
-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
src/shared/sensor_plugin_loader.cpp

index 79245d7..de31c85 100755 (executable)
@@ -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();
index 8aa70d1..5a096a9 100755 (executable)
@@ -373,7 +373,7 @@ sensor_base* sensor_plugin_loader::get_sensor(sensor_id_t id)
        vector<sensor_base *> 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);