From 58e4020ea7ddfa77b4cc6ded556fd77e21804951 Mon Sep 17 00:00:00 2001 From: Sooyoung Ha Date: Mon, 9 Nov 2015 23:40:04 +0900 Subject: [PATCH] source: remove build warning for 64bit build 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 --- lib/libcommon/fileio.c | 31 +++++++++++++++++-------------- lib/libsms/sms_tool.c | 2 +- libvmodem/libvgsm_network.c | 2 +- libvmodem/libvgsm_sat.c | 2 +- libvmodem/libvgsm_ss.c | 18 +++++++++--------- vmodem/at/at_func.c | 4 ++-- vmodem/db/db_phonebook.c | 4 ++-- vmodem/db/db_security.c | 2 +- vmodem/db/db_ss.c | 2 +- vmodem/server/server_tx_gprs.c | 2 +- 10 files changed, 36 insertions(+), 33 deletions(-) diff --git a/lib/libcommon/fileio.c b/lib/libcommon/fileio.c index 6f9d470..943f565 100644 --- a/lib/libcommon/fileio.c +++ b/lib/libcommon/fileio.c @@ -26,6 +26,7 @@ * */ +#include #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) diff --git a/lib/libsms/sms_tool.c b/lib/libsms/sms_tool.c index 2243147..28b7d19 100644 --- a/lib/libsms/sms_tool.c +++ b/lib/libsms/sms_tool.c @@ -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); diff --git a/libvmodem/libvgsm_network.c b/libvmodem/libvgsm_network.c index cf4f087..92f7a71 100644 --- a/libvmodem/libvgsm_network.c +++ b/libvmodem/libvgsm_network.c @@ -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); diff --git a/libvmodem/libvgsm_sat.c b/libvmodem/libvgsm_sat.c index e7d58e8..508091a 100644 --- a/libvmodem/libvgsm_sat.c +++ b/libvmodem/libvgsm_sat.c @@ -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)); } diff --git a/libvmodem/libvgsm_ss.c b/libvmodem/libvgsm_ss.c index f2ed872..0ac7457 100644 --- a/libvmodem/libvgsm_ss.c +++ b/libvmodem/libvgsm_ss.c @@ -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 diff --git a/vmodem/at/at_func.c b/vmodem/at/at_func.c index e28baf0..262bccd 100644 --- a/vmodem/at/at_func.c +++ b/vmodem/at/at_func.c @@ -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; diff --git a/vmodem/db/db_phonebook.c b/vmodem/db/db_phonebook.c index 83eaf32..40fb464 100644 --- a/vmodem/db/db_phonebook.c +++ b/vmodem/db/db_phonebook.c @@ -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) diff --git a/vmodem/db/db_security.c b/vmodem/db/db_security.c index e336e02..dfaea2c 100644 --- a/vmodem/db/db_security.c +++ b/vmodem/db/db_security.c @@ -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); diff --git a/vmodem/db/db_ss.c b/vmodem/db/db_ss.c index 70db55c..05a9248 100644 --- a/vmodem/db/db_ss.c +++ b/vmodem/db/db_ss.c @@ -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))); diff --git a/vmodem/server/server_tx_gprs.c b/vmodem/server/server_tx_gprs.c index e7bb4e1..de60a66 100644 --- a/vmodem/server/server_tx_gprs.c +++ b/vmodem/server/server_tx_gprs.c @@ -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)); } -- 2.7.4