source: remove build warning for 64bit build 41/51441/2
authorSooyoung Ha <yoosah.ha@samsung.com>
Mon, 9 Nov 2015 14:40:04 +0000 (23:40 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Mon, 9 Nov 2015 14:45:52 +0000 (23:45 +0900)
I fix some pointer casting and printf format warnings for 64bit support.

There are many problems about code convention like indentations,
whitespaces, tabs, and so on. These should be aligned later, not this
commit.

Change-Id: I9359a68242af335ee6fbf8a0c781e4743e77bd5e
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
lib/libcommon/fileio.c
lib/libsms/sms_tool.c
libvmodem/libvgsm_network.c
libvmodem/libvgsm_sat.c
libvmodem/libvgsm_ss.c
vmodem/at/at_func.c
vmodem/db/db_phonebook.c
vmodem/db/db_security.c
vmodem/db/db_ss.c
vmodem/server/server_tx_gprs.c

index 6f9d4706c2ba47eb45fb46b0fb106e08148ac687..943f565708882d75e90799e256b59835f56d6cb9 100644 (file)
@@ -26,6 +26,7 @@
  *
  */
 
+#include <stdint.h>
 #include "fileio.h"
 
 gchar *get_simulator_path(void)
@@ -299,12 +300,13 @@ char *search_target_name(char *directory_name)
 }
 
 char *find_exec_path(char *line) {
-    int loc;
-    int find_loc = 0;
+    uintptr_t loc;
+    uintptr_t find_loc = 0;
     char *ldpath = NULL;
     char *start_p = NULL;
     static char exec_path[512] = "";
     int nfound = 0;
+    size_t len;
 
 #if 0
     // ld path -> factoryfs of bash_profile
@@ -316,7 +318,7 @@ char *find_exec_path(char *line) {
        return NULL;
     }
 
-    find_loc = (int)ldpath - (int)line;
+    find_loc = (uintptr_t)ldpath - (uintptr_t)line;
 
     for (loc = 0; loc < find_loc;loc++) {
        if (line[loc] == '#') {
@@ -324,13 +326,13 @@ char *find_exec_path(char *line) {
        }
     }
 
-    for (loc = 0; loc < strlen(ldpath);loc++) {
+    for (len = 0; len < strlen(ldpath);len++) {
 
-       if (ldpath[loc] == '#') {
+       if (ldpath[len] == '#') {
            return NULL;
        }
-       if (ldpath[loc] == '=') {
-           start_p = &ldpath[loc];
+       if (ldpath[len] == '=') {
+           start_p = &ldpath[len];
            nfound = 1;
            break;
        }
@@ -384,16 +386,17 @@ char *find_exec_path_by_bash_profile(char *target_path)
 
 
 char *find_ld_path(char *line) {
-    int loc;
+    uintptr_t loc;
     char *ldpath = NULL;
-    int find_loc = 0;
+    uintptr_t find_loc = 0;
+    size_t len;
 
     ldpath = strstr(line, "LD_LIBRARY_PATH");
     if (ldpath == NULL) {
        return NULL;
     }
 
-    find_loc = (int)ldpath - (int)line;
+    find_loc = (uintptr_t)ldpath - (uintptr_t)line;
 
     for (loc = 0; loc < find_loc;loc++) {
        if (line[loc] == '#') {
@@ -401,16 +404,16 @@ char *find_ld_path(char *line) {
        }
     }
 
-    for (loc = 0; loc < strlen(ldpath);loc++) {
-       if (ldpath[loc] == '#') {
+    for (len = 0; len < strlen(ldpath);len++) {
+       if (ldpath[len] == '#') {
            return NULL;
        }
-       if (ldpath[loc] == '=') {
+       if (ldpath[len] == '=') {
            break;
        }
     }
 
-    return &ldpath[loc] + 1;
+    return &ldpath[len] + 1;
 }
 
 char *find_ld_path_by_bash_profile(char *target_path)
index 2243147a075669412e09045b1e58868647a55b2d..28b7d19716f8d1c5a5a6f7ea340a96fd26afaf63 100644 (file)
@@ -563,7 +563,7 @@ int MsgConvertUTF8ToGSM7bit(unsigned char *pDestText, int maxLength,  const unsi
     bzero(pUCS2Text, maxUCS2Length);
 
     fprintf(stderr, "srcTextLen = %d\n", srcTextLen);
-    fprintf(stderr, "temp buffer size = %d\n", maxUCS2Length * sizeof(unsigned short));
+    fprintf(stderr, "temp buffer size = %zu\n", (size_t)(maxUCS2Length * sizeof(unsigned short)));
     fprintf(stderr, "max dest Length = %d\n", maxLength);
 
     ucs2Length = MsgConvertUTF8toUCS2((unsigned char*)pUCS2Text, maxUCS2Length * sizeof(unsigned short), pSrcText, srcTextLen);
index cf4f08738f0d47e5d09b3ae82a2b6960d155de01..92f7a718065dc460a6362444248666574ff85a82 100644 (file)
@@ -113,7 +113,7 @@ int vgsm_network_nitz_information(LXT_HANDLE* handle, gsm_network_nitz_info_t re
 
     unsigned char * pdata = (unsigned char *) malloc(length);
 
-    printf("size of gsm_network_nitz_info_t : %d\n",sizeof(reg));
+    printf("size of gsm_network_nitz_info_t : %zu\n",sizeof(reg));
 
     if (!pdata)
        return (-1);
index e7d58e8f4256cc730c9e16627787a14b79d641b6..508091aed047f8b489d1d19cf3fc815b9affdfce 100644 (file)
@@ -57,7 +57,7 @@ int vgsm_proactive_cmd_send(LXT_HANDLE * handle,int command)
            GSM_SAT,
            GSM_SAT_PROACTIVE_COMMAND_SEND,
            1,
-           (void *)command);
+           (void *)(&command));
 }
 
 
index f2ed872943f3357296afabaa3a463ac26fb5ce13..0ac7457970944b0eedae060ce279a280d03a7575 100644 (file)
@@ -150,9 +150,9 @@ int vgsm_ss_setUSSD(LXT_HANDLE* handle, _USSD_data_t *ussd, int size)
     printf("time: %s, weather: %s\n",
            ussd->time, ussd->weather);
 
-    printf("data length : %d\n",sizeof(*ussd));
-    printf("time length : %d\n",sizeof(ussd->time));
-    printf("weather length : %d\n",sizeof(ussd->weather));
+    printf("data length : %zu\n",sizeof(*ussd));
+    printf("time length : %zu\n",sizeof(ussd->time));
+    printf("weather length : %zu\n",sizeof(ussd->weather));
     printf("size : %d\n", size);
 #endif
 
@@ -174,12 +174,12 @@ int vgsm_ss_setAOC(LXT_HANDLE* handle, _AOC_t *aoc, int size)
            aoc->acm, aoc->ccm, aoc->maxacm, aoc->ppu,
            aoc->chartype);
 
-    printf("data length : %d\n",sizeof(*aoc));
-    printf("acm length : %d\n",sizeof(aoc->acm));
-    printf("type length : %d\n",sizeof(aoc->ccm));
-    printf("type length : %d\n",sizeof(aoc->maxacm));
-    printf("type length : %d\n",sizeof(aoc->ppu));
-    printf("type length : %d\n",sizeof(aoc->chartype));
+    printf("data length : %zu\n",sizeof(*aoc));
+    printf("acm length : %zu\n",sizeof(aoc->acm));
+    printf("type length : %zu\n",sizeof(aoc->ccm));
+    printf("type length : %zu\n",sizeof(aoc->maxacm));
+    printf("type length : %zu\n",sizeof(aoc->ppu));
+    printf("type length : %zu\n",sizeof(aoc->chartype));
     printf("size : %d\n", size);
 #endif
 
index e28baf0d404f6112836769580aab514fdb629040..262bccd5599d80a81dbccc39c8f55efe47fa3c06 100644 (file)
@@ -157,7 +157,7 @@ char* read_cmd_line(void)
                sms_data_len = start_pduIndex + total_data_length;
 
                TRACE(MSGL_VGSM_INFO, "sca_length:%d, total_data_length: %d, cnt: %d\n", sca_length, total_data_length, cnt);
-               TRACE(MSGL_VGSM_INFO, "(strlen(ATCMGS) + strlen(length) + strlen(token)): %d, sms_data_len:%d\n", (strlen(ATCMGS) + strlen(length) + strlen(token)), sms_data_len);
+               TRACE(MSGL_VGSM_INFO, "(strlen(ATCMGS) + strlen(length) + strlen(token)): %zu, sms_data_len:%d\n", (strlen(ATCMGS) + strlen(length) + strlen(token)), sms_data_len);
 
                while(cnt < sms_data_len + 1)
                {
@@ -222,7 +222,7 @@ int GSM_ATDispatchDpramData(GSM_StateMachine* pstate)
            return -1;
        }
     }
-    TRACE(MSGL_VGSM_INFO, "atmsg length: %d\n", strlen(atmsg));        
+    TRACE(MSGL_VGSM_INFO, "atmsg length: %zu\n", strlen(atmsg));
 
     // set default value
     frame.m_StartMagicCode = 0x7F;
index 83eaf3297f68db8b184bf486505145f97eb0a1a6..40fb464c2f5adca12adf75529af4299064e64a89 100644 (file)
@@ -316,7 +316,7 @@ int db_sim_pb_add(PB *pb)
     if (bin_path)
        g_free(bin_path);
 
-    SIM_DEBUG("name, strlen : %s, %d", pb->name,strlen(pb->name));
+    SIM_DEBUG("name, strlen : %s, %zu", pb->name,strlen(pb->name));
     db_sim_pb_get_check(pb);
 
     if(isdata == 1)
@@ -601,7 +601,7 @@ int db_sim_pb_remove(PB *pb)
 
     /////////////////////
     //090723
-    SIM_DEBUG("name, strlen : %s, %d", pb->name,strlen(pb->name));
+    SIM_DEBUG("name, strlen : %s, %zu", pb->name,strlen(pb->name));
     db_sim_pb_get_check(pb);
 
     if(isdata != 1)
index e336e029769429175494b725eb0ce01c9c19d98e..dfaea2c251c848418349adc6bd83f94f28e4133a 100644 (file)
@@ -1040,7 +1040,7 @@ int db_sim_sec_add(void)
     if (bin_path)
        g_free(bin_path);
 
-    SIM_DEBUG("puk %s len %d\n\n\n",   puk, strlen(puk));
+    SIM_DEBUG("puk %s len %zu\n\n\n",  puk, strlen(puk));
 
     // open the database
     err = sqlite3_open(dbname,&db);
index 70db55cad9244af8e7d85e3b26ec0096821327c4..05a9248ce478072ef162ef46872431070a9b1033 100644 (file)
@@ -95,7 +95,7 @@ static int vgsm_ss_sqlite_restore_callback(void * ref, int ncol, char ** cols, c
                call_forwarding_entry_t         entry;
                memset(entry.number, 0, sizeof(entry.number));
 
-               log_msg(MSGL_VGSM_INFO,"class = %d, type = %d, number = %s(%d), reply time = %d, ss_mode = %d \n", atoi(*cols), atoi(*(cols+1)), *(cols+2), strlen(*(cols+2)), atoi(*(cols+3)), atoi(*(cols+4)));
+               log_msg(MSGL_VGSM_INFO,"class = %d, type = %d, number = %s(%zu), reply time = %d, ss_mode = %d \n", atoi(*cols), atoi(*(cols+1)), *(cols+2), strlen(*(cols+2)), atoi(*(cols+3)), atoi(*(cols+4)));
                entry.tel_class = atoi(*cols);
                entry.type = atoi(*(cols+1));
                memcpy(&entry.number, *(cols+2), strlen(*(cols+2)));
index e7bb4e179df07623b92a0d4f3033202272b4832a..de60a6619e06a6ea803d589a71f830e1bbfc7211 100644 (file)
@@ -84,7 +84,7 @@ int server_tx_gprs_IPConfigurationNotify(LXT_MESSAGE const* packet)
 
     sprintf(sndbuf, "%s%d,%s,%s,%s,%d,%d%s", CGDCONT, g_pdpcontext.cid, pdp_type, g_pdpcontext.apn, g_pdpcontext.pdp_addr, g_pdpcontext.d_comp, g_pdpcontext.h_comp, CRLF);
 
-    log_msg(MSGL_VGSM_INFO,"packet:%s, length:%d\n", sndbuf, strlen(sndbuf));
+    log_msg(MSGL_VGSM_INFO,"packet:%s, length:%zu\n", sndbuf, strlen(sndbuf));
 
     return oem_tx_gprs_IPConfigurationNotify(sndbuf, strlen(sndbuf));
 }