From: Kyeonghun Lee Date: Wed, 23 Nov 2016 11:41:18 +0000 (+0900) Subject: remove build warning on 64bit environment X-Git-Tag: submit/tizen_3.0/20161124.052156^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a874a152690026d2367b8e7ddc0ce4f3d71eb3a;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git remove build warning on 64bit environment Change-Id: I7a7b33949080afb6c592d6f5b607b6dfbc29df9e Signed-off-by: Kyeonghun Lee --- diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 0e7754b..cf67fc7 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -136,7 +136,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS /* Add Message */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %zu, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);", MSGFW_MESSAGE_TABLE_NAME, rowId, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, (unsigned int)pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, 0, pMsg->bBackup, pMsg->sim_idx, imsi, pMsg->bRestricted); @@ -417,7 +417,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \ - DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \ + DISPLAY_TIME = %lu, DATA_SIZE = %zu, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \ BACKUP = %d, SUBJECT = ?, MSG_TEXT = ? \ WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, convId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize, @@ -2935,7 +2935,7 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S /* Add Message */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, 0, %d, ?, '', '', ?, 0, %d, '%s');", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %lu, %zu, %d, %d, %d, %d, %d, 0, %d, ?, '', '', ?, 0, %d, '%s');", MSGFW_MESSAGE_TABLE_NAME, rowId, pMsg->threadId, pMsg->folderId, pMsg->storageId, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->displayTime, pMsg->dataSize, pMsg->networkStatus, pMsg->bRead, pMsg->bProtected, pMsg->priority, pMsg->direction, pMsg->bBackup, pMsg->sim_idx, imsi); diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp index 1c4014c..bd519cd 100755 --- a/framework/storage-handler/MsgStorageMms.cpp +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -72,7 +72,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MsgDbHandler *dbHandle = getDbHandle(); msg_error_t err = MSG_SUCCESS; - unsigned int fileSize = 0; + gsize fileSize = 0; char *pFileData = NULL; char sqlQuery[MAX_QUERY_LEN+1]; @@ -84,11 +84,11 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if( pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS ) { if (pMsg->displayTime > 0) { snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, DISPLAY_TIME = %lu, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, DISPLAY_TIME = %lu, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %zu WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->displayTime, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); } else { snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", + "UPDATE %s SET MAIN_TYPE = %d, SUB_TYPE = %d, FOLDER_ID = %d, SUBJECT = ?, NETWORK_STATUS = %d, MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %zu WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->msgType.mainType, pMsg->msgType.subType, pMsg->folderId, pMsg->networkStatus, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); } @@ -98,7 +98,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) dbHandle->bindText(pMsg->subject, 1); - if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) { + if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, &fileSize, NULL) == true) { dbHandle->bindText(pFileData, 2); } else { dbHandle->bindText("", 2); @@ -114,13 +114,13 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) } // if (MsgOpenAndReadFile(pMsg->msgText, &pFileData, &fileSize) == false) { - if (g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == false) { + if (g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, &fileSize, NULL) == false) { return MSG_ERR_STORAGE_ERROR; } dbHandle->bindText(pMsg->subject, 1); - if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) { + if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, &fileSize, NULL) == true) { dbHandle->bindText(pFileData, 2); } else { dbHandle->bindText("", 2); @@ -128,14 +128,14 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) } } else if (pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MMS) { snprintf(sqlQuery, sizeof(sqlQuery), - "UPDATE %s SET MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %d WHERE MSG_ID = %d;", + "UPDATE %s SET MSG_TEXT = ?, THUMB_PATH = '%s', DATA_SIZE = %zu WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsg->thumbPath, pMsg->dataSize, pMsg->msgId); if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { return MSG_ERR_DB_PREPARE; } - if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL) == true) { + if (pMsg->msgText[0] != '\0' && g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, &fileSize, NULL) == true) { dbHandle->bindText(pFileData, 1); } else { dbHandle->bindText("", 1); diff --git a/include/utils/MsgMemory.h b/include/utils/MsgMemory.h index 43082b4..3ea375e 100755 --- a/include/utils/MsgMemory.h +++ b/include/utils/MsgMemory.h @@ -29,7 +29,7 @@ /*================================================================================================== DEFINES ==================================================================================================*/ -#define GETSP() ({ unsigned int sp; asm volatile ("mov %0,sp " : "=r"(sp)); sp; }) +#define GETSP() ({ unsigned long sp; asm volatile ("mov %0,sp " : "=r"(sp)); sp; }) #define BUF_SIZE 256 #define PAGE_SIZE (1 << 12) #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1))) @@ -43,10 +43,10 @@ static inline void stack_trim(void) { - unsigned int sp; + unsigned long sp; char buf[BUF_SIZE]; FILE* file; - unsigned int stacktop; + unsigned long stacktop; int found = 0; sp = GETSP(); @@ -62,7 +62,7 @@ stack_trim(void) fclose(file); if (found) { - sscanf(buf, "%x-", &stacktop); + sscanf(buf, "%lx-", &stacktop); if (madvise((void*)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp)-stacktop, MADV_DONTNEED) < 0) perror("stack madvise fail"); } diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp index 5547e64..4036817 100755 --- a/plugin/mms_plugin/MmsPluginHttp.cpp +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -694,9 +694,13 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in fclose(respfile); respfile = NULL; - if (g_file_get_contents((gchar*)conf_filename, (gchar**)&request_info.response_data, (gsize*)&request_info.response_data_len, NULL) == false) { + gsize data_len = 0; + + if (g_file_get_contents((gchar*)conf_filename, (gchar**)&request_info.response_data, (gsize*)&data_len, NULL) == false) { MSG_WARN("Fail to g_file_get_contents"); } + + request_info.response_data_len = (unsigned int)data_len; } this->clearSession(); diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp index 35af834..0bcbc50 100755 --- a/plugin/sms_plugin/SmsPluginStorage.cpp +++ b/plugin/sms_plugin/SmsPluginStorage.cpp @@ -725,7 +725,7 @@ void* SmsPluginStorage::class2_thread(void *data) } MSG_END(); - return (void *)err; + return NULL; } @@ -1081,7 +1081,7 @@ msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo) } snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \ - DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \ + DISPLAY_TIME = %lu, DATA_SIZE = %zu, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \ BACKUP = %d, SUBJECT = ?, MSG_TEXT = ?, SIM_INDEX = %d \ WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, convId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType, pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp index e76d1f6..22b9aee 100755 --- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp +++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp @@ -3376,11 +3376,11 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u /* skip 'basic' code */ iField++; memset(authStr, 0x00, sizeof(authStr)); - snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId)); + snprintf(authStr, sizeof(authStr), "%%%zus", sizeof(userId)); sscanf((char*)(fieldValue + iField), authStr, userId); iField = iField + AcStrlen((char*)userId) + 1; memset(authStr, 0x00, sizeof(authStr)); - snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(passWd)); + snprintf(authStr, sizeof(authStr), "%%%zus", sizeof(passWd)); sscanf((char*)(fieldValue + iField), authStr, passWd); iField = iField + AcStrlen((char*)userId) + 1; snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd); @@ -3405,7 +3405,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL /* skip 'basic' code */ iField++; memset(authStr, 0x00, sizeof(authStr)); - snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId)); + snprintf(authStr, sizeof(authStr), "%%%zus", sizeof(userId)); sscanf((char*)(fieldValue + iField), authStr, userId); iField = iField + AcStrlen((char*)userId) + 1; diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index d51b90b..b2d5975 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -85,9 +85,9 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %u, %d, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);", + snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %lu, %zu, %d, %d, %d, %d, %d, %d, %d, ?, '', '', ?, 0, %d, '%s', %d);", MSGFW_MESSAGE_TABLE_NAME, msgId, pMsgInfo->threadId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType, - pMsgInfo->msgType.subType, (unsigned int)pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected, + pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize, pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected, pMsgInfo->priority, pMsgInfo->direction, 0, pMsgInfo->bBackup, pMsgInfo->sim_idx, imsi, pMsgInfo->bRestricted); MSG_DEBUG("QUERY : %s", sqlQuery);