Corrected signed/unsigned integer comparison warnings.
authorOssama Othman <ossama.othman@intel.com>
Mon, 21 Dec 2015 23:56:55 +0000 (15:56 -0800)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 13 Jan 2016 07:57:25 +0000 (07:57 +0000)
The return value of the ftell() function was assigned to an unsigned
integer typed variable and then compared to -1.  Since ftell() actually
returns a 'long' assign to a 'long' instead.  This addresses
signed/unsigned integer comparison warnings.

Change-Id: I990e891ee2ad1f81cd0721ad82646fcf2e79d2b0
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4689
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/ResourceModel.c
resource/csdk/connectivity/samples/linux/sample_main.c

index 36ef460..16104df 100644 (file)
@@ -1633,7 +1633,7 @@ bool read_file(const char* name, char** bytes, size_t* length)
 
     FILE* file;
     char* buffer;
-    size_t fileLen;
+    long fileLen;
 
     // Open file
     file = fopen(name, "rt");
@@ -1654,7 +1654,7 @@ bool read_file(const char* name, char** bytes, size_t* length)
     }
     fseek(file, 0, SEEK_SET);
 
-    LOGI("file size: %d", fileLen);
+    LOGI("file size: %ld", fileLen);
 
     // Allocate memory
     buffer = calloc(1, sizeof(char) * fileLen + 1);
index 392c5bf..c3ef1b2 100644 (file)
@@ -1601,7 +1601,7 @@ bool read_file(const char* name, CAPayload_t* bytes, size_t* length)
 
     FILE* file = NULL;
     CAPayload_t buffer = NULL;
-    unsigned long fileLen = 0;
+    long fileLen = 0;
 
     // Open file
     file = fopen(name, "rb");