OSDN Git Service

STPK-1429 Remove a compilation warning
authorPatrick Porlan <patrick.porlan@intel.com>
Fri, 23 May 2014 15:07:24 +0000 (17:07 +0200)
committersuyyala <sridhar.uyyala@intel.com>
Sat, 7 Jun 2014 16:35:49 +0000 (09:35 -0700)
GCC is weird sometimes. It warns about comparing an unsigned to
a signed int, and casting does not make that go away, but using
an intermediate variable and affectation is fine.

The value was always known at compile time and could fit in a
single byte anyway.

Issue: STPK-1429

Change-Id: I4373c84d55a906cdbbeef1a7be6ffcf316189893
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
enumeration.c

index 6080fbc..24b3301 100644 (file)
@@ -269,6 +269,7 @@ static void orientation_sensor_check(void)
        int has_mag = 0;
        int has_rot = 0;
        int has_ori = 0;
+       int catalog_size = CATALOG_SIZE;
 
        for (i=0; i<sensor_count; i++)
                switch (sensor_catalog[sensor_info[i].catalog_index].type) {
@@ -290,7 +291,7 @@ static void orientation_sensor_check(void)
                }
 
        if (has_acc && has_gyr && has_mag && !has_rot && !has_ori)
-               for (i=0; i<CATALOG_SIZE; i++)
+               for (i=0; i<catalog_size; i++)
                        if (sensor_catalog[i].type == SENSOR_TYPE_ORIENTATION) {
                                ALOGI("Adding placeholder orientation sensor");
                                add_sensor(0, i, 1);