From: Sangkoo Kim Date: Mon, 14 Dec 2015 05:10:27 +0000 (+0900) Subject: Apply tizen coding rule X-Git-Tag: submit/tizen/20151214.073541^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d9d6f6b2b40e44d1d69e79b0a25b54ce186c7d8;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git Apply tizen coding rule Change-Id: I4e207e707dd129c57a761bb25277f47ea0b45e22 --- diff --git a/externals/MsgAlarm.cpp b/externals/MsgAlarm.cpp index fb6091b..354f4e3 100755 --- a/externals/MsgAlarm.cpp +++ b/externals/MsgAlarm.cpp @@ -120,7 +120,7 @@ msg_error_t MsgAlarmRegistration(struct tm *timeInfo, msg_alarm_cb userCB, int * target_time.min = timeInfo->tm_min; target_time.sec = timeInfo->tm_sec; - MSG_DEBUG( "Alarm Time : [%d-%d-%d %d:%d:%d] ", + MSG_DEBUG("Alarm Time : [%d-%d-%d %d:%d:%d] ", target_time.year, target_time.month, target_time.day, target_time.hour, target_time.min, target_time.sec); diff --git a/externals/MsgLbs.cpp b/externals/MsgLbs.cpp index 7ffe63d..4d1894a 100755 --- a/externals/MsgLbs.cpp +++ b/externals/MsgLbs.cpp @@ -28,7 +28,6 @@ extern "C" void MsgLbsSms(const char *msgBody, int msgSize) { - int ret = LBS_AGPS_ERROR_NONE; ret = lbs_agps_sms(msgBody, msgSize); @@ -39,7 +38,6 @@ void MsgLbsSms(const char *msgBody, int msgSize) { void MsgLbsWapPush(const char *pushHeader, const char *pushBody, int pushBodySize) { - int ret = LBS_AGPS_ERROR_NONE; ret = lbs_agps_wap_push(pushHeader, pushBody, pushBodySize); diff --git a/externals/MsgNotificationWrapper.cpp b/externals/MsgNotificationWrapper.cpp index c0f25ee..35188bc 100755 --- a/externals/MsgNotificationWrapper.cpp +++ b/externals/MsgNotificationWrapper.cpp @@ -258,7 +258,6 @@ msg_error_t MsgInsertNotification(MSG_MESSAGE_INFO_S *msg_info) MSG_END(); return err; - } msg_error_t MsgInsertOnlyActiveNotification(msg_notification_type_t noti_type, MSG_MESSAGE_INFO_S *msg_info) @@ -269,7 +268,7 @@ msg_error_t MsgInsertOnlyActiveNotification(msg_notification_type_t noti_type, M #ifndef MSG_WEARABLE_PROFILE notification_h noti_h = NULL; - MSG_NOTI_INFO_S noti_info = {0,}; + MSG_NOTI_INFO_S noti_info = {0, }; noti_info.type = noti_type; noti_info.active_noti_button_num = 1; @@ -411,7 +410,6 @@ __END_OF_REFRESH_NOTI : msg_error_t MsgRefreshNotification(msg_notification_type_t noti_type, bool bFeedback, msg_active_notification_type_t active_type) { - msg_error_t msg_err = MSG_SUCCESS; #ifndef MSG_WEARABLE_PROFILE @@ -489,7 +487,7 @@ msg_error_t MsgAddNotification(msg_notification_type_t noti_type, MSG_MESSAGE_IN #ifndef MSG_WEARABLE_PROFILE notification_h noti_h = NULL; - MSG_NOTI_INFO_S noti_info = {0,}; + MSG_NOTI_INFO_S noti_info = {0, }; noti_info.type = noti_type; @@ -564,9 +562,7 @@ void MsgDeleteNotification(msg_notification_type_t noti_type, int simIndex) int noti_err = NOTIFICATION_ERROR_NONE; if (noti_type == MSG_NOTI_TYPE_ALL) { - noti_err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI); - } else if (noti_type == MSG_NOTI_TYPE_VOICE_1 || noti_type == MSG_NOTI_TYPE_VOICE_2 || noti_type == MSG_NOTI_TYPE_SIM) { int notiId = 0; @@ -615,7 +611,7 @@ bool MsgCheckNotificationSettingEnable(void) if (allow_to_notify) { MSG_DEBUG("message notification is allowed"); - // check do not disturb mode + /* check do not disturb mode */ err = notification_system_setting_load_system_setting(&system_setting); if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) { @@ -987,13 +983,13 @@ int getPrivId(msg_notification_type_t noti_type, int sim_idx) noti_id = MsgSettingGetInt(MSG_SENTFAIL_NOTI_ID); break; case MSG_NOTI_TYPE_VOICE_1: { - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); noti_id = MsgSettingGetInt(keyName); break; } case MSG_NOTI_TYPE_VOICE_2: { - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx); noti_id = MsgSettingGetInt(keyName); break; @@ -1044,13 +1040,13 @@ void updatePrivId(msg_notification_type_t noti_type, int noti_id, int sim_idx) err = MsgSettingSetInt(MSG_SENTFAIL_NOTI_ID, noti_id); break; case MSG_NOTI_TYPE_VOICE_1: { - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_1, sim_idx); err = MsgSettingSetInt(keyName, noti_id); break; } case MSG_NOTI_TYPE_VOICE_2: { - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", VOICE_NOTI_ID_2, sim_idx); err = MsgSettingSetInt(keyName, noti_id); break; @@ -1222,7 +1218,7 @@ void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info) setServiceOperation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL); setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL); - char slot_id[5] = {0,}; + char slot_id[5] = {0, }; snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); } @@ -1251,7 +1247,7 @@ void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info) setServiceOperation(noti_info->svc_h, APP_CONTROL_OPERATION_CALL); setServiceUri(noti_info->svc_h, MSG_TEL_URI_VOICEMAIL); - char slot_id[5] = {0,}; + char slot_id[5] = {0, }; snprintf(slot_id, sizeof(slot_id), "%d", msg_info->sim_idx - 1); addServiceExtraData(noti_info->svc_h, "slot_id", slot_id); } @@ -1279,12 +1275,12 @@ void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info) } snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ if (msg_info->addressList[0].displayName[0] == '\0') - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal); else - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName); snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal); @@ -1312,18 +1308,18 @@ void createInfoData(MSG_NOTI_INFO_S *noti_info, MSG_MESSAGE_INFO_S *msg_info) } snprintf(msg_info->addressList[0].displayName, sizeof(msg_info->addressList[0].displayName), "%s", contactInfo.firstName); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ if (msg_info->addressList[0].displayName[0] == '\0') - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal); else - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName); if (msg_info->addressList[0].displayName[0] == '\0') - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].addressVal); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].addressVal); else - snprintf(noti_info->sender, sizeof(noti_info->sender), "%s",msg_info->addressList[0].displayName); + snprintf(noti_info->sender, sizeof(noti_info->sender), "%s", msg_info->addressList[0].displayName); - snprintf(noti_info->number, sizeof(noti_info->number), "%s",msg_info->addressList[0].addressVal); + snprintf(noti_info->number, sizeof(noti_info->number), "%s", msg_info->addressList[0].addressVal); MsgDbHandler *dbhandler = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; @@ -1559,7 +1555,7 @@ void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) { MSG_BEGIN(); - char unreadMsgCntStr[10] = {0,}; + char unreadMsgCntStr[10] = {0, }; bool bPreview; if (MsgSettingGetBool(MSG_SETTING_PREVIEW, &bPreview) != MSG_SUCCESS) { @@ -1773,7 +1769,6 @@ void setText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) } MSG_END(); - } void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) @@ -1782,10 +1777,9 @@ void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) switch (noti_info->type) { #ifdef MSG_NOTI_INTEGRATION - case MSG_NOTI_TYPE_NORMAL : - case MSG_NOTI_TYPE_CB : - case MSG_NOTI_TYPE_SIM : - { + case MSG_NOTI_TYPE_NORMAL: + case MSG_NOTI_TYPE_CB: + case MSG_NOTI_TYPE_SIM: { setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); if (noti_info->count > 1 && noti_info->senderCount > 1) { setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH); @@ -1815,8 +1809,7 @@ void setIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) break; } #else - case MSG_NOTI_TYPE_NORMAL : - { + case MSG_NOTI_TYPE_NORMAL: { setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, MSG_NORMAL_STATUS_ICON); setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON_FOR_LOCK, MSG_NORMAL_ICON_PATH); @@ -1934,7 +1927,6 @@ void setActiveText(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) } MSG_END(); - } @@ -1943,19 +1935,18 @@ void setActiveIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) MSG_BEGIN(); switch (noti_info->type) { - case MSG_NOTI_TYPE_NORMAL : - case MSG_NOTI_TYPE_SIM : - { + case MSG_NOTI_TYPE_NORMAL: + case MSG_NOTI_TYPE_SIM: { switch (noti_info->active_subtype) { - case MSG_CB_SMS : + case MSG_CB_SMS: setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH); break; - case MSG_WAP_SI_SMS : - case MSG_WAP_SL_SMS : + case MSG_WAP_SI_SMS: + case MSG_WAP_SL_SMS: setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_ACTIVE_PUSH_ICON_PATH); - case MSG_SYNCML_CP : + case MSG_SYNCML_CP: setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_OTA_ICON_PATH); - default : + default: if (noti_info->imagePath[0] != '\0') setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, noti_info->imagePath); else @@ -1966,12 +1957,11 @@ void setActiveIcon(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) break; } - case MSG_NOTI_TYPE_CB : - { + case MSG_NOTI_TYPE_CB: { setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_CB_ICON_PATH); break; } - case MSG_NOTI_TYPE_CLASS0 : + case MSG_NOTI_TYPE_CLASS0: setNotiImage(noti_h, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); break; default: @@ -2004,7 +1994,7 @@ msg_error_t MsgInsertInstantMessage(msg_notification_type_t noti_type) if (msg_err == MSG_SUCCESS) { MSG_DEBUG("Unread count [%d]", noti_info.count); if (noti_info.count == 1) { - MSG_SEC_DEBUG("noti_info.sender [%s]",noti_info.sender); + MSG_SEC_DEBUG("noti_info.sender [%s]", noti_info.sender); setNotiText(noti, NOTIFICATION_TEXT_TYPE_TITLE, noti_info.sender, NULL); setNotiText(noti, NOTIFICATION_TEXT_TYPE_CONTENT, noti_info.text, NULL); } else if (noti_info.count > 1) { @@ -2021,7 +2011,6 @@ msg_error_t MsgInsertInstantMessage(msg_notification_type_t noti_type) setNotiImage(noti, NOTIFICATION_IMAGE_TYPE_ICON, MSG_NORMAL_ICON_PATH); } break; - } case MSG_NOTI_TYPE_FAILED: { notiMsg = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, FAILED_TO_SEND_MESSAGE); @@ -2161,7 +2150,7 @@ void setActiveNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) MSG_DEBUG("Active Notification button 1 - Msg Id = [%d]", noti_info->msg_id); - char tel_num[MSG_NOTI_TEXT_LEN_S] = {0,}; + char tel_num[MSG_NOTI_TEXT_LEN_S] = {0, }; snprintf(tel_num, sizeof(tel_num), "tel:%s", noti_info->number); MSG_SEC_DEBUG("Active sender number [%s]", noti_info->number); setServiceUri(noti_info->active_noti_svc_h[0], tel_num); @@ -2175,7 +2164,7 @@ void setActiveNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) addServiceExtraData(noti_info->active_noti_svc_h[1], "type", "reply"); addServiceExtraData(noti_info->active_noti_svc_h[1], "msgId", noti_info->msg_id); - char slot_id[5] = {0,}; + char slot_id[5] = {0, }; snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1); addServiceExtraData(noti_info->active_noti_svc_h[1], "slot_id", slot_id); } @@ -2190,7 +2179,7 @@ void setActiveNotification(notification_h noti_h, MSG_NOTI_INFO_S *noti_info) addServiceExtraData(noti_info->active_noti_svc_h[2], "msgId", noti_info->msg_id); addServiceExtraData(noti_info->active_noti_svc_h[2], "CALLER", "active_noti"); - char slot_id[5] = {0,}; + char slot_id[5] = {0, }; snprintf(slot_id, sizeof(slot_id), "%d", noti_info->sim_idx - 1); addServiceExtraData(noti_info->active_noti_svc_h[2], "slot_id", slot_id); } @@ -2287,8 +2276,8 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag case MSG_NOTI_TYPE_CB: case MSG_NOTI_TYPE_SIM: #endif - { - int smsUnreadCnt = 0; + { + int smsUnreadCnt = 0; int mmsUnreadCnt = 0; char sqlQuery[MAX_QUERY_LEN+1]; @@ -2466,7 +2455,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag return MSG_ERR_DB_PREPARE; if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { - smsUnreadCnt = dbhandler->columnInt(6); mmsUnreadCnt = dbhandler->columnInt(7); msgSize = dbhandler->columnInt(8); @@ -2543,7 +2531,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag MsgSoundSetRepeatAlarm(); } } else { - MSG_DEBUG("No unread message."); MSG_DEBUG("notiPrivId [%d]", noti_info->id); @@ -2563,7 +2550,7 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag if (MsgSettingSetInt(NOTIFICATION_PRIV_ID, noti_info->id) != MSG_SUCCESS) MSG_DEBUG("MsgSettingSetInt fail : NOTIFICATION_PRIV_ID"); - MsgSettingHandleNewMsg(0,0); + MsgSettingHandleNewMsg(0, 0); MsgInsertBadge(0); MsgSoundSetRepeatAlarm(); } @@ -2699,7 +2686,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag return MSG_ERR_DB_PREPARE; if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { - noti_info->count = dbhandler->columnInt(4); if (noti_info->count > 0) { @@ -2738,7 +2724,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag MSG_DEBUG("unread SIM message [%d].", noti_info->msg_id); } else { - MSG_DEBUG("No unread SIM message."); MSG_DEBUG("notiPrivId [%d]", noti_info->id); @@ -2800,7 +2785,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag return MSG_ERR_DB_PREPARE; if (dbhandler->stepQuery() == MSG_ERR_DB_ROW) { - noti_info->count = dbhandler->columnInt(6); if (noti_info->count > 0) { @@ -2861,7 +2845,6 @@ msg_error_t getLatestMsgInfo(MSG_NOTI_INFO_S *noti_info, bool isForInstantMessag } } } else { - MSG_DEBUG("No sent failed message."); MSG_DEBUG("failedNotiId [%d]", noti_info->id); diff --git a/externals/MsgSoundPlayer.cpp b/externals/MsgSoundPlayer.cpp index dfae880..1f06f41 100755 --- a/externals/MsgSoundPlayer.cpp +++ b/externals/MsgSoundPlayer.cpp @@ -121,6 +121,7 @@ static gboolean MsgSoundMelodyTimeout(gpointer data) } */ +#if 0 static int MsgSoundPlayCallback(int message, void *param, void *user_param) { #ifdef _USE_MM_FW_ @@ -149,6 +150,7 @@ static int MsgSoundPlayCallback(int message, void *param, void *user_param) #endif return 1; } +#endif /*================================================================================================== IMPLEMENTATION OF MsgSoundPlayer - Member Functions @@ -190,7 +192,6 @@ MsgSoundPlayer::MsgSoundPlayer() MsgSoundPlayer::~MsgSoundPlayer() { - } @@ -254,7 +255,6 @@ void MsgSoundPlayer::MsgGetRingtonePath(char *userRingtonePath, char **msg_tone_ tmpFilePath = NULL; } #endif /* MSG_WEARABLE_PROFILE */ - } @@ -358,7 +358,7 @@ void MsgSoundPlayer::MsgGetPlayStatus(bool bVoiceMail, bool *bPlaySound, bool *b bool bMsgSettingNoti = true; /* Alert for message notification */ bool bMsgSettingVibration = false; /* vibration for message notification */ - MSG_RINGTONE_TYPE_T ringtoneType = MSG_RINGTONE_TYPE_DEFAULT; //sound type for message notification + MSG_RINGTONE_TYPE_T ringtoneType = MSG_RINGTONE_TYPE_DEFAULT; /*sound type for message notification */ bool bMsgSettingSound = true; MsgSettingGetBool(MSG_SETTING_VIBRATION, &bMsgSettingVibration); @@ -563,7 +563,7 @@ void MsgSoundPlayer::MsgSoundPlayStop() pthread_mutex_lock(&muMmPlay); - if (bPlaying == true && hPlayerHandle != 0 ) { + if (bPlaying == true && hPlayerHandle != 0) { MSG_DEBUG("stopping the player."); /* Stop playing media contents */ int err = mm_player_stop(hPlayerHandle); diff --git a/externals/MsgSpamFilter.cpp b/externals/MsgSpamFilter.cpp index 0599e01..a1ee225 100755 --- a/externals/MsgSpamFilter.cpp +++ b/externals/MsgSpamFilter.cpp @@ -92,10 +92,10 @@ bool MsgCheckFilter(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo) memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE)>%d-1 THEN '%%'||SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d+1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \ - UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \ - UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1)||'%%' AND FILTER_ACTIVE = 1 \ - UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%'||SUBSTR(FILTER_VALUE,1) AND FILTER_ACTIVE = 1;", + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE (CASE WHEN LENGTH(FILTER_VALUE) > %d-1 THEN '%%' || SUBSTR(FILTER_VALUE, LENGTH(FILTER_VALUE)-%d+1) ELSE FILTER_VALUE END) AND FILTER_ACTIVE = 1 \ + UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE SUBSTR(FILTER_VALUE, 1) || '%%' AND FILTER_ACTIVE = 1 \ + UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%' || SUBSTR(FILTER_VALUE, 1) || '%%' AND FILTER_ACTIVE = 1 \ + UNION SELECT FILTER_ID FROM %s WHERE FILTER_TYPE = %d AND '%s' LIKE '%%' || SUBSTR(FILTER_VALUE, 1) AND FILTER_ACTIVE = 1;", MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_SAME, pMsgInfo->addressList[0].addressVal, MsgContactGetMinMatchDigit(), MsgContactGetMinMatchDigit(), MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_START, pMsgInfo->addressList[0].addressVal, MSGFW_FILTER_TABLE_NAME, MSG_FILTER_BY_ADDRESS_INCLUDE, pMsgInfo->addressList[0].addressVal, diff --git a/framework/deliver-handler/MsgDeliverHandler.cpp b/framework/deliver-handler/MsgDeliverHandler.cpp index bf3282f..ada7597 100755 --- a/framework/deliver-handler/MsgDeliverHandler.cpp +++ b/framework/deliver-handler/MsgDeliverHandler.cpp @@ -59,7 +59,6 @@ void MsgPlayTTSMode(MSG_SUB_TYPE_T msgSubType, msg_message_id_t msgId, bool isFa MSG_DEBUG("VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE [%d]", isTTSOn); if(isTTSOn) { - bool isVoiceMail = false; if (msgSubType == MSG_MWI_VOICE_SMS) { @@ -263,7 +262,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques if (pMsgInfo->folderId == MSG_INBOX_ID) MsgInsertNotification(pMsgInfo); - } else if (subType == MSG_RETRIEVE_MANUALCONF_MMS) { + } else if (subType == MSG_RETRIEVE_MANUALCONF_MMS) { if (pMsgInfo->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS) { MSG_DEBUG("Manual success"); #if 0 //disable as per UX request to not show success notification : 2015.9.18 @@ -275,9 +274,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques MsgInsertTicker("Retrieving message failed", RETRIEVING_MESSAGE_FAILED, true, pMsgInfo->msgId); } } - } - else if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS || pMsgInfo->msgType.subType == MSG_SENDCONF_MMS) - { + } else if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS || pMsgInfo->msgType.subType == MSG_SENDCONF_MMS) { MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsgInfo->msgType.mainType); if (plg == NULL) return MSG_ERR_NULL_POINTER; @@ -300,8 +297,7 @@ msg_error_t MsgHandleMmsConfIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_reques if (err != MSG_SUCCESS) return MSG_ERR_STORAGE_ERROR; - if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS) - { + if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS) { err = MsgStoMoveMessageToFolder(pMsgInfo->msgId, MSG_SENTBOX_ID); if (err != MSG_SUCCESS) return MSG_ERR_STORAGE_ERROR; @@ -324,12 +320,11 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) MsgDisplayLock(); if (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) { - bool bOnlyNoti = false; err = MsgHandleSMS(pMsgInfo, pSendNoti, &bOnlyNoti); - if (err == MSG_SUCCESS && ((*pSendNoti)||bOnlyNoti)) { + if (err == MSG_SUCCESS && ((*pSendNoti) || bOnlyNoti)) { #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED bool isFavorites = false; if (!checkBlockingMode(pMsgInfo->addressList[0].addressVal, &isFavorites)) { @@ -338,9 +333,7 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) #endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ MsgInsertNotification(pMsgInfo); } - } - else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) - { + } else if (pMsgInfo->msgType.mainType == MSG_MMS_TYPE) { err = MsgHandleMMS(pMsgInfo, pSendNoti); } @@ -351,10 +344,8 @@ msg_error_t MsgHandleIncomingMsg(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) (pMsgInfo->folderId == MSG_INBOX_ID || pMsgInfo->folderId == MSG_SPAMBOX_ID) && (pMsgInfo->msgType.mainType == MSG_SMS_TYPE) && (pMsgInfo->msgType.subType != MSG_WAP_SL_SMS)) { - #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED MSG_DEBUG("Enter MsgAddPhoneLog() : pMsg->folderId [%d]", pMsgInfo->folderId); - MsgAddPhoneLog(pMsgInfo); #endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED } @@ -412,8 +403,7 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO } } else if ((pMsgInfo->msgType.subType == MSG_WAP_SI_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_CO_SMS) || (pMsgInfo->msgType.subType == MSG_WAP_SL_SMS)) { MSG_DEBUG("Add WAP Push Message"); - switch (pMsgInfo->msgType.subType) - { + switch (pMsgInfo->msgType.subType) { case MSG_WAP_SI_SMS: case MSG_WAP_SL_SMS: err = MsgStoAddWAPMsg(pMsgInfo); @@ -426,11 +416,9 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO } } else if ((pMsgInfo->msgType.subType == MSG_CB_SMS) || (pMsgInfo->msgType.subType == MSG_JAVACB_SMS)) { /** check add message option */ - } - else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) { + } else if (pMsgInfo->msgType.subType == MSG_STATUS_REPORT_SMS) { MSG_DEBUG("Add Report Message"); - } - else if (pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS) { + } else if (pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS && pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS) { char keyName[MAX_VCONFKEY_NAME_LEN]; memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, pMsgInfo->sim_idx); @@ -506,8 +494,7 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO app_control_h svc_handle = NULL; switch (pMsgInfo->msgType.subType) { - case MSG_WAP_SL_SMS: - { + case MSG_WAP_SL_SMS: { *pSendNoti = true; if (serviceType == MSG_PUSH_SERVICE_ALWAYS) { @@ -543,7 +530,6 @@ msg_error_t MsgHandleSMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti, bool *bO app_control_destroy(svc_handle); } else if (serviceType == MSG_PUSH_SERVICE_PROMPT) { - MSG_DEBUG("WAP Message SL(Always Ask) start."); app_control_h svc_h; @@ -760,10 +746,8 @@ msg_error_t MsgHandleMMS(MSG_MESSAGE_INFO_S *pMsgInfo, bool *pSendNoti) } else { MSG_DEBUG("Process Message Fail : processReceivedInd()"); } - } } return err; } - diff --git a/framework/main.cpp b/framework/main.cpp index 2f2f44c..e3163ad 100755 --- a/framework/main.cpp +++ b/framework/main.cpp @@ -54,16 +54,14 @@ void* InitMsgServer(void*) MSG_DEBUG("Start InitMsgServer."); #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED - // Init contact digit number + /* Init contact digit number */ MsgInitContactSvc(); -#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ MsgInitCallStatusManager(); - //CID 356902: Moving try block up to include MsgStoInitDB which also throws MsgException - try - { - // storage handler initialize + try { + /* storage handler initialize */ err = MsgStoInitDB(false); if (err != MSG_SUCCESS) { MSG_ERR("FAIL TO INITIALIZE STORAGE HANDLER [%d]", err); @@ -71,20 +69,15 @@ void* InitMsgServer(void*) MsgInitNoti(); - // plugin manager initialize + /* plugin manager initialize */ MsgPluginManager::instance()->initialize(); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); - } - catch (exception& e) - { + } catch (exception& e) { MSG_FATAL("%s", e.what()); } - -// MsgSoundPlayer::instance()->MsgSoundInitRepeatAlarm(); +/* MsgSoundPlayer::instance()->MsgSoundInitRepeatAlarm(); */ MsgStoDisconnectDB(); @@ -97,20 +90,15 @@ void* InitMsgServer(void*) void* StartMsgServer(void*) { - try - { + try { if (MsgTransactionManager::instance()->initCynara() == false) { MSG_ERR("Cynara initialize failed. It will try again when API is called."); } MsgTransactionManager::instance()->run(); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); - } - catch (exception& e) - { + } catch (exception& e) { MSG_FATAL("%s", e.what()); } @@ -136,18 +124,17 @@ int main(void) #if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); #endif - // Reset message server ready flag + /* Reset message server ready flag */ if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, false) != MSG_SUCCESS) MSG_DEBUG("MsgSettingSetBool FAIL: VCONFKEY_MSG_SERVER_READY"); - // init server + /* init server */ InitMsgServer(NULL); pthread_t startThreadId; - // start transaction manager - if (pthread_create(&startThreadId, NULL, StartMsgServer, NULL) != 0) - { + /* start transaction manager */ + if (pthread_create(&startThreadId, NULL, StartMsgServer, NULL) != 0) { MSG_DEBUG("StartMsgServer not invoked: %s", g_strerror(errno)); return -1; } @@ -155,25 +142,22 @@ int main(void) mainloop = g_main_loop_new(NULL, FALSE); - if (mainloop != NULL) - { + if (mainloop != NULL) { MSG_DEBUG("Start Messaging Framework!!!"); - // Run GMainLoop + /* Run GMainLoop */ g_main_loop_run(mainloop); - } - else - { + } else { MSG_DEBUG("Fail to start Messaging Framework!!!"); } - //contacts-service is not used for gear + /* contacts-service is not used for gear */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED - // Close Contact Sevice + /* Close Contact Sevice */ MsgCloseContactSvc(); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ - // Disconnect to DB + /* Disconnect to DB */ MsgStoDisconnectDB(); MsgDeInitCallStatusManager(); diff --git a/framework/plugin-manager/MsgPluginManager.cpp b/framework/plugin-manager/MsgPluginManager.cpp index 4acfea6..70d921c 100755 --- a/framework/plugin-manager/MsgPluginManager.cpp +++ b/framework/plugin-manager/MsgPluginManager.cpp @@ -37,39 +37,34 @@ void MsgSentStatusListener(MSG_SENT_STATUS_S *pSentStatus) MSG_DEBUG("SENT STATUS %d, %d", pSentStatus->reqId, pSentStatus->status); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return; } - - - // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SENT_STATUS_S); // cmd type, MSG_SENT_STATUS + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SENT_STATUS_S); /* cmd type, MSG_SENT_STATUS */ char cmdBuf[cmdSize]; bzero(cmdBuf, cmdSize); MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_SENT_STATUS_CNF; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSentStatus, sizeof(MSG_SENT_STATUS_S)); - // Send Command to Transaction Manager + /* Send Command to Transaction Manager */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ MSG_DEBUG("Waiting result for SENT STATUS"); char *temp = NULL; @@ -77,7 +72,7 @@ void MsgSentStatusListener(MSG_SENT_STATUS_S *pSentStatus) unsigned int len; client.read(&temp, &len); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); MSG_END(); @@ -92,19 +87,16 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, msg_i MSG_DEBUG("StorageChangeType : [%d], msg ID : [%d]", storageChangeType, pMsgIdList->msgIdList[i]); } - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { - client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + try { + client.connect(MSG_SOCKET_PATH); + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return; } - // composing command + /* composing command */ int cmdSize = sizeof(MSG_CMD_S) + sizeof(int) + sizeof(msg_message_id_t) * pMsgIdList->nCount + sizeof(msg_storage_change_type_t); char cmdBuf[cmdSize]; @@ -112,7 +104,7 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, msg_i MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_STORAGE_CHANGE_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); @@ -121,10 +113,10 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, msg_i memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), (void*)pMsgIdList->msgIdList, sizeof(msg_message_id_t)*pMsgIdList->nCount); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(msg_message_id_t)*pMsgIdList->nCount)), &storageChangeType, sizeof(msg_storage_change_type_t)); - // Send Command to Transaction Manager + /* Send Command to Transaction Manager */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ MSG_DEBUG("Waiting result for STORAGE CHANGE"); char *temp = NULL; @@ -132,7 +124,7 @@ void MsgStorageChangeListener(msg_storage_change_type_t storageChangeType, msg_i unsigned int len; client.read(&temp, &len); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); MSG_END(); @@ -143,33 +135,28 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // Check Invalid Message Structure - if (pMsg == NULL) - { + /* Check Invalid Message Structure */ + if (pMsg == NULL) { MSG_DEBUG("pMsg is NULL !!"); - return MSG_ERR_NULL_MESSAGE; } - // Allocate Memory to Command Data + /* Allocate Memory to Command Data */ char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); - // composing command - int cmdSize = sizeof(MSG_CMD_S) + dataSize; // cmd type, MSG_MESSAGE_INFO_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + dataSize; /* cmd type, MSG_MESSAGE_INFO_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -178,14 +165,14 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INCOMING_MSG_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData, dataSize); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); char* retBuf = NULL; @@ -194,16 +181,16 @@ msg_error_t MsgIncomingMessageListener(MSG_MESSAGE_INFO_S *pMsg) client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_MSG_IND) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /* THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ #ifdef FEATURE_SMS_CDMA memcpy(&(pMsg->msgId), pEvent->data, sizeof(msg_message_id_t)); @@ -219,20 +206,17 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SYNCML_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_SYNCML_MESSAGE_DATA_S); /* cmd type, MSG_SYNCML_MESSAGE_DATA_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -240,32 +224,32 @@ msg_error_t MsgIncomingSyncMLMessageListener(MSG_SYNCML_MESSAGE_DATA_S *pSyncMLD bzero(cmdBuf, cmdSize); MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INCOMING_SYNCML_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pSyncMLData, sizeof(MSG_SYNCML_MESSAGE_DATA_S)); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -276,20 +260,17 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData) { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_MESSAGE_DATA_S); // cmd type, MSG_SYNCML_MESSAGE_DATA_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_PUSH_MESSAGE_DATA_S); /* cmd type, MSG_SYNCML_MESSAGE_DATA_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -297,32 +278,32 @@ msg_error_t MsgIncomingPushMessageListener(MSG_PUSH_MESSAGE_DATA_S *pPushData) bzero(cmdBuf, cmdSize); MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INCOMING_PUSH_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pPushData, sizeof(MSG_PUSH_MESSAGE_DATA_S)); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -334,37 +315,34 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_ { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // Check Invalid Message Structure - if (pCbMsg == NULL) - { + /* Check Invalid Message Structure */ + if (pCbMsg == NULL) { MSG_DEBUG("pMsg is NULL !!"); return MSG_ERR_NULL_MESSAGE; } + int cmdSize = 0; - // Allocate Memory to Command Data + /* Allocate Memory to Command Data */ char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); int dataSize = MsgEncodeMsgInfo(pMsgInfo, &encodedData); - // composing command + /* composing command */ if(pCbMsg->type == MSG_ETWS_SMS) - cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S); // cmd type, MSG_CB_MSG_S + cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S); /* cmd type, MSG_CB_MSG_S */ else - cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S) + dataSize; // cmd type, MSG_CB_MSG_S + cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_CB_MSG_S) + dataSize; /* cmd type, MSG_CB_MSG_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -373,7 +351,7 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_ MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INCOMING_CB_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); @@ -383,7 +361,7 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_ if(pCbMsg->type != MSG_ETWS_SMS) memcpy((void*)((char*)pCmd + sizeof(MSG_CMD_TYPE_T)+ MAX_COOKIE_LEN + sizeof(MSG_CB_MSG_S)), encodedData, dataSize); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); char* retBuf = NULL; @@ -392,16 +370,16 @@ msg_error_t MsgIncomingCBMessageListener(MSG_CB_MSG_S *pCbMsg, MSG_MESSAGE_INFO_ client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_CB_MSG_IND) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -413,20 +391,17 @@ msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData) { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_LBS_MESSAGE_DATA_S); // cmd type, MSG_LBS_MESSAGE_DATA_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + sizeof(MSG_LBS_MESSAGE_DATA_S); /* cmd type, MSG_LBS_MESSAGE_DATA_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -434,32 +409,32 @@ msg_error_t MsgIncomingLBSMessageListener(MSG_LBS_MESSAGE_DATA_S *pLBSData) bzero(cmdBuf, cmdSize); MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INCOMING_LBS_IND; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pLBSData, sizeof(MSG_LBS_MESSAGE_DATA_S)); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INCOMING_LBS_MSG_IND) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -471,19 +446,16 @@ msg_error_t MsgInitSimBySatListener() { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command + /* composing command */ int cmdSize = sizeof(MSG_CMD_S); char cmdBuf[cmdSize]; @@ -491,27 +463,27 @@ msg_error_t MsgInitSimBySatListener() MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_INIT_SIM_BY_SAT; - // Send Command to Transaction Manager + /* Send Command to Transaction Manager */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin + /* Decoding the result from FW and Returning it to plugin */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_INIT_SIM_BY_SAT) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -524,25 +496,22 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_ MSG_BEGIN(); MSG_SEC_DEBUG("pMsg = %s, pReqId = %d ", pMsg->msgData, *pReqId); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // Allocate Memory to Command Data + /* Allocate Memory to Command Data */ char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); - // composing command - int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_request_id_t) + dataSize; // cmd type, MSG_MESSAGE_INFO_S, msg_request_id_t + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + sizeof(msg_request_id_t) + dataSize; /* cmd type, MSG_MESSAGE_INFO_S, msg_request_id_t */ MSG_DEBUG("cmdSize : %d", cmdSize); char cmdBuf[cmdSize]; @@ -550,33 +519,33 @@ msg_error_t MsgMmsConfIncomingListener(MSG_MESSAGE_INFO_S *pMsg, msg_request_id_ MSG_CMD_S *pCmd = (MSG_CMD_S *)cmdBuf; - // Set Command Parameters - pCmd->cmdType = MSG_CMD_PLG_INCOMING_MMS_CONF; // cmd type + /* Set Command Parameters */ + pCmd->cmdType = MSG_CMD_PLG_INCOMING_MMS_CONF; /* cmd type */ - memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); // cmd cookie + memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); /* cmd cookie */ - // cmd data + /* cmd data */ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), pReqId, sizeof(msg_request_id_t)); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN + sizeof(msg_request_id_t)), encodedData, dataSize); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char *retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize = 0; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin + /* Decoding the result from FW and Returning it to plugin */ MSG_EVENT_S *pEvent = (MSG_EVENT_S *)retBuf; if(pEvent->eventType != MSG_EVENT_PLG_INCOMING_MMS_CONF) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -588,27 +557,22 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // Check Invalid Message Structure - if (pMsg == NULL) - { + /* Check Invalid Message Structure */ + if (pMsg == NULL) { MSG_DEBUG("pMsg is NULL !!"); - return MSG_ERR_NULL_MESSAGE; } - // Allocate Memory to Command Data + /* Allocate Memory to Command Data */ char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); int dataSize = MsgEncodeMsgInfo(pMsg, &encodedData); @@ -631,8 +595,8 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ dataSize += ((sizeof(int)*size) + 1); - // composing command - int cmdSize = sizeof(MSG_CMD_S) + dataSize; // cmd type, MSG_MESSAGE_INFO_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + dataSize; /* cmd type, MSG_MESSAGE_INFO_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -641,14 +605,14 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_ADD_SIM_MSG; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData2, dataSize); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); char* retBuf = NULL; @@ -657,18 +621,18 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_ADD_SIM_MSG) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ - //CID 48645: pEvent->data is an array hence null check is not required on it. + /*CID 48645: pEvent->data is an array hence null check is not required on it. */ if (retMsgId) { memcpy(retMsgId, pEvent->data, sizeof(msg_message_id_t)); MSG_DEBUG("Saved SIM message ID = [%d]", *retMsgId); @@ -681,19 +645,16 @@ msg_error_t MsgSimMessageListener(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, msg_ msg_error_t MsgResendMessageListener(void) { - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command + /* composing command */ int cmdSize = sizeof(MSG_CMD_S); char cmdBuf[cmdSize]; @@ -701,27 +662,27 @@ msg_error_t MsgResendMessageListener(void) MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_RESEND_MESSAGE; - // Send Command to Transaction Manager + /* Send Command to Transaction Manager */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin + /* Decoding the result from FW and Returning it to plugin */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_RESEND_MESSAGE) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -733,27 +694,22 @@ bool MsgCheckUniquenessListener(MSG_UNIQUE_INDEX_S *p_msg, msg_message_id_t msgI { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // Check Invalid Message Structure - if (p_msg == NULL) - { + /* Check Invalid Message Structure */ + if (p_msg == NULL) { MSG_DEBUG("p_msg is NULL !!"); - return MSG_ERR_NULL_MESSAGE; } - // Allocate Memory to Command Data + /* Allocate Memory to Command Data */ char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); @@ -776,8 +732,8 @@ bool MsgCheckUniquenessListener(MSG_UNIQUE_INDEX_S *p_msg, msg_message_id_t msgI memcpy(p, p_msg, sizeof(MSG_UNIQUE_INDEX_S)); p = (void*)((char*)p + sizeof(MSG_UNIQUE_INDEX_S)); - // composing command - int cmdSize = sizeof(MSG_CMD_S) + dataSize; // cmd type, MSG_MESSAGE_INFO_S + /* composing command */ + int cmdSize = sizeof(MSG_CMD_S) + dataSize; /* cmd type, MSG_MESSAGE_INFO_S */ MSG_DEBUG("cmdSize: %d", cmdSize); @@ -786,14 +742,14 @@ bool MsgCheckUniquenessListener(MSG_UNIQUE_INDEX_S *p_msg, msg_message_id_t msgI MSG_CMD_S* pCmd = (MSG_CMD_S*) cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_PLG_CHECK_UNIQUENESS; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), encodedData, dataSize); - // Send Command to Messaging FW + /* Send Command to Messaging FW */ client.write(cmdBuf, cmdSize); char* retBuf = NULL; @@ -802,16 +758,16 @@ bool MsgCheckUniquenessListener(MSG_UNIQUE_INDEX_S *p_msg, msg_message_id_t msgI client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin - // the result is used for making delivery report + /* Decoding the result from FW and Returning it to plugin */ + /* the result is used for making delivery report */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_PLG_CHECK_UNIQUENESS) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INCOMING_MSG_ERROR, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -826,19 +782,16 @@ msg_error_t MsgSimImsiListener(int sim_idx) { MSG_BEGIN(); - // establish connection to msgfw daemon + /* establish connection to msgfw daemon */ MsgIpcClientSocket client; - try - { + try { client.connect(MSG_SOCKET_PATH); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); return MSG_ERR_UNKNOWN; } - // composing command + /* composing command */ int cmdSize = sizeof(MSG_CMD_S) + sizeof(int); char cmdBuf[cmdSize]; @@ -846,30 +799,30 @@ msg_error_t MsgSimImsiListener(int sim_idx) MSG_CMD_S* pCmd = (MSG_CMD_S*)cmdBuf; - // Set Command Parameters + /* Set Command Parameters */ pCmd->cmdType = MSG_CMD_UPDATE_IMSI; memset(pCmd->cmdCookie, 0x00, MAX_COOKIE_LEN); memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), (const void *)&sim_idx, sizeof(int)); - // Send Command to Transaction Manager + /* Send Command to Transaction Manager */ client.write(cmdBuf, cmdSize); - // Receive result from Transaction Manager + /* Receive result from Transaction Manager */ char* retBuf = NULL; unique_ptr wrap(&retBuf, unique_ptr_deleter); unsigned int retSize; client.read(&retBuf, &retSize); - // close connection to msgfw daemon + /* close connection to msgfw daemon */ client.close(); - // Decoding the result from FW and Returning it to plugin + /* Decoding the result from FW and Returning it to plugin */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*)retBuf; if (pEvent->eventType != MSG_EVENT_UPDATE_IMSI) MSG_FATAL("Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); - //THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); + /*THROW(MsgException::INVALID_RESULT, "Wrong result(evt type %d : %s) received", pEvent->eventType, MsgDbgEvtStr(pEvent->eventType)); */ MSG_END(); @@ -895,7 +848,7 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM if (!mLibHandler) THROW(MsgException::PLUGIN_ERROR, "ERROR dlopen library : [%s]", libPath); - // assign the c function pointers + /* assign the c function pointers */ msg_error_t(*pFunc)(MSG_PLUGIN_HANDLER_S*) = NULL; pFunc = (msg_error_t(*)(MSG_PLUGIN_HANDLER_S*))dlsym(mLibHandler, "MsgPlgCreateHandle"); @@ -926,7 +879,7 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM if (registerListener(&fwListener) != MSG_SUCCESS) THROW(MsgException::PLUGIN_ERROR, "ERROR to register listener"); - // Initialize Plug-in + /* Initialize Plug-in */ if (initialize() != MSG_SUCCESS) THROW(MsgException::PLUGIN_ERROR, "ERROR to initialize plugin"); } @@ -935,7 +888,7 @@ MsgPlugin::MsgPlugin(MSG_MAIN_TYPE_T mainType, const char *libPath): mSupportedM MsgPlugin::~MsgPlugin() { this->finalize(); - // close mLibHandler. + /* close mLibHandler. */ if (mLibHandler != NULL) dlclose(mLibHandler); } @@ -1115,7 +1068,7 @@ msg_error_t MsgPlugin::composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo) msg_error_t MsgPlugin::restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, int rcvdBodyLen, char* filePath) { if (mPlgHandler.pfRestoreMsg != NULL) - return mPlgHandler.pfRestoreMsg(pMsgInfo,pRecvBody, rcvdBodyLen, filePath); + return mPlgHandler.pfRestoreMsg(pMsgInfo, pRecvBody, rcvdBodyLen, filePath); else return MSG_ERR_INVALID_PLUGIN_HANDLE; } @@ -1146,7 +1099,6 @@ MsgPluginManager* MsgPluginManager::instance() MsgPluginManager::MsgPluginManager() { - } @@ -1163,19 +1115,15 @@ void MsgPluginManager::initialize() MsgPlugin *newPlg = NULL; - try - { + try { newPlg = new MsgPlugin(__msg_plg_items[i].type, __msg_plg_items[i].path); - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); continue; } if (newPlg) plgMap.insert(make_pair(__msg_plg_items[i].type, newPlg)); - } } @@ -1184,8 +1132,7 @@ void MsgPluginManager::finalize() { MsgPluginMap::iterator it; - for (it = plgMap.begin(); it != plgMap.end(); it++) - { + for (it = plgMap.begin(); it != plgMap.end(); it++) { MsgPlugin *temp = it->second; delete temp; } diff --git a/framework/setting-handler/MsgSettingHandler.cpp b/framework/setting-handler/MsgSettingHandler.cpp index b803b24..5135bf5 100755 --- a/framework/setting-handler/MsgSettingHandler.cpp +++ b/framework/setting-handler/MsgSettingHandler.cpp @@ -42,8 +42,7 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) #ifdef USE_GCONF err = MsgGconfGetClient(); - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { MSG_DEBUG("Get GConf Client Error"); return MSG_ERR_NULL_POINTER; } @@ -51,8 +50,7 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) MSG_DEBUG("Setting Type : %d", pSetting->type); - switch (pSetting->type) - { + switch (pSetting->type) { case MSG_GENERAL_OPT : err = MsgSetGeneralOpt(pSetting); break; @@ -61,7 +59,7 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) break; #ifndef FEATURE_SMS_CDMA case MSG_SMSC_LIST : - // Check SIM is present or not + /* Check SIM is present or not */ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pSetting->option.smscList.simIndex); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -86,7 +84,7 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) break; case MSG_CBMSG_OPT : if (pSetting->option.cbMsgOpt.simIndex != 0) { - // Check SIM is present or not + /* Check SIM is present or not */ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pSetting->option.cbMsgOpt.simIndex); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -98,7 +96,7 @@ msg_error_t MsgSetConfigData(const MSG_SETTING_S *pSetting) err = MsgSetCBMsgOpt(pSetting, true); break; case MSG_VOICEMAIL_OPT : - // Check SIM is present or not + /* Check SIM is present or not */ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pSetting->option.voiceMailOpt.simIndex); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -128,26 +126,23 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) #ifdef USE_GCONF msg_error_t err = MsgGconfGetClient(); - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { MSG_DEBUG("Get GConf Client Error"); return MSG_ERR_NULL_POINTER; } #endif - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; MSG_SIM_STATUS_T simStatus = MSG_SIM_STATUS_NOT_FOUND; - switch (pSetting->type) - { - case MSG_GENERAL_OPT : + switch (pSetting->type) { + case MSG_GENERAL_OPT: MsgGetGeneralOpt(pSetting); break; - case MSG_SMS_SENDOPT : + case MSG_SMS_SENDOPT: MsgGetSMSSendOpt(pSetting); break; - case MSG_SMSC_LIST : - { - // Check SIM is present or not + case MSG_SMSC_LIST: { + /* Check SIM is present or not */ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pSetting->option.smscList.simIndex); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -158,21 +153,20 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) MsgGetSMSCList(pSetting); } break; - case MSG_MMS_SENDOPT : + case MSG_MMS_SENDOPT: MsgGetMMSSendOpt(pSetting); break; - case MSG_MMS_RECVOPT : + case MSG_MMS_RECVOPT: MsgGetMMSRecvOpt(pSetting); break; - case MSG_MMS_STYLEOPT : + case MSG_MMS_STYLEOPT: MsgGetMMSStyleOpt(pSetting); break; - case MSG_PUSHMSG_OPT : + case MSG_PUSHMSG_OPT: MsgGetPushMsgOpt(pSetting); break; - case MSG_CBMSG_OPT : - { - // Check SIM is present or not + case MSG_CBMSG_OPT: { + /* Check SIM is present or not */ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pSetting->option.cbMsgOpt.simIndex); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -183,8 +177,8 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) MsgGetCBMsgOpt(pSetting); } break; - case MSG_VOICEMAIL_OPT : - // Check SIM is present or not + case MSG_VOICEMAIL_OPT: + /* Check SIM is present or not */ if (pSetting->option.voiceMailOpt.simIndex == 0) { MSG_DEBUG("Invalid SIM Index [%d]", pSetting->option.voiceMailOpt.simIndex); return MSG_ERR_INVALID_PARAMETER; @@ -199,7 +193,7 @@ msg_error_t MsgGetConfigData(MSG_SETTING_S *pSetting) } MsgGetVoiceMailOpt(pSetting); break; - case MSG_MSGSIZE_OPT : + case MSG_MSGSIZE_OPT: MsgGetMsgSizeOpt(pSetting); break; @@ -389,10 +383,10 @@ msg_error_t MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim) int addrLen = 0; int index = 0; - MSG_SMSC_LIST_S smscList = {0,}; + MSG_SMSC_LIST_S smscList = {0, }; memcpy(&smscList, &(pSetting->option.smscList), sizeof(MSG_SMSC_LIST_S)); -// int sel_id = smscList.selected; + /* int sel_id = smscList.selected; */ index = smscList.index; @@ -406,10 +400,10 @@ msg_error_t MsgSetSMSCList(const MSG_SETTING_S *pSetting, bool bSetSim) else addrLen = strlen(pSetting->option.smscList.smscData[index].smscAddr.address); - if(addrLen > SMSC_ADDR_MAX) { + if (addrLen > SMSC_ADDR_MAX) { MSG_DEBUG("SMSC address is too long [%d]", strlen(pSetting->option.smscList.smscData[index].smscAddr.address)); return MSG_ERR_SET_SIM_SET; - } else if(addrLen < 2) { + } else if (addrLen < 2) { MSG_DEBUG("SMSC address is too short [%d]", addrLen); return MSG_ERR_SET_SIM_SET; } @@ -504,8 +498,7 @@ msg_error_t MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting) } } #ifdef __NOT_USED_BY_DESIGN_CHANGE__ - if (MsgSettingSetBool(MMS_SEND_KEEP_COPY, sendOpt.bKeepCopy) != MSG_SUCCESS) - { + if (MsgSettingSetBool(MMS_SEND_KEEP_COPY, sendOpt.bKeepCopy) != MSG_SUCCESS) { MSG_DEBUG("Error to set config data [%s]", MMS_SEND_KEEP_COPY); return MSG_ERR_SET_SETTING; } @@ -521,8 +514,7 @@ msg_error_t MsgSetMMSSendOpt(const MSG_SETTING_S *pSetting) MsgSettingGetBool(MMS_SEND_HIDE_RECIPIENTS, &bValue); if (bValue != sendOpt.bHideRecipients) { - if (MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, sendOpt.bHideRecipients) != MSG_SUCCESS) - { + if (MsgSettingSetBool(MMS_SEND_HIDE_RECIPIENTS, sendOpt.bHideRecipients) != MSG_SUCCESS) { MSG_DEBUG("Error to set config data [%s]", MMS_SEND_HIDE_RECIPIENTS); return MSG_ERR_SET_SETTING; } @@ -801,7 +793,7 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) MSG_DEBUG("SIM Index = [%d]", simIndex); - if (bSetSim == true) {//if (bSetSim == true && simIndex != 0) { + if (bSetSim == true) { /* if (bSetSim == true && simIndex != 0) { */ #ifndef FEATURE_SMS_CDMA if (simIndex != 0) { memset(keyName, 0x00, sizeof(keyName)); @@ -809,7 +801,7 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) cbOpt.maxSimCnt = MsgSettingGetInt(keyName); if (cbOpt.channelData.channelCnt > cbOpt.maxSimCnt) { - MSG_DEBUG("Channel Count [%d] is over Max SIM Count [%d]", cbOpt.channelData.channelCnt,cbOpt.maxSimCnt); + MSG_DEBUG("Channel Count [%d] is over Max SIM Count [%d]", cbOpt.channelData.channelCnt, cbOpt.maxSimCnt); return MSG_ERR_SET_SIM_SET; } } @@ -854,15 +846,12 @@ msg_error_t MsgSetCBMsgOpt(const MSG_SETTING_S *pSetting, bool bSetSim) MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err); #ifndef FEATURE_SMS_CDMA - if (bSetSim == true) - { - for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) - { + if (bSetSim == true) { + for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) { memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i); - if (MsgSettingSetBool(keyName, cbOpt.bLanguage[i]) != MSG_SUCCESS) - { + if (MsgSettingSetBool(keyName, cbOpt.bLanguage[i]) != MSG_SUCCESS) { MSG_DEBUG("Error to set config data [%s]", keyName); return MSG_ERR_SET_SETTING; } @@ -1149,8 +1138,7 @@ void MsgGetCBMsgOpt(MSG_SETTING_S *pSetting) MSG_ERR("MsgStoGetCBChannelInfo : err=[%d]", err); #ifndef FEATURE_SMS_CDMA - for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) - { + for (int i = MSG_CBLANG_TYPE_ALL; i < MSG_CBLANG_TYPE_MAX; i++) { memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, DEF_BUF_LEN, "%s/%d", CB_LANGUAGE, i); @@ -1211,14 +1199,13 @@ msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting) MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); - // Get Setting Data from SIM + /* Get Setting Data from SIM */ if (plg != NULL) err = plg->setConfigData(pSetting); else err = MSG_ERR_NULL_POINTER; - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { MSG_DEBUG("Error. Error code is %d.", err); return err; } @@ -1233,14 +1220,13 @@ msg_error_t MsgGetConfigInSim(MSG_SETTING_S *pSetting) MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); - // Get Setting Data from SIM + /* Get Setting Data from SIM */ if (plg != NULL) err = plg->getConfigData(pSetting); else err = MSG_ERR_NULL_POINTER; - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { MSG_DEBUG("Error. Error code is %d.", err); return err; } diff --git a/framework/storage-handler/MsgStorageFilter.cpp b/framework/storage-handler/MsgStorageFilter.cpp index 15641d9..f90dbea 100755 --- a/framework/storage-handler/MsgStorageFilter.cpp +++ b/framework/storage-handler/MsgStorageFilter.cpp @@ -44,8 +44,7 @@ msg_error_t MsgStoCheckDuplicatedFilter(const MSG_FILTER_S *pFilter) MSG_DEBUG("sql : %s", sqlQuery); - if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) - { + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { if (filterStr) free(filterStr); return MSG_ERR_DB_EXEC; @@ -230,8 +229,7 @@ msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList) if (pFilterList->msg_struct_info != NULL) { msg_struct_s* pTmp = NULL; - for (int i = 0; i < rowCnt; i++) - { + for (int i = 0; i < rowCnt; i++) { pFilterList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s; pTmp = (msg_struct_s *)pFilterList->msg_struct_info[i]; diff --git a/framework/storage-handler/MsgStorageFolder.cpp b/framework/storage-handler/MsgStorageFolder.cpp index d9261dd..1688fec 100755 --- a/framework/storage-handler/MsgStorageFolder.cpp +++ b/framework/storage-handler/MsgStorageFolder.cpp @@ -135,8 +135,7 @@ msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList) msg_struct_s* pTmp = NULL; - for (int i = 0; i < rowCnt; i++) - { + for (int i = 0; i < rowCnt; i++) { pFolderList->msg_struct_info[i] = (msg_struct_t)new msg_struct_s; pTmp = (msg_struct_s *)pFolderList->msg_struct_info[i]; pTmp->type = MSG_STRUCT_FOLDER_INFO; @@ -150,7 +149,6 @@ msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList) memset(pFolder->folderName, 0x00, sizeof(pFolder->folderName)); dbHandle->getColumnToString(index++, MAX_FOLDER_NAME_SIZE, pFolder->folderName); - } dbHandle->freeTable(); diff --git a/framework/storage-handler/MsgStorageManager.cpp b/framework/storage-handler/MsgStorageManager.cpp index 8e8ffbe..e9ce72c 100755 --- a/framework/storage-handler/MsgStorageManager.cpp +++ b/framework/storage-handler/MsgStorageManager.cpp @@ -146,8 +146,7 @@ msg_error_t MsgStoDBVerCheck() MSG_DEBUG("dbVersion [%d]", dbVersion); - switch (dbVersion) - { + switch (dbVersion) { case 0 : MsgUpdateDBtoVer1(); /* no break */ @@ -168,7 +167,7 @@ void MsgInitMmapMutex(const char *shm_file_name) return; } - int fd = shm_open (shm_file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* note: permission is not working */ + int fd = shm_open(shm_file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); /* note: permission is not working */ if (fd < 0) { MSG_FATAL("shm_open errno [%d]", errno); @@ -188,7 +187,7 @@ void MsgInitMmapMutex(const char *shm_file_name) return ; } - // initialize the data on mmap + /* initialize the data on mmap */ pthread_mutexattr_t mattr; pthread_mutexattr_init(&mattr); pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); @@ -196,7 +195,7 @@ void MsgInitMmapMutex(const char *shm_file_name) pthread_mutex_init(mx, &mattr); pthread_mutexattr_destroy(&mattr); - close (fd); + close(fd); if (munmap((void *)mx, sizeof(pthread_mutex_t)) != 0) { MSG_FATAL("munmap() failed! (errno: %d)", errno); @@ -209,33 +208,33 @@ void MsgInitMmapMutex(const char *shm_file_name) msg_error_t MsgStoInitDB(bool bSimChanged) { MSG_BEGIN(); -// MsgDbHandler *dbHandle = getDbHandle(); + /* MsgDbHandler *dbHandle = getDbHandle(); */ msg_error_t err = MSG_SUCCESS; - // Init mmap mutex for DB access + /* Init mmap mutex for DB access */ MsgInitMmapMutex(SHM_FILE_FOR_DB_LOCK); - // Check DB version. + /* Check DB version. */ MsgStoDBVerCheck(); - // Delete Msgs in Hidden Folder + /* Delete Msgs in Hidden Folder */ MsgStoDeleteAllMessageInFolder(0, true, NULL); - // Reset network status + /* Reset network status */ MsgStoResetNetworkStatus(); #if 0 - // Reset Cb Message + /* Reset Cb Message */ MsgStoResetCBMessage(); #endif - //clear abnormal mms message + /*clear abnormal mms message */ MsgStoCleanAbnormalMmsData(); - // Clear all old Sim data + /* Clear all old Sim data */ MsgStoClearSimMessageInDB(); - //update sim index to 0 for all messages + /*update sim index to 0 for all messages */ MsgStoUpdateIMSI(0); MSG_END(); @@ -251,7 +250,7 @@ msg_error_t MsgAddDefaultFolders() char sqlQuery[MAX_QUERY_LEN+1]; MsgDbHandler *dbHandle = getDbHandle(); - // INBOX + /* INBOX */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_INBOX_ID); @@ -274,7 +273,7 @@ msg_error_t MsgAddDefaultFolders() return MSG_ERR_DB_EXEC; } - // OUTBOX + /* OUTBOX */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_OUTBOX_ID); @@ -297,7 +296,7 @@ msg_error_t MsgAddDefaultFolders() return MSG_ERR_DB_EXEC; } - // SENTBOX + /* SENTBOX */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_SENTBOX_ID); @@ -320,7 +319,7 @@ msg_error_t MsgAddDefaultFolders() return MSG_ERR_DB_EXEC; } - // DRAFT + /* DRAFT */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_DRAFT_ID); @@ -343,7 +342,7 @@ msg_error_t MsgAddDefaultFolders() return MSG_ERR_DB_EXEC; } - // CBMSGBOX + /* CBMSGBOX */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_CBMSGBOX_ID); @@ -366,7 +365,7 @@ msg_error_t MsgAddDefaultFolders() return MSG_ERR_DB_EXEC; } - // SPAMBOX + /* SPAMBOX */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) FROM %s WHERE FOLDER_ID = %d;", MSGFW_FOLDER_TABLE_NAME, MSG_SPAMBOX_ID); @@ -447,9 +446,8 @@ msg_error_t MsgStoResetDatabase() dbHandle->beginTrans(); - // Delete Database - for (int i = 0; i < listCnt; i++) - { + /* Delete Database */ + for (int i = 0; i < listCnt; i++) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", tableList[i]); @@ -459,7 +457,7 @@ msg_error_t MsgStoResetDatabase() } } - // Delete Message Table + /* Delete Message Table */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE STORAGE_ID <> %d;", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); @@ -469,7 +467,7 @@ msg_error_t MsgStoResetDatabase() return MSG_ERR_DB_EXEC; } - // Delete Conversation Table + /* Delete Conversation Table */ err = MsgStoClearConversationTable(dbHandle); if (err != MSG_SUCCESS) { @@ -477,14 +475,14 @@ msg_error_t MsgStoResetDatabase() return err; } - // Add Default Folders + /* Add Default Folders */ if (MsgAddDefaultFolders() != MSG_SUCCESS) { MSG_DEBUG("Add Default Folders Fail"); dbHandle->endTrans(false); return MSG_ERR_DB_STORAGE_INIT; } - // Add Default Address + /* Add Default Address */ if (MsgAddDefaultAddress() != MSG_SUCCESS) { MSG_DEBUG("Add Default Address Fail"); dbHandle->endTrans(false); @@ -493,17 +491,17 @@ msg_error_t MsgStoResetDatabase() dbHandle->endTrans(true); - // Delete MMS Files + /* Delete MMS Files */ MsgRmRf((char*)MSG_DATA_PATH); MsgRmRf((char*)MSG_SMIL_FILE_PATH); - // Reset SMS Count + /* Reset SMS Count */ if (MsgSettingSetIndicator(0, 0) != MSG_SUCCESS) { MSG_DEBUG("MsgSettingSetIndicator() FAILED"); return MSG_ERR_SET_SETTING; } - // Reset MMS Count + /* Reset MMS Count */ if (MsgSettingSetIndicator(0, 0) != MSG_SUCCESS) { MSG_DEBUG("MsgSettingSetIndicator() FAILED"); return MSG_ERR_SET_SETTING; @@ -549,7 +547,6 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file "SELECT MSG_ID FROM %s " "WHERE STORAGE_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_PHONE); - } err = dbHandle->getTable(sqlQuery, &rowCnt, NULL); @@ -579,9 +576,8 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file encoded_data = MsgVMessageEncode(&msgInfo); if (msgInfo.bTextSms == false) - { - MsgDeleteFile(msgInfo.msgData); //ipc - } + MsgDeleteFile(msgInfo.msgData); /*ipc */ + if (encoded_data != NULL) { if (MsgAppendFile(fileName, encoded_data, strlen(encoded_data)) == false) { free(encoded_data); @@ -601,7 +597,6 @@ msg_error_t MsgStoBackupMessage(msg_message_backup_type_t type, const char *file MSG_END(); return MSG_SUCCESS; - } msg_error_t MsgStoUpdateMms(MSG_MESSAGE_INFO_S *pMsg) @@ -613,7 +608,6 @@ msg_error_t MsgStoUpdateMms(MSG_MESSAGE_INFO_S *pMsg) char *pFileData = NULL; if (pMsg->msgType.subType == MSG_SENDCONF_MMS) { - memset(sqlQuery, 0x00, sizeof(sqlQuery)); dbHandle->beginTrans(); @@ -654,12 +648,10 @@ msg_error_t MsgStoUpdateMms(MSG_MESSAGE_INFO_S *pMsg) pFileData = NULL; } } else { - err = MsgStoUpdateMMSMessage(pMsg); if (err != MSG_SUCCESS) { MSG_DEBUG("MsgStoUpdateMMSMessage() error : %d", err); } - } return err; @@ -673,7 +665,7 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id } msg_error_t err = MSG_SUCCESS; - MSG_MESSAGE_INFO_S msgInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; unique_ptr addressListBuf(&msgInfo.addressList, unique_ptr_deleter); VTree* vMsg = NULL; @@ -710,8 +702,7 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id pCurrent = pData; - while ((pTemp = strstr(pCurrent, "END:VMSG")) != NULL) - { + while ((pTemp = strstr(pCurrent, "END:VMSG")) != NULL) { isMMS = false; MSG_DEBUG("Start Position: %s", pCurrent); @@ -720,10 +711,10 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id MSG_DEBUG("Start Position2: %s", pCurrent); - //decodes if it is sms + /*decodes if it is sms */ err = MsgVMessageDecodeSMS(pCurrent, &msgInfo); - //decode if it is mms + /*decode if it is mms */ if (err == MSG_ERR_INVALID_MESSAGE) { MSG_DEBUG("Vmsg is not an SMS, decoding for MMS..."); vMsg = vmsg_decode(pCurrent); @@ -745,174 +736,140 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); } - while (1 && isMMS) - { - while (1) - { + while (1 && isMMS) { + while (1) { MSG_DEBUG("pObject type [%d], pObject Value [%s]", pObject->property, pObject->pszValue[0]); - switch (pObject->property) - { - case VMSG_TYPE_MSGTYPE : - { - if (!strncmp(pObject->pszValue[0], "MMS RETRIEVED", strlen("MMS RETRIEVED"))) { - msgInfo.msgType.mainType = MSG_MMS_TYPE; - msgInfo.msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS; - } else if (!strncmp(pObject->pszValue[0], "MMS SEND", strlen("MMS SEND"))) { - msgInfo.msgType.mainType = MSG_MMS_TYPE; - msgInfo.msgType.subType = MSG_SENDCONF_MMS; - } else if (!strncmp(pObject->pszValue[0], "MMS NOTIFICATION", strlen("MMS NOTIFICATION"))) { - msgInfo.msgType.mainType = MSG_MMS_TYPE; - msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS; - } else { - vmsg_free_vtree_memory(vMsg); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; - } + switch (pObject->property) { + case VMSG_TYPE_MSGTYPE : { + if (!strncmp(pObject->pszValue[0], "MMS RETRIEVED", strlen("MMS RETRIEVED"))) { + msgInfo.msgType.mainType = MSG_MMS_TYPE; + msgInfo.msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS; + } else if (!strncmp(pObject->pszValue[0], "MMS SEND", strlen("MMS SEND"))) { + msgInfo.msgType.mainType = MSG_MMS_TYPE; + msgInfo.msgType.subType = MSG_SENDCONF_MMS; + } else if (!strncmp(pObject->pszValue[0], "MMS NOTIFICATION", strlen("MMS NOTIFICATION"))) { + msgInfo.msgType.mainType = MSG_MMS_TYPE; + msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS; + } else { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } - break; + } + break; - case VMSG_TYPE_MSGBOX : - { - if(!strncmp(pObject->pszValue[0], "INBOX", strlen("INBOX"))) { - msgInfo.folderId= MSG_INBOX_ID; - msgInfo.direction=MSG_DIRECTION_TYPE_MT; - - if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) - msgInfo.networkStatus=MSG_NETWORK_RETRIEVE_SUCCESS; - else if (msgInfo.msgType.subType == MSG_SENDCONF_MMS) - msgInfo.networkStatus=MSG_NETWORK_SEND_SUCCESS; - else - msgInfo.networkStatus=MSG_NETWORK_RECEIVED; - - } else if(!strncmp(pObject->pszValue[0], "OUTBOX", strlen("OUTBOX"))) { - msgInfo.folderId= MSG_OUTBOX_ID; - msgInfo.direction=MSG_DIRECTION_TYPE_MO; - - msgInfo.networkStatus=MSG_NETWORK_SEND_FAIL; - } else if(!strncmp(pObject->pszValue[0], "SENTBOX", strlen("SENTBOX"))) { - msgInfo.folderId= MSG_SENTBOX_ID; - msgInfo.direction=MSG_DIRECTION_TYPE_MO; - - msgInfo.networkStatus=MSG_NETWORK_SEND_SUCCESS; - } else if(!strncmp(pObject->pszValue[0], "DRAFTBOX", strlen("DRAFTBOX"))) { - msgInfo.folderId=MSG_DRAFT_ID; - msgInfo.direction=MSG_DIRECTION_TYPE_MO; - - msgInfo.networkStatus=MSG_NETWORK_NOT_SEND; - } else { - vmsg_free_vtree_memory(vMsg); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; - } + case VMSG_TYPE_MSGBOX : { + if (!strncmp(pObject->pszValue[0], "INBOX", strlen("INBOX"))) { + msgInfo.folderId = MSG_INBOX_ID; + msgInfo.direction = MSG_DIRECTION_TYPE_MT; + + if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) + msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_SUCCESS; + else if (msgInfo.msgType.subType == MSG_SENDCONF_MMS) + msgInfo.networkStatus = MSG_NETWORK_SEND_SUCCESS; + else + msgInfo.networkStatus = MSG_NETWORK_RECEIVED; + + } else if (!strncmp(pObject->pszValue[0], "OUTBOX", strlen("OUTBOX"))) { + msgInfo.folderId = MSG_OUTBOX_ID; + msgInfo.direction = MSG_DIRECTION_TYPE_MO; + + msgInfo.networkStatus = MSG_NETWORK_SEND_FAIL; + } else if (!strncmp(pObject->pszValue[0], "SENTBOX", strlen("SENTBOX"))) { + msgInfo.folderId = MSG_SENTBOX_ID; + msgInfo.direction = MSG_DIRECTION_TYPE_MO; + + msgInfo.networkStatus = MSG_NETWORK_SEND_SUCCESS; + } else if (!strncmp(pObject->pszValue[0], "DRAFTBOX", strlen("DRAFTBOX"))) { + msgInfo.folderId = MSG_DRAFT_ID; + msgInfo.direction = MSG_DIRECTION_TYPE_MO; + + msgInfo.networkStatus = MSG_NETWORK_NOT_SEND; + } else { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } - break; + } + break; - case VMSG_TYPE_STATUS : - { - if(!strncmp(pObject->pszValue[0], "READ", strlen("READ"))) { - msgInfo.bRead = true; - } else if(!strncmp(pObject->pszValue[0], "UNREAD", strlen("UNREAD"))) { - msgInfo.bRead = false; - } else { - vmsg_free_vtree_memory(vMsg); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; - } + case VMSG_TYPE_STATUS : { + if(!strncmp(pObject->pszValue[0], "READ", strlen("READ"))) { + msgInfo.bRead = true; + } else if (!strncmp(pObject->pszValue[0], "UNREAD", strlen("UNREAD"))) { + msgInfo.bRead = false; + } else { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } - break; - - case VMSG_TYPE_DATE : - { - struct tm displayTime; + } + break; - if (!_convert_vdata_str_to_tm(pObject->pszValue[0], &displayTime)) { - vmsg_free_vtree_memory( vMsg ); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; - } + case VMSG_TYPE_DATE : { + struct tm displayTime; - msgInfo.displayTime = mktime(&displayTime); + if (!_convert_vdata_str_to_tm(pObject->pszValue[0], &displayTime)) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } - break; - case VMSG_TYPE_SUBJECT : - { - MSG_DEBUG("subject length is [%d].", strlen(pObject->pszValue[0])); + msgInfo.displayTime = mktime(&displayTime); + } + break; - if(strlen(pObject->pszValue[0]) > 0) { - strncpy(msgInfo.subject, pObject->pszValue[0], MAX_SUBJECT_LEN); - if ( msgInfo.subject[strlen(pObject->pszValue[0])-1] == '\r' ) - msgInfo.subject[strlen(pObject->pszValue[0])-1]= '\0'; - } + case VMSG_TYPE_SUBJECT : { + MSG_DEBUG("subject length is [%d].", strlen(pObject->pszValue[0])); + + if(strlen(pObject->pszValue[0]) > 0) { + strncpy(msgInfo.subject, pObject->pszValue[0], MAX_SUBJECT_LEN); + if ( msgInfo.subject[strlen(pObject->pszValue[0])-1] == '\r' ) + msgInfo.subject[strlen(pObject->pszValue[0])-1] = '\0'; } - break; + } + break; - case VMSG_TYPE_BODY : - { - if (msgInfo.msgType.mainType == MSG_MMS_TYPE) { - msgInfo.bTextSms = true; + case VMSG_TYPE_BODY : { + if (msgInfo.msgType.mainType == MSG_MMS_TYPE) { + msgInfo.bTextSms = true; #if 0 - if(msgInfo.msgType.subType == MSG_NOTIFICATIONIND_MMS) { - - msgInfo.bTextSms = true; - - // Save Message Data into File - char fileName[MAX_COMMON_INFO_SIZE+1]; - memset(fileName, 0x00, sizeof(fileName)); - - if (MsgCreateFileName(fileName) == false) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; - } - - if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; - } - strncpy(msgInfo.msgData, MSG_IPC_DATA_PATH, MAX_MSG_DATA_LEN); - strncat(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN-strlen(msgInfo.msgData)); - msgInfo.dataSize = strlen(fileName); - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(msgInfo.msgType.mainType); - if (plg == NULL) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_NULL_POINTER; - } - err = plg->restoreMsg(&msgInfo, pObject->pszValue[0], pObject->numOfBiData, NULL); - - } else { -//////////////// From here was avaliable - char retrievedFilePath[MAX_FULL_PATH_SIZE] = {0,}; - MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(msgInfo.msgType.mainType); - if (plg == NULL) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_NULL_POINTER; - } - err = plg->restoreMsg(&msgInfo, pObject->pszValue[0], pObject->numOfBiData, retrievedFilePath); - msgInfo.bTextSms = false; - - char fileName[MAX_COMMON_INFO_SIZE+1]; - memset(fileName, 0x00, sizeof(fileName)); - - if (MsgCreateFileName(fileName) == false) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; - } - MSG_SEC_DEBUG("fileName: %s, retrievedFilePath: %s (%d)", fileName, retrievedFilePath, strlen(retrievedFilePath)); - - if (MsgWriteIpcFile(fileName, retrievedFilePath, strlen(retrievedFilePath)+ 1) == false) { - vmsg_free_vtree_memory(vMsg); - return MSG_ERR_STORAGE_ERROR; - } - strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN); - msgInfo.dataSize = strlen(retrievedFilePath) + 1; - - if (err != MSG_SUCCESS) - return vmsg_free_vtree_memory(vMsg); -/////////////////////////// + if(msgInfo.msgType.subType == MSG_NOTIFICATIONIND_MMS) { + msgInfo.bTextSms = true; + + /* Save Message Data into File */ + char fileName[MAX_COMMON_INFO_SIZE+1]; + memset(fileName, 0x00, sizeof(fileName)); + + if (MsgCreateFileName(fileName) == false) { + vmsg_free_vtree_memory(vMsg); + return MSG_ERR_STORAGE_ERROR; } -#else + if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { + vmsg_free_vtree_memory(vMsg); + return MSG_ERR_STORAGE_ERROR; + } + strncpy(msgInfo.msgData, MSG_IPC_DATA_PATH, MAX_MSG_DATA_LEN); + strncat(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN-strlen(msgInfo.msgData)); + msgInfo.dataSize = strlen(fileName); + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(msgInfo.msgType.mainType); + if (plg == NULL) { + vmsg_free_vtree_memory(vMsg); + return MSG_ERR_NULL_POINTER; + } + err = plg->restoreMsg(&msgInfo, pObject->pszValue[0], pObject->numOfBiData, NULL); + + } else { +/** From here was avaliable */ + char retrievedFilePath[MAX_FULL_PATH_SIZE] = {0, }; + MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(msgInfo.msgType.mainType); + if (plg == NULL) { + vmsg_free_vtree_memory(vMsg); + return MSG_ERR_NULL_POINTER; + } + err = plg->restoreMsg(&msgInfo, pObject->pszValue[0], pObject->numOfBiData, retrievedFilePath); msgInfo.bTextSms = false; char fileName[MAX_COMMON_INFO_SIZE+1]; @@ -920,50 +877,70 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id if (MsgCreateFileName(fileName) == false) { vmsg_free_vtree_memory(vMsg); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; + return MSG_ERR_STORAGE_ERROR; } + MSG_SEC_DEBUG("fileName: %s, retrievedFilePath: %s (%d)", fileName, retrievedFilePath, strlen(retrievedFilePath)); - if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { + if (MsgWriteIpcFile(fileName, retrievedFilePath, strlen(retrievedFilePath)+ 1) == false) { vmsg_free_vtree_memory(vMsg); - err = MSG_ERR_STORAGE_ERROR; - goto __RETURN; + return MSG_ERR_STORAGE_ERROR; } - - //set serialized mms data ipcfilename strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN); -#endif + msgInfo.dataSize = strlen(retrievedFilePath) + 1; + + if (err != MSG_SUCCESS) + return vmsg_free_vtree_memory(vMsg); } - } - break; +#else - case VCARD_TYPE_TEL : - { - MSG_ADDRESS_INFO_S * addrInfo = NULL; + msgInfo.bTextSms = false; - msgInfo.nAddressCnt++; + char fileName[MAX_COMMON_INFO_SIZE+1]; + memset(fileName, 0x00, sizeof(fileName)); - if (msgInfo.addressList == NULL) { - addrInfo = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S)); - } else { - addrInfo = (MSG_ADDRESS_INFO_S *)realloc(msgInfo.addressList, msgInfo.nAddressCnt * sizeof(MSG_ADDRESS_INFO_S)); + if (MsgCreateFileName(fileName) == false) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; } - if (addrInfo == NULL) { + if (MsgWriteIpcFile(fileName, pObject->pszValue[0], pObject->numOfBiData) == false) { vmsg_free_vtree_memory(vMsg); err = MSG_ERR_STORAGE_ERROR; goto __RETURN; - } - msgInfo.addressList = addrInfo; + /*set serialized mms data ipcfilename */ + strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN); +#endif + } + } + break; + + case VCARD_TYPE_TEL : { + MSG_ADDRESS_INFO_S * addrInfo = NULL; - msgInfo.addressList[msgInfo.nAddressCnt-1].addressType = MSG_ADDRESS_TYPE_PLMN; - msgInfo.addressList[msgInfo.nAddressCnt-1].recipientType = MSG_RECIPIENTS_TYPE_TO; - strncpy(msgInfo.addressList[msgInfo.nAddressCnt-1].addressVal, pObject->pszValue[0], MAX_ADDRESS_VAL_LEN); + msgInfo.nAddressCnt++; + if (msgInfo.addressList == NULL) { + addrInfo = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S)); + } else { + addrInfo = (MSG_ADDRESS_INFO_S *)realloc(msgInfo.addressList, msgInfo.nAddressCnt * sizeof(MSG_ADDRESS_INFO_S)); } - break; + + if (addrInfo == NULL) { + vmsg_free_vtree_memory(vMsg); + err = MSG_ERR_STORAGE_ERROR; + goto __RETURN; + } + + msgInfo.addressList = addrInfo; + + msgInfo.addressList[msgInfo.nAddressCnt-1].addressType = MSG_ADDRESS_TYPE_PLMN; + msgInfo.addressList[msgInfo.nAddressCnt-1].recipientType = MSG_RECIPIENTS_TYPE_TO; + strncpy(msgInfo.addressList[msgInfo.nAddressCnt-1].addressVal, pObject->pszValue[0], MAX_ADDRESS_VAL_LEN); + } + break; } if (pObject->pSibling != NULL) @@ -980,9 +957,9 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id } } - msgInfo.bBackup = true; // Set Backup Flag - msgInfo.storageId = MSG_STORAGE_PHONE; // Set Storage Id - msgInfo.priority = MSG_MESSAGE_PRIORITY_NORMAL; // Set Priority + msgInfo.bBackup = true; /* Set Backup Flag */ + msgInfo.storageId = MSG_STORAGE_PHONE; /* Set Storage Id */ + msgInfo.priority = MSG_MESSAGE_PRIORITY_NORMAL; /* Set Priority */ err = MsgStoAddMessage(&msgInfo, NULL); if (err != MSG_SUCCESS) { @@ -1020,9 +997,8 @@ msg_error_t MsgStoRestoreMessage(const char *filepath, msg_id_list_s **result_id *result_id_list = msgIdList; __RETURN: - if(pData) - { - free( pData ); + if (pData) { + free(pData); pData = NULL; pCurrent = NULL; } @@ -1045,7 +1021,7 @@ msg_error_t MsgStoAddPushEvent(MSG_PUSH_EVENT_INFO_S* pPushEvent) memset(sqlQuery, 0x00, sizeof(sqlQuery)); - // Check whether Same record exists or not. + /* Check whether Same record exists or not. */ #if 0 snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE CONTENT_TYPE LIKE '%s' AND APP_ID LIKE '%s' AND (PKG_NAME LIKE '%s' OR SECURE = 1);", MSGFW_PUSH_CONFIG_TABLE_NAME, pPushEvent->contentType, pPushEvent->appId, pPushEvent->pkgName); diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 6c05b7d..9324ab6 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -99,7 +99,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS if (pMsg->msgId > 0) { rowId = pMsg->msgId; } else { - // get rowId + /* get rowId */ err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &rowId); if (err != MSG_SUCCESS) { dbHandle->endTrans(false); @@ -113,7 +113,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS char *pFileData = NULL; unique_ptr buf(&pFileData, unique_ptr_deleter); - // Get File Data + /* Get File Data */ if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { dbHandle->endTrans(false); @@ -129,7 +129,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS char *imsi = MsgSettingGetString(keyName); - // Add Message + /* 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');", @@ -178,9 +178,7 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS #if 0 /* In the case of MMS Message, load the MMS plugin to save MMS PDU */ if (pMsg->msgType.mainType == MSG_MMS_TYPE) { - if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { - MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); if (plg == NULL) { dbHandle->endTrans(false); @@ -207,7 +205,6 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS || pMsg->msgType.subType == MSG_RETRIEVE_MMS || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { - MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); err = MsgStoUpdateMMSMessage(pMsg); @@ -216,7 +213,6 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - } } } else if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) { @@ -237,7 +233,6 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS unique_ptr buf_mms(&pMmsSerializedData, unique_ptr_deleter); if (pMsg->msgType.subType != MSG_DELIVERYIND_MMS && pMsg->msgType.subType != MSG_READORGIND_MMS) { - MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_MMS_TYPE); if (plg == NULL) { @@ -258,26 +253,22 @@ msg_error_t MsgStoAddMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pS dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; } - -// if (pMsg->msgText[0] != '\0') { -// g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL); -// MSG_DEBUG("file size [%d]", fileSize); -// } +/* + * if (pMsg->msgText[0] != '\0') { + * g_file_get_contents((gchar*)pMsg->msgText, (gchar**)&pFileData, (gsize*)&fileSize, NULL); + * MSG_DEBUG("file size [%d]", fileSize); + * } + */ if (pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MMS || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS - || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) - { + || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { MSG_DEBUG("pMsg->msgText: %s, pMsg->thumbPath: %s ", pMsg->msgText, pMsg->thumbPath); - err = MsgStoUpdateMMSMessage(pMsg); } - } } else { - - // Get File Data if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { dbHandle->endTrans(false); @@ -326,7 +317,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S prevType = dbHandle->columnInt(0); dbHandle->finalizeQuery(); - //check msg type with previous type + /* check msg type with previous type */ if (prevType != pMsg->msgType.mainType) { MSG_DEBUG("different msg type to update [prev : %d], [current : %d]", prevType, pMsg->msgType.mainType); @@ -361,7 +352,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S char *pFileData = NULL; unique_ptr buf(&pFileData, unique_ptr_deleter); - // Get File Data + /* Get File Data */ if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { dbHandle->endTrans(false); @@ -370,7 +361,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S } if (pSendOptInfo != NULL) { - // Get Global setting value if bSetting == false + /* Get Global setting value if bSetting == false */ if (pSendOptInfo->bSetting == false) { MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy); @@ -397,7 +388,7 @@ msg_error_t MsgStoUpdateMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S } } - // Update Message + /* Update Message */ 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, \ @@ -512,7 +503,7 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead) if (bRead == true) { #ifndef FEATURE_SMS_CDMA - // Get STORAGE_ID + /* Get STORAGE_ID */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT STORAGE_ID FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); @@ -530,7 +521,7 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead) MSG_DEBUG("StorageId:[%d]", storageId); - // Update Read Status for SIM Msg + /* Update Read Status for SIM Msg */ if (storageId == MSG_STORAGE_SIM) { MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); @@ -539,7 +530,7 @@ msg_error_t MsgStoUpdateReadStatus(msg_message_id_t msgId, bool bRead) return MSG_ERR_NULL_POINTER; } - // Get SIM Msg ID + /* Get SIM Msg ID */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); @@ -611,7 +602,7 @@ msg_error_t MsgStoUpdateThreadReadStatus(msg_thread_id_t threadId, msg_id_list_s dbHandle->freeTable(); /*** **/ - // set read status + /* set read status */ dbHandle->beginTrans(); memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET READ_STATUS = %d " @@ -669,7 +660,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) char sqlQuery[MAX_QUERY_LEN+1]; MsgDbHandler *dbHandle = getDbHandle(); - // delete report notification + /* delete report notification */ char tempAddr[MAX_ADDRESS_VAL_LEN+1]; memset(tempAddr, 0x00, sizeof(tempAddr)); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -692,7 +683,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) dbHandle->finalizeQuery(); - // Get SUB_TYPE, STORAGE_ID + /* Get SUB_TYPE, STORAGE_ID */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, STORAGE_ID, READ_STATUS, CONV_ID, SIM_INDEX \ FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); @@ -739,13 +730,13 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) dbHandle->beginTrans(); #ifndef FEATURE_SMS_CDMA - // Check sim message + /* Check sim message */ if (storageId == MSG_STORAGE_SIM) { msg_sim_id_t simMsgId; msg_sim_slot_id_t sim_idx; while (true) { - // get sim message id + /* get sim message id */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); @@ -776,7 +767,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) dbHandle->finalizeQuery(); - //Sim message delete in db table + /*Sim message delete in db table */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE SIM_ID = %d AND SIM_SLOT_ID =%d;", MSGFW_SIM_MSG_TABLE_NAME, simMsgId, sim_idx); @@ -796,7 +787,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_SENDOPT_TABLE_NAME, msgId); - // Delete SMS Send Option + /* Delete SMS Send Option */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -806,7 +797,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_REPORT_TABLE_NAME, msgId); - // Delete Data from SMS_REPORT table + /* Delete Data from SMS_REPORT table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -817,7 +808,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_CB_MSG_TABLE_NAME, msgId); - // Delete Push Message from push table + /* Delete Push Message from push table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -827,7 +818,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgId); - // Delete Push Message from push table + /* Delete Push Message from push table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -837,49 +828,46 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SYNCML_MSG_TABLE_NAME, msgId); - // Delete SyncML Message from syncML table + /* Delete SyncML Message from syncML table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } } else if (msgType.mainType == MSG_MMS_TYPE) { + char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0, }; + char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0, }; - char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; - char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,}; - - {//remove multipart - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;", - MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); + /*remove multipart */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;", + MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); - if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle->endTrans(false); - return MSG_ERR_DB_PREPARE; - } + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; + } - while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - memset(filePath, 0x00, sizeof(filePath)); - strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); - if (remove(filePath) == -1) - MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); - else - MSG_SEC_DEBUG("Success to delete file [%s]", filePath); - } - dbHandle->finalizeQuery(); + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + memset(filePath, 0x00, sizeof(filePath)); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + dbHandle->finalizeQuery(); - // Delete Data from Multipart table - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", - MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); + /* Delete Data from Multipart table */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", + MSGFW_MMS_MULTIPART_TABLE_NAME, msgId); - if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle->endTrans(false); - return MSG_ERR_DB_EXEC; - } + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_EXEC; } - memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); @@ -912,7 +900,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) dbHandle->finalizeQuery(); - // remove thumbnail file + /* remove thumbnail file */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT VALUE FROM %s " @@ -948,7 +936,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId); - // Delete Data from MMS table + /* Delete Data from MMS table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -958,7 +946,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_REPORT_TABLE_NAME, msgId); - // Delete Data from MMS STATUS table + /* Delete Data from MMS STATUS table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -968,7 +956,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); - // Delete Message from msg table + /* Delete Message from msg table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -978,7 +966,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_UNIQUENESS_INFO_TABLE_NAME, msgId); - // Delete Message from uniqueness table + /* Delete Message from uniqueness table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; @@ -986,13 +974,13 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) #endif if (convId > 0) { - // Clear Conversation table + /* Clear Conversation table */ if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - // Update conversation table. + /* Update conversation table. */ if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_STORAGE_ERROR; @@ -1003,7 +991,7 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) if (msgType.mainType == MSG_SMS_TYPE && folderId == MSG_INBOX_ID) { msgType.classType = MSG_CLASS_NONE; - // Set memory status in SIM + /* Set memory status in SIM */ if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) { MSG_DEBUG("Set Memory Status"); @@ -1045,7 +1033,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD int rowCnt = 0; MsgDbHandler *dbHandle = getDbHandle(); - // Get conversation ID from Folder + /* Get conversation ID from Folder */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE FOLDER_ID = %d", @@ -1140,8 +1128,8 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD goto FREE_MEMORY; } - //Delete phone log -// MsgDeletePhoneLog(dbHandle->getColumnToInt(i)); + /*Delete phone log */ +/* MsgDeletePhoneLog(dbHandle->getColumnToInt(i)); */ } dbHandle->freeTable(); @@ -1151,45 +1139,42 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD for (int i = 0; i < listCnt; i++) { if (!strcmp(tableList[i], MMS_PLUGIN_MESSAGE_TABLE_NAME)) { - int rowCnt = 0; - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; - char dirPath[MSG_FILEPATH_LEN_MAX] = {0,}; - - {//remove multipart - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s;", - MSGFW_MMS_MULTIPART_TABLE_NAME); + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; + char dirPath[MSG_FILEPATH_LEN_MAX] = {0, }; + /* remove multipart */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s;", + MSGFW_MMS_MULTIPART_TABLE_NAME); - if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { - dbHandle->endTrans(false); - return MSG_ERR_DB_PREPARE; - } + if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + dbHandle->endTrans(false); + return MSG_ERR_DB_PREPARE; + } - while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - memset(filePath, 0x00, sizeof(filePath)); - strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); - if (remove(filePath) == -1) - MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); - else - MSG_SEC_DEBUG("Success to delete file [%s]", filePath); - } - dbHandle->finalizeQuery(); + while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { + memset(filePath, 0x00, sizeof(filePath)); + strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); + if (remove(filePath) == -1) + MSG_SEC_DEBUG("Fail to delete file [%s]", filePath); + else + MSG_SEC_DEBUG("Success to delete file [%s]", filePath); + } + dbHandle->finalizeQuery(); - // Delete Data from Multipart table - memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", - MSGFW_MMS_MULTIPART_TABLE_NAME); + /* Delete Data from Multipart table */ + memset(sqlQuery, 0x00, sizeof(sqlQuery)); + snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", + MSGFW_MMS_MULTIPART_TABLE_NAME); - if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { - err = MSG_ERR_DB_EXEC; - dbHandle->endTrans(false); - goto FREE_MEMORY; - } + if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { + err = MSG_ERR_DB_EXEC; + dbHandle->endTrans(false); + goto FREE_MEMORY; } - //get mms msg id list + /*get mms msg id list */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT B.FILE_PATH FROM %s A, %s B \ WHERE A.FOLDER_ID = %d AND A.MAIN_TYPE = %d AND A.MSG_ID = B.MSG_ID", @@ -1208,13 +1193,12 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD } for (int i = 1; i <= rowCnt; i++) { - memset(filePath, 0x00, sizeof(filePath)); dbHandle->getColumnToString(i, MSG_FILEPATH_LEN_MAX, filePath); MSG_SEC_DEBUG("filePath [%s]", filePath); - //delete raw file + /*delete raw file */ snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); if (remove(filePath) == -1) @@ -1225,14 +1209,13 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD MsgRmRf(dirPath); rmdir(dirPath); - } dbHandle->freeTable(); } - // delete thumbnail - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + /* delete thumbnail */ + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT VALUE FROM %s " @@ -1262,7 +1245,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD (SELECT MSG_ID FROM %s WHERE FOLDER_ID = %d);", tableList[i], MSGFW_MESSAGE_TABLE_NAME, folderId); - // Delete Message in specific folder from table + /* Delete Message in specific folder from table */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { MSG_DEBUG("sqlQuery [%s]", sqlQuery); dbHandle->endTrans(false); @@ -1272,7 +1255,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD } } - // Clear Conversation table + /* Clear Conversation table */ if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { dbHandle->endTrans(false); err = MSG_ERR_DB_EXEC; @@ -1280,7 +1263,7 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD goto FREE_MEMORY; } - // Update Address + /* Update Address */ while (!threadList.empty()) { err = MsgStoUpdateConversation(dbHandle, threadList.front()); @@ -1295,35 +1278,29 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD dbHandle->endTrans(true); -/*** Set pMsgIdList **/ + /* Set pMsgIdList */ if (pMsgIdList != NULL && pToDeleteMsgIdList->nCount > 0) { pMsgIdList->nCount = pToDeleteMsgIdList->nCount; pMsgIdList->msgIdList = (msg_message_id_t *)new char[sizeof(msg_message_id_t)*pToDeleteMsgIdList->nCount]; memcpy(pMsgIdList->msgIdList, pToDeleteMsgIdList->msgIdList, sizeof(msg_message_id_t)*pToDeleteMsgIdList->nCount); } -/*** **/ -/*** Create thread for noti and phone log delete. **/ + /* Create thread for noti and phone log delete. */ if (!bOnlyDB) { if (pToDeleteMsgIdList->nCount > 0) { -// if (g_idle_add(startToDeletePhoneLog, (void *)pToDeleteMsgIdList) == 0) { -// MSG_DEBUG("startToDeletePhoneLog not invoked: %s", strerror(errno)); - // memory free - if (pToDeleteMsgIdList != NULL) { - //free peer info list - if (pToDeleteMsgIdList->msgIdList != NULL) - delete [] pToDeleteMsgIdList->msgIdList; - - delete [] pToDeleteMsgIdList; - } -// err = MSG_ERR_UNKNOWN; -// } + /* memory free */ + if (pToDeleteMsgIdList != NULL) { + /*free peer info list */ + if (pToDeleteMsgIdList->msgIdList != NULL) + delete [] pToDeleteMsgIdList->msgIdList; + + delete [] pToDeleteMsgIdList; + } MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE); } } -/*** **/ return MSG_SUCCESS; @@ -1335,9 +1312,9 @@ FREE_MEMORY: threadList.pop(); } - // memory free + /* memory free */ if (pToDeleteMsgIdList != NULL) { - //free peer info list + /*free peer info list */ if (pToDeleteMsgIdList->msgIdList != NULL) delete [] pToDeleteMsgIdList->msgIdList; @@ -1345,7 +1322,6 @@ FREE_MEMORY: } return err; - } @@ -1385,7 +1361,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) MsgDbHandler *dbHandle = getDbHandle(); dbHandle->beginTrans(); - // reset msgid temp table + /* reset msgid temp table */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", MSGFW_TMP_MSGID_TABLE_NAME); MSG_DEBUG("[%s]", sqlQuery); @@ -1449,7 +1425,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) } dbHandle->freeTable(); - // delete report notification + /* delete report notification */ char tempAddr[MAX_ADDRESS_VAL_LEN+1]; while (!threadList1.empty()) { memset(tempAddr, 0x00, sizeof(tempAddr)); @@ -1497,14 +1473,12 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) } } dbHandle->freeTable(); - /*** **/ dbHandle->beginTrans(); for (int i = 0; i < listCnt; i++) { if ( !i ) { - - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; - char dirPath[MSG_FILEPATH_LEN_MAX] = {0,}; + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; + char dirPath[MSG_FILEPATH_LEN_MAX] = {0, }; rowCnt = 0; @@ -1525,7 +1499,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) MSG_SEC_DEBUG("filePath [%s]", filePath); - // Delete raw file. + /* Delete raw file. */ snprintf(dirPath, sizeof(dirPath), "%s.dir", filePath); if (remove(filePath) == -1) @@ -1540,8 +1514,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) dbHandle->freeTable(); } else if (i == 1) { - - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; rowCnt = 0; @@ -1568,8 +1541,8 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) } dbHandle->freeTable(); } else if (!strcmp(tableList[i], MSGFW_MMS_MULTIPART_TABLE_NAME)) { - // MMS file path to delete. - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + /* MMS file path to delete. */ + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; rowCnt = 0; @@ -1597,7 +1570,7 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) } dbHandle->freeTable(); - // MMS thumbnail path to delete + /* MMS thumbnail path to delete */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT THUMB_FILE_PATH FROM %s WHERE MSG_ID IN %s;", MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_TMP_MSGID_TABLE_NAME); @@ -1627,18 +1600,18 @@ msg_error_t MsgStoDeleteMessageByList(msg_id_list_s *pMsgIdList) memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN %s;", tableList[i], MSGFW_TMP_MSGID_TABLE_NAME); - // Delete Message in specific folder from table + /* Delete Message in specific folder from table */ err = dbHandle->execQuery(sqlQuery); if (err != MSG_SUCCESS) { MSG_DEBUG("Fail to execQuery()."); } } - // Clear Conversation table + /* Clear Conversation table */ err = MsgStoClearConversationTable(dbHandle); if (err != MSG_SUCCESS) MSG_DEBUG("Fail to MsgStoClearConversationTable()."); - // Update Address + /* Update Address */ while (!threadList2.empty()) { err = MsgStoUpdateConversation(dbHandle, threadList2.front()); if (err != MSG_SUCCESS) MSG_DEBUG("Fail to MsgStoUpdateConversation()."); @@ -1720,9 +1693,8 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t MSG_DEBUG("msgId : %d, destStorageId : %d", msgId, destStorageId); switch (destStorageId) { - case MSG_STORAGE_SIM : // Move message to sim card - case MSG_STORAGE_SIM2 : - { + case MSG_STORAGE_SIM : /* Move message to sim card */ + case MSG_STORAGE_SIM2 : { MSG_MESSAGE_INFO_S msgInfo; SMS_SIM_ID_LIST_S simIdList; @@ -1774,8 +1746,7 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t } break; - default: //Moving message to memory (when destination storage id is MSG_STORAGE_PHONE) - { + default: { /* Moving message to memory (when destination storage id is MSG_STORAGE_PHONE) */ #ifndef FEATURE_SMS_CDMA bool bSimMsg = false; int rowCnt = 0; @@ -1803,7 +1774,7 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t msg_sim_id_t simMsgId; msg_sim_slot_id_t sim_idx; - // get sim message id + /* get sim message id */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT SIM_SLOT_ID, SIM_ID FROM %s WHERE MSG_ID = %d;", @@ -1819,7 +1790,7 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t return err; } - //Delete messages in sim card + /* Delete messages in sim card */ MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(MSG_SMS_TYPE); if (plg == NULL) { MSG_DEBUG("SMS Plug-in is NULL"); @@ -1843,7 +1814,7 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t dbHandle->beginTrans(); - //Delete Messages in SIM Msg table + /* Delete Messages in SIM Msg table */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId); @@ -1854,7 +1825,7 @@ msg_error_t MsgStoMoveMessageToStorage(msg_message_id_t msgId, msg_storage_id_t return MSG_ERR_DB_EXEC; } - //Move storage id + /* Move storage id */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET STORAGE_ID = %d WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, destStorageId, msgId); @@ -1946,19 +1917,19 @@ msg_error_t MsgStoCountMsgByType(const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCo memset(sqlQuery, 0x00, sizeof(sqlQuery)); MsgDbHandler *dbHandle = getDbHandle(); - // SMS + /* SMS */ if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_NORMAL_SMS || pMsgType->subType == MSG_STATUS_REPORT_SMS || pMsgType->subType == MSG_CONCAT_SIM_SMS)) { snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d);", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_NORMAL_SMS, MSG_STATUS_REPORT_SMS, MSG_CONCAT_SIM_SMS); } else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_WAP_SI_SMS || pMsgType->subType == MSG_WAP_SL_SMS)) { - // PUSH + /* PUSH */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d);", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS); } else if ((pMsgType->mainType == MSG_MMS_TYPE) && (pMsgType->subType == MSG_SENDREQ_MMS || pMsgType->subType == MSG_SENDCONF_MMS || pMsgType->subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgType->subType == MSG_RETRIEVE_MANUALCONF_MMS)) { - // MMS + /* MMS */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d, %d);", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SENDREQ_MMS, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS); } else { @@ -2010,7 +1981,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M pMsg->bProtected = dbHandle->columnInt(10); pMsg->bBackup = dbHandle->columnInt(11); pMsg->priority = dbHandle->columnInt(12); - pMsg->direction= dbHandle->columnInt(13); + pMsg->direction = dbHandle->columnInt(13); strncpy(pMsg->subject, (char *)dbHandle->columnText(15), MAX_SUBJECT_LEN); @@ -2022,7 +1993,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M strncpy(msgData, (char *)dbHandle->columnText(16), pMsg->dataSize); - // Save Message Data into File + /* Save Message Data into File */ char fileName[MSG_FILENAME_LEN_MAX+1]; memset(fileName, 0x00, sizeof(fileName)); @@ -2045,7 +2016,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M memset(pMsg->msgText, 0x00, sizeof(pMsg->msgText)); strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), pMsg->dataSize); - // For WAP PUSH SI Message + /* For WAP PUSH SI Message */ if (pMsg->msgType.subType == MSG_WAP_SI_SMS) { strncat(pMsg->msgText, "\n", MAX_MSG_TEXT_LEN-strlen(pMsg->msgText)); strncat(pMsg->msgText, pMsg->subject, MAX_MSG_TEXT_LEN-strlen(pMsg->msgText)); @@ -2060,7 +2031,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M strncpy(pMsg->msgText, (char *)dbHandle->columnText(16), MAX_MSG_TEXT_LEN); } - // thumbnail path + /* thumbnail path */ if (dbHandle->columnText(17)!= NULL && ((char *)dbHandle->columnText(17))[0] != '\0') { strncpy(pMsg->thumbPath, (char *)dbHandle->columnText(17), MSG_FILEPATH_LEN_MAX); MSG_DEBUG("pMsg->thumbPath : [%s]", pMsg->thumbPath); @@ -2075,24 +2046,22 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M dbHandle->finalizeQuery(); - // get address information. - //contacts-service is not used for gear - //contactNameOrder is never used + /* get address information. */ + /*contacts-service is not used for gear */ + /*contactNameOrder is never used */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED MsgStoGetAddressByMsgId(dbHandle, pMsg->msgId, MsgGetContactNameOrder(), &pMsg->nAddressCnt, &pMsg->addressList); -#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED -// MsgStoGetAddressByMsgId(dbHandle, pMsg->msgId, &pMsg->nAddressCnt, &pMsg->addressList); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ - // Get MMS body if it is MMS. + /* Get MMS body if it is MMS. */ if ((pMsg->networkStatus == MSG_NETWORK_RETRIEVE_SUCCESS && (pMsg->msgType.subType == MSG_RETRIEVE_MMS || pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)) || pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_SENDCONF_MMS || pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) { msg_error_t err = MSG_SUCCESS; char *pDestMsg = NULL; - int temp_size = pMsg->dataSize;//save raw file size; + int temp_size = pMsg->dataSize; /* save raw file size; */ - // call mms plugin to get mms specific message data + /* call mms plugin to get mms specific message data */ MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(pMsg->msgType.mainType); if (plg == NULL) { MSG_DEBUG("SMS Plug-in is NULL"); @@ -2110,15 +2079,15 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M memset(pMsg->msgData, 0, MAX_MSG_DATA_LEN+1); - // Encode MMS specific data to MMS_MESSAGE_DATA_S + /* Encode MMS specific data to MMS_MESSAGE_DATA_S */ if (pMsg->dataSize > MAX_MSG_DATA_LEN) { - // Save Message Data into File + /* Save Message Data into File */ char tempFileName[MSG_FILENAME_LEN_MAX+1]; memset(tempFileName, 0x00, sizeof(tempFileName)); if (MsgCreateFileName(tempFileName) == false) { if(pDestMsg) { - free (pDestMsg); + free(pDestMsg); pDestMsg = NULL; } return MSG_ERR_STORAGE_ERROR; @@ -2127,7 +2096,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M if (MsgWriteIpcFile(tempFileName, pDestMsg, pMsg->dataSize) == false) { if(pDestMsg) { - free (pDestMsg); + free(pDestMsg); pDestMsg = NULL; } return MSG_ERR_STORAGE_ERROR; @@ -2139,7 +2108,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M pMsg->bTextSms = true; } - pMsg->dataSize = temp_size;//raw file size; + pMsg->dataSize = temp_size; /*raw file size; */ if (pDestMsg) { free(pDestMsg); @@ -2147,7 +2116,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M } } - // Get SMS Sending Options + /* Get SMS Sending Options */ if (pMsg->msgType.mainType == MSG_SMS_TYPE && pSendOptInfo != NULL) MsgStoGetSmsSendOpt(pMsg, pSendOptInfo); @@ -2170,14 +2139,14 @@ msg_error_t MsgStoGetFailedMessage(int **failed_msg_list, int *count) MSGFW_MESSAGE_TABLE_NAME, MSG_NETWORK_SEND_PENDING, MSG_NETWORK_RETRIEVE_PENDING, MSG_OUTBOX_ID, MSG_INBOX_ID); err = dbHandle->getTable(sqlQuery, &rowCnt, &index); - if(err == MSG_ERR_DB_NORECORD){ + if(err == MSG_ERR_DB_NORECORD) { dbHandle->freeTable(); return MSG_SUCCESS; } *count = rowCnt; int *list = new int[rowCnt]; - for(int i=0; igetColumnToInt(index++); } *failed_msg_list = list; @@ -2210,7 +2179,7 @@ msg_error_t MsgStoAddSyncMLMessage(MSG_MESSAGE_INFO_S *pMsgInfo, int extId, int } } - // Add Message Table + /* Add Message Table */ pMsgInfo->threadId = convId; rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo); @@ -2300,7 +2269,7 @@ msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t QPtype, MSG_MESSAGE_IN MSGFW_MESSAGE_TABLE_NAME, MSG_INBOX_ID, MSG_MMS_TYPE, MSG_NOTIFICATIONIND_MMS); } - // Get Message ID + /* Get Message ID */ msg_message_id_t msgId; if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) @@ -2315,7 +2284,7 @@ msg_error_t MsgStoGetQuickPanelData(msg_quickpanel_type_t QPtype, MSG_MESSAGE_IN dbHandle->finalizeQuery(); - // Get Message Info + /* Get Message Info */ err = MsgStoGetMessage(msgId, pMsg, NULL); return err; @@ -2410,7 +2379,7 @@ msg_error_t MsgStoSetTempAddressTable(const char *pSearchVal, int *count) unique_ptr buf(&pAddrInfo, unique_ptr_deleter); *count = 0; - // get contact search list + /* get contact search list */ if (MsgGetContactSearchList(pSearchVal, &pAddrInfo, count) != MSG_SUCCESS) { MSG_DEBUG("MsgGetContactSearchList fail."); *count = 0; @@ -2424,7 +2393,7 @@ msg_error_t MsgStoSetTempAddressTable(const char *pSearchVal, int *count) char sqlQuery[MAX_QUERY_LEN+1]; dbHandle->beginTrans(); - // reset address temp table + /* reset address temp table */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s;", MSGFW_ADDRESS_TEMP_TABLE_NAME); MSG_DEBUG("[%s]", sqlQuery); @@ -2479,17 +2448,17 @@ msg_error_t MsgStoCountMsgByContact(const MSG_THREAD_LIST_INDEX_S *pAddrInfo, MS if (pAddrInfo->contactId > 0) { snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) AS TOTAL, \ - SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ - SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ - SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ + SUM(CASE WHEN READ_STATUS = 0 AND FOLDER_ID = %d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE = %d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE = %d THEN 1 ELSE 0 END) \ FROM (SELECT * FROM %s A JOIN %s B ON A.CONV_ID = B.CONV_ID WHERE B.CONTACT_ID = %d)", MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->contactId); } else { snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(*) AS TOTAL, \ - SUM(CASE WHEN READ_STATUS=0 AND FOLDER_ID=%d THEN 1 ELSE 0 END), \ - SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END), \ - SUM(CASE WHEN MAIN_TYPE=%d THEN 1 ELSE 0 END) \ - FROM (SELECT * FROM %s A JOIN %s B ON A.CONV_ID = B.CONV_ID WHERE B.ADDRESS_VAL = '%s')", + SUM(CASE WHEN READ_STATUS = 0 AND FOLDER_ID = %d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE = %d THEN 1 ELSE 0 END), \ + SUM(CASE WHEN MAIN_TYPE = %d THEN 1 ELSE 0 END) \ + FROM (SELECT * FROM %s A JOIN %s B ON A.CONV_ID = B.CONV_ID WHERE B.ADDRESS_VAL = '%s')", MSG_INBOX_ID, MSG_SMS_TYPE, MSG_MMS_TYPE, MSGFW_MESSAGE_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, pAddrInfo->msgAddrInfo.addressVal); } @@ -2602,11 +2571,10 @@ msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REP dbHandle->finalizeQuery(); - if (direction == MSG_DIRECTION_TYPE_MO) {//get received report list of MO message - + if (direction == MSG_DIRECTION_TYPE_MO) {/*get received report list of MO message */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); - //MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME) - //select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC; + /*MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME) */ + /*select * from MSG_REPORT_TABLE where MSG_ID=38 order by ADDRESS_VAL DESC, STATUS_TYPE ASC; */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_VAL, STATUS_TYPE, STATUS, TIME " "FROM %s " @@ -2634,15 +2602,14 @@ msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REP report_status[i].status = dbHandle->getColumnToInt(index++); report_status[i].statusTime = (time_t)dbHandle->getColumnToInt(index++); - MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i+1, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime ); + MSG_DEBUG("(%d/%d) addr = %s, report_type = %d, report_status = %d, report_time = %d", i+1, rowCnt, report_status[i].addressVal, report_status[i].type, report_status[i].status, report_status[i].statusTime); } *pReportStatus = report_status; dbHandle->freeTable(); - } else if (direction == MSG_DIRECTION_TYPE_MT) {//read report sent status of MT message - + } else if (direction == MSG_DIRECTION_TYPE_MT) { /*read report sent status of MT message */ int readReportSentStatus; if (MsgStoCheckReadReportRequested(dbHandle, msgId) == false) { @@ -2666,8 +2633,6 @@ msg_error_t MsgStoGetMmsReportStatus(msg_message_id_t msgId, int *count, MSG_REP MSG_DEBUG("report_type = %d, report_status = %d", report_status->type, report_status->status); *pReportStatus = report_status; - - } return MSG_SUCCESS; @@ -2681,7 +2646,7 @@ msg_error_t MsgStoGetThreadIdByAddress(const MSG_MESSAGE_INFO_S *pMsg, msg_threa if (MsgExistAddress(dbHandle, pMsg, pThreadId) == true) { MSG_DEBUG("Conversation ID : [%d]", *pThreadId); - // check thread count + /* check thread count */ MSG_THREAD_VIEW_S threadInfo; memset(&threadInfo, 0x00, sizeof(MSG_THREAD_VIEW_S)); MsgStoGetThreadInfo(*pThreadId, &threadInfo); @@ -2707,7 +2672,7 @@ msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t threadId, int *cnt) char sqlQuery[MAX_QUERY_LEN+1]; - // Get MSG_ID + /* Get MSG_ID */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s A \ WHERE CONV_ID = %d AND READ_STATUS = 0;", MSGFW_MESSAGE_TABLE_NAME, threadId); @@ -2820,24 +2785,24 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S char sqlQuery[MAX_QUERY_LEN+1]; if(MsgExistConversation(dbHandle, pMsg->threadId)) { - // add message to address table which having same thread_id and datetime; + /* add message to address table which having same thread_id and datetime; */ for (int i = 0; i < pMsg->nAddressCnt; i++) { if(MsgExistAddress(dbHandle, pMsg, pMsg->threadId, i) == false) { unsigned int addrId; MSG_CONTACT_INFO_S contactInfo; memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); - // Get Contact Info -// if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) { -// MSG_DEBUG("MsgGetContactInfo() fail."); -// } + /* Get Contact Info */ +/* if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) { */ +/* MSG_DEBUG("MsgGetContactInfo() fail."); */ +/* } */ err = dbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, &addrId); if (err != MSG_SUCCESS) { MSG_DEBUG("pDbHandle->getRowId fail. [%d]", err); return err; } - // Add Address + /* Add Address */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, '%s', %d, %d, ?, ?, ?, ?, ?, '%s', 0);", MSGFW_ADDRESS_TABLE_NAME, addrId, pMsg->threadId, pMsg->addressList[i].addressType, pMsg->addressList[i].recipientType, pMsg->addressList[i].addressVal, @@ -2861,7 +2826,7 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S dbHandle->finalizeQuery(); - // set conversation display name by conv id + /* set conversation display name by conv id */ MsgStoSetConversationDisplayName(dbHandle, pMsg->threadId); } } @@ -2895,7 +2860,7 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S char *pFileData = NULL; unique_ptr buf(&pFileData, unique_ptr_deleter); - // Get File Data + /* Get File Data */ if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { return MSG_ERR_STORAGE_ERROR; @@ -2909,7 +2874,7 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S char *imsi = MsgSettingGetString(keyName); - // Add Message + /* 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');", @@ -2970,16 +2935,12 @@ msg_error_t MsgStoRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S if (err != MSG_SUCCESS) return MSG_ERR_STORAGE_ERROR; - } } } - } - } - else - { - // add message to conversation, message, address table; + } else { + /* add message to conversation, message, address table; */ pMsg->msgId = 0; err = MsgStoAddMessage(pMsg, pSendOptInfo); } @@ -3022,8 +2983,7 @@ msg_message_id_t MsgStoAddSimMessage(MSG_MESSAGE_INFO_S *pMsg, int *simIdList, i MSG_DEBUG("simIdList exist."); int simId = 0; - for(int i=0; i < listSize; ++i) - { + for(int i = 0; i < listSize; ++i) { if(simIdList[i]) { simId = simIdList[i] - 1; char sqlQuery[MAX_QUERY_LEN+1]; @@ -3104,7 +3064,7 @@ msg_error_t MsgStoUpdateIMSI(int sim_idx) MSG_BEGIN(); MSG_DEBUG("sim_idx = %d", sim_idx); -// msg_error_t err = MSG_SUCCESS; +/* msg_error_t err = MSG_SUCCESS; */ MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN+1]; @@ -3112,7 +3072,7 @@ msg_error_t MsgStoUpdateIMSI(int sim_idx) dbHandle->beginTrans(); - if(sim_idx == 0){ + if (sim_idx == 0) { MSG_DEBUG("sim index is 0"); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -3129,9 +3089,7 @@ msg_error_t MsgStoUpdateIMSI(int sim_idx) dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - } - else - { + } else { MSG_DEBUG("sim index is %d", sim_idx); memset(keyName, 0x00, sizeof(keyName)); diff --git a/framework/storage-handler/MsgStorageMms.cpp b/framework/storage-handler/MsgStorageMms.cpp index 1da8154..1c4014c 100755 --- a/framework/storage-handler/MsgStorageMms.cpp +++ b/framework/storage-handler/MsgStorageMms.cpp @@ -45,7 +45,6 @@ msg_error_t MsgStoGetText(msg_message_id_t msgId, char *pSubject, char *pMsgText return MSG_ERR_DB_PREPARE; if(dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - char *subject = (char*)dbHandle->columnText(0); char *text = (char*)dbHandle->columnText(1); @@ -61,7 +60,6 @@ msg_error_t MsgStoGetText(msg_message_id_t msgId, char *pSubject, char *pMsgText dbHandle->finalizeQuery(); return MSG_SUCCESS; - } @@ -180,7 +178,7 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if(pMsg->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsg->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { if (pMsg->addressList) { if (pMsg->nAddressCnt == 1) { - char tmpAddressVal[MAX_ADDRESS_VAL_LEN+1] = {0,}; + char tmpAddressVal[MAX_ADDRESS_VAL_LEN+1] = {0, }; msg_address_type_t tmpAddressType; msg_recipient_type_t tmpRecipientType; int tmpConvId; @@ -219,7 +217,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) if (tmpAddressType != pMsg->addressList->addressType || tmpRecipientType != pMsg->addressList->recipientType || (strncmp(tmpAddressVal, pMsg->addressList->addressVal, MAX_ADDRESS_VAL_LEN) != 0)) { - MSG_WARN("AddressList of NotiInd and MMSConf are different!!, Replace AddressList to MMSConf data"); MSG_WARN("AddType [NotiInd : %d], [MMSConf : %d]", tmpAddressType, pMsg->addressList->addressType); MSG_WARN("RcptType [NotiInd : %d], [MMSConf : %d]", tmpRecipientType, pMsg->addressList->recipientType); @@ -338,7 +335,6 @@ msg_error_t MsgStoUpdateMMSMessage(MSG_MESSAGE_INFO_S *pMsg) MSG_DEBUG("Conversation id:[%d]", convId); if (convId > 0) { - if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) { MSG_DEBUG("MsgStoUpdateConversation() Error"); dbHandle->freeTable(); @@ -439,8 +435,7 @@ msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg) return err; } - for(int i = 0; i < rowCnt; i++) - { + for (int i = 0; i < rowCnt; i++) { pMsg->addressList[i].addressType = dbHandle->getColumnToInt(index++); pMsg->addressList[i].recipientType = dbHandle->getColumnToInt(index++); dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pMsg->addressList[i].addressVal); @@ -505,18 +500,17 @@ msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S return MSG_ERR_DB_GETTABLE; } - pRecipientList->recipientCnt= rowCnt; + pRecipientList->recipientCnt = rowCnt; MSG_DEBUG("pRecipientList->recipientCnt [%d]", pRecipientList->recipientCnt); - pRecipientList->recipientAddr= (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*rowCnt]; + pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*rowCnt]; MSG_ADDRESS_INFO_S* pTmp = pRecipientList->recipientAddr; - for (int i = 0; i < rowCnt; i++) - { + for (int i = 0; i < rowCnt; i++) { pTmp->addressType = dbHandle->getColumnToInt(index++); - pTmp->recipientType= dbHandle->getColumnToInt(index++); + pTmp->recipientType = dbHandle->getColumnToInt(index++); memset(pTmp->addressVal, 0x00, sizeof(pTmp->addressVal)); dbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pTmp->addressVal); diff --git a/framework/storage-handler/MsgStorageSim.cpp b/framework/storage-handler/MsgStorageSim.cpp index 72c934a..6370d10 100755 --- a/framework/storage-handler/MsgStorageSim.cpp +++ b/framework/storage-handler/MsgStorageSim.cpp @@ -45,7 +45,7 @@ msg_error_t MsgStoClearSimMessageInDB() queue threadList; - // Get Address ID of SIM Message + /* Get Address ID of SIM Message */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(CONV_ID) FROM %s WHERE STORAGE_ID = %d", @@ -66,8 +66,7 @@ msg_error_t MsgStoClearSimMessageInDB() return MSG_SUCCESS; } - for (int i = 1; i <= rowCnt; i++) - { + for (int i = 1; i <= rowCnt; i++) { MSG_DEBUG("thread ID : %d", dbHandle->getColumnToInt(i)); threadList.push((msg_thread_id_t)dbHandle->getColumnToInt(i)); } @@ -80,30 +79,28 @@ msg_error_t MsgStoClearSimMessageInDB() dbHandle->beginTrans(); - for (int i = 0; i < listCnt; i++) - { + for (int i = 0; i < listCnt; i++) { memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID IN \ (SELECT MSG_ID FROM %s WHERE STORAGE_ID = %d);", tableList[i], MSGFW_MESSAGE_TABLE_NAME, MSG_STORAGE_SIM); - // Delete SIM Message in tables + /* Delete SIM Message in tables */ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } } - // Clear Conversation table + /* Clear Conversation table */ if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) { dbHandle->endTrans(false); return MSG_ERR_DB_EXEC; } - // Update Address - while (!threadList.empty()) - { + /* Update Address */ + while (!threadList.empty()) { err = MsgStoUpdateConversation(dbHandle, threadList.front()); threadList.pop(); diff --git a/framework/storage-handler/MsgStorageUtil.cpp b/framework/storage-handler/MsgStorageUtil.cpp index 468300c..4dda840 100755 --- a/framework/storage-handler/MsgStorageUtil.cpp +++ b/framework/storage-handler/MsgStorageUtil.cpp @@ -207,8 +207,7 @@ msg_error_t MsgStoCleanAbnormalMmsData() } - for (int i = 0; i < rowCnt; i++) - { + for (int i = 0; i < rowCnt; i++) { memset(filePath, 0x00, sizeof(filePath)); msgId = dbHandle->getColumnToInt(index++); @@ -227,7 +226,6 @@ msg_error_t MsgStoCleanAbnormalMmsData() MsgStoDeleteMessage(msgId, false); } } - } dbHandle->freeTable(); @@ -268,7 +266,6 @@ msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s MsgSettingGetBool(MSG_AUTO_ERASE, &bAutoErase); if (bAutoErase) { - MSG_DEBUG("threadId [%d]", threadId); //msg_id_list_s msgIdList; @@ -361,10 +358,10 @@ msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s MSGFW_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, - MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt)>0)?(currentSmsCnt-limitSmsCnt):0, + MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt) > 0)?(currentSmsCnt-limitSmsCnt):0, MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_SPAMBOX_ID, MSG_STORAGE_PHONE, - MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt)>0)?(currentMmsCnt-limitMmsCnt):0); + MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt) > 0)?(currentMmsCnt-limitMmsCnt):0); #else snprintf(sqlQuery, sizeof(sqlQuery), "SELECT DISTINCT(MSG_ID) FROM %s " @@ -379,10 +376,10 @@ msg_error_t MsgStoAutoDeleteConversation(msg_thread_id_t threadId, msg_id_list_s MSGFW_MESSAGE_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, - MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt)>0)?(currentSmsCnt-limitSmsCnt):0, + MSG_SMS_TYPE, ((currentSmsCnt-limitSmsCnt) > 0)?(currentSmsCnt-limitSmsCnt):0, MSGFW_MESSAGE_TABLE_NAME, threadId, MSG_ALLBOX_ID, MSG_CBMSGBOX_ID, MSG_STORAGE_PHONE, - MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt)>0)?(currentMmsCnt-limitMmsCnt):0); + MSG_MMS_TYPE, MSG_DELIVERYIND_MMS, MSG_READRECIND_MMS, MSG_READORGIND_MMS, ((currentMmsCnt-limitMmsCnt) > 0)?(currentMmsCnt-limitMmsCnt):0); #endif err = dbHandle->getTable(sqlQuery, &rowCnt, &index); @@ -526,7 +523,6 @@ msg_error_t MsgStoAddWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) dbHandle->beginTrans(); if (pMsgInfo->nAddressCnt > 0) { - err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); if (err != MSG_SUCCESS) { @@ -605,7 +601,6 @@ msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) pPushMsg = (MSG_PUSH_CACHEOP_S*)pFileData; for (int i = 0; i < pPushMsg->invalObjectCnt; i++) { - int msgid = -1; memset(href, 0x00, sizeof(href)); @@ -619,7 +614,6 @@ msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) err = dbHandle->prepareQuery(sqlQuery); if ((dbHandle->stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) { - msgid = dbHandle->columnInt(0); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -663,7 +657,6 @@ msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) } for (int i = 0; i < pPushMsg->invalServiceCnt; i++) { - int msgid = -1; memset(href, 0x00, sizeof(href)); @@ -677,7 +670,6 @@ msg_error_t MsgStoAddCOWAPMsg(MSG_MESSAGE_INFO_S *pMsgInfo) err = dbHandle->prepareQuery(sqlQuery); if ((dbHandle->stepQuery() == MSG_ERR_DB_ROW) && err == MSG_SUCCESS) { - msgid = dbHandle->columnInt(0); memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -848,13 +840,12 @@ msg_error_t MsgStoUpdateAllAddress() if (err == MSG_ERR_DB_NORECORD) { dbHandle->freeTable(); return MSG_SUCCESS; - } else if ( err != MSG_SUCCESS) { + } else if (err != MSG_SUCCESS) { dbHandle->freeTable(); return err; } for (int i = 0; i < rowCnt; i++) { - err = MsgStoUpdateConversation(dbHandle, index++); if (err != MSG_SUCCESS) diff --git a/framework/submit-handler/MsgSubmitHandler.cpp b/framework/submit-handler/MsgSubmitHandler.cpp index aa52fdb..b1d21cb 100755 --- a/framework/submit-handler/MsgSubmitHandler.cpp +++ b/framework/submit-handler/MsgSubmitHandler.cpp @@ -50,16 +50,13 @@ msg_error_t MsgSubmitReq(MSG_REQUEST_INFO_S *pReqInfo, bool bScheduled) MSG_DEBUG("==== bSetting = [%d] ====", pReqInfo->sendOptInfo.bSetting); - if (pReqInfo->msgInfo.msgType.mainType == MSG_SMS_TYPE) - { + if (pReqInfo->msgInfo.msgType.mainType == MSG_SMS_TYPE) { MSG_DEBUG("==== deliver = [%d] ====", pReqInfo->sendOptInfo.bDeliverReq); MSG_DEBUG("==== keepcopy = [%d] ====", pReqInfo->sendOptInfo.bKeepCopy); MSG_DEBUG("==== bReplyPath = [%d] ====", pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath); err = MsgSubmitReqSMS(pReqInfo); - } - else if (pReqInfo->msgInfo.msgType.mainType == MSG_MMS_TYPE) - { + } else if (pReqInfo->msgInfo.msgType.mainType == MSG_MMS_TYPE) { MSG_DEBUG("==== deliver = [%d] ====", pReqInfo->sendOptInfo.bDeliverReq); MSG_DEBUG("==== keepcopy = [%d] ====", pReqInfo->sendOptInfo.bKeepCopy); MSG_DEBUG("==== bReadReq = [%d] ====", pReqInfo->sendOptInfo.option.mmsSendOptInfo.bReadReq); @@ -77,7 +74,7 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo) { msg_error_t err = MSG_SUCCESS; - // submit request based on msgType; + /* submit request based on msgType; */ MSG_MAIN_TYPE_T mainType = pReqInfo->msgInfo.msgType.mainType; MsgPlugin* plg = MsgPluginManager::instance()->getPlugin(mainType); @@ -88,8 +85,8 @@ msg_error_t MsgSubmitReqSMS(MSG_REQUEST_INFO_S *pReqInfo) return MSG_ERR_INVALID_PLUGIN_HANDLE; } - // If MSG ID > 0 -> MSG in DRAFT - // Move Folder to OUTBOX + /* If MSG ID > 0 -> MSG in DRAFT */ + /* Move Folder to OUTBOX */ if (pReqInfo->msgInfo.msgPort.valid == false) { pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; @@ -128,52 +125,46 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) } else if (pReqInfo->msgInfo.sim_idx != defaultNetworkSimId) { MSG_ERR("It is not default network SIM ID, request SIM=[%d], activated SIM=[%d]", pReqInfo->msgInfo.sim_idx, defaultNetworkSimId); return MSG_ERR_INVALID_PARAMETER; - } MSG_MAIN_TYPE_T msgMainType = pReqInfo->msgInfo.msgType.mainType; MsgPlugin *plg = MsgPluginManager::instance()->getPlugin(msgMainType); - if(!plg) - { + if(!plg) { MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); MSG_DEBUG("No Plugin for %d type", msgMainType); return MSG_ERR_INVALID_PLUGIN_HANDLE; } - // If MSG ID > 0 -> MSG in DRAFT - // Move Folder to OUTBOX + /* If MSG ID > 0 -> MSG in DRAFT */ + /* Move Folder to OUTBOX */ /* reject_msg_support */ MSG_DEBUG("Not scheduled MMS, pReqInfo->msgInfo.msgType.subType [%d]", pReqInfo->msgInfo.msgType.subType); - if(pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) - { + if(pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) { char fileName[MSG_FILENAME_LEN_MAX+1] = {0}; - // copy whole of MMS PDU filepath to msgData + /* copy whole of MMS PDU filepath to msgData */ strncpy(fileName, pReqInfo->msgInfo.msgData, MSG_FILENAME_LEN_MAX); memset(pReqInfo->msgInfo.msgData, 0x00, sizeof(pReqInfo->msgInfo.msgData)); snprintf(pReqInfo->msgInfo.msgData, sizeof(pReqInfo->msgInfo.msgData), "%s%s", MSG_IPC_DATA_PATH, fileName); MSG_SEC_DEBUG("JAVA MMS PDU filepath:%s", pReqInfo->msgInfo.msgData); - // submit request + /* submit request */ err = plg->submitReq(pReqInfo); - if(err != MSG_SUCCESS) - { + if(err != MSG_SUCCESS) { MSG_DEBUG("Update Network Status : [%d]", err); - MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo),MSG_NETWORK_SEND_FAIL); + MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); } return err; - } - else if((pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (pReqInfo->msgInfo.msgType.subType == MSG_FORWARD_MMS)) - { + } else if ((pReqInfo->msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (pReqInfo->msgInfo.msgType.subType == MSG_FORWARD_MMS)) { MSG_SEC_DEBUG("msgdata file path = [%s]", pReqInfo->msgInfo.msgData); - if(pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) { + if (pReqInfo->msgInfo.msgId > 0 && (pReqInfo->msgInfo.folderId == MSG_DRAFT_ID || pReqInfo->msgInfo.folderId == MSG_OUTBOX_ID)) { MSG_DEBUG("Not New Message."); pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; err = MsgStoUpdateMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)); @@ -183,21 +174,17 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) pReqInfo->msgInfo.folderId = MSG_OUTBOX_ID; err = MsgStoAddMessage(&(pReqInfo->msgInfo), &(pReqInfo->sendOptInfo)); } - } - else if(pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS) - { + } else if (pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS) { msg_read_report_status_t readStatus; err = MsgStoCheckReadReportStatus(pReqInfo->msgInfo.msgId); if(err != MSG_SUCCESS) { - MSG_INFO("msg id [%d], read report could NOT send [%d]", pReqInfo->msgInfo.msgId, err); return err; } memcpy(&readStatus, pReqInfo->msgInfo.msgData, sizeof(msg_read_report_status_t)); if (readStatus == MSG_READ_REPORT_REJECT_BY_USER) { - MSG_INFO("msg id [%d], read report reject by user", pReqInfo->msgInfo.msgId); err = MsgStoSetReadReportSendStatus(pReqInfo->msgInfo.msgId, MMS_RECEIVE_READ_REPORT_NO_SENT); @@ -212,39 +199,37 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) pReqInfo->msgInfo.nAddressCnt = pRecipientList.recipientCnt; pReqInfo->msgInfo.addressList = pRecipientList.recipientAddr; -// for(int i = 0; i < pRecipientList.recipientCnt; i++) -// { -// pReqInfo->msgInfo.addressList[i].addressType = pRecipientList.recipientAddr[i].addressType; -// pReqInfo->msgInfo.addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; -// pReqInfo->msgInfo.addressList[i].contactId = pRecipientList.recipientAddr[i].contactId; -// strncpy(pReqInfo->msgInfo.addressList[i].addressVal, pRecipientList.recipientAddr[i].addressVal, MAX_ADDRESS_VAL_LEN); -// } + /* + for(int i = 0; i < pRecipientList.recipientCnt; i++) + { + pReqInfo->msgInfo.addressList[i].addressType = pRecipientList.recipientAddr[i].addressType; + pReqInfo->msgInfo.addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; + pReqInfo->msgInfo.addressList[i].contactId = pRecipientList.recipientAddr[i].contactId; + strncpy(pReqInfo->msgInfo.addressList[i].addressVal, pRecipientList.recipientAddr[i].addressVal, MAX_ADDRESS_VAL_LEN); + } + */ char subject[MAX_SUBJECT_LEN+1]; err = MsgStoGetSubject(pReqInfo->msgInfo.msgId, subject); - if(err != MSG_SUCCESS) + if (err != MSG_SUCCESS) MSG_DEBUG("Getting subject returned not a MSG_SUCCESS"); strncpy(pReqInfo->msgInfo.subject, subject, MAX_SUBJECT_LEN); err = plg->composeReadReport(&(pReqInfo->msgInfo)); - } - else if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) - { + } else if (pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) { MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), pReqInfo->msgInfo.networkStatus); } /* reject_msg_support */ - if(err != MSG_SUCCESS) - { + if(err != MSG_SUCCESS) { MSG_DEBUG("Fail to Add/Update Message : MsgStoMoveMessageToFolder()/MsgStoAddMessage()"); return err; } - switch(pReqInfo->msgInfo.msgType.subType) - { + switch (pReqInfo->msgInfo.msgType.subType) { case MSG_SENDREQ_MMS: case MSG_FORWARD_MMS: MsgDeleteFile(pReqInfo->msgInfo.msgData); @@ -259,43 +244,39 @@ msg_error_t MsgSubmitReqMMS(MSG_REQUEST_INFO_S *pReqInfo) break; } - // update content location from db + /* update content location from db */ if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS) err = MsgStoGetContentLocation(&(pReqInfo->msgInfo)); /* reject_msg_support */ - else if(pReqInfo->msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) + else if (pReqInfo->msgInfo.msgType.subType == MSG_NOTIFYRESPIND_MMS) err = plg->updateRejectStatus(&(pReqInfo->msgInfo)); - /* reject_msg_support */ - // Check SIM is present or not + /* Check SIM is present or not */ char keyName[MAX_VCONFKEY_NAME_LEN]; memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx); MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); - if(simStatus == MSG_SIM_STATUS_NOT_FOUND) - { + if(simStatus == MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("SIM is not present..."); MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); return MSG_ERR_NO_SIM; } - if(err == MSG_SUCCESS) + if (err == MSG_SUCCESS) err = plg->submitReq(pReqInfo); - if(err == MSG_SUCCESS && ( pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS || pReqInfo->msgInfo.msgType.subType == MSG_READRECIND_MMS )) + if (err == MSG_SUCCESS && ( pReqInfo->msgInfo.msgType.subType == MSG_READREPLY_MMS || pReqInfo->msgInfo.msgType.subType == MSG_READRECIND_MMS )) MsgStoSetReadReportSendStatus(pReqInfo->msgInfo.msgId, MMS_RECEIVE_READ_REPORT_SENT); - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { if(pReqInfo->msgInfo.msgType.subType == MSG_RETRIEVE_MMS ) MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_RETRIEVE_FAIL); else MsgStoUpdateNetworkStatus(dbHandle, &(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL); } - return err; } @@ -316,21 +297,15 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status #ifdef MSG_MMS_KEEPCOPY MSG_SENDINGOPT_INFO_S sendOpt = {}; - if (msgType.mainType == MSG_MMS_TYPE) - { + if (msgType.mainType == MSG_MMS_TYPE) { if (MsgStoGetMmsSendOpt(MsgId, &sendOpt) == MSG_SUCCESS) - { bKeepCopy = sendOpt.bKeepCopy; - } else - { ret = MsgSettingGetBool(MSG_KEEP_COPY, &bKeepCopy); - } } - // Move Msg to SENTBOX - if (Status == MSG_NETWORK_SEND_SUCCESS) - { + /* Move Msg to SENTBOX */ + if (Status == MSG_NETWORK_SEND_SUCCESS) { MSG_DEBUG("In Status == MSG_NETWORK_SEND_SUCCESS and bKeepCopy is [%d]", bKeepCopy); if (bKeepCopy == true) err = MsgStoMoveMessageToFolder(MsgId, MSG_SENTBOX_ID); @@ -338,9 +313,8 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status err = MsgStoDeleteMessage(MsgId, false); } #else - // Move Msg to SENTBOX - if (Status == MSG_NETWORK_SEND_SUCCESS) - { + /* Move Msg to SENTBOX */ + if (Status == MSG_NETWORK_SEND_SUCCESS) { MSG_DEBUG("In Status == MSG_NETWORK_SEND_SUCCESS and bKeepCopy is [%d]", bKeepCopy); if (bKeepCopy == true) err = MsgStoMoveMessageToFolder(MsgId, MSG_SENTBOX_ID); @@ -356,10 +330,10 @@ void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *p memset(pDest, 0x00, sizeof(MSG_REQUEST_INFO_S)); - // Copy Request ID + /* Copy Request ID */ pDest->reqId = pSrc->reqId; - // Copy Msg Info + /* Copy Msg Info */ pDest->msgInfo.msgId = pSrc->msgInfo.msgId; pDest->msgInfo.threadId = pSrc->msgInfo.threadId; @@ -393,8 +367,7 @@ void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *p pDest->msgInfo.msgPort.valid = pSrc->msgInfo.msgPort.valid; - if (pDest->msgInfo.msgPort.valid == true) - { + if (pDest->msgInfo.msgPort.valid == true) { pDest->msgInfo.msgPort.dstPort = pSrc->msgInfo.msgPort.dstPort; pDest->msgInfo.msgPort.srcPort = pSrc->msgInfo.msgPort.srcPort; } @@ -404,26 +377,21 @@ void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *p strncpy(pDest->msgInfo.msgData, pSrc->msgInfo.msgData, MAX_MSG_DATA_LEN); - if (pDest->msgInfo.bTextSms == true) - { + if (pDest->msgInfo.bTextSms == true) { memcpy(pDest->msgInfo.msgText, pSrc->msgInfo.msgText, pDest->msgInfo.dataSize); pDest->msgInfo.msgText[pDest->msgInfo.dataSize] = '\0'; } - // Set Sending Info + /* Set Sending Info */ pDest->sendOptInfo.bSetting = pSrc->sendOptInfo.bSetting; - if (pDest->sendOptInfo.bSetting == true) - { + if (pDest->sendOptInfo.bSetting == true) { pDest->sendOptInfo.bDeliverReq = pSrc->sendOptInfo.bDeliverReq; pDest->sendOptInfo.bKeepCopy = pSrc->sendOptInfo.bKeepCopy; - if (pDest->msgInfo.msgType.mainType == MSG_SMS_TYPE) - { + if (pDest->msgInfo.msgType.mainType == MSG_SMS_TYPE) { pDest->sendOptInfo.option.smsSendOptInfo.bReplyPath = pSrc->sendOptInfo.option.smsSendOptInfo.bReplyPath; - } - else if (pDest->msgInfo.msgType.mainType == MSG_MMS_TYPE) - { + } else if (pDest->msgInfo.msgType.mainType == MSG_MMS_TYPE) { pDest->sendOptInfo.option.mmsSendOptInfo.priority = pSrc->sendOptInfo.option.mmsSendOptInfo.priority; pDest->sendOptInfo.option.mmsSendOptInfo.bReadReq = pSrc->sendOptInfo.option.mmsSendOptInfo.bReadReq; diff --git a/framework/transaction-manager/MsgCmdHandlerFilter.cpp b/framework/transaction-manager/MsgCmdHandlerFilter.cpp index 319e708..ad4887e 100755 --- a/framework/transaction-manager/MsgCmdHandlerFilter.cpp +++ b/framework/transaction-manager/MsgCmdHandlerFilter.cpp @@ -36,22 +36,19 @@ int MsgAddFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Filter Structure + /* Get Filter Structure */ MSG_FILTER_S* pFilter = (MSG_FILTER_S*)pCmd->cmdData; - // Add Filter + /* Add Filter */ err = MsgStoAddFilter(pFilter); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoAddFilter()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoAddFilter()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_FILTER, err, (void**)ppEvent); return eventSize; @@ -69,22 +66,19 @@ int MsgUpdateFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Filter Structure + /* Get Filter Structure */ MSG_FILTER_S* pFilter = (MSG_FILTER_S*)pCmd->cmdData; - // Update Filter + /* Update Filter */ err = MsgStoUpdateFilter(pFilter); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateFilter()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateFilter()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_FILTER, err, (void**)ppEvent); return eventSize; @@ -102,24 +96,21 @@ int MsgDeleteFilterHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Filter Structure + /* Get Filter Structure */ msg_filter_id_t *pFilterId = (msg_filter_id_t *)pCmd->cmdData; MSG_DEBUG("Delete Filter id : %d", *pFilterId); - // Delete Filter + /* Delete Filter */ err = MsgStoDeleteFilter(*pFilterId); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoDeleteFilter()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoDeleteFilter()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_FILTER, err, (void**)ppEvent); return eventSize; @@ -137,7 +128,7 @@ int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Filter Structure + /* Get Filter Structure */ msg_filter_id_t *pFilterId = (msg_filter_id_t *)pCmd->cmdData; bool setFlag = false; @@ -146,19 +137,16 @@ int MsgSetFilterActivationHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Filter id : %d", *pFilterId); - // Delete Filter + /* Delete Filter */ err = MsgStoSetFilterActivation(*pFilterId, setFlag); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoSetFilterActivation()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoSetFilterActivation()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SET_FILTER_ACTIVATION, err, (void**)ppEvent); return eventSize; @@ -179,16 +167,15 @@ int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Filter List + /* Get Filter List */ msg_struct_list_s filterList; err = MsgStoGetFilterList(&filterList); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetFilterList()"); - // Encoding Filter List Data + /* Encoding Filter List Data */ dataSize = MsgEncodeFilterList(&filterList, &encodedData); if (filterList.msg_struct_info) { @@ -202,13 +189,11 @@ int MsgGetFilterListHandler(const MSG_CMD_S *pCmd, char **ppEvent) } g_free(filterList.msg_struct_info); } - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetFilterList()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FILTERLIST, err, (void**)ppEvent); return eventSize; @@ -226,24 +211,21 @@ int MsgSetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Filter Flag + /* Get Filter Flag */ bool setFlag = false; memcpy(&setFlag, pCmd->cmdData, sizeof(bool)); - // Add Filter + /* Add Filter */ err = MsgSetFilterOperation(setFlag); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgSetFilterOperation()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgSetFilterOperation()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SET_FILTER_OPERATION, err, (void**)ppEvent); return eventSize; @@ -264,24 +246,21 @@ int MsgGetFilterOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Filter List + /* Get Filter List */ bool setFlag = false; err = MsgGetFilterOperation(&setFlag); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgGetFilterOperation()"); - // Encoding Filter List Data + /* Encoding Filter List Data */ dataSize = MsgEncodeFilterFlag(&setFlag, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgFilterGetFilterList()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FILTER_OPERATION, err, (void**)ppEvent); return eventSize; diff --git a/framework/transaction-manager/MsgCmdHandlerSetting.cpp b/framework/transaction-manager/MsgCmdHandlerSetting.cpp index 7a25234..5b8301a 100755 --- a/framework/transaction-manager/MsgCmdHandlerSetting.cpp +++ b/framework/transaction-manager/MsgCmdHandlerSetting.cpp @@ -37,22 +37,19 @@ int MsgSetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; int eventType = -1; - // Get Setting Structure + /* Get Setting Structure */ MSG_SETTING_S* pSetting = (MSG_SETTING_S*)pCmd->cmdData; - // Set Config Data + /* Set Config Data */ err = MsgSetConfigData(pSetting); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgSetConfigData()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgSetConfigData()"); } - // Make Event Data + /* Make Event Data */ switch (pCmd->cmdType) { case MSG_CMD_SET_SMSC_OPT : eventType = MSG_EVENT_SET_SMSC_OPT; @@ -107,11 +104,11 @@ int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; int eventType = -1; - // Get Option Type + /* Get Option Type */ MSG_OPTION_TYPE_T type = 0; memcpy((void *)&type, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_OPTION_TYPE_T)); - // Get Config Data + /* Get Config Data */ MSG_SETTING_S setting; setting.type = type; @@ -135,85 +132,82 @@ int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MsgGetConfigData(&setting); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgGetConfigData()"); - // Encoding Config Data - switch (setting.type) - { - case MSG_GENERAL_OPT : - dataSize += sizeof(MSG_GENERAL_OPT_S); - break; - case MSG_SMS_SENDOPT : - dataSize += sizeof(MSG_SMS_SENDOPT_S); - break; - case MSG_SMSC_LIST : - dataSize += sizeof(MSG_SMSC_LIST_S); - break; - case MSG_MMS_SENDOPT : - dataSize += sizeof(MSG_MMS_SENDOPT_S); - break; - case MSG_MMS_RECVOPT : - dataSize += sizeof(MSG_MMS_RECVOPT_S); - break; - case MSG_MMS_STYLEOPT : - dataSize += sizeof(MSG_MMS_STYLEOPT_S); - break; - case MSG_PUSHMSG_OPT : - dataSize += sizeof(MSG_PUSHMSG_OPT_S); - break; - case MSG_CBMSG_OPT : - dataSize += sizeof(MSG_CBMSG_OPT_S); - break; - case MSG_VOICEMAIL_OPT : - dataSize += sizeof(MSG_VOICEMAIL_OPT_S); - break; - case MSG_MSGSIZE_OPT : - dataSize += sizeof(MSG_MSGSIZE_OPT_S); - break; - default: - break; - } + /* Encoding Config Data */ + switch (setting.type) { + case MSG_GENERAL_OPT : + dataSize += sizeof(MSG_GENERAL_OPT_S); + break; + case MSG_SMS_SENDOPT : + dataSize += sizeof(MSG_SMS_SENDOPT_S); + break; + case MSG_SMSC_LIST : + dataSize += sizeof(MSG_SMSC_LIST_S); + break; + case MSG_MMS_SENDOPT : + dataSize += sizeof(MSG_MMS_SENDOPT_S); + break; + case MSG_MMS_RECVOPT : + dataSize += sizeof(MSG_MMS_RECVOPT_S); + break; + case MSG_MMS_STYLEOPT : + dataSize += sizeof(MSG_MMS_STYLEOPT_S); + break; + case MSG_PUSHMSG_OPT : + dataSize += sizeof(MSG_PUSHMSG_OPT_S); + break; + case MSG_CBMSG_OPT : + dataSize += sizeof(MSG_CBMSG_OPT_S); + break; + case MSG_VOICEMAIL_OPT : + dataSize += sizeof(MSG_VOICEMAIL_OPT_S); + break; + case MSG_MSGSIZE_OPT : + dataSize += sizeof(MSG_MSGSIZE_OPT_S); + break; + default: + break; + } - encodedData = (char*)new char[dataSize]; - void* p = (void*)encodedData; + encodedData = (char*)new char[dataSize]; + void* p = (void*)encodedData; - switch (setting.type) - { - case MSG_GENERAL_OPT : - memcpy(p, &(setting.option.generalOpt), dataSize); - break; - case MSG_SMS_SENDOPT : - memcpy(p, &(setting.option.smsSendOpt), dataSize); - break; - case MSG_SMSC_LIST : - memcpy(p, &(setting.option.smscList), dataSize); - break; - case MSG_MMS_SENDOPT : - memcpy(p, &(setting.option.mmsSendOpt), dataSize); - break; - case MSG_MMS_RECVOPT : - memcpy(p, &(setting.option.mmsRecvOpt), dataSize); - break; - case MSG_MMS_STYLEOPT : - memcpy(p, &(setting.option.mmsStyleOpt), dataSize); - break; - case MSG_PUSHMSG_OPT : - memcpy(p, &(setting.option.pushMsgOpt), dataSize); - break; - case MSG_CBMSG_OPT : - memcpy(p, &(setting.option.cbMsgOpt), dataSize); - break; - case MSG_VOICEMAIL_OPT : - memcpy(p, &(setting.option.voiceMailOpt), dataSize); - break; - case MSG_MSGSIZE_OPT : - memcpy(p, &(setting.option.msgSizeOpt), dataSize); - break; - default: - break; - } + switch (setting.type) { + case MSG_GENERAL_OPT : + memcpy(p, &(setting.option.generalOpt), dataSize); + break; + case MSG_SMS_SENDOPT : + memcpy(p, &(setting.option.smsSendOpt), dataSize); + break; + case MSG_SMSC_LIST : + memcpy(p, &(setting.option.smscList), dataSize); + break; + case MSG_MMS_SENDOPT : + memcpy(p, &(setting.option.mmsSendOpt), dataSize); + break; + case MSG_MMS_RECVOPT : + memcpy(p, &(setting.option.mmsRecvOpt), dataSize); + break; + case MSG_MMS_STYLEOPT : + memcpy(p, &(setting.option.mmsStyleOpt), dataSize); + break; + case MSG_PUSHMSG_OPT : + memcpy(p, &(setting.option.pushMsgOpt), dataSize); + break; + case MSG_CBMSG_OPT : + memcpy(p, &(setting.option.cbMsgOpt), dataSize); + break; + case MSG_VOICEMAIL_OPT : + memcpy(p, &(setting.option.voiceMailOpt), dataSize); + break; + case MSG_MSGSIZE_OPT : + memcpy(p, &(setting.option.msgSizeOpt), dataSize); + break; + default: + break; + } } else { MSG_DEBUG("Command Handle Fail : MsgGetConfigData()"); } @@ -252,7 +246,7 @@ int MsgGetConfigHandler(const MSG_CMD_S *pCmd, char **ppEvent) break; } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, eventType, err, (void**)ppEvent); return eventSize; diff --git a/framework/transaction-manager/MsgCmdHandlerStorage.cpp b/framework/transaction-manager/MsgCmdHandlerStorage.cpp index 994be20..aad61f6 100755 --- a/framework/transaction-manager/MsgCmdHandlerStorage.cpp +++ b/framework/transaction-manager/MsgCmdHandlerStorage.cpp @@ -20,7 +20,7 @@ #include "MsgUtilFile.h" #include "MsgException.h" #include "MsgCppTypes.h" -//#include "MsgSoundPlayer.h" +/*#include "MsgSoundPlayer.h" */ #include "MsgUtilFunction.h" #include "MsgStorageHandler.h" #include "MsgPluginManager.h" @@ -54,7 +54,6 @@ static gboolean __refresh_noti(void *data) mx.unlock(); return FALSE; - } int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) @@ -87,26 +86,26 @@ int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoRestoreMessage()"); - // Encoding Message ID + /* Encoding Message ID */ dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoRestoreMessage()"); } } else { - // Add Message + /* Add Message */ msgInfo.msgId = 0; err = MsgStoAddMessage(&msgInfo, &sendOptInfo); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoAddMessage()"); - // Encoding Message ID + /* Encoding Message ID */ dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoAddMessage()"); } } - //storage change CB + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -117,7 +116,7 @@ int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_INSERT, &msgIdList); - // Update unread message status + /* Update unread message status */ if (msgInfo.folderId == MSG_INBOX_ID && msgInfo.bRead == false) { mx.lock(); g_job_cnt++; @@ -125,11 +124,11 @@ int MsgAddMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) mx.unlock(); } - // Delete Temp File for Message Data + /* Delete Temp File for Message Data */ if (msgInfo.bTextSms == false) - MsgDeleteFile(msgInfo.msgData); //ipc + MsgDeleteFile(msgInfo.msgData); /*ipc */ - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_ADD_MSG, err, (void**)ppEvent); return eventSize; @@ -164,19 +163,18 @@ int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgDecodeMsgInfo((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(int), &msgInfo); msgInfo.msgId = 0; - // Add Message + /* Add Message */ err = MsgStoAddSyncMLMessage(&msgInfo, extId, pinCode); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoAddSyncMLMessage()"); - // Encoding Message ID + /* Encoding Message ID */ dataSize = MsgEncodeMsgId(&(msgInfo.msgId), &encodedData); - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); - //storage change CB + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -186,13 +184,11 @@ int MsgAddSyncMLMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) msgIdList.msgIdList = msgIds; MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoAddSyncMLMessage()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_ADD_SYNCML_MSG, err, (void**)ppEvent); return eventSize; @@ -220,7 +216,7 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo, &sendOptInfo); - // Update Message + /* Update Message */ err = MsgStoUpdateMessage(&msgInfo, &sendOptInfo); if (err == MSG_SUCCESS) @@ -228,11 +224,11 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) else MSG_DEBUG("Command Handle Fail : MsgStoUpdateMessage()"); - // Delete Temp File for Message Data + /* Delete Temp File for Message Data */ if (msgInfo.bTextSms == false) - MsgDeleteFile(msgInfo.msgData); //ipc + MsgDeleteFile(msgInfo.msgData); /*ipc */ - //storage change CB + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -243,7 +239,7 @@ int MsgUpdateMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_MSG, err, (void**)ppEvent); return eventSize; @@ -267,21 +263,18 @@ int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&readStatus, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(bool)); - // Update Read Status + /* Update Read Status */ err = MsgStoUpdateReadStatus(msgId, readStatus); MSG_DEBUG("message id = [%d], readStatus = [%d]", msgId, readStatus); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateReadStatus()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateReadStatus()"); } - //storage change CB + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -292,7 +285,7 @@ int MsgUpdateReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_READ, err, (void**)ppEvent); return eventSize; @@ -320,7 +313,6 @@ int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("unReadCnt [%d]", unReadCnt); if (unReadCnt > 0) { - msg_id_list_s msgIdList; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -337,7 +329,7 @@ int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) delete [] (char*)msgIdList.msgIdList; } - // delete report notification + /* delete report notification */ if (err == MSG_SUCCESS) { MsgDbHandler *dbHandle = getDbHandle(); char tempAddr[MAX_ADDRESS_VAL_LEN+1]; @@ -364,11 +356,10 @@ int MsgUpdateThreadReadStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) dbHandle->finalizeQuery(); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_THREAD_READ, err, (void**)ppEvent); return eventSize; - } @@ -389,19 +380,16 @@ int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&protectedStatus, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(bool)); - // Update Protected Status + /* Update Protected Status */ err = MsgStoUpdateProtectedStatus(msgId, protectedStatus); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateProtectedStatus()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateProtectedStatus()"); } - //storage change CB + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -412,7 +400,7 @@ int MsgUpdateProtectedStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PROTECTED, err, (void**)ppEvent); return eventSize; @@ -436,14 +424,14 @@ int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgStoGetSyncMLExtId(*msgId, &extId); - // Delete Message + /* Delete Message */ err = MsgStoDeleteMessage(*msgId, true); if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoDeleteMessage()"); if(extId > 0) { - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, extId); } @@ -460,7 +448,7 @@ int MsgDeleteMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoDeleteMessage()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_MSG, err, (void**)ppEvent); return eventSize; @@ -487,7 +475,7 @@ int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_id_list_s msgIdList; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); - // Delete Message + /* Delete Message */ err = MsgStoDeleteAllMessageInFolder(*folderId, bOnlyDB, &msgIdList); if (err == MSG_SUCCESS) { @@ -499,11 +487,10 @@ int MsgDeleteAllMessageInFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoDeleteAllMessageInFolder()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELALL_MSGINFOLDER, err, (void**)ppEvent); return eventSize; - } @@ -534,7 +521,7 @@ int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&msgIds[i], (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+sizeof(msg_message_id_t)*i), sizeof(msg_message_id_t)); } - // Delete Message + /* Delete Message */ err = MsgStoDeleteMessageByList(&msgIdList); if (err == MSG_SUCCESS) { @@ -544,7 +531,7 @@ int MsgDeleteMessageByListHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoDeleteMessageByList()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_MESSAGE_BY_LIST, err, (void**)ppEvent); return eventSize; @@ -568,7 +555,7 @@ int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&folderId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(msg_folder_id_t)); - // Move Message + /* Move Message */ err = MsgStoMoveMessageToFolder(msgId, folderId); if (err == MSG_SUCCESS) { @@ -587,7 +574,7 @@ int MsgMoveMessageToFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoMoveMessageToFolder()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_MOVE_MSGTOFOLDER, err, (void**)ppEvent); return eventSize; @@ -611,19 +598,16 @@ int MsgMoveMessageToStorageHandler(const MSG_CMD_S *pCmd, char **ppEvent) memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&storageId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(msg_storage_id_t)); - // Move Message + /* Move Message */ err = MsgStoMoveMessageToStorage(msgId, storageId); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoMoveMessageToStorage()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoMoveMessageToStorage()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_MOVE_MSGTOSTORAGE, err, (void**)ppEvent); return eventSize; @@ -644,27 +628,24 @@ int MsgCountMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Folder ID + /* Get Folder ID */ msg_folder_id_t* folderId = (msg_folder_id_t*)pCmd->cmdData; - // Get Message Count + /* Get Message Count */ MSG_COUNT_INFO_S countInfo; err = MsgStoCountMessage(*folderId, &countInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCountMessage()"); - // Encoding Messaging Count Data + /* Encoding Messaging Count Data */ dataSize = MsgEncodeCountInfo(&countInfo, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCountMessage()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_COUNT_MSG, err, (void**)ppEvent); return eventSize; @@ -685,27 +666,24 @@ int MsgCountMsgByTypeHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Folder ID + /* Get Folder ID */ MSG_MESSAGE_TYPE_S* pMsgType = (MSG_MESSAGE_TYPE_S*)pCmd->cmdData; int nMsgCnt = 0; - // Get Message Count + /* Get Message Count */ err = MsgStoCountMsgByType(pMsgType, &nMsgCnt); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCountMsgByType()"); - // Encoding Messaging Count Data + /* Encoding Messaging Count Data */ dataSize = MsgEncodeCountByMsgType(nMsgCnt, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCountMsgByType()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_COUNT_BY_MSGTYPE, err, (void**)ppEvent); return eventSize; @@ -721,7 +699,7 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) return 0; } - // Get Message ID + /* Get Message ID */ msg_message_id_t* msgId = (msg_message_id_t*)pCmd->cmdData; char* encodedData = NULL; @@ -729,7 +707,7 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message + /* Get Message */ MSG_MESSAGE_INFO_S msgInfo; MSG_SENDINGOPT_INFO_S sendOptInfo; @@ -741,21 +719,18 @@ int MsgGetMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MsgStoGetMessage(*msgId, &msgInfo, &sendOptInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetMessage()"); - // Encoding Message Info Data + /* Encoding Message Info Data */ dataSize = MsgEncodeMsgInfo(&msgInfo, &sendOptInfo, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetMessage()"); } -// MsgSoundPlayStop(); +/* MsgSoundPlayStop(); */ - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MSG, err, (void**)ppEvent); return eventSize; @@ -773,22 +748,19 @@ int MsgAddFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Folder Info + /* Get Folder Info */ MSG_FOLDER_INFO_S* pFolderInfo = (MSG_FOLDER_INFO_S*)pCmd->cmdData; - // Add Folder + /* Add Folder */ err = MsgStoAddFolder(pFolderInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoAddFolder()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoAddFolder()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_FOLDER, err, (void**)ppEvent); return eventSize; @@ -806,22 +778,19 @@ int MsgUpdateFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Folder Info + /* Get Folder Info */ MSG_FOLDER_INFO_S* pFolderInfo = (MSG_FOLDER_INFO_S*)pCmd->cmdData; - // Update Folder + /* Update Folder */ err = MsgStoUpdateFolder(pFolderInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateFolder()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateFolder()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_FOLDER, err, (void**)ppEvent); return eventSize; @@ -839,22 +808,19 @@ int MsgDeleteFolderHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Folder Info + /* Get Folder Info */ msg_folder_id_t* pFolderInfo = (msg_folder_id_t*)pCmd->cmdData; - // Delete Folder + /* Delete Folder */ err = MsgStoDeleteFolder(*pFolderInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoDeleteFolder()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoDeleteFolder()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_FOLDER, err, (void**)ppEvent); return eventSize; @@ -875,16 +841,15 @@ int MsgGetFolderListHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Storage List + /* Get Storage List */ msg_struct_list_s folderList; err = MsgStoGetFolderList(&folderList); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetFolderList()"); - // Encoding Folder List Data + /* Encoding Folder List Data */ dataSize = MsgEncodeFolderList(&folderList, &encodedData); if (folderList.msg_struct_info) { @@ -898,13 +863,11 @@ int MsgGetFolderListHandler(const MSG_CMD_S *pCmd, char **ppEvent) } g_free(folderList.msg_struct_info); } - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetFolderList()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_FOLDERLIST, err, (void**)ppEvent); return eventSize; @@ -922,10 +885,10 @@ int MsgInitSimBySatHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Sim Init - Later - //Run msg-init-app + /* Sim Init - Later */ + /* Run msg-init-app */ - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INIT_SIM_BY_SAT, err, (void**)ppEvent); return eventSize; @@ -950,16 +913,15 @@ int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; #if 0 - // Get Thread View List + /* Get Thread View List */ msg_struct_list_s msgThreadViewList; - //err = MsgStoGetThreadViewList(&sortRule, &msgThreadViewList); + /*err = MsgStoGetThreadViewList(&sortRule, &msgThreadViewList); */ - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetThreadViewList()"); - // Encoding Folder View List Data + /* Encoding Folder View List Data */ dataSize = MsgEncodeThreadViewList(&msgThreadViewList, &encodedData); MSG_DEBUG("dataSize [%d]", dataSize); @@ -975,14 +937,12 @@ int MsgGetThreadViewListHandler(const MSG_CMD_S *pCmd, char **ppEvent) } g_free(msgThreadViewList.msg_struct_info); } - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetThreadViewList()"); return err; } #endif - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_THREADVIEWLIST, err, (void**)ppEvent); return eventSize; @@ -1018,7 +978,7 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Success : MsgStoDeleteThreadMessageList()"); if(isSyncMLMsg == true) { - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, -1, -1); } @@ -1031,7 +991,7 @@ int MsgDeleteThreadMessageListHandler(const MSG_CMD_S *pCmd, char **ppEvent) delete [] (char*)msgIdList.msgIdList; } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_THREADMESSAGELIST, err, (void**)ppEvent); return eventSize; @@ -1050,7 +1010,7 @@ int MsgSetTempAddressTableHandler(const MSG_CMD_S *pCmd, char **ppEvent) int search_len = 0; memcpy(&search_len, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); - char search_val[search_len + 1] = {0,}; + char search_val[search_len + 1] = {0, }; memcpy(&search_val, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)), sizeof(char)*search_len); int eventSize = 0; @@ -1060,14 +1020,12 @@ int MsgSetTempAddressTableHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoSetTmpAddressTable()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoSetTmpAddressTable()"); count = 0; } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(&count, sizeof(int), MSG_EVENT_SET_TEMP_ADDRESS_TABLE, err, (void**)ppEvent); MSG_END(); @@ -1085,7 +1043,7 @@ int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent) return 0; } - // Get From address + /* Get From address */ MSG_THREAD_LIST_INDEX_S addrInfo; memcpy(&addrInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_THREAD_LIST_INDEX_S)); @@ -1095,26 +1053,23 @@ int MsgCountMsgByContactHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message Common Info + /* Get Message Common Info */ MSG_THREAD_COUNT_INFO_S threadCountInfo = {0}; err = MsgStoCountMsgByContact(&addrInfo, &threadCountInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCountMsgByContact()"); - // Encoding Folder View List Data + /* Encoding Folder View List Data */ dataSize = MsgEncodeMsgGetContactCount(&threadCountInfo, &encodedData); MSG_DEBUG("dataSize [%d]", dataSize); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCountMsgByContact()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_CONTACT_COUNT, err, (void**)ppEvent); return eventSize; @@ -1130,7 +1085,7 @@ int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) return 0; } - // Get Message ID + /* Get Message ID */ msg_quickpanel_type_t* type = (msg_quickpanel_type_t*)pCmd->cmdData; char* encodedData = NULL; @@ -1138,7 +1093,7 @@ int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message + /* Get Message */ MSG_MESSAGE_INFO_S msgInfo; memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); @@ -1147,19 +1102,16 @@ int MsgGetQuickPanelDataHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MsgStoGetQuickPanelData(*type, &msgInfo); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetQuickPanelData()"); - // Encoding Message Info Data + /* Encoding Message Info Data */ dataSize = MsgEncodeMsgInfo(&msgInfo, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetQuickPanelData()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_QUICKPANEL_DATA, err, (void**)ppEvent); return eventSize; @@ -1177,7 +1129,7 @@ int MsgResetDatabaseHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Reset DB + /* Reset DB */ err = MsgStoResetDatabase(); if (err == MSG_SUCCESS) @@ -1185,7 +1137,7 @@ int MsgResetDatabaseHandler(const MSG_CMD_S *pCmd, char **ppEvent) else MSG_DEBUG("Command Handle Fail : MsgStoResetDatabase()"); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_RESET_DB, err, (void**)ppEvent); return eventSize; @@ -1206,14 +1158,14 @@ int MsgGetMemSizeHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Memory size + /* Get Memory size */ unsigned int memsize = 0; memsize = MsgDu(MSG_DATA_ROOT_PATH); dataSize = MsgEncodeMemSize(&memsize, &encodedData); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_MEMSIZE, err, (void**)ppEvent); return eventSize; @@ -1230,21 +1182,19 @@ int MsgBackupMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) } int eventSize = 0; - char path[MSG_FILEPATH_LEN_MAX+1] = {0,}; + char path[MSG_FILEPATH_LEN_MAX+1] = {0, }; msg_message_backup_type_t type; memcpy(&type, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_backup_type_t)); memcpy(&path, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_backup_type_t)), sizeof(path)); - char fullPath[MSG_FILEPATH_LEN_MAX+1] = {0,}; - err = MsgStoBackupMessage(type, path); if (err == MSG_SUCCESS) MSG_DEBUG("Command Handle Success : MsgBackupMessageHandler()"); else MSG_DEBUG("Command Handle Fail : MsgBackupMessageHandler()"); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_BACKUP_MESSAGE, err, (void**)ppEvent); return eventSize; @@ -1262,11 +1212,11 @@ int MsgRestoreMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; msg_id_list_s *msgIdList = NULL; - char path[MSG_FILEPATH_LEN_MAX+1] = {0,}; + char path[MSG_FILEPATH_LEN_MAX+1] = {0, }; memcpy(&path, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(path)); MSG_DEBUG("path = %s", path); - // Reset DB + /* Reset DB */ err = MsgStoRestoreMessage(path, &msgIdList); if (err == MSG_SUCCESS) { @@ -1283,11 +1233,10 @@ int MsgRestoreMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) } else { MSG_DEBUG("Not Exist msg id list to restore"); } - } else MSG_DEBUG("Command Handle Fail : MsgStoRestoreMessage()"); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_RESTORE_MESSAGE, err, (void**)ppEvent); return eventSize; @@ -1303,9 +1252,9 @@ int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) return 0; } - // Get Message ID + /* Get Message ID */ msg_message_id_t* msgId = (msg_message_id_t*)pCmd->cmdData; - MSG_MESSAGE_TYPE_S msgType = {0,}; + MSG_MESSAGE_TYPE_S msgType = {0, }; char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); @@ -1327,19 +1276,16 @@ int MsgGetReportStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MSG_ERR_INVALID_MSG_TYPE; } - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgGetReportStatusHandler()"); - // Encoding Report Status Data + /* Encoding Report Status Data */ dataSize = MsgEncodeReportStatus(reportStatus, report_count, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgGetReportStatusHandler()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_REPORT_STATUS, err, (void**)ppEvent); return eventSize; @@ -1368,7 +1314,7 @@ int MsgGetThreadIdByAddressHandler(const MSG_CMD_S *pCmd, char **ppEvent) msgInfo.addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * msgInfo.nAddressCnt]; - for(int i=0; icmdData+sizeof(int)+(sizeof(MSG_ADDRESS_INFO_S)*i)), sizeof(MSG_ADDRESS_INFO_S)); char* encodedData = NULL; @@ -1380,20 +1326,17 @@ int MsgGetThreadIdByAddressHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MsgStoGetThreadIdByAddress(&msgInfo, &threadId); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("threadId [%d]", threadId); MSG_DEBUG("Command Handle Success : MsgGetThreadIdByAddressHandler()"); - // Encoding threadId Data + /* Encoding threadId Data */ dataSize = MsgEncodeThreadId(&threadId, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgGetThreadIdByAddressHandler()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_THREAD_ID_BY_ADDRESS, err, (void**)ppEvent); return eventSize; @@ -1427,13 +1370,13 @@ int MsgGetThreadInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetThreadInfo()"); - // Encoding thread Info Data + /* Encoding thread Info Data */ dataSize = MsgEncodeThreadInfo(&threadInfo, &encodedData); } else { MSG_DEBUG("Command Handle Fail : MsgStoGetThreadInfo()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_GET_THREAD_INFO, err, (void**)ppEvent); return eventSize; @@ -1451,26 +1394,23 @@ int MsgCheckReadReportRequestedHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message ID + /* Get Message ID */ msg_message_id_t* MsgId = (msg_message_id_t*)pCmd->cmdData; - // Check ReadReport Is Requested + /* Check ReadReport Is Requested */ bool bReadReportRequested; bReadReportRequested = MsgStoCheckReadReportRequested(*MsgId); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCheckSendReadReport()"); - // Encoding ReadReportIsSent Data + /* Encoding ReadReportIsSent Data */ dataSize = MsgEncodeReadReportRequested(bReadReportRequested, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCheckReadReportIsSent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeStorageEvent(encodedData, dataSize, MSG_EVENT_PLG_CHECK_READ_REPORT_REQUESTED, err, (void**)ppEvent); return eventSize; @@ -1487,29 +1427,26 @@ int MsgCheckReadReportIsSentHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message ID + /* Get Message ID */ msg_message_id_t* MsgId = (msg_message_id_t*)pCmd->cmdData; - // Check ReadReport Is Sent + /* Check ReadReport Is Sent */ bool bReadReportIsSent; MSG_DEBUG("#### MSGID = %d ####", *MsgId); bReadReportIsSent = MsgStoCheckReadReportIsSent(*MsgId); MSG_DEBUG("######## 1. bReadStatusIsSent = %d #######", bReadReportIsSent); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCheckReadReportIsSent()"); - // Encoding ReadReportIsSent Data + /* Encoding ReadReportIsSent Data */ dataSize = MsgEncodeReadReportIsSent(bReadReportIsSent, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCheckReadReportIsSent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeStorageEvent(encodedData, dataSize, MSG_EVENT_PLG_CHECK_READ_REPORT_IS_SENT, err, (void**)ppEvent); return eventSize; @@ -1526,26 +1463,23 @@ int MsgSetReadReportSendStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message ID + /* Get Message ID */ msg_message_id_t msgId; int readReportSendStatus; memcpy(&msgId, (char*)pCmd + sizeof(MSG_CMD_TYPE_T), sizeof(msg_message_id_t)); memcpy(&readReportSendStatus, (char*)pCmd + sizeof(MSG_CMD_TYPE_T) + sizeof(msg_message_id_t), sizeof(int)); - // Set Read Report Send Status + /* Set Read Report Send Status */ err = MsgStoSetReadReportSendStatus(msgId, readReportSendStatus); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoUpdateReadStatus()"); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoUpdateReadStatus()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeStorageEvent(encodedData, dataSize, MSG_EVENT_PLG_SET_READ_REPORT_SEND_STATUS, err, (void**)ppEvent); return eventSize; @@ -1562,29 +1496,26 @@ int MsgGetMmsVersionHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message ID + /* Get Message ID */ msg_message_id_t* MsgId = (msg_message_id_t*)pCmd->cmdData; - // Check ReadReport Is Sent + /* Check ReadReport Is Sent */ int version; MSG_DEBUG("#### MSGID = %d ####", *MsgId); version = MsgStoGetMmsVersion(*MsgId); MSG_DEBUG("######## 1. version = %x #######", version); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoCheckReadReportIsSent()"); - // Encoding ReadReportIsSent Data + /* Encoding ReadReportIsSent Data */ dataSize = MsgEncodeMmsVersion(version, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoCheckReadReportIsSent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeStorageEvent(encodedData, dataSize, MSG_EVENT_PLG_GET_MMS_VERSION, err, (void**)ppEvent); return eventSize; @@ -1601,27 +1532,24 @@ int MsgGetMmsStatusInfoHandler(const MSG_CMD_S *pCmd, char **ppEvent) int dataSize = 0, eventSize = 0; - // Get Message ID + /* Get Message ID */ msg_message_id_t* MsgId = (msg_message_id_t*)pCmd->cmdData; MMS_STATUS_INFO_S mmsStatusInfo; MSG_DEBUG("#### MSGID = %d ####", *MsgId); - err = MsgStoGetMmsStatusInfo(*MsgId,&mmsStatusInfo); - if (err == MSG_SUCCESS) - { + err = MsgStoGetMmsStatusInfo(*MsgId, &mmsStatusInfo); + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgGetMmsStatusInfoHandler()"); - // Encoding ReadReportIsSent Data + /* Encoding ReadReportIsSent Data */ dataSize = MsgEncodeMmsStatusInfo(&mmsStatusInfo, &encodedData); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgGetMmsStatusInfoHandler()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeStorageEvent(encodedData, dataSize, MSG_EVENT_PLG_GET_MMS_STATUS_INFO, err, (void**)ppEvent); return eventSize; @@ -1640,10 +1568,10 @@ int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Message Info + /* Get Message Info */ MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData; - // Add Message + /* Add Message */ err = MsgStoAddPushEvent(pPushEvent); if (err == MSG_SUCCESS) { @@ -1652,7 +1580,7 @@ int MsgAddPushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoAddPushEvent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_ADD_PUSH_EVENT, err, (void**)ppEvent); return eventSize; @@ -1669,10 +1597,10 @@ int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Message Info + /* Get Message Info */ MSG_PUSH_EVENT_INFO_S* pPushEvent = (MSG_PUSH_EVENT_INFO_S*)pCmd->cmdData; - // Add Message + /* Add Message */ err = MsgStoDeletePushEvent(pPushEvent); if (err == MSG_SUCCESS) { @@ -1681,7 +1609,7 @@ int MsgDeletePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoDeletePushEvent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_DELETE_PUSH_EVENT, err, (void**)ppEvent); return eventSize; @@ -1698,13 +1626,13 @@ int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // Get Message Info + /* Get Message Info */ MSG_PUSH_EVENT_INFO_S pSrc; MSG_PUSH_EVENT_INFO_S pDst; memcpy(&pSrc, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_EVENT_INFO_S)); memcpy(&pDst, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_PUSH_EVENT_INFO_S)), sizeof(MSG_PUSH_EVENT_INFO_S)); - // Add Message + /* Add Message */ err = MsgStoUpdatePushEvent(&pSrc, &pDst); if (err == MSG_SUCCESS) { @@ -1713,7 +1641,7 @@ int MsgUpdatePushEventHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoUpdatePushEvent()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_PUSH_EVENT, err, (void**)ppEvent); return eventSize; @@ -1753,8 +1681,8 @@ int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("simIdList[0] [%d]", simIdList[0]); - // Add Message -#if 0 // Not to broadcast callback here. + /* Add Message */ +#if 0 /* Not to broadcast callback here. */ bool isReplaceMsg = false; if (msgInfo.msgId <= 0) @@ -1771,8 +1699,8 @@ int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (msg_id > 0) { MSG_DEBUG("Command Handle Success : MsgStoAddSimMessage()"); -#if 0 // Not to broadcast callback here. - //storage change CB +#if 0 /* Not to broadcast callback here. */ + /*storage change CB */ msg_id_list_s msgIdList; msg_message_id_t msgIds[1]; memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); @@ -1791,11 +1719,11 @@ int MsgAddSimMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) err = MSG_ERR_INVALID_MESSAGE; } - // Delete Temp File for Message Data + /* Delete Temp File for Message Data */ if (msgInfo.bTextSms == false) - MsgDeleteFile(msgInfo.msgData); //ipc + MsgDeleteFile(msgInfo.msgData); /*ipc */ - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent((const void *)&msg_id, sizeof(msg_message_id_t), MSG_EVENT_ADD_SIM_MSG, err, (void**)ppEvent); return eventSize; @@ -1816,7 +1744,7 @@ int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent) int sim_idx = 0; memcpy(&sim_idx, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); - // Add Message + /* Add Message */ err = MsgStoUpdateIMSI(sim_idx); if (err == MSG_SUCCESS) { @@ -1825,7 +1753,7 @@ int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("Command Handle Fail : MsgStoUpdateIMSI()"); } - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_UPDATE_IMSI, err, (void**)ppEvent); return eventSize; diff --git a/framework/transaction-manager/MsgCmdHandlerTransport.cpp b/framework/transaction-manager/MsgCmdHandlerTransport.cpp index 890ecf8..3579615 100755 --- a/framework/transaction-manager/MsgCmdHandlerTransport.cpp +++ b/framework/transaction-manager/MsgCmdHandlerTransport.cpp @@ -52,16 +52,16 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) int ret[3]; int eventSize = 0; - MSG_REQUEST_INFO_S reqInfo = {0,}; - MSG_PROXY_INFO_S proxyInfo = {0,}; + MSG_REQUEST_INFO_S reqInfo = {0, }; + MSG_PROXY_INFO_S proxyInfo = {0, }; reqInfo.msgInfo.addressList = NULL; unique_ptr addressListBuf(&reqInfo.msgInfo.addressList, unique_ptr_deleter); - // Get Message Request + /* Get Message Request */ memcpy(&reqInfo.reqId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_request_id_t)); - // Storing Request ID, Proxy Info for Sent Status CNF + /* Storing Request ID, Proxy Info for Sent Status CNF */ memcpy(&proxyInfo, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_request_id_t)), sizeof(MSG_PROXY_INFO_S)); MsgDecodeMsgInfo((char *)(pCmd->cmdData+sizeof(msg_request_id_t)+sizeof(MSG_PROXY_INFO_S)), &reqInfo.msgInfo, &reqInfo.sendOptInfo); @@ -82,10 +82,10 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (reqInfo.msgInfo.msgId > 0) bNewMsg = false; - // Submit Request + /* Submit Request */ err = MsgSubmitReq(&reqInfo, false); - if (err == MSG_SUCCESS){ + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgSubmitReq()"); } else { MSG_DEBUG("Command Handle Fail : MsgSubmitReq()"); @@ -99,24 +99,24 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (reqInfo.msgInfo.msgType.mainType == MSG_SMS_TYPE) { MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo); } else if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE) { - // Retrieve MMS shall not be kept in sentMsg + /* Retrieve MMS shall not be kept in sentMsg */ if ((reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_MMS) || (reqInfo.msgInfo.msgType.subType == MSG_FORWARD_MMS) || (reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS)) MsgTransactionManager::instance()->insertSentMsg(reqId, &proxyInfo); } - // keep transaction Id list for distinguish java MMS sent msg when sendconf received + /* keep transaction Id list for distinguish java MMS sent msg when sendconf received */ if (reqInfo.msgInfo.msgType.mainType == MSG_MMS_TYPE && reqInfo.msgInfo.msgType.subType == MSG_SENDREQ_JAVA_MMS) { - MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S trId={0}; + MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S trId = {0}; memcpy(&trId.id, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(MSG_REQUEST_INFO_S)+sizeof(MSG_PROXY_INFO_S)), MMS_TR_ID_LEN); char* pFileName; pFileName = strstr(reqInfo.msgInfo.msgData, "MSG_"); strncpy(trId.pduFileName, pFileName, MAX_COMMON_INFO_SIZE); - MSG_SEC_DEBUG("java MMS msg trId:%s filepath:%s ",trId.id, reqInfo.msgInfo.msgData); + MSG_SEC_DEBUG("java MMS msg trId:%s filepath:%s", trId.id, reqInfo.msgInfo.msgData); MsgTransactionManager* tm = MsgTransactionManager::instance(); tm->setJavaMMSList(&trId); @@ -126,7 +126,7 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) ret[1] = reqInfo.msgInfo.msgId; ret[2] = reqInfo.msgInfo.threadId; - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_SUBMIT_REQ, err, (void**)ppEvent); /* reject_msg_support */ @@ -156,8 +156,7 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); MsgStoAutoDeleteConversation(reqInfo.msgInfo.threadId, &msgIdList); - if (msgIdList.msgIdList) - { + if (msgIdList.msgIdList) { MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList); delete [] (char*)msgIdList.msgIdList; } @@ -168,21 +167,21 @@ int MsgSubmitReqHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ int listenerFd = 0; memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); MSG_DEBUG("Registering sent status CB for %d", listenerFd); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setSentStatusCB(listenerFd); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SENT_STATUS_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -191,20 +190,20 @@ int MsgRegSentStatusCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming SMS CB for fd %d mType %d port %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->port); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setIncomingMsgCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -213,20 +212,20 @@ int MsgRegIncomingMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming MMS Conf CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setMMSConfMsgCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -234,22 +233,22 @@ int MsgRegIncomingMMSConfMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEven int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming Push Msg CB for fd:%d mType:%d appId:%s", pCmdData->listenerFd, pCmdData->msgType, pCmdData->appId); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setPushMsgCB(pCmdData); - //MsgTransactionManager::instance()->sendPendigPushMsg(pCmdData); + /* MsgTransactionManager::instance()->sendPendigPushMsg(pCmdData); */ - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -259,20 +258,20 @@ int MsgRegIncomingPushMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_CB_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming CB Msg CB for fd:%d mType:%d: bSave: %d", pCmdData->listenerFd, pCmdData->msgType, pCmdData->bsave); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setCBMsgCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_CB_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -281,20 +280,20 @@ int MsgRegIncomingCBMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming Sync ML Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setSyncMLMsgCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -303,20 +302,20 @@ int MsgRegIncomingSyncMLMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCmdData = (MSG_CMD_REG_INCOMING_LBS_MSG_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering incoming LBS Msg CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setLBSMsgCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_INCOMING_LBS_MSG_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -325,20 +324,20 @@ int MsgRegIncomingLBSMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCmdData = (MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S*) pCmd->cmdData; MSG_DEBUG("Registering SyncML Msg ooperation CB for fd %d mType %d", pCmdData->listenerFd, pCmdData->msgType); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setSyncMLMsgOperationCB(pCmdData); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -347,21 +346,21 @@ int MsgRegSyncMLMsgOperationCallbackHandler(const MSG_CMD_S *pCmd, char **ppEven int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ int listenerFd = 0; memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); MSG_DEBUG("Registering storage change CB for %d", listenerFd); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setStorageChangeCB(listenerFd); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_STORAGE_CHANGE_CB, MsgException::SUCCESS, (void**)ppEvent); return eventSize; @@ -370,21 +369,21 @@ int MsgRegStorageChangeCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ int listenerFd = 0; memcpy(&listenerFd, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(int)); MSG_DEBUG("Registering report msg incoming CB for %d", listenerFd); - // storing dst fd in list + /* storing dst fd in list */ MsgTransactionManager::instance()->setReportMsgCB(listenerFd); - // Make Event Data + /* Make Event Data */ int eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_REG_REPORT_MSG_INCOMING_CB, MsgException::SUCCESS, (void**)ppEvent); return eventSize; @@ -393,46 +392,45 @@ int MsgRegIncomingReportMsgCallbackHandler(const MSG_CMD_S *pCmd, char **ppEvent int MsgSentStatusHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Message Request + /* Get Message Request */ MSG_SENT_STATUS_S* pStatus = (MSG_SENT_STATUS_S*) pCmd->cmdData; MSG_DEBUG("REQID %d, STATUS %d", pStatus->reqId, pStatus->status); - // storing dst fd in list + /* storing dst fd in list */ MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(pStatus->reqId); - // when no sent status cb is found + /* when no sent status cb is found */ if (!prxInfo) { return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); } MSG_DEBUG("REQID %d, listenerFD %d, handleAddr %x, msgId %d", pStatus->reqId, prxInfo->listenerFd, prxInfo->handleAddr, prxInfo->sentMsgId); - // if APP send and quit(not exist at this time), don't send the data up. - if (prxInfo->handleAddr == 0) - { - // just making data which will be passed to plugin. it indicates "handling evt success" + /* if APP send and quit(not exist at this time), don't send the data up. */ + if (prxInfo->handleAddr == 0) { + /* just making data which will be passed to plugin. it indicates "handling evt success" */ MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId); return MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); } - unsigned long ret[3] = {0}; //3// reqid, status, object + unsigned long ret[3] = {0}; /* reqid, status, object */ ret[0] = (unsigned long)pStatus->reqId; ret[1] = (unsigned long)pStatus->status; ret[2] = prxInfo->handleAddr; - // Make Event Data for APP + /* Make Event Data for APP */ int eventSize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); - // Send to listener thread, here + /* Send to listener thread, here */ MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventSize); MsgTransactionManager::instance()->delProxyInfo(pStatus->reqId); @@ -450,13 +448,13 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) bool sendNoti = true; bool isClass2msg = false; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Incoming Message + /* Get Incoming Message */ MSG_MESSAGE_INFO_S msgInfo; memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S)); @@ -465,7 +463,7 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MsgDecodeMsgInfo((char *)pCmd->cmdData, &msgInfo); - // broadcast to listener threads, here + /* broadcast to listener threads, here */ msg_id_list_s msgIdList; msg_message_id_t msgIds[2]; msg_message_id_t class2msgId = 0; @@ -478,7 +476,7 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) } #endif - // normal process + /* normal process */ err = MsgHandleIncomingMsg(&msgInfo, &sendNoti); if (isClass2msg == true) { @@ -495,7 +493,7 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (sendNoti == true) { MsgTransactionManager::instance()->broadcastIncomingMsgCB(err, &msgInfo); - if (msgInfo.msgType.subType > MSG_TYPE0_SMS && msgInfo.msgType.subType < MSG_WAP_SI_SMS) { // if it is replacement message. + if (msgInfo.msgType.subType > MSG_TYPE0_SMS && msgInfo.msgType.subType < MSG_WAP_SI_SMS) { /* if it is replacement message. */ MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); } else { MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_INSERT, &msgIdList); @@ -512,8 +510,7 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) memset(&msgIdList, 0x00, sizeof(msg_id_list_s)); MsgStoAutoDeleteConversation(msgInfo.threadId, &msgIdList); - if (msgIdList.msgIdList) - { + if (msgIdList.msgIdList) { MsgTransactionManager::instance()->broadcastStorageChangeCB(err, MSG_STORAGE_CHANGE_DELETE, &msgIdList); delete [] (char*)msgIdList.msgIdList; } @@ -525,7 +522,7 @@ int MsgIncomingMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) #endif if (msgInfo.bTextSms == false) { - MsgDeleteFile(msgInfo.msgData); //ipc + MsgDeleteFile(msgInfo.msgData); /*ipc */ memset(msgInfo.msgData, 0x00, sizeof(msgInfo.msgData)); } @@ -630,7 +627,7 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) } } - // make return event + /* make return event */ eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent); } else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS || msgInfo.msgType.subType == MSG_SENDCONF_MMS) { @@ -644,31 +641,31 @@ int MsgIncomingMMSConfMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_PROXY_INFO_S* prxInfo = MsgTransactionManager::instance()->getProxyInfo(reqID); - // when no sent status cb is found + /* when no sent status cb is found */ if (prxInfo) { - // No need to update javaMMS sent messages + /* No need to update javaMMS sent messages */ javamms_list& listenerList = MsgTransactionManager::instance()->getJavaMMSList(); javamms_list::iterator it = listenerList.begin(); - MSG_DEBUG("listenerList size:%d ",listenerList.size()); + MSG_DEBUG("listenerList size:%d ", listenerList.size()); if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL && msgInfo.msgType.subType == MSG_SENDREQ_MMS) { for ( ; it != listenerList.end() ; it++) { if (strstr(it->pduFileName, "JAVA")) { MSG_SEC_DEBUG("JAVA MMS fileName:%s", it->pduFileName); - MsgDeleteFile(it->pduFileName); // ipc + MsgDeleteFile(it->pduFileName); /* ipc */ listenerList.erase(it); goto __BYPASS_UPDATE; } } } else { - //msgData has MMS_RECV_DATA_S + /*msgData has MMS_RECV_DATA_S */ MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData; for ( ; it != listenerList.end() ; it++) { if (!strcmp(it->id, pMmsRecvData->szTrID)) { - MSG_SEC_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s",pMmsRecvData->szTrID, it->id); - MsgDeleteFile(it->pduFileName); // ipc + MSG_SEC_DEBUG("find sent JAVA MMS message trId:%s from listener list trId:%s", pMmsRecvData->szTrID, it->id); + MsgDeleteFile(it->pduFileName); /* ipc */ listenerList.erase(it); goto __BYPASS_UPDATE; } @@ -688,11 +685,11 @@ __BYPASS_UPDATE: if (msgInfo.networkStatus == MSG_NETWORK_SEND_FAIL) { MSG_DEBUG("message-dialog: send fail"); MsgInsertTicker("Sending multimedia message failed.", SENDING_MULTIMEDIA_MESSAGE_FAILED, true, msgInfo.msgId); -// MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_NORMAL_SOUND_PLAY); +/* MsgSoundPlayer::instance()->MsgSoundPlayStart(NULL, MSG_NORMAL_SOUND_PLAY); */ } else { MSG_DEBUG("message-dialog: send success"); -#if 0 // disabled as per UX request to not show success notification : 2015. 09. 18 +#if 0 /* disabled as per UX request to not show success notification : 2015. 09. 18 */ bool bTTS = false; if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) { @@ -707,25 +704,24 @@ __BYPASS_UPDATE: #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED MSG_SEC_DEBUG("Enter MsgAddPhoneLog() : msgInfo.addressList[0].addressVal [%s]", msgInfo.addressList[0].addressVal); MsgAddPhoneLog(&msgInfo); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /*MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ } if (prxInfo) { if (prxInfo->handleAddr == 0) { - // just making data which will be passed to plugin. it indicates "handling evt success" + /* just making data which will be passed to plugin. it indicates "handling evt success" */ MsgTransactionManager::instance()->delProxyInfo(reqID); } else { - - unsigned long ret[3] = {0}; //3// reqid, status, object + unsigned long ret[3] = {0}; /* reqid, status, object */ ret[0] = (unsigned long)reqID; ret[1] = (unsigned long)msgInfo.networkStatus; ret[2] = prxInfo->handleAddr; - // Make Event Data for APP + /* Make Event Data for APP */ eventsize = MsgMakeEvent(ret, sizeof(ret), MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_SUCCESS, (void**)ppEvent); - // Send to listener thread, here + /* Send to listener thread, here */ MsgTransactionManager::instance()->write(prxInfo->listenerFd, *ppEvent, eventsize); MsgTransactionManager::instance()->delProxyInfo(reqID); @@ -735,7 +731,7 @@ __BYPASS_UPDATE: eventsize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_MMS_CONF, MSG_SUCCESS, (void**)ppEvent); MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, MSG_STORAGE_CHANGE_UPDATE, &msgIdList); } else { - //To avoid prevent memory leak.. this case will not occur. eventsize will be return as 0. + /*To avoid prevent memory leak.. this case will not occur. eventsize will be return as 0. */ if (tmpAddr) { delete[] tmpAddr; tmpAddr = NULL; @@ -752,7 +748,7 @@ int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) int eventSize = 0; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; @@ -761,15 +757,15 @@ int MsgIncomingPushMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_PUSH_MESSAGE_DATA_S pushData; memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S)); - // Get Incoming Message + /* Get Incoming Message */ memcpy(&pushData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_PUSH_MESSAGE_DATA_S)); - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastPushMsgCB(MSG_SUCCESS, &pushData); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, MSG_SUCCESS, (void**)ppEvent); MSG_END(); @@ -783,13 +779,13 @@ int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_error_t err = MSG_SUCCESS; int eventSize = 0; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Incoming Message + /* Get Incoming Message */ MSG_CB_MSG_S cbMsg; memset(&cbMsg, 0x00, sizeof(MSG_CB_MSG_S)); @@ -842,7 +838,7 @@ int MsgIncomingCBMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; @@ -851,15 +847,15 @@ int MsgIncomingSyncMLMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_SYNCML_MESSAGE_DATA_S syncMLData; memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S)); - // Get Incoming Message + /* Get Incoming Message */ memcpy(&syncMLData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_SYNCML_MESSAGE_DATA_S)); int eventSize = 0; - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastSyncMLMsgCB(MSG_SUCCESS, &syncMLData); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -870,7 +866,7 @@ int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) { int eventSize = 0; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; @@ -879,13 +875,13 @@ int MsgIncomingLBSMsgHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_LBS_MESSAGE_DATA_S lbsData; memset(&lbsData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S)); - // Get Incoming Message + /* Get Incoming Message */ memcpy(&lbsData, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(MSG_LBS_MESSAGE_DATA_S)); - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastLBSMsgCB(MSG_SUCCESS, &lbsData); - // Make Event Data + /* Make Event Data */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -904,31 +900,28 @@ int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_message_id_t msgId = 0; int extId = 0; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Data + /* Get Data */ memcpy(&msgId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(msg_message_id_t)); memcpy(&extId, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(msg_message_id_t)), sizeof(int)); err = MsgStoGetSyncMLExtId(msgId, &extId); - if (err == MSG_SUCCESS) - { + if (err == MSG_SUCCESS) { MSG_DEBUG("Command Handle Success : MsgStoGetSyncMLExtId()"); - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastSyncMLMsgOperationCB(err, msgId, extId); - } - else - { + } else { MSG_DEBUG("Command Handle Fail : MsgStoGetSyncMLExtId()"); } - // Make Event Data to Client + /* Make Event Data to Client */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_SYNCML_OPERATION, err, (void**)ppEvent); return eventSize; @@ -937,7 +930,7 @@ int MsgSyncMLMsgOperationHandler(const MSG_CMD_S *pCmd, char **ppEvent) int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent) { - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; @@ -966,14 +959,14 @@ int MsgStorageChangeHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("storageChangeType : [%d], msg Id : [%d]", storageChangeType, msgIdList.msgIdList[i]); } - // broadcast to listener threads, here + /* broadcast to listener threads, here */ MsgTransactionManager::instance()->broadcastStorageChangeCB(MSG_SUCCESS, storageChangeType, &msgIdList); if (msgIdList.msgIdList) { delete [] msgIdList.msgIdList; } - // Make Event Data to Client + /* Make Event Data to Client */ eventSize = MsgMakeEvent(NULL, 0, MSG_EVENT_PLG_STORAGE_CHANGE_IND, MSG_SUCCESS, (void**)ppEvent); return eventSize; @@ -989,7 +982,7 @@ int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) return 0; } - // Get the msgIdList of sending failed message. + /* Get the msgIdList of sending failed message. */ int *failed_msg_list = NULL; int count = 0; unique_ptr failed_list(&failed_msg_list, unique_ptr_deleter); @@ -1000,8 +993,7 @@ int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) MSG_DEBUG("MsgStoGetFailedMessage() Error!! [%d]", err); } - for(int i=0; i < count ; ++i) - { + for (int i = 0; i < count ; ++i) { MSG_REQUEST_INFO_S reqInfo = {0}; reqInfo.msgInfo.addressList = NULL; unique_ptr addressListBuf(&reqInfo.msgInfo.addressList, unique_ptr_deleter); @@ -1014,12 +1006,11 @@ int MsgResendMessageHandler(const MSG_CMD_S *pCmd, char **ppEvent) if (reqInfo.msgInfo.msgType.subType == MSG_GET_MMS || \ reqInfo.msgInfo.msgType.subType == MSG_NOTIFICATIONIND_MMS || \ - reqInfo.msgInfo.msgType.subType == MSG_RETRIEVE_MMS) - { + reqInfo.msgInfo.msgType.subType == MSG_RETRIEVE_MMS) { MSG_WARN("retrieve pending id[%d]", reqInfo.msgInfo.msgId); /* For retrieving failed msg (MMS)*/ reqInfo.msgInfo.msgType.subType = MSG_RETRIEVE_MMS; - reqInfo.msgInfo.folderId = MSG_OUTBOX_ID; // outbox fixed + reqInfo.msgInfo.folderId = MSG_OUTBOX_ID; /* outbox fixed */ reqInfo.msgInfo.networkStatus = MSG_NETWORK_RETRIEVING; } else { /* For sending failed msg */ @@ -1061,13 +1052,13 @@ int MsgCheckUniquenessHandler(const MSG_CMD_S *pCmd, char **ppEvent) msg_error_t err = MSG_SUCCESS; int eventSize = 0; - // input check + /* input check */ if (!pCmd || !ppEvent) { MSG_DEBUG("pCmd or ppEvent is null"); return 0; } - // Get Incoming Message + /* Get Incoming Message */ bool bInsert; memcpy(&bInsert, (void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), sizeof(bool)); diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp index c7b9c99..f646510 100755 --- a/framework/transaction-manager/MsgTransManager.cpp +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -76,7 +76,7 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), mxQ(), cv handlerMap.clear(); -// Fill in mMsgHandlers, as given in the below. +/* Fill in mMsgHandlers, as given in the below. */ handlerMap[MSG_CMD_ADD_MSG] = &MsgAddMessageHandler; handlerMap[MSG_CMD_ADD_SYNCML_MSG] = &MsgAddSyncMLMessageHandler; handlerMap[MSG_CMD_UPDATE_MSG] = &MsgUpdateMessageHandler; @@ -181,8 +181,7 @@ MsgTransactionManager::MsgTransactionManager() : running(false), mx(), mxQ(), cv MsgTransactionManager::~MsgTransactionManager() { -// pthread_cond_init(&retCV, NULL); // = PTHREAD_COND_INITIALIZER; - +/* pthread_cond_init(&retCV, NULL); */ /* = PTHREAD_COND_INITIALIZER; */ } @@ -209,19 +208,18 @@ void MsgTransactionManager::run() MSG_DEBUG("Start Transaction Manager"); - // Set Msg FW Ready Flag + /* Set Msg FW Ready Flag */ if(MsgSettingSetBool(VCONFKEY_MSG_SERVER_READY, true) != MSG_SUCCESS) MSG_DEBUG("MsgSettingSetBool FAIL : VCONFKEY_MSG_SERVER_READY"); MSG_INFO("### VCONFKEY_MSG_SERVER_READY ###"); /* running worker for plg task */ pthread_t tv; - if (pthread_create (&tv, NULL, &worker_event_queue, NULL) != 0) { + if (pthread_create(&tv, NULL, &worker_event_queue, NULL) != 0) { THROW(MsgException::SERVER_READY_ERROR, "cannot create thread [%d]", errno); } - while(1) - { + while(1) { readfds = servSock.fdSet(); nfds = servSock.maxFd(); @@ -231,25 +229,18 @@ void MsgTransactionManager::run() THROW(MsgException::SELECT_ERROR, "select error : %s", g_strerror(errno)); } - try - { - for (int i=0 ; i < nfds; i++) - { - if (FD_ISSET(i, &readfds)) - { - if (i == servSock.fd()) // if it is socket connection request + try { + for (int i=0 ; i < nfds; i++) { + if (FD_ISSET(i, &readfds)) { + if (i == servSock.fd()) /* if it is socket connection request */ servSock.accept(); else handleRequest(i); } } - } - catch (MsgException& e) - { + } catch (MsgException& e) { MSG_FATAL("%s", e.what()); - } - catch (exception& e) - { + } catch (exception& e) { MSG_FATAL("%s", e.what()); } } @@ -273,7 +264,7 @@ void MsgTransactionManager::insertSentMsg(int reqId, MSG_PROXY_INFO_S* pPrxInfo) fd_map::iterator it = statusCBFdMap.find(pPrxInfo->listenerFd); - if (it == statusCBFdMap.end()) { // if the status CB is not registered + if (it == statusCBFdMap.end()) { /* if the status CB is not registered */ MSG_DEBUG("No sent_status registered for fd %d", pPrxInfo->listenerFd); } else { sentMsgMap.insert(make_pair(reqId, *pPrxInfo)); @@ -285,8 +276,7 @@ MSG_PROXY_INFO_S* MsgTransactionManager::getProxyInfo(int reqId) { sentmsg_map::iterator it = sentMsgMap.find(reqId); - if (it == sentMsgMap.end()) - { + if (it == sentMsgMap.end()) { MSG_DEBUG("No sent status cb found"); return NULL; } @@ -301,8 +291,7 @@ void MsgTransactionManager::delProxyInfo(int reqId) sentmsg_map::iterator it = sentMsgMap.find(reqId); - if (it == sentMsgMap.end()) - { + if (it == sentMsgMap.end()) { THROW(MsgException::SENT_STATUS_ERROR, "channel info does not exist"); } @@ -321,7 +310,7 @@ void MsgTransactionManager::workerEventQueue() while (1) { mxQ.lock(); while (!eventQueue.front(&pCmd)) { /* if no item, wait */ - MSG_DEBUG ("waiting for task"); + MSG_DEBUG("waiting for task"); cv.wait(mxQ.pMutex()); } eventQueue.pop_front(); /* pop it from queue*/ @@ -333,9 +322,9 @@ void MsgTransactionManager::workerEventQueue() } memcpy (&fd, pCmd->cmdCookie, sizeof(int)); - if (fd < 0 ) { + if (fd < 0) { MSG_FATAL("fd [%d] < 0", fd); - g_free (pCmd); pCmd = NULL; + g_free(pCmd); pCmd = NULL; continue; } pfHandler = handlerMap[pCmd->cmdType]; @@ -343,7 +332,7 @@ void MsgTransactionManager::workerEventQueue() MSG_FATAL("No handler for %d", pCmd->cmdType); MsgMakeErrorEvent(pCmd->cmdType, MSG_ERR_INVALID_PARAMETER, &eventSize, &pEventData); } else { - // run handler function + /* run handler function */ eventSize = pfHandler(pCmd, &pEventData); if (eventSize == 0 || pEventData == NULL) { @@ -354,8 +343,8 @@ void MsgTransactionManager::workerEventQueue() MSG_DEBUG("Replying to fd [%d], size [%d]", fd, eventSize); servSock.write(fd, pEventData, eventSize); - g_free (pCmd); pCmd = NULL; - g_free (pEventData); pEventData = NULL; + g_free(pCmd); pCmd = NULL; + g_free(pEventData); pEventData = NULL; } } @@ -370,8 +359,7 @@ void MsgTransactionManager::handleRequest(int fd) int len = 0; int ret = servSock.read(fd, &buf, &len); - if( ret == CLOSE_CONNECTION_BY_SIGNAL || ret == CLOSE_CONNECTION_BY_USER || ret < 0) - { + if (ret == CLOSE_CONNECTION_BY_SIGNAL || ret == CLOSE_CONNECTION_BY_USER || ret < 0) { MSG_DEBUG("Read value [%d]", ret); cleanup(fd); return; @@ -385,15 +373,15 @@ void MsgTransactionManager::handleRequest(int fd) int eventSize = 0; - // decoding cmd from APP + /* decoding cmd from APP */ MSG_CMD_S* pCmd = (MSG_CMD_S*) buf; MSG_DEBUG("Command Type [%d : %s]", pCmd->cmdType, MsgDbgCmdStr(pCmd->cmdType)); if (pCmd->cmdType > MSG_CMD_NUM) THROW(MsgException::OUT_OF_RANGE, "request CMD is not defined"); - // check privilege -// if (checkPrivilege(pCmd->cmdType, pCmd->cmdCookie) == false) { + /* check privilege */ +/* if (checkPrivilege(pCmd->cmdType, pCmd->cmdCookie) == false) { */ if (checkPrivilege(fd, pCmd->cmdType) == false) { MSG_DEBUG("No Privilege rule. Not allowed."); #ifdef MSG_CHECK_PRIVILEGE @@ -406,7 +394,7 @@ void MsgTransactionManager::handleRequest(int fd) #endif } - // determine the handler based on pCmd->cmdType + /* determine the handler based on pCmd->cmdType */ int (*pfHandler)(const MSG_CMD_S*, char**) = NULL; switch (pCmd->cmdType) { @@ -419,11 +407,10 @@ void MsgTransactionManager::handleRequest(int fd) case MSG_CMD_PLG_INIT_SIM_BY_SAT: case MSG_CMD_PLG_INCOMING_PUSH_IND: case MSG_CMD_PLG_INCOMING_CB_IND: { - - MSG_CMD_S* pCmdDup = (MSG_CMD_S*) calloc (1, len); /* pCmdDup should be freed afterward */ + MSG_CMD_S* pCmdDup = (MSG_CMD_S*)calloc(1, len); /* pCmdDup should be freed afterward */ if (pCmdDup != NULL) { - memcpy (pCmdDup, pCmd, len); - memcpy (pCmdDup->cmdCookie, &fd, sizeof(int)); /* Now, cmdCookie keeps fd for return */ + memcpy(pCmdDup, pCmd, len); + memcpy(pCmdDup->cmdCookie, &fd, sizeof(int)); /* Now, cmdCookie keeps fd for return */ mxQ.lock(); /* aquire lock before adding cmd */ eventQueue.push_back(pCmdDup); @@ -438,7 +425,7 @@ void MsgTransactionManager::handleRequest(int fd) MSG_FATAL("No handler for %d", pCmd->cmdType); MsgMakeErrorEvent(pCmd->cmdType, MSG_ERR_INVALID_PARAMETER, &eventSize, &pEventData); } else { - // run handler function + /* run handler function */ memcpy (pCmd->cmdCookie, &fd, sizeof(int)); /* Now, cmdCookie keeps fd for return */ eventSize = pfHandler(pCmd, &pEventData); @@ -457,7 +444,7 @@ void MsgTransactionManager::handleRequest(int fd) } -// terminating the socket connection between ipc server and ipc client +/* terminating the socket connection between ipc server and ipc client */ void MsgTransactionManager::cleanup(int fd) { MSG_BEGIN(); @@ -468,148 +455,118 @@ void MsgTransactionManager::cleanup(int fd) MSG_DEBUG("fd %d disonnected", fd); - // remove sent msg info for fd + /* remove sent msg info for fd */ sentmsg_map::iterator sentmsg_it = sentMsgMap.begin(); - for (; sentmsg_it != sentMsgMap.end(); sentmsg_it++) - { - if (sentmsg_it->second.listenerFd == fd) - { + for (; sentmsg_it != sentMsgMap.end(); sentmsg_it++) { + if (sentmsg_it->second.listenerFd == fd) { sentmsg_it->second.listenerFd = 0; sentmsg_it->second.handleAddr = 0; } } - // remove sent status callback for fd + /* remove sent status callback for fd */ statusCBFdMap.erase(fd); MSG_DEBUG("After erase fd [%d], statusCBFdMap has below.", fd); fd_map::iterator it = statusCBFdMap.begin(); - for (; it!=statusCBFdMap.end(); ++it) + for (; it != statusCBFdMap.end(); ++it) MSG_DEBUG("[%d]", it->first); - // remove all newMsgCBs for fd + /* remove all newMsgCBs for fd */ newmsg_list::iterator newmsg_it = newMsgCBList.begin(); - while (newmsg_it != newMsgCBList.end()) - { - if (newmsg_it->listenerFd == fd) - { + while (newmsg_it != newMsgCBList.end()) { + if (newmsg_it->listenerFd == fd) { newmsg_it = newMsgCBList.erase(newmsg_it); - } - else - { + } else { ++newmsg_it; } } - // remove all newMMSConfMsgCBs for fd + /* remove all newMMSConfMsgCBs for fd */ mmsconf_list::iterator mmsconf_it = newMMSConfMsgCBList.begin(); - while (mmsconf_it != newMMSConfMsgCBList.end()) - { - if (mmsconf_it->listenerFd == fd) - { + while (mmsconf_it != newMMSConfMsgCBList.end()) { + if (mmsconf_it->listenerFd == fd) { mmsconf_it = newMMSConfMsgCBList.erase(mmsconf_it); - } - else - { + } else { ++mmsconf_it; } } - // remove all newSyncMLMsgCBs for fd + /* remove all newSyncMLMsgCBs for fd */ syncmlmsg_list::iterator syncmlmsg_it = newSyncMLMsgCBList.begin(); - while (syncmlmsg_it != newSyncMLMsgCBList.end()) - { - if (syncmlmsg_it->listenerFd == fd) - { + while (syncmlmsg_it != newSyncMLMsgCBList.end()) { + if (syncmlmsg_it->listenerFd == fd) { syncmlmsg_it = newSyncMLMsgCBList.erase(syncmlmsg_it); - } - else - { + } else { ++syncmlmsg_it; } } - // remove all newLBSMsgCBs for fd + /* remove all newLBSMsgCBs for fd */ lbsmsg_list::iterator lbsmsg_it = newLBSMsgCBList.begin(); - while (lbsmsg_it != newLBSMsgCBList.end()) - { - if (lbsmsg_it->listenerFd == fd) - { + while (lbsmsg_it != newLBSMsgCBList.end()) { + if (lbsmsg_it->listenerFd == fd) { lbsmsg_it = newLBSMsgCBList.erase(lbsmsg_it); - } - else - { + } else { ++lbsmsg_it; } } - // remove all newPushMsgCBs for fd + /* remove all newPushMsgCBs for fd */ pushmsg_list::iterator pushmsg_it = newPushMsgCBList.begin(); - while (pushmsg_it != newPushMsgCBList.end()) - { - if (pushmsg_it->listenerFd == fd) - { + while (pushmsg_it != newPushMsgCBList.end()) { + if (pushmsg_it->listenerFd == fd) { pushmsg_it = newPushMsgCBList.erase(pushmsg_it); - } - else - { + } else { ++pushmsg_it; } } - // remove all newCBMsgCBs for fd + /* remove all newCBMsgCBs for fd */ cbmsg_list::iterator cbmsg_it = newCBMsgCBList.begin(); - //bool bSave = false; + /*bool bSave = false; */ - while (cbmsg_it != newCBMsgCBList.end()) - { - if (cbmsg_it->listenerFd == fd) - { + while (cbmsg_it != newCBMsgCBList.end()) { + if (cbmsg_it->listenerFd == fd) { cbmsg_it = newCBMsgCBList.erase(cbmsg_it); - } - else - { - //if (cbmsg_it->bsave == true) - // bSave = true; + } else { + /*if (cbmsg_it->bsave == true) */ + /* bSave = true; */ ++cbmsg_it; } } - // remove all operationSyncMLMsgCBs for fd + /* remove all operationSyncMLMsgCBs for fd */ syncmlop_list::iterator syncmlop_it = operationSyncMLMsgCBList.begin(); - while (syncmlop_it != operationSyncMLMsgCBList.end()) - { - if (syncmlop_it->listenerFd == fd) - { + while (syncmlop_it != operationSyncMLMsgCBList.end()) { + if (syncmlop_it->listenerFd == fd) { syncmlop_it = operationSyncMLMsgCBList.erase(syncmlop_it); - } - else - { + } else { ++syncmlop_it; } } - // remove storage change callback for fd + /* remove storage change callback for fd */ storageChangeFdMap.erase(fd); MSG_DEBUG("After erase fd [%d], storageChangeFdMap has below.", fd); it = storageChangeFdMap.begin(); - for (; it!=storageChangeFdMap.end(); ++it) + for (; it != storageChangeFdMap.end(); ++it) MSG_DEBUG("[%d]", it->first); - // remove report msg incoming callback for fd + /* remove report msg incoming callback for fd */ reportMsgCBFdMap.erase(fd); MSG_DEBUG("After erase fd [%d], reportMsgCBFdMap has below.", fd); it = reportMsgCBFdMap.begin(); - for (; it!=reportMsgCBFdMap.end(); ++it) + for (; it != reportMsgCBFdMap.end(); ++it) MSG_DEBUG("[%d]", it->first); MSG_END(); @@ -662,8 +619,7 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) goto _END_OF_FUNC; } - switch(CmdType) - { + switch(CmdType) { case MSG_CMD_GET_MSG: case MSG_CMD_COUNT_MSG: case MSG_CMD_COUNT_BY_MSGTYPE: @@ -696,8 +652,7 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) case MSG_CMD_GET_PUSH_MSG_OPT: case MSG_CMD_GET_VOICE_MSG_OPT: case MSG_CMD_GET_GENERAL_MSG_OPT: - case MSG_CMD_GET_MSG_SIZE_OPT: - { + case MSG_CMD_GET_MSG_SIZE_OPT: { ret = cynara_check(p_cynara, peer_client, peer_session, peer_user, "http://tizen.org/privilege/message.read"); if (ret != CYNARA_API_ACCESS_ALLOWED) { @@ -740,8 +695,7 @@ bool MsgTransactionManager::checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType) case MSG_CMD_SET_PUSH_MSG_OPT: case MSG_CMD_SET_VOICE_MSG_OPT: case MSG_CMD_SET_GENERAL_MSG_OPT: - case MSG_CMD_SET_MSG_SIZE_OPT: - { + case MSG_CMD_SET_MSG_SIZE_OPT: { ret = cynara_check(p_cynara, peer_client, peer_session, peer_user, "http://tizen.org/privilege/message.write"); if (ret != CYNARA_API_ACCESS_ALLOWED) { @@ -764,7 +718,7 @@ _END_OF_FUNC: void MsgTransactionManager::setSentStatusCB(int listenerFd) { if (listenerFd <= 0) - THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d",listenerFd); + THROW(MsgException::INVALID_PARAM, "InParam Error: listenerFd %d", listenerFd); statusCBFdMap[listenerFd] = true; } @@ -772,8 +726,7 @@ void MsgTransactionManager::setSentStatusCB(int listenerFd) void MsgTransactionManager::setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -782,10 +735,8 @@ void MsgTransactionManager::setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbI newmsg_list::iterator it = newMsgCBList.begin(); - for (; it != newMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (it->port == pCbInfo->port)) - { + for (; it != newMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (it->port == pCbInfo->port)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d, port %d", it->listenerFd, it->msgType, it->port); return; } @@ -797,8 +748,7 @@ void MsgTransactionManager::setIncomingMsgCB(MSG_CMD_REG_INCOMING_MSG_CB_S *pCbI void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -807,10 +757,8 @@ void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); - for (; it != newMMSConfMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (!strncmp(it->appId, pCbInfo->appId, MAX_MMS_JAVA_APPID_LEN))) - { + for (; it != newMMSConfMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && (!strncmp(it->appId, pCbInfo->appId, MAX_MMS_JAVA_APPID_LEN))) { MSG_DEBUG("Duplicated MMSConfMessageCB info fd:%d, mType:%d, appId:%s", it->listenerFd, it->msgType, it->appId); return; } @@ -822,8 +770,7 @@ void MsgTransactionManager::setMMSConfMsgCB(MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -832,10 +779,8 @@ void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCb pushmsg_list::iterator it = newPushMsgCBList.begin(); - for (; it != newPushMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && !strncmp(it->appId, pCbInfo->appId, MAX_WAPPUSH_ID_LEN)) - { + for (; it != newPushMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType) && !strncmp(it->appId, pCbInfo->appId, MAX_WAPPUSH_ID_LEN)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; } @@ -847,8 +792,7 @@ void MsgTransactionManager::setPushMsgCB(MSG_CMD_REG_INCOMING_PUSH_MSG_CB_S *pCb void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo) { MSG_BEGIN(); - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -857,19 +801,18 @@ void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo cbmsg_list::iterator it = newCBMsgCBList.begin(); - for (; it != newCBMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) - { + for (; it != newCBMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; } } MSG_DEBUG("bSave : [%d]", pCbInfo->bsave); - if(pCbInfo->bsave) + if(pCbInfo->bsave) { if(MsgSettingSetBool(CB_SAVE, pCbInfo->bsave) != MSG_SUCCESS) MSG_DEBUG("MsgSettingSetBool FAIL: CB_SAVE"); + } newCBMsgCBList.push_back(*pCbInfo); @@ -880,8 +823,7 @@ void MsgTransactionManager::setCBMsgCB(MSG_CMD_REG_INCOMING_CB_MSG_CB_S *pCbInfo void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -890,10 +832,8 @@ void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); - for (; it != newSyncMLMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) - { + for (; it != newSyncMLMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; } @@ -905,8 +845,7 @@ void MsgTransactionManager::setSyncMLMsgCB(MSG_CMD_REG_INCOMING_SYNCML_MSG_CB_S void MsgTransactionManager::setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -915,10 +854,8 @@ void MsgTransactionManager::setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbIn lbsmsg_list::iterator it = newLBSMsgCBList.begin(); - for (; it != newLBSMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) - { + for (; it != newLBSMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; } @@ -930,18 +867,15 @@ void MsgTransactionManager::setLBSMsgCB(MSG_CMD_REG_INCOMING_LBS_MSG_CB_S *pCbIn void MsgTransactionManager::setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S *pTrId) { - if (!pTrId) - { + if (!pTrId) { MSG_FATAL("trId NULL"); return; } javamms_list::iterator it; - for (it = javaMMSList.begin(); it != javaMMSList.end(); it++) - { - if (!strcmp(it->id, pTrId->id)) - { + for (it = javaMMSList.begin(); it != javaMMSList.end(); it++) { + if (!strcmp(it->id, pTrId->id)) { MSG_SEC_DEBUG("Duplicated javaMMS transaction Id:%s", it->id); return; } @@ -953,8 +887,7 @@ void MsgTransactionManager::setJavaMMSList(MSG_CMD_REG_INCOMING_JAVAMMS_TRID_S * void MsgTransactionManager::setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERATION_CB_S *pCbInfo) { - if (!pCbInfo) - { + if (!pCbInfo) { MSG_FATAL("cbinfo NULL"); return; } @@ -963,10 +896,8 @@ void MsgTransactionManager::setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERA syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); - for (; it != operationSyncMLMsgCBList.end(); it++) - { - if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) - { + for (; it != operationSyncMLMsgCBList.end(); it++) { + if ((it->listenerFd == pCbInfo->listenerFd) && (it->msgType == pCbInfo->msgType)) { MSG_DEBUG("Duplicated messageCB info fd %d, mType %d", it->listenerFd, it->msgType); return; } @@ -979,7 +910,7 @@ void MsgTransactionManager::setSyncMLMsgOperationCB(MSG_CMD_REG_SYNCML_MSG_OPERA void MsgTransactionManager::setStorageChangeCB(int listenerFd) { if (listenerFd <= 0) - THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d", listenerFd); + THROW(MsgException::INVALID_PARAM, "InParam Error: listenerFd %d", listenerFd); MutexLocker lock(mx); @@ -990,7 +921,7 @@ void MsgTransactionManager::setStorageChangeCB(int listenerFd) void MsgTransactionManager::setReportMsgCB(int listenerFd) { if (listenerFd <= 0) - THROW(MsgException::INVALID_PARAM,"InParam Error: listenerFd %d", listenerFd); + THROW(MsgException::INVALID_PARAM, "InParam Error: listenerFd %d", listenerFd); MutexLocker lock(mx); @@ -1044,9 +975,8 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const newmsg_list::iterator it = newMsgCBList.begin(); - for (; it != newMsgCBList.end(); it++) - { - MSG_DEBUG("fd %d dstport %d",it->listenerFd, it->port); + for (; it != newMsgCBList.end(); it++) { + MSG_DEBUG("fd %d dstport %d", it->listenerFd, it->port); if ((msgInfo->msgPort.valid == false) && (it->port == 0)) { MSG_DEBUG("Send incoming normal msg to listener %d", it->listenerFd); @@ -1066,7 +996,7 @@ void MsgTransactionManager::broadcastIncomingMsgCB(const msg_error_t err, const } else { bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_SMS); } - char msgId[MSG_EVENT_MSG_ID_LEN] = {0,}; + char msgId[MSG_EVENT_MSG_ID_LEN] = {0, }; snprintf(msgId, sizeof(msgId), "%u", msgInfo->msgId); bundle_add(b, EVT_KEY_MSG_ID, msgId); eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b); @@ -1094,22 +1024,16 @@ void MsgTransactionManager::broadcastMMSConfCB(const msg_error_t err, const MSG_ mmsconf_list::iterator it = newMMSConfMsgCBList.begin(); - for (; it != newMMSConfMsgCBList.end(); it++) - { - MSG_DEBUG("fd:%d appId:%s",it->listenerFd, it->appId); + for (; it != newMMSConfMsgCBList.end(); it++) { + MSG_DEBUG("fd:%d appId:%s", it->listenerFd, it->appId); - if (mmsRecvData->msgAppId.valid == true) - { - if (!strcmp(it->appId, mmsRecvData->msgAppId.appId)) - { + if (mmsRecvData->msgAppId.valid == true) { + if (!strcmp(it->appId, mmsRecvData->msgAppId.appId)) { MSG_DEBUG("Send incoming java msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } - } - else - { - if (strlen(it->appId) <= 0) - { + } else { + if (strlen(it->appId) <= 0) { MSG_DEBUG("Send incoming normal msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1133,11 +1057,9 @@ void MsgTransactionManager::broadcastPushMsgCB(const msg_error_t err, const MSG_ pushmsg_list::iterator it = newPushMsgCBList.begin(); - for (; it != newPushMsgCBList.end(); it++) - { + for (; it != newPushMsgCBList.end(); it++) { MSG_DEBUG("registered_appid : %s, incoming_appid: %s", it->appId, pushData->pushAppId); - if (!strcmp(it->appId, pushData->pushAppId)) - { + if (!strcmp(it->appId, pushData->pushAppId)) { MSG_DEBUG("Send incoming Push information to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1159,8 +1081,7 @@ void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB cbmsg_list::iterator it = newCBMsgCBList.begin(); - for (; it != newCBMsgCBList.end(); it++) - { + for (; it != newCBMsgCBList.end(); it++) { MSG_DEBUG("Send incoming CB information to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1170,7 +1091,7 @@ void MsgTransactionManager::broadcastCBMsgCB(const msg_error_t err, const MSG_CB b = bundle_create(); if (b) { bundle_add(b, EVT_KEY_MSG_TYPE, EVT_VAL_CB); - char msgId[MSG_EVENT_MSG_ID_LEN] = {0,}; + char msgId[MSG_EVENT_MSG_ID_LEN] = {0, }; snprintf(msgId, sizeof(msgId), "%u", cbMsgId); bundle_add(b, EVT_KEY_MSG_ID, msgId); eventsystem_send_system_event(SYS_EVENT_INCOMMING_MSG, b); @@ -1193,8 +1114,7 @@ void MsgTransactionManager::broadcastSyncMLMsgCB(const msg_error_t err, const MS syncmlmsg_list::iterator it = newSyncMLMsgCBList.begin(); - for (; it != newSyncMLMsgCBList.end(); it++) - { + for (; it != newSyncMLMsgCBList.end(); it++) { MSG_DEBUG("Send incoming SyncML information to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1217,8 +1137,7 @@ void MsgTransactionManager::broadcastLBSMsgCB(const msg_error_t err, const MSG_L lbsmsg_list::iterator it = newLBSMsgCBList.begin(); - for (; it != newLBSMsgCBList.end(); it++) - { + for (; it != newLBSMsgCBList.end(); it++) { MSG_DEBUG("Send incoming LBS msg to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1239,7 +1158,7 @@ void MsgTransactionManager::broadcastSyncMLMsgOperationCB(const msg_error_t err, char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); - // Encoding Storage Change Data + /* Encoding Storage Change Data */ int dataSize = MsgEncodeSyncMLOperationData(msgId, extId, &encodedData); int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_SYNCML_OPERATION, err, (void**)(&pEventData)); @@ -1248,8 +1167,7 @@ void MsgTransactionManager::broadcastSyncMLMsgOperationCB(const msg_error_t err, syncmlop_list::iterator it = operationSyncMLMsgCBList.begin(); - for( ; it != operationSyncMLMsgCBList.end() ; it++ ) - { + for( ; it != operationSyncMLMsgCBList.end() ; it++ ) { MSG_DEBUG("Send SyncML operation to listener %d", it->listenerFd); write(it->listenerFd, pEventData, eventSize); } @@ -1277,7 +1195,7 @@ void MsgTransactionManager::broadcastStorageChangeCB(const msg_error_t err, cons char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); - // Encoding Storage Change Data + /* Encoding Storage Change Data */ dataSize = MsgEncodeStorageChangeData(storageChangeType, pMsgIdList, &encodedData); int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_STORAGE_CHANGE_IND, err, (void**)(&pEventData)); @@ -1286,8 +1204,7 @@ void MsgTransactionManager::broadcastStorageChangeCB(const msg_error_t err, cons fd_map::iterator it = storageChangeFdMap.begin(); - for (; it != storageChangeFdMap.end(); it++) - { + for (; it != storageChangeFdMap.end(); it++) { MSG_DEBUG("Send Storage Change Callback to listener %d", it->first); write(it->first, pEventData, eventSize); } @@ -1315,7 +1232,7 @@ void MsgTransactionManager::broadcastReportMsgCB(const msg_error_t err, const ms char* encodedData = NULL; unique_ptr buf(&encodedData, unique_ptr_deleter); - // Encoding Storage Change Data + /* Encoding Storage Change Data */ dataSize = MsgEncodeReportMsgData(reportMsgType, pMsgInfo, &encodedData); int eventSize = MsgMakeEvent(encodedData, dataSize, MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND, err, (void**)(&pEventData)); @@ -1324,8 +1241,7 @@ void MsgTransactionManager::broadcastReportMsgCB(const msg_error_t err, const ms fd_map::iterator it = reportMsgCBFdMap.begin(); - for (; it != reportMsgCBFdMap.end(); it++) - { + for (; it != reportMsgCBFdMap.end(); it++) { MSG_DEBUG("Send Report Message Incoming Callback to listener %d", it->first); write(it->first, pEventData, eventSize); } @@ -1372,7 +1288,7 @@ void MsgTransactionManager::finishCynara() if (ret == CYNARA_API_SUCCESS) { MSG_INFO("cynara_finish() is successful"); } else { - MSG_INFO("cynara_finish() is failed [%d]",ret); + MSG_INFO("cynara_finish() is failed [%d]", ret); } p_cynara = NULL; diff --git a/include/common/MsgCmdTypes.h b/include/common/MsgCmdTypes.h index cf5be05..2bb06c2 100755 --- a/include/common/MsgCmdTypes.h +++ b/include/common/MsgCmdTypes.h @@ -67,97 +67,97 @@ enum _MSG_CMD_TYPE_E MSG_CMD_GET_STORAGELIST, MSG_CMD_ADD_MSG, MSG_CMD_ADD_SYNCML_MSG, -// 5 +/* 5 */ MSG_CMD_UPDATE_MSG, MSG_CMD_UPDATE_READ, MSG_CMD_UPDATE_PROTECTED, MSG_CMD_DELETE_MSG, MSG_CMD_DELALL_MSGINFOLDER, -// 10 +/* 10 */ MSG_CMD_MOVE_MSGTOFOLDER, MSG_CMD_MOVE_MSGTOSTORAGE, MSG_CMD_COUNT_MSG, MSG_CMD_GET_MSG, MSG_CMD_ADD_FOLDER, -// 15 +/* 15 */ MSG_CMD_UPDATE_FOLDER, MSG_CMD_DELETE_FOLDER, MSG_CMD_GET_FOLDERLIST, MSG_CMD_ADD_FILTER, MSG_CMD_UPDATE_FILTER, -// 20 +/* 20 */ MSG_CMD_DELETE_FILTER, MSG_CMD_GET_FILTERLIST, MSG_CMD_SET_FILTER_OPERATION, MSG_CMD_GET_FILTER_OPERATION, MSG_CMD_SUBMIT_REQ, -// 25 +/* 25 */ MSG_CMD_REG_SENT_STATUS_CB, MSG_CMD_REG_STORAGE_CHANGE_CB, MSG_CMD_REG_INCOMING_MSG_CB, MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB, MSG_CMD_REG_INCOMING_SYNCML_MSG_CB, -// 30 +/* 30 */ MSG_CMD_REG_INCOMING_LBS_MSG_CB, MSG_CMD_PLG_SENT_STATUS_CNF, MSG_CMD_PLG_STORAGE_CHANGE_IND, MSG_CMD_PLG_INCOMING_MSG_IND, MSG_CMD_PLG_INCOMING_MMS_CONF, -//35 +/* 35 */ MSG_CMD_PLG_INCOMING_SYNCML_IND, MSG_CMD_PLG_INCOMING_LBS_IND, MSG_CMD_PLG_INIT_SIM_BY_SAT, MSG_CMD_GET_THREADVIEWLIST, MSG_CMD_DELETE_THREADMESSAGELIST, -// 40 +/* 40 */ MSG_CMD_GET_CONTACT_COUNT, MSG_CMD_GET_QUICKPANEL_DATA, MSG_CMD_COUNT_BY_MSGTYPE, MSG_CMD_RESET_DB, MSG_CMD_GET_MEMSIZE, -// 45 +/* 45 */ MSG_CMD_BACKUP_MESSAGE, MSG_CMD_RESTORE_MESSAGE, MSG_CMD_UPDATE_THREAD_READ, MSG_CMD_REG_SYNCML_MSG_OPERATION_CB, MSG_CMD_SYNCML_OPERATION, -// 50 +/* 50 */ MSG_CMD_GET_REPORT_STATUS, MSG_CMD_GET_THREAD_ID_BY_ADDRESS, MSG_CMD_GET_THREAD_INFO, MSG_CMD_GET_SMSC_OPT, MSG_CMD_GET_CB_OPT, -// 55 +/* 55 */ MSG_CMD_GET_SMS_SEND_OPT, MSG_CMD_GET_MMS_SEND_OPT, MSG_CMD_GET_MMS_RECV_OPT, MSG_CMD_GET_PUSH_MSG_OPT, MSG_CMD_GET_VOICE_MSG_OPT, -// 60 +/* 60 */ MSG_CMD_GET_GENERAL_MSG_OPT, MSG_CMD_GET_MSG_SIZE_OPT, MSG_CMD_SET_SMSC_OPT, MSG_CMD_SET_CB_OPT, MSG_CMD_SET_SMS_SEND_OPT, -// 65 +/* 65 */ MSG_CMD_SET_MMS_SEND_OPT, MSG_CMD_SET_MMS_RECV_OPT, MSG_CMD_SET_PUSH_MSG_OPT, MSG_CMD_SET_VOICE_MSG_OPT, MSG_CMD_SET_GENERAL_MSG_OPT, -// 70 +/* 70 */ MSG_CMD_SET_MSG_SIZE_OPT, MSG_CMD_REG_INCOMING_PUSH_MSG_CB, MSG_CMD_PLG_INCOMING_PUSH_IND, MSG_CMD_REG_INCOMING_CB_MSG_CB, MSG_CMD_PLG_INCOMING_CB_IND, -//75 +/* 75 */ MSG_CMD_ADD_PUSH_EVENT, MSG_CMD_DELETE_PUSH_EVENT, MSG_CMD_UPDATE_PUSH_EVENT, MSG_CMD_DELETE_MESSAGE_BY_LIST, MSG_CMD_SET_FILTER_ACTIVATION, -// 80 +/* 80 */ MSG_CMD_ADD_SIM_MSG, MSG_CMD_PLG_RESEND_MESSAGE, MSG_CMD_REG_REPORT_MSG_INCOMING_CB, @@ -167,7 +167,7 @@ enum _MSG_CMD_TYPE_E #ifdef FEATURE_SMS_CDMA MSG_CMD_PLG_CHECK_UNIQUENESS, #endif -// end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM +/* end of MSG_CMD; new CMD should be defined before MSG_CMD_NUM */ MSG_CMD_NUM }; @@ -178,97 +178,97 @@ enum _MSG_EVENT_TYPE_E MSG_EVENT_GET_STORAGELIST, MSG_EVENT_ADD_MSG, MSG_EVENT_ADD_SYNCML_MSG, -// 5 +/* 5 */ MSG_EVENT_UPDATE_MSG, MSG_EVENT_UPDATE_READ, MSG_EVENT_UPDATE_PROTECTED, MSG_EVENT_DELETE_MSG, MSG_EVENT_DELALL_MSGINFOLDER, -// 10 +/* 10 */ MSG_EVENT_MOVE_MSGTOFOLDER, MSG_EVENT_MOVE_MSGTOSTORAGE, MSG_EVENT_COUNT_MSG, MSG_EVENT_GET_MSG, MSG_EVENT_ADD_FOLDER, -// 15 +/* 15 */ MSG_EVENT_UPDATE_FOLDER, MSG_EVENT_DELETE_FOLDER, MSG_EVENT_GET_FOLDERLIST, MSG_EVENT_ADD_FILTER, MSG_EVENT_UPDATE_FILTER, -// 20 +/* 20 */ MSG_EVENT_DELETE_FILTER, MSG_EVENT_GET_FILTERLIST, MSG_EVENT_SET_FILTER_OPERATION, MSG_EVENT_GET_FILTER_OPERATION, MSG_EVENT_SUBMIT_REQ, -// 25 +/* 25 */ MSG_EVENT_REG_SENT_STATUS_CB, MSG_EVENT_REG_STORAGE_CHANGE_CB, MSG_EVENT_REG_INCOMING_MSG_CB, MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB, MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB, -// 30 +/* 30 */ MSG_EVENT_REG_INCOMING_LBS_MSG_CB, MSG_EVENT_PLG_SENT_STATUS_CNF, MSG_EVENT_PLG_STORAGE_CHANGE_IND, MSG_EVENT_PLG_INCOMING_MSG_IND, MSG_EVENT_PLG_INCOMING_MMS_CONF, -//35 +/* 35 */ MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND, MSG_EVENT_PLG_INCOMING_LBS_MSG_IND, MSG_EVENT_PLG_INIT_SIM_BY_SAT, MSG_EVENT_GET_THREADVIEWLIST, MSG_EVENT_DELETE_THREADMESSAGELIST, -// 40 +/* 40 */ MSG_EVENT_GET_CONTACT_COUNT, MSG_EVENT_GET_QUICKPANEL_DATA, MSG_EVENT_COUNT_BY_MSGTYPE, MSG_EVENT_RESET_DB, MSG_EVENT_GET_MEMSIZE, -//45 +/* 45 */ MSG_EVENT_BACKUP_MESSAGE, MSG_EVENT_RESTORE_MESSAGE, MSG_EVENT_UPDATE_THREAD_READ, MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB, MSG_EVENT_SYNCML_OPERATION, -// 50 +/* 50 */ MSG_EVENT_GET_REPORT_STATUS, MSG_EVENT_GET_THREAD_ID_BY_ADDRESS, MSG_EVENT_GET_THREAD_INFO, MSG_EVENT_GET_SMSC_OPT, MSG_EVENT_GET_CB_OPT, -// 55 +/* 55 */ MSG_EVENT_GET_SMS_SEND_OPT, MSG_EVENT_GET_MMS_SEND_OPT, MSG_EVENT_GET_MMS_RECV_OPT, MSG_EVENT_GET_PUSH_MSG_OPT, MSG_EVENT_GET_VOICE_MSG_OPT, -// 60 +/* 60 */ MSG_EVENT_GET_GENERAL_MSG_OPT, MSG_EVENT_GET_MSG_SIZE_OPT, MSG_EVENT_SET_SMSC_OPT, MSG_EVENT_SET_CB_OPT, MSG_EVENT_SET_SMS_SEND_OPT, -// 65 +/* 65 */ MSG_EVENT_SET_MMS_SEND_OPT, MSG_EVENT_SET_MMS_RECV_OPT, MSG_EVENT_SET_PUSH_MSG_OPT, MSG_EVENT_SET_VOICE_MSG_OPT, MSG_EVENT_SET_GENERAL_MSG_OPT, -// 70 +/* 70 */ MSG_EVENT_SET_MSG_SIZE_OPT, MSG_EVENT_REG_INCOMING_PUSH_MSG_CB, MSG_EVENT_PLG_INCOMING_PUSH_MSG_IND, MSG_EVENT_REG_INCOMING_CB_MSG_CB, MSG_EVENT_PLG_INCOMING_CB_MSG_IND, -// 75 +/* 75 */ MSG_EVENT_ADD_PUSH_EVENT, MSG_EVENT_DELETE_PUSH_EVENT, MSG_EVENT_UPDATE_PUSH_EVENT, MSG_EVENT_DELETE_MESSAGE_BY_LIST, MSG_EVENT_SET_FILTER_ACTIVATION, -// 80 +/* 80 */ MSG_EVENT_ADD_SIM_MSG, MSG_EVENT_PLG_RESEND_MESSAGE, MSG_EVENT_REG_REPORT_MSG_INCOMING_CB, @@ -279,14 +279,14 @@ enum _MSG_EVENT_TYPE_E MSG_EVENT_PLG_CHECK_UNIQUENESS, #endif -// Enums that does not match _MSG_CMD_TYPE_E +/* Enums that does not match _MSG_CMD_TYPE_E */ MSG_EVENT_PLG_REPORT_MSG_INCOMING_IND, -// end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM +/* end of MSG_EVENT; new EVENT should be defined before MSG_EVENT_NUM */ MSG_EVENT_NUM }; -#endif // MSG_CMD_TYPES_H +#endif /* MSG_CMD_TYPES_H */ diff --git a/include/common/MsgCppTypes.h b/include/common/MsgCppTypes.h index 746b7e7..01546d9 100755 --- a/include/common/MsgCppTypes.h +++ b/include/common/MsgCppTypes.h @@ -24,7 +24,7 @@ #include template -void unique_ptr_deleter( T **ptr ) { +void unique_ptr_deleter(T **ptr) { if (ptr && *ptr ) delete[] *ptr; } @@ -34,7 +34,7 @@ template class AutoPtr { private: - T** ptr; // Caution: Memory allocation should be done by "new" not "malloc" + T** ptr; /* Caution: Memory allocation should be done by "new" not "malloc" */ public: @@ -51,5 +51,5 @@ public: } }; -#endif // #ifndef __MSG_CPP_TYPES_H__ +#endif /* __MSG_CPP_TYPES_H__ */ diff --git a/include/common/MsgFilterTypes.h b/include/common/MsgFilterTypes.h index cb453eb..eb05322 100755 --- a/include/common/MsgFilterTypes.h +++ b/include/common/MsgFilterTypes.h @@ -63,5 +63,5 @@ typedef struct * @} */ -#endif // MSG_FILTER_TYPES_H +#endif /* MSG_FILTER_TYPES_H */ diff --git a/include/common/MsgInternalTypes.h b/include/common/MsgInternalTypes.h index 49d965d..c32c2b3 100755 --- a/include/common/MsgInternalTypes.h +++ b/include/common/MsgInternalTypes.h @@ -39,14 +39,14 @@ #define MSG_THUMBNAIL_PATH MSG_DATA_PATH"thumbnails/" -// temporary +/* temporary */ #define MSG_SIM_MSISDN "memory/private/msg-service/msisdn" -#define MAX_FULL_PATH_SIZE 320 // max length for internal file path +#define MAX_FULL_PATH_SIZE 320 /* max length for internal file path */ #define MAX_THREAD_ADDR_LEN 40 #define MAX_THREAD_NAME_LEN 195 #define MAX_THREAD_DATA_LEN 128 -#define MAX_CB_MSG_TEXT_LEN 4200 // 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3) +#define MAX_CB_MSG_TEXT_LEN 4200 /* 1page max char(93)*max page(15)*max bytes of UTF8 1 char(3) */ #define MAX_CB_MSG_LANGUAGE_TYPE_LEN 3 #define MAX_ETWS_WARNING_SECURITY_INFO_LEN 50 #define MAX_ME_IMEI_LEN 20 @@ -88,7 +88,7 @@ #define DEFAULT_SIM_COUNT_PATH DEFAULT_SETTING_PATH"/sim_count" #define MSG_KEEP_COPY DEFAULT_GENERAL_OPT_PATH"/keep_copy" -//#define MSG_ALERT_REP_TYPE DEFAULT_GENERAL_OPT_PATH"/alert_rep_type" +/* #define MSG_ALERT_REP_TYPE DEFAULT_GENERAL_OPT_PATH"/alert_rep_type" */ #define MSG_ALERT_REP_TYPE "db/setting/sound/noti/msg_alert_rep_type" #define MSG_AUTO_ERASE DEFAULT_GENERAL_OPT_PATH"/auto_erase" #define MSG_BLOCK_MESSAGE DEFAULT_GENERAL_OPT_PATH"/block_msg" @@ -247,7 +247,9 @@ typedef struct MSG_MESSAGE_TYPE_S msgType; /**< Indicates the message type such as SMS and MMS */ msg_storage_id_t storageId; /**< Indicates where the message is saved. */ int nAddressCnt; /**< Indicates the count of addresses. */ -// MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ +#if 0 + MSG_ADDRESS_INFO_S addressList[MAX_TO_ADDRESS_CNT]; /**< Indicates the address information list. */ +#endif MSG_ADDRESS_INFO_S *addressList; /**< Indicates the address information list. */ char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ @@ -354,7 +356,7 @@ typedef struct size_t textSize; /**< Indicates the data size. The unit is byte. */ char *pText; /**< Indicates the message payload information as a body. default character encoding is UTF-8*/ int tcs_bc_level; - char firstMediaPath[MSG_FILEPATH_LEN_MAX+1]; // First Media Path in mms; + char firstMediaPath[MSG_FILEPATH_LEN_MAX+1]; /**< First Media Path in mms; */ msg_list_handle_t multipart_list; int simIndex; } MSG_CONVERSATION_VIEW_S; @@ -499,10 +501,10 @@ typedef struct time_t receivedTime; unsigned short serialNum; - unsigned short messageId; // Message Identifier - unsigned char dcs; // data coding scheme - int cbTextLen; // length of cbText - unsigned char cbText[MAX_CB_MSG_TEXT_LEN];// cb message text (UTF8) + unsigned short messageId; /**< Message Identifier */ + unsigned char dcs; /**< data coding scheme */ + int cbTextLen; /**< length of cbText */ + unsigned char cbText[MAX_CB_MSG_TEXT_LEN]; /**< cb message text (UTF8) */ unsigned short etwsWarningType; unsigned char etwsWarningSecurityInfo[MAX_ETWS_WARNING_SECURITY_INFO_LEN]; @@ -523,7 +525,7 @@ typedef struct { time_t receivedTime; unsigned short serialNum; - unsigned short messageId; // Message Identifier + unsigned short messageId; /**< Message Identifier */ } MSG_CB_DUPLICATE_S; #endif diff --git a/include/common/MsgMmsTypes.h b/include/common/MsgMmsTypes.h index 2ce1da6..7e48cc3 100755 --- a/include/common/MsgMmsTypes.h +++ b/include/common/MsgMmsTypes.h @@ -99,7 +99,7 @@ typedef struct char szAlt[MAX_SMIL_ALT_LEN + 1]; /**< Indicates the alternative text to be displayed in failure case */ MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */ char szDrm2FullPath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the fullpath of the DRM */ - union{ + union { MmsSmilText sText; /**< Indicates the text attributes */ MmsSmilAVI sAVI; /**< Indicates the video attributes */ } sMedia; @@ -120,7 +120,6 @@ typedef struct MsgDrmType drmType; /**< Indicates the drm type. see enum MsgDrmType */ char szDrm2FullPath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the fullpath of the DRM */ char szContentType[MSG_MSG_ID_LEN + 1]; - } MMS_ATTACH_S; /** @@ -136,7 +135,6 @@ typedef struct int nMin; /**< Indicates the min attribute of the page */ int nMax; /**< Indicates the max attribute of the page */ int nRepeat; /**< Indicates the page needs to be displayed repeatedly */ - }MMS_PAGE_S; /** @@ -157,11 +155,10 @@ typedef struct MMS_LENGTH nLeft; /**< Indicates the left co-ordinate of the region */ MMS_LENGTH nTop; /**< Indicates the top co-ordinate of the region */ MMS_LENGTH width; /**< Indicates the width of the region */ - MMS_LENGTH height; /**< Indicates the width of the region */ // '%' rate should be supported + MMS_LENGTH height; /**< Indicates the width of the region, '%' rate should be supported */ bool bBgColor; /**< Indicates the background color set in the region */ int bgColor; /**< Indicates the background color of the region */ REGION_FIT_TYPE_T fit; /**< Indicates the fit type. see enum REGION_FIT_TYPE_T */ - } MMS_SMIL_REGION; /** @@ -170,7 +167,7 @@ typedef struct typedef struct { MMS_LENGTH width; /**< Indicates the width of the root layout */ - MMS_LENGTH height; /**< Indicates the height of the root layout */ // '%' rate should be supported + MMS_LENGTH height; /**< Indicates the height of the root layout, '%' rate should be supported */ bool bBgColor; /**< Indicates the background color set in the root layout */ int bgColor; /**< Indicates the background color of the root layout */ }MMS_SMIL_ROOTLAYOUT; @@ -211,7 +208,7 @@ typedef struct -#define MAX_FULL_PATH_SIZE_S 160 // max length for internal file path +#define MAX_FULL_PATH_SIZE_S 160 /* max length for internal file path */ typedef struct { @@ -231,72 +228,71 @@ typedef struct _MMS_ADDRESS_DATA_S { */ typedef struct _MMS_HEADER_DATA_S { - MMSList *bcc;// Bcc - MMSList *cc;// Cc + MMSList *bcc; /* Bcc */ + MMSList *cc; /* Cc */ char contentLocation[MMS_LOCATION_LEN + 1]; - char szContentType[MSG_MSG_ID_LEN + 1];//string : ex) application/vnd.wap.multipart.related + char szContentType[MSG_MSG_ID_LEN + 1]; /* string : ex) application/vnd.wap.multipart.related */ unsigned long int date; - bool bDeliveryReport; // X-Mms-Delivery-Report - MmsTimeStruct delivery; // X-Mms-Delivery-Time + bool bDeliveryReport; /* X-Mms-Delivery-Report */ + MmsTimeStruct delivery; /* X-Mms-Delivery-Time */ MmsTimeStruct expiry; - char szFrom[254 * 3 + 11]; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" // From - int messageClass;//Personal | Advertisement | Informational | Auto + char szFrom[254 * 3 + 11]; /* "/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6", From */ + int messageClass; /* Personal | Advertisement | Informational | Auto */ char messageID[MSG_MSG_ID_LEN + 1]; - int messageType;//MmsMsgType : ex) sendreq - int mmsVersion;//1.0 1.3 - int messageSize; //X-Mms-Message-Size - int mmsPriority;//_MSG_PRIORITY_TYPE_E : Low | Normal | High - bool bReadReport;// X-Mms-Read-Report -// X-Mms-Report-Allowed -// X-Mms-Response-Status -// X-Mms-Response-Text - bool bHideAddress;// X-Mms-Sender-Visibility - msg_delivery_report_status_t mmsStatus;// X-Mms-Status - char szSubject[MAX_SUBJECT_LEN + 1];// Subject - MMSList *to;// Cc// To + int messageType; /* MmsMsgType : ex) sendreq */ + int mmsVersion; /* 1.0 1.3 */ + int messageSize; /* X-Mms-Message-Size */ + int mmsPriority; /* _MSG_PRIORITY_TYPE_E : Low | Normal | High */ + bool bReadReport; /* X-Mms-Read-Report */ + bool bHideAddress; /* X-Mms-Sender-Visibility */ + msg_delivery_report_status_t mmsStatus; /* X-Mms-Status */ + char szSubject[MAX_SUBJECT_LEN + 1]; /* Subject */ + MMSList *to; /* to */ char trID[MSG_MSG_ID_LEN + 1]; -// X-Mms-Retrieve-Status -// X-Mms-Retrieve-Text -// X-Mms-Read-Status -// X-Mms-Reply-Charging -// X-Mms-Reply-Charging-Deadline -// X-Mms-Reply-Charging-ID -// X-Mms-Reply-Charging-Size -// X-Mms-Previously-Sent-By -// X-Mms-Previously-Sent-Date -// X-Mms-Store -// X-Mms-MM-State -// X-Mms-MM-Flags -// X-Mms-Store-Status -// X-Mms-Store-Status-Text -// X-Mms-Stored -// X-Mms-Attributes -// X-Mms-Totals -// X-Mms-Mbox-Totals -// X-Mms-Quotas -// X-Mms-Mbox-Quotas -// X-Mms-Message-Count -// Content -// X-Mms-Start -// Additional-headers -// X-Mms-Distribution-Indicator -// X-Mms-Element-Descriptor -// X-Mms-Limit -// X-Mms-Recommended-Retrieval-Mode -// X-Mms-Recommended-Retrieval-Mode-Text -// X-Mms-Status-Text -// X-Mms-Applic-ID -// X-Mms-Reply-Applic-ID -// X-Mms-Aux-Applic-Info - int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich -// X-Mms-DRM-Content -// X-Mms-Adaptation-Allowed -// X-Mms-Replace-ID -// X-Mms-Cancel-ID -// X-Mms-Cancel-Status -//------------------------------------------------------------------ - int contentType;//MimeType : ex) application/vnd.wap.multipart.related - + int contentClass; /* text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */ + int contentType; /* MimeType : ex) application/vnd.wap.multipart.related */ +#if 0 + X-Mms-Report-Allowed + X-Mms-Response-Status + X-Mms-Response-Text + X-Mms-Retrieve-Status + X-Mms-Retrieve-Text + X-Mms-Read-Status + X-Mms-Reply-Charging + X-Mms-Reply-Charging-Deadline + X-Mms-Reply-Charging-ID + X-Mms-Reply-Charging-Size + X-Mms-Previously-Sent-By + X-Mms-Previously-Sent-Date + X-Mms-Store + X-Mms-MM-State + X-Mms-MM-Flags + X-Mms-Store-Status + X-Mms-Store-Status-Text + X-Mms-Stored + X-Mms-Attributes + X-Mms-Totals + X-Mms-Mbox-Totals + X-Mms-Quotas + X-Mms-Mbox-Quotas + X-Mms-Message-Count + X-Mms-Start + /* Additional-headers */ + X-Mms-Distribution-Indicator + X-Mms-Element-Descriptor + X-Mms-Limit + X-Mms-Recommended-Retrieval-Mode + X-Mms-Recommended-Retrieval-Mode-Text + X-Mms-Status-Text + X-Mms-Applic-ID + X-Mms-Reply-Applic-ID + X-Mms-Aux-Applic-Info + X-Mms-DRM-Content + X-Mms-Adaptation-Allowed + X-Mms-Replace-ID + X-Mms-Cancel-ID + X-Mms-Cancel-Status +#endif } MMS_HEADER_DATA_S; /** @@ -324,7 +320,7 @@ typedef struct */ typedef struct _MMS_MESSAGE_DATA_S { - int backup_type; //normal = 0|| backup = 1; + int backup_type; /**< normal = 0|| backup = 1; */ char szSmilFilePath[MSG_FILEPATH_LEN_MAX + 1]; /**< Indicates the SMIL file path */ int pageCnt; /**< The count of the SMIL pages */ GList *pagelist; /**< The pointer to SMIL pages list */ @@ -338,8 +334,8 @@ typedef struct _MMS_MESSAGE_DATA_S GList *metalist; /**< The pointer to SMIL meta list */ MMS_SMIL_ROOTLAYOUT rootlayout; /**< Indicates the root layout information */ MMS_APPID_INFO_S msgAppId; - MMS_HEADER_DATA_S header;//use for scloud - MMS_MULTIPART_DATA_S smil;//use for scloud + MMS_HEADER_DATA_S header; /**< use for scloud */ + MMS_MULTIPART_DATA_S smil;/**< use for scloud */ } MMS_MESSAGE_DATA_S; /** @@ -347,7 +343,7 @@ typedef struct _MMS_MESSAGE_DATA_S */ typedef struct { - int backup_type; //none = 0 || scloud backup = 1 || kies backup = 2; + int backup_type; /* none = 0 || scloud backup = 1 || kies backup = 2; */ MMS_HEADER_DATA_S *header; /**< The header struct of MMS*/ MMS_MULTIPART_DATA_S *smil; MMSList *multipartlist; /**< list of MMS_MULTIPART_DATA_S*/ diff --git a/include/common/MsgPluginInterface.h b/include/common/MsgPluginInterface.h index a530ae4..cd8daa5 100755 --- a/include/common/MsgPluginInterface.h +++ b/include/common/MsgPluginInterface.h @@ -147,7 +147,7 @@ msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle); -// Control API +/* Control API */ /** * \par Description: @@ -353,7 +353,7 @@ typedef msg_error_t (*MsgPlgCheckSimStatus)(MSG_SIM_STATUS_T *pStatus); typedef msg_error_t (*MsgPlgCheckDeviceStatus)(); -// Transport API +/* Transport API */ /** * \par Description: @@ -396,7 +396,7 @@ typedef msg_error_t (*MsgPlgCheckDeviceStatus)(); typedef msg_error_t (*MsgPlgSubmitRequest)(MSG_REQUEST_INFO_S *pReqInfo); -// Storage API +/* Storage API */ /** * \par Description: @@ -441,7 +441,7 @@ typedef msg_error_t (*MsgPlgSubmitRequest)(MSG_REQUEST_INFO_S *pReqInfo); typedef msg_error_t (*MsgPlgInitSimMessage)(); -// Storage API +/* Storage API */ /** * \par Description: @@ -619,7 +619,7 @@ typedef msg_error_t (*MsgPlgSetMemoryStatus)(msg_error_t Error); typedef msg_error_t (*MsgPlgSetMemoryStatus)(msg_sim_slot_id_t sim_idx, msg_error_t Error); #endif -// Setting API +/* Setting API */ /** * \par Description: @@ -662,7 +662,7 @@ typedef msg_error_t (*MsgPlgSetMemoryStatus)(msg_sim_slot_id_t sim_idx, msg_erro typedef msg_error_t (*MsgPlgInitConfigData)(MSG_SIM_STATUS_T SimStatus); -// Setting API +/* Setting API */ /** * \par Description: @@ -746,7 +746,7 @@ typedef msg_error_t (*MsgPlgSetConfigData)(const MSG_SETTING_S *pSetting); /*================================================================================================*/ typedef msg_error_t (*MsgPlgGetConfigData)(MSG_SETTING_S *pSetting); -// MMS API +/* MMS API */ /** * \par Description: @@ -1049,7 +1049,7 @@ typedef msg_error_t (*MsgPlgGetMeImei) (char *pImei); typedef msg_error_t (*MsgPlgGetDefaultNetworkSimId) (int *simId); -// framework defined callbacks. +/* framework defined callbacks. */ typedef void (*MsgPlgOnSentStatus)(MSG_SENT_STATUS_S *pSentStatus); typedef void (*MsgPlgOnStorageChange)(msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList); typedef msg_error_t (*MsgPlgOnMsgIncoming)(MSG_MESSAGE_INFO_S *pMsgInfo); diff --git a/include/common/MsgQueue.h b/include/common/MsgQueue.h index 69cb8f2..d1a06c2 100755 --- a/include/common/MsgQueue.h +++ b/include/common/MsgQueue.h @@ -21,12 +21,12 @@ #include -template +template class MsgSimpleQ { public: MsgSimpleQ(){}; - void pop_front (); + void pop_front(); bool front(T* qItem); void push_front(T const & input); void push_back(T const & input); @@ -39,62 +39,61 @@ private: std::list q; }; -template +template void MsgSimpleQ::pop_front() { - if( q.empty() ) return; + if(q.empty()) return; q.pop_front(); } -template +template bool MsgSimpleQ::front(T* qItem) { if( qItem == NULL || q.empty() ) - return false; // Fail + return false; /* Fail */ - *qItem = q.front(); // copy + *qItem = q.front(); /* copy */ - return true; // Success + return true; /* Success */ } -template +template void MsgSimpleQ::push_back(T const & qItem) { q.push_back(qItem); } -template void +template void MsgSimpleQ::push_front(T const & qItem) { q.push_front(qItem); } -template +template int MsgSimpleQ::size() { return q.size(); } -template +template bool MsgSimpleQ::empty() { return q.empty(); } -template +template void MsgSimpleQ::clear() { q.clear(); } -template +template bool MsgSimpleQ::checkExist(T const & qItem, bool(cmp)(T const &, T const &)) { - for(typename list::iterator iterPos = q.begin(); iterPos != q.end(); ++iterPos) { - + for (typename list::iterator iterPos = q.begin(); iterPos != q.end(); ++iterPos) { if (cmp(qItem, *iterPos) == true) return true; } @@ -105,13 +104,12 @@ bool MsgSimpleQ::checkExist(T const & qItem, bool(cmp)(T const &, T const &)) template void MsgSimpleQ::remove(T const & qItem, bool(cmp)(T const &, T const &)) { - for(typename list::iterator iterPos = q.begin(); iterPos != q.end(); ) { - + for (typename list::iterator iterPos = q.begin(); iterPos != q.end(); ) { if (cmp(qItem, *iterPos) == true) q.erase(iterPos++); else ++iterPos; } } -#endif // __MsgThdSafeQ_H__ +#endif /* __MsgThdSafeQ_H__ */ diff --git a/include/common/MsgSettingTypes.h b/include/common/MsgSettingTypes.h index ab30fb0..788efaf 100755 --- a/include/common/MsgSettingTypes.h +++ b/include/common/MsgSettingTypes.h @@ -332,7 +332,9 @@ typedef struct { MSG_MMS_HOME_RETRIEVE_TYPE_T homeNetwork; /**< Indicates the retrieve type for MMS home network. */ MSG_MMS_ABROAD_RETRIEVE_TYPE_T abroadNetwok; /**< Indicates the retrieve type for MMS abroad network. */ -// MSG_MMS_SEND_READ_REPORT_T readReceipt; /**< Indicates whether the read report will be sent or not. */ +#if 0 + MSG_MMS_SEND_READ_REPORT_T readReceipt; /**< Indicates whether the read report will be sent or not. */ +#endif bool readReceipt; /**< Indicates whether the read report will be sent or not. */ bool bDeliveryReceipt; /**< Indicates whether the delivery report will be sent or not. */ bool bRejectUnknown; /**< Indicates whether unknown addresses are rejected or not. */ @@ -423,8 +425,7 @@ typedef struct { MSG_OPTION_TYPE_T type; /**< The option type in a setting */ - union - { + union { MSG_GENERAL_OPT_S generalOpt; /**< General option */ MSG_SMS_SENDOPT_S smsSendOpt; /**< SMS send option */ MSG_SMSC_LIST_S smscList; /**< SMSC list option */ @@ -443,5 +444,5 @@ typedef struct * @} */ -#endif // MSG_SETTING_TYPES_H +#endif /* MSG_SETTING_TYPES_H */ diff --git a/include/common/MsgSmil.h b/include/common/MsgSmil.h index 6537e0e..540479f 100755 --- a/include/common/MsgSmil.h +++ b/include/common/MsgSmil.h @@ -37,4 +37,4 @@ bool MsgSmilParseSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, const char *pSmilDoc */ bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc); -#endif//MSG_SMIL_H +#endif /* MSG_SMIL_H */ diff --git a/include/common/MsgStorageTypes.h b/include/common/MsgStorageTypes.h index f882676..6332864 100755 --- a/include/common/MsgStorageTypes.h +++ b/include/common/MsgStorageTypes.h @@ -164,5 +164,5 @@ typedef struct char appid[MAX_WAPPUSH_ID_LEN]; } PUSH_APPLICATION_INFO_S; -#endif // MSG_STORAGE_TYPES_H +#endif /* MSG_STORAGE_TYPES_H */ diff --git a/include/common/MsgThread.h b/include/common/MsgThread.h index c3c5ed6..88d1875 100755 --- a/include/common/MsgThread.h +++ b/include/common/MsgThread.h @@ -32,12 +32,10 @@ class MsgThread public: MsgThread(): thd(0) {}; - virtual void start() - { + virtual void start() { MSG_DEBUG("MsgThread::Start() called"); - if (pthread_create(&thd, NULL, &MsgThread::thdMain, this) < 0) - { + if (pthread_create(&thd, NULL, &MsgThread::thdMain, this) < 0) { MSG_DEBUG("pthread_create() error"); return; } @@ -45,21 +43,18 @@ public: pthread_detach(thd); } - virtual void stop() - { + virtual void stop() { MSG_DEBUG("MsgThread::stop() called"); } - void wait() - { + void wait() { MSG_DEBUG("MsgThread::Wait() called"); void* pData; pthread_join(thd, &pData); } private: - static void* thdMain(void* pInst) - { + static void* thdMain(void* pInst) { MSG_DEBUG("MsgThread::thdMain() called"); MsgThread* pt = static_cast(pInst); pt->run(); diff --git a/include/common/MsgTransportTypes.h b/include/common/MsgTransportTypes.h index e4cf048..c8ebbe4 100755 --- a/include/common/MsgTransportTypes.h +++ b/include/common/MsgTransportTypes.h @@ -71,5 +71,5 @@ typedef struct * @} */ -#endif // MSG_TRANSPORT_TYPES_H +#endif /* MSG_TRANSPORT_TYPES_H */ diff --git a/include/common/MsgTypes.h b/include/common/MsgTypes.h index d91eeed..6f67b08 100755 --- a/include/common/MsgTypes.h +++ b/include/common/MsgTypes.h @@ -53,7 +53,7 @@ /** * @brief Defines the enabled MMS version */ -#define MMS_V1_2 // MMS Version : MMS_V1_0 / MMS_V1_1 / MMS_V1_2 +#define MMS_V1_2 /* MMS Version : MMS_V1_0 / MMS_V1_1 / MMS_V1_2 */ /** @@ -72,7 +72,7 @@ * @brief Defines message struct handle. */ -typedef struct _msg_struct{ +typedef struct _msg_struct { int type; void *data; }msg_struct_s; @@ -138,15 +138,14 @@ typedef struct bool bKeepCopy; msg_struct_t mmsSendOpt; msg_struct_t smsSendOpt; - } MSG_SENDINGOPT_S; typedef enum { - MMS_TIMETYPE_NONE = -1, // fixme: backward compatibility - MMS_TIMETYPE_ERROR = -1, // error return in Get method - MMS_TIMETYPE_RELATIVE = 0, // default + MMS_TIMETYPE_NONE = -1, /**< fixme: backward compatibility */ + MMS_TIMETYPE_ERROR = -1, /**< error return in Get method */ + MMS_TIMETYPE_RELATIVE = 0, /**< default */ MMS_TIMETYPE_ABSOLUTE = 1 }MmsTimeType; @@ -189,8 +188,7 @@ typedef struct bool bDeliverReq; bool bKeepCopy; - union - { + union { MMS_SENDINGOPT_INFO_S mmsSendOptInfo; SMS_SENDINGOPT_INFO_S smsSendOptInfo; } option; @@ -345,5 +343,5 @@ typedef struct * @} */ -#endif // MSG_TYPES_H +#endif /* MSG_TYPES_H */ diff --git a/include/framework/MsgDeliverHandler.h b/include/framework/MsgDeliverHandler.h index e959c48..8baf4af 100755 --- a/include/framework/MsgDeliverHandler.h +++ b/include/framework/MsgDeliverHandler.h @@ -40,5 +40,5 @@ void MsgLaunchClass0(msg_message_id_t msgId); ==================================================================================================*/ #define MSG_SVC_PKG_NAME_BROWSER "org.tizen.browser" -#endif // MSG_DELIVER_HANDLER_H +#endif /* MSG_DELIVER_HANDLER_H */ diff --git a/include/framework/MsgPluginManager.h b/include/framework/MsgPluginManager.h index 9d49a33..f440a4a 100755 --- a/include/framework/MsgPluginManager.h +++ b/include/framework/MsgPluginManager.h @@ -61,7 +61,7 @@ public: msg_error_t getDefaultNetworkSimId(int *simId); - // MMS handlers + /* MMS handlers */ msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pFileData); msg_error_t processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject); @@ -72,14 +72,14 @@ public: msg_error_t restoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char* pRecvBody, int rcvdBodyLen, char* filePath); operator void*() const { - return (mSupportedMsg==MSG_UNKNOWN_TYPE)? NULL:(void*) this; + return (mSupportedMsg == MSG_UNKNOWN_TYPE)? NULL:(void*) this; } private: MSG_MAIN_TYPE_T mSupportedMsg; MSG_PLUGIN_HANDLER_S mPlgHandler; - void *mLibHandler; // plugin library pointer + void *mLibHandler; /* plugin library pointer */ }; @@ -120,5 +120,5 @@ private: MsgPluginMap plgMap; }; -#endif // MSG_PLUGIN_MANAGER_H +#endif /* MSG_PLUGIN_MANAGER_H */ diff --git a/include/framework/MsgSettingHandler.h b/include/framework/MsgSettingHandler.h index 54ba7ba..b6ce6a2 100755 --- a/include/framework/MsgSettingHandler.h +++ b/include/framework/MsgSettingHandler.h @@ -57,7 +57,7 @@ void MsgGetMsgSizeOpt(MSG_SETTING_S *pSetting); msg_error_t MsgSetConfigInSim(const MSG_SETTING_S *pSetting); msg_error_t MsgGetConfigInSim(MSG_SETTING_S *pSetting); -//void MsgSetDefaultConfig(); +/* void MsgSetDefaultConfig(); */ #endif diff --git a/include/framework/MsgStorageHandler.h b/include/framework/MsgStorageHandler.h index bad0eb2..75cbd82 100755 --- a/include/framework/MsgStorageHandler.h +++ b/include/framework/MsgStorageHandler.h @@ -81,27 +81,27 @@ msg_error_t MsgStoGetThreadUnreadCnt(msg_thread_id_t ThreadId, int *cnt); msg_error_t MsgStoGetThreadInfo(msg_thread_id_t threadId, MSG_THREAD_VIEW_S *pThreadInfo); -// Folder +/* Folder */ msg_error_t MsgStoAddFolder(const MSG_FOLDER_INFO_S *pFolderInfo); msg_error_t MsgStoUpdateFolder(const MSG_FOLDER_INFO_S *pFolderInfo); msg_error_t MsgStoDeleteFolder(msg_folder_id_t FolderId); msg_error_t MsgStoGetFolderList(msg_struct_list_s *pFolderList); -// Filter +/* Filter */ msg_error_t MsgStoAddFilter(const MSG_FILTER_S *pFilter); msg_error_t MsgStoUpdateFilter(const MSG_FILTER_S *pFilter); msg_error_t MsgStoDeleteFilter(msg_filter_id_t FilterId); msg_error_t MsgStoGetFilterList(msg_struct_list_s *pFilterList); msg_error_t MsgStoSetFilterActivation(msg_filter_id_t filterId, bool bActive); -// Sim Operation related Functions +/* Sim Operation related Functions */ msg_error_t MsgStoClearSimMessageInDB(); -// Internal Function +/* Internal Function */ msg_error_t MsgStoGetSmsSendOpt(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S* pSendOpt); msg_error_t MsgStoGetMmsSendOpt(msg_message_id_t MsgId, MSG_SENDINGOPT_INFO_S* pSendOpt); -// SyncML Msg +/* SyncML Msg */ msg_error_t MsgStoGetSyncMLExtId(msg_message_id_t msgId, int *extId); bool MsgStoCheckSyncMLMsgInThread(msg_thread_id_t threadId); @@ -110,15 +110,13 @@ msg_error_t MsgStoGetContentLocation(MSG_MESSAGE_INFO_S* pMsgInfo); msg_error_t MsgStoSetReadReportSendStatus(msg_message_id_t msgId, int readReportSendStatus); msg_error_t MsgStoGetReadReportSendStatus(msg_message_id_t msgId, int *pReadReportSendStatus); -/////////////////////////////////////////////////////////////////////////////////// -// For MMS - will be removed +/* For MMS - will be removed */ msg_error_t MsgStoGetOrgAddressList(MSG_MESSAGE_INFO_S *pMsg); msg_error_t MsgStoGetSubject(msg_message_id_t MsgId, char* pSubject); msg_error_t MsgStoGetRecipientList(msg_message_id_t msgId, MSG_RECIPIENTS_LIST_S *pRecipientList); msg_error_t MsgStoGetReadStatus(msg_message_id_t MsgId, bool *pReadStatus); msg_error_t MsgStoGetAddrInfo(msg_message_id_t MsgId, MSG_ADDRESS_INFO_S *pAddrInfo); -/////////////////////////////////////////////////////////////////////////////////// msg_error_t MsgStoResetNetworkStatus(); #if 0 @@ -146,5 +144,5 @@ msg_error_t MsgCheckUniqueness(bool bInsert, msg_message_id_t msgId, MSG_UNIQUE_ #endif msg_error_t MsgStoUpdateIMSI(int sim_idx); -#endif // MSG_STORAGE_HANDLER_H +#endif /* MSG_STORAGE_HANDLER_H */ diff --git a/include/framework/MsgSubmitHandler.h b/include/framework/MsgSubmitHandler.h index d3d9591..2405e43 100755 --- a/include/framework/MsgSubmitHandler.h +++ b/include/framework/MsgSubmitHandler.h @@ -36,5 +36,5 @@ msg_error_t MsgUpdateSentMsg(msg_message_id_t MsgId, msg_network_status_t Status void MsgCopyReqInfo(MSG_REQUEST_INFO_S *pSrc, int addrIdx, MSG_REQUEST_INFO_S *pDest); -#endif // MSG_SUBMIT_HANDLER_H +#endif /* MSG_SUBMIT_HANDLER_H */ diff --git a/include/framework/MsgTransManager.h b/include/framework/MsgTransManager.h index f2fc587..2933099 100755 --- a/include/framework/MsgTransManager.h +++ b/include/framework/MsgTransManager.h @@ -65,7 +65,7 @@ public: void workerEventQueue(); void write(int fd, const char* buf, int len); - // methods for sent status event + /* methods for sent status event */ void insertSentMsg(int reqId, MSG_PROXY_INFO_S* pChInfo); MSG_PROXY_INFO_S* getProxyInfo(int reqId); void delProxyInfo(int reqId); @@ -103,7 +103,7 @@ private: void handleRequest(int fd); void cleanup(int fd); -// bool checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie); +/* bool checkPrivilege(MSG_CMD_TYPE_T CmdType, const char *pCookie); */ bool checkPrivilege(int fd, MSG_CMD_TYPE_T CmdType); static MsgTransactionManager* pInstance; @@ -112,20 +112,20 @@ private: bool running; handler_map handlerMap; - sentmsg_map sentMsgMap; // req_id, listener_fd, msghandle_addr - fd_map statusCBFdMap; // src_fd, true if registered + sentmsg_map sentMsgMap; + fd_map statusCBFdMap; - newmsg_list newMsgCBList; // src_fd, msgType, port if registered - mmsconf_list newMMSConfMsgCBList; // src_fd, msgType, port if registered - pushmsg_list newPushMsgCBList; // src_fd, msgType, port if registered - cbmsg_list newCBMsgCBList; // src_fd, msgType, port if registered - syncmlmsg_list newSyncMLMsgCBList; // src_fd, msgType, port if registered - lbsmsg_list newLBSMsgCBList; // src_fd, msgType, port if registered - javamms_list javaMMSList; // trId list to distinguish sent Java MMS msg when sendconf received - syncmlop_list operationSyncMLMsgCBList; // src_fd, msgType, port if registered + newmsg_list newMsgCBList; + mmsconf_list newMMSConfMsgCBList; + pushmsg_list newPushMsgCBList; + cbmsg_list newCBMsgCBList; + syncmlmsg_list newSyncMLMsgCBList; + lbsmsg_list newLBSMsgCBList; + javamms_list javaMMSList; + syncmlop_list operationSyncMLMsgCBList; - fd_map storageChangeFdMap; // src_fd, true if registered - fd_map reportMsgCBFdMap; // src_fd, true if registered + fd_map storageChangeFdMap; + fd_map reportMsgCBFdMap; Mutex mx; /* mutex for shared resources like callback listeners */ Mutex mxQ; /* mutex for event queue */ @@ -137,5 +137,5 @@ private: enum cynara_user_creds user_method; }; -#endif //MSG_TRANSACTION_MANAGER_H +#endif /* MSG_TRANSACTION_MANAGER_H */ diff --git a/include/mapi/msg_private.h b/include/mapi/msg_private.h index 407c725..616156f 100755 --- a/include/mapi/msg_private.h +++ b/include/mapi/msg_private.h @@ -43,7 +43,7 @@ MSG_ERR("Feature [%s] not supported", (feature_name));\ return MSG_ERR_NOT_SUPPORTED; \ } \ - } while(0) + } while (0) #define CHECK_MSG_SUPPORTED_RETURN_NULL(feature_name) \ do { \ @@ -53,7 +53,7 @@ MSG_ERR("Feature [%s] not supported", (feature_name));\ return NULL; \ } \ - } while(0) + } while (0) /*================================================================================================== FUNCTION PROTOTYPES diff --git a/include/mapi/msg_storage_types.h b/include/mapi/msg_storage_types.h index 3f4dfa2..60d5545 100755 --- a/include/mapi/msg_storage_types.h +++ b/include/mapi/msg_storage_types.h @@ -204,12 +204,12 @@ enum _MSG_COUNT_LIMIT_MSG_TYPE_E { * This enum is used with storage change callback functions. */ enum _MSG_STORAGE_CHANGE_TYPE_E { - // msg data + /* msg data */ MSG_STORAGE_CHANGE_INSERT = 1, /**< Indicates storage change by an INSERT operation*/ MSG_STORAGE_CHANGE_UPDATE, /**< Indicates storage change by an UPDATE operation*/ MSG_STORAGE_CHANGE_DELETE, /**< Indicates storage change by a DELETE operation*/ - // thread data + /* thread data */ MSG_STORAGE_CHANGE_CONTACT, /**< Indicates storage change by a CHANGE CONTACT operation*/ }; diff --git a/include/mapi/msg_transport.h b/include/mapi/msg_transport.h index 2e71c1d..9badbe7 100755 --- a/include/mapi/msg_transport.h +++ b/include/mapi/msg_transport.h @@ -554,5 +554,5 @@ int msg_mms_reject_message(msg_handle_t handle, msg_struct_t req); } #endif -#endif // MAPI_TRANSPORT_H +#endif /* MAPI_TRANSPORT_H */ diff --git a/include/mapi/msg_types.h b/include/mapi/msg_types.h index fbba025..c54f590 100755 --- a/include/mapi/msg_types.h +++ b/include/mapi/msg_types.h @@ -1207,7 +1207,7 @@ enum _MSG_ERROR_E { MSG_ERR_INVALID_STORAGE_ID = -4, /**< Storage ID is invalid */ MSG_ERR_INVALID_MSG_TYPE = -5, /**< Message type is invalid */ - MSG_ERR_INVALID_STORAGE_REG= -6, /**< Storage registry is invalid */ + MSG_ERR_INVALID_STORAGE_REG = -6, /**< Storage registry is invalid */ MSG_ERR_INVALID_MESSAGE_ID = -7, /**< Message ID is invalid */ MSG_ERR_INVALID_MSGHANDLE = -8, /**< Message handle is invalid */ MSG_ERR_INVALID_PARAMETER = -9, /**< Parameter is invalid */ @@ -1241,13 +1241,13 @@ enum _MSG_ERROR_E { MSG_ERR_DB_PREPARE = -31, /**< DB prepare query error*/ MSG_ERR_DB_STEP = -32, /**< DB step query error*/ - MSG_ERR_DB_NORECORD= -33, /**< DB no-record error*/ + MSG_ERR_DB_NORECORD = -33, /**< DB no-record error*/ MSG_ERR_DB_STORAGE_INIT = -34, /**< DB storage init error*/ MSG_ERR_DB_MAKE_DIR = -35, /**< mkdir error*/ MSG_ERR_DB_ROW = -36, /**< DB step() has another row ready */ MSG_ERR_DB_DONE = -37, /**< DB step() has finished executing */ - MSG_ERR_DB_GENERIC= -38, /**< Generic DB error*/ + MSG_ERR_DB_GENERIC = -38, /**< Generic DB error*/ MSG_ERR_DB_END = -39, /**< DB end error*/ /* End Database Errors */ @@ -1689,7 +1689,6 @@ typedef enum _MimeType { MIME_TYPE_VALUE_MAX = 0x7207, /**< Indicates the maximum MIME type */ MIME_UNKNOWN = 0xffff /**< Indicates the unknown MIME type */ - } MimeType; /** @@ -1740,7 +1739,7 @@ typedef enum { MMS_SMIL_TRANS_IRISWIPE = 7, /**< Indicates the iris wipe transition */ MMS_SMIL_TRANS_BOXWIPE = 8, /**< Indicates the box wipe transition */ MMS_SMIL_TRANS_FOURBOXWIPE = 9, /**< Indicates the four box wipe transition */ - MMS_SMIL_TRANS_PUSHWIPE =10, /**< Indicates the push wipe transition */ + MMS_SMIL_TRANS_PUSHWIPE = 10, /**< Indicates the push wipe transition */ MMS_SMIL_TRANS_ELLIPSEWIPE = 11 /**< Indicates the ellipse wipe transition */ }MmsSmilTransType; diff --git a/include/utils/MsgCallStatusManager.h b/include/utils/MsgCallStatusManager.h index e4ac0d2..7743bbe 100644 --- a/include/utils/MsgCallStatusManager.h +++ b/include/utils/MsgCallStatusManager.h @@ -37,5 +37,5 @@ void MsgInitCallStatusManager(); void MsgDeInitCallStatusManager(); int MsgGetCallStatus(); -#endif // MSG_CALL_STATUS_MANAGER_H +#endif /* MSG_CALL_STATUS_MANAGER_H */ diff --git a/include/utils/MsgContact.h b/include/utils/MsgContact.h index 3ccd75e..0ca3f67 100755 --- a/include/utils/MsgContact.h +++ b/include/utils/MsgContact.h @@ -23,9 +23,6 @@ #include "MsgStorageTypes.h" #include "MsgInternalTypes.h" - - -//contacts-service is not used for gear #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED /*================================================================================================== FUNCTION PROTOTYPES @@ -45,10 +42,10 @@ void MsgAddPhoneLog(const MSG_MESSAGE_INFO_S *pMsgInfo); void MsgDeletePhoneLog(msg_message_id_t msgId); bool checkBlockingMode(char *address, bool *pisFavorites); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ int MsgContactGetMinMatchDigit(); void MsgConvertNumber(const char* pSrcNum, char* pDestNum, int destSize); bool MsgIsNumber(const char* pSrc); -#endif //MSG_CONTACT_H +#endif /* MSG_CONTACT_H */ diff --git a/include/utils/MsgDebug.h b/include/utils/MsgDebug.h index 13d8f5e..d1fc5df 100755 --- a/include/utils/MsgDebug.h +++ b/include/utils/MsgDebug.h @@ -44,123 +44,105 @@ /*log macros*/ #define MSG_BEGIN()\ - do\ - {\ + do { \ SLOGD(" BEGIN >>>> \n");\ - } while(0) + } while (0) #define MSG_END()\ - do\ - {\ + do { \ SLOGD(" END <<<< \n");\ - } while(0) + } while (0) #define MSG_DEBUG(fmt, ...)\ - do\ - {\ + do { \ SLOGD(fmt"\n", ##__VA_ARGS__);\ - } while(0) + } while (0) #define MSG_INFO(fmt, ...)\ - do\ - {\ + do { \ SLOGI("* Info * " fmt "\n", ##__VA_ARGS__);\ - } while(0) + } while (0) #define MSG_WARN(fmt, ...)\ - do\ - {\ + do { \ SLOGW("* Warning * " fmt "\n", ##__VA_ARGS__);\ - } while(0) + } while (0) #define MSG_ERR(fmt, ...)\ - do\ - {\ + do { \ SLOGE("* Error * " fmt "\n", ##__VA_ARGS__);\ - } while(0) + } while (0) #define MSG_FATAL(fmt, ...)\ - do\ - {\ + do { \ SLOGE(" ERROR << " fmt " >>\n", ##__VA_ARGS__);\ - } while(0) + } while (0) /*secure log macros*/ #define MSG_SEC_DEBUG(fmt, ...)\ - do\ - {\ + do { \ SECURE_SLOGD(fmt"\n", ##__VA_ARGS__);\ } while (0) #define MSG_SEC_INFO(fmt, ...)\ - do\ - {\ + do { \ SECURE_SLOGI("* Info * " fmt"\n", ##__VA_ARGS__);\ } while (0) #define MSG_SEC_ERR(fmt, ...)\ - do\ - {\ + do { \ SECURE_LOG(LOG_ERROR, LOG_TAG, "* Error *" fmt "\n", ##__VA_ARGS__);\ } while (0) /*valid data log macros*/ #define MSG_SMS_VLD_INFO(fmt, ...)\ - do\ - {\ + do { \ SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS INFO]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) #define MSG_SMS_VLD_TXT(fmt, ...)\ - do\ - {\ + do { \ SLOG(LOG_DEBUG, MSG_SMS_VALID_TAG, "[SMS_TEXT]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) #define MSG_MMS_VLD_INFO(fmt, ...)\ - do\ - {\ + do { \ SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS INFO]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) #define MSG_MMS_VLD_TXT(fmt, ...)\ - do\ - {\ + do { \ SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS TEXT]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) #define MSG_MMS_VLD_FILE(fmt, ...)\ - do\ - {\ + do { \ SLOG(LOG_DEBUG, MSG_MMS_VALID_TAG, "[MMS FILE]%s, " fmt "\n", __TIMESTAMP__, ##__VA_ARGS__);\ } while (0) /*err & warn return message log macros*/ #define MSG_ERR_RET_VM(expr, val, fmt, ...)\ - do\ - {\ + do { \ if (expr) {\ MSG_ERR(fmt, ##__VA_ARGS__);\ return (val);\ }\ - } while(0) + } while (0) #define MSG_ERR_RET_M(expr, fmt, ...)\ - do\ - {\ + do { \ if (expr) {\ MSG_ERR(fmt, ##__VA_ARGS__);\ return;\ }\ - } while(0) + } while (0) #define MSG_WARN_M(expr, fmt, ...)\ - do\ - {\ + do { \ if (expr) {\ MSG_WARN(fmt, ##__VA_ARGS__);\ }\ - } while(0) + } while (0) /*profile log macros*/ #define MSG_PROFILE_BEGIN(pfid) \ @@ -178,12 +160,12 @@ long __ds = __prf_2_##pfid.tv_sec - __prf_1_##pfid.tv_sec;\ long __dm = __prf_2_##pfid.tv_usec - __prf_1_##pfid.tv_usec;\ if ( __dm < 0 ) { __ds--; __dm = 1000000 + __dm; } \ - SLOGD("**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid " -> Elapsed Time: %u.%06u seconds\n",\ - rindex(__FILE__, '/')+1,\ + SLOGD("**PROFILE** [MSGFW: %s: %s() %u ~ %u] " #pfid " -> Elapsed Time: %u.%06u seconds\n", \ + rindex(__FILE__, '/')+1, \ __FUNCTION__, \ - __prf_l1_##pfid,\ - __prf_l2_##pfid,\ - (unsigned int)(__ds),\ + __prf_l1_##pfid, \ + __prf_l2_##pfid, \ + (unsigned int)(__ds), \ (unsigned int)(__dm));\ } while (0) @@ -192,29 +174,25 @@ int get_tid(); #define MSG_FATAL(fmt, ...) \ - do \ - {\ + do { \ printf("\n[%d] [MSGFW: %s: %s(): %d] *FAILED* << " fmt" >>\n", get_tid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ } while (0) #define MSG_DEBUG(fmt, ...) \ - do\ - {\ + do { \ printf("\n[%d] [MSGFW: %s: %s(): %d] " fmt"\n", get_tid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);\ } while (0) #define MSG_BEGIN() \ - do\ - {\ - printf("\n[%d] BEGIN >>>> %s() at [MSGFW: %s: %d]\n", get_tid(),__FUNCTION__, rindex(__FILE__, '/')+1, __LINE__ );\ - } while( 0 ) + do { \ + printf("\n[%d] BEGIN >>>> %s() at [MSGFW: %s: %d]\n", get_tid(), __FUNCTION__, rindex(__FILE__, '/')+1, __LINE__);\ + } while (0) #define MSG_END() \ - do\ - {\ + do { \ printf("\n[%d] END <<<< %s() at [MSGFW: %s: %d]\n", get_tid(), __FUNCTION__, rindex(__FILE__, '/')+1, __LINE__); \ } \ - while( 0 ) + while (0) #define MSG_PROFILE_BEGIN(pfid) \ unsigned int __prf_l1_##pfid = __LINE__; \ @@ -278,7 +256,7 @@ int get_tid(); #define MSG_FREE(x) \ ({\ - if (x != NULL){\ + if (x != NULL) {\ free(x);\ x = NULL;}\ }) @@ -291,5 +269,5 @@ int get_tid(); const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType); const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType); -#endif //__MSG_DEBUG_H__ +#endif /*__MSG_DEBUG_H__ */ diff --git a/include/utils/MsgException.h b/include/utils/MsgException.h index 5d4c73f..d598c59 100755 --- a/include/utils/MsgException.h +++ b/include/utils/MsgException.h @@ -29,25 +29,25 @@ using namespace std; /*================================================================================================== DEFINES ==================================================================================================*/ -#define THROW(errCode, debugFmt,...) \ +#define THROW(errCode, debugFmt, ...) \ do {\ char __debugBuf[256];\ snprintf(__debugBuf, 256, debugFmt, ##__VA_ARGS__);\ MsgException e(errCode, __debugBuf);\ MSG_FATAL("%s [%d]", e.what(), e.errorCode());\ throw e; \ -} while(0) +} while (0) /*================================================================================================== CLASS DEFINITIONS ==================================================================================================*/ -class MsgException : public runtime_error //public exception +class MsgException : public runtime_error /* public exception */ { public: MsgException(int errCode, const string& msg = "") - : runtime_error( errorStrings[errCode] + " : " + msg), eCode(errCode) - {} + : runtime_error(errorStrings[errCode] + " : " + msg), eCode(errCode) { + } enum { @@ -70,7 +70,7 @@ public: SERVER_READY_ERROR = 13, REQ_EXIST_ERROR, - // dont erase NUM_ERRORS. place a new error code in ahead of NUM_ERRORS + /* dont erase NUM_ERRORS. place a new error code in ahead of NUM_ERRORS */ NUM_ERRORS }; @@ -81,6 +81,6 @@ private: int eCode; }; -#endif //#ifndef __MSG_EXCEPTION_H__ +#endif /* __MSG_EXCEPTION_H__ */ diff --git a/include/utils/MsgGconfWrapper.h b/include/utils/MsgGconfWrapper.h index ebb8de7..253edd2 100755 --- a/include/utils/MsgGconfWrapper.h +++ b/include/utils/MsgGconfWrapper.h @@ -17,7 +17,7 @@ #ifndef MSG_GCONF_WRAPPER_H #define MSG_GCONF_WRAPPER_H -//#define USE_GCONF +/* #define USE_GCONF */ /*================================================================================================== INCLUDE FILES ==================================================================================================*/ @@ -63,4 +63,4 @@ bool MsgSettingGetUnknownAutoReject(); void MsgSettingRegVconfCBCommon(const char *pKey, _vconf_change_cb pCb); void MsgSettingRemoveVconfCBCommon(const char *pKey, _vconf_change_cb pCb); -#endif // MSG_GCONF_WRAPPER_H +#endif /* MSG_GCONF_WRAPPER_H */ diff --git a/include/utils/MsgIpcSocket.h b/include/utils/MsgIpcSocket.h index 8795d48..9cdecda 100755 --- a/include/utils/MsgIpcSocket.h +++ b/include/utils/MsgIpcSocket.h @@ -56,7 +56,7 @@ class MsgIpcClientSocket { public: MsgIpcClientSocket(); -// ~MsgIpcClientSocket(); +/* ~MsgIpcClientSocket(); */ int maxFd() { return (maxfd+1); } fd_set fdSet() { return fds; } @@ -71,8 +71,8 @@ public: void addfd(int fd); int getRemoteFd() {return remotefd; } private: - int readn(char *buf, unsigned int len ); - int writen (const char *buf, unsigned int len); + int readn(char *buf, unsigned int len); + int writen(const char *buf, unsigned int len); bool wait_for_reply(); int sockfd, remotefd, maxfd; @@ -94,15 +94,15 @@ public: void close(int fd); /* read msg from client of fd */ - int read(int fd, char** buf, int* len ); + int read(int fd, char** buf, int* len); /* write msg to ipc client */ int write(int fd, const char* buf, unsigned int len); void addfd(int fd); void setSockfd(int fd) { sockfd = fd; } private: - int readn(int fd, char *buf, unsigned int len ); - int writen (int fd, const char *buf, unsigned int len); + int readn(int fd, char *buf, unsigned int len); + int writen(int fd, const char *buf, unsigned int len); /* server socket fd */ int sockfd; @@ -113,5 +113,5 @@ private: std::map mapFds; }; -#endif //__IPCSocket_H__ +#endif /*__IPCSocket_H__ */ diff --git a/include/utils/MsgJsonParser.h b/include/utils/MsgJsonParser.h index 08d1e8e..87034f6 100755 --- a/include/utils/MsgJsonParser.h +++ b/include/utils/MsgJsonParser.h @@ -38,35 +38,35 @@ void msg_json_gen_set_value(msg_json_gen_object *parent, const char *key, const char* msg_json_gen_make_json_msg(msg_json_gen_object *root_obj, unsigned long *len); #define MSG_JSON_OBJ_SET_STR(json_obj, key, val)\ - if(json_obj && key && val){\ + if (json_obj && key && val) {\ json_object_set_string_member(json_obj, key, val);\ } else {\ MSG_DEBUG("Error : json_obj = %p, key = %s, val = %s", json_obj, key, val);\ } #define MSG_JSON_OBJ_SET_INT(json_obj, key, val)\ - if(json_obj && key){\ + if (json_obj && key) {\ json_object_set_int_member(json_obj, key, val);\ } else {\ MSG_DEBUG("Error : json_obj = %p, key = %s, val = %d", json_obj, key, val);\ } #define MSG_JSON_OBJ_SET_OBJ(json_obj, key, val)\ - if(json_obj && key){\ + if (json_obj && key) {\ json_object_set_object_member(json_obj, key, val);\ } else {\ MSG_DEBUG("Error : json_obj = %p, key = %s, val = %p", json_obj, key, val);\ } #define MSG_JSON_OBJ_SET_ARRAY(json_obj, key, json_array)\ - if(json_obj && key && json_array){\ + if (json_obj && key && json_array) {\ json_object_set_array_member(json_obj, key, json_array);\ } else {\ MSG_DEBUG("Error : json_obj = %p, key = %s, json_array = %p", json_obj, key, json_array);\ } #define MSG_JSON_ARRAY_ADD_OBJECT(json_array, json_obj)\ - if(json_array && json_obj){\ + if (json_array && json_obj) {\ json_array_add_object_element(json_array, json_obj);\ } else {\ MSG_DEBUG("Error : json_array = %p, json_obj = %p", json_array, json_obj);\ diff --git a/include/utils/MsgMemory.h b/include/utils/MsgMemory.h index 7fa9522..2be5f89 100755 --- a/include/utils/MsgMemory.h +++ b/include/utils/MsgMemory.h @@ -32,8 +32,8 @@ #define GETSP() ({ unsigned int 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))) -#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) +#define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1))) +#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1))) #define PAGE_ALIGN(addr) _ALIGN_DOWN(addr, PAGE_SIZE) @@ -51,10 +51,10 @@ stack_trim(void) sp = GETSP(); - snprintf(buf, BUF_SIZE, "/proc/%d/maps",getpid()); - file = fopen(buf,"r"); - while(fgets(buf, BUF_SIZE, file) != NULL) { - if(strstr(buf, "[stack]")){ + snprintf(buf, BUF_SIZE, "/proc/%d/maps", getpid()); + file = fopen(buf, "r"); + while (fgets(buf, BUF_SIZE, file) != NULL) { + if (strstr(buf, "[stack]")) { found = 1; break; } @@ -62,7 +62,7 @@ stack_trim(void) fclose(file); if(found) { - sscanf(buf,"%x-",&stacktop); + sscanf(buf, "%x-", &stacktop); if(madvise((void*)PAGE_ALIGN(stacktop), PAGE_ALIGN(sp)-stacktop, MADV_DONTNEED) < 0) perror("stack madvise fail"); } @@ -72,5 +72,5 @@ stack_trim(void) void MsgReleaseMemory(); -#endif // __MSG_MEMORY_H__ +#endif /* __MSG_MEMORY_H__ */ diff --git a/include/utils/MsgMmsMessage.h b/include/utils/MsgMmsMessage.h index 342a683..805b096 100755 --- a/include/utils/MsgMmsMessage.h +++ b/include/utils/MsgMmsMessage.h @@ -69,7 +69,7 @@ void MsgMmsRelease(MMS_DATA_S **ppMmsData); int MsgMmsReleaseMultipartList(MMSList **ppMultipartList); -int MsgMmsGetSmilMultipart(MMSList *pMultipartList, MMS_MULTIPART_DATA_S **smil_multipart);//TODO : delete +int MsgMmsGetSmilMultipart(MMSList *pMultipartList, MMS_MULTIPART_DATA_S **smil_multipart); /*TODO : delete */ int MsgMmsConvertMmsDataToMmsMessageData(MMS_DATA_S *pSrc, MMS_MESSAGE_DATA_S *pDst); @@ -86,7 +86,7 @@ int MsgMmsSetMultipartListData(MMS_DATA_S *pMmsData); int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData); int printMultipart(MMS_MULTIPART_DATA_S *multipart); -int printMultipartList(MMSList *pMultipartList);//for debug +int printMultipartList(MMSList *pMultipartList); /*for debug */ void _MsgMmsMultipartPrint(MMS_MULTIPART_DATA_S *multipart); @@ -94,4 +94,4 @@ bool _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg); int MsgMmsCheckFilepathSmack(int fd, const char *ipc_filename); -#endif // MSG_MMS_MESSAGE_H +#endif /* MSG_MMS_MESSAGE_H */ diff --git a/include/utils/MsgMutex.h b/include/utils/MsgMutex.h index c3b1cc6..43588da 100755 --- a/include/utils/MsgMutex.h +++ b/include/utils/MsgMutex.h @@ -33,24 +33,24 @@ void WaitMsgReady(int sec); class Mutex { public: - Mutex(){ + Mutex() { pthread_mutexattr_t mattr; pthread_mutexattr_init(&mattr); pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&m, &mattr); pthread_mutexattr_destroy(&mattr); } - ~Mutex(){ pthread_mutex_destroy(&m); } - void lock(){ pthread_mutex_lock(&m); } + ~Mutex() { pthread_mutex_destroy(&m); } + void lock() { pthread_mutex_lock(&m); } - int timedlock(){ + int timedlock() { struct timespec abs_time; clock_gettime(CLOCK_REALTIME, &abs_time); abs_time.tv_sec += 1; return pthread_mutex_timedlock(&m, &abs_time); } - void unlock(){ pthread_mutex_unlock(&m); } + void unlock() { pthread_mutex_unlock(&m); } pthread_mutex_t* pMutex() { return &m; } private: @@ -60,14 +60,12 @@ private: class MutexLocker { public: - MutexLocker(Mutex& mx) - { + MutexLocker(Mutex& mx) { pm = &mx; pm->lock(); } - ~MutexLocker() - { + ~MutexLocker() { pm->unlock(); } @@ -78,10 +76,9 @@ private: class CndVar { public: - CndVar(){ pthread_cond_init(&c, 0); } + CndVar() { pthread_cond_init(&c, 0); } void wait(pthread_mutex_t* m) { pthread_cond_wait(&c, m); } - int timedwait(pthread_mutex_t* m, int sec) - { + int timedwait(pthread_mutex_t* m, int sec) { struct timeval now = {0}; struct timespec timeout = {0}; gettimeofday(&now, NULL); @@ -90,12 +87,12 @@ public: int retcode = pthread_cond_timedwait(&c, m, &timeout); return retcode; } - void signal(){ pthread_cond_signal(&c); } - void broadcast(){ pthread_cond_broadcast(&c); } + void signal() { pthread_cond_signal(&c); } + void broadcast() { pthread_cond_broadcast(&c); } private: pthread_cond_t c; }; -#endif //__MUTEX_H__ +#endif /* __MUTEX_H__ */ diff --git a/include/utils/MsgSerialize.h b/include/utils/MsgSerialize.h index 9a8dc5f..b29c536 100755 --- a/include/utils/MsgSerialize.h +++ b/include/utils/MsgSerialize.h @@ -25,5 +25,5 @@ int MsgDeserializeMmsJsonData(char* value, int value_len, MMS_DATA_S **ppMmsData int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue); int MsgDeserializeMmsData(char* value, int value_len, MMS_DATA_S **ppMmsData); -#endif //MSG_MMS_SERIALIZE_H +#endif /* MSG_MMS_SERIALIZE_H */ diff --git a/include/utils/MsgSqliteWrapper.h b/include/utils/MsgSqliteWrapper.h index d640827..562842e 100755 --- a/include/utils/MsgSqliteWrapper.h +++ b/include/utils/MsgSqliteWrapper.h @@ -114,7 +114,7 @@ public: void getColumnToString(int RowIndex, int Length, char *pString); msg_error_t getRowId(const char *pTableName, unsigned int *pRowId); void getMmapMutex(const char *shm_file_name); - void shm_mutex_timedlock (int sec); + void shm_mutex_timedlock(int sec); void shm_mutex_unlock(); private: @@ -129,5 +129,5 @@ private: MsgDbHandler *getDbHandle(); void removeDbHandle(); -#endif // MSG_SQLITE_WRAPPER_H +#endif /* MSG_SQLITE_WRAPPER_H */ diff --git a/include/utils/MsgTextConvert.h b/include/utils/MsgTextConvert.h index d922c99..c9b6087 100755 --- a/include/utils/MsgTextConvert.h +++ b/include/utils/MsgTextConvert.h @@ -23,8 +23,6 @@ ==================================================================================================*/ #include -//#include "SmsPluginTypes.h" - /*================================================================================================== DEFINES @@ -98,7 +96,7 @@ typedef struct _MSG_LOCKING_SHIFT_S } MSG_LOCKING_SHIFT_S; -// ETSI GSM 03.38 GSM 7 bit Default Alphabet Table -> UCS2 +/* ETSI GSM 03.38 GSM 7 bit Default Alphabet Table -> UCS2 */ static const WCHAR g_GSM7BitToUCS2[] = { /* @ */ @@ -120,10 +118,10 @@ static const WCHAR g_GSM7BitToUCS2[] = }; -//GSM 7 bit Default Alphabet Extension Table -> UCS2 +/* GSM 7 bit Default Alphabet Extension Table -> UCS2 */ static const WCHAR g_GSM7BitExtToUCS2[] = { - // 0x0020 -> (SP) for invalid code + /* 0x0020 -> (SP) for invalid code */ /* Page Break */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x000C, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, /* ^ */ @@ -141,10 +139,10 @@ static const WCHAR g_GSM7BitExtToUCS2[] = }; -//Turkish National Language Single Shift Table -> UCS2 +/* Turkish National Language Single Shift Table -> UCS2 */ static const WCHAR g_TurkishSingleToUCS2[] = { - // 0x0020 -> (SP) for invalid code + /* 0x0020 -> (SP) for invalid code */ /* Page Break */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x000C, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, /* ^ */ @@ -162,7 +160,7 @@ static const WCHAR g_TurkishSingleToUCS2[] = }; -// Turkish National Language Locking Shift Table -> UCS2 +/* Turkish National Language Locking Shift Table -> UCS2 */ static const WCHAR g_TurkishLockingToUCS2[] = { /* @ */ @@ -184,10 +182,10 @@ static const WCHAR g_TurkishLockingToUCS2[] = }; -// Spanish National Language Single Shift Table -> UCS2 +/* Spanish National Language Single Shift Table -> UCS2 */ static const WCHAR g_SpanishSingleToUCS2[] = { - // 0x0020 -> (SP) for invalid code + /* 0x0020 -> (SP) for invalid code */ /* Page Break */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x00E7, 0x000C, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, /* ^ */ @@ -205,10 +203,10 @@ static const WCHAR g_SpanishSingleToUCS2[] = }; -// Portuguese National Language Single Shift Table -> UCS2 +/* Portuguese National Language Single Shift Table -> UCS2 */ static const WCHAR g_PortuSingleToUCS2[] = { - // 0x0020 -> (SP) for invalid code + /* 0x0020 -> (SP) for invalid code */ /* Page Break */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x00EA, 0x0020, 0x0020, 0x0020, 0x00E7, 0x000C, 0x00D4, 0x00F4, 0x0020, 0x00C1, 0x00E1, /* ^ */ @@ -226,7 +224,7 @@ static const WCHAR g_PortuSingleToUCS2[] = }; -// Portuguese National Language Locking Shift Table -> UCS2 +/* Portuguese National Language Locking Shift Table -> UCS2 */ static const WCHAR g_PortuLockingToUCS2[] = { /* @ */ @@ -290,8 +288,6 @@ private: std::map ucs2toPortuList; std::map replaceCharList; - }; -#endif //MSG_TEXT_CONVERT_H - +#endif /* MSG_TEXT_CONVERT_H */ diff --git a/include/utils/MsgUtilFile.h b/include/utils/MsgUtilFile.h index c8d06e5..ca3f3d6 100755 --- a/include/utils/MsgUtilFile.h +++ b/include/utils/MsgUtilFile.h @@ -26,7 +26,6 @@ /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ -//File Util bool MakeThumbnail(char *srcPath, char *dstPath); /** file operation wrapper - for avoding runtime error */ FILE* MsgOpenFile(const char* filepath, const char* opt); @@ -41,15 +40,15 @@ int MsgFsync(FILE *pFile); bool MsgCreateFileName(char *pFileName); bool MsgOpenAndReadFile(const char *pFileName, char **ppData, int *pDataSize); bool MsgReadFileForDecode(FILE* pFile, char* pBuf, int length, int* nSize); -bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset ); +bool MsgWriteDataFromEncodeBuffer(FILE* pFile, char* pInBuffer, int *pPtr, int maxLen, int* pOffset); bool MsgWriteIpcFile(const char *pFileName, const char *pData, int DataSize); void MsgDeleteFile(const char *pFileName); bool MsgGetFileSize(const char *pFilePath, int* nSize); int MsgGetFileSize(const char *pFileName); FILE* MsgOpenMMSFile(char *pFileName); bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength); -char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize ); -bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize); +char* MsgOpenAndReadMmsFile(const char* szFilePath, int offset, int size, int* npSize); +bool MsgWriteSmilFile(const char *pFilePath, char *pData, int DataSize); int MsgReadSmilFile(const char *pFileName, char **ppData); void MsgDeleteSmilFile(const char *pFilePath); int MsgRmRf(char *pDirPath); @@ -59,12 +58,12 @@ void MsgMmsInitDir(); bool MsgAccessFile(const char *filepath, int mode); bool MsgChmod(const char *filepath, int mode); bool MsgChown(const char *filepath, int uid, int gid); -bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize); +bool MsgCreateFile(const char *pFilePath, char *pData, int DataSize); char *MsgGetDirName(char *file_path); char *MsgGetFileName(char *file_path); int MsgCheckFilepathSmack(const char *app_smack_label, char *file_path); bool MsgScanFile(char *filePath); void MsgGetMimeType(char *filePath, char *mimeType, int size); -#endif // MSG_UTIL_FILE_H +#endif /* MSG_UTIL_FILE_H */ diff --git a/include/utils/MsgUtilFunction.h b/include/utils/MsgUtilFunction.h index 54e0d44..0a174e2 100755 --- a/include/utils/MsgUtilFunction.h +++ b/include/utils/MsgUtilFunction.h @@ -45,7 +45,7 @@ bool MsgCheckFeatureSupport(const char *feature_name); -// Encoders +/* Encoders */ int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest); int MsgEncodeCountByMsgType(int MsgCount, char **ppDest); @@ -89,7 +89,7 @@ int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest); int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest); -// Decoders +/* Decoders */ void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId); void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo); @@ -123,11 +123,11 @@ void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId); void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo); -// Event Encoder +/* Event Encoder */ int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent); -// Utin functions +/* Util functions */ int msg_verify_number(const char *raw, char *trimmed); int msg_verify_email(const char *raw); @@ -154,4 +154,4 @@ gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementCha void MsgDbusInit(); void MsgDbusDeinit(); -#endif // MSG_UTIL_FUNCTION_H +#endif /* MSG_UTIL_FUNCTION_H */ diff --git a/include/utils/MsgUtilStorage.h b/include/utils/MsgUtilStorage.h index 01a57ef..354c876 100755 --- a/include/utils/MsgUtilStorage.h +++ b/include/utils/MsgUtilStorage.h @@ -29,29 +29,28 @@ /*================================================================================================== FUNCTION PROTOTYPES ==================================================================================================*/ -// Common Function - +/* Common Function */ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo); msg_error_t MsgStoSetReadStatus(MsgDbHandler *pDbHandle, msg_message_id_t MsgId, bool bRead); msg_error_t MsgStoGetOldestMessage(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t *pMsgId); msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t FolderId); -msg_error_t MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount, msg_folder_id_t folderId ); +msg_error_t MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYPE_S *pMsgType, int *pMsgCount, msg_folder_id_t folderId); msg_error_t MsgStocheckMemoryStatus(); int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t FolderId); msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t *pConvId); -//contacts-service is not used for gear +/* contacts-service is not used for gear */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, int *nAddressCnt, MSG_ADDRESS_INFO_S **pAddress); msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int contactNameOrder, msg_struct_list_s *pAddress); msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, int contactNameOrder, msg_struct_list_s *pAddrlist); -#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED -//contactNameOrder is never used +#else /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ +/* contactNameOrder is never used */ msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, int *nAddressCnt, MSG_ADDRESS_INFO_S **pAddress); msg_error_t MsgStoGetAddressByMsgId(MsgDbHandler *pDbHandle, msg_message_id_t msgId, msg_struct_list_s *pAddress); msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t convId, msg_struct_list_s *pAddrlist); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ void MsgStoUpdateAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, msg_thread_id_t convId); msg_error_t MsgStoAddConversation(MsgDbHandler *pDbHandle, msg_thread_id_t *pConvId); @@ -81,7 +80,7 @@ bool MsgStoCheckReadReportRequested(MsgDbHandler *pDbHandle, msg_message_id_t Ms bool MsgStoCheckReadReportIsSent(MsgDbHandler *pDbHandle, msg_message_id_t MsgId); msg_error_t MsgStoUpdateNetworkStatus(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t status); -// Lists +/* Lists */ msg_error_t MsgStoGetThreadViewList(const MSG_SORT_RULE_S *pSortRule, msg_struct_list_s *pThreadViewList); msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATION_VIEW_S *pConv); msg_error_t MsgStoGetConversationViewList(msg_thread_id_t ThreadId, msg_struct_list_s *pConvViewList); @@ -96,5 +95,5 @@ msg_error_t MsgStoGetMediaList(const msg_thread_id_t threadId, msg_list_handle_t msg_error_t MsgStoClearUniquenessTable(); #endif -#endif // MSG_UTIL_STORAGE_H +#endif /* MSG_UTIL_STORAGE_H */ diff --git a/include/utils/MsgVMessage.h b/include/utils/MsgVMessage.h index ebc8fd9..92903c8 100755 --- a/include/utils/MsgVMessage.h +++ b/include/utils/MsgVMessage.h @@ -33,5 +33,5 @@ char *MsgVMessageEncodeSMS(MSG_MESSAGE_INFO_S *pMsg); msg_error_t MsgVMessageDecodeSMS(const char *vmsg_stream, MSG_MESSAGE_INFO_S *pMsg); bool _convert_vdata_str_to_tm(const char* szText, struct tm * tm); -#endif //MSG_VMESSAGE_H +#endif /* MSG_VMESSAGE_H */ diff --git a/mapi/msg_filter.cpp b/mapi/msg_filter.cpp index 038668c..e2f07e6 100755 --- a/mapi/msg_filter.cpp +++ b/mapi/msg_filter.cpp @@ -231,10 +231,10 @@ int msg_get_filter_info_bool(void *filter, int field, bool *value) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_ACTIVE_BOOL : + case MSG_FILTER_ACTIVE_BOOL: *value = filter_data->bActive; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -253,13 +253,13 @@ int msg_get_filter_info_int(void *filter, int field, int *value) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_ID_INT : + case MSG_FILTER_ID_INT: *value = filter_data->filterId; break; - case MSG_FILTER_TYPE_INT : + case MSG_FILTER_TYPE_INT: *value = filter_data->filterType; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -276,10 +276,10 @@ int msg_get_filter_info_str(void *filter, int field, char *value, int size) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_VALUE_STR : + case MSG_FILTER_VALUE_STR: strncpy(value, filter_data->filterValue, size); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -295,10 +295,10 @@ int msg_set_filter_info_bool(void *filter, int field, bool value) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_ACTIVE_BOOL : + case MSG_FILTER_ACTIVE_BOOL: filter_data->bActive = value; break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -314,13 +314,13 @@ int msg_set_filter_info_int(void *filter, int field, int value) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_ID_INT : + case MSG_FILTER_ID_INT: filter_data->filterId = value; break; - case MSG_FILTER_TYPE_INT : + case MSG_FILTER_TYPE_INT: filter_data->filterType = value; break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -336,13 +336,12 @@ int msg_set_filter_info_str(void *filter, int field, char *value, int size) MSG_FILTER_S *filter_data = (MSG_FILTER_S *)filter; switch (field) { - case MSG_FILTER_VALUE_STR : - { + case MSG_FILTER_VALUE_STR: { int len = (size > MAX_FILTER_VALUE_LEN)?MAX_FILTER_VALUE_LEN:size; strncpy(filter_data->filterValue, value, len); break; } - default : + default: return MSG_ERR_INVALID_PARAMETER; } diff --git a/mapi/msg_message.cpp b/mapi/msg_message.cpp index 827a8fb..9c0073c 100755 --- a/mapi/msg_message.cpp +++ b/mapi/msg_message.cpp @@ -61,7 +61,7 @@ void msg_message_create_struct(msg_struct_s *msg_struct) msg->msgId = 0; msg->threadId = 0; msg->folderId = MSG_DRAFT_ID; - msg->mainType= MSG_SMS_TYPE; + msg->mainType = MSG_SMS_TYPE; msg->subType = MSG_NORMAL_SMS; msg->classType = MSG_CLASS_NONE; msg->storageId = MSG_STORAGE_PHONE; @@ -163,66 +163,65 @@ int msg_message_get_int_value(void *data, int field, int *value) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_ID_INT : + case MSG_MESSAGE_ID_INT: *value = msg_data->msgId; break; - case MSG_MESSAGE_THREAD_ID_INT : + case MSG_MESSAGE_THREAD_ID_INT: *value = msg_data->threadId; break; - case MSG_MESSAGE_FOLDER_ID_INT : + case MSG_MESSAGE_FOLDER_ID_INT: *value = msg_data->folderId; break; - case MSG_MESSAGE_TYPE_INT : - { + case MSG_MESSAGE_TYPE_INT: { if (msg_data->mainType == MSG_SMS_TYPE) { switch (msg_data->subType) { - case MSG_CB_SMS : + case MSG_CB_SMS: *value = MSG_TYPE_SMS_CB; break; - case MSG_JAVACB_SMS : + case MSG_JAVACB_SMS: *value = MSG_TYPE_SMS_JAVACB; break; - case MSG_WAP_SI_SMS : - case MSG_WAP_SL_SMS : + case MSG_WAP_SI_SMS: + case MSG_WAP_SL_SMS: *value = MSG_TYPE_SMS_WAPPUSH; break; - case MSG_MWI_VOICE_SMS : - case MSG_MWI_FAX_SMS : - case MSG_MWI_EMAIL_SMS : - case MSG_MWI_OTHER_SMS : + case MSG_MWI_VOICE_SMS: + case MSG_MWI_FAX_SMS: + case MSG_MWI_EMAIL_SMS: + case MSG_MWI_OTHER_SMS: *value = MSG_TYPE_SMS_MWI; break; - case MSG_SYNCML_CP : + case MSG_SYNCML_CP: *value = MSG_TYPE_SMS_SYNCML; break; - case MSG_REJECT_SMS : + case MSG_REJECT_SMS: *value = MSG_TYPE_SMS_REJECT; break; - case MSG_ETWS_SMS : + case MSG_ETWS_SMS: *value = MSG_TYPE_SMS_ETWS_PRIMARY; break; - case MSG_CMAS_PRESIDENTIAL : + case MSG_CMAS_PRESIDENTIAL: *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL; break; - case MSG_CMAS_EXTREME : + case MSG_CMAS_EXTREME: *value = MSG_TYPE_SMS_CMAS_EXTREME; break; - case MSG_CMAS_SEVERE : + case MSG_CMAS_SEVERE: *value = MSG_TYPE_SMS_CMAS_SEVERE; break; - case MSG_CMAS_AMBER : + case MSG_CMAS_AMBER: *value = MSG_TYPE_SMS_CMAS_AMBER; break; - case MSG_CMAS_TEST : + case MSG_CMAS_TEST: *value = MSG_TYPE_SMS_CMAS_TEST; break; - case MSG_CMAS_EXERCISE : + case MSG_CMAS_EXERCISE: *value = MSG_TYPE_SMS_CMAS_EXERCISE; break; - case MSG_CMAS_OPERATOR_DEFINED : + case MSG_CMAS_OPERATOR_DEFINED: *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; break; - default : + default: *value = MSG_TYPE_SMS; break; } @@ -240,43 +239,43 @@ int msg_message_get_int_value(void *data, int field, int *value) break; } - case MSG_MESSAGE_CLASS_TYPE_INT : + case MSG_MESSAGE_CLASS_TYPE_INT: *value = msg_data->classType; break; - case MSG_MESSAGE_STORAGE_ID_INT : + case MSG_MESSAGE_STORAGE_ID_INT: *value = msg_data->storageId; break; - case MSG_MESSAGE_DISPLAY_TIME_INT : + case MSG_MESSAGE_DISPLAY_TIME_INT: *value = msg_data->displayTime; break; - case MSG_MESSAGE_NETWORK_STATUS_INT : + case MSG_MESSAGE_NETWORK_STATUS_INT: *value = msg_data->networkStatus; break; - case MSG_MESSAGE_ENCODE_TYPE_INT : + case MSG_MESSAGE_ENCODE_TYPE_INT: *value = msg_data->encodeType; break; - case MSG_MESSAGE_PRIORITY_INT : + case MSG_MESSAGE_PRIORITY_INT: *value = msg_data->priority; break; - case MSG_MESSAGE_DIRECTION_INT : + case MSG_MESSAGE_DIRECTION_INT: *value = msg_data->direction; break; - case MSG_MESSAGE_DEST_PORT_INT : + case MSG_MESSAGE_DEST_PORT_INT: *value = msg_data->dstPort; break; - case MSG_MESSAGE_SRC_PORT_INT : + case MSG_MESSAGE_SRC_PORT_INT: *value = msg_data->srcPort; break; - case MSG_MESSAGE_ATTACH_COUNT_INT : + case MSG_MESSAGE_ATTACH_COUNT_INT: *value = msg_data->attachCount; break; - case MSG_MESSAGE_DATA_SIZE_INT : + case MSG_MESSAGE_DATA_SIZE_INT: *value = msg_data->dataSize; break; - case MSG_MESSAGE_SIM_INDEX_INT : + case MSG_MESSAGE_SIM_INDEX_INT: *value = msg_data->simIndex; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -294,27 +293,26 @@ int msg_message_get_bool_value(void *data, int field, bool *value) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_READ_BOOL : + case MSG_MESSAGE_READ_BOOL: *value = msg_data->bRead; break; - case MSG_MESSAGE_PROTECTED_BOOL : + case MSG_MESSAGE_PROTECTED_BOOL: *value = msg_data->bProtected; break; - case MSG_MESSAGE_BACKUP_BOOL : + case MSG_MESSAGE_BACKUP_BOOL: *value = msg_data->bBackup; break; - case MSG_MESSAGE_PORT_VALID_BOOL : + case MSG_MESSAGE_PORT_VALID_BOOL: *value = msg_data->bPortValid; break; - case MSG_MESSAGE_REPLACE_BOOL : - { + case MSG_MESSAGE_REPLACE_BOOL: { if (msg_data->subType >= MSG_REPLACE_TYPE1_SMS && msg_data->subType <= MSG_REPLACE_TYPE7_SMS) *value = true; else *value = false; break; } - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -332,16 +330,15 @@ int msg_message_get_str_value(void *data, int field, char *value, int size) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_REPLY_ADDR_STR : + case MSG_MESSAGE_REPLY_ADDR_STR: strncpy(value, msg_data->replyAddress, size); break; - case MSG_MESSAGE_SUBJECT_STR : + case MSG_MESSAGE_SUBJECT_STR: strncpy(value, msg_data->subject, size); break; - case MSG_MESSAGE_SMS_DATA_STR : - case MSG_MESSAGE_MMS_TEXT_STR : - if (msg_data->pData) - { + case MSG_MESSAGE_SMS_DATA_STR: + case MSG_MESSAGE_MMS_TEXT_STR: + if (msg_data->pData) { if (msg_data->mainType == MSG_SMS_TYPE) { int data_len = 0; ((size_t)size >= msg_data->dataSize)? (data_len = msg_data->dataSize) : data_len = size; @@ -354,7 +351,7 @@ int msg_message_get_str_value(void *data, int field, char *value, int size) } break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -370,7 +367,7 @@ int msg_message_get_struct_hnd(void *data, int field, void **value) int ret = MSG_SUCCESS; switch (field) { - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -388,13 +385,13 @@ int msg_message_get_list_hnd(void *data, int field, void **value) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_ADDR_LIST_STRUCT : + case MSG_MESSAGE_ADDR_LIST_STRUCT: *value = (void *)msg_data->addr_list; break; - case MSG_MESSAGE_ADDR_LIST_HND : + case MSG_MESSAGE_ADDR_LIST_HND: *value = (msg_list_handle_t)msg_data->addressList; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -412,17 +409,16 @@ int msg_message_set_int_value(void *data, int field, int value) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_ID_INT : + case MSG_MESSAGE_ID_INT: msg_data->msgId = value; break; - case MSG_MESSAGE_THREAD_ID_INT : + case MSG_MESSAGE_THREAD_ID_INT: msg_data->threadId = value; break; - case MSG_MESSAGE_FOLDER_ID_INT : + case MSG_MESSAGE_FOLDER_ID_INT: msg_data->folderId = value; break; - case MSG_MESSAGE_TYPE_INT : - { + case MSG_MESSAGE_TYPE_INT: { if (value == MSG_TYPE_SMS) { msg_data->mainType = MSG_SMS_TYPE; msg_data->subType = MSG_NORMAL_SMS; @@ -446,43 +442,43 @@ int msg_message_set_int_value(void *data, int field, int value) } break; } - case MSG_MESSAGE_CLASS_TYPE_INT : + case MSG_MESSAGE_CLASS_TYPE_INT: msg_data->classType = value; break; - case MSG_MESSAGE_STORAGE_ID_INT : + case MSG_MESSAGE_STORAGE_ID_INT: msg_data->storageId = value; break; - case MSG_MESSAGE_DISPLAY_TIME_INT : + case MSG_MESSAGE_DISPLAY_TIME_INT: msg_data->displayTime = value; break; - case MSG_MESSAGE_NETWORK_STATUS_INT : + case MSG_MESSAGE_NETWORK_STATUS_INT: msg_data->networkStatus = value; break; - case MSG_MESSAGE_ENCODE_TYPE_INT : + case MSG_MESSAGE_ENCODE_TYPE_INT: msg_data->encodeType = value; break; - case MSG_MESSAGE_PRIORITY_INT : + case MSG_MESSAGE_PRIORITY_INT: msg_data->priority = value; break; - case MSG_MESSAGE_DIRECTION_INT : + case MSG_MESSAGE_DIRECTION_INT: msg_data->direction = value; break; - case MSG_MESSAGE_DEST_PORT_INT : + case MSG_MESSAGE_DEST_PORT_INT: msg_data->dstPort = value; break; - case MSG_MESSAGE_SRC_PORT_INT : + case MSG_MESSAGE_SRC_PORT_INT: msg_data->srcPort = value; break; - case MSG_MESSAGE_ATTACH_COUNT_INT : + case MSG_MESSAGE_ATTACH_COUNT_INT: msg_data->attachCount = value; break; - case MSG_MESSAGE_DATA_SIZE_INT : + case MSG_MESSAGE_DATA_SIZE_INT: msg_data->dataSize = value; break; - case MSG_MESSAGE_SIM_INDEX_INT : + case MSG_MESSAGE_SIM_INDEX_INT: msg_data->simIndex = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -500,19 +496,19 @@ int msg_message_set_bool_value(void *data, int field, bool value) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_READ_BOOL : + case MSG_MESSAGE_READ_BOOL: msg_data->bRead = value; break; - case MSG_MESSAGE_PROTECTED_BOOL : + case MSG_MESSAGE_PROTECTED_BOOL: msg_data->bProtected = value; break; - case MSG_MESSAGE_BACKUP_BOOL : + case MSG_MESSAGE_BACKUP_BOOL: msg_data->bBackup = value; break; - case MSG_MESSAGE_PORT_VALID_BOOL : + case MSG_MESSAGE_PORT_VALID_BOOL: msg_data->bPortValid = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -530,14 +526,13 @@ int msg_message_set_str_value(void *data, int field, char *value, int size) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)data; switch (field) { - case MSG_MESSAGE_REPLY_ADDR_STR : + case MSG_MESSAGE_REPLY_ADDR_STR: snprintf(msg_data->replyAddress, sizeof(msg_data->replyAddress), "%s", value); break; - case MSG_MESSAGE_SUBJECT_STR : - snprintf(msg_data->subject, sizeof(msg_data->subject), "%s",value); + case MSG_MESSAGE_SUBJECT_STR: + snprintf(msg_data->subject, sizeof(msg_data->subject), "%s", value); break; - case MSG_MESSAGE_SMS_DATA_STR : - { + case MSG_MESSAGE_SMS_DATA_STR: { if (msg_data->pData) delete [] static_cast(msg_data->pData); @@ -547,7 +542,7 @@ int msg_message_set_str_value(void *data, int field, char *value, int size) ((char*) msg_data->pData)[msg_data->dataSize] = '\0'; } break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -563,7 +558,7 @@ int msg_message_set_struct_hnd(void *data, int field, void *value) int ret = MSG_SUCCESS; switch (field) { - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -573,7 +568,6 @@ int msg_message_set_struct_hnd(void *data, int field, void *value) void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S *pDst) { - pDst->msgId = pSrc->msgId; pDst->threadId = pSrc->msgId; pDst->folderId = pSrc->folderId; @@ -626,7 +620,7 @@ void msg_message_copy_message(MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_HIDDEN_S * msg_struct_s *addr_struct = __msg_message_create_address_struct(); MSG_ADDRESS_INFO_S *addrInfo = (MSG_ADDRESS_INFO_S *)addr_struct->data; - msg_struct_s *addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList,(guint)i); + msg_struct_s *addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList, (guint)i); MSG_ADDRESS_INFO_S *address = (MSG_ADDRESS_INFO_S *)addr_info->data; addrInfo->addressType = address->addressType; @@ -652,60 +646,59 @@ int msg_cb_message_get_int_value(void *data, int field, int *value) *value = 0; switch (field) { - case MSG_CB_MSG_TYPE_INT : - { + case MSG_CB_MSG_TYPE_INT: { switch (cb_msg->type) { - case MSG_ETWS_SMS : + case MSG_ETWS_SMS: *value = MSG_TYPE_SMS_ETWS_PRIMARY; break; case MSG_CB_SMS: - *value = ((cb_msg->messageId & 0xFFF8) == 0x1100 ) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB; + *value = ((cb_msg->messageId & 0xFFF8) == 0x1100) ? MSG_TYPE_SMS_ETWS_SECONDARY : MSG_TYPE_SMS_CB; break; - case MSG_CMAS_PRESIDENTIAL : + case MSG_CMAS_PRESIDENTIAL: *value = MSG_TYPE_SMS_CMAS_PRESIDENTIAL; break; - case MSG_CMAS_EXTREME : + case MSG_CMAS_EXTREME: *value = MSG_TYPE_SMS_CMAS_EXTREME; break; - case MSG_CMAS_SEVERE : + case MSG_CMAS_SEVERE: *value = MSG_TYPE_SMS_CMAS_SEVERE; break; - case MSG_CMAS_AMBER : + case MSG_CMAS_AMBER: *value = MSG_TYPE_SMS_CMAS_AMBER; break; - case MSG_CMAS_TEST : + case MSG_CMAS_TEST: *value = MSG_TYPE_SMS_CMAS_TEST; break; - case MSG_CMAS_EXERCISE : + case MSG_CMAS_EXERCISE: *value = MSG_TYPE_SMS_CMAS_EXERCISE; break; - case MSG_CMAS_OPERATOR_DEFINED : + case MSG_CMAS_OPERATOR_DEFINED: *value = MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; break; - default : + default: ret = MSG_ERR_UNKNOWN; } } break; - case MSG_CB_MSG_RECV_TIME_INT : + case MSG_CB_MSG_RECV_TIME_INT: *value = cb_msg->receivedTime; break; - case MSG_CB_MSG_SERIAL_NUM_INT : + case MSG_CB_MSG_SERIAL_NUM_INT: *value = cb_msg->serialNum; break; - case MSG_CB_MSG_MSG_ID_INT : + case MSG_CB_MSG_MSG_ID_INT: *value = cb_msg->messageId; break; - case MSG_CB_MSG_DCS_INT : + case MSG_CB_MSG_DCS_INT: *value = (int)cb_msg->dcs; break; - case MSG_CB_MSG_CB_TEXT_LEN_INT : + case MSG_CB_MSG_CB_TEXT_LEN_INT: *value = cb_msg->cbTextLen; break; - case MSG_CB_MSG_ETWS_WARNING_TYPE_INT : + case MSG_CB_MSG_ETWS_WARNING_TYPE_INT: *value = cb_msg->etwsWarningType; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -723,24 +716,21 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size) MSG_CB_MSG_S *cb_msg = (MSG_CB_MSG_S *)data; switch (field) { - case MSG_CB_MSG_CB_TEXT_STR: - { + case MSG_CB_MSG_CB_TEXT_STR: { int copylen = 0; copylen = (size > cb_msg->cbTextLen) ? cb_msg->cbTextLen : size - 1; - memcpy (value, cb_msg->cbText, copylen); + memcpy(value, cb_msg->cbText, copylen); value[copylen] = '\0'; } break; - case MSG_CB_MSG_LANGUAGE_TYPE_STR: - { + case MSG_CB_MSG_LANGUAGE_TYPE_STR: { int copylen = 0; copylen = ((size_t)size > strlen((const char*)cb_msg->language_type)) ? strlen((const char*)cb_msg->language_type) : size - 1; - memcpy (value, cb_msg->language_type, copylen); + memcpy(value, cb_msg->language_type, copylen); value[copylen] = '\0'; } break; - case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR: - { + case MSG_CB_MSG_ETWS_WARNING_SECU_INFO_STR: { if ((size_t)size < sizeof(cb_msg->etwsWarningSecurityInfo)) ret = MSG_ERR_INVALID_PARAMETER; else @@ -748,7 +738,7 @@ int msg_cb_message_get_str_value(void *data, int field, char *value, int size) } break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -843,14 +833,13 @@ int msg_message_list_append(msg_struct_t msg_struct_handle, int field, msg_struc msg_struct_s *msg_struct_item = NULL; switch (field) { - case MSG_MESSAGE_ADDR_LIST_HND: - { + case MSG_MESSAGE_ADDR_LIST_HND: { msg_struct_item = __msg_message_create_address_struct(); msg_data->addressList = g_list_append(msg_data->addressList, msg_struct_item); *item = (msg_struct_t)msg_struct_item; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -866,8 +855,7 @@ int msg_message_list_clear(msg_struct_t msg_struct_handle, int field) MSG_MESSAGE_HIDDEN_S *msg_data = (MSG_MESSAGE_HIDDEN_S *)msg_struct->data; switch (field) { - case MSG_MESSAGE_ADDR_LIST_HND: - { + case MSG_MESSAGE_ADDR_LIST_HND: { /* Free GList *addressList */ if (msg_data->addressList) { g_list_free_full(msg_data->addressList, __msg_message_release_address_struct); @@ -875,7 +863,7 @@ int msg_message_list_clear(msg_struct_t msg_struct_handle, int field) } } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -893,10 +881,10 @@ int msg_conversation_get_list_hnd(void *data, int field, void **value) MSG_CONVERSATION_VIEW_S *msg_data = (MSG_CONVERSATION_VIEW_S *)data; switch (field) { - case MSG_CONV_MSG_MULTIPART_HND : + case MSG_CONV_MSG_MULTIPART_HND: *value = (void *)msg_data->multipart_list; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } diff --git a/mapi/msg_mms.cpp b/mapi/msg_mms.cpp index f8312a9..9137133 100755 --- a/mapi/msg_mms.cpp +++ b/mapi/msg_mms.cpp @@ -128,8 +128,7 @@ void *msg_mms_create_struct_data(int field) data = (void *)new MMS_PAGE_S; bzero(data, sizeof(MMS_PAGE_S)); break; - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *media = new MMS_MEDIA_HIDDEN_S; bzero(media, sizeof(MMS_MEDIA_HIDDEN_S)); @@ -178,28 +177,28 @@ void msg_mms_list_item_free_func(gpointer data) msg_struct_s *msg_struct = (msg_struct_s *)data; switch (msg_struct->type) { - case MSG_STRUCT_MMS_MEDIA : + case MSG_STRUCT_MMS_MEDIA: __msg_mms_release_media(msg_struct); break; - case MSG_STRUCT_MMS_PAGE : + case MSG_STRUCT_MMS_PAGE: __msg_mms_release_page(msg_struct); break; - case MSG_STRUCT_MMS_ATTACH : + case MSG_STRUCT_MMS_ATTACH: __msg_mms_release_attach(msg_struct); break; - case MSG_STRUCT_MMS_REGION : + case MSG_STRUCT_MMS_REGION: __msg_mms_release_region(msg_struct); break; - case MSG_STRUCT_MMS_TRANSITION : + case MSG_STRUCT_MMS_TRANSITION: __msg_mms_release_transition(msg_struct); break; - case MSG_STRUCT_MMS_META : + case MSG_STRUCT_MMS_META: __msg_mms_release_meta(msg_struct); break; - case MSG_STRUCT_MULTIPART_INFO : + case MSG_STRUCT_MULTIPART_INFO: __msg_mms_release_multipart(msg_struct); break; - default : + default: break; } } @@ -411,8 +410,7 @@ int msg_mms_release_struct(msg_struct_s **msg_struct_data) delete msg_struct; *msg_struct_data = NULL; break; - case MSG_STRUCT_MULTIPART_INFO: - { + case MSG_STRUCT_MULTIPART_INFO: { if (msg_struct->data) { delete (MMS_MULTIPART_DATA_S *)(msg_struct->data); msg_struct->data = NULL; @@ -431,8 +429,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_ROOTLAYOUT_WIDTH_INT) { *value = mms_data->rootlayout.width.value; @@ -471,8 +468,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_PAGE: - { + case MSG_STRUCT_MMS_PAGE: { MMS_PAGE_S *mms_page_data = (MMS_PAGE_S *)msg_struct->data; if (field == MSG_MMS_PAGE_PAGE_DURATION_INT) *value = mms_page_data->nDur; @@ -490,8 +486,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_TYPE_INT) *value = mms_media_data->mediatype; @@ -501,8 +496,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_ATTACH: - { + case MSG_STRUCT_MMS_ATTACH: { MMS_ATTACH_S *mms_attach_data = (MMS_ATTACH_S *)msg_struct->data; if (field == MSG_MMS_ATTACH_MIME_TYPE_INT) *value = mms_attach_data->mediatype; @@ -514,8 +508,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_LENGTH_LEFT_INT) *value = mms_region_data->nLeft.value; @@ -533,8 +526,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_TRANSITION: - { + case MSG_STRUCT_MMS_TRANSITION: { MMS_SMIL_TRANSITION *mms_transition_data = (MMS_SMIL_TRANSITION *)msg_struct->data; if (field == MSG_MMS_TRANSITION_TYPE_INT) *value = mms_transition_data->nType; @@ -546,8 +538,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_REPEAT_INT) *value = mms_smil_text_data->nRepeat; @@ -569,8 +560,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_AVI: - { + case MSG_STRUCT_MMS_SMIL_AVI: { MmsSmilAVI *mms_smil_avi_data = (MmsSmilAVI *)msg_struct->data; if (field == MSG_MMS_SMIL_AVI_REPEAT_INT) *value = mms_smil_avi_data->nRepeat; @@ -590,7 +580,7 @@ int msg_mms_get_int_value(msg_struct_s *msg_struct, int field, int *value) err = msg_multipart_get_int_value(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -602,8 +592,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) { /* mms header */ strncpy(value, mms_data->header.contentLocation, size); @@ -631,8 +620,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_SRC_STR) strncpy(value, mms_media_data->szSrc, size); @@ -643,7 +631,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int else if (field == MSG_MMS_MEDIA_CONTENT_ID_STR) { if (strlen(mms_media_data->szContentID) > 0) snprintf(value, size, "<%s>", mms_media_data->szContentID); - }else if (field == MSG_MMS_MEDIA_REGION_ID_STR) + } else if (field == MSG_MMS_MEDIA_REGION_ID_STR) strncpy(value, mms_media_data->regionId, size); else if (field == MSG_MMS_MEDIA_ALTERNATIVE_STR) strncpy(value, mms_media_data->szAlt, size); @@ -657,8 +645,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_ATTACH: - { + case MSG_STRUCT_MMS_ATTACH: { MMS_ATTACH_S *mms_attach_data = (MMS_ATTACH_S *)msg_struct->data; if (field == MSG_MMS_ATTACH_FILENAME_STR) strncpy(value, mms_attach_data->szFileName, size); @@ -672,8 +659,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_ID_STR) strncpy(value, mms_region_data->szID, size); @@ -681,8 +667,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_TRANSITION: - { + case MSG_STRUCT_MMS_TRANSITION: { MMS_SMIL_TRANSITION *mms_transition_data = (MMS_SMIL_TRANSITION *)msg_struct->data; if (field == MSG_MMS_TRANSITION_ID_STR) strncpy(value, mms_transition_data->szID, size); @@ -690,8 +675,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_META: - { + case MSG_STRUCT_MMS_META: { MMS_SMIL_META *mms_meta_data = (MMS_SMIL_META *)msg_struct->data; if (field == MSG_MMS_META_ID_STR) strncpy(value, mms_meta_data->szID, size); @@ -703,8 +687,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_TRANSITION_IN_ID_STR) strncpy(value, mms_smil_text_data->szTransInId, size); @@ -714,8 +697,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_AVI: - { + case MSG_STRUCT_MMS_SMIL_AVI: { MmsSmilAVI *mms_smil_avi_data = (MmsSmilAVI *)msg_struct->data; if (field == MSG_MMS_SMIL_AVI_TRANSITION_IN_ID_STR) strncpy(value, mms_smil_avi_data->szTransInId, size); @@ -729,7 +711,7 @@ int msg_mms_get_str_value(msg_struct_s *msg_struct, int field, char *value, int err = msg_multipart_get_str_value(msg_struct->data, field, value, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -741,8 +723,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_ROOTLAYOUT_WIDTH_PERCENT_BOOL) *value = mms_data->rootlayout.width.bUnitPercent; @@ -754,8 +735,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_LENGTH_LEFT_PERCENT_BOOL) *value = mms_region_data->nLeft.bUnitPercent; @@ -771,8 +751,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_BOLD_BOOL) *value = mms_smil_text_data->bBold; @@ -786,7 +765,7 @@ int msg_mms_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -798,8 +777,7 @@ int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_SMIL_TEXT_HND) *value = mms_media_data->pText; @@ -809,7 +787,7 @@ int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -821,8 +799,7 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_PAGE_LIST_HND) *value = (msg_list_handle_t)mms_data->pagelist; @@ -840,8 +817,7 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_PAGE: - { + case MSG_STRUCT_MMS_PAGE: { MMS_PAGE_S *mms_page_data = (MMS_PAGE_S *)msg_struct->data; if (field == MSG_MMS_PAGE_MEDIA_LIST_HND) *value = (msg_list_handle_t)mms_page_data->medialist; @@ -849,7 +825,7 @@ int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -861,8 +837,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_ROOTLAYOUT_WIDTH_INT) mms_data->rootlayout.width.value = value; @@ -902,8 +877,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_PAGE: - { + case MSG_STRUCT_MMS_PAGE: { MMS_PAGE_S *mms_page_data = (MMS_PAGE_S *)msg_struct->data; if (field == MSG_MMS_PAGE_PAGE_DURATION_INT) mms_page_data->nDur = value; @@ -921,8 +895,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_TYPE_INT) mms_media_data->mediatype = (MmsSmilMediaType)value; @@ -932,8 +905,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_ATTACH: - { + case MSG_STRUCT_MMS_ATTACH: { MMS_ATTACH_S *mms_attach_data = (MMS_ATTACH_S *)msg_struct->data; if (field == MSG_MMS_ATTACH_MIME_TYPE_INT) mms_attach_data->mediatype = (MimeType)value; @@ -945,8 +917,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_LENGTH_LEFT_INT) mms_region_data->nLeft.value = value; @@ -965,8 +936,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_TRANSITION: - { + case MSG_STRUCT_MMS_TRANSITION: { MMS_SMIL_TRANSITION *mms_transition_data = (MMS_SMIL_TRANSITION *)msg_struct->data; if (field == MSG_MMS_TRANSITION_TYPE_INT) mms_transition_data->nType = (MmsSmilTransType)value; @@ -978,8 +948,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_REPEAT_INT) mms_smil_text_data->nRepeat = value; @@ -1001,8 +970,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_AVI: - { + case MSG_STRUCT_MMS_SMIL_AVI: { MmsSmilAVI *mms_smil_avi_data = (MmsSmilAVI *)msg_struct->data; if (field == MSG_MMS_SMIL_AVI_REPEAT_INT) mms_smil_avi_data->nRepeat = value; @@ -1018,7 +986,7 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1030,8 +998,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_SRC_STR) strncpy(mms_media_data->szSrc, value, MSG_FILEPATH_LEN_MAX); @@ -1070,8 +1037,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_ATTACH: - { + case MSG_STRUCT_MMS_ATTACH: { MMS_ATTACH_S *mms_attach_data = (MMS_ATTACH_S *)msg_struct->data; if (field == MSG_MMS_ATTACH_FILENAME_STR) { strncpy(mms_attach_data->szFileName, value, MSG_FILENAME_LEN_MAX); @@ -1106,8 +1072,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int } } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_ID_STR) strncpy(mms_region_data->szID, value, MAX_SMIL_REGION_ID); @@ -1115,8 +1080,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_TRANSITION: - { + case MSG_STRUCT_MMS_TRANSITION: { MMS_SMIL_TRANSITION *mms_transition_data = (MMS_SMIL_TRANSITION *)msg_struct->data; if (field == MSG_MMS_TRANSITION_ID_STR) strncpy(mms_transition_data->szID, value, MAX_SMIL_TRANSITION_ID); @@ -1124,8 +1088,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_META: - { + case MSG_STRUCT_MMS_META: { MMS_SMIL_META *mms_meta_data = (MMS_SMIL_META *)msg_struct->data; if (field == MSG_MMS_META_ID_STR) strncpy(mms_meta_data->szID, value, MAX_SMIL_META_ID); @@ -1137,8 +1100,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_TRANSITION_IN_ID_STR) strncpy(mms_smil_text_data->szTransInId, value, MAX_SMIL_TRANSIN_ID); @@ -1148,8 +1110,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_AVI: - { + case MSG_STRUCT_MMS_SMIL_AVI: { MmsSmilAVI *mms_smil_avi_data = (MmsSmilAVI *)msg_struct->data; if (field == MSG_MMS_SMIL_AVI_TRANSITION_IN_ID_STR) strncpy(mms_smil_avi_data->szTransInId, value, MAX_SMIL_TRANSIN_ID); @@ -1159,8 +1120,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_HEADER_CONTENT_LOCATION_STR) { /* mms header */ strncpy(mms_data->header.contentLocation, value, sizeof(mms_data->header.contentLocation) - 1 ); @@ -1192,7 +1152,7 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = msg_multipart_set_str_value(msg_struct->data, field, value, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1205,8 +1165,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_ROOTLAYOUT_WIDTH_PERCENT_BOOL) mms_data->rootlayout.width.bUnitPercent = value; @@ -1216,8 +1175,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_REGION: - { + case MSG_STRUCT_MMS_REGION: { MMS_SMIL_REGION *mms_region_data = (MMS_SMIL_REGION *)msg_struct->data; if (field == MSG_MMS_REGION_LENGTH_LEFT_PERCENT_BOOL) mms_region_data->nLeft.bUnitPercent = value; @@ -1231,8 +1189,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) err = MSG_ERR_INVALID_PARAMETER; } break; - case MSG_STRUCT_MMS_SMIL_TEXT: - { + case MSG_STRUCT_MMS_SMIL_TEXT: { MmsSmilText *mms_smil_text_data = (MmsSmilText *)msg_struct->data; if (field == MSG_MMS_SMIL_TEXT_BOLD_BOOL) mms_smil_text_data->bBold = value; @@ -1246,7 +1203,7 @@ int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value) err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1258,8 +1215,7 @@ int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_MMS_MEDIA: - { + case MSG_STRUCT_MMS_MEDIA: { MMS_MEDIA_HIDDEN_S *mms_media_data = (MMS_MEDIA_HIDDEN_S *)msg_struct->data; if (field == MSG_MMS_MEDIA_SMIL_TEXT_HND) @@ -1270,7 +1226,7 @@ int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s err = MSG_ERR_INVALID_PARAMETER; } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1284,9 +1240,7 @@ int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t msg_struct_s *msg_struct_item = NULL; switch (msg_struct->type) { - case MSG_STRUCT_MMS: - { - + case MSG_STRUCT_MMS: { MMS_DATA_HIDDEN_S *mms_data = (MMS_DATA_HIDDEN_S *)msg_struct->data; if (field == MSG_STRUCT_MMS_PAGE) { @@ -1318,9 +1272,7 @@ int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t } } break; - case MSG_STRUCT_MMS_PAGE: - { - + case MSG_STRUCT_MMS_PAGE: { MMS_PAGE_S *mms_page_data = (MMS_PAGE_S *)msg_struct->data; if (field == MSG_STRUCT_MMS_MEDIA) { @@ -1332,7 +1284,7 @@ int msg_mms_list_append(msg_struct_t msg_struct_handle, int field, msg_struct_t } } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1408,8 +1360,7 @@ void convert_to_mmsdata2(MMS_DATA_HIDDEN_S *pSrcMms, MMS_MESSAGE_DATA_S *pDest) if (page) { page->mediaCnt = g_list_length(src_page->medialist); - for (j = 0; j < page->mediaCnt; j++) - { + for (j = 0; j < page->mediaCnt; j++) { MMS_MEDIA_S *dst_media = (MMS_MEDIA_S *)calloc(1, sizeof(MMS_MEDIA_S)); msg_struct_s *src_media_s = (msg_struct_s *)g_list_nth_data(src_page->medialist, j); @@ -1493,8 +1444,7 @@ void convert_from_mmsdata2(const MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_HIDDEN_S *pD MMS_PAGE_S *src_page = (MMS_PAGE_S *)g_list_nth_data(pSrc->pagelist, i); page->mediaCnt = g_list_length(src_page->medialist); - for (j = 0; j < page->mediaCnt; j++) - { + for (j = 0; j < page->mediaCnt; j++) { msg_struct_s *dst_media_s = msg_mms_create_struct(MSG_STRUCT_MMS_MEDIA); MMS_MEDIA_S *src_media = (MMS_MEDIA_S *)g_list_nth_data(src_page->medialist, j); @@ -1553,7 +1503,6 @@ void convert_from_mmsdata2(const MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_HIDDEN_S *pD memcpy(&pDestMms->header, &pSrc->header, sizeof(MMS_HEADER_DATA_S)); memcpy(&pDestMms->smil, &pSrc->smil, sizeof(MMS_MULTIPART_DATA_S)); - } @@ -1586,7 +1535,7 @@ int msg_multipart_get_str_value(void *data, int field, char *value, int size) strncpy(value, msg_data->szContentLocation, size); break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1610,7 +1559,7 @@ int msg_multipart_get_int_value(void *data, int field, int *value) case MSG_MMS_MULTIPART_MALWARE_ALLOW_INT: *value = msg_data->malware_allow; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1647,7 +1596,7 @@ int msg_multipart_set_str_value(void *data, int field, char *value, int size) case MSG_MMS_MULTIPART_CONTENT_LOCATION_STR: strncpy(msg_data->szContentLocation, value, MSG_MSG_ID_LEN); break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1678,11 +1627,10 @@ void convert_to_hidden_mmsdata(MMS_DATA_S *pSrc, msg_struct_s *pDest) pDestMms->smil.type = MIME_APPLICATION_SMIL; pDestMms->smil.pMultipartData = (char *)calloc(1, pDestMms->smil.nMultipartDataLen+1); if (pDestMms->smil.pMultipartData) - memcpy(pDestMms->smil.pMultipartData, pSrc->smil->pMultipartData,pDestMms->smil.nMultipartDataLen); + memcpy(pDestMms->smil.pMultipartData, pSrc->smil->pMultipartData, pDestMms->smil.nMultipartDataLen); } if (pSrc->multipartlist) { - int list_cnt = g_list_length(pSrc->multipartlist); for (int i = 0; i < list_cnt; i++) { @@ -1699,12 +1647,10 @@ void convert_to_hidden_mmsdata(MMS_DATA_S *pSrc, msg_struct_s *pDest) } } } - } void convert_from_hidden_mmsdata(msg_struct_s *pSrc, MMS_DATA_S *pDest) { - MMS_DATA_HIDDEN_S *pSrcMms = (MMS_DATA_HIDDEN_S *)pSrc->data; MMS_MESSAGE_DATA_S *MmsMessageData = NULL; diff --git a/mapi/msg_setting.cpp b/mapi/msg_setting.cpp index 386d47d..1bdf954 100755 --- a/mapi/msg_setting.cpp +++ b/mapi/msg_setting.cpp @@ -32,40 +32,40 @@ int msg_setting_get_int_value(msg_struct_s *msg_struct, int field, int *value) int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_SMSC_OPT : + case MSG_STRUCT_SETTING_SMSC_OPT: err = msg_get_smsc_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMSC_INFO : + case MSG_STRUCT_SETTING_SMSC_INFO: err = msg_get_smsc_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_OPT : + case MSG_STRUCT_SETTING_CB_OPT: err = msg_get_cb_option_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_get_cb_channel_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMS_SEND_OPT : + case MSG_STRUCT_SETTING_SMS_SEND_OPT: err = msg_get_sms_send_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_SEND_OPT : + case MSG_STRUCT_SETTING_MMS_SEND_OPT: err = msg_get_mms_send_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_RECV_OPT : + case MSG_STRUCT_SETTING_MMS_RECV_OPT: err = msg_get_mms_recv_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: err = msg_get_push_msg_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_get_general_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MSGSIZE_OPT : + case MSG_STRUCT_SETTING_MSGSIZE_OPT: err = msg_get_msgsize_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_get_voice_msg_opt_int(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -78,19 +78,19 @@ int msg_setting_get_str_value(msg_struct_s *msg_struct, int field, char *src, in int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_SMSC_INFO : + case MSG_STRUCT_SETTING_SMSC_INFO: err = msg_get_smsc_info_str(msg_struct->data, field, src, size); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_get_cb_channel_info_str(msg_struct->data, field, src, size); break; - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_get_voice_msg_opt_str(msg_struct->data, field, src, size); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_get_general_opt_str(msg_struct->data, field, src, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -103,28 +103,28 @@ int msg_setting_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_CB_OPT : + case MSG_STRUCT_SETTING_CB_OPT: err = msg_get_cb_option_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_get_cb_channel_info_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMS_SEND_OPT : + case MSG_STRUCT_SETTING_SMS_SEND_OPT: err = msg_get_sms_send_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_SEND_OPT : + case MSG_STRUCT_SETTING_MMS_SEND_OPT: err = msg_get_mms_send_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_RECV_OPT : + case MSG_STRUCT_SETTING_MMS_RECV_OPT: err = msg_get_mms_recv_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: err = msg_get_push_msg_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_get_general_opt_bool(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -137,13 +137,13 @@ int msg_setting_get_list_handle(msg_struct_s *msg_struct, int field, void **valu int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_SMSC_OPT : + case MSG_STRUCT_SETTING_SMSC_OPT: err = msg_get_smsc_opt_list(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_OPT : + case MSG_STRUCT_SETTING_CB_OPT: err = msg_get_cb_option_list(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -156,40 +156,40 @@ int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value) int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_SMSC_OPT : + case MSG_STRUCT_SETTING_SMSC_OPT: err = msg_set_smsc_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMSC_INFO : + case MSG_STRUCT_SETTING_SMSC_INFO: err = msg_set_smsc_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_OPT : + case MSG_STRUCT_SETTING_CB_OPT: err = msg_set_cb_option_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_set_cb_channel_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMS_SEND_OPT : + case MSG_STRUCT_SETTING_SMS_SEND_OPT: err = msg_set_sms_send_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_SEND_OPT : + case MSG_STRUCT_SETTING_MMS_SEND_OPT: err = msg_set_mms_send_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_RECV_OPT : + case MSG_STRUCT_SETTING_MMS_RECV_OPT: err = msg_set_mms_recv_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: err = msg_set_push_msg_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_set_general_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MSGSIZE_OPT : + case MSG_STRUCT_SETTING_MSGSIZE_OPT: err = msg_set_msgsize_opt_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_set_voice_msg_opt_int(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -202,19 +202,19 @@ int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value, int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_SMSC_INFO : + case MSG_STRUCT_SETTING_SMSC_INFO: err = msg_set_smsc_info_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_set_cb_channel_info_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_set_voice_msg_opt_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_set_general_opt_str(msg_struct->data, field, value, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -227,28 +227,28 @@ int msg_setting_set_bool_value(msg_struct_s *msg_struct, int field, bool value) int err = MSG_SUCCESS; switch (msg_struct->type) { - case MSG_STRUCT_SETTING_CB_OPT : + case MSG_STRUCT_SETTING_CB_OPT: err = msg_set_cb_option_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: err = msg_set_cb_channel_info_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_SMS_SEND_OPT : + case MSG_STRUCT_SETTING_SMS_SEND_OPT: err = msg_set_sms_send_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_SEND_OPT : + case MSG_STRUCT_SETTING_MMS_SEND_OPT: err = msg_set_mms_send_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_MMS_RECV_OPT : + case MSG_STRUCT_SETTING_MMS_RECV_OPT: err = msg_set_mms_recv_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: err = msg_set_push_msg_opt_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_set_general_opt_bool(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -321,10 +321,10 @@ int msg_get_smsc_opt_list(void *smsc_opt, int field, void **value) int ret = MSG_SUCCESS; switch (field) { - case MSG_SMSC_LIST_STRUCT : + case MSG_SMSC_LIST_STRUCT: *value = (void *)smsc_opt_data->smsc_list; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -342,13 +342,13 @@ int msg_get_smsc_opt_int(void *smsc_opt, int field, int *value) MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt; switch (field) { - case MSG_SMSC_SELECTED_ID_INT : + case MSG_SMSC_SELECTED_ID_INT: *value = smsc_opt_data->selected; break; - case MSG_SMSC_LIST_SIM_INDEX_INT : + case MSG_SMSC_LIST_SIM_INDEX_INT: *value = smsc_opt_data->simIndex; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -366,16 +366,16 @@ int msg_set_smsc_opt_int(void *smsc_opt, int field, int value) MSG_SMSC_LIST_HIDDEN_S *smsc_opt_data = (MSG_SMSC_LIST_HIDDEN_S *)smsc_opt; switch (field) { - case MSG_SMSC_SELECTED_ID_INT : + case MSG_SMSC_SELECTED_ID_INT: smsc_opt_data->selected = value; break; - case MSG_SMSC_LIST_INDEX_INT : + case MSG_SMSC_LIST_INDEX_INT: smsc_opt_data->index = value; break; - case MSG_SMSC_LIST_SIM_INDEX_INT : + case MSG_SMSC_LIST_SIM_INDEX_INT: smsc_opt_data->simIndex = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -393,19 +393,19 @@ int msg_get_smsc_info_int(void *smsc_info, int field, int *value) MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info; switch (field) { - case MSG_SMSC_ADDR_TON_INT : + case MSG_SMSC_ADDR_TON_INT: *value = smsc_data->smscAddr.ton; break; - case MSG_SMSC_ADDR_NPI_INT : + case MSG_SMSC_ADDR_NPI_INT: *value = smsc_data->smscAddr.npi; break; - case MSG_SMSC_PID_INT : + case MSG_SMSC_PID_INT: *value = smsc_data->pid; break; - case MSG_SMSC_VAL_PERIOD_INT : + case MSG_SMSC_VAL_PERIOD_INT: *value = smsc_data->valPeriod; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -423,19 +423,19 @@ int msg_set_smsc_info_int(void *smsc_info, int field, int value) MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info; switch (field) { - case MSG_SMSC_ADDR_TON_INT : + case MSG_SMSC_ADDR_TON_INT: smsc_data->smscAddr.ton = value; break; - case MSG_SMSC_ADDR_NPI_INT : + case MSG_SMSC_ADDR_NPI_INT: smsc_data->smscAddr.npi = value; break; - case MSG_SMSC_PID_INT : + case MSG_SMSC_PID_INT: smsc_data->pid = value; break; - case MSG_SMSC_VAL_PERIOD_INT : + case MSG_SMSC_VAL_PERIOD_INT: smsc_data->valPeriod = value; break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -451,13 +451,13 @@ int msg_get_smsc_info_str(void *smsc_info, int field, char *value, int size) MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info; switch (field) { - case MSG_SMSC_ADDR_STR : + case MSG_SMSC_ADDR_STR: strncpy(value, smsc_data->smscAddr.address, size); break; - case MSG_SMSC_NAME_STR : + case MSG_SMSC_NAME_STR: strncpy(value, smsc_data->name, size); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -474,15 +474,15 @@ int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size) MSG_SMSC_DATA_S *smsc_data = (MSG_SMSC_DATA_S *)smsc_info; switch (field) { - case MSG_SMSC_ADDR_STR : + case MSG_SMSC_ADDR_STR: bzero(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address)); snprintf(smsc_data->smscAddr.address, sizeof(smsc_data->smscAddr.address), "%s", val); break; - case MSG_SMSC_NAME_STR : + case MSG_SMSC_NAME_STR: bzero(smsc_data->name, sizeof(smsc_data->name)); snprintf(smsc_data->name, sizeof(smsc_data->name), "%s", val); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -554,13 +554,13 @@ int msg_get_cb_option_int(void *cb_opt, int field, int *value) MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt; switch (field) { - case MSG_CB_MAX_SIM_COUNT_INT : + case MSG_CB_MAX_SIM_COUNT_INT: *value = cb_opt_data->maxSimCnt; break; - case MSG_CB_SIM_INDEX_INT : + case MSG_CB_SIM_INDEX_INT: *value = cb_opt_data->simIndex; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -578,13 +578,13 @@ int msg_set_cb_option_int(void *cb_opt, int field, int value) MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt; switch (field) { - case MSG_CB_MAX_SIM_COUNT_INT : + case MSG_CB_MAX_SIM_COUNT_INT: cb_opt_data->maxSimCnt = value; break; - case MSG_CB_SIM_INDEX_INT : + case MSG_CB_SIM_INDEX_INT: cb_opt_data->simIndex = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -603,40 +603,40 @@ int msg_get_cb_option_bool(void *cb_opt, int field, bool *value) MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt; switch (field) { - case MSG_CB_RECEIVE_BOOL : + case MSG_CB_RECEIVE_BOOL: *value = cb_opt_data->bReceive; break; - case MSG_CB_LANGUAGE_TYPE_ALL_BOOL : + case MSG_CB_LANGUAGE_TYPE_ALL_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL]; break; - case MSG_CB_LANGUAGE_TYPE_ENG_BOOL : + case MSG_CB_LANGUAGE_TYPE_ENG_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG]; break; - case MSG_CB_LANGUAGE_TYPE_GER_BOOL : + case MSG_CB_LANGUAGE_TYPE_GER_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER]; break; - case MSG_CB_LANGUAGE_TYPE_FRE_BOOL : + case MSG_CB_LANGUAGE_TYPE_FRE_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE]; break; - case MSG_CB_LANGUAGE_TYPE_ITA_BOOL : + case MSG_CB_LANGUAGE_TYPE_ITA_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA]; break; - case MSG_CB_LANGUAGE_TYPE_NED_BOOL : + case MSG_CB_LANGUAGE_TYPE_NED_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED]; break; - case MSG_CB_LANGUAGE_TYPE_SPA_BOOL : + case MSG_CB_LANGUAGE_TYPE_SPA_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA]; break; - case MSG_CB_LANGUAGE_TYPE_POR_BOOL : + case MSG_CB_LANGUAGE_TYPE_POR_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR]; break; - case MSG_CB_LANGUAGE_TYPE_SWE_BOOL : + case MSG_CB_LANGUAGE_TYPE_SWE_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE]; break; - case MSG_CB_LANGUAGE_TYPE_TUR_BOOL : + case MSG_CB_LANGUAGE_TYPE_TUR_BOOL: *value = cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR]; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -654,40 +654,40 @@ int msg_set_cb_option_bool(void *cb_opt, int field, bool value) MSG_CBMSG_OPT_HIDDEN_S *cb_opt_data = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt; switch (field) { - case MSG_CB_RECEIVE_BOOL : + case MSG_CB_RECEIVE_BOOL: cb_opt_data->bReceive = value; break; - case MSG_CB_LANGUAGE_TYPE_ALL_BOOL : + case MSG_CB_LANGUAGE_TYPE_ALL_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ALL] = value; break; - case MSG_CB_LANGUAGE_TYPE_ENG_BOOL : + case MSG_CB_LANGUAGE_TYPE_ENG_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ENG] = value; break; - case MSG_CB_LANGUAGE_TYPE_GER_BOOL : + case MSG_CB_LANGUAGE_TYPE_GER_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_GER] = value; break; - case MSG_CB_LANGUAGE_TYPE_FRE_BOOL : + case MSG_CB_LANGUAGE_TYPE_FRE_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_FRE] = value; break; - case MSG_CB_LANGUAGE_TYPE_ITA_BOOL : + case MSG_CB_LANGUAGE_TYPE_ITA_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_ITA] = value; break; - case MSG_CB_LANGUAGE_TYPE_NED_BOOL : + case MSG_CB_LANGUAGE_TYPE_NED_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_NED] = value; break; - case MSG_CB_LANGUAGE_TYPE_SPA_BOOL : + case MSG_CB_LANGUAGE_TYPE_SPA_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SPA] = value; break; - case MSG_CB_LANGUAGE_TYPE_POR_BOOL : + case MSG_CB_LANGUAGE_TYPE_POR_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_POR] = value; break; - case MSG_CB_LANGUAGE_TYPE_SWE_BOOL : + case MSG_CB_LANGUAGE_TYPE_SWE_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_SWE] = value; break; - case MSG_CB_LANGUAGE_TYPE_TUR_BOOL : + case MSG_CB_LANGUAGE_TYPE_TUR_BOOL: cb_opt_data->bLanguage[MSG_CBLANG_TYPE_TUR] = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -705,10 +705,10 @@ int msg_get_cb_option_list(void *cb_opt, int field, void **value) int ret = MSG_SUCCESS; switch (field) { - case MSG_CB_CHANNEL_LIST_STRUCT : + case MSG_CB_CHANNEL_LIST_STRUCT: *value = (void *)cb_opt_data->channelData; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -726,13 +726,13 @@ int msg_get_cb_channel_info_int(void *cb_ch_info, int field, int *value) MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_ID_FROM_INT : + case MSG_CB_CHANNEL_ID_FROM_INT: *value = cb_ch_data->from; break; - case MSG_CB_CHANNEL_ID_TO_INT : + case MSG_CB_CHANNEL_ID_TO_INT: *value = cb_ch_data->to; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -750,13 +750,13 @@ int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value) MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_ID_FROM_INT : + case MSG_CB_CHANNEL_ID_FROM_INT: cb_ch_data->from = value; break; - case MSG_CB_CHANNEL_ID_TO_INT : + case MSG_CB_CHANNEL_ID_TO_INT: cb_ch_data->to = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -774,10 +774,10 @@ int msg_get_cb_channel_info_bool(void *cb_ch_info, int field, bool *value) MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_ACTIVATE_BOOL : + case MSG_CB_CHANNEL_ACTIVATE_BOOL: *value = cb_ch_data->bActivate; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -795,10 +795,10 @@ int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value) MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_ACTIVATE_BOOL : + case MSG_CB_CHANNEL_ACTIVATE_BOOL: cb_ch_data->bActivate = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -814,10 +814,10 @@ int msg_get_cb_channel_info_str(void *cb_ch_info, int field, char *value, int si MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_NAME_STR : + case MSG_CB_CHANNEL_NAME_STR: strncpy(value, cb_ch_data->name, size); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -834,11 +834,11 @@ int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size MSG_CB_CHANNEL_INFO_S *cb_ch_data = (MSG_CB_CHANNEL_INFO_S *)cb_ch_info; switch (field) { - case MSG_CB_CHANNEL_NAME_STR : + case MSG_CB_CHANNEL_NAME_STR: bzero(cb_ch_data->name, sizeof(cb_ch_data->name)); snprintf(cb_ch_data->name, sizeof(cb_ch_data->name), "%s", val); break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -910,16 +910,16 @@ int msg_get_sms_send_opt_int(void *sms_send_opt, int field, int *value) MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt; switch (field) { - case MSG_SMS_SENDOPT_ENCODE_TYPE_INT : + case MSG_SMS_SENDOPT_ENCODE_TYPE_INT: *value = send_opt->dcs; break; - case MSG_SMS_SENDOPT_NETWORK_MODE_INT : + case MSG_SMS_SENDOPT_NETWORK_MODE_INT: *value = send_opt->netMode; break; - case MSG_SMS_SENDOPT_SAVE_STORAGE_INT : + case MSG_SMS_SENDOPT_SAVE_STORAGE_INT: *value = send_opt->saveStorage; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -937,16 +937,16 @@ int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value) MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt; switch (field) { - case MSG_SMS_SENDOPT_ENCODE_TYPE_INT : + case MSG_SMS_SENDOPT_ENCODE_TYPE_INT: send_opt->dcs = value; break; - case MSG_SMS_SENDOPT_NETWORK_MODE_INT : + case MSG_SMS_SENDOPT_NETWORK_MODE_INT: send_opt->netMode = value; break; - case MSG_SMS_SENDOPT_SAVE_STORAGE_INT : + case MSG_SMS_SENDOPT_SAVE_STORAGE_INT: send_opt->saveStorage = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -964,13 +964,13 @@ int msg_get_sms_send_opt_bool(void *sms_send_opt, int field, bool *value) MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt; switch (field) { - case MSG_SMS_SENDOPT_REPLY_PATH_BOOL : + case MSG_SMS_SENDOPT_REPLY_PATH_BOOL: *value = send_opt->bReplyPath; break; - case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL : + case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL: *value = send_opt->bDeliveryReport; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -988,13 +988,13 @@ int msg_set_sms_send_opt_bool(void *sms_send_opt, int field, bool value) MSG_SMS_SENDOPT_S *send_opt = (MSG_SMS_SENDOPT_S *)sms_send_opt; switch (field) { - case MSG_SMS_SENDOPT_REPLY_PATH_BOOL : + case MSG_SMS_SENDOPT_REPLY_PATH_BOOL: send_opt->bReplyPath = value; break; - case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL : + case MSG_SMS_SENDOPT_DELIVERY_REPORT_BOOL: send_opt->bDeliveryReport = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1067,34 +1067,34 @@ int msg_get_mms_send_opt_int(void *mms_send_opt, int field, int *value) MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt; switch (field) { - case MSG_MMS_SENDOPT_CLASS_TYPE_INT : + case MSG_MMS_SENDOPT_CLASS_TYPE_INT: *value = send_opt->msgClass; break; - case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT : + case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT: *value = send_opt->priority; break; - case MSG_MMS_SENDOPT_EXPIRY_TIME_INT : + case MSG_MMS_SENDOPT_EXPIRY_TIME_INT: *value = send_opt->expiryTime; break; - case MSG_MMS_SENDOPT_DELIVERY_TIME_INT : + case MSG_MMS_SENDOPT_DELIVERY_TIME_INT: *value = send_opt->deliveryTime; break; - case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT : + case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT: *value = send_opt->customDeliveryTime; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_INT: *value = send_opt->replyCharging; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT: *value = send_opt->replyChargingDeadline; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT: *value = send_opt->replyChargingSize; break; - case MSG_MMS_SENDOPT_CREATION_MODE_INT : + case MSG_MMS_SENDOPT_CREATION_MODE_INT: *value = send_opt->creationMode; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1112,34 +1112,34 @@ int msg_set_mms_send_opt_int(void *mms_send_opt, int field, int value) MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt; switch (field) { - case MSG_MMS_SENDOPT_CLASS_TYPE_INT : + case MSG_MMS_SENDOPT_CLASS_TYPE_INT: send_opt->msgClass = value; break; - case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT : + case MSG_MMS_SENDOPT_PRIORITY_TYPE_INT: send_opt->priority = value; break; - case MSG_MMS_SENDOPT_EXPIRY_TIME_INT : + case MSG_MMS_SENDOPT_EXPIRY_TIME_INT: send_opt->expiryTime = value; break; - case MSG_MMS_SENDOPT_DELIVERY_TIME_INT : + case MSG_MMS_SENDOPT_DELIVERY_TIME_INT: send_opt->deliveryTime = value; break; - case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT : + case MSG_MMS_SENDOPT_CUSTOM_DELIVERY_TIME_INT: send_opt->customDeliveryTime = value; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_INT: send_opt->replyCharging = value; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_DEADLINE_INT: send_opt->replyChargingDeadline = value; break; - case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT : + case MSG_MMS_SENDOPT_REPLY_CHARGING_SIZE_INT: send_opt->replyChargingSize = value; break; - case MSG_MMS_SENDOPT_CREATION_MODE_INT : + case MSG_MMS_SENDOPT_CREATION_MODE_INT: send_opt->creationMode = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1157,25 +1157,25 @@ int msg_get_mms_send_opt_bool(void *mms_send_opt, int field, bool *value) MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt; switch (field) { - case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL : + case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL: *value = send_opt->bSenderVisibility; break; - case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL : + case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL: *value = send_opt->bDeliveryReport; break; - case MSG_MMS_SENDOPT_READ_REPLY_BOOL : + case MSG_MMS_SENDOPT_READ_REPLY_BOOL: *value = send_opt->bReadReply; break; - case MSG_MMS_SENDOPT_KEEP_COPY_BOOL : + case MSG_MMS_SENDOPT_KEEP_COPY_BOOL: *value = send_opt->bKeepCopy; break; - case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL : + case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL: *value = send_opt->bBodyReplying; break; - case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL : + case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL: *value = send_opt->bHideRecipients; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1193,25 +1193,25 @@ int msg_set_mms_send_opt_bool(void *mms_send_opt, int field, bool value) MSG_MMS_SENDOPT_S *send_opt = (MSG_MMS_SENDOPT_S *)mms_send_opt; switch (field) { - case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL : + case MSG_MMS_SENDOPT_SENDER_VISIBILITY_BOOL: send_opt->bSenderVisibility = value; break; - case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL : + case MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL: send_opt->bDeliveryReport = value; break; - case MSG_MMS_SENDOPT_READ_REPLY_BOOL : + case MSG_MMS_SENDOPT_READ_REPLY_BOOL: send_opt->bReadReply = value; break; - case MSG_MMS_SENDOPT_KEEP_COPY_BOOL : + case MSG_MMS_SENDOPT_KEEP_COPY_BOOL: send_opt->bKeepCopy = value; break; - case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL : + case MSG_MMS_SENDOPT_BODY_REPLYING_BOOL: send_opt->bBodyReplying = value; break; - case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL : + case MSG_MMS_SENDOPT_HIDE_RECIPIENTS_BOOL: send_opt->bHideRecipients = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1283,13 +1283,13 @@ int msg_get_mms_recv_opt_int(void *mms_recv_opt, int field, int *value) MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt; switch (field) { - case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT : + case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT: *value = recv_opt->homeNetwork; break; - case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT : + case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT: *value = recv_opt->abroadNetwok; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1307,13 +1307,13 @@ int msg_set_mms_recv_opt_int(void *mms_recv_opt, int field, int value) MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt; switch (field) { - case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT : + case MSG_MMS_RECVOPT_HOME_RETRIEVE_TYPE_INT: recv_opt->homeNetwork = value; break; - case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT : + case MSG_MMS_RECVOPT_ABROAD_RETRIEVE_TYPE_INT: recv_opt->abroadNetwok = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1331,19 +1331,19 @@ int msg_get_mms_recv_opt_bool(void *mms_recv_opt, int field, bool *value) MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt; switch (field) { - case MSG_MMS_RECVOPT_READ_REPORT_BOOL : + case MSG_MMS_RECVOPT_READ_REPORT_BOOL: *value = recv_opt->readReceipt; break; - case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL : + case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL: *value = recv_opt->bDeliveryReceipt; break; - case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL : + case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL: *value = recv_opt->bRejectUnknown; break; - case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL : + case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL: *value = recv_opt->bRejectAdvertisement; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1361,19 +1361,19 @@ int msg_set_mms_recv_opt_bool(void *mms_recv_opt, int field, bool value) MSG_MMS_RECVOPT_S *recv_opt = (MSG_MMS_RECVOPT_S *)mms_recv_opt; switch (field) { - case MSG_MMS_RECVOPT_READ_REPORT_BOOL : + case MSG_MMS_RECVOPT_READ_REPORT_BOOL: recv_opt->readReceipt = value; break; - case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL : + case MSG_MMS_RECVOPT_DELIVERY_REPORT_BOOL: recv_opt->bDeliveryReceipt = value; break; - case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL : + case MSG_MMS_RECVOPT_REJECT_UNKNOWN_BOOL: recv_opt->bRejectUnknown = value; break; - case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL : + case MSG_MMS_RECVOPT_REJECT_ADVERTISEMENT_BOOL: recv_opt->bRejectAdvertisement = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1443,10 +1443,10 @@ int msg_get_push_msg_opt_int(void *push_msg_opt, int field, int *value) MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt; switch (field) { - case MSG_PUSHMSG_SERVICE_TYPE_INT : + case MSG_PUSHMSG_SERVICE_TYPE_INT: *value = push_opt->serviceType; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1464,10 +1464,10 @@ int msg_set_push_msg_opt_int(void *push_msg_opt, int field, int value) MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt; switch (field) { - case MSG_PUSHMSG_SERVICE_TYPE_INT : + case MSG_PUSHMSG_SERVICE_TYPE_INT: push_opt->serviceType = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1485,10 +1485,10 @@ int msg_get_push_msg_opt_bool(void *push_msg_opt, int field, bool *value) MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt; switch (field) { - case MSG_PUSHMSG_RECEIVE_BOOL : + case MSG_PUSHMSG_RECEIVE_BOOL: *value = push_opt->bReceive; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1506,10 +1506,10 @@ int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value) MSG_PUSHMSG_OPT_S *push_opt = (MSG_PUSHMSG_OPT_S *)push_msg_opt; switch (field) { - case MSG_PUSHMSG_RECEIVE_BOOL : + case MSG_PUSHMSG_RECEIVE_BOOL: push_opt->bReceive = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1579,13 +1579,13 @@ int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field, int *value) MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; switch (field) { - case MSG_VOICEMSG_SIM_INDEX_INT : + case MSG_VOICEMSG_SIM_INDEX_INT: *value = voice_opt->simIndex; break; - case MSG_VOICEMSG_VOICE_COUNT_INT : + case MSG_VOICEMSG_VOICE_COUNT_INT: *value = voice_opt->voiceCnt; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1603,10 +1603,10 @@ int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value) MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; switch (field) { - case MSG_VOICEMSG_SIM_INDEX_INT : + case MSG_VOICEMSG_SIM_INDEX_INT: voice_opt->simIndex = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1622,13 +1622,13 @@ int msg_get_voice_msg_opt_str(void *voice_msg_opt, int field, char *value, int s MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; switch (field) { - case MSG_VOICEMSG_ADDRESS_STR : + case MSG_VOICEMSG_ADDRESS_STR: strncpy(value, voice_opt->mailNumber, size); break; - case MSG_VOICEMSG_ALPHA_ID_STR : + case MSG_VOICEMSG_ALPHA_ID_STR: strncpy(value, voice_opt->alpahId, size); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -1645,11 +1645,11 @@ int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int siz MSG_VOICEMAIL_OPT_S *voice_opt = (MSG_VOICEMAIL_OPT_S *)voice_msg_opt; switch (field) { - case MSG_VOICEMSG_ADDRESS_STR : + case MSG_VOICEMSG_ADDRESS_STR: bzero(voice_opt->mailNumber, sizeof(voice_opt->mailNumber)); snprintf(voice_opt->mailNumber, sizeof(voice_opt->mailNumber), "%s", val); break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1719,19 +1719,19 @@ int msg_get_general_opt_int(void *general_opt, int field, int *value) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_ALERT_TONE_INT : + case MSG_GENERAL_ALERT_TONE_INT: *value = opt->alertTone; break; - case MSG_GENERAL_SMS_LIMIT_CNT_INT : + case MSG_GENERAL_SMS_LIMIT_CNT_INT: *value = opt->smsLimitCnt; break; - case MSG_GENERAL_MMS_LIMIT_CNT_INT : + case MSG_GENERAL_MMS_LIMIT_CNT_INT: *value = opt->mmsLimitCnt; break; - case MSG_GENERAL_RINGTONE_TYPE_INT : + case MSG_GENERAL_RINGTONE_TYPE_INT: *value = opt->ringtoneType; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1749,19 +1749,19 @@ int msg_set_general_opt_int(void *general_opt, int field, int value) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_ALERT_TONE_INT : + case MSG_GENERAL_ALERT_TONE_INT: opt->alertTone = value; break; - case MSG_GENERAL_SMS_LIMIT_CNT_INT : + case MSG_GENERAL_SMS_LIMIT_CNT_INT: opt->smsLimitCnt = value; break; - case MSG_GENERAL_MMS_LIMIT_CNT_INT : + case MSG_GENERAL_MMS_LIMIT_CNT_INT: opt->mmsLimitCnt = value; break; - case MSG_GENERAL_RINGTONE_TYPE_INT : + case MSG_GENERAL_RINGTONE_TYPE_INT: opt->ringtoneType = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1779,25 +1779,25 @@ int msg_get_general_opt_bool(void *general_opt, int field, bool *value) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_KEEP_COPY_BOOL : + case MSG_GENERAL_KEEP_COPY_BOOL: *value = opt->bKeepCopy; break; - case MSG_GENERAL_AUTO_ERASE_BOOL : + case MSG_GENERAL_AUTO_ERASE_BOOL: *value = opt->bAutoErase; break; - case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL : + case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL: *value = opt->bBlockUnknownMsg; break; - case MSG_GENERAL_MSG_NOTIFICATION_BOOL : + case MSG_GENERAL_MSG_NOTIFICATION_BOOL: *value = opt->bNotification; break; - case MSG_GENERAL_MSG_VIBRATION_BOOL : + case MSG_GENERAL_MSG_VIBRATION_BOOL: *value = opt->bVibration; break; - case MSG_GENERAL_MSG_PREVIEW_BOOL : + case MSG_GENERAL_MSG_PREVIEW_BOOL: *value = opt->bPreview; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1815,25 +1815,25 @@ int msg_set_general_opt_bool(void *general_opt, int field, bool value) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_KEEP_COPY_BOOL : + case MSG_GENERAL_KEEP_COPY_BOOL: opt->bKeepCopy = value; break; - case MSG_GENERAL_AUTO_ERASE_BOOL : + case MSG_GENERAL_AUTO_ERASE_BOOL: opt->bAutoErase = value; break; - case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL : + case MSG_GENERAL_BLOCK_UNKNOWN_NUMBER_BOOL: opt->bBlockUnknownMsg = value; break; - case MSG_GENERAL_MSG_NOTIFICATION_BOOL : + case MSG_GENERAL_MSG_NOTIFICATION_BOOL: opt->bNotification = value; break; - case MSG_GENERAL_MSG_VIBRATION_BOOL : + case MSG_GENERAL_MSG_VIBRATION_BOOL: opt->bVibration = value; break; - case MSG_GENERAL_MSG_PREVIEW_BOOL : + case MSG_GENERAL_MSG_PREVIEW_BOOL: opt->bPreview = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1849,10 +1849,10 @@ int msg_get_general_opt_str(void *general_opt, int field, char *value, int size) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_RINGTONE_PATH_STR : + case MSG_GENERAL_RINGTONE_PATH_STR: strncpy(value, opt->ringtonePath, size); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } @@ -1869,11 +1869,11 @@ int msg_set_general_opt_str(void *general_opt, int field, char *val, int size) MSG_GENERAL_OPT_S *opt = (MSG_GENERAL_OPT_S *)general_opt; switch (field) { - case MSG_GENERAL_RINGTONE_PATH_STR : + case MSG_GENERAL_RINGTONE_PATH_STR: bzero(opt->ringtonePath, sizeof(opt->ringtonePath)); snprintf(opt->ringtonePath, sizeof(opt->ringtonePath), "%s", val); break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1944,10 +1944,10 @@ int msg_get_msgsize_opt_int(void *size_opt, int field, int *value) MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt; switch (field) { - case MSG_MESSAGE_SIZE_INT : + case MSG_MESSAGE_SIZE_INT: *value = msg_opt->nMsgSize; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } @@ -1965,10 +1965,10 @@ int msg_set_msgsize_opt_int(void *size_opt, int field, int value) MSG_MSGSIZE_OPT_S *msg_opt = (MSG_MSGSIZE_OPT_S *)size_opt; switch (field) { - case MSG_MESSAGE_SIZE_INT : + case MSG_MESSAGE_SIZE_INT: msg_opt->nMsgSize = value; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } diff --git a/mapi/msg_storage.cpp b/mapi/msg_storage.cpp index b35b9cc..0a42eff 100755 --- a/mapi/msg_storage.cpp +++ b/mapi/msg_storage.cpp @@ -850,41 +850,41 @@ EXPORT_API int msg_generate_message(msg_handle_t handle, msg_message_type_t msg_ msg_set_mms_struct((msg_struct_t)msg_s, mms_data); msg_release_struct(&mms_data); -/* -* MMS_MESSAGE_DATA_S* mms_data; -* MMS_PAGE_S* page[2]; -* MMS_MEDIA_S* media[5]; -* -* mms_data = msg_mms_create_message(); -* -* msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); -* msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); -* msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); -* -* ------------> 1st Slide Composing -* page[0] = msg_mms_add_page(mms_data, 5440); -* -* media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); -* media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); -* media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); -* media[2]->sMedia.sText.nColor = 0x000000; -* media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; -* media[2]->sMedia.sText.bBold = true; -* -* ------------> 2nd Slide Composing -* page[1] = msg_mms_add_page(mms_data, 4544); -* -* media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); -* media[3]->sMedia.sText.nColor = 0x000000; -* media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; -* media[3]->sMedia.sText.bItalic = true; -* media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); -* strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); -* -* //FIXME msg_mms_set_message_body((msg_message_t)&msgInfo, mms_data); -* -* msg_mms_destroy_message(mms_data); -*/ +#if 0 + MMS_MESSAGE_DATA_S* mms_data; + MMS_PAGE_S* page[2]; + MMS_MEDIA_S* media[5]; + + mms_data = msg_mms_create_message(); + + msg_mms_set_rootlayout(mms_data, 100, 100, 0xffffff); + msg_mms_add_region(mms_data, "Image", 0, 50, 100, 50, 0xffffff); + msg_mms_add_region(mms_data, "Text", 0, 0, 100, 50, 0xffffff); + + /* ------------> 1st Slide Composing */ + page[0] = msg_mms_add_page(mms_data, 5440); + + media[0] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_IMG, "Image", (char*)"/opt/etc/msg-service/P091120_104633.jpg"); + media[1] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_AUDIO, NULL, (char*)"/opt/etc/msg-service/audio.amr"); + media[2] = msg_mms_add_media(page[0], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp0_2.txt"); + media[2]->sMedia.sText.nColor = 0x000000; + media[2]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[2]->sMedia.sText.bBold = true; + + /* ------------> 2nd Slide Composing */ + page[1] = msg_mms_add_page(mms_data, 4544); + + media[3] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_TEXT, "Text", (char*)"/opt/etc/msg-service/Temp1_0.txt"); + media[3]->sMedia.sText.nColor = 0x000000; + media[3]->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; + media[3]->sMedia.sText.bItalic = true; + media[4] = msg_mms_add_media(page[1], MMS_SMIL_MEDIA_VIDEO, "Text", (char*)"/opt/etc/msg-service/V091120_104905.3gp"); + strncpy(media[4]->szAlt, "Video Load Fail", MAX_SMIL_ALT_LEN-1); + + /* FIXME msg_mms_set_message_body((msg_message_t)&msgInfo, mms_data); */ + + msg_mms_destroy_message(mms_data); +#endif } /*err = msg_add_message(handle, (msg_message_t)&msgInfo, &sendingOpt);*/ @@ -920,7 +920,7 @@ EXPORT_API int msg_get_quick_panel_data(msg_handle_t handle, msg_quickpanel_type if (ret != PRIV_MGR_ERROR_SUCCESS) return MSG_ERR_PERMISSION_DENIED; - if (handle == NULL || opq_msg == NULL ) { + if (handle == NULL || opq_msg == NULL) { MSG_FATAL("handle or opq_msg is NULL"); return MSG_ERR_INVALID_PARAMETER; } @@ -996,7 +996,6 @@ EXPORT_API int msg_get_mem_size(msg_handle_t handle, unsigned int* memsize) } return err; - } EXPORT_API int msg_backup_message(msg_handle_t handle, msg_message_backup_type_t type, const char *backup_filepath) @@ -1260,7 +1259,7 @@ EXPORT_API int msg_get_thread(msg_handle_t handle, msg_thread_id_t thread_id, ms if (ret != PRIV_MGR_ERROR_SUCCESS) return MSG_ERR_PERMISSION_DENIED; - if (handle == NULL || msg_thread == NULL ) { + if (handle == NULL || msg_thread == NULL) { MSG_FATAL("handle or msg_thread is NULL"); return MSG_ERR_INVALID_PARAMETER; } @@ -1340,39 +1339,39 @@ static int msg_get_msg_type(int mainType, int subType) { if (mainType == MSG_SMS_TYPE) { switch (subType) { - case MSG_CB_SMS : + case MSG_CB_SMS: return MSG_TYPE_SMS_CB; - case MSG_JAVACB_SMS : + case MSG_JAVACB_SMS: return MSG_TYPE_SMS_JAVACB; - case MSG_WAP_SI_SMS : - case MSG_WAP_SL_SMS : + case MSG_WAP_SI_SMS: + case MSG_WAP_SL_SMS: return MSG_TYPE_SMS_WAPPUSH; - case MSG_MWI_VOICE_SMS : - case MSG_MWI_FAX_SMS : - case MSG_MWI_EMAIL_SMS : - case MSG_MWI_OTHER_SMS : + case MSG_MWI_VOICE_SMS: + case MSG_MWI_FAX_SMS: + case MSG_MWI_EMAIL_SMS: + case MSG_MWI_OTHER_SMS: return MSG_TYPE_SMS_MWI; - case MSG_SYNCML_CP : + case MSG_SYNCML_CP: return MSG_TYPE_SMS_SYNCML; - case MSG_REJECT_SMS : + case MSG_REJECT_SMS: return MSG_TYPE_SMS_REJECT; - case MSG_ETWS_SMS : + case MSG_ETWS_SMS: return MSG_TYPE_SMS_ETWS_PRIMARY; - case MSG_CMAS_PRESIDENTIAL : + case MSG_CMAS_PRESIDENTIAL: return MSG_TYPE_SMS_CMAS_PRESIDENTIAL; - case MSG_CMAS_EXTREME : + case MSG_CMAS_EXTREME: return MSG_TYPE_SMS_CMAS_EXTREME; - case MSG_CMAS_SEVERE : + case MSG_CMAS_SEVERE: return MSG_TYPE_SMS_CMAS_SEVERE; - case MSG_CMAS_AMBER : + case MSG_CMAS_AMBER: return MSG_TYPE_SMS_CMAS_AMBER; - case MSG_CMAS_TEST : + case MSG_CMAS_TEST: return MSG_TYPE_SMS_CMAS_TEST; - case MSG_CMAS_EXERCISE : + case MSG_CMAS_EXERCISE: return MSG_TYPE_SMS_CMAS_EXERCISE; - case MSG_CMAS_OPERATOR_DEFINED : + case MSG_CMAS_OPERATOR_DEFINED: return MSG_TYPE_SMS_CMAS_OPERATOR_DEFINED; - default : + default: return MSG_TYPE_SMS; } } else if (mainType == MSG_MMS_TYPE) { @@ -1547,25 +1546,25 @@ int msg_thread_info_get_int(void *data, int field, int *value) MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data; switch (field) { - case MSG_THREAD_ID_INT : + case MSG_THREAD_ID_INT: *value = pThread->threadId; break; - case MSG_THREAD_MSG_TYPE_INT : + case MSG_THREAD_MSG_TYPE_INT: *value = msg_get_msg_type(pThread->mainType, pThread->subType); break; - case MSG_THREAD_MSG_TIME_INT : + case MSG_THREAD_MSG_TIME_INT: *value = pThread->threadTime; break; - case MSG_THREAD_DIRECTION_INT : + case MSG_THREAD_DIRECTION_INT: *value = pThread->direction; break; - case MSG_THREAD_UNREAD_COUNT_INT : + case MSG_THREAD_UNREAD_COUNT_INT: *value = pThread->unreadCnt; break; - case MSG_THREAD_SMS_COUNT_INT : + case MSG_THREAD_SMS_COUNT_INT: *value = pThread->smsCnt; break; - case MSG_THREAD_MMS_COUNT_INT : + case MSG_THREAD_MMS_COUNT_INT: *value = pThread->mmsCnt; break; default: @@ -1587,46 +1586,46 @@ int msg_conv_info_get_int(void *data, int field, int *value) MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data; switch (field) { - case MSG_CONV_MSG_ID_INT : + case MSG_CONV_MSG_ID_INT: *value = pConv->msgId; break; - case MSG_CONV_MSG_THREAD_ID_INT : + case MSG_CONV_MSG_THREAD_ID_INT: *value = pConv->threadId; break; - case MSG_CONV_MSG_FOLDER_ID_INT : + case MSG_CONV_MSG_FOLDER_ID_INT: *value = pConv->folderId; break; - case MSG_CONV_MSG_TYPE_INT : + case MSG_CONV_MSG_TYPE_INT: *value = msg_get_msg_type(pConv->mainType, pConv->subType); break; - case MSG_CONV_MSG_STORAGE_ID_INT : + case MSG_CONV_MSG_STORAGE_ID_INT: *value = pConv->storageId; break; - case MSG_CONV_MSG_DISPLAY_TIME_INT : + case MSG_CONV_MSG_DISPLAY_TIME_INT: *value = pConv->displayTime; break; - case MSG_CONV_MSG_SCHEDULED_TIME_INT : + case MSG_CONV_MSG_SCHEDULED_TIME_INT: *value = pConv->scheduledTime; break; - case MSG_CONV_MSG_NETWORK_STATUS_INT : + case MSG_CONV_MSG_NETWORK_STATUS_INT: *value = pConv->networkStatus; break; - case MSG_CONV_MSG_DIRECTION_INT : + case MSG_CONV_MSG_DIRECTION_INT: *value = pConv->direction; break; - case MSG_CONV_MSG_ATTACH_COUNT_INT : + case MSG_CONV_MSG_ATTACH_COUNT_INT: *value = pConv->attachCount; break; - case MSG_CONV_MSG_TEXT_SIZE_INT : + case MSG_CONV_MSG_TEXT_SIZE_INT: *value = pConv->textSize; break; - case MSG_CONV_MSG_PAGE_COUNT_INT : + case MSG_CONV_MSG_PAGE_COUNT_INT: *value = pConv->pageCount; break; - case MSG_CONV_MSG_TCS_BC_LEVEL_INT : + case MSG_CONV_MSG_TCS_BC_LEVEL_INT: *value = pConv->tcs_bc_level; break; - case MSG_CONV_MSG_SIM_INDEX_INT : + case MSG_CONV_MSG_SIM_INDEX_INT: *value = pConv->simIndex; break; default: @@ -1753,10 +1752,10 @@ int msg_thread_info_get_str(void *data, int field, char *value, int size) MSG_THREAD_VIEW_S *pThread = (MSG_THREAD_VIEW_S *)data; switch (field) { - case MSG_THREAD_NAME_STR : + case MSG_THREAD_NAME_STR: strncpy(value, pThread->threadName, size); break; - case MSG_THREAD_MSG_DATA_STR : + case MSG_THREAD_MSG_DATA_STR: strncpy(value, pThread->threadData, size); break; default: @@ -1775,26 +1774,26 @@ int msg_conv_info_get_str(void *data, int field, char *value, int size) MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S *)data; switch (field) { - case MSG_CONV_MSG_SUBJECT_STR : + case MSG_CONV_MSG_SUBJECT_STR: strncpy(value, pConv->subject, size); break; - case MSG_CONV_MSG_ATTACH_NAME_STR : + case MSG_CONV_MSG_ATTACH_NAME_STR: strncpy(value, pConv->attachFileName, size); break; - case MSG_CONV_MSG_AUDIO_NAME_STR : + case MSG_CONV_MSG_AUDIO_NAME_STR: strncpy(value, pConv->audioFileName, size); break; - case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR : + case MSG_CONV_MSG_IMAGE_THUMB_PATH_STR: strncpy(value, pConv->imageThumbPath, size); break; - case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR : + case MSG_CONV_MSG_VIDEO_THUMB_PATH_STR: strncpy(value, pConv->videoThumbPath, size); break; - case MSG_CONV_MSG_TEXT_STR : + case MSG_CONV_MSG_TEXT_STR: if (pConv->pText) strncpy(value, pConv->pText, size); break; - case MSG_CONV_MSG_1ST_MEDIA_PATH_STR : + case MSG_CONV_MSG_1ST_MEDIA_PATH_STR: strncpy(value, pConv->firstMediaPath, size); break; default: @@ -1914,13 +1913,13 @@ int msg_thread_info_get_bool(void *data, int field, bool *value) case MSG_THREAD_PROTECTED_BOOL: *value = pthreadInfo->bProtected; break; - case MSG_THREAD_DRAFT_BOOL : + case MSG_THREAD_DRAFT_BOOL: *value = pthreadInfo->bDraft; break; - case MSG_THREAD_SEND_FAILED_BOOL : + case MSG_THREAD_SEND_FAILED_BOOL: *value = pthreadInfo->bSendFailed; break; - case MSG_THREAD_SENDING_BOOL : + case MSG_THREAD_SENDING_BOOL: *value = pthreadInfo->bSending; break; default: @@ -1945,10 +1944,10 @@ int msg_list_condition_get_bool(void *data, int field, bool *value) case MSG_LIST_CONDITION_PROTECTED_BOOL: *value = pCond->bProtected; break; - case MSG_LIST_CONDITION_SCHEDULED_BOOL : + case MSG_LIST_CONDITION_SCHEDULED_BOOL: *value = pCond->bScheduled; break; - case MSG_LIST_CONDITION_AND_OPERATER_BOOL : + case MSG_LIST_CONDITION_AND_OPERATER_BOOL: *value = pCond->bAnd; break; default: @@ -2213,7 +2212,6 @@ int msg_sms_sendopt_get_bool(void *opt_info, int field, bool *value) int msg_syncml_info_set_int(void *syncml_info, int field, int value) { - msg_error_t err = MSG_SUCCESS; if (!syncml_info) @@ -2603,8 +2601,7 @@ int msg_syncml_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct msg_struct_s *pTmp = NULL; switch (field) { - case MSG_SYNCML_INFO_MESSAGE_HND: - { + case MSG_SYNCML_INFO_MESSAGE_HND: { pTmp = (msg_struct_s *)pSync->msg; MSG_MESSAGE_HIDDEN_S *pSrc = (MSG_MESSAGE_HIDDEN_S *)value->data; MSG_MESSAGE_HIDDEN_S *pDst = (MSG_MESSAGE_HIDDEN_S *)pTmp->data; @@ -3102,7 +3099,7 @@ int msg_media_item_get_int(void *data, int field, int *value) case MSG_MEDIA_MESSAGE_ID_INT: *value = pMedia->msg_id; break; - default : + default: ret = MSG_ERR_INVALID_PARAMETER; break; } diff --git a/mapi/msg_svc.cpp b/mapi/msg_svc.cpp index dc1eb24..14b52c5 100755 --- a/mapi/msg_svc.cpp +++ b/mapi/msg_svc.cpp @@ -45,29 +45,25 @@ EXPORT_API msg_struct_t msg_create_struct(int field) msg_struct->data = NULL; switch (field) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: msg_message_create_struct(msg_struct); break; - case MSG_STRUCT_CONV_INFO: - { + case MSG_STRUCT_CONV_INFO: { msg_struct->data = (void *)new MSG_CONVERSATION_VIEW_S; memset(msg_struct->data, 0x00, sizeof(MSG_CONVERSATION_VIEW_S)); break; } - case MSG_STRUCT_FILTER: - { + case MSG_STRUCT_FILTER: { msg_struct->data = (void *)new MSG_FILTER_S; memset(msg_struct->data, 0x00, sizeof(MSG_FILTER_S)); break; } - case MSG_STRUCT_THREAD_INFO: - { + case MSG_STRUCT_THREAD_INFO: { msg_struct->data = (void *)new MSG_THREAD_VIEW_S; memset(msg_struct->data, 0x00, sizeof(MSG_THREAD_VIEW_S)); break; } - case MSG_STRUCT_SENDOPT: - { + case MSG_STRUCT_SENDOPT: { MSG_SENDINGOPT_S *pOpt = (MSG_SENDINGOPT_S *)new MSG_SENDINGOPT_S; memset(pOpt, 0x00, sizeof(MSG_SENDINGOPT_S)); msg_struct->data = pOpt; @@ -87,9 +83,8 @@ EXPORT_API msg_struct_t msg_create_struct(int field) memset(pSms->data, 0x00, sizeof(SMS_SENDINGOPT_S)); break; } - case MSG_STRUCT_SYNCML_INFO: - { - MSG_SYNCML_MESSAGE_S *pSyncML= (MSG_SYNCML_MESSAGE_S *)new MSG_SYNCML_MESSAGE_S; + case MSG_STRUCT_SYNCML_INFO: { + MSG_SYNCML_MESSAGE_S *pSyncML = (MSG_SYNCML_MESSAGE_S *)new MSG_SYNCML_MESSAGE_S; memset(pSyncML, 0x00, sizeof(MSG_SYNCML_MESSAGE_S)); msg_struct->data = pSyncML; @@ -100,20 +95,17 @@ EXPORT_API msg_struct_t msg_create_struct(int field) break; } - case MSG_STRUCT_COUNT_INFO: - { + case MSG_STRUCT_COUNT_INFO: { msg_struct->data = new MSG_COUNT_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_COUNT_INFO_S)); break; } - case MSG_STRUCT_THREAD_COUNT_INFO: - { + case MSG_STRUCT_THREAD_COUNT_INFO: { msg_struct->data = new MSG_THREAD_COUNT_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_THREAD_COUNT_INFO_S)); break; } - case MSG_STRUCT_THREAD_LIST_INDEX: - { + case MSG_STRUCT_THREAD_LIST_INDEX: { MSG_THREAD_LIST_INDEX_INFO_S * pThread = (MSG_THREAD_LIST_INDEX_INFO_S *)new MSG_THREAD_LIST_INDEX_INFO_S; memset(pThread, 0x00, sizeof(MSG_THREAD_LIST_INDEX_INFO_S)); @@ -128,20 +120,17 @@ EXPORT_API msg_struct_t msg_create_struct(int field) break; } - case MSG_STRUCT_SORT_RULE: - { + case MSG_STRUCT_SORT_RULE: { msg_struct->data = new MSG_SORT_RULE_S; memset(msg_struct->data, 0x00, sizeof(MSG_SORT_RULE_S)); break; } - case MSG_STRUCT_FOLDER_INFO: - { + case MSG_STRUCT_FOLDER_INFO: { msg_struct->data = new MSG_FOLDER_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_FOLDER_INFO_S)); break; } - case MSG_STRUCT_MSG_LIST_CONDITION: - { + case MSG_STRUCT_MSG_LIST_CONDITION: { msg_struct->data = new MSG_LIST_CONDITION_S; memset(msg_struct->data, 0x00, sizeof(MSG_LIST_CONDITION_S)); @@ -154,14 +143,12 @@ EXPORT_API msg_struct_t msg_create_struct(int field) break; } - case MSG_STRUCT_REPORT_STATUS_INFO: - { + case MSG_STRUCT_REPORT_STATUS_INFO: { msg_struct->data = new MSG_REPORT_STATUS_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_REPORT_STATUS_INFO_S)); break; } - case MSG_STRUCT_SETTING_SMSC_OPT : - { + case MSG_STRUCT_SETTING_SMSC_OPT: { msg_struct->data = new MSG_SMSC_LIST_HIDDEN_S; memset(msg_struct->data, 0x00, sizeof(MSG_SMSC_LIST_HIDDEN_S)); @@ -188,14 +175,12 @@ EXPORT_API msg_struct_t msg_create_struct(int field) } break; } - case MSG_STRUCT_SETTING_SMSC_INFO : - { + case MSG_STRUCT_SETTING_SMSC_INFO: { msg_struct->data = new MSG_SMSC_DATA_S; memset(msg_struct->data, 0x00, sizeof(MSG_SMSC_DATA_S)); break; } - case MSG_STRUCT_SETTING_CB_OPT : - { + case MSG_STRUCT_SETTING_CB_OPT: { msg_struct->data = new MSG_CBMSG_OPT_HIDDEN_S; memset(msg_struct->data, 0x00, sizeof(MSG_CBMSG_OPT_HIDDEN_S)); @@ -221,70 +206,59 @@ EXPORT_API msg_struct_t msg_create_struct(int field) } break; } - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - { + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: { msg_struct->data = new MSG_CB_CHANNEL_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_CB_CHANNEL_INFO_S)); break; } - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - { + case MSG_STRUCT_SETTING_SMS_SEND_OPT: { msg_struct->data = new MSG_SMS_SENDOPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_SMS_SENDOPT_S)); break; } - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - { + case MSG_STRUCT_SETTING_MMS_SEND_OPT: { msg_struct->data = new MSG_MMS_SENDOPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_MMS_SENDOPT_S)); break; } - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - { + case MSG_STRUCT_SETTING_MMS_RECV_OPT: { msg_struct->data = new MSG_MMS_RECVOPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_MMS_RECVOPT_S)); break; } - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - { + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: { msg_struct->data = new MSG_PUSHMSG_OPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_PUSHMSG_OPT_S)); break; } - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : - { + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: { msg_struct->data = new MSG_VOICEMAIL_OPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_VOICEMAIL_OPT_S)); MSG_VOICEMAIL_OPT_S *pTmp = (MSG_VOICEMAIL_OPT_S *)msg_struct->data; pTmp->simIndex = MSG_SIM_SLOT_ID_1; /* default sim index */ break; } - case MSG_STRUCT_SETTING_GENERAL_OPT : - { + case MSG_STRUCT_SETTING_GENERAL_OPT: { msg_struct->data = new MSG_GENERAL_OPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_GENERAL_OPT_S)); break; } - case MSG_STRUCT_SETTING_MSGSIZE_OPT : - { + case MSG_STRUCT_SETTING_MSGSIZE_OPT: { msg_struct->data = new MSG_MSGSIZE_OPT_S; memset(msg_struct->data, 0x00, sizeof(MSG_MSGSIZE_OPT_S)); break; } - case MSG_STRUCT_SMS_SENDOPT: - { + case MSG_STRUCT_SMS_SENDOPT: { msg_struct->data = new SMS_SENDINGOPT_S; memset(msg_struct->data, 0x00, sizeof(SMS_SENDINGOPT_S)); break; } - case MSG_STRUCT_MMS_SENDOPT: - { + case MSG_STRUCT_MMS_SENDOPT: { msg_struct->data = new MMS_SENDINGOPT_S; memset(msg_struct->data, 0x00, sizeof(MMS_SENDINGOPT_S)); break; } - case MSG_STRUCT_REQUEST_INFO: - { + case MSG_STRUCT_REQUEST_INFO: { MSG_REQUEST_S *pRequest = (MSG_REQUEST_S *)new MSG_REQUEST_S; memset(pRequest, 0x00, sizeof(MSG_REQUEST_S)); msg_struct->data = pRequest; @@ -334,7 +308,7 @@ EXPORT_API msg_struct_t msg_create_struct(int field) msg_struct->data = new MSG_PUSH_EVENT_INFO_S; memset(msg_struct->data, 0x00, sizeof(MSG_PUSH_EVENT_INFO_S)); break; - default : + default: delete msg_struct; return NULL; break; @@ -354,15 +328,13 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) msg_struct_s *msg_struct = (msg_struct_s *)*msg_struct_handle; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : - { + case MSG_STRUCT_MESSAGE_INFO: { msg_message_release(&msg_struct); *msg_struct_handle = NULL; break; } - case MSG_STRUCT_FILTER: - { + case MSG_STRUCT_FILTER: { delete (MSG_FILTER_S*)(msg_struct->data); msg_struct->data = NULL; @@ -370,8 +342,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_CONV_INFO: - { + case MSG_STRUCT_CONV_INFO: { MSG_CONVERSATION_VIEW_S *pConv = (MSG_CONVERSATION_VIEW_S*)(msg_struct->data); if (pConv->multipart_list) { @@ -391,8 +362,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_THREAD_INFO: - { + case MSG_STRUCT_THREAD_INFO: { delete (MSG_THREAD_VIEW_S*)(msg_struct->data); msg_struct->data = NULL; @@ -400,8 +370,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SENDOPT: - { + case MSG_STRUCT_SENDOPT: { MSG_SENDINGOPT_S *pOpt = (MSG_SENDINGOPT_S*)(msg_struct->data); delete (MMS_SENDINGOPT_S *)(((msg_struct_s *)pOpt->mmsSendOpt)->data); ((msg_struct_s *)pOpt->mmsSendOpt)->data = NULL; @@ -421,8 +390,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_SYNCML_INFO: - { + case MSG_STRUCT_SYNCML_INFO: { MSG_SYNCML_MESSAGE_S *pSyncML = (MSG_SYNCML_MESSAGE_S*)(msg_struct->data); msg_struct_s *msg = (msg_struct_s *)pSyncML->msg; msg_message_release(&msg); @@ -434,8 +402,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_COUNT_INFO: - { + case MSG_STRUCT_COUNT_INFO: { delete (MSG_COUNT_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -443,8 +410,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_THREAD_COUNT_INFO: - { + case MSG_STRUCT_THREAD_COUNT_INFO: { delete (MSG_THREAD_COUNT_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -453,8 +419,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_THREAD_LIST_INDEX: - { + case MSG_STRUCT_THREAD_LIST_INDEX: { MSG_THREAD_LIST_INDEX_INFO_S *pThread = (MSG_THREAD_LIST_INDEX_INFO_S*)(msg_struct->data); delete (MSG_ADDRESS_INFO_S *)(((msg_struct_s *)pThread->msgAddrInfo)->data); ((msg_struct_s *)pThread->msgAddrInfo)->data = NULL; @@ -468,8 +433,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_SORT_RULE: - { + case MSG_STRUCT_SORT_RULE: { delete (MSG_SORT_RULE_S*)(msg_struct->data); msg_struct->data = NULL; @@ -478,8 +442,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_FOLDER_INFO: - { + case MSG_STRUCT_FOLDER_INFO: { delete (MSG_FOLDER_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -488,8 +451,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_MSG_LIST_CONDITION: - { + case MSG_STRUCT_MSG_LIST_CONDITION: { MSG_LIST_CONDITION_S *pCond = (MSG_LIST_CONDITION_S*)(msg_struct->data); MSG_SORT_RULE_S *pSortRule = (MSG_SORT_RULE_S *)(((msg_struct_s *)pCond->sortRule)->data); @@ -506,8 +468,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_REPORT_STATUS_INFO: - { + case MSG_STRUCT_REPORT_STATUS_INFO: { delete (MSG_REPORT_STATUS_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -516,8 +477,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_SMS_SENDOPT: - { + case MSG_STRUCT_SMS_SENDOPT: { delete (SMS_SENDINGOPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -526,8 +486,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_MMS_SENDOPT: - { + case MSG_STRUCT_MMS_SENDOPT: { delete (MMS_SENDINGOPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -536,8 +495,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) break; } - case MSG_STRUCT_REQUEST_INFO: - { + case MSG_STRUCT_REQUEST_INFO: { MSG_REQUEST_S *pRequest = (MSG_REQUEST_S*)(msg_struct->data); MSG_SENDINGOPT_S *pSendingOpt = (MSG_SENDINGOPT_S *)(((msg_struct_s *)pRequest->sendOpt)->data); @@ -578,14 +536,12 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) case MSG_STRUCT_MMS_META: case MSG_STRUCT_MMS_SMIL_TEXT: case MSG_STRUCT_MMS_SMIL_AVI: - case MSG_STRUCT_MULTIPART_INFO: - { + case MSG_STRUCT_MULTIPART_INFO: { msg_mms_release_struct(&msg_struct); *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_SMSC_OPT : - { + case MSG_STRUCT_SETTING_SMSC_OPT: { msg_struct_list_s *smsc_list = NULL; msg_struct_s *smsc_info = NULL; MSG_SMSC_LIST_HIDDEN_S *pTmp = NULL; @@ -610,8 +566,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - { + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: { delete (MSG_CB_CHANNEL_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -619,8 +574,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_CB_OPT : - { + case MSG_STRUCT_SETTING_CB_OPT: { msg_struct_list_s *cb_list = NULL; msg_struct_s *cb_info = NULL; MSG_CBMSG_OPT_HIDDEN_S *pTmp = NULL; @@ -645,8 +599,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - { + case MSG_STRUCT_SETTING_SMS_SEND_OPT: { delete (MSG_SMS_SENDOPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -654,8 +607,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - { + case MSG_STRUCT_SETTING_MMS_SEND_OPT: { delete (MSG_MMS_SENDOPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -663,8 +615,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - { + case MSG_STRUCT_SETTING_MMS_RECV_OPT: { delete (MSG_MMS_RECVOPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -672,8 +623,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - { + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: { delete (MSG_PUSHMSG_OPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -681,8 +631,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : - { + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: { delete (MSG_VOICEMAIL_OPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -690,8 +639,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_GENERAL_OPT : - { + case MSG_STRUCT_SETTING_GENERAL_OPT: { delete (MSG_GENERAL_OPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -699,8 +647,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_SETTING_MSGSIZE_OPT : - { + case MSG_STRUCT_SETTING_MSGSIZE_OPT: { delete (MSG_MSGSIZE_OPT_S*)(msg_struct->data); msg_struct->data = NULL; @@ -708,8 +655,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_ADDRESS_INFO : - { + case MSG_STRUCT_ADDRESS_INFO: { delete (MSG_ADDRESS_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -717,8 +663,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_PUSH_CONFIG_INFO: - { + case MSG_STRUCT_PUSH_CONFIG_INFO: { delete (MSG_PUSH_EVENT_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -726,8 +671,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - case MSG_STRUCT_MEDIA_INFO: - { + case MSG_STRUCT_MEDIA_INFO: { delete (MSG_MEDIA_INFO_S*)(msg_struct->data); msg_struct->data = NULL; @@ -735,7 +679,7 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) *msg_struct_handle = NULL; break; } - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -798,58 +742,58 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_get_int_value(msg_struct->data, field, value); break; case MSG_STRUCT_FILTER: err = msg_get_filter_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SYNCML_INFO : + case MSG_STRUCT_SYNCML_INFO: err = msg_syncml_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_COUNT_INFO : + case MSG_STRUCT_COUNT_INFO: err = msg_count_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_COUNT_INFO : + case MSG_STRUCT_THREAD_COUNT_INFO: err = msg_thread_count_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_LIST_INDEX : + case MSG_STRUCT_THREAD_LIST_INDEX: err = msg_thread_index_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SORT_RULE : + case MSG_STRUCT_SORT_RULE: err = msg_sortrule_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_FOLDER_INFO : + case MSG_STRUCT_FOLDER_INFO: err = msg_folder_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_INFO : + case MSG_STRUCT_THREAD_INFO: err = msg_thread_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_CONV_INFO : + case MSG_STRUCT_CONV_INFO: err = msg_conv_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_MSG_LIST_CONDITION : + case MSG_STRUCT_MSG_LIST_CONDITION: err = msg_list_condition_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REPORT_STATUS_INFO : + case MSG_STRUCT_REPORT_STATUS_INFO: err = msg_report_status_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_ADDRESS_INFO : + case MSG_STRUCT_ADDRESS_INFO: err = msg_address_info_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_MMS_SENDOPT : + case MSG_STRUCT_MMS_SENDOPT: err = msg_mms_sendopt_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REJECT_MSG_INFO : + case MSG_STRUCT_REJECT_MSG_INFO: err = msg_reject_message_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REQUEST_INFO : + case MSG_STRUCT_REQUEST_INFO: err = msg_request_get_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SENT_STATUS_INFO : + case MSG_STRUCT_SENT_STATUS_INFO: err = msg_sent_status_get_int((MSG_SENT_STATUS_S *)msg_struct->data, field, value); break; - case MSG_STRUCT_CB_MSG : + case MSG_STRUCT_CB_MSG: err = msg_cb_message_get_int_value(msg_struct->data, field, value); break; case MSG_STRUCT_MMS: @@ -864,23 +808,23 @@ EXPORT_API int msg_get_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_get_int_value(msg_struct, field, value); break; - case MSG_STRUCT_SETTING_SMSC_OPT : - case MSG_STRUCT_SETTING_SMSC_INFO : - case MSG_STRUCT_SETTING_CB_OPT : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - case MSG_STRUCT_SETTING_GENERAL_OPT : - case MSG_STRUCT_SETTING_MSGSIZE_OPT : - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_SMSC_OPT: + case MSG_STRUCT_SETTING_SMSC_INFO: + case MSG_STRUCT_SETTING_CB_OPT: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_SMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_RECV_OPT: + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: + case MSG_STRUCT_SETTING_GENERAL_OPT: + case MSG_STRUCT_SETTING_MSGSIZE_OPT: + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_setting_get_int_value(msg_struct, field, value); break; - case MSG_STRUCT_MEDIA_INFO : + case MSG_STRUCT_MEDIA_INFO: err = msg_media_item_get_int(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -905,33 +849,33 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_get_str_value(msg_struct->data, field, value, size); break; case MSG_STRUCT_FILTER: err = msg_get_filter_info_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_FOLDER_INFO : + case MSG_STRUCT_FOLDER_INFO: err = msg_folder_info_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_THREAD_INFO : + case MSG_STRUCT_THREAD_INFO: err = msg_thread_info_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_CONV_INFO : + case MSG_STRUCT_CONV_INFO: err = msg_conv_info_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_MSG_LIST_CONDITION : + case MSG_STRUCT_MSG_LIST_CONDITION: err = msg_list_condition_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_ADDRESS_INFO : + case MSG_STRUCT_ADDRESS_INFO: err = msg_address_info_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_REJECT_MSG_INFO : + case MSG_STRUCT_REJECT_MSG_INFO: err = msg_reject_message_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_MEDIA_INFO : + case MSG_STRUCT_MEDIA_INFO: err = msg_media_item_get_str(msg_struct->data, field, value, size); break; case MSG_STRUCT_MMS: @@ -946,22 +890,22 @@ EXPORT_API int msg_get_str_value(msg_struct_t msg_struct_handle, int field, char case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_get_str_value(msg_struct, field, value, size); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : - case MSG_STRUCT_SETTING_SMSC_INFO : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: + case MSG_STRUCT_SETTING_SMSC_INFO: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_setting_get_str_value(msg_struct, field, value, size); break; - case MSG_STRUCT_PUSH_CONFIG_INFO : + case MSG_STRUCT_PUSH_CONFIG_INFO: err = msg_push_config_get_str(msg_struct->data, field, value, size); break; case MSG_STRUCT_REPORT_STATUS_INFO: err = msg_report_status_get_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_CB_MSG : + case MSG_STRUCT_CB_MSG: err = msg_cb_message_get_str_value(msg_struct->data, field, value, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -983,13 +927,13 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_FILTER : + case MSG_STRUCT_FILTER: err = msg_get_filter_info_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_get_bool_value(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_INFO : + case MSG_STRUCT_THREAD_INFO: err = msg_thread_info_get_bool(msg_struct->data, field, value); break; case MSG_STRUCT_CONV_INFO: @@ -1021,19 +965,19 @@ EXPORT_API int msg_get_bool_value(msg_struct_t msg_struct_handle, int field, boo case MSG_STRUCT_MMS_SMIL_AVI: err = msg_mms_get_bool_value(msg_struct, field, value); break; - case MSG_STRUCT_SETTING_CB_OPT : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_CB_OPT: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_SMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_RECV_OPT: + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_setting_get_bool_value(msg_struct, field, value); break; case MSG_STRUCT_PUSH_CONFIG_INFO: err = msg_push_config_get_bool(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1055,7 +999,7 @@ EXPORT_API int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_get_struct_hnd(msg_struct->data, field, (void **)value); break; case MSG_STRUCT_SENDOPT: @@ -1076,7 +1020,7 @@ EXPORT_API int msg_get_struct_handle(msg_struct_t msg_struct_handle, int field, case MSG_STRUCT_REQUEST_INFO: err = msg_request_get_struct_handle(msg_struct, field, (void **)value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1098,7 +1042,7 @@ EXPORT_API int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, vo return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_get_list_hnd(msg_struct->data, field, value); break; case MSG_STRUCT_CONV_INFO: @@ -1108,11 +1052,11 @@ EXPORT_API int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, vo case MSG_STRUCT_MMS_PAGE: err = msg_mms_get_list_handle(msg_struct, field, (msg_list_handle_t *)value); break; - case MSG_STRUCT_SETTING_CB_OPT : - case MSG_STRUCT_SETTING_SMSC_OPT : + case MSG_STRUCT_SETTING_CB_OPT: + case MSG_STRUCT_SETTING_SMSC_OPT: err = msg_setting_get_list_handle(msg_struct, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1134,46 +1078,46 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_set_int_value(msg_struct->data, field, value); break; - case MSG_STRUCT_FILTER : + case MSG_STRUCT_FILTER: err = msg_set_filter_info_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SYNCML_INFO : + case MSG_STRUCT_SYNCML_INFO: err = msg_syncml_info_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_COUNT_INFO : + case MSG_STRUCT_COUNT_INFO: err = msg_count_info_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_COUNT_INFO : + case MSG_STRUCT_THREAD_COUNT_INFO: err = msg_thread_count_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_THREAD_LIST_INDEX : + case MSG_STRUCT_THREAD_LIST_INDEX: err = msg_thread_index_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_SORT_RULE : + case MSG_STRUCT_SORT_RULE: err = msg_sortrule_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_FOLDER_INFO : + case MSG_STRUCT_FOLDER_INFO: err = msg_folder_info_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_MSG_LIST_CONDITION : + case MSG_STRUCT_MSG_LIST_CONDITION: err = msg_list_condition_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REPORT_STATUS_INFO : + case MSG_STRUCT_REPORT_STATUS_INFO: err = msg_report_status_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_ADDRESS_INFO : + case MSG_STRUCT_ADDRESS_INFO: err = msg_address_info_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_MMS_SENDOPT : + case MSG_STRUCT_MMS_SENDOPT: err = msg_mms_sendopt_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REJECT_MSG_INFO : + case MSG_STRUCT_REJECT_MSG_INFO: err = msg_reject_message_set_int(msg_struct->data, field, value); break; - case MSG_STRUCT_REQUEST_INFO : + case MSG_STRUCT_REQUEST_INFO: err = msg_request_set_int(msg_struct->data, field, value); break; case MSG_STRUCT_MMS: @@ -1187,20 +1131,20 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int case MSG_STRUCT_MMS_SMIL_AVI: err = msg_mms_set_int_value(msg_struct, field, value); break; - case MSG_STRUCT_SETTING_SMSC_OPT : - case MSG_STRUCT_SETTING_SMSC_INFO : - case MSG_STRUCT_SETTING_CB_OPT : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - case MSG_STRUCT_SETTING_GENERAL_OPT : - case MSG_STRUCT_SETTING_MSGSIZE_OPT : - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_SMSC_OPT: + case MSG_STRUCT_SETTING_SMSC_INFO: + case MSG_STRUCT_SETTING_CB_OPT: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_SMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_RECV_OPT: + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: + case MSG_STRUCT_SETTING_GENERAL_OPT: + case MSG_STRUCT_SETTING_MSGSIZE_OPT: + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_setting_set_int_value(msg_struct, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1225,22 +1169,22 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_set_str_value(msg_struct->data, field, value, size); break; - case MSG_STRUCT_FILTER : + case MSG_STRUCT_FILTER: err = msg_set_filter_info_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_FOLDER_INFO : + case MSG_STRUCT_FOLDER_INFO: err = msg_folder_info_set_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_MSG_LIST_CONDITION : + case MSG_STRUCT_MSG_LIST_CONDITION: err = msg_list_condition_set_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_ADDRESS_INFO : + case MSG_STRUCT_ADDRESS_INFO: err = msg_address_info_set_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_REJECT_MSG_INFO : + case MSG_STRUCT_REJECT_MSG_INFO: err = msg_reject_message_set_str(msg_struct->data, field, value, size); break; case MSG_STRUCT_MMS: @@ -1255,19 +1199,19 @@ EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char case MSG_STRUCT_MULTIPART_INFO: err = msg_mms_set_str_value(msg_struct, field, value, size); break; - case MSG_STRUCT_SETTING_GENERAL_OPT : - case MSG_STRUCT_SETTING_SMSC_INFO : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_VOICE_MSG_OPT : + case MSG_STRUCT_SETTING_GENERAL_OPT: + case MSG_STRUCT_SETTING_SMSC_INFO: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_VOICE_MSG_OPT: err = msg_setting_set_str_value(msg_struct, field, value, size); break; case MSG_STRUCT_PUSH_CONFIG_INFO: err = msg_push_config_set_str(msg_struct->data, field, value, size); break; - case MSG_STRUCT_MEDIA_INFO : + case MSG_STRUCT_MEDIA_INFO: err = msg_media_info_set_str(msg_struct->data, field, value, size); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1289,10 +1233,10 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_FILTER : + case MSG_STRUCT_FILTER: err = msg_set_filter_info_bool(msg_struct->data, field, value); break; - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_set_bool_value(msg_struct->data, field, value); break; case MSG_STRUCT_SENDOPT: @@ -1321,19 +1265,19 @@ EXPORT_API int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, boo case MSG_STRUCT_MMS_SMIL_AVI: err = msg_mms_set_bool_value(msg_struct, field, value); break; - case MSG_STRUCT_SETTING_CB_OPT : - case MSG_STRUCT_SETTING_CB_CHANNEL_INFO : - case MSG_STRUCT_SETTING_SMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_SEND_OPT : - case MSG_STRUCT_SETTING_MMS_RECV_OPT : - case MSG_STRUCT_SETTING_PUSH_MSG_OPT : - case MSG_STRUCT_SETTING_GENERAL_OPT : + case MSG_STRUCT_SETTING_CB_OPT: + case MSG_STRUCT_SETTING_CB_CHANNEL_INFO: + case MSG_STRUCT_SETTING_SMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_SEND_OPT: + case MSG_STRUCT_SETTING_MMS_RECV_OPT: + case MSG_STRUCT_SETTING_PUSH_MSG_OPT: + case MSG_STRUCT_SETTING_GENERAL_OPT: err = msg_setting_set_bool_value(msg_struct, field, value); break; case MSG_STRUCT_PUSH_CONFIG_INFO: err = msg_push_config_set_bool(msg_struct->data, field, value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1355,7 +1299,7 @@ EXPORT_API int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, return MSG_ERR_NULL_POINTER; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO : + case MSG_STRUCT_MESSAGE_INFO: err = msg_message_set_struct_hnd(msg_struct->data, field, (void *)value); break; case MSG_STRUCT_SENDOPT: @@ -1376,7 +1320,7 @@ EXPORT_API int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, case MSG_STRUCT_REQUEST_INFO: err = msg_request_set_struct_handle(msg_struct, field, (msg_struct_s *)value); break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1398,9 +1342,8 @@ EXPORT_API int msg_set_list_handle(msg_struct_t msg_struct_handle, int field, vo return MSG_ERR_NULL_POINTER; #if 0 /* No operations */ - switch (msg_struct->type) - { - default : + switch (msg_struct->type) { + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1419,18 +1362,16 @@ EXPORT_API int msg_list_add_item(msg_struct_t msg_struct_handle, int field, msg_ msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO: - { + case MSG_STRUCT_MESSAGE_INFO: { err = msg_message_list_append(msg_struct_handle, field, item); } break; case MSG_STRUCT_MMS: - case MSG_STRUCT_MMS_PAGE: - { + case MSG_STRUCT_MMS_PAGE: { err = msg_mms_list_append(msg_struct_handle, field, item); } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1467,12 +1408,11 @@ EXPORT_API int msg_list_clear(msg_struct_t msg_struct_handle, int field) msg_struct_s *msg_struct = (msg_struct_s *)msg_struct_handle; switch (msg_struct->type) { - case MSG_STRUCT_MESSAGE_INFO: - { + case MSG_STRUCT_MESSAGE_INFO: { err = msg_message_list_clear(msg_struct_handle, field); } break; - default : + default: err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1532,16 +1472,16 @@ EXPORT_API int msg_util_calculate_text_length(const char* msg_text, msg_encode_t *segment_size = 0; switch (msg_encode_type_to) { - case MSG_ENCODE_GSM7BIT : + case MSG_ENCODE_GSM7BIT: decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &langId, &bAbnormal); break; - case MSG_ENCODE_UCS2 : + case MSG_ENCODE_UCS2: decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (const unsigned char*)msg_text, textSize); break; - case MSG_ENCODE_AUTO : + case MSG_ENCODE_AUTO: decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (const unsigned char*)msg_text, textSize, &encodeType); break; - default : + default: return MSG_ERR_INVALID_PARAMETER; } diff --git a/mapi/msg_transport.cpp b/mapi/msg_transport.cpp index cdc03ee..15b8cac 100755 --- a/mapi/msg_transport.cpp +++ b/mapi/msg_transport.cpp @@ -395,7 +395,7 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ return MSG_ERR_INVALID_PARAMETER; } - msg_struct_s req = {0,}; + msg_struct_s req = {0, }; MSG_REQUEST_S msgReq = {0}; req.type = MSG_STRUCT_REQUEST_INFO; @@ -409,8 +409,8 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ return retVal; } - MSG_MESSAGE_HIDDEN_S msg_info = {0,}; - msg_struct_s msg = {0,}; + MSG_MESSAGE_HIDDEN_S msg_info = {0, }; + msg_struct_s msg = {0, }; msg.type = MSG_STRUCT_MESSAGE_INFO; msg.data = &msg_info; @@ -423,14 +423,14 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ msg_info.simIndex = MSG_SIM_SLOT_ID_1; /* fill the destination number in msgReq */ - MSG_ADDRESS_INFO_S address = {0,}; + MSG_ADDRESS_INFO_S address = {0, }; memset(&address, 0x00, sizeof(MSG_ADDRESS_INFO_S)); address.addressType = MSG_ADDRESS_TYPE_PLMN; address.recipientType = MSG_RECIPIENTS_TYPE_TO; snprintf(address.addressVal, MAX_ADDRESS_VAL_LEN, "%s", phone_num); - msg_struct_list_s addr_list = {0,}; + msg_struct_list_s addr_list = {0, }; addr_list.nCount = 1; addr_list.msg_struct_info = (msg_struct_t *)calloc(1, sizeof(msg_struct_t)); @@ -455,15 +455,15 @@ static int msg_send_single_sms(const char *phone_num, const char *sms_text, msg_ msg_info.pData = (void*)sms_text; /* Send option */ - msg_struct_s sendOpt = {0,}; + msg_struct_s sendOpt = {0, }; MSG_SENDINGOPT_S send_info; memset(&send_info, 0x00, sizeof(MSG_SENDINGOPT_S)); sendOpt.type = MSG_STRUCT_SENDOPT; sendOpt.data = (void *)&send_info; - msg_struct_s smsSendOpt = {0,}; - SMS_SENDINGOPT_INFO_S sms_send_opt = {0,}; + msg_struct_s smsSendOpt = {0, }; + SMS_SENDINGOPT_INFO_S sms_send_opt = {0, }; memset(&sms_send_opt, 0x00, sizeof(SMS_SENDINGOPT_INFO_S)); smsSendOpt.type = MSG_STRUCT_SMS_SENDOPT; @@ -525,7 +525,7 @@ EXPORT_API int msg_sms_send(const char *phone_num_list, const char *sms_text, ms if (retVal != MSG_SUCCESS) return retVal; - for (char* cur_num = strtok_r(trimmed_num,", ", &temp); cur_num ; cur_num = strtok_r(NULL,", ", &temp)) { + for (char* cur_num = strtok_r(trimmed_num, ", ", &temp); cur_num ; cur_num = strtok_r(NULL, ", ", &temp)) { if (strlen(cur_num) > MAX_PHONE_NUMBER_LEN) { MSG_SEC_DEBUG("Phone number is too long [%s], and sending is skipped", cur_num); continue; @@ -729,7 +729,7 @@ EXPORT_API int msg_mms_forward_message(msg_handle_t handle, msg_struct_t req) if (ret != PRIV_MGR_ERROR_SUCCESS) return MSG_ERR_PERMISSION_DENIED; - if (handle == NULL || req == NULL ) { + if (handle == NULL || req == NULL) { MSG_FATAL("handle or req is NULL"); return MSG_ERR_INVALID_PARAMETER; } @@ -887,7 +887,6 @@ int msg_request_get_struct_handle(msg_struct_s *msg_struct, int field, void **va default: err = MSG_ERR_UNKNOWN; break; - } return err; @@ -926,16 +925,14 @@ int msg_request_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struc switch (field) { - case MSG_REQUEST_MESSAGE_HND: - { + case MSG_REQUEST_MESSAGE_HND: { pTmp = (msg_struct_s *)pRequest->msg; MSG_MESSAGE_HIDDEN_S *pSrc = (MSG_MESSAGE_HIDDEN_S *)value->data; MSG_MESSAGE_HIDDEN_S *pDst = (MSG_MESSAGE_HIDDEN_S *)pTmp->data; msg_message_copy_message(pSrc, pDst); break; } - case MSG_REQUEST_SENDOPT_HND: - { + case MSG_REQUEST_SENDOPT_HND: { pTmp = (msg_struct_s *)pRequest->sendOpt; MSG_SENDINGOPT_S *pSrc = (MSG_SENDINGOPT_S *)value->data; MSG_SENDINGOPT_S *pDst = (MSG_SENDINGOPT_S *)pTmp->data; diff --git a/plugin/mms_plugin/MmsPluginAppBase.cpp b/plugin/mms_plugin/MmsPluginAppBase.cpp index 69d9271..7197b5c 100755 --- a/plugin/mms_plugin/MmsPluginAppBase.cpp +++ b/plugin/mms_plugin/MmsPluginAppBase.cpp @@ -62,7 +62,6 @@ void MmsPluginAppBase::makePreviewInfo(msg_message_id_t msgId, bool allow_malwa void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize) { - MMS_PAGE_S *pPage = NULL; MMS_MEDIA_S *pMedia = NULL; @@ -73,17 +72,13 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize) /* Get the text data from the 1st slide. */ if (pMmsMsgData->pageCnt > 0) { - pPage = _MsgMmsGetPage(pMmsMsgData, 0); if (pPage) { - for (int j = 0; j < pPage->mediaCnt; ++j) { - pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { - MimeType mimeType = MIME_UNKNOWN; MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); @@ -99,8 +94,7 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize) } } } else { - /* (P151014-01246) - * Set filepath of the first text/plain attachment to display preview text on notification */ + /* Set filepath of the first text/plain attachment to display preview text on notification */ if (pMmsMsgData->attachlist) { GList *l = pMmsMsgData->attachlist; while (l) { @@ -137,7 +131,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo /* scan malware in raw file */ if (raw_filepath && strlen(raw_filepath) > 0 && MsgAccessFile(raw_filepath, F_OK) == true) { - int tcs_ret = 0; // MmsPluginTcsScanFile(raw_filepath, &bc_level); + int tcs_ret = 0; /* MmsPluginTcsScanFile(raw_filepath, &bc_level); */ if (tcs_ret == 0) { if (bc_level > -1) { MSG_DEBUG("malware exist, level = %d", bc_level); @@ -154,11 +148,9 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo for (int j = 0; j < pPage->mediaCnt; j++) { pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia) { /* IF Vobject type add to Attach in Preview data */ - MimeType mimeType = MIME_UNKNOWN; MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD) { - MSG_DEBUG("Unsupported File [%s] It will be add to attach list", pMedia->szFilePath); ref_attach_count++; @@ -167,7 +159,6 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo attachment_name = pMedia->szFileName; } } - } } } @@ -176,14 +167,12 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo if (pMmsMsg->pageCnt > 0) { - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_PAGE, (char *)"pagecount", pMmsMsg->pageCnt); pPage = _MsgMmsGetPage(pMmsMsg, 0); if (pPage) { for (int j = 0; j < pPage->mediaCnt; j++) { - pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia == NULL) { @@ -198,7 +187,6 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_AUDIO, pMedia->szFileName); } } else { - if (j == 0) { /* First Page, First Media */ MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_1ST_MEDIA, pMedia->szFilePath); } @@ -214,8 +202,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo MSG_SEC_DEBUG("drm type = %d, %s", pMedia->drmType, pMedia->szFilePath); if (pMedia->drmType == MSG_DRM_TYPE_NONE) { - - snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms",msgId); + snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%d.mms", msgId); if ((pszExt = strrchr(pMedia->szFilePath, '.')) != NULL && !strcasecmp(pszExt, ".png")) { snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.png", MSG_THUMBNAIL_PATH, szFileName); @@ -245,7 +232,6 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo int attachCnt = _MsgMmsGetAttachCount(pMmsMsg); if (attachCnt > 0) { - MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0); MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt); @@ -254,13 +240,11 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo if (attachment_name == NULL) { attachment_name = pAttach->szFileName; } - } else { MSG_DEBUG("There is no attachment"); } if (attachCnt + ref_attach_count > 0 && attachment_name) { - MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, attachment_name, attachCnt + ref_attach_count); MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt + ref_attach_count); } diff --git a/plugin/mms_plugin/MmsPluginCodecCommon.cpp b/plugin/mms_plugin/MmsPluginCodecCommon.cpp index 47610e1..13becbf 100755 --- a/plugin/mms_plugin/MmsPluginCodecCommon.cpp +++ b/plugin/mms_plugin/MmsPluginCodecCommon.cpp @@ -211,7 +211,6 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = /* Add by MMSENC v1.2 */ {"Unreachable", 0x07 } - }, /* MmsCodeReadStatus */ @@ -386,7 +385,7 @@ int MmsGetTextType(MmsCode i, char *pValue) for (j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) { if (gMmsField[i][j].szText != NULL) { - if (strcasecmp( gMmsField[i][j].szText, pValue ) == 0) { + if (strcasecmp(gMmsField[i][j].szText, pValue) == 0) { return j; } } @@ -675,26 +674,23 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod char *char_set = NULL; char *l_encoded_text = NULL; - char l_encoding[2] = {0,}; + char l_encoding[2] = {0, }; if (encoded_word == NULL) goto __CATCH; - if ( 6 > strlen(encoded_word)) { + if (6 > strlen(encoded_word)) { goto __CATCH; } start_ptr = encoded_word; - if ( (encoded_word[0] == '=' && encoded_word[1] == '?') /* "=?" */ + if ((encoded_word[0] == '=' && encoded_word[1] == '?') /* "=?" */ && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) /* '?' */ && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL) /* '?' */ - && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) /* "?=" */ - { - + && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) { /* "?=" */ /* extract character set */ if ( q1_ptr - (start_ptr + 2) > 0 ) { - char_set = (char*)calloc(1, q1_ptr - (start_ptr + 2) + 1); if (char_set) { @@ -711,15 +707,12 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod /* extract encode type */ if ((*(q2_ptr - 1) == MSG_CH_BASE64_UPPER) || (*(q2_ptr - 1) == MSG_CH_BASE64_LOWER) - || (*(q1_ptr + 1) == MSG_CH_BASE64_UPPER) || (*(q1_ptr + 1) == MSG_CH_BASE64_LOWER)) - { + || (*(q1_ptr + 1) == MSG_CH_BASE64_UPPER) || (*(q1_ptr + 1) == MSG_CH_BASE64_LOWER)) { l_encoding[0] = MSG_CH_BASE64_UPPER; } else if ((*(q2_ptr-1) == MSG_CH_QPRINT_UPPER) || (*(q2_ptr-1) == MSG_CH_QPRINT_LOWER) - || (*(q1_ptr+1) == MSG_CH_QPRINT_UPPER) || (*(q1_ptr+1) == MSG_CH_QPRINT_LOWER)) - { + || (*(q1_ptr+1) == MSG_CH_QPRINT_UPPER) || (*(q1_ptr+1) == MSG_CH_QPRINT_LOWER)) { /* QPRINT */ l_encoding[0] = MSG_CH_QPRINT_UPPER; - } else { MSG_DEBUG("unknown encoding"); goto __CATCH; @@ -742,7 +735,6 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod *encoding = g_strdup(l_encoding); *encoded_text = l_encoded_text; *encoded_word_size = end_ptr - start_ptr + 2; - } else { MSG_DEBUG("It is not encoded word type"); return -1; @@ -770,7 +762,7 @@ char *MsgDecodeText(const char *pOri) char *encoded_text = NULL; char *decoded_text = NULL; - char *return_string= NULL; + char *return_string = NULL; string result_string; bool b_encoded_word = false; @@ -793,16 +785,13 @@ char *MsgDecodeText(const char *pOri) normal_word_start_ptr = pSrc; while (normal_word_start_ptr < pSrc + total_len) { - encoded_word_start_ptr = strstr(normal_word_start_ptr, MSG_STR_DEC_START); b_encoded_word = false; /* Find encoded word */ - while (b_encoded_word == false && encoded_word_start_ptr != NULL ) { - + while (b_encoded_word == false && encoded_word_start_ptr != NULL) { if (extract_encoded_word_param(encoded_word_start_ptr, &charset, &encoding, &encoded_text, &encoded_word_size) == 0) { - if (charset && encoding && encoded_text && encoded_word_size > 0) { b_encoded_word = true; MSG_DEBUG("charset [%s], encoding [%s], encoded_text [%s], encoded_word_size [%d]", charset, encoding, encoded_text, encoded_word_size); @@ -816,11 +805,9 @@ char *MsgDecodeText(const char *pOri) } encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); /* find next encoded_start_ptr */ - } /* end of while */ if (b_encoded_word) { - /* copy normal text */ if (encoded_word_start_ptr - normal_word_start_ptr > 0) { result_string.append(normal_word_start_ptr, encoded_word_start_ptr - normal_word_start_ptr); @@ -828,13 +815,11 @@ char *MsgDecodeText(const char *pOri) } if (strcasecmp(encoding, "B") == 0) { - MSG_DEBUG("Base64 encoded text [%s][%d]", encoded_text, strlen(encoded_text)); decoded_text = (char *)MsgDecodeBase64((unsigned char *)encoded_text, strlen(encoded_text), (ULONG *)&decoded_len); if (decoded_text && decoded_len > 0) { - char *result_text = NULL; int result_text_len = 0; @@ -859,7 +844,6 @@ char *MsgDecodeText(const char *pOri) MSG_FREE(decoded_text); } else if (strcasecmp(encoding, "Q") == 0) { - char *result_text = NULL; int result_text_len = 0; @@ -868,7 +852,6 @@ char *MsgDecodeText(const char *pOri) decoded_text = (char *)MsgDecodeQuotePrintable((unsigned char *)encoded_text, strlen(encoded_text), (ULONG *)&decoded_len); if (decoded_text && decoded_len > 0) { - MSG_DEBUG("Qprint decoded text [%s][%d], outlen [%d]", decoded_text, strlen(decoded_text), decoded_len); if (MmsPluginTextConvert("UTF-8", charset, decoded_text, decoded_len, &result_text, &result_text_len) == false) { @@ -906,7 +889,6 @@ char *MsgDecodeText(const char *pOri) break; } - } /* end of while */ if (result_string.length() > 0) { @@ -1189,7 +1171,6 @@ const char *MmsDebugGetMimeType(MimeType mimeType) case MIME_TEXT_X_VTODO: return "MIME_TEXT_X_VTODO"; - case MIME_VIDEO_MPEG4: return "MIME_VIDEO_MPEG4"; case MIME_VIDEO_MP4: @@ -1667,7 +1648,7 @@ bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib) MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus; MmsMsgMultiStatus *pCurStatus = NULL; - while (pMultiStatus != NULL ) { + while (pMultiStatus != NULL) { pCurStatus = pMultiStatus; pMultiStatus = pMultiStatus->pNext; @@ -1690,7 +1671,7 @@ bool MmsReleaseMsgBody(MsgBody *pBody, int type) MSG_BEGIN(); if (pBody == NULL) { - MSG_DEBUG("pBody == NULL \n" ); + MSG_DEBUG("pBody == NULL \n"); MSG_END(); return false; @@ -1803,8 +1784,7 @@ bool MmsIsTextType(int type) || type == MIME_TEXT_VND_WAP_WML || type == MIME_TEXT_X_VNOTE || type == MIME_APPLICATION_SMIL - || type == MIME_TEXT_X_IMELODY) - { + || type == MIME_TEXT_X_IMELODY) { return true; } else { return false; @@ -1832,8 +1812,7 @@ bool MmsIsVitemContent(int type, char *pszName) case MIME_TEXT_X_VCALENDAR: case MIME_TEXT_X_VNOTE: /* vnt */ case MIME_TEXT_X_VTODO: - case MIME_TEXT_PLAIN: /* vbm - It SHOULD be distinguished from a normal text file. */ - { + case MIME_TEXT_PLAIN: { /* vbm - It SHOULD be distinguished from a normal text file. */ char *pszExt = NULL; if (!pszName) diff --git a/plugin/mms_plugin/MmsPluginComposer.cpp b/plugin/mms_plugin/MmsPluginComposer.cpp index 555b8ef..db4b2af 100755 --- a/plugin/mms_plugin/MmsPluginComposer.cpp +++ b/plugin/mms_plugin/MmsPluginComposer.cpp @@ -51,14 +51,12 @@ MmsPluginComposer *MmsPluginComposer::instance() return MmsPluginComposer::pInstance; } -MmsPluginComposer::MmsPluginComposer(){} -MmsPluginComposer::~MmsPluginComposer(){} +MmsPluginComposer::MmsPluginComposer() {} +MmsPluginComposer::~MmsPluginComposer() {} void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_DATA_S *pMmsData) { - if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) { - if (pMmsData->header == NULL) { /* send req from user */ pMmsData->header = MsgMmsCreateHeader(); } @@ -71,7 +69,6 @@ void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDING int len = g_list_length(pMmsData->multipartlist); for (int i = 0; i < len; i++) { - MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMmsData->multipartlist, i); if (multipart) { @@ -102,14 +99,12 @@ MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) /* Calculate allocated buffer size */ for (int i = 0; i < nAddressCnt; ++i) { - MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); if (pMsgInfo->addressList[i].recipientType == MSG_RECIPIENTS_TYPE_UNKNOWN) pMsgInfo->addressList[i].recipientType = MSG_RECIPIENTS_TYPE_TO; if (pMsgInfo->addressList[i].recipientType == recipientType) { - MMS_ADDRESS_DATA_S * pAddressData = NULL; if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_PLMN) { pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_PLMN, pMsgInfo->addressList[i].addressVal); diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp index 80039b5..53e9987 100755 --- a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp +++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp @@ -206,7 +206,6 @@ void __connection_profile_state_changed_cb(connection_profile_state_e state, voi MmsPluginCmAgent *cmAgent = MmsPluginCmAgent::instance(); cmAgent->connection_profile_state_changed_cb(state, user_data); - } static gboolean __connection_create(void *pVoid) @@ -223,7 +222,6 @@ static gboolean __connection_create(void *pVoid) int err = connection_create(&g_connection); if (CONNECTION_ERROR_NONE == err) { - connection_cellular_state_e cellular_state; connection_type_e net_state; @@ -233,7 +231,6 @@ static gboolean __connection_create(void *pVoid) if (cellular_state == CONNECTION_CELLULAR_STATE_AVAILABLE || cellular_state == CONNECTION_CELLULAR_STATE_CONNECTED) { - MSG_INFO("Client registration success [%p], cellular_state [%d], net_state [%d]", g_connection, cellular_state, net_state); err = connection_set_type_changed_cb(g_connection, __connection_type_changed_cb, NULL); @@ -244,12 +241,10 @@ static gboolean __connection_create(void *pVoid) ret = true; } else { - MSG_INFO("Client registration Failed, cellular state [%d], net_state [%d]", cellular_state, net_state); connection_destroy(g_connection); g_connection = NULL; } - } else { MSG_WARN("Client registration failed %d", err); } @@ -305,15 +300,12 @@ static gboolean __connection_profile_open(void *pVoid) MSG_ERR("connection_get_default_cellular_service_profile Failed!! [%d]", err); netOpenResult = MSG_CM_ERR_UNKNOWN; } else { - err = connection_profile_set_state_changed_cb(g_profile, __connection_profile_state_changed_cb, g_profile); if (connection_open_profile(g_connection, g_profile, __connection_profile_opened_cb, NULL) != CONNECTION_ERROR_NONE) { MSG_ERR("Connection open Failed!!"); netOpenResult = MSG_CM_ERR_UNKNOWN; } - - } if (ret_val) { @@ -481,7 +473,7 @@ bool MmsPluginCmAgent::open() __ERR_RETURN: context_invoke(__connection_profile_close, NULL); - context_invoke( __connection_destroy, NULL); + context_invoke(__connection_destroy, NULL); unlock(); MSG_END(); return isCmOpened; @@ -550,14 +542,12 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul int err = CONNECTION_ERROR_NONE; if (result == CONNECTION_ERROR_NONE || result == CONNECTION_ERROR_ALREADY_EXISTS) { - err = connection_get_cellular_state(g_connection, &state); MSG_INFO("connection_get_cellular_state ret [%d], state [%d]", err, state); err = connection_get_default_cellular_service_profile(g_connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); if (err != CONNECTION_ERROR_NONE || profile == NULL) { - MSG_ERR("Failed connection_get_default_cellular_service_profile. err [%d], profile [%p]", err, profile); goto __SIGNAL_RETURN; } @@ -567,7 +557,6 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul MSG_DEBUG("profile state [%d]", profile_state); if (profile_state == CONNECTION_PROFILE_STATE_CONNECTED && waitProfileOpen == true) { - __connection_profile_print(profile); MSG_FREE(this->home_url); @@ -597,12 +586,10 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul } else { goto __NO_SIGNAL_RETURN; /* Just open success */ } - } else { MSG_ERR("connection open profile Failed!! [%d]", result); isCmOpened = false; goto __SIGNAL_RETURN; - } __NO_SIGNAL_RETURN: /* Just Open */ @@ -659,12 +646,11 @@ void MmsPluginCmAgent::connection_profile_state_changed_cb(connection_profile_st /* Should get profile to get latest profile info*/ err = connection_get_default_cellular_service_profile(g_connection, CONNECTION_CELLULAR_SERVICE_TYPE_MMS, &profile); if (err != CONNECTION_ERROR_NONE || profile == NULL) { - MSG_ERR("Failed connection_get_default_cellular_service_profile. err [%d], profile [%p]", err, profile); goto __SIGNAL_RETURN; } - if (state == CONNECTION_PROFILE_STATE_CONNECTED ) { + if (state == CONNECTION_PROFILE_STATE_CONNECTED) { __connection_profile_print(profile); MSG_FREE(this->home_url); @@ -691,7 +677,7 @@ void MmsPluginCmAgent::connection_profile_state_changed_cb(connection_profile_st goto __SIGNAL_RETURN; } -__NO_SIGNAL_RETURN://Default +__NO_SIGNAL_RETURN: /* Default */ unlock(); return; diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index 785b85f..02f3a03 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -254,7 +254,6 @@ void MmsReleaseHeader(MmsHeader *mms) mmsHeader.pTo = NULL; mmsHeader.pCc = NULL; mmsHeader.pBcc = NULL; - } static void __MmsCleanDecodeBuff(void) @@ -464,7 +463,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_SEC_INFO("Message-ID =[%s]", mmsHeader.szMsgID); if (strlen(mmsHeader.szMsgID) > 2) - __MsgMIMERemoveQuote (mmsHeader.szMsgID); + __MsgMIMERemoveQuote(mmsHeader.szMsgID); break; @@ -673,7 +672,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) mmsHeader.deliveryTime.type = MMS_TIMETYPE_ABSOLUTE; if (valueLength > 0) { - if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, totalLength) == false) { + if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, totalLength) == false) { MSG_DEBUG("invalid MMS_CODE_DELIVERYTIME"); goto __CATCH; } @@ -819,7 +818,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) MSG_DEBUG("msgStatus GetOneByte fail"); goto __CATCH; } - mmsHeader.hideAddress= (MmsSenderVisible)!(MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F))); + mmsHeader.hideAddress = (MmsSenderVisible)!(MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F))); MSG_SEC_INFO("X-Mms-Sender-Visibility = [%d]", mmsHeader.hideAddress); break; @@ -993,7 +992,6 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) break; default: { - /* * Application-header = Token-text Application-specific-value * Token-text = Token End-of-string @@ -1035,10 +1033,8 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) offset = __MmsGetDecodeOffset(); if (offset >= totalLength) goto __RETURN; - } /* while */ - __RETURN: if (mmsHeader.pTo == NULL && pLastTo) { @@ -1352,16 +1348,16 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value } else if (strcasecmp(szTypeString, "Application-ID") == 0) { pMsgType->param.szApplicationID = (char*) calloc(1, textLength + 1); if (pMsgType->param.szApplicationID) { - memset(pMsgType->param.szApplicationID, 0, textLength + 1); + memset(pMsgType->param.szApplicationID, 0, textLength + 1); strncpy(pMsgType->param.szApplicationID, szTypeValue, textLength); - MSG_SEC_DEBUG("Application-ID:%s",pMsgType->param.szApplicationID); + MSG_SEC_DEBUG("Application-ID:%s", pMsgType->param.szApplicationID); } - } else if (strcasecmp(szTypeString,"Reply-To-Application-ID") == 0) { - pMsgType->param.szReplyToApplicationID = (char*) calloc(1, textLength + 1); + } else if (strcasecmp(szTypeString, "Reply-To-Application-ID") == 0) { + pMsgType->param.szReplyToApplicationID = (char*)calloc(1, textLength + 1); if (pMsgType->param.szReplyToApplicationID) { memset(pMsgType->param.szReplyToApplicationID, 0, textLength + 1); strncpy(pMsgType->param.szReplyToApplicationID, szTypeValue, textLength); - MSG_SEC_DEBUG("ReplyToApplication-ID:%s",pMsgType->param.szReplyToApplicationID); + MSG_SEC_DEBUG("ReplyToApplication-ID:%s", pMsgType->param.szReplyToApplicationID); } #endif } @@ -1460,7 +1456,6 @@ static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int tota szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); if (szTypeString && (strchr(szTypeString, ';')) != NULL) { - MSG_SEC_DEBUG("Constrained-media : Extension-Media : Content Type with delimiter = [%s]", szTypeString); pszTemp = __MsgGetStringUntilDelimiter(szTypeString, ';'); @@ -1580,8 +1575,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head switch (fieldCode) { case 0x0E: /* Content-Location */ - case 0x04: /* Content-Location */ - { + case 0x04: { /* Content-Location */ pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1); if (pLatinBuff == NULL) goto __CATCH; @@ -1608,8 +1602,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head } break; - case 0x40: /* Content-ID */ - { + case 0x40: { /* Content-ID */ char szContentID[MMS_CONTENT_ID_LEN + 1] = {0, }; pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1); @@ -1657,7 +1650,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (length > 0) { if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) goto __RETURN; - } if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { @@ -1687,7 +1679,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, valueLength) == false) goto __RETURN; } else { - gCurMmsDecodeBuffPos--; valueLength++; @@ -1711,21 +1702,18 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head valueLength -= textLength; - if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) - { + if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) { MSG_DEBUG("Disposition parameter fail"); goto __CATCH; } if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, valueLength) == false) goto __RETURN; - } break; case 0x0B: /* Content-Encoding */ - if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { MSG_DEBUG("Disposition value GetOneByte fail"); goto __CATCH; @@ -1737,7 +1725,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head break; case 0x0C: /* Content-Language */ - if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == true) { if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, tmpIntLen) == false) goto __RETURN; @@ -1761,11 +1748,9 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (cTemp) free(cTemp); } - break; case 0x0D: /* Content-Length */ - if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == false) { MSG_DEBUG("__MmsBinaryDecodeInteger fail..."); goto __CATCH; @@ -1777,7 +1762,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head break; case 0x1C: /* Location */ - pLatinBuff = (char *)calloc(1, MMS_LOCATION_URL_LEN + 1); if (pLatinBuff == NULL) goto __CATCH; @@ -1805,7 +1789,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head break; case 0x30: /* X-Wap-Content-URI skip this value */ - MSG_DEBUG("X-Wap-Content-URI header."); pLatinBuff = (char *)calloc(1, MMS_TEXT_LEN); if (pLatinBuff == NULL) @@ -1829,9 +1812,8 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head break; - case 0x01: /* Accept-charset */ + case 0x01: { /* Accept-charset */ /* if (NvGetInt(NV_SI_ADM_GCF_STATE) == 1) */ - { /* WAP-230-WSP-200010705-a.pdf 8.4.2.8 Accept charset field The following rules are used to encode accept character set values. @@ -1853,7 +1835,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (length > 0) { if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false) goto __RETURN; - } if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&charset, &charSetLen, totalLength) == false) { @@ -1872,9 +1853,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head } default: - /* Other Content-xxx headers : Have valueLength */ - MSG_WARN("unknown Value = 0x%x\n", oneByte); length = __MmsDecodeValueLength(pFile, &valueLength, totalLength); @@ -1952,22 +1931,19 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head pMsgType->encoding = MmsGetTextType(MmsCodeContentTransferEncoding, pValue); break; - case MMS_BODYHDR_CONTENTID: /* Content-ID */ - { + case MMS_BODYHDR_CONTENTID: { /* Content-ID */ char szContentID[MMS_CONTENT_ID_LEN + 1]; pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1); - if (pLatinBuff == NULL) - { + if (pLatinBuff == NULL) { goto __CATCH; } - __MsgMIMERemoveQuote (pValue); + __MsgMIMERemoveQuote(pValue); strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN); length = strlen(pLatinBuff); - if (__MsgLatin2UTF ((unsigned char*)szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) - { + if (__MsgLatin2UTF((unsigned char*)szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) { MSG_DEBUG("MsgLatin2UTF fail"); goto __CATCH; } @@ -1987,7 +1963,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN); length = strlen(pLatinBuff); - if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) { + if (__MsgLatin2UTF((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) { MSG_DEBUG("MsgLatin2UTF fail"); goto __CATCH; } @@ -2023,7 +1999,6 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false) goto __RETURN; - } } /* while */ @@ -2235,7 +2210,6 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p nEntries--; MmsPrintMulitpart(pMultipart, index++); - } pMsgBody->size = totalLength - pMsgBody->offset; @@ -2346,7 +2320,6 @@ static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pM case MIME_MULTIPART_MIXED: case MIME_MULTIPART_RELATED: case MIME_MULTIPART_ALTERNATIVE: - MSG_DEBUG("Multipart"); if (__MmsBinaryDecodeMultipart(pFile, szFilePath, pMsgType, pMsgBody, totalLength) == false) { MSG_DEBUG("MmsBinaryDecodeMultipart is fail"); @@ -2397,8 +2370,7 @@ bool __MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength) { int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos; - if (pFile == NULL || pOneByte == NULL) - { + if (pFile == NULL || pOneByte == NULL) { MSG_DEBUG("invalid file or buffer"); goto __CATCH; } @@ -2528,7 +2500,7 @@ static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLeng if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) goto __CATCH; - if (oneByte > 0x7f) { + if (oneByte > 0x7f) { iBuff[count++] = oneByte; } else { iBuff[count++] = oneByte; @@ -2575,8 +2547,7 @@ static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int t if (length > 4) length = 4; - if (length == 1) - { + if (length == 1) { if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) { MSG_DEBUG("_MmsBinaryDecodeGetOneByte fail"); return oneByte; @@ -2654,8 +2625,7 @@ static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen return false; } - if (oneByte < 0x1F) /* long integer : WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.86) */ - { + if (oneByte < 0x1F) { /* long integer : WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.86) */ pData = (char *)calloc(1, oneByte + 1); if (pData == NULL) { MSG_DEBUG("pData calloc fail"); @@ -2684,7 +2654,7 @@ static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen *pInteger = returner.integer; *pIntLen = oneByte + 1; - } else if (oneByte >= 0x80) { + } else if (oneByte >= 0x80) { /* short integer : WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.86) */ *pInteger = oneByte & 0x7f; *pIntLen = 1; @@ -2742,7 +2712,6 @@ static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLe if (0x00 < oneByte && oneByte < 0x1F) { /* short-length */ - *pValueLength = oneByte; length = 1; } else if (oneByte == 0x1F) { @@ -2753,7 +2722,7 @@ static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLe MSG_DEBUG(" __MmsBinaryDecodeUintvar fail.."); goto __CATCH; } - length ++; /* + length-quote */ + length++; /* + length-quote */ *pValueLength = uintvar; } else { MSG_DEBUG("not a value length type data"); @@ -2800,7 +2769,6 @@ static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalL if (0x00 < oneByte && oneByte < 0x1F) { /* short-length */ - *pValueLength = oneByte; length = 1; } else if (oneByte == 0x1F) { @@ -2811,7 +2779,7 @@ static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalL MSG_DEBUG("__MmsBinaryDecodeUintvar fail.."); goto __CATCH; } - length ++; /* + length-quote */ + length++; /* + length-quote */ *pValueLength = uintvar; } else { MSG_DEBUG("there is not length-quote, consider it as short length."); @@ -3178,7 +3146,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength) if (__MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false) goto __CATCH; - if (szBuff == NULL) { + if (szBuff == NULL) { szBuff = (char *)calloc(1, gMmsDecodeBufLen + 1); } else { szTempPtr = (char *)realloc(szBuff, curLen + gMmsDecodeBufLen + 1); @@ -3228,7 +3196,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength) length = strlen(gpCurMmsDecodeBuff) + 1; } /* while */ - if (length > 0) { + if (length > 0) { pData = (char *)calloc(1, length); if (pData == NULL) { goto __CATCH; @@ -3420,38 +3388,35 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen strncpy(szBuff, pData, bufLen - 1); } - { /* temp brace */ + nTemp = strlen(szBuff); - nTemp = strlen(szBuff); + const char *pToCharSet = "UTF-8"; - const char *pToCharSet = "UTF-8"; + UINT16 charset_code = MmsGetBinaryValue(MmsCodeCharSet, charSet); - UINT16 charset_code = MmsGetBinaryValue(MmsCodeCharSet, charSet); - - const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code); - if (pFromCharSet == NULL || !strcmp(pFromCharSet, pToCharSet)) { - if (pData) { - free(pData); - pData = NULL; - } - return true; + const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code); + if (pFromCharSet == NULL || !strcmp(pFromCharSet, pToCharSet)) { + if (pData) { + free(pData); + pData = NULL; } + return true; + } - char *pDest = NULL; - int destLen = 0; + char *pDest = NULL; + int destLen = 0; - if (MmsPluginTextConvert(pToCharSet, pFromCharSet, szBuff, nTemp, &pDest, &destLen) == false) { - MSG_DEBUG("MmsPluginTextConvert Fail"); + if (MmsPluginTextConvert(pToCharSet, pFromCharSet, szBuff, nTemp, &pDest, &destLen) == false) { + MSG_DEBUG("MmsPluginTextConvert Fail"); - } else { - memset(szBuff, 0x00, bufLen); - snprintf(szBuff, destLen+1, "%s", pDest); - } + } else { + memset(szBuff, 0x00, bufLen); + snprintf(szBuff, destLen+1, "%s", pDest); + } - if (pDest) { - free(pDest); - pDest = NULL; - } + if (pDest) { + free(pDest); + pDest = NULL; } break; } @@ -3627,7 +3592,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot char *pTmpBuff = NULL; - memset (szBuff, 0, bufLen); + memset(szBuff, 0, bufLen); textLength = 0; pLatinBuff = __MmsBinaryDecodeText2(pFile, totalLength, &textLength); @@ -3662,7 +3627,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot goto __CATCH; } - if (__MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pLatinBuff, length) < 0) { + if (__MsgLatin2UTF((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pLatinBuff, length) < 0) { MSG_DEBUG("MsgLatin2UTF fail"); goto __CATCH; } @@ -3671,7 +3636,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot } else { pTmpBuff = MsgDecodeText(pLatinBuff); pUTF8Buff = pTmpBuff; - free (pLatinBuff); + free(pLatinBuff); pLatinBuff = NULL; } } @@ -3687,8 +3652,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot int nameLength = 0; nameLength = (length < bufLen) ? (length - strlen(pExt)) : (bufLen - strlen(pExt)); strncpy(szBuff, pUTF8Buff, nameLength); - g_strlcat(szBuff, pExt,(gsize)bufLen); - + g_strlcat(szBuff, pExt, (gsize)bufLen); } else { strncpy(szBuff, pUTF8Buff, bufLen - 1); } @@ -3780,7 +3744,6 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody)); { /* attribute convert mmsHeader -> mmsAttribute */ - pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type; pMsg->mmsAttrib.date = mmsHeader.date; @@ -3832,7 +3795,6 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe nRead = MsgReadFile(pMsg->msgBody.pPresentationBody->body.pText, sizeof(char), pMsg->msgBody.pPresentationBody->size, pFile); if (nRead == 0) goto __CATCH; - } MsgCloseFile(pFile); @@ -3878,7 +3840,6 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe } while (pMultipart) { - if (__MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody, (char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, bSavePartsAsTempFiles) == false) goto __CATCH; @@ -3886,12 +3847,11 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe MmsPrintMulitpart(pMultipart, partIndex); pMultipart = pMultipart->pNext; - partIndex ++; + partIndex++; } } else { /* single part */ if (pMsg->nPartCount > 0) { - if (bSavePartsAsTempFiles) { if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { if (errno == EEXIST) { @@ -3961,7 +3921,7 @@ static bool __MsgCheckFileNameHasInvalidChar(char *szName) strLen = strlen(szName); - for (i=0; i bcharsnospace */ - - memset (pType->param.szBoundary, 0, MSG_BOUNDARY_LEN + 1); + memset(pType->param.szBoundary, 0, MSG_BOUNDARY_LEN + 1); strncpy(pType->param.szBoundary, pDec, MSG_BOUNDARY_LEN); MSG_SEC_INFO("szBoundary = [%s]", pType->param.szBoundary); break; @@ -4139,8 +4097,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; case MSG_PARAM_NAME: - - memset (pType->param.szName, 0, MSG_LOCALE_FILENAME_LEN_MAX + 1); + memset(pType->param.szName, 0, MSG_LOCALE_FILENAME_LEN_MAX + 1); pUTF8Buff = __MsgConvertLatin2UTF8FileName(pDec); @@ -4180,8 +4137,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; case MSG_PARAM_FILENAME: - - memset (pType->param.szFileName, 0, MSG_FILENAME_LEN_MAX+1); + memset(pType->param.szFileName, 0, MSG_FILENAME_LEN_MAX+1); pUTF8Buff = __MsgConvertLatin2UTF8FileName(pDec); @@ -4221,19 +4177,15 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; case MSG_PARAM_TYPE: - /* type/subtype of root. Only if content-type is multipart/related */ - pType->param.type = MimeGetMimeIntFromMimeString(pDec); MSG_SEC_INFO("type = %d", pType->param.type); break; case MSG_PARAM_START: - /* Content-id. Only if content-type is multipart/related */ - - memset (pType->param.szStart, 0, MSG_MSG_ID_LEN + 1); + memset(pType->param.szStart, 0, MSG_MSG_ID_LEN + 1); strncpy(pType->param.szStart, pDec, MSG_MSG_ID_LEN); MSG_SEC_INFO("szStart = %s", pType->param.szStart); @@ -4241,10 +4193,8 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; case MSG_PARAM_START_INFO: - /* Only if content-type is multipart/related */ - - memset (pType->param.szStartInfo, 0, MSG_MSG_ID_LEN + 1); + memset(pType->param.szStartInfo, 0, MSG_MSG_ID_LEN + 1); strncpy(pType->param.szStartInfo, pDec, MSG_MSG_ID_LEN); MSG_SEC_INFO("szStartInfo = %s", pType->param.szStartInfo); @@ -4252,9 +4202,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; case MSG_PARAM_REPORT_TYPE: - /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */ - if (strcasecmp(pDec, "delivery-status") == 0) { pType->param.reportType = MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS; } else { @@ -4265,7 +4213,6 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc) break; default: - MSG_DEBUG("Unknown paremeter (%s)", pDec); break; } @@ -4284,15 +4231,14 @@ static char *__MsgSkipWS(char *s) while (true) { if ((*s == MSG_CH_CR) || (*s == MSG_CH_LF) || (*s == MSG_CH_SP) || (*s == MSG_CH_TAB)) { ++s; - } else if ((*s != '(') || (__MsgSkipComment(s,(long)NULL)==NULL)) { + } else if ((*s != '(') || (__MsgSkipComment(s, (long)NULL) == NULL)) { return s; } } } -static char *__MsgSkipComment (char *s,long trim) +static char *__MsgSkipComment(char *s, long trim) { - char *ret; char *s1 = s; char *t = NULL; @@ -4305,7 +4251,7 @@ static char *__MsgSkipComment (char *s,long trim) do { switch (*s1) { case '(': - if (!__MsgSkipComment (s1,(long)NULL)) + if (!__MsgSkipComment(s1, (long)NULL)) goto __NULL_RETURN; t = --s1; break; @@ -4360,7 +4306,7 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc) goto __CATCH; } - if (__MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pSrc, length) < 0) { + if (__MsgLatin2UTF((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pSrc, length) < 0) { MSG_DEBUG("MsgLatin2UTF fail"); goto __CATCH; } @@ -4403,7 +4349,7 @@ static bool __MsgChangeSpace(char *pOrg, char **ppNew) { char *pNew = NULL; int cLen = 0; - int cIndex =0; + int cIndex = 0; int index = 0; if (pOrg == NULL) @@ -4417,7 +4363,7 @@ static bool __MsgChangeSpace(char *pOrg, char **ppNew) memset(pNew, 0, cLen + 1); - for (cIndex=0; cIndexpBody(1) is NULL"); break; @@ -4774,7 +4712,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) } if (pSelectedPart) { - MmsReleaseMsgDRMInfo(&pSelectedPart->type.drmInfo); free(pSelectedPart->pBody); @@ -4907,7 +4844,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) pTmpMultipart = pRemoveList; while (pTmpMultipart) { - MmsReleaseMsgDRMInfo(&pTmpMultipart->type.drmInfo); MmsReleaseMsgBody(pTmpMultipart->pBody, pTmpMultipart->type.type); @@ -4924,7 +4860,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) } if (pSelectedPart != NULL) { - if (pSelectedPart->pBody != NULL) memcpy(pPartBody, pSelectedPart->pBody, sizeof(MsgBody)); @@ -4949,7 +4884,6 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody) __CATCH: return false; - } char *MsgResolveContentURI(char *szSrc) @@ -5075,14 +5009,14 @@ static char __MsgConvertHexValue(char *pSrc) int cIndex = 0; int cLen = 0; char ResultChar; - unsigned char uCh[2] = {0,}; + unsigned char uCh[2] = {0, }; cLen = strlen(pSrc); for (cIndex = 0; cIndex < cLen ; cIndex += 2) { uCh[0] = __MsgConvertCharToInt(pSrc[cIndex]); uCh[1] = __MsgConvertCharToInt(pSrc[cIndex+1]); - ch = (int)uCh[0]<<4|uCh[1]; + ch = (int)uCh[0] << 4 | uCh[1]; } ResultChar = (char)ch; @@ -5092,11 +5026,11 @@ static char __MsgConvertHexValue(char *pSrc) static int __MsgConvertCharToInt(char ch) { - if (ch>='0' && ch<='9') { + if (ch >= '0' && ch <= '9') { return ch - '0'; - } else if (ch>='a'&& ch <='f') { + } else if (ch >= 'a' && ch <= 'f') { return ch -'a'+10; - } else if (ch>='A'&& ch <='F') { + } else if (ch >= 'A' && ch <= 'F') { return ch -'A'+10; } else { return 0; @@ -5122,7 +5056,6 @@ static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2) } if (pMsgType1->szContentID[0] != '\0') { - length = strlen(pMsgType1->szContentID); if (pMsgType1->szContentID[0] == '<' && pMsgType1->szContentID[length - 1] == '>') { char szTempString[MSG_MSG_ID_LEN + 1]; @@ -5262,8 +5195,7 @@ static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szS while ((nChar > 0) && (*szSrc != '\0')) { if (0x01 <= *szSrc && *szSrc <= 0x7F) { /* check outbuffer's room for this UTF8 character */ - - outBufSize --; + outBufSize--; if (outBufSize < 0) goto __RETURN; @@ -5322,7 +5254,7 @@ bool MmsAddrUtilRemovePlmnString(char *pszAddr) strLen = strlen(pszAddr); - pszAddrCopy = (char*)calloc(1,strLen + 1); + pszAddrCopy = (char*)calloc(1, strLen + 1); if (!pszAddrCopy) { MSG_DEBUG("pszAddrCopy is NULL, mem alloc failed"); return false; @@ -5413,7 +5345,7 @@ static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char * while ((nChar > 0) && (*szSrc != '\0')) { if (*szSrc < 0x80) { - outBufSize --; + outBufSize--; if (outBufSize < 0) goto __RETURN; @@ -5442,7 +5374,7 @@ static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char * des += 3; szSrc += 3; } else { - outBufSize --; + outBufSize--; if (outBufSize < 0) goto __RETURN; @@ -5479,7 +5411,7 @@ static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, in { MSG_BEGIN(); int nRead = 0; - int length= 0; + int length = 0; if (pFile == NULL) { MSG_DEBUG("Error"); @@ -5574,7 +5506,6 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, if (pPartType->type == MIME_APPLICATION_SMIL) { snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", "smil.txt"); } else { - if (pPartType->param.szName[0] != '\0') { snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "%s", pPartType->param.szName); } else if (pPartType->param.szFileName[0] != '\0') { @@ -5600,7 +5531,6 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, MSG_SEC_DEBUG("save flag [%d], filepath [%s], file exist [%d]", bSave, szFullPath, bFileExist); if (bSave == true && bFileExist == false) { - if ((pFile = MsgOpenFile(szFullPath, "wb+")) == NULL) { MSG_DEBUG("MsgOpenFile failed"); goto __CATCH; @@ -5618,9 +5548,8 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, /* IF DRM type Convert to dcf */ if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE - || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) - { - char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0,}; + || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) { + char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0, }; if (MsgDrmConvertDmtoDcfType(pPartBody->szOrgFilePath, destDrmPath) == true) { MSG_INFO("Success Convert to Dcf"); @@ -5662,9 +5591,8 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, /* IF DRM type check dcf exist */ if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE - || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) - { - char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0,}; + || pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT) { + char destDrmPath[MSG_FILEPATH_LEN_MAX] = {0, }; MsgGetFileNameWithoutExtension(destDrmPath, pPartBody->szOrgFilePath); strncat(destDrmPath, ".dcf", 4); @@ -5840,13 +5768,11 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m } if (MmsIsTextType(msgTypeValue)) { - if (msgCharsetValue == MSG_CHARSET_US_ASCII) { pNewData = pTemp; *npRead = nTemp; } else if (msgCharsetValue == MSG_CHARSET_UTF8) { - - /* skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) */ + /* skip BOM(Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) */ if (nTemp >= 3) { if (((UINT8)pTemp[0]) == 0xEF && ((UINT8)pTemp[1]) == 0xBB && ((UINT8)pTemp[2]) == 0xBF) { pTemp += 3; @@ -5857,7 +5783,6 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m pNewData = pTemp; *npRead = nTemp; } else { - UINT16 MIBenum = MmsGetBinaryValue(MmsCodeCharSet, msgCharsetValue); pFromCodeSet = MmsGetTextByCode(MmsCodeCharSet, MIBenum); @@ -5927,8 +5852,8 @@ __CATCH: static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex, char *outBuf, int outBufLen) { - char szTemp[MSG_FILENAME_LEN_MAX+1]={0,}; - char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,}; + char szTemp[MSG_FILENAME_LEN_MAX+1] = {0, }; + char szTempFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; const char *pExt = NULL; MSG_SEC_DEBUG("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName); @@ -5939,7 +5864,6 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType /* Filename */ int inp_len = strlen(szFileName); if (inp_len > 0) { - pExt = strrchr(szFileName, '.'); if (pExt != NULL && *(pExt + 1) != '\0') { @@ -5964,7 +5888,6 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType pExt = "dcf"; if (pExt == NULL) { /* find ext from content type */ - if (iMsgType == MIME_APPLICATION_OCTET_STREAM || iMsgType == MIME_UNKNOWN) { MSG_DEBUG("unsupported MsgType [%d]", iMsgType); goto __CATCH; @@ -5989,7 +5912,7 @@ __CATCH: return false; } -bool MsgGetFileNameWithoutExtension (char *szOutputName, char *szName) +bool MsgGetFileNameWithoutExtension(char *szOutputName, char *szName) { char *pszExt = NULL; @@ -6064,8 +5987,6 @@ bool MmsGetMediaPartHeader(int index, MsgType *pHeader) } -/////////////////////////////////////////////////////////////////////////////// - MmsPluginDecoder *MmsPluginDecoder::pInstance = NULL; MmsPluginDecoder *MmsPluginDecoder::instance() @@ -6076,8 +5997,8 @@ MmsPluginDecoder *MmsPluginDecoder::instance() return MmsPluginDecoder::pInstance; } -MmsPluginDecoder::MmsPluginDecoder(){} -MmsPluginDecoder::~MmsPluginDecoder(){} +MmsPluginDecoder::MmsPluginDecoder() {} +MmsPluginDecoder::~MmsPluginDecoder() {} void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const char *pduFilePath) { @@ -6126,7 +6047,6 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody)); { /* attribute convert mmsHeader -> mmsAttribute */ - pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type; pMsg->mmsAttrib.date = mmsHeader.date; @@ -6182,7 +6102,6 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const nRead = MsgReadFile(pMsg->msgBody.pPresentationBody->body.pText, sizeof(char), pMsg->msgBody.pPresentationBody->size, pFile); if (nRead == 0) goto __CATCH; - } MsgCloseFile(pFile); @@ -6226,7 +6145,6 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const } while (pMultipart) { - if (__MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody, (char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, true) == false) goto __CATCH; @@ -6234,12 +6152,11 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const MmsPrintMulitpart(pMultipart, partIndex); pMultipart = pMultipart->pNext; - partIndex ++; + partIndex++; } } else { /* single part */ if (pMsg->nPartCount > 0) { - if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) { if (errno == EEXIST) { MSG_DEBUG("exist dir : [%s]", szTempMediaDir); @@ -6278,7 +6195,6 @@ __CATCH: MSG_DEBUG("### Fail ###"); MSG_END(); return; - } /* CID 41989: Removed function decodeMmsPdu which is unused. */ @@ -6294,11 +6210,11 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat MmsInitHeader(); - //pMsg->msgID = msgID; + /* pMsg->msgID = msgID; */ snprintf(szFullPath, sizeof(szFullPath), "%s", pduFilePath); - //MsgGetFileName(szFullPath, pMsg->szFileName, sizeof(pMsg->szFileName)); + /* MsgGetFileName(szFullPath, pMsg->szFileName, sizeof(pMsg->szFileName)); */ if (MsgGetFileSize(szFullPath, &nSize) == false) { MSG_FATAL("Fail MsgGetFileSize"); @@ -6323,7 +6239,7 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat goto __CATCH; } - //set header + /* set header */ if (pMmsData->header == NULL) { pMmsData->header = MsgMmsCreateHeader(); } @@ -6361,11 +6277,10 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat snprintf(pMmsData->header->trID, sizeof(pMmsData->header->trID), "%s", mmsHeader.szTrID); - //CID 41989: Moving assignment of iter_multipart before its de-referencing. iter_multipart = mmsHeader.msgBody.body.pMultipart; - //set multipart - if (pMmsData->header->contentType == MIME_MULTIPART_RELATED || pMmsData->header->contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { + /*set multipart */ + if (pMmsData->header->contentType == MIME_MULTIPART_RELATED || pMmsData->header->contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); pMultipart->type = MIME_APPLICATION_SMIL; @@ -6374,7 +6289,7 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", mmsHeader.msgBody.presentationType.szContentLocation); snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", mmsHeader.msgBody.presentationType.param.szName); - //snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", mmsHeader.msgBody.presentationType.param.szFileName); + /* snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), MSG_DATA_PATH"%s", mmsHeader.msgBody.presentationType.param.szFileName); */ MsgBody *pBody = iter_multipart->pBody; pMultipart->pMultipartData = MsgOpenAndReadMmsFile(pBody->szOrgFilePath, pBody->offset, pBody->size, (int*)&pMultipart->nMultipartDataLen); @@ -6384,17 +6299,16 @@ void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePat while (iter_multipart) { - MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); pMultipart->type = (MimeType)iter_multipart->type.type; - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s",MimeGetMimeStringFromMimeInt(iter_multipart->type.type)); + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(iter_multipart->type.type)); snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", iter_multipart->type.szContentID); snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", iter_multipart->type.szContentLocation); snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", iter_multipart->type.param.szName); - //snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", iter_multipart->pBody->szOrgFilePath); + /* snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", iter_multipart->pBody->szOrgFilePath); */ MsgBody *pBody = iter_multipart->pBody; pMultipart->pMultipartData = MsgOpenAndReadMmsFile(pBody->szOrgFilePath, pBody->offset, pBody->size, (int*)&pMultipart->nMultipartDataLen); diff --git a/plugin/mms_plugin/MmsPluginDrm.cpp b/plugin/mms_plugin/MmsPluginDrm.cpp index c71c2e4..be22384 100755 --- a/plugin/mms_plugin/MmsPluginDrm.cpp +++ b/plugin/mms_plugin/MmsPluginDrm.cpp @@ -34,8 +34,8 @@ bool MmsPluginDrmGetInfo(const char *szFilePath, MsgType *pMsgType) return false; } - char szMimeType[DRM_MAX_LEN_MIME + 1] = {0,}; - char szContentID[DRM_MAX_LEN_CID + 1] = {0,}; + char szMimeType[DRM_MAX_LEN_MIME + 1] = {0, }; + char szContentID[DRM_MAX_LEN_CID + 1] = {0, }; MSG_DRM_TYPE drmType = MSG_DRM_NONE; int ret = 0; diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp index b6edf29..1853955 100755 --- a/plugin/mms_plugin/MmsPluginEncode.cpp +++ b/plugin/mms_plugin/MmsPluginEncode.cpp @@ -551,10 +551,10 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m } /* make report body .. */ - maxLen = strlen (pszReportMsg) +16 /* date string */ + 8 /* enter chars */ ; + maxLen = strlen(pszReportMsg) + 16 /* date string */ + 8 /* enter chars */ ; if (maxLen > MSG_STDSTR_LONG) { - snprintf (pText, MSG_STDSTR_LONG, "%s", pszReportMsg); + snprintf(pText, MSG_STDSTR_LONG, "%s", pszReportMsg); } else { snprintf(pText, MSG_STDSTR_LONG, "%s\r\n\r\n%.4d/%.2d/%.2d %.2d:%.2d\r\n", pszReportMsg, dateTime.tm_year+1900, dateTime.tm_mon+1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min); @@ -728,8 +728,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) /* To = Encoded-string-value */ - if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szTo) == false) - { + if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, pMsg->mmsAttrib.szTo) == false) { MSG_DEBUG("To __MmsBinaryEncodeAddress fail"); goto __CATCH; } @@ -875,7 +874,6 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) if ((pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED) || (pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED_TEXT_ONLY)) { - /* reply charging */ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80; fieldValue = MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80; @@ -907,7 +905,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGSIZE) | 0x80; - if (__MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) { + if (__MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) { MSG_DEBUG("replyChargingSize MmsBinaryEncodeInteger error"); goto __CATCH; } @@ -1042,7 +1040,7 @@ static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_READ); } else { - snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_DELETED ); + snprintf(szSubject, MSG_LOCALE_SUBJ_LEN + 8, "%s", MMS_READ_REPORT_STRING_DELETED); } } @@ -1159,7 +1157,7 @@ static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read goto __CATCH; } - snprintf(szTo, length + 11,"%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); + snprintf(szTo, length + 11, "%s/TYPE=PLMN", pMsg->mmsAttrib.szFrom); MSG_DEBUG("To = %s", szTo); if (__MmsBinaryEncodeAddress(pFile, MMS_CODE_TO, szTo) == false) { @@ -1230,7 +1228,6 @@ static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody } if (MmsIsMultipart(pType->type)) { - int nEntries = 0; /* --------------------------- * Multipart message @@ -1365,7 +1362,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) contentType = pType->type; fieldValue = MmsGetBinaryValue(MmsCodeContentType, contentType); - if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { + if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) { /* Extension-media type */ szTextType = MmsGetTextValue(MmsCodeContentType, contentType); if (szTextType != NULL) { @@ -1406,7 +1403,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) if (pType->param.szName[0]) { char* pszName = NULL; - if (MmsIsAsciiString (pType->param.szName)) { + if (MmsIsAsciiString(pType->param.szName)) { MSG_DEBUG("Name is consisted of ascii char-set chars."); } else { isAscii = false; @@ -1600,7 +1597,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe if (pType->param.szName[0]) { MSG_SEC_DEBUG("Parameter Name : %s", pType->param.szName); char *pszName = NULL; - if (MmsIsAsciiString (pType->param.szName)) { + if (MmsIsAsciiString(pType->param.szName)) { MSG_DEBUG("Name is consisted of ascii char-set chars."); } else { isAscii = false; @@ -1666,7 +1663,6 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe MSG_DEBUG(" szApplicationID MmsBinaryEncodeTextString fail"); goto __CATCH; } - } /* ReplyToApplicationID: Text-string */ @@ -1718,7 +1714,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe } else { /* Any-charset */ if (MmsIsTextType(contentType)) { - if (!MmsIsVitemContent (contentType, pType->param.szName)) { + if (!MmsIsVitemContent(contentType, pType->param.szName)) { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80; fieldValue = 0x0000; /* laconic_warning, just to remove warning message */ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80; @@ -1916,7 +1912,7 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp goto __CATCH; } - if (__MmsBinaryEncodeContentHeader(pFile, (MimeType)contentType, pType, true) == false) { + if (__MmsBinaryEncodeContentHeader(pFile, (MimeType)contentType, pType, true) == false) { MSG_DEBUG("MmsBinaryEncodeContentHeader fail"); goto __CATCH; } @@ -2017,7 +2013,6 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp if (contentType != MIME_APPLICATION_VND_WAP_MULTIPART_RELATED && contentType != MIME_MULTIPART_RELATED && pType->disposition != INVALID_VALUE) { - /* * Content-disposition-value = Value-length Disposition *(Parameter) * Disposition = Form-data | Attachment | Inline | Token-text @@ -2068,7 +2063,6 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms /* content-id ------------------------------------------------- */ if (pType->szContentID[0]) { - MSG_SEC_DEBUG("Content ID : %s", pType->szContentID); if (bMultipart) { /* Binary Encoding */ @@ -2102,7 +2096,7 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms if (pType->szContentLocation[0]) { MSG_SEC_DEBUG("Content Location : %s", pType->szContentLocation); - if (MmsIsAsciiString (pType->szContentLocation)) { + if (MmsIsAsciiString(pType->szContentLocation)) { MSG_DEBUG("Name is consisted of ascii char-set chars."); } else { isAscii = false; @@ -2157,7 +2151,6 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms if (contentType != MIME_APPLICATION_VND_WAP_MULTIPART_RELATED && contentType != MIME_MULTIPART_RELATED && pType->disposition != INVALID_VALUE) { - MSG_DEBUG("Content Disposition : %d", pType->disposition); /* * Content-disposition-value = Value-length Disposition *(Parameter) @@ -2168,7 +2161,6 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms */ if (bMultipart) { /* Binary Encoding */ - UINT8 fieldValue = 0xff; gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80; @@ -2252,7 +2244,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody) } } else if (pBody->body.pText && pBody->size) { pBody->offset = __MmsGetEncodeOffset(); - if (MsgWriteFile(pBody->body.pText, sizeof(char),(size_t)pBody->size, pFile) != (size_t)pBody->size) { + if (MsgWriteFile(pBody->body.pText, sizeof(char), (size_t)pBody->size, pFile) != (size_t)pBody->size) { MSG_DEBUG("MsgWriteFile failed"); goto __CATCH; } @@ -2287,7 +2279,6 @@ static int __MmsBinaryEncodeIntegerLen(UINT32 integer) /* short-integer */ return 1; } else { - int length = 0; /* * Long-integer = Short-length Multi-octet-integer @@ -2569,7 +2560,7 @@ static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length) i++; } - for(i=0; i < length; i++) + for (i = 0; i < length; i++) gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = szReverse[length - i - 1]; return true; @@ -2700,7 +2691,7 @@ static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source) } textLeng = __MmsBinaryEncodeTextStringLen((UINT8*)source); - if (textLeng == -1) { + if (textLeng == -1) { MSG_DEBUG(" textLeng MmsBinaryEncodeTextStringLen fail."); goto __CATCH; } @@ -2755,8 +2746,7 @@ static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int lengt goto __CATCH; } - if (length != (charLeng + textLeng + valLengthLen)) - { + if (length != (charLeng + textLeng + valLengthLen)) { MSG_DEBUG("invalid length"); goto __CATCH; } @@ -2910,7 +2900,7 @@ static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID) } gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode; - if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) { + if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) { MSG_DEBUG("MmsBinaryEncodeTextString fail"); goto __CATCH; } @@ -3096,7 +3086,6 @@ static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *s pSingleAddr = strchr(szAddr, MSG_CH_SEMICOLON); if (pSingleAddr) { - *pSingleAddr = MSG_CH_NULL; if (__MmsBinaryEncodeOneAddress(pFile, addrType, szAddr) == false) { MSG_DEBUG("__MmsBinaryEncodeAddress fail"); @@ -3162,7 +3151,6 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt } if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) { /* + fieldCode + timeType */ - if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) { MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail"); @@ -3182,7 +3170,7 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt /* time type & value */ if (time.type == MMS_TIMETYPE_RELATIVE) { gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_RELATIVE) | 0x80; - if (__MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) { + if (__MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) { MSG_DEBUG("MmsBinaryEncodeLongInteger fail"); goto __CATCH; } @@ -3212,7 +3200,7 @@ char *_MsgSkipWS3(char *s) return s; } } -////////////////////////////////////////////////////////////////////////////// + static bool __EncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath) { bool encode_ret = false; @@ -3240,8 +3228,7 @@ static bool __EncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath) goto __CATCH; } - switch(pMmsMsg->mmsAttrib.msgType) - { + switch(pMmsMsg->mmsAttrib.msgType) { case MMS_MSGTYPE_SEND_REQ: case MMS_MSGTYPE_SEND_CONF: encode_ret = MmsEncodeSendReq(pFile, pMmsMsg); @@ -3279,8 +3266,8 @@ MmsPluginEncoder *MmsPluginEncoder::instance() return MmsPluginEncoder::pInstance; } -MmsPluginEncoder::MmsPluginEncoder(){} -MmsPluginEncoder::~MmsPluginEncoder(){} +MmsPluginEncoder::MmsPluginEncoder() {} +MmsPluginEncoder::~MmsPluginEncoder() {} void MmsPluginEncoder::encodeMmsPdu(MMS_DATA_S *pMmsData, msg_message_id_t msgID, const char *pduFilePath) { @@ -3298,7 +3285,6 @@ void MmsPluginEncoder::encodeMmsPdu(MMS_DATA_S *pMmsData, msg_message_id_t msgID __CATCH: MmsReleaseMmsMsg(pMmsMsg); MSG_FREE(pMmsMsg); - } void MmsPluginEncoder::encodeMmsPdu(MmsMsg *pMmsMsg, msg_message_id_t msgID, const char *pduFilePath) diff --git a/plugin/mms_plugin/MmsPluginEventHandler.cpp b/plugin/mms_plugin/MmsPluginEventHandler.cpp index 4df7231..f71d8e0 100755 --- a/plugin/mms_plugin/MmsPluginEventHandler.cpp +++ b/plugin/mms_plugin/MmsPluginEventHandler.cpp @@ -48,7 +48,6 @@ MmsPluginEventHandler::MmsPluginEventHandler() MmsPluginEventHandler::~MmsPluginEventHandler() { - } @@ -129,7 +128,7 @@ TapiHandle *MmsPluginEventHandler::getTelHandle(int sim_idx) void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char *pRetrievedFilePath) { - MSG_MESSAGE_INFO_S msgInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; msgInfo.sim_idx = pRequest->simId; switch (pRequest->eMmsPduType) { diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp index 73c03e2..5900940 100755 --- a/plugin/mms_plugin/MmsPluginHttp.cpp +++ b/plugin/mms_plugin/MmsPluginHttp.cpp @@ -25,7 +25,7 @@ #include "MmsPluginUtil.h" static void __http_print_profile(CURL *curl); -static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void); +static int __http_debug_cb(CURL *input_curl, curl_infotype input_info_type, char *input_data, size_t input_size, void *input_void); static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int ulContentLen); static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *szHeaderBuffer); @@ -35,7 +35,7 @@ static void __httpGetHost(char *szUrl, char *szHost, int nBufferLen); FUNCTION IMPLEMENTATION ==================================================================================================*/ -static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void) +static int __http_debug_cb(CURL *input_curl, curl_infotype input_info_type, char *input_data, size_t input_size, void *input_void) { MSG_SEC_INFO("curl_infotype [%d] : %s", input_info_type, input_data); return 0; @@ -144,7 +144,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int memset(pcheader, 0, HTTP_REQUEST_LEN); __httpGetHost(szUrl, szBuffer, 1024); - if (strlen(szBuffer)){ + if (strlen(szBuffer)) { snprintf(pcheader, HTTP_REQUEST_LEN, "Host: %s", szBuffer); MSG_INFO("%s", pcheader); *responseHeaders = curl_slist_append(*responseHeaders, pcheader); @@ -410,11 +410,11 @@ static int __http_multi_perform(void *session) retval = select(max_fd+1, &fd_r, &fd_w, &fd_excp, &timeout); - if (retval == -1){ /* select error */ + if (retval == -1) { /* select error */ MSG_ERR("select error"); ret = -1; break; - } else if (retval == 0){ /* timeout */ + } else if (retval == 0) { /* timeout */ MSG_ERR("time out"); ret = -1; break; @@ -430,12 +430,10 @@ static int __http_multi_perform(void *session) } MSG_INFO("curl_multi_perform end : rcm = %d, still_running = %d, cm_open = %d", rcm, still_running, connection_open_flag); - } while (still_running && (connection_open_flag == true)); while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { if (msg->msg == CURLMSG_DONE) { - if (msg->easy_handle == session) { MSG_INFO("HTTP transfer completed with status %d", msg->data.result); if (msg->data.result != 0) { @@ -458,8 +456,7 @@ static int __http_multi_perform(void *session) MmsPluginHttpAgent *MmsPluginHttpAgent::pInstance = NULL; MmsPluginHttpAgent *MmsPluginHttpAgent::instance() { - if (!pInstance) - { + if (!pInstance) { pInstance = new MmsPluginHttpAgent(); } @@ -563,15 +560,13 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf /* Verify request info */ if (request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_GET - && request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_POST) - { + && request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_POST) { MSG_ERR("transaction_type of request_info is Invaild [%d]", request_info.transaction_type); http_error = MMS_HTTP_ERROR_TRANSACTION_TYPE; goto __CATCH; } if (request_info.transaction_type == MMS_HTTP_TRANSACTION_TYPE_POST) { - if (request_info.post_data == NULL || request_info.post_data_len == 0) { MSG_ERR("post data info is Invaild"); http_error = MMS_HTTP_ERROR_SESSION; @@ -703,7 +698,6 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in /* close conf file & load response data */ if (respfile) { - fclose(respfile); respfile = NULL; diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp index c3337af..db91fcd 100755 --- a/plugin/mms_plugin/MmsPluginInternal.cpp +++ b/plugin/mms_plugin/MmsPluginInternal.cpp @@ -45,12 +45,10 @@ MmsPluginInternal *MmsPluginInternal::pInstance = NULL; MmsPluginInternal::MmsPluginInternal() { - } MmsPluginInternal::~MmsPluginInternal() { - } MmsPluginInternal *MmsPluginInternal::instance() @@ -66,10 +64,10 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ MSG_BEGIN(); FILE *pFile = NULL; - char fileName[MSG_FILENAME_LEN_MAX] = {0,}; + char fileName[MSG_FILENAME_LEN_MAX] = {0, }; if (pMsgInfo->bTextSms == true) { - char fullPath[MAX_FULL_PATH_SIZE+1] = {0,}; + char fullPath[MAX_FULL_PATH_SIZE+1] = {0, }; if (MsgCreateFileName(fileName) == false) THROW(MsgException::FILE_ERROR, "MsgCreateFileName error"); @@ -150,7 +148,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST MSG_DEBUG("pMsgInfo->subject [%s]", pMsgInfo->subject); -#if 0 // P150826-01612, P150910-05427 : we do not need to add empty subject text any more. +#if 0 /* we do not need to add empty subject text any more. */ if (strlen(pMsgInfo->subject) < 1) snprintf(pMsgInfo->subject, MAX_SUBJECT_LEN, "MMS Notification Message."); #endif @@ -169,83 +167,83 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST MMS_DATA_S *mms_data = MsgMmsCreate(); if (mms_data == NULL) return false; - { - mms_data->header = MsgMmsCreateHeader(); - if (mms_data->header == NULL) { - MsgMmsRelease(&mms_data); - return false; - } + mms_data->header = MsgMmsCreateHeader(); - MMS_HEADER_DATA_S *pHeader = mms_data->header; + if (mms_data->header == NULL) { + MsgMmsRelease(&mms_data); + return false; + } - pHeader->messageType = mmsHeader.type; + MMS_HEADER_DATA_S *pHeader = mms_data->header; - snprintf(pHeader->trID, sizeof(pHeader->trID), "%s", mmsHeader.szTrID); + pHeader->messageType = mmsHeader.type; - pHeader->mmsVersion = mmsHeader.version; + snprintf(pHeader->trID, sizeof(pHeader->trID), "%s", mmsHeader.szTrID); - /* From */ - if (mmsHeader.pFrom) { - MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); - snprintf(pHeader->szFrom, sizeof(pHeader->szFrom), "%s", mmsHeader.pFrom->szAddr); - } + pHeader->mmsVersion = mmsHeader.version; - /* Subject */ - snprintf(pHeader->szSubject, sizeof(pHeader->szSubject), "%s", mmsHeader.szSubject); - /* Delivery Report */ - pHeader->bDeliveryReport = (mmsHeader.deliveryReport != MMS_REPORT_YES); - /* Message Class */ - pHeader->messageClass = mmsHeader.msgClass; + /* From */ + if (mmsHeader.pFrom) { + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); + snprintf(pHeader->szFrom, sizeof(pHeader->szFrom), "%s", mmsHeader.pFrom->szAddr); + } - /* Priority */ - pHeader->mmsPriority = mmsHeader.priority; + /* Subject */ + snprintf(pHeader->szSubject, sizeof(pHeader->szSubject), "%s", mmsHeader.szSubject); + /* Delivery Report */ + pHeader->bDeliveryReport = (mmsHeader.deliveryReport != MMS_REPORT_YES); + /* Message Class */ + pHeader->messageClass = mmsHeader.msgClass; - /* Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; */ - /* Expiry */ - pHeader->expiry.type = mmsHeader.expiryTime.type; - pHeader->expiry.time = mmsHeader.expiryTime.time; + /* Priority */ + pHeader->mmsPriority = mmsHeader.priority; - time_t curTime = time(NULL); + /* Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; */ + /* Expiry */ + pHeader->expiry.type = mmsHeader.expiryTime.type; + pHeader->expiry.time = mmsHeader.expiryTime.time; - if (pHeader->expiry.type == MMS_TIMETYPE_RELATIVE) { - pHeader->expiry.type = MMS_TIMETYPE_ABSOLUTE; - pHeader->expiry.time += curTime; - } + time_t curTime = time(NULL); - /* Charge */ - /* contentclass */ - /* int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */ - strncpy(pHeader->contentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); + if (pHeader->expiry.type == MMS_TIMETYPE_RELATIVE) { + pHeader->expiry.type = MMS_TIMETYPE_ABSOLUTE; + pHeader->expiry.time += curTime; + } - pHeader->messageSize = mmsHeader.msgSize; + /* Charge */ + /* contentclass */ + /* int contentClass; */ /*text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */ + strncpy(pHeader->contentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN); - MSG_DEBUG("Message size = [%d]", pHeader->messageSize); + pHeader->messageSize = mmsHeader.msgSize; - char *pSerializedMms = NULL; - int serializeDataSize = 0; + MSG_DEBUG("Message size = [%d]", pHeader->messageSize); - char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; - char pTempFilePath[MSG_FILEPATH_LEN_MAX+1] = {0}; + char *pSerializedMms = NULL; + int serializeDataSize = 0; - serializeDataSize = MsgSerializeMms(mms_data, &pSerializedMms); + char pTempFileName[MSG_FILENAME_LEN_MAX+1] = {0}; + char pTempFilePath[MSG_FILEPATH_LEN_MAX+1] = {0}; - if (pSerializedMms) { - if (MsgCreateFileName(pTempFileName) == true) { - pMsgInfo->bTextSms = false; + serializeDataSize = MsgSerializeMms(mms_data, &pSerializedMms); - snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName); + if (pSerializedMms) { + if (MsgCreateFileName(pTempFileName) == true) { + pMsgInfo->bTextSms = false; - MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize); + snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName); - /* set file name */ - snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName); - } + MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize); - free(pSerializedMms); + /* set file name */ + snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName); } + + free(pSerializedMms); } - MsgMmsRelease(&mms_data); + + MsgMmsRelease(&mms_data); /* Check contents-location is in noti.ind */ if (mmsHeader.szContentLocation[0] == '\0') { @@ -387,10 +385,10 @@ void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo) status.msgStatus = mmsHeader.msgStatus; status.handledTime = mmsHeader.date; status.bDeliveryReportIsRead = false; - status.bDeliveyrReportIsLast= true; + status.bDeliveyrReportIsLast = true; MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr); - MSG_SEC_DEBUG("[INFO] [ADDR: %s, MMSID: %s]",mmsHeader.pTo->szAddr, mmsHeader.szMsgID); + MSG_SEC_DEBUG("[INFO] [ADDR: %s, MMSID: %s]", mmsHeader.pTo->szAddr, mmsHeader.szMsgID); pMsgInfo->msgType.mainType = MSG_MMS_TYPE; pMsgInfo->msgType.subType = MSG_DELIVERYIND_MMS; @@ -494,7 +492,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn strncpy(pMsgInfo->msgText, responseText, MMS_LOCALE_RESP_TEXT_LEN); } - MSG_ADDRESS_INFO_S addressinfo = {0,}; + MSG_ADDRESS_INFO_S addressinfo = {0, }; char keyName[MAX_VCONFKEY_NAME_LEN]; memset(keyName, 0x00, sizeof(keyName)); @@ -741,10 +739,16 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra MSG_DEBUG("Error value of updateMmsAttrib [%d]", err); - { /* make MmsData & insert multipart */ + /* make MmsData & insert multipart */ + MMSList *multipart_list = NULL; + MMS_MULTIPART_DATA_S *pSmilMultipart = NULL; + MmsMsg *pMmsMsg = NULL; MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); + bool bFiltered; + MmsPluginAppBase *appBase; + MMS_DATA_S *pMmsData = MsgMmsCreate(); if (pMmsData == NULL) { MSG_SEC_DEBUG("Fail to create mms"); @@ -761,30 +765,28 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra goto __CATCH; } */ - bool bFiltered = checkFilterMmsBody(pMmsData); + bFiltered = checkFilterMmsBody(pMmsData); if (bFiltered == true) { pMsgInfo->folderId = MSG_SPAMBOX_ID; } - MMS_MULTIPART_DATA_S *pSmilMultipart = pMmsData->smil; + pSmilMultipart = pMmsData->smil; if (pSmilMultipart) { MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pSmilMultipart); } - MMSList *multipart_list = pMmsData->multipartlist; + multipart_list = pMmsData->multipartlist; for (int i = 0; i < (int)g_list_length(multipart_list); i++) { MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart); } - { /* make Preview info for APP */ - MmsPluginAppBase *appBase; - appBase = new MmsPluginAppBase(pMmsData); - appBase->makePreviewInfo(pMsgInfo->msgId, false, pRetrievedFilePath); - appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - delete appBase; - } + /* make Preview info for APP */ + appBase = new MmsPluginAppBase(pMmsData); + appBase->makePreviewInfo(pMsgInfo->msgId, false, pRetrievedFilePath); + appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + delete appBase; MsgMmsRelease(&pMmsData); @@ -792,10 +794,8 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath); goto __CATCH; } - } /* make MmsData & insert multipart */ -__CATCH: - { +__CATCH: { MmsMsg *pMsg = NULL; pStorage->getMmsMessage(&pMsg); MmsInitHeader(); @@ -858,48 +858,44 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra pMsgInfo->dataSize = pRequest->getDataLen; + MmsMsg *pMmsMsg = NULL; + MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); - { - MmsMsg *pMmsMsg = NULL; - MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg); - - MMS_DATA_S *pMmsData = MsgMmsCreate(); - pMmsData->header = MsgMmsCreateHeader(); + MMS_DATA_S *pMmsData = MsgMmsCreate(); + pMmsData->header = MsgMmsCreateHeader(); - if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) { - MSG_DEBUG("Fail to Compose MMS Message"); - goto __CATCH; - } + if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) { + MSG_DEBUG("Fail to Compose MMS Message"); + goto __CATCH; + } - char *pSerializedData = NULL; + char *pSerializedData = NULL; - MsgSerializeMms(pMmsData, &pSerializedData); + MsgSerializeMms(pMmsData, &pSerializedData); - MsgMmsRelease(&pMmsData); + MsgMmsRelease(&pMmsData); - char fileName[MSG_FILENAME_LEN_MAX] = {0}; - char fileFilePath[MSG_FILEPATH_LEN_MAX] = {0}; + char fileName[MSG_FILENAME_LEN_MAX] = {0}; + char fileFilePath[MSG_FILEPATH_LEN_MAX] = {0}; - if (MsgCreateFileName(fileName) == false) - goto __CATCH; + if (MsgCreateFileName(fileName) == false) + goto __CATCH; - snprintf(fileFilePath, sizeof(fileFilePath), "%s%s", MSG_DATA_PATH, fileName); + snprintf(fileFilePath, sizeof(fileFilePath), "%s%s", MSG_DATA_PATH, fileName); - if (!MsgOpenCreateAndOverwriteFile(fileFilePath, (char *)pSerializedData, (int)strlen(pSerializedData))) { - goto __CATCH; - } + if (!MsgOpenCreateAndOverwriteFile(fileFilePath, (char *)pSerializedData, (int)strlen(pSerializedData))) { + goto __CATCH; + } - snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", fileFilePath); + snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", fileFilePath); - if (MsgGetFileSize(pRetrievedFilePath, (int *)&pMsgInfo->dataSize) == false) { - MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath); - goto __CATCH; - } + if (MsgGetFileSize(pRetrievedFilePath, (int *)&pMsgInfo->dataSize) == false) { + MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath); + goto __CATCH; } -__CATCH: - { +__CATCH: { MmsMsg *pMsg = NULL; MmsPluginStorage::instance()->getMmsMessage(&pMsg); MmsInitHeader(); @@ -911,7 +907,6 @@ __CATCH: #endif void MmsPluginInternal::processForwardConf(MSG_MESSAGE_INFO_S *msgInfo, mmsTranQEntity *pRequest) { - } /* This function Send NotifyRespInd Msg @@ -982,12 +977,12 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS pFile = MsgOpenMMSFile(pTempFilePath); if (!pFile) { - MSG_ERR("MsgOpenMMSFile fail \n" ); + MSG_ERR("MsgOpenMMSFile fail \n"); return false; } if (MmsEncodeAckInd(pFile, szTrID, bReportAllowed) == false) { - MSG_ERR("MmsEncodeAckInd: MmsEncodeAckInd fail \n" ); + MSG_ERR("MmsEncodeAckInd: MmsEncodeAckInd fail \n"); MsgCloseFile(pFile); return false; } @@ -1064,7 +1059,6 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c /* Not Rejected */ MSG_END(); return false; - } @@ -1107,7 +1101,6 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData) pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { - MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) { diff --git a/plugin/mms_plugin/MmsPluginMain.cpp b/plugin/mms_plugin/MmsPluginMain.cpp index c3471dc..519c5ca 100755 --- a/plugin/mms_plugin/MmsPluginMain.cpp +++ b/plugin/mms_plugin/MmsPluginMain.cpp @@ -51,7 +51,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) pPluginHandle->pfRestoreMsg = MmsRestoreMsg; MSG_DEBUG("MMS plugin: create handler OK"); - MSG_DEBUG ("MMS plugin %p", pPluginHandle); + MSG_DEBUG("MMS plugin %p", pPluginHandle); } return MSG_SUCCESS; @@ -237,7 +237,7 @@ msg_error_t MmsUpdateRejectStatus(MSG_MESSAGE_INFO_S *pMsgInfo) char szTrID[MMS_TR_ID_LEN + 1] = {0x00}; bool bReportAllowed; - err = MmsPluginStorage::instance()->getTrID(pMsgInfo,szTrID,sizeof(szTrID)); + err = MmsPluginStorage::instance()->getTrID(pMsgInfo, szTrID, sizeof(szTrID)); if (err != MSG_SUCCESS) MSG_DEBUG("MmsPlgUpdRejectStatus : Get MMS Transacation id Failed"); @@ -306,7 +306,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd MsgCloseFile(pFile); } } else { - MSG_DEBUG(":::%d :%s ",rcvdBodyLen, pRcvBody); + MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvBody); if (filePath) { snprintf(filePath, MAX_FULL_PATH_SIZE, "%sBODY_%lu.DATA", MSG_DATA_PATH, random() % 1000000000 + 1); @@ -315,7 +315,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd } /* create temp file */ - if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody,rcvdBodyLen)) + if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody, rcvdBodyLen)) return MSG_ERR_PLUGIN_STORAGE; } diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index 5e27b6c..cd6e2f4 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -111,7 +111,6 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType) /* Calculate allocated buffer size */ for (int i = 0; i < nAddressCnt; ++i) { - MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal); if (pMsgInfo->addressList[i].recipientType == MSG_RECIPIENTS_TYPE_UNKNOWN) @@ -248,7 +247,7 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg memset(pMultipart->type.szContentLocation, 0, MSG_MSG_ID_LEN + 1); gchar *tmpContentLocation = msg_replace_non_ascii_char(szContentLocation, '_'); - if (tmpContentLocation ) { + if (tmpContentLocation) { MSG_SEC_DEBUG("tmpContentLocation = [%s]", tmpContentLocation); snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", tmpContentLocation); g_free(tmpContentLocation); @@ -257,7 +256,7 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg } if (MmsIsTextType(mimeType) == true) { - if (!MmsIsVitemContent (mimeType, pMultipart->type.param.szName)) { + if (!MmsIsVitemContent(mimeType, pMultipart->type.param.szName)) { pMultipart->type.param.charset = MSG_CHARSET_UTF8; } pMultipart->type.encoding = MSG_ENCODING_8BIT; @@ -307,7 +306,7 @@ void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID) pMmsMsg->szForwardMsgID[0] = '\0'; if (mmsHeader.pFrom) { - MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr ); + MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr); strncpy(pMmsMsg->mmsAttrib.szFrom, mmsHeader.pFrom->szAddr, MSG_LOCALE_ADDR_LEN + 9); } @@ -440,14 +439,12 @@ void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg) if (pMmsMsg->pageCnt > 0) { for (int i = 0; i < pMmsMsg->pageCnt; i++) { - pPage = _MsgMmsGetPage(pMmsMsg, i); if (pPage == NULL) continue; for (int j = 0; j < pPage->mediaCnt; j++) { - pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia == NULL) continue; @@ -469,8 +466,7 @@ void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg) bool IsMatchedMedia(MMS_MEDIA_S *media, MMS_MULTIPART_DATA_S *pMultipart) { if (strlen(pMultipart->szContentID) > 0) { - - char szTempContentID[MSG_MSG_ID_LEN + 1] = {0,}; + char szTempContentID[MSG_MSG_ID_LEN + 1] = {0, }; MmsRemoveLessGreaterChar(pMultipart->szContentID, szTempContentID, sizeof(szTempContentID)); if (strcmp(media->szContentID, szTempContentID) == 0) { @@ -501,7 +497,6 @@ MsgMultipart *MmsGetNthMultipart(MmsMsg *pMsg, int index) MsgMultipart *pPart = NULL; if (MsgIsMultipart(pMsg->msgType.type) == true) { - pPart = pMsg->msgBody.body.pMultipart; while (pPart && index--) { @@ -527,13 +522,10 @@ bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pM if (pMsgData->pagelist) { for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { - MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); if (page && page->medialist) { - for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { - MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); if (media) { /* add media */ @@ -746,7 +738,6 @@ bool MmsInsertPartFromMultipart(MmsMsg *pMsg, MMS_MULTIPART_DATA_S *pNewMultipar __CATCH: return false; - } bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) @@ -788,16 +779,15 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) int partCnt = pMsg->nPartCount; if (partCnt <= 0) { - MSG_DEBUG("partCnt=%d\n", partCnt ); + MSG_DEBUG("partCnt=%d\n", partCnt); } else { - if (MmsGetMediaPartHeader(0, &partHeader) == false) { - MSG_DEBUG("Failed to get MediaPart MmsGetMediaPartHeader" ); + MSG_DEBUG("Failed to get MediaPart MmsGetMediaPartHeader"); goto FREE_CATCH; } if (partHeader.contentSize > 0) { - char szBuf[MSG_FILEPATH_LEN_MAX + 1] = {0,}; + char szBuf[MSG_FILEPATH_LEN_MAX + 1] = {0, }; MMS_PAGE_S *page = NULL; MMS_MEDIA_S *media = NULL; @@ -827,14 +817,11 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) _MsgMmsAddPage(pMmsMsg, page); } - } } else { - int partCnt = pMsg->nPartCount; for (int i = 0; i < partCnt; ++i) { - MsgMultipart *multipart = MmsGetNthMultipart(pMsg, i); MMS_MULTIPART_DATA_S pMultipart; @@ -851,7 +838,7 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg) snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", multipart->type.szContentLocation); snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", multipart->type.param.szName); snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", multipart->pBody->szOrgFilePath); - snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type)); + snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); if (multipart->type.drmInfo.drmType != MSG_DRM_TYPE_NONE) { pMultipart.drmType = multipart->type.drmInfo.drmType; @@ -913,7 +900,6 @@ void MmsPrintMmsMsg(const MmsMsg *pMmsMsg) } PRINT_KEY_VAL_STR("mms ver", pMmsMsg->mmsAttrib.version); - } int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo) @@ -947,11 +933,11 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo) MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath)); MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath); - { /* make Preview info for APP */ - MmsPluginAppBase appBase(mmsMsg); - appBase.makePreviewInfo(pMsgInfo->msgId, true, szFullPath); - appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - } + /* make Preview info for APP */ + MmsPluginAppBase appBase(mmsMsg); + appBase.makePreviewInfo(pMsgInfo->msgId, true, szFullPath); + appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + MmsReleaseMmsMsg(mmsMsg); MSG_END(); return 0; @@ -964,7 +950,6 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) MMS_HEADER_DATA_S *pHeaderData = pMmsData->header; if (pHeaderData) { - snprintf(pHeaderData->messageID, sizeof(pHeaderData->messageID), "%s", pMmsMsg->szMsgID); snprintf(pHeaderData->trID, sizeof(pHeaderData->trID), "%s", pMmsMsg->szTrID); snprintf(pHeaderData->contentLocation, sizeof(pHeaderData->contentLocation), "%s", pMmsMsg->szContentLocation); @@ -995,7 +980,6 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) } if (pMmsMsg->mmsAttrib.contentType == MIME_MULTIPART_RELATED || pMmsMsg->mmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) { - MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { pMultipart->type = MIME_APPLICATION_SMIL; @@ -1012,17 +996,15 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) int partCnt = pMmsMsg->nPartCount; for (int i = 0; i < partCnt; ++i) { - MsgMultipart *multipart = MmsGetNthMultipart(pMmsMsg, i); if (multipart) { - MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { pMultipart->type = (MimeType)multipart->type.type; - snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s",MimeGetMimeStringFromMimeInt(multipart->type.type)); + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", MimeGetMimeStringFromMimeInt(multipart->type.type)); snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", multipart->type.szContentID); snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", multipart->type.szContentLocation); snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", multipart->type.param.szName); @@ -1057,7 +1039,6 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) MMS_HEADER_DATA_S *pHeaderData = pMmsData->header; if (pHeaderData) { - if (strlen(pHeaderData->contentLocation) > 0) { snprintf(pMmsMsg->szContentLocation, sizeof(pMmsMsg->szContentLocation), "%s", pHeaderData->contentLocation); } @@ -1099,13 +1080,10 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) printMmsAttribute(&pMmsMsg->mmsAttrib); if (pMmsData->multipartlist) { - if (pMmsData->smil) { - MMS_MULTIPART_DATA_S *smil_multipart = pMmsData->smil; if (smil_multipart) { - pMmsMsg->mmsAttrib.contentType = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; pMmsMsg->msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED; @@ -1134,7 +1112,6 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData) int len = g_list_length(pMmsData->multipartlist); for (int i = 0; i < len; i++) { - MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMmsData->multipartlist, i); if (multipart) { @@ -1164,7 +1141,6 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList) /* Calculate allocated buffer size */ for (int i = 0; i < nAddressCnt; ++i) { - MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i); if (pAddressData) { MSG_SEC_DEBUG("address type : %d, address value: %s", pAddressData->address_type, pAddressData->address_val); @@ -1206,7 +1182,6 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList) MSG_END(); return szCompose; - } MMSList * MmsConvertAddressToNewStyle(const char *szAddr) @@ -1215,8 +1190,8 @@ MMSList * MmsConvertAddressToNewStyle(const char *szAddr) MMS_ADDRESS_DATA_S *pAddressData = NULL; char *pTempChar = NULL; - char *pStartPtr= NULL; - char *pEndPtr= NULL; + char *pStartPtr = NULL; + char *pEndPtr = NULL; if (szAddr == NULL) return NULL; @@ -1226,10 +1201,9 @@ MMSList * MmsConvertAddressToNewStyle(const char *szAddr) pStartPtr = pTempChar; while (pStartPtr && pStartPtr[0]) { - int addLen = 0; - char tempAddress[512] = {0,}; - char tempAddress2[512] = {0,}; + char tempAddress[512] = {0, }; + char tempAddress2[512] = {0, }; pEndPtr = strchr(pStartPtr, MSG_CH_SEMICOLON); @@ -1327,7 +1301,6 @@ bool convertAttachToMultipart(MMS_ATTACH_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDe snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pSrcMedia->szContentType); pDestMultipart->type = MimeGetMimeIntFromMimeString(pSrcMedia->szContentType); } else { - MimeMainType mainType = MIME_MAINTYPE_UNKNOWN; MimeType pMimeType = MIME_UNKNOWN; const char *pszMimeType = NULL; @@ -1423,7 +1396,6 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData) } while (g_list_find_custom(r_list, str2, __compare_str) != NULL) { - g_free(str2); if (ext) @@ -1476,7 +1448,6 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData) } while (g_list_find_custom(r_list, str2, __compare_str) != NULL) { - g_free(str2); if (ext) @@ -1494,7 +1465,6 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData) g_free(str2); } } - } /* end for attach */ g_list_free(r_list); diff --git a/plugin/mms_plugin/MmsPluginSMILValidate.cpp b/plugin/mms_plugin/MmsPluginSMILValidate.cpp index 40cf869..9cea890 100755 --- a/plugin/mms_plugin/MmsPluginSMILValidate.cpp +++ b/plugin/mms_plugin/MmsPluginSMILValidate.cpp @@ -165,7 +165,7 @@ MSG_SMIL_ERR_E _MsgMMSValidateSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bool *pbR return eRet; } - eRet = _MsgMMSAddDefaultSecondSMILRegion(pMsgData,!bTextReg); + eRet = _MsgMMSAddDefaultSecondSMILRegion(pMsgData, !bTextReg); if (eRet != MSG_SMIL_SUCCESS) { MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Region Information\n"); return eRet; @@ -251,7 +251,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultFirstSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, bo else snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_IMG_REG); - if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + if (_MsgMmsAddRegion(pMsgData, pRegion) != MSG_SUCCESS) { MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); free(pRegion); @@ -301,7 +301,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultSecondSMILRegion(MMS_MESSAGE_DATA_S *pMsgData, b else snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_IMG_REG); - if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + if (_MsgMmsAddRegion(pMsgData, pRegion) != MSG_SUCCESS) { MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); free(pRegion); @@ -348,7 +348,7 @@ MSG_SMIL_ERR_E _MsgMMSAddDefaultFullSMILRegion(MMS_MESSAGE_DATA_S *pMsgData) snprintf(pRegion->szID, MAX_SMIL_REGION_ID, "%s", MSG_SMIL_DEFAULT_FULL_REG); - if (_MsgMmsAddRegion(pMsgData,pRegion) != MSG_SUCCESS) { + if (_MsgMmsAddRegion(pMsgData, pRegion) != MSG_SUCCESS) { MSG_DEBUG("_MsgMMSValidateSMILRegion: Add Region failed\n"); free(pRegion); @@ -462,7 +462,7 @@ MSG_SMIL_ERR_E _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegA if (bResetRegion) { if (PageRegionCnt > 1) { if (pMedia->mediatype == MMS_SMIL_MEDIA_AUDIO) { - memset(pMedia->regionId,0x00, MAX_SMIL_REGION_ID); + memset(pMedia->regionId, 0x00, MAX_SMIL_REGION_ID); continue; } diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index 1579755..428f8a7 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -46,7 +46,6 @@ MmsPluginStorage::MmsPluginStorage() MmsPluginStorage::~MmsPluginStorage() { - } @@ -204,7 +203,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo) char *pSerializedMms = NULL; gsize pSerializedMmsSize = 0; - char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,}; + char working_dir[MSG_FILENAME_LEN_MAX+1] = {0, }; MMS_DATA_S *pMmsData = NULL; /* pMsgInfo->msgData is Filepath of json */ @@ -235,11 +234,10 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo) MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart); } - { /* make Preview info for APP */ - MmsPluginAppBase appBase(pMmsData); - appBase.makePreviewInfo(pMsgInfo->msgId, true, NULL); - appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - } + /* make Preview info for APP */ + MmsPluginAppBase appBase(pMmsData); + appBase.makePreviewInfo(pMsgInfo->msgId, true, NULL); + appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); MsgMmsRelease(&pMmsData); MSG_END(); @@ -500,7 +498,7 @@ int MmsPluginStorage::getMmsVersion(msg_message_id_t selectedMsgId) } /* reject_msg_support */ -msg_error_t MmsPluginStorage::getTrID(MSG_MESSAGE_INFO_S *pMsgInfo,char *pszTrID,int nBufferLen) +msg_error_t MmsPluginStorage::getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen) { MsgDbHandler *dbHandle = getDbHandle(); @@ -646,13 +644,10 @@ msg_error_t MmsPluginStorage::getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsg pPage = _MsgMmsGetPage(pMmsMsg, 0); if (pPage) { - for (int j = 0; j < pPage->mediaCnt; ++j) { - pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) { - MimeType mimeType = MIME_UNKNOWN; MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL); @@ -677,7 +672,7 @@ msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, const char char sqlQuery[MAX_QUERY_LEN + 1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) + /* (MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) */ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s " "(MSG_ID, TYPE, VALUE, COUNT)" @@ -697,7 +692,7 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId) MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN + 1]; - char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; + char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0, }; /* remove thumbnail file */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -711,7 +706,6 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId) } while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - memset(filePath, 0x00, sizeof(filePath)); strncpy(filePath, (char *)dbHandle->columnText(0), MSG_FILEPATH_LEN_MAX); if (remove(filePath) == -1) @@ -741,8 +735,8 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId) MsgDbHandler *dbHandle = getDbHandle(); char sqlQuery[MAX_QUERY_LEN + 1]; - char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; - char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,}; + char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0, }; + char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0, }; /* remove DB Preview */ removePreviewInfo(msgId); @@ -863,7 +857,7 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP /* CID 41991: pMultipart->szFilePath is an array, hence checking for null is not required */ if (strlen(pMultipart->szFilePath) > 0 && MsgAccessFile(pMultipart->szFilePath, F_OK) == true) { int bc_level = -1; - int tcs_ret = 0; // MsgTcsScanFile(pMultipart->szFilePath, &bc_level); + int tcs_ret = 0; /* MsgTcsScanFile(pMultipart->szFilePath, &bc_level); */ if (tcs_ret == 0) { if (bc_level > -1) { MSG_DEBUG("This content is malware, level = %d", bc_level); @@ -874,7 +868,6 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP } if (pMultipart->tcs_bc_level < 0 || pMultipart->malware_allow) { - if (g_str_has_prefix(pMultipart->szContentType, "video") || g_str_has_prefix(pMultipart->szContentType, "image")) { char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, }; @@ -953,7 +946,6 @@ msg_error_t MmsPluginStorage::updateMultipart(msg_message_id_t msgId, int allow_ pMultipart->malware_allow = allow_malware; if (pMultipart->tcs_bc_level >= 0 || pMultipart->malware_allow) { - if (!strcasecmp(pMultipart->szContentType, "video") || !strcasecmp(pMultipart->szContentType, "image")) { char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, }; @@ -969,10 +961,8 @@ msg_error_t MmsPluginStorage::updateMultipart(msg_message_id_t msgId, int allow_ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; - } - MSG_END(); return MSG_SUCCESS; } @@ -996,7 +986,6 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId) } while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - filePath = (const char *)dbHandle->columnText(0); if (filePath) { if (remove(filePath) == -1) @@ -1004,7 +993,6 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId) else MSG_SEC_DEBUG("Success to delete file [%s]", filePath); } - } dbHandle->finalizeQuery(); @@ -1018,7 +1006,6 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId) } while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - filePath = (const char *)dbHandle->columnText(0); if (filePath) { if (remove(filePath) == -1) @@ -1026,7 +1013,6 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId) else MSG_SEC_DEBUG("Success to delete file [%s]", filePath); } - } dbHandle->finalizeQuery(); @@ -1061,9 +1047,7 @@ msg_error_t MmsPluginStorage::getMultipartList(msg_message_id_t msgId, MMSList * msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt, &index); if (err == MSG_SUCCESS) { - for (int i = 0; i < rowCnt; i++) { - MMS_MULTIPART_DATA_S *multipart = MsgMmsCreateMultipart(); dbHandle->getColumnToString(index++, sizeof(multipart->szContentType), multipart->szContentType); @@ -1124,7 +1108,7 @@ msg_error_t MmsPluginStorage::addMmsData(msg_message_id_t msgId, const char *raw , raw_filepath, pHeader->mmsVersion, MMS_DATATYPE_NONE, pHeader->date, pHeader->bHideAddress , pHeader->bDeliveryReport, 0 /*pMmsMsg->mmsAttrib.bReportAllowed*/, 0 /*pMmsMsg->mmsAttrib.readReportAllowedType*/ , pHeader->bReadReport, 0 /*pMmsMsg->mmsAttrib.bRead*/, 0 /*pMmsMsg->mmsAttrib.readReportSendStatus*/, 0 /*pMmsMsg->mmsAttrib.bReadReportSent*/ - , pHeader->mmsPriority, true /*pMmsMsg->mmsAttrib.bLeaveCopy*/,pHeader->messageSize, pHeader->messageClass + , pHeader->mmsPriority, true /*pMmsMsg->mmsAttrib.bLeaveCopy*/, pHeader->messageSize, pHeader->messageClass , pHeader->expiry.time, 0, pHeader->delivery.time, pHeader->mmsStatus); msg_error_t db_err = dbHandle->execQuery(sqlQuery); @@ -1147,7 +1131,6 @@ msg_error_t MmsPluginStorage::addMmsData(msg_message_id_t msgId, const char *raw MSG_DEBUG("insert multipart to db"); for (int i = 0; i < (int)g_list_length(multipart_list); i++) { - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); if (pMultipart) { @@ -1225,9 +1208,7 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm MMSList *pMultipartList = NULL; if (this->getMultipartList(msgId, &pMultipartList) == MSG_SUCCESS) { - if (pMultipartList) { - MMS_MULTIPART_DATA_S *smil_multipart = NULL; char *content_type = NULL; @@ -1281,8 +1262,8 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI } if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS || pMsgInfo->msgType.subType == MSG_SENDCONF_MMS) { - char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,}; - char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,}; + char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0, }; + char working_dir[MSG_FILENAME_LEN_MAX+1] = {0, }; /* compose */ MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData); @@ -1310,18 +1291,16 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI goto __CATCH; } - { /* make Preview info for APP */ - MmsPluginAppBase appBase(pMmsData); - appBase.makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); - appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - } + /* make Preview info for APP */ + MmsPluginAppBase appBase(pMmsData); + appBase.makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); + appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); } else if (pMsgInfo->msgType.subType == MSG_RETRIEVE_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType ==MSG_RETRIEVE_MANUALCONF_MMS) { - - char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,}; - char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,}; + char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0, }; + char working_dir[MSG_FILENAME_LEN_MAX+1] = {0, }; /* compose */ MmsPluginComposer::instance()->composeRetrieveConf(pMsgInfo, pSendOptInfo, pMmsData); @@ -1349,16 +1328,13 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI goto __CATCH; } - { /* make Preview info for APP */ - MmsPluginAppBase *appBase; - appBase = new MmsPluginAppBase(pMmsData); - appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); - appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - delete appBase; - } + MmsPluginAppBase *appBase; + appBase = new MmsPluginAppBase(pMmsData); + appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); + appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + delete appBase; } else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { - if (pMmsData->header == NULL || pMmsData->header->messageType != MMS_MSGTYPE_NOTIFICATION_IND) { goto __CATCH; } @@ -1404,8 +1380,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE MSG_DEBUG("msg sub type = [%d]", pMsgInfo->msgType.subType); if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) { - char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,}; - char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,}; + char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0, }; + char working_dir[MSG_FILENAME_LEN_MAX+1] = {0, }; /* compose */ MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData); @@ -1417,7 +1393,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE /* add to db */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); - snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, KEEP_COPY = %d, ASK_READ_REPLY = %d, EXPIRY_TIME = %d, CUSTOM_DELIVERY_TIME = %d, DELIVERY_TIME= %d, PRIORITY = %d \ + snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, KEEP_COPY = %d, ASK_READ_REPLY = %d, EXPIRY_TIME = %d, CUSTOM_DELIVERY_TIME = %d, DELIVERY_TIME = %d, PRIORITY = %d \ WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, pSendOptInfo->bDeliverReq, pSendOptInfo->bKeepCopy, pSendOptInfo->option.mmsSendOptInfo.bReadReq, pSendOptInfo->option.mmsSendOptInfo.expiryTime.time, pSendOptInfo->option.mmsSendOptInfo.bUseDeliveryCustomTime, pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time, pSendOptInfo->option.mmsSendOptInfo.priority, pMsgInfo->msgId); @@ -1436,22 +1412,20 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */ - { /* add multipart list */ - if (pMmsData->smil) { - pMmsData->smil->type = MIME_APPLICATION_SMIL; - insertMultipart(pMsgInfo->msgId, pMmsData->smil); - } - - MMSList *multipart_list = pMmsData->multipartlist; + /* add multipart list */ + if (pMmsData->smil) { + pMmsData->smil->type = MIME_APPLICATION_SMIL; + insertMultipart(pMsgInfo->msgId, pMmsData->smil); + } - if (multipart_list) { - for (int i = 0; i < (int)g_list_length(multipart_list); i++) { + MMSList *multipart_list = pMmsData->multipartlist; - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); + if (multipart_list) { + for (int i = 0; i < (int)g_list_length(multipart_list); i++) { + MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); - if (pMultipart) { - insertMultipart(pMsgInfo->msgId, pMultipart); - } + if (pMultipart) { + insertMultipart(pMsgInfo->msgId, pMultipart); } } } @@ -1464,13 +1438,12 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE goto __CATCH; } - { /* make Preview info for APP */ - MmsPluginAppBase *appBase; - appBase = new MmsPluginAppBase(pMmsData); - appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); - appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - delete appBase; - } + /* make Preview info for APP */ + MmsPluginAppBase *appBase; + appBase = new MmsPluginAppBase(pMmsData); + appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath); + appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + delete appBase; } MsgMmsRelease(&pMmsData); @@ -1533,7 +1506,6 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP err = getMmsData(pMsg->msgId, pMmsData); /* get MmsData Info from DB */ if (err == MSG_SUCCESS) { - if (pSendOptInfo) { pSendOptInfo->bDeliverReq = pHeader->bDeliveryReport; pSendOptInfo->option.mmsSendOptInfo.bReadReq = pHeader->bReadReport; @@ -1586,13 +1558,14 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo) MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath)); MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath); - { /* make Preview info for APP */ - MmsPluginAppBase *appBase; - appBase = new MmsPluginAppBase(mmsMsg); - appBase->makePreviewInfo(pMsgInfo->msgId, true, szFullPath); - appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); - delete appBase; - } + + /* make Preview info for APP */ + MmsPluginAppBase *appBase; + appBase = new MmsPluginAppBase(mmsMsg); + appBase->makePreviewInfo(pMsgInfo->msgId, true, szFullPath); + appBase->getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText)); + delete appBase; + MmsReleaseMmsMsg(mmsMsg); MSG_END(); diff --git a/plugin/mms_plugin/MmsPluginTextConvert.cpp b/plugin/mms_plugin/MmsPluginTextConvert.cpp index 9369296..613d82d 100755 --- a/plugin/mms_plugin/MmsPluginTextConvert.cpp +++ b/plugin/mms_plugin/MmsPluginTextConvert.cpp @@ -52,11 +52,9 @@ bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeset, cons } if (strcasecmp("utf-16", pFromCodeset) == 0) { /* check utf-8 str though utf-16 */ - MSG_DEBUG("Codeset [%s] check utf-8 type", pFromCodeset); if (((UINT8)pSrc[0] == 0xFF && (UINT8)pSrc[1] == 0xFE) || ((UINT8)pSrc[0] == 0xFE && (UINT8)pSrc[1] == 0xFF)) { - char *pTemp = (char *)calloc(1, srcLen + 1); if (pTemp == NULL) { MSG_DEBUG("fail to calloc"); @@ -92,11 +90,10 @@ bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeset, cons free(pTemp); pTemp = NULL; } - } } - pDest = g_convert (pSrc, srcLen, + pDest = g_convert(pSrc, srcLen, pToCodeSet, pFromCodeset, &bytes_read, &bytes_written, &error); diff --git a/plugin/mms_plugin/MmsPluginTransport.cpp b/plugin/mms_plugin/MmsPluginTransport.cpp index 5b79262..ae74d84 100755 --- a/plugin/mms_plugin/MmsPluginTransport.cpp +++ b/plugin/mms_plugin/MmsPluginTransport.cpp @@ -30,13 +30,11 @@ MmsPluginTransport *MmsPluginTransport::pInstance = NULL; MmsPluginTransport::MmsPluginTransport() { - } MmsPluginTransport::~MmsPluginTransport() { - } @@ -89,8 +87,7 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo) MSG_MMS_VLD_INFO("%d, MMS Receive Auto Start %s->%s, Success", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.addressList[0].addressVal, (msisdn == NULL)?"ME":msisdn); break; - case MSG_NOTIFYRESPIND_MMS: /* reject */ - { + case MSG_NOTIFYRESPIND_MMS: {/* reject */ MSG_DEBUG("######### MANUAL RETRIEVE : SEND NOTIFY RESPONSE IND"); reqItem.msgId = pReqInfo->msgInfo.msgId; reqItem.eMmsPduType = eMMS_NOTIFYRESP_IND; @@ -163,7 +160,5 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo) void MmsPluginTransport::cancelRequest(msg_request_id_t reqId) { - - } diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp index b7ce3ff..1762b17 100755 --- a/plugin/mms_plugin/MmsPluginUserAgent.cpp +++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp @@ -214,7 +214,6 @@ MmsPluginUaManager::MmsPluginUaManager() MmsPluginUaManager::~MmsPluginUaManager() { - } MmsPluginUaManager *MmsPluginUaManager::instance() @@ -232,7 +231,6 @@ void MmsPluginUaManager::start() MutexLocker lock(mx); if (!running) { - running = true; MsgThread::start(); } @@ -275,7 +273,6 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity) memset(&request_info, 0x00, sizeof(request_info)); if (qEntity->eHttpCmdType == eHTTP_CMD_POST_TRANSACTION) { - request_info.transaction_type = MMS_HTTP_TRANSACTION_TYPE_POST; request_info.url = home_url; @@ -423,7 +420,6 @@ void MmsPluginUaManager::run() MSG_DEBUG("\n\n =================== MMS Transaction Start ========================"); do { - MMS_NET_ERROR_T mms_net_status = submitHandler(&reqEntity); reqEntity.eMmsTransactionStatus = mms_net_status; if (mms_net_status != eMMS_SUCCESS) { @@ -461,18 +457,18 @@ void MmsPluginUaManager::run() } lock(); mmsTranQ.remove(reqEntity, compare_func_for_removal); -/* mmsTranQ.pop_front(); */ + /* mmsTranQ.pop_front(); */ unlock(); - //////// Waiting Conf ////////////////////// + /* Waiting Conf */ MMS_NET_ERROR_T networkErr; if ((networkErr = waitingConf(&reqEntity)) == eMMS_HTTP_CONF_SUCCESS) { bool bReportAllowed; - char retrievedFilePath[MAX_FULL_PATH_SIZE+1] = {0,}; + char retrievedFilePath[MAX_FULL_PATH_SIZE+1] = {0, }; /* process Http data */ try { - if (processReceivedData(reqEntity.msgId, reqEntity.pGetData, reqEntity.getDataLen, retrievedFilePath) == false) { + if (processReceivedData(reqEntity.msgId, reqEntity.pGetData, reqEntity.getDataLen, retrievedFilePath) == false) { MmsPluginEventHandler::instance()->handleMmsError(&reqEntity); break; } @@ -480,7 +476,6 @@ void MmsPluginUaManager::run() MSG_FATAL("%s", e.what()); MmsPluginEventHandler::instance()->handleMmsError(&reqEntity); break; - } catch (exception& e) { MSG_FATAL("%s", e.what()); MmsPluginEventHandler::instance()->handleMmsError(&reqEntity); @@ -601,7 +596,6 @@ void MmsPluginUaManager::run() MmsPluginEventHandler::instance()->handleMmsError(&reqEntity); break; } - } while (reqEntity.isCompleted == false); MSG_DEBUG("==== MMS Transaction Completed ====\n\n"); @@ -615,12 +609,10 @@ void MmsPluginUaManager::run() free(reqEntity.pGetData); reqEntity.pGetData = NULL; } - } /* Request CM Close */ cmAgent->close(); - } MSG_END(); @@ -677,7 +669,7 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv /* create temp file */ if (!MsgOpenCreateAndOverwriteFile(retrievedFilePath, (char *)pRcvdBody, rcvdBodyLen)) { - MSG_ERR( "_MmsUaInitMsgDecoder: creating temporary file failed(msgID=%d)\n", msgId); + MSG_ERR("_MmsUaInitMsgDecoder: creating temporary file failed(msgID=%d)\n", msgId); return false; } #if 1 diff --git a/plugin/mms_plugin/MmsPluginUtil.cpp b/plugin/mms_plugin/MmsPluginUtil.cpp index 1753b5f..795ab2d 100755 --- a/plugin/mms_plugin/MmsPluginUtil.cpp +++ b/plugin/mms_plugin/MmsPluginUtil.cpp @@ -119,7 +119,6 @@ bool MmsRemoveMarkup(const char *src, char *dst, int dstsize) srcptr = src; while (*srcptr != '\0' && ((dstptr-dst) < dstsize)) { - if (*srcptr == '<') state = M_IN; if (*srcptr == '>') state = M_OUT; @@ -150,7 +149,6 @@ bool MmsReplaceSpaceChar(char *pszText) char *spaceCharPtr = strchr(pszText, ' '); while (spaceCharPtr) { - *spaceCharPtr = '_'; spaceCharPtr = strchr(pszText, ' '); @@ -180,7 +178,6 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar) ptr = (const unsigned char*)szSrc; while (offset < srcLen && *(ptr) != '\0') { - b1 = *(ptr); if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */ @@ -204,7 +201,6 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar) } } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */ - offset += 3; if (offset > srcLen) @@ -221,7 +217,6 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar) } } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */ - offset += 4; if (offset > srcLen) @@ -273,7 +268,6 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar) ptr = (const unsigned char*)szSrc; while (offset < srcLen && *(ptr) != '\0') { - b1 = *(ptr); if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */ @@ -294,7 +288,6 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar) } } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */ - offset += 3; if (offset > srcLen) @@ -310,7 +303,6 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar) } } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */ - offset += 4; if (offset > srcLen) diff --git a/plugin/mms_plugin/include/MmsPluginCodecTypes.h b/plugin/mms_plugin/include/MmsPluginCodecTypes.h index 569b356..040cb52 100755 --- a/plugin/mms_plugin/include/MmsPluginCodecTypes.h +++ b/plugin/mms_plugin/include/MmsPluginCodecTypes.h @@ -380,7 +380,6 @@ typedef struct _MMS_ATTRIB_S { char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1]; MmsMsgMultiStatus *pMultiStatus; - } MmsAttrib; typedef struct _MsgContentParam { diff --git a/plugin/mms_plugin/include/MmsPluginComposer.h b/plugin/mms_plugin/include/MmsPluginComposer.h index f82ed7e..e0f304a 100755 --- a/plugin/mms_plugin/include/MmsPluginComposer.h +++ b/plugin/mms_plugin/include/MmsPluginComposer.h @@ -41,6 +41,5 @@ private: MmsPluginComposer(); ~MmsPluginComposer(); - }; #endif /* MMS_PLUGIN_COMPOSER_H */ diff --git a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h index a6e66b0..5ef109f 100755 --- a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h +++ b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h @@ -63,7 +63,6 @@ private: char *dns_address_list; Mutex mx; CndVar cv; - }; #endif /* MMS_PLUGIN_CONNMAN_H */ diff --git a/plugin/mms_plugin/include/MmsPluginDecode.h b/plugin/mms_plugin/include/MmsPluginDecode.h index e85057e..16368df 100755 --- a/plugin/mms_plugin/include/MmsPluginDecode.h +++ b/plugin/mms_plugin/include/MmsPluginDecode.h @@ -118,6 +118,5 @@ private: MmsPluginDecoder(); ~MmsPluginDecoder(); - }; #endif /* MMS_PLUGIN_DECODE_H */ diff --git a/plugin/mms_plugin/include/MmsPluginEncode.h b/plugin/mms_plugin/include/MmsPluginEncode.h index 3a7ee31..af1227f 100755 --- a/plugin/mms_plugin/include/MmsPluginEncode.h +++ b/plugin/mms_plugin/include/MmsPluginEncode.h @@ -45,6 +45,5 @@ private: MmsPluginEncoder(); ~MmsPluginEncoder(); - }; #endif /* MMS_PLUGIN_ENCODE_H */ diff --git a/plugin/mms_plugin/include/MmsPluginUserAgent.h b/plugin/mms_plugin/include/MmsPluginUserAgent.h index 8368d4a..4f2523a 100755 --- a/plugin/mms_plugin/include/MmsPluginUserAgent.h +++ b/plugin/mms_plugin/include/MmsPluginUserAgent.h @@ -31,10 +31,10 @@ class MmsPluginUaManager: public MsgThread { void getMmsPduData(mmsTranQEntity *qEntity); bool processReceivedData(int msgId, char *pRcvdBody, int rcvdBodyLen, char *retrievedFilePath); - void lock(){ mx.lock(); } - void unlock(){ mx.unlock(); } - void wait(){ cv.wait(mx.pMutex()); } - void signal(){ cv.signal(); } + void lock() { mx.lock(); } + void unlock() { mx.unlock(); } + void wait() { cv.wait(mx.pMutex()); } + void signal() { cv.signal(); } private: MmsPluginUaManager(); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp index d374c7c..e410f0c 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp @@ -44,8 +44,6 @@ SmsPluginCallback* SmsPluginCallback::pInstance = NULL; SmsPluginCallback::SmsPluginCallback() { - - } @@ -85,7 +83,6 @@ void SmsPluginCallback::registerEvent() void SmsPluginCallback::deRegisterEvent() { - } @@ -105,7 +102,6 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v MSG_FATAL("%s", e.what()); return; } - } @@ -353,7 +349,7 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_ if (sentStatus == SMS_NETWORK_SEND_FAIL) { int svc_type; tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type); - if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){ + if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) { sentStatus = SMS_NETWORK_SEND_PENDING; } } @@ -385,7 +381,6 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_ MSG_FATAL("%s", e.what()); return; } - } @@ -438,7 +433,6 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us if ((TelSmsCause_t)result != TAPI_NETTEXT_SUCCESS) bRet = false; SmsPluginSetting::instance()->setResultFromEvent(bRet); - } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp index b5fe7a7..90afbba 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp @@ -29,13 +29,11 @@ SmsPluginMsgCodec* SmsPluginMsgCodec::pInstance = NULL; SmsPluginMsgCodec::SmsPluginMsgCodec() { - } SmsPluginMsgCodec::~SmsPluginMsgCodec() { - } @@ -252,7 +250,7 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY; p_pkg_str[offset++] = 0x02; /* fixed */ - _copy_short_to_char(&p_pkg_str[offset],&(p_msg->svc_ctg)); + _copy_short_to_char(&p_pkg_str[offset], &(p_msg->svc_ctg)); } /* 3. Address */ @@ -357,7 +355,7 @@ int SmsPluginMsgCodec::encodeCBMsg(const sms_trans_broadcast_msg_s *p_msg, unsig /* 1. Service Category(Mandatory) */ p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY; p_pkg_str[offset++] = 0x02; - _copy_short_to_char(&p_pkg_str[offset],&p_msg->svc_ctg); + _copy_short_to_char(&p_pkg_str[offset], &p_msg->svc_ctg); /* 2. Bearer Data(Optional) */ @@ -467,7 +465,6 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c MSG_END(); return offset; - } @@ -589,7 +586,6 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s offset--; p_pkg_str[len_index] = offset - len_index - 1; - } /* 4. Language Indicator (Optional) */ @@ -683,7 +679,6 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg, offset--; p_pkg_str[len_index] = offset - len_index - 1; - } /* Sprint and Verizon issue */ /* 3. Validity Period */ @@ -1160,7 +1155,7 @@ void SmsPluginMsgCodec::decodeP2PDeliverMsg(const unsigned char *p_pkg_str, int if (p_del->enhanced_vmn.an_digit_mode) { p_del->enhanced_vmn.an_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f); p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++]; - for (int i=0; ienhanced_vmn.an_num_field; i++) { + for (int i = 0; i < p_del->enhanced_vmn.an_num_field; i++) { switch (tmp_str[tmp_off] & 0xf0) { case 0x10: case 0x20: @@ -1201,7 +1196,7 @@ void SmsPluginMsgCodec::decodeP2PDeliverMsg(const unsigned char *p_pkg_str, int if (p_del->enhanced_vmn.cli_digit_mode) { p_del->enhanced_vmn.cli_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f); p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++]; - for (int i=0; ienhanced_vmn.cli_num_field; i++) { + for (int i = 0; i < p_del->enhanced_vmn.cli_num_field; i++) { switch (tmp_str[tmp_off] & 0xf0) { case 0x10: case 0x20: @@ -1251,11 +1246,11 @@ void SmsPluginMsgCodec::decodeP2PDeliverMsg(const unsigned char *p_pkg_str, int p_del->enhanced_vmn_ack.num_delete_ack = tmp_str[offset] >> 5; p_del->enhanced_vmn_ack.num_play_ack = (tmp_str[offset] & 0x1c) >> 2; _shiftNBit_for_decode(tmp_str, tmp_len, 6); - for (int i=0; ienhanced_vmn_ack.num_delete_ack; i++) { + for (int i = 0; i < p_del->enhanced_vmn_ack.num_delete_ack; i++) { p_del->enhanced_vmn_ack.da_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1]; offset += 2; } - for (int i=0; ienhanced_vmn_ack.num_play_ack; i++) { + for (int i = 0; i < p_del->enhanced_vmn_ack.num_play_ack; i++) { p_del->enhanced_vmn_ack.pa_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1]; offset += 2; } @@ -2052,8 +2047,6 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk _shiftNBit_for_decode(tmp_str, pkg_len, 4); } } - - } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp index 37112bd..00df541 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp @@ -50,7 +50,6 @@ SmsPluginEventHandler::SmsPluginEventHandler() SmsPluginEventHandler::~SmsPluginEventHandler() { - } @@ -284,7 +283,7 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len); } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) { MSG_DEBUG("Encode Type = GSM7BIT"); - MSG_LANG_INFO_S langinfo = {0,}; + MSG_LANG_INFO_S langinfo = {0, }; MsgTextConvert *textCvt = MsgTextConvert::instance(); p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len, &langinfo); } else { @@ -411,7 +410,7 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_ p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len); } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) { MSG_DEBUG("Encode Type = GSM7BIT"); - MSG_LANG_INFO_S langinfo = {0,}; + MSG_LANG_INFO_S langinfo = {0, }; MsgTextConvert *textCvt = MsgTextConvert::instance(); p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len, &langinfo); } else { @@ -426,13 +425,11 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_ void SmsPluginEventHandler::convertAckMsgToMsgInfo(sms_telesvc_deliver_ack_s *p_deliver, MSG_MESSAGE_INFO_S *p_msg_info) { - } void SmsPluginEventHandler::convertReportMsgToMsgInfo(sms_telesvc_report_s *p_deliver, MSG_MESSAGE_INFO_S *p_msg_info) { - } @@ -454,7 +451,6 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus) if (sentInfo.bLast == true || NetStatus != MSG_NETWORK_SEND_SUCCESS) { /* Update Msg Status */ if (sentInfo.reqInfo.msgInfo.msgPort.valid == false) { - sentInfo.reqInfo.msgInfo.networkStatus = NetStatus; if (NetStatus == MSG_NETWORK_SEND_SUCCESS) { @@ -491,7 +487,6 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus) void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg) { - /* Make MSG_MESSAGE_INFO_S */ MSG_MESSAGE_INFO_S msgInfo; @@ -594,7 +589,6 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg) /* Handling of Fail Case ?? */ /* SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS); */ } else { /* SMS Deliver */ - /* Add message to DB */ if (msgInfo.msgPort.valid == false) { if (p_p2p_msg->telesvc_id != SMS_TRANS_TELESVC_VMN_95) { @@ -726,7 +720,6 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_ /* Callback to MSG FW */ if (err == MSG_SUCCESS) { - #if 1 MSG_CB_MSG_S cbOutMsg = {0, }; bool is_duplicate = false; @@ -760,7 +753,7 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_ /* cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData; */ memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText)); - cbOutMsg.cbTextLen= msgInfo.dataSize; + cbOutMsg.cbTextLen = msgInfo.dataSize; memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type)); /* memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3); */ @@ -820,7 +813,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg) msg.totalSeg = p_p2p_msg->telesvc_msg.data.deliver.user_data.user_data[1]; msg.segNum = p_p2p_msg->telesvc_msg.data.deliver.user_data.user_data[2]; - char tmpUserText[SMS_MAX_USER_DATA_LEN+1] = {0,}; + char tmpUserText[SMS_MAX_USER_DATA_LEN+1] = {0, }; sms_telesvc_userdata_s tmpUserData; memset(&tmpUserData, 0x00, sizeof(sms_telesvc_userdata_s)); @@ -844,7 +837,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg) unique_ptr dataBuf(&pUserData, unique_ptr_deleter); unique_ptr dataBuf1(&pTmpUserData, unique_ptr_deleter); - MSG_MESSAGE_INFO_S msgInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; msgInfo.addressList = NULL; unique_ptr addressListBuf(&msgInfo.addressList, unique_ptr_deleter); @@ -1095,7 +1088,6 @@ int SmsPluginEventHandler::MakeWapUserData(unsigned short msgId, char **ppTotalD } return totalSize; - } @@ -1111,7 +1103,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms syncMLData.pushBodyLen = PushBodyLen; memcpy(syncMLData.pushBody, pPushBody, PushBodyLen); - syncMLData.wspHeaderLen= WspHeaderLen; + syncMLData.wspHeaderLen = WspHeaderLen; memcpy(syncMLData.wspHeader, pWspHeader, WspHeaderLen); /* Callback to MSG FW */ @@ -1175,7 +1167,7 @@ bool SmsPluginEventHandler::checkCbOpt(sms_trans_svc_ctg_t svc_ctg) if (svc_ctg >= SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL && svc_ctg <= SMS_TRANS_SVC_CTG_CMAS_TEST) { bool bActivate = false; short Category = 0; - MSG_CB_CHANNEL_S cbChannelInfo = {0,}; + MSG_CB_CHANNEL_S cbChannelInfo = {0, }; msg_error_t err = MSG_SUCCESS; MsgDbHandler *dbHandle = getDbHandle(); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp index fb4d7e2..79c53ec 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp @@ -90,7 +90,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) pPluginHandle->pfAddMessage = SmsPlgAddMessage; MSG_DEBUG("SMS plugin: create handler OK"); - MSG_DEBUG ("SMS plugin %p", pPluginHandle); + MSG_DEBUG("SMS plugin %p", pPluginHandle); } return MSG_SUCCESS; @@ -189,7 +189,6 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo) /* Add Submit SMS into DB */ if (pReqInfo->msgInfo.msgId == 0) { if (pReqInfo->msgInfo.msgPort.valid == false) { - err = SmsPluginStorage::instance()->checkMessage(&(pReqInfo->msgInfo)); if (err != MSG_SUCCESS) { @@ -268,7 +267,6 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_id_t SimMsgId) msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error) { - int tapiRet = TAPI_API_SUCCESS; int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE; diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp index 9f9cb0f..6b35694 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp @@ -28,15 +28,11 @@ SmsPluginParamCodec* SmsPluginParamCodec::pInstance = NULL; SmsPluginParamCodec::SmsPluginParamCodec() { - - } SmsPluginParamCodec::~SmsPluginParamCodec() { - - } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp index ef594c5..69c6347 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp @@ -66,8 +66,6 @@ SmsPluginSetting::SmsPluginSetting() SmsPluginSetting::~SmsPluginSetting() { - - } @@ -184,7 +182,7 @@ void SmsPluginSetting::initConfigData() if (simStatus != MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("simStatus == [%d]", simStatus); */ - MSG_CBMSG_OPT_S cbMsgOpt = {0,}; + MSG_CBMSG_OPT_S cbMsgOpt = {0, }; if (getCbConfig(&cbMsgOpt) == true) { err = addCbOpt(&cbMsgOpt); @@ -237,7 +235,6 @@ void SmsPluginSetting::SimRefreshCb() } pthread_detach(thd); - } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp index 582650c..faa651b 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp @@ -38,13 +38,11 @@ SmsPluginStorage* SmsPluginStorage::pInstance = NULL; SmsPluginStorage::SmsPluginStorage() { - } SmsPluginStorage::~SmsPluginStorage() { - } @@ -87,7 +85,6 @@ msg_error_t SmsPluginStorage::insertMsgRef(MSG_MESSAGE_INFO_S *pMsg, unsigned ch MSG_END(); return MSG_SUCCESS; - } @@ -251,7 +248,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo) err = addClass2Message(pMsgInfo); } */ - else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS){ + else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { err = MSG_SUCCESS; } return err; @@ -313,7 +310,6 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo) dbHandle->beginTrans(); if (pMsgInfo->nAddressCnt > 0) { - err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); if (err != MSG_SUCCESS) { @@ -532,7 +528,6 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo) err = MsgStoCheckMsgCntFull(dbHandle, &(pMsgInfo->msgType), pMsgInfo->folderId); if (err != MSG_SUCCESS) { - if (err == MSG_ERR_MESSAGE_COUNT_FULL) { bool bAutoErase = false; @@ -581,13 +576,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou if (err == MSG_ERR_DB_NORECORD) { dbHandle->freeTable(); return MSG_SUCCESS; - } else if ( err != MSG_SUCCESS) { + } else if (err != MSG_SUCCESS) { dbHandle->freeTable(); return err; } - char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0,}; - char appId[MAX_WAPPUSH_ID_LEN + 1] = {0,}; + char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0, }; + char appId[MAX_WAPPUSH_ID_LEN + 1] = {0, }; int appcode = 0, default_appcode = 0; bool found = false; char *_content_type = NULL, *_app_id = NULL; @@ -647,7 +642,7 @@ msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode) std::list::iterator it = pushAppInfoList.begin(); int count = 0; for (; it != pushAppInfoList.end(); it++) { - if (index == count){ + if (index == count) { *appcode = it->appcode; break; } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp index 25b8b27..e1917f5 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp @@ -58,7 +58,6 @@ SmsPluginTransport::SmsPluginTransport() SmsPluginTransport::~SmsPluginTransport() { - } @@ -98,8 +97,7 @@ unsigned char SmsPluginTransport::getSubmitMsgId() void SmsPluginTransport::convertMsgInfoToTelesvcMsg(const MSG_MESSAGE_INFO_S *pMsgInfo, sms_trans_msg_s *pTransMsg) { switch (pTransMsg->type) { - case SMS_TRANS_P2P_MSG: - { + case SMS_TRANS_P2P_MSG: { MSG_DEBUG("Convert MSG_MESSAGE_INFO_S data to SMS_TRANS_MSG_S data."); sms_trans_p2p_msg_s *pPtpMsg = (sms_trans_p2p_msg_s *)&(pTransMsg->data.p2p_msg); @@ -115,7 +113,6 @@ void SmsPluginTransport::convertMsgInfoToTelesvcMsg(const MSG_MESSAGE_INFO_S *pM void SmsPluginTransport::convertMsgInfoToPtp(const MSG_MESSAGE_INFO_S *pMsgInfo, sms_trans_p2p_msg_s *pPtpMsg) { - /* 1. Set Teleservice ID */ pPtpMsg->telesvc_id = SMS_TRANS_TELESVC_CMT_95; @@ -151,7 +148,6 @@ void SmsPluginTransport::convertMsgInfoToPtp(const MSG_MESSAGE_INFO_S *pMsgInfo, default: break; } - } @@ -248,7 +244,6 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn /* 13. Set Service category program data */ /* TODO */ - } @@ -300,7 +295,7 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo) convertMsgInfoToTelesvcMsg(&pReqInfo->msgInfo, &trans_msg); /* encode msg data */ - unsigned char tel_sms_data[TAPI_NETTEXT_SMDATA_SIZE_MAX+1] = {0,}; + unsigned char tel_sms_data[TAPI_NETTEXT_SMDATA_SIZE_MAX+1] = {0, }; tapi_data_pkg.MsgLength = SmsPluginMsgCodec::instance()->encodeMsg(&trans_msg, tel_sms_data); @@ -380,7 +375,6 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo) MsgInsertTicker("Unable to send message. It will be sent when service available.", SMS_MESSAGE_SENDING_PENDING, true, 0); else MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, pReqInfo->msgInfo.msgId); - } _RETURN_FUNC : @@ -429,7 +423,6 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######"); else MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet); - } } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) { @@ -460,7 +453,6 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s } else { cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY; response = TAPI_NETTEXT_SIM_FULL; - } memcpy(&(trans_msg.data.ack_msg.cause_code), &(cause_code), sizeof(sms_trans_cause_code_s)); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp index 1b4f52f..ff70fa6 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp @@ -33,7 +33,6 @@ SmsPluginUAManager::SmsPluginUAManager() : mx(), cv() SmsPluginUAManager::~SmsPluginUAManager() { - } @@ -86,7 +85,7 @@ void SmsPluginUAManager::run() void SmsPluginUAManager::addReqEntity(sms_request_info_s *request) { - sms_request_info_s reqTmp = {0,}; + sms_request_info_s reqTmp = {0, }; memcpy(&reqTmp, request, sizeof(sms_request_info_s)); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp index aa1fb9f..32147a1 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp @@ -30,7 +30,7 @@ #include #endif -static unsigned short wapPushPortList [] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F}; +static unsigned short wapPushPortList[] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F}; char gWapCodeBufferLeft[WSP_CODE_BUFFER_LEFT_LEN_MAX]; char gWapCodeBufferRight[WSP_CODE_BUFFER_RIGHT_LEN_MAX]; @@ -216,7 +216,7 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = { { (char*)"application/vnd.wap.multipart.byteranges", 0x25 }, { (char*)"application/vnd.wap.multipart.alternative", 0x26 }, { (char*)"application/xml", 0x27 }, - { (char*)"text/xml",0x28 }, + { (char*)"text/xml", 0x28 }, { (char*)"application/vnd.wap.wbxml", 0x29 }, { (char*)"application/x-x968-cross-cert", 0x2a }, { (char*)"application/x-x968-ca-cert", 0x2b }, @@ -605,10 +605,10 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] = { const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = { - {(char*)"NETWPIN",0x00}, - {(char*)"USERPIN",0x01}, - {(char*)"USERNETWPIN",0x02}, - {(char*)"USERPINMAC",0x03} + {(char*)"NETWPIN", 0x00}, + {(char*)"USERPIN", 0x01}, + {(char*)"USERNETWPIN", 0x02}, + {(char*)"USERPINMAC", 0x03} }; @@ -665,7 +665,6 @@ SmsPluginWapPushHandler::SmsPluginWapPushHandler() SmsPluginWapPushHandler::~SmsPluginWapPushHandler() { - } @@ -709,7 +708,6 @@ sms_wap_app_code_t SmsPluginWapPushHandler::getAppCode(const char *pPushHeader) MSG_DEBUG("Application Count [%d]", appCount); for (int i = 0; i < appCount; i++) { - header = (unsigned char*)strcasestr(pPushHeader, pushDefaultApplication[i].pContentType); if (header != NULL) { @@ -789,7 +787,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi /* pass PDU type */ iPDU++; - pushHeaderLen = wspRetriveUintvarDecode( pPDUTypeData, &iPDU ); + pushHeaderLen = wspRetriveUintvarDecode(pPDUTypeData, &iPDU); MSG_DEBUG("PDUTypeDataLen [%d]", PDUTypeDataLen); MSG_DEBUG("pushHeaderLen [%d]", pushHeaderLen); @@ -800,7 +798,6 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi MSG_DEBUG("wspBodyLen [%d]", wspBodyLen); if (wspHeaderLen > 0) { - pWspHeader = new char[wspHeaderLen]; if (pWspHeader == NULL) { @@ -831,7 +828,6 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi wspBodyLen = PDUTypeDataLen - wspHeaderLen; if (wspBodyLen > 0) { - pWspBody = new char[wspBodyLen]; if (pWspBody == NULL) { @@ -1012,8 +1008,7 @@ static void launchProcessByAppcode(int appcode) case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML: case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS: case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS: - case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION: - { + case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION: { connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (error) { MSG_DEBUG("Connecting to system bus failed: %s\n", error->message); @@ -1036,7 +1031,7 @@ static void launchProcessByAppcode(int appcode) MSG_DEBUG("Connecting to system bus failed: %s\n", error->message); goto _DBUS_ERROR; } - dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL, + dbus_proxy_service = g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.tizen.omadmservice", "/org/tizen/omadmservice", "org.tizen.omadmservice", NULL, &error); if (error) { @@ -1057,8 +1052,7 @@ static void launchProcessByAppcode(int appcode) } break; case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION: - case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML: - { + case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML: { connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (error) { MSG_DEBUG("Connecting to system bus failed: %s\n", error->message); @@ -1135,8 +1129,8 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu msg_error_t err = MSG_SUCCESS; int pushEvt_cnt = 0; - char app_id[MAX_WAPPUSH_ID_LEN] = {0,}; - char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN] = {0,}; + char app_id[MAX_WAPPUSH_ID_LEN] = {0, }; + char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN] = {0, }; SmsPluginStorage *storageHandler = SmsPluginStorage::instance(); err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id, sizeof(app_id), content_type, sizeof(content_type)); @@ -1147,7 +1141,6 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu } for (int i = 0; i < pushEvt_cnt; ++i) { - /* check Push message receive setting */ bool bPushRecv = false; int appcode = 0; @@ -1517,32 +1510,32 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen, msg_error_t err = MSG_SUCCESS; if (pPushBody == NULL) { - MSG_DEBUG("pPushBody is NULL \n" ); + MSG_DEBUG("pPushBody is NULL \n"); return; } getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText); if (xmlDoc == NULL) { - MSG_DEBUG("xmlDoc is NULL \n" ); + MSG_DEBUG("xmlDoc is NULL \n"); return; } topNode = xmlDocGetRootElement(xmlDoc); if (topNode == NULL) { - MSG_DEBUG("Empty Document." ); + MSG_DEBUG("Empty Document."); xmlFreeDoc(xmlDoc); return; } else { - MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name ); + MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n", topNode->name); } indNode = topNode; while (indNode != NULL) { if (!xmlStrcmp(indNode->name, (const xmlChar*) "sl")) { - MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name); + MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); break; } @@ -1648,20 +1641,20 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, MSG_DEBUG("Enter handleCOMessage"); if (pPushBody == NULL) { - MSG_DEBUG("pPushBody is NULL \n" ); + MSG_DEBUG("pPushBody is NULL \n"); return; } getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText); if (xmlDoc == NULL) { - MSG_DEBUG("xmlDoc is NULL \n" ); + MSG_DEBUG("xmlDoc is NULL \n"); return; } topNode = xmlDocGetRootElement(xmlDoc); if (topNode == NULL) { - MSG_DEBUG("Warning:Empty Document\n" ); + MSG_DEBUG("Warning:Empty Document\n"); xmlFreeDoc(xmlDoc); return; } @@ -1669,7 +1662,6 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, indNode = topNode->xmlChildrenNode; while (indNode != NULL) { - xmlChar* tmpUrl = NULL; if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) { MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); @@ -1684,7 +1676,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, MSG_DEBUG("NO href value from the xmlDoc\n"); } } else if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_SVC)) { - MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name); + MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI); if (tmpUrl != NULL) { @@ -1869,7 +1861,6 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo) pMsgInfo->msgPort.valid = false; pMsgInfo->msgPort.dstPort = 0; pMsgInfo->msgPort.srcPort = 0; - } @@ -1904,7 +1895,6 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod *pXmlDoc = xmlParseMemory((char*)xmldata, AcStrlen((char*)xmldata)); } - } @@ -1919,7 +1909,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) memset(&timeStruct, 0x00, sizeof(struct tm)); /* check pDate */ - if (AcStrlen(pDate)<20) + if (AcStrlen(pDate) < 20) return 0; MSG_DEBUG("pDate [%s]", pDate); @@ -1930,7 +1920,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_year = (atoi( tmpBuf)-1900); + timeStruct.tm_year = (atoi(tmpBuf)-1900); /* Month */ for (i = 0; i < 2; i++) { @@ -1938,7 +1928,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_mon = (atoi( tmpBuf) - 1); + timeStruct.tm_mon = (atoi(tmpBuf) - 1); /* Date */ for (i = 0; i < 2; i++) { @@ -1946,7 +1936,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_mday = atoi( tmpBuf); + timeStruct.tm_mday = atoi(tmpBuf); /* Hours */ for (i = 0; i < 2; i++) { @@ -1954,7 +1944,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_hour = atoi( tmpBuf); + timeStruct.tm_hour = atoi(tmpBuf); /* Minites */ for (i = 0; i < 2; i++) { @@ -1962,7 +1952,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_min = atoi( tmpBuf); + timeStruct.tm_min = atoi(tmpBuf); /* Seconds */ for (i = 0; i < 2; i++) { @@ -1970,7 +1960,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) } tmpBuf[i] = '\0'; index++; - timeStruct.tm_sec = atoi( tmpBuf); + timeStruct.tm_sec = atoi(tmpBuf); nTimeInSec = mktime(&timeStruct); @@ -1988,33 +1978,32 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio } /* compare with signal-none. */ - comp = g_strcmp0( "signal-none", pAction ); + comp = g_strcmp0("signal-none", pAction); if (comp == 0) return MSG_PUSH_SI_ACTION_SIGNAL_NONE; /* compare with signal-low. */ - comp = g_strcmp0( "signal-low", pAction ); + comp = g_strcmp0("signal-low", pAction); if (comp == 0) return MSG_PUSH_SI_ACTION_SIGNAL_LOW; /* compare with signal-medium. */ - comp = g_strcmp0( "signal-medium", pAction ); + comp = g_strcmp0("signal-medium", pAction); if (comp == 0) return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM; /* compare with signal-high. */ - comp = g_strcmp0( "signal-high", pAction ); + comp = g_strcmp0("signal-high", pAction); if (comp == 0) return MSG_PUSH_SI_ACTION_SIGNAL_HIGH; /* compare with delete. */ - comp = g_strcmp0( "delete", pAction ); + comp = g_strcmp0("delete", pAction); if (comp == 0) return MSG_PUSH_SI_ACTION_DELETE; /* signal-medium is default action value. */ return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM; - } @@ -2023,60 +2012,59 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio int comp = 0; if (pAction == NULL) { - MSG_DEBUG( "MSG_DEBUG is NULL. Setting to default action type.\n" ); + MSG_DEBUG("MSG_DEBUG is NULL. Setting to default action type.\n"); return MSG_PUSH_SL_ACTION_EXECUTE_LOW; } /* compare pSrcStr with execute-low. */ - comp = g_strcmp0( "execute-low", pAction ); + comp = g_strcmp0("execute-low", pAction); if (comp == 0) return MSG_PUSH_SL_ACTION_EXECUTE_LOW; /* compare pSrcStr with execute-high. */ - comp = g_strcmp0( "execute-high", pAction ); + comp = g_strcmp0("execute-high", pAction); if (comp == 0) return MSG_PUSH_SL_ACTION_EXECUTE_HIGH; /* compare pSrcStr with cache. */ - comp = g_strcmp0( "cache", pAction ); + comp = g_strcmp0("cache", pAction); if (comp == 0) return MSG_PUSH_SL_ACTION_CACHE; /* default SL action value is execute-low. */ return MSG_PUSH_SL_ACTION_EXECUTE_LOW; - } -unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer ) +unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode(unsigned char* sourceData, unsigned long* currentPointer) { unsigned long i = 0; unsigned long decodedValue; while (sourceData[*currentPointer +i] >= 0x80) i++; - decodedValue = wspDecodeUintvar( i+1, sourceData + *currentPointer ); + decodedValue = wspDecodeUintvar(i+1, sourceData + *currentPointer); *currentPointer = *currentPointer + i + 1; - MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue ); + MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n", decodedValue); return decodedValue; } -unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar ) +unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar) { unsigned long i; unsigned long decodedUintvar = 0; for (i = 0 ; i < length; i++) { - decodedUintvar = decodedUintvar + ( wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f )); + decodedUintvar = decodedUintvar + (wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f)); } return decodedUintvar; } -void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader) +void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader) { unsigned long iField; bool continueField = FALSE; @@ -2097,37 +2085,37 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un /* outTemper is Decoded Headers. temper is Single Decoded Header. */ - if (NULL == ( outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) { - MSG_DEBUG("outTemper Memory allocation is failed.\n" ); + if (NULL == (outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) { + MSG_DEBUG("outTemper Memory allocation is failed.\n"); return; } memset(outTemper, 0, (WSP_STANDARD_STR_LEN_MAX * 5)); currentLength = WSP_STANDARD_STR_LEN_MAX; - MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n" ); + MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n"); int loop; char szBuf[64]; szBuf[0] = 0x00; - MSG_DEBUG("wspDecodeHeader: RAW data \n" ); - for (loop = 0 ; loop<(int)encodedHeaderLen; loop++) { + MSG_DEBUG("wspDecodeHeader: RAW data \n"); + for (loop = 0 ; loop < (int)encodedHeaderLen; loop++) { char szTempBuf[5]; szTempBuf[0] = 0x00; - snprintf( szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop] ); + snprintf(szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop]); - if (AcStrlen( szBuf ) + 7 < 64) { - strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 ); + if (AcStrlen(szBuf) + 7 < 64) { + strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1); } else { - strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 ); + strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1); MSG_DEBUG("[%s]", szBuf); szBuf[0] = 0x00; - strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 ); + strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1); } } - strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 ); + strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1); MSG_DEBUG("[%s]", szBuf); - MSG_DEBUG("fContentType=%d \n",fContentType ); + MSG_DEBUG("fContentType=%d \n", fContentType); /* operation for content-type */ /* makes psuedo- content-type fieldcode */ /* content - type is processed with header. But it's come without field code. So existence of fContentType can decide adding content type header field code whether ContentType + general header is or not. */ @@ -2135,19 +2123,19 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un if (fContentType) { encodedHeader = new char[ encodedHeaderLen + 1 ]; if (encodedHeader == NULL) { - MSG_DEBUG("encodedHeader Memory allocation is failed.\n" ); + MSG_DEBUG("encodedHeader Memory allocation is failed.\n"); return; } encodedHeader[0] = 0x91; - memcpy( encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen ); + memcpy(encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen); } else { encodedHeader = new char[ encodedHeaderLen ]; if (encodedHeader == NULL) { - MSG_DEBUG("encodedHeader Memory allocation is failed.\n" ); + MSG_DEBUG("encodedHeader Memory allocation is failed.\n"); return; } - memcpy( encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen ); + memcpy(encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen); } /* Is it reacehd end of header? */ @@ -2157,7 +2145,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un temper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ]; if (temper == NULL) { - MSG_DEBUG("temper Memory allocation is failed.\n" ); + MSG_DEBUG("temper Memory allocation is failed.\n"); return; } memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5)); @@ -2168,714 +2156,686 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un /* this section presents header code page shifting procedure This part can be implemented by future request. - if (track == 0x 7f ) + if (track == 0x 7f) */ track = encodedHeader[iEncodedHeader]; if (track == 0x00) { - MSG_DEBUG("WspLDecodeHeader: fieldcode is 0 \n" ); + MSG_DEBUG("WspLDecodeHeader: fieldcode is 0 \n"); strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1); fieldCode = 0xff; iEncodedHeader++; - } else if (( track > 0 ) && ( track < 0x20 )) { + } else if ((track > 0) && (track < 0x20)) { iEncodedHeader++; - } else if (( track < 0x7f ) && ( track > 0x1f )) { /* In this case, first byte is normal string. So it's considered to unknown header. */ + } else if ((track < 0x7f) && (track > 0x1f)) { /* In this case, first byte is normal string. So it's considered to unknown header. */ unsigned char* fieldName = (unsigned char*)gWapCodeBufferLeft; unsigned char* fieldValue = (unsigned char*)gWapCodeBufferRight; - strncpy( (char*)fieldName, (char*)(encodedHeader + iEncodedHeader ),WSP_CODE_BUFFER_LEFT_LEN_MAX-1); + strncpy((char*)fieldName, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_LEFT_LEN_MAX-1); fieldName[WSP_CODE_BUFFER_LEFT_LEN_MAX-1] = '\0'; - iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldName ) + 1; - strncpy( (char*)fieldValue, (char*)(encodedHeader + iEncodedHeader ), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1); + iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldName) + 1; + strncpy((char*)fieldValue, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1); fieldValue[WSP_CODE_BUFFER_RIGHT_LEN_MAX-1] = '\0'; - iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldValue ) + 1; + iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldValue) + 1; - strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); /* this means 'don't process anymore.' */ fieldCode = 0xff; } else if (track > 0x7f) { /* In case of first byte is field code, else case is error. */ - - /*if (( track & 0x7f ) <= wspHeaderFieldCount ) */ - { - + /*if ((track & 0x7f) <= wspHeaderFieldCount) { */ unsigned long fieldValueLen = encodedHeader[iEncodedHeader + 1]; unsigned char fieldValue[1275]; fieldCode = track & 0x7f; /* - if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) { - dprint( DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5] ); + if ((fieldValueLen == 0) || (fieldValueLen == 0x80)) { + dprint(DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5]); } */ memset(fieldValue, 0, 1275); - { - /* add field name */ - /* This continueField flag show whether previous field code and current field code are same or not. If it's same, there are some sequential display effect by omitting field name addition process. The reason why it should be do that can be found in encoding example of spec. */ - if (!continueField) { - strncat( (char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat( (char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - continueField = FALSE; - } - /* field value is string */ - /* In this case, it just copy field value. */ - if (( fieldValueLen > LENGTH_QUOTE ) && ( fieldValueLen < 0x80 )) { + /* add field name */ + /* This continueField flag show whether previous field code and current field code are same or not. If it's same, there are some sequential display effect by omitting field name addition process. The reason why it should be do that can be found in encoding example of spec. */ + if (!continueField) { + strncat((char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + continueField = FALSE; + } - /* string field value should be NULL terminated */ - strncat( (char*)temper, (char*)(encodedHeader + iEncodedHeader + 1 ), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - - iEncodedHeader = iEncodedHeader + AcStrlen( (char*)encodedHeader + iEncodedHeader + 1 ) + 2; - fieldCode = 0xff; - } - /* first field value is length */ - /* If first byte of field value is length value, allocate field value by the length. - In field value, data is - 1D 03 8F 24 24 - Then 8F 24 24 is field value. - 1D 1F 33.... - Then allocate 33H for FieldValue. - 1D 8F - Then 8F - 1D 'Hi man!' Like 00, if string is come, then process without calculating field value. - 1D 8F 24 24 - In this case, original data is wrong. - If accept-charset: ISO-10646-ucs-2;Q=0.7 is - 01 03 03 E8 47 - 01 - field code - 03 - field value length - 03 E8 47 - field value - it's decoded by above value. - */ - if (fieldValueLen < 0x20) { - - if (fieldValueLen == LENGTH_QUOTE) { - - /* field length is encoded in UINTVAR */ - unsigned long uintvarLen = 0; - fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen ); - memcpy( fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen ); - iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2; + /* field value is string */ + /* In this case, it just copy field value. */ + if ((fieldValueLen > LENGTH_QUOTE) && (fieldValueLen < 0x80)) { + /* string field value should be NULL terminated */ + strncat((char*)temper, (char*)(encodedHeader + iEncodedHeader + 1), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + iEncodedHeader = iEncodedHeader + AcStrlen((char*)encodedHeader + iEncodedHeader + 1) + 2; + fieldCode = 0xff; + } + /* first field value is length */ + /* If first byte of field value is length value, allocate field value by the length. + In field value, data is + 1D 03 8F 24 24 - Then 8F 24 24 is field value. + 1D 1F 33.... - Then allocate 33H for FieldValue. + 1D 8F - Then 8F + 1D 'Hi man!' Like 00, if string is come, then process without calculating field value. + 1D 8F 24 24 - In this case, original data is wrong. + If accept-charset: ISO-10646-ucs-2;Q=0.7 is + 01 03 03 E8 47 + 01 - field code + 03 - field value length + 03 E8 47 - field value + it's decoded by above value. + */ + if (fieldValueLen < 0x20) { + if (fieldValueLen == LENGTH_QUOTE) { + /* field length is encoded in UINTVAR */ + unsigned long uintvarLen = 0; + fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen); + memcpy(fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen); + iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2; + + } else { + if (fieldValueLen == 1) { + /* field value is one byte integer over 0x80 */ + /* make it two byte integer */ + fieldValue[0] = 0x00; + memcpy(fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen); + fieldValueLen = 2; + iEncodedHeader = iEncodedHeader + 1 + 2; } else { - - if (fieldValueLen == 1) { - /* field value is one byte integer over 0x80 */ - /* make it two byte integer */ - fieldValue[0] = 0x00; - memcpy( fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen); - fieldValueLen = 2; - iEncodedHeader = iEncodedHeader + 1 + 2; - } else { - memcpy( fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen ); - fieldValue[fieldValueLen] = 0; - iEncodedHeader = iEncodedHeader + fieldValueLen + 2; - if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) { - MSG_DEBUG("%X \n", encodedHeader[iEncodedHeader] ); - } + memcpy(fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen); + fieldValue[fieldValueLen] = 0; + iEncodedHeader = iEncodedHeader + fieldValueLen + 2; + if ((fieldValueLen == 0) || (fieldValueLen == 0x80)) { + MSG_DEBUG("%X \n", encodedHeader[iEncodedHeader]); } } } - /* field value is single encoded */ - if (fieldValueLen > 0x7f) { - fieldValue[0] = encodedHeader[iEncodedHeader + 1]; - fieldValueLen = 1; - iEncodedHeader = iEncodedHeader + 2; - } - /* processing normal pre-defined field decoding */ + } - MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode ); - MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen ); + /* field value is single encoded */ + if (fieldValueLen > 0x7f) { + fieldValue[0] = encodedHeader[iEncodedHeader + 1]; + fieldValueLen = 1; + iEncodedHeader = iEncodedHeader + 2; + } + /* processing normal pre-defined field decoding */ - if (( fieldCode > wspHeaderFieldCount ) && ( fieldCode != 0xff )) { - MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track ); - strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1); - fieldCode = 0xff; - } + MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode); + MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen); + if ((fieldCode > wspHeaderFieldCount) && (fieldCode != 0xff)) { + MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track); + strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1); + fieldCode = 0xff; + } - switch (fieldCode) { - /* accept charset */ - /* It's normal way of field process. */ - case 0x01: - { - unsigned long i = 0; - unsigned long code; - - /* Case of length of charset greater than 1 are two thigins. - 1. code length of charset is greater than 1. - 2. It include parameter. - 3. Or both of two - */ - if (1 != fieldValueLen) { - code = wspHeaderDecodeInteger( fieldValue ); - /* Calculate iField. */ - if (fieldValue[0] < 0x80 ) - iField = fieldValue[0]; - else - iField = 1; - - while ( wspCharset[i].charsetCode != code ) - i++; - strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - /* If parameter exist */ - if (iField < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, ¶m); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - } else { - code = fieldValue[0] & 0x7f; - while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff )) i++; - strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + switch (fieldCode) { + /* accept charset */ + /* It's normal way of field process. */ + case 0x01: { + unsigned long i = 0; + unsigned long code; + + /* Case of length of charset greater than 1 are two thigins. + 1. code length of charset is greater than 1. + 2. It include parameter. + 3. Or both of two + */ + if (1 != fieldValueLen) { + code = wspHeaderDecodeInteger(fieldValue); + /* Calculate iField. */ + if (fieldValue[0] < 0x80) + iField = fieldValue[0]; + else + iField = 1; + + while (wspCharset[i].charsetCode != code) + i++; + strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + /* If parameter exist */ + if (iField < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeQValue(fieldValueLen - iField, fieldValue + iField, ¶m); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } + } else { + code = fieldValue[0] & 0x7f; + while ((wspCharset[i].charsetCode != code) && (wspCharset[i].charsetCode != 0xffff)) i++; + strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + } + break; + + /* type encoding */ + /* Like below routine, Same decoding routine process together. */ + /* Accept-encoding */ + case 0x02: + /* content-encoding */ + case 0x0b: { + int integerValue; + + integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + if (integerValue > 2) { + MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n"); + break; } + strncat((char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } break; - - /* type encoding */ - /* Like below routine, Same decoding routine process together. */ - /* Accept-encoding */ - case 0x02: - /* content-encoding */ - case 0x0b: - { - int integerValue; - - integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen ); - if (integerValue > 2) { - MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n"); - break; - } - strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + /* contents type decoder */ + /* accept */ + case 0x00: + /* content-type */ + case 0x11: { + unsigned long contentsTypeCode; + unsigned long i = 0; + /* encoded content type length body */ + unsigned long tempLen; + MSG_DEBUG("fieldValueLen: %d", fieldValueLen); + + /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */ + if (0 == fieldValueLen) { + strncat((char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + break; + } + /* 01 AE --> 00 AE --> AE*/ + if (fieldValueLen == 2 && fieldValue[0] == 0) { + memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); + MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); } - break; - /* contents type decoder */ - /* accept */ - case 0x00: - /* content-type */ - case 0x11: - { - unsigned long contentsTypeCode; - unsigned long i = 0; - /* encoded content type length body */ - unsigned long tempLen; - MSG_DEBUG("fieldValueLen: %d", fieldValueLen); - - /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */ - if (0 == fieldValueLen) { - strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - break; - } - /* 01 AE --> 00 AE --> AE*/ - if (fieldValueLen == 2 && fieldValue[0] == 0) { - memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 ); - MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" ); - } - - if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) { - if (fieldValue[0] >= 0x80) { - tempLen = 1; - } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /* 06 05 02 03 0A AF 89 */ - fieldValue[3] = fieldValue[2]; - fieldValue[2] = fieldValue[1]; - fieldValue[1] = fieldValue[0]; - fieldValue[0] = 0x02; - tempLen = 2; - fieldValueLen = 3; - MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" ); - } else { - tempLen = fieldValue[0]; /* 06 06 03 02 03 16 AF 88 */ - } - - if (tempLen == 1) { - char* szExtendedContent; - - contentsTypeCode = fieldValue[0] & 0x7f; - while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++; - /* If specified content type doesn't exist */ - if (i < wspContentsTypeCount) - strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + if ((fieldValue[0] < 0x20) || (fieldValue[0] >= 0x80)) { + if (fieldValue[0] >= 0x80) { + tempLen = 1; + } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /* 06 05 02 03 0A AF 89 */ + fieldValue[3] = fieldValue[2]; + fieldValue[2] = fieldValue[1]; + fieldValue[1] = fieldValue[0]; + fieldValue[0] = 0x02; + tempLen = 2; + fieldValueLen = 3; + MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n"); + } else { + tempLen = fieldValue[0]; /* 06 06 03 02 03 16 AF 88 */ + } - szExtendedContent = wspExtendedDecodeType( (char)contentsTypeCode ); + if (tempLen == 1) { + char* szExtendedContent; - if (szExtendedContent != NULL) { - MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " ); - strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - } else { - contentsTypeCode = wspHeaderDecodeInteger(fieldValue); + contentsTypeCode = fieldValue[0] & 0x7f; + while ((wspContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspContentsTypeCount)) i++; - while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) - i++; + /* If specified content type doesn't exist */ + if (i < wspContentsTypeCount) + strncat((char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - /* If there is a Content-Type assigned, */ - if (i < wspUnregisteredContentsTypeCount) - strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + szExtendedContent = wspExtendedDecodeType((char)contentsTypeCode); - tempLen +=1; + if (szExtendedContent != NULL) { + MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n "); + strncat((char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } else { - tempLen = AcStrlen( (char*)fieldValue ) + 1; + contentsTypeCode = wspHeaderDecodeInteger(fieldValue); - strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen); - } + while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) + i++; - /* If there is a parameter */ - if (tempLen < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, ¶m); - if (param != NULL) { - strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - } - } - break; + /* If there is a Content-Type assigned, */ + if (i < wspUnregisteredContentsTypeCount) + strncat((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - /* language */ - /* content-language */ - case 0x0c: - /* accept-language */ - case 0x03: - { - unsigned long i = 0; - unsigned long code; - unsigned long tempLen; - if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) { - if (fieldValue[0] > 0x80 ) - tempLen = 1; - else - tempLen = fieldValue[0]; - } else { - tempLen = AcStrlen( (char*)fieldValue ) + 1; + tempLen +=1; } + } else { + tempLen = AcStrlen((char*)fieldValue) + 1; - if (tempLen == 1) { - - code = wspHeaderDecodeInteger( fieldValue ); - while ( wspLanguage[i].languageCode != code) { - i++; - if (i == wspLanguageCount) - break; - } - - if (i < wspLanguageCount) { - strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - } else { - strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen); + } - if (tempLen < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, ¶m ); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + /* If there is a parameter */ + if (tempLen < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue + tempLen, fieldValueLen - tempLen, ¶m); + if (param != NULL) { + strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } - break; + } + break; - /* integer */ - /* Max-forwards */ - case 0x1e: - /* content-length */ - case 0x0d: - /* age */ - case 0x05: - /* Bearer-indication */ - case 0x33: - /* Push-Flag */ - case 0x34: - { - - unsigned char temp[16]; - /* - if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f )) - AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]); + /* language */ + /* content-language */ + case 0x0c: + /* accept-language */ + case 0x03: { + unsigned long i = 0; + unsigned long code; + unsigned long tempLen; + if ((fieldValue[0] < 0x20) || (fieldValue[0] > 0x80)) { + if (fieldValue[0] > 0x80) + tempLen = 1; else - */ - snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen )); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + tempLen = fieldValue[0]; + } else { + tempLen = AcStrlen((char*)fieldValue) + 1; } - break; - /* X-Wap-Application-Id */ - case 0x2f: - { - unsigned char temp[64]; - int integerValue; - - if (fieldValueLen == 2 && fieldValue[0] == 0) { - memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 ); - MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" ); - fieldValueLen = 1; - } - integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); - - int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S); - for (int i = 0; i < count ; ++i) { - if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) { - snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken); - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + if (tempLen == 1) { + code = wspHeaderDecodeInteger(fieldValue); + while (wspLanguage[i].languageCode != code) { + i++; + if (i == wspLanguageCount) break; - } } - } - break; - /* Accept-Application */ - case 0x32: - if (0x80 == fieldValue[0]) { - strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 ); - } else { - unsigned char temp[16]; - /* - if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 )) - AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]); - else - */ - snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen )); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + if (i < wspLanguageCount) { + strncat((char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + } else { + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; - - /* date */ - /* last-modified */ - case 0x1d: - /* if-unmodified-since */ - case 0x1b: - /* if-range */ - case 0x1a: - /* if-modified-since */ - case 0x17: - /* expires */ - case 0x14: - /* date */ - case 0x12: - { - char* decodedString = NULL; - unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); - wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString); - strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 ); + if (tempLen < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeQValue(fieldValueLen - tempLen, fieldValue + tempLen, ¶m); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; + } + break; - /* connection */ - case 0x09: - if (fieldValue[0] == 0x80 ) - strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 ); - break; - /* accept-ranges */ - case 0x04: - if (fieldValue[0] == 0x80 ) - strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 ); - if (fieldValue[0] == 0x81 ) - strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 ); - break; - /* content-md5 */ - case 0x0f: - { - unsigned char temp[1275]; - memcpy( temp, fieldValue, (size_t)fieldValueLen ); - temp[fieldValueLen] = 0; - wspHeaderCopyDecodedString( temp, ¤tLength, &temper ); + /* integer */ + /* Max-forwards */ + case 0x1e: + /* content-length */ + case 0x0d: + /* age */ + case 0x05: + /* Bearer-indication */ + case 0x33: + /* Push-Flag */ + case 0x34: { + unsigned char temp[16]; + /* + if ((fieldValueLen == 2) && (fieldValue[0] > 0x7f)) + AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[1]); + else + */ + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; + /* X-Wap-Application-Id */ + case 0x2f: { + unsigned char temp[64]; + int integerValue; + + if (fieldValueLen == 2 && fieldValue[0] == 0) { + memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); + MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); + fieldValueLen = 1; } - break; - /* Credential */ - /* authorization */ - case 0x07: - /* proxy - authorization */ - case 0x21: - if (fieldValue[0] == 0x80) { - char* addString = NULL; - unique_ptr addStringbuf(&addString, unique_ptr_deleter); - wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString ); - strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } else { - iField = AcStrlen( (char*)fieldValue) + 1; - strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - if (iField < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, ¶m ); - if (param != NULL) { - strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } + integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + + int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S); + for (int i = 0; i < count ; ++i) { + if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) { + snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + break; } } - break; + } + break; + /* Accept-Application */ + case 0x32: + if (0x80 == fieldValue[0]) { + strncat((char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + } else { + unsigned char temp[16]; + /* + if ((fieldValueLen == 2) && (fieldValue[0] == 1)) + AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[0]); + else + */ + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + } + break; - /* Challenge */ - /* www - auth */ - case 0x2d: - /* Proxy-authenticate */ - case 0x20: - if (0 == fieldValueLen ) - break; - if (fieldValue[0] == 0x80) { - char* addString = NULL; - unique_ptr addStringbuf(&addString, unique_ptr_deleter); - wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString ); - strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } else { - unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1]; - unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX]; - unsigned char addedString[WSP_STANDARD_STR_LEN_MAX]; - strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1); - iField = AcStrlen( (char*)authScheme ) + 1; - strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1); - iField = iField + AcStrlen( (char*)realmValue ) + 1; - snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue ); - wspHeaderCopyDecodedString( addedString, ¤tLength, &temper ); + /* date */ + /* last-modified */ + case 0x1d: + /* if-unmodified-since */ + case 0x1b: + /* if-range */ + case 0x1a: + /* if-modified-since */ + case 0x17: + /* expires */ + case 0x14: + /* date */ + case 0x12: { + char* decodedString = NULL; + unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); + wspHeaderDecodeDateValue(fieldValueLen, fieldValue, &decodedString); + strncat((char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + } + break; - if (iField < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, ¶m ); - if (param != NULL) { - strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - wspHeaderCopyDecodedString( (unsigned char*)param, ¤tLength, &temper ); - } + /* connection */ + case 0x09: + if (fieldValue[0] == 0x80) + strncat((char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + break; + /* accept-ranges */ + case 0x04: + if (fieldValue[0] == 0x80) + strncat((char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + if (fieldValue[0] == 0x81) + strncat((char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + break; + /* content-md5 */ + case 0x0f: { + unsigned char temp[1275]; + memcpy(temp, fieldValue, (size_t)fieldValueLen); + temp[fieldValueLen] = 0; + wspHeaderCopyDecodedString(temp, ¤tLength, &temper); + } + break; + /* Credential */ + /* authorization */ + case 0x07: + /* proxy - authorization */ + case 0x21: + if (fieldValue[0] == 0x80) { + char* addString = NULL; + unique_ptr addStringbuf(&addString, unique_ptr_deleter); + wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString); + strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } else { + iField = AcStrlen((char*)fieldValue) + 1; + + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (iField < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, ¶m); + if (param != NULL) { + strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } + } + break; + + /* Challenge */ + /* www - auth */ + case 0x2d: + /* Proxy-authenticate */ + case 0x20: + if (0 == fieldValueLen) break; + if (fieldValue[0] == 0x80) { + char* addString = NULL; + unique_ptr addStringbuf(&addString, unique_ptr_deleter); + wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString); + strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } else { + unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1]; + unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX]; + unsigned char addedString[WSP_STANDARD_STR_LEN_MAX]; + + strncpy((char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1); + iField = AcStrlen((char*)authScheme) + 1; + strncpy((char*)realmValue, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); + iField = iField + AcStrlen((char*)realmValue) + 1; + snprintf((char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue); + wspHeaderCopyDecodedString(addedString, ¤tLength, &temper); + + if (iField < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue + iField, fieldValueLen - iField, ¶m); + if (param != NULL) { + strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + wspHeaderCopyDecodedString((unsigned char*)param, ¤tLength, &temper); + } + } + } + break; - /* content -range */ - case 0x10: - { - unsigned long first, len, last; + /* content -range */ + case 0x10: { + unsigned long first, len, last; - unsigned char temp[16]; - iField = 0; + unsigned char temp[16]; + iField = 0; - strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + strncat((char*)temper, " bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - first = wspRetriveUintvarDecode( fieldValue, &iField ); - len = wspRetriveUintvarDecode( fieldValue, &iField ); - /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. */ - last = first + contentsLength - 1; + first = wspRetriveUintvarDecode(fieldValue, &iField); + len = wspRetriveUintvarDecode(fieldValue, &iField); + /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. */ + last = first + contentsLength - 1; - snprintf( (char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len ); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - break; + snprintf((char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; - /* cache-control */ - case 0x08: - { - char* cacheString = NULL; - unique_ptr cacheStringbuf(&cacheString, unique_ptr_deleter); + /* cache-control */ + case 0x08: { + char* cacheString = NULL; + unique_ptr cacheStringbuf(&cacheString, unique_ptr_deleter); - wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString ); - strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - break; + wspHeaderDecodeCacheControl(fieldValue, fieldValueLen, &cacheString); + strncat((char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; - /* pragma */ - case 0x1f: - if (fieldValue[0] == 0x80) { - strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } else { - if (1 < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter( fieldValue, fieldValueLen, ¶m ); + /* pragma */ + case 0x1f: + if (fieldValue[0] == 0x80) { + strncat((char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } else { + if (1 < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue, fieldValueLen, ¶m); - if (param != NULL) { - strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } + if (param != NULL) { + strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } - break; - - /* public */ - case 0x22: - /* allow */ - case 0x06: - { - unsigned long i = 0; - while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++; - strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - break; - /* range */ - case 0x23: - strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - if (fieldValue[0] == 0x80) { - unsigned char temp[16]; - unsigned long first, last; - iField = 0; - - first = wspRetriveUintvarDecode( fieldValue, &iField ); - last = wspRetriveUintvarDecode( fieldValue, &iField ); - - snprintf( (char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last ); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - if (fieldValue[0] == 0x81) { - unsigned char temp[16]; - unsigned long suffix; + } + break; - suffix = wspRetriveUintvarDecode( fieldValue, &iField ); + /* public */ + case 0x22: + /* allow */ + case 0x06: { + unsigned long i = 0; + while (wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen) != wspMethodType[i].methodCode) i++; + strncat((char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; + /* range */ + case 0x23: + strncat((char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (fieldValue[0] == 0x80) { + unsigned char temp[16]; + unsigned long first, last; + iField = 0; + + first = wspRetriveUintvarDecode(fieldValue, &iField); + last = wspRetriveUintvarDecode(fieldValue, &iField); + + snprintf((char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + if (fieldValue[0] == 0x81) { + unsigned char temp[16]; + unsigned long suffix; - snprintf( (char*)temp, sizeof(temp), "-%u", (unsigned int)suffix ); + suffix = wspRetriveUintvarDecode(fieldValue, &iField); - } - break; - /* retry-after */ - case 0x25: - if (fieldValue[0] == 0x80) { - char* temp = NULL; - unique_ptr tempbuf(&temp, unique_ptr_deleter); - - wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp ); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } + snprintf((char*)temp, sizeof(temp), "-%u", (unsigned int)suffix); + } + break; + /* retry-after */ + case 0x25: + if (fieldValue[0] == 0x80) { + char* temp = NULL; + unique_ptr tempbuf(&temp, unique_ptr_deleter); + + wspHeaderDecodeDateValue(fieldValueLen - 1, fieldValue + 1, &temp); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } - if (fieldValue[0] == 0x81) { - unsigned char temp[16]; + if (fieldValue[0] == 0x81) { + unsigned char temp[16]; - snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen )); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } - break; - /* transfer-encoding */ - case 0x27: - /* No other cases allowed */ - if (fieldValue[0] == 0x80 ) - strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; + /* transfer-encoding */ + case 0x27: + /* No other cases allowed */ + if (fieldValue[0] == 0x80) + strncat((char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - break; - /* vary */ - case 0x2a: - { - int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen ); - if (integerValue > wspHeaderFieldCount) { - MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount); - break; - } - strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + break; + /* vary */ + case 0x2a: { + int integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + if (integerValue > wspHeaderFieldCount) { + MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n", wspHeaderFieldCount); + break; } - break; - /* warning */ - case 0x2c: - { - unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; - - if (fieldValue[0] < 0x20 ) - iField = fieldValue[0]; - else - iField = 1; - - snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField )); - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - if (iField < fieldValueLen) { - unsigned char agent[WSP_STANDARD_STR_LEN_MAX]; - unsigned char text[WSP_STANDARD_STR_LEN_MAX]; - strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1); - iField = iField + AcStrlen((char*)agent ) + 1; - strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1); - snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text ); - wspHeaderCopyDecodedString( temp, ¤tLength, &temper ); - } + strncat((char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; + /* warning */ + case 0x2c: { + unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; + + if (fieldValue[0] < 0x20) + iField = fieldValue[0]; + else + iField = 1; + + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, iField)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (iField < fieldValueLen) { + unsigned char agent[WSP_STANDARD_STR_LEN_MAX]; + unsigned char text[WSP_STANDARD_STR_LEN_MAX]; + strncpy((char*)agent, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); + iField = iField + AcStrlen((char*)agent) + 1; + strncpy((char*)text, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); + snprintf((char*)temp, sizeof(temp), " %s %s", agent, text); + wspHeaderCopyDecodedString(temp, ¤tLength, &temper); } - break; - /* content-disposition */ - case 0x2e: - if (fieldValue[0] == 0x80 ) - strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - - if (fieldValue[0] == 0x81 ) - strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - - if (1 < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, ¶m ); - - if (param != NULL) { - strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); - } + } + break; + /* content-disposition */ + case 0x2e: + if (fieldValue[0] == 0x80) + strncat((char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + + if (fieldValue[0] == 0x81) + strncat((char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + + if (1 < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, ¶m); + + if (param != NULL) { + strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; - /* Profile-diff */ - case 0x36: - temper[AcStrlen((char*)temper) + fieldValueLen] = '\0'; - memcpy( temper, fieldValue, (size_t)fieldValueLen ); - break; - /* Profile-Warning */ - case 0x37: - { - unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; - - snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue )); - temp[2] = temp[1]; - temp[1] = (unsigned char)0x30; - temp[3] = '\0'; - if (fieldValueLen > 1) { - /* copy warn-target - URI */ - strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 ); - if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) { - /* copy warn-date */ - char* decodedString = NULL; - unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); - wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString ); - strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 ); - } + } + break; + /* Profile-diff */ + case 0x36: + temper[AcStrlen((char*)temper) + fieldValueLen] = '\0'; + memcpy(temper, fieldValue, (size_t)fieldValueLen); + break; + /* Profile-Warning */ + case 0x37: { + unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; + + snprintf((char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue)); + temp[2] = temp[1]; + temp[1] = (unsigned char)0x30; + temp[3] = '\0'; + if (fieldValueLen > 1) { + /* copy warn-target - URI */ + strncat((char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); + if (fieldValueLen > (AcStrlen((char*)(fieldValue + 1)) + 1)) { + /* copy warn-date */ + char* decodedString = NULL; + unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); + wspHeaderDecodeDateValue(fieldValueLen - (AcStrlen((char*)(fieldValue + 1)) + 2), fieldValue + AcStrlen((char*)(fieldValue + 1)) + 1, &decodedString); + strncat((char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); } - strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); } - break; - - default: - break; + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } + break; + + default: + break; } - } + /*}*/ } /* It deosn't finished decoding yet. */ - if (( iEncodedHeader < encodedHeaderLen ) && ( fieldCode != 0xff )) { + if ((iEncodedHeader < encodedHeaderLen) && (fieldCode != 0xff)) { /* In here, iEncodedHeader already point next field code to be decoded. */ /* If this code is same, then set continueField else add CRLF. */ - if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f )) { - strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f)) { + strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); continueField = TRUE; } else { - strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); continueField = FALSE; } } else { - strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 ); + strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } /* add single header to total headers */ - strncat( (char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1 ); - MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper ); - + strncat((char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1); + MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper); } - MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n" ); + MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n"); *pHeader = outTemper; return; - } -unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* data ) +unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger(unsigned char* data) { /* we only can handle max 32bit integer */ unsigned long i; @@ -2890,12 +2850,12 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* da if (data[0] < 0x80) { unsigned long IntLen = 0; - IntLen = (data[0]>0x04) ? 0x04:data[0]; + IntLen = (data[0] > 0x04) ? 0x04:data[0]; MSG_DEBUG("WspLHeaderDecodeInteger: input %d , length %d\n", data[0], IntLen); - for (i=0; i 100) { qValue = qValue - 100; qValue = qValue / 1000; - sprintf( (char*)*pDecodedString, "; q=%.3f", qValue ); + sprintf((char*)*pDecodedString, "; q=%.3f", qValue); } else { /* qValue variable is divided by 100. And it's multiplied by 100. It's to resolve problem of changed 0.01 of qValue. */ @@ -2928,16 +2888,16 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsig qValue = qValue - 1; qValue = qValue / 100; qValueTemp = (unsigned long)(qValue * 100); - if (0 == (qValueTemp % 10 )) - sprintf( (char*)*pDecodedString, "; q=%.1f", qValue ); + if (0 == (qValueTemp % 10)) + sprintf((char*)*pDecodedString, "; q=%.1f", qValue); else - sprintf( (char*)*pDecodedString, "; q=%.2f", qValue ); + sprintf((char*)*pDecodedString, "; q=%.2f", qValue); } return; } -unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length ) +unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length) { unsigned long i; @@ -2948,25 +2908,25 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned c returner.integer = 0; - if (length == 1 ) + if (length == 1) return data[0] & 0x7f; returner.integer = 0; for (i = 0 ; i < length; i++) { - returner.integer = returner.integer + ( data[i] * (0x1 << ( ( length - ( i + 1)) * 8 ))); - MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer ); + returner.integer = returner.integer + (data[i] * (0x1 << ((length - (i + 1)) * 8))); + MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer); } return returner.integer; } -char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType ) +char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType) { int i = 0; - while ( wspExtendedContentsType[i].contentsTypeCode != contentType) { + while (wspExtendedContentsType[i].contentsTypeCode != contentType) { if (wspExtendedContentsType[i].contentsTypeCode == 0xff) return NULL; i++; @@ -2976,7 +2936,7 @@ char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType ) } -void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam) +void SmsPluginWapPushHandler::wspHeaderDecodeParameter(unsigned char* data, unsigned long length, char** pParam) { char* param = *pParam; @@ -2988,19 +2948,19 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns param = new char[WSP_STANDARD_STR_LEN_MAX]; if (param == NULL) { - MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n" ); + MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n"); return; } - strncpy( (char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1); + strncpy((char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1); - if (NO_VALUE == data[AcStrlen( (char*)param ) + 1]) { + if (NO_VALUE == data[AcStrlen((char*)param) + 1]) { *pParam = param; return; } - strncat( (char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 ); - strncat( (char*)param, (char*)(data + AcStrlen( (char*)param )), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); + strncat((char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); + strncat((char*)param, (char*)(data + AcStrlen((char*)param)), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); *pParam = param; @@ -3009,23 +2969,23 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns switch (data[0] & 0x7f) { case 0x00: - wspHeaderDecodeQValue( length - 1, data + 1, ¶m); + wspHeaderDecodeQValue(length - 1, data + 1, ¶m); break; case 0x01: - wspHeaderDecodeCharset( length - 1 , data + 1, ¶m); + wspHeaderDecodeCharset(length - 1 , data + 1, ¶m); break; case 0x02: - wspHeaderDecodeVersion( length - 1, data + 1, ¶m); + wspHeaderDecodeVersion(length - 1, data + 1, ¶m); break; /* integer */ case 0x03: - /* param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX ); */ + /* param = (unsigned char *)malloc((size_t)WSP_STANDARD_STR_LEN_MAX); */ param = new char[WSP_STANDARD_STR_LEN_MAX]; if (param == NULL) { MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n"); return; } else { - sprintf( (char*)param, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 )); + sprintf((char*)param, "Type=%i", (int)wspHeaderDecodeInteger(data + 1)); } break; case 0x08: @@ -3035,7 +2995,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n"); return; } else { - sprintf( (char*)param, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 )); + sprintf((char*)param, "Padding=%i", (int)wspHeaderDecodeInteger(data + 1)); } break; case 0x05: @@ -3045,8 +3005,8 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n"); return; } else { - strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1); - memcpy( param + 5, data + 1, length - 1 ); + strncpy((char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1); + memcpy(param + 5, data + 1, length - 1); param[5 + length - 1] = '\0'; } break; @@ -3057,8 +3017,8 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n"); return; } else { - strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1); - memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) ); + strncpy((char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1); + memcpy(param + 9, (char*)(data + 1), (size_t)(length - 1)); param[9 + length - 1] = '\0'; } break; @@ -3076,16 +3036,16 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns } else { strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1); SecurityTypeCode = data[1] & 0x7f; - while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode )) + while ((i < wspSecurityTypeCount) && (wspSecurityType[i].SecurityTypeCode != SecurityTypeCode)) i++; if (i < wspSecurityTypeCount) { - strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); + strncat((char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); } if (0x12 == (data[2] & 0x7f)) { - strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 ); - memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 ); + strncat((char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1); + memcpy(param+AcStrlen((char*)param), (char*)(data+3), (size_t)length-3); } } break; @@ -3100,9 +3060,8 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns } -void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString) +void SmsPluginWapPushHandler::wspHeaderDecodeCharset(unsigned long length, unsigned char* data, char**pDecodedString) { - *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX]; if (*pDecodedString == NULL) { @@ -3110,10 +3069,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi return; } - strncpy( (char*)*pDecodedString, "charset=", WSP_STANDARD_STR_LEN_MAX-1); + strncpy((char*)*pDecodedString, "charset=", WSP_STANDARD_STR_LEN_MAX-1); if (data[0] > 0x80) { - unsigned long code = wspHeaderDecodeInteger(data ); + unsigned long code = wspHeaderDecodeInteger(data); unsigned long i = 0; while (wspCharset[i].charsetCode != code) { if (wspCharset[i].charsetCode == 0xffff) { @@ -3121,10 +3080,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi } i++; } - strncat( (char*)*pDecodedString, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pDecodedString)-1 ); + strncat((char*)*pDecodedString, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pDecodedString)-1); } else { unsigned long lastLen = AcStrlen((char*)*pDecodedString); - memcpy( (char*)(*pDecodedString + lastLen), data, (size_t)length ); + memcpy((char*)(*pDecodedString + lastLen), data, (size_t)length); *pDecodedString[length + lastLen] = '\0'; } @@ -3132,7 +3091,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi } -void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString ) +void SmsPluginWapPushHandler::wspHeaderDecodeVersion(unsigned long length, unsigned char* data, char** pDecodedString) { *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX]; @@ -3143,49 +3102,47 @@ void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsi if (length > 1) { /* untyped version */ - memcpy( *pDecodedString, data, (size_t)length ); + memcpy(*pDecodedString, data, (size_t)length); } else { /* typed version */ - unsigned char majorVer = ((data[0] & 0x7f ) >> 4 ); + unsigned char majorVer = ((data[0] & 0x7f) >> 4); unsigned char minorVer = data[0] & 0x0f; - sprintf( (char*)*pDecodedString, "level=%u.%u", majorVer, minorVer ); + sprintf((char*)*pDecodedString, "level=%u.%u", majorVer, minorVer); } return; } -void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString ) +void SmsPluginWapPushHandler::wspHeaderDecodeDateValue(unsigned long length, unsigned char* data, char** pDecodedString) { time_t lTime; struct tm* pTMData; - MSG_DEBUG("WspLHeaderDecodeDateValue: \n" ); + MSG_DEBUG("WspLHeaderDecodeDateValue: \n"); *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX]; if (*pDecodedString == NULL) { - MSG_DEBUG( "WspLHeaderDecodeDateValue:MemAlloc failed\n"); + MSG_DEBUG("WspLHeaderDecodeDateValue:MemAlloc failed\n"); return; } lTime = wspHeaderDecodeIntegerByLength(data, length); - pTMData = (struct tm*)gmtime((const time_t* )&lTime); + pTMData = (struct tm*)gmtime((const time_t*)&lTime); if (pTMData == NULL) { - MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail \n" ); - strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1); + MSG_DEBUG("WspLHeaderDecodeDateValue: Date decode fail \n"); + strncpy((char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1); return; } /* check date value validity */ - { - if (( pTMData->tm_wday > 6 ) || (pTMData->tm_mon > 11 ) || (pTMData->tm_mday > 31 )) { - MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData->tm_wday, pTMData->tm_mon, pTMData->tm_mday ); - strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1); - return; - } + if ((pTMData->tm_wday > 6) || (pTMData->tm_mon > 11) || (pTMData->tm_mday > 31)) { + MSG_DEBUG("WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData->tm_wday, pTMData->tm_mon, pTMData->tm_mday); + strncpy((char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1); + return; } #ifdef MSG_FW_FOR_DEBUG @@ -3193,48 +3150,47 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un switch (wspMachineStatus.dateType) { /* UNIX asciitime function */ case UNIX_DATE_TYPE: - snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon], - pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 ); + snprintf((char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon], + pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900); break; case RFC1123_DATE_TYPE: - snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday, - wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec ); + snprintf((char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday, + wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec); break; case RFC850_DATE_TYPE: /* Have some Y2K Problems */ /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */ - snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday, - wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec ); + snprintf((char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday, + wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec); break; } #endif /*UNIX_DATE_TYPE : */ - snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon], - pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 ); + snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon], + pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900); return; - } -void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper ) +void SmsPluginWapPushHandler::wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper) { - unsigned long elementLen = AcStrlen( (char*)szDecodedString ); + unsigned long elementLen = AcStrlen((char*)szDecodedString); char* temper2 = NULL; /* CR+LF */ *currentLen = *currentLen + elementLen + 2; - if ( *currentLen > AcStrlen( (char*)* pTemper ) + 2) { - temper2 = new char[(*currentLen + 1 )]; + if (*currentLen > AcStrlen((char*)* pTemper) + 2) { + temper2 = new char[(*currentLen + 1)]; if (temper2 == NULL) { - MSG_DEBUG( "WspLHeaderCopyDecodedString:MemAlloc failed\n"); + MSG_DEBUG("WspLHeaderCopyDecodedString:MemAlloc failed\n"); return; } - strncpy( (char*)temper2, (char*)* pTemper, *currentLen); + strncpy((char*)temper2, (char*)* pTemper, *currentLen); delete[] *pTemper; - strncpy( (char*)temper2, (char*)szDecodedString, *currentLen); + strncpy((char*)temper2, (char*)szDecodedString, *currentLen); } *pTemper = temper2; @@ -3243,7 +3199,7 @@ void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecod } -void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ) +void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString) { unsigned char userId[WSP_STANDARD_STR_LEN_MAX]; unsigned char passWd[WSP_STANDARD_STR_LEN_MAX]; @@ -3253,7 +3209,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX * 2]; if (*pDecodedString == NULL) { - MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n" ); + MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n"); return; } @@ -3261,19 +3217,19 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u iField++; memset(authStr, 0x00, sizeof(authStr)); snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId)); - sscanf((char*)(fieldValue + iField), authStr, userId ); - iField = iField + AcStrlen( (char*)userId ) + 1; + sscanf((char*)(fieldValue + iField), authStr, userId); + iField = iField + AcStrlen((char*)userId) + 1; memset(authStr, 0x00, sizeof(authStr)); snprintf(authStr, sizeof(authStr), "%%%ds", 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 ); + 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); return; } -void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ) +void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString) { unsigned char userId[WSP_STANDARD_STR_LEN_MAX]; unsigned long iField = 0; @@ -3282,7 +3238,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL *pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX]; if (*pDecodedString == NULL) { - MSG_DEBUG( "WspLHeaderDecodeChallenge:MemAlloc failed\n"); + MSG_DEBUG("WspLHeaderDecodeChallenge:MemAlloc failed\n"); return; } @@ -3290,10 +3246,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL iField++; memset(authStr, 0x00, sizeof(authStr)); snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId)); - sscanf( (char*)(fieldValue + iField), authStr, userId ); - iField = iField + AcStrlen( (char*)userId ) + 1; + sscanf((char*)(fieldValue + iField), authStr, userId); + iField = iField + AcStrlen((char*)userId) + 1; - snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId ); + snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId); return; } @@ -3306,7 +3262,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa *pCacheString = new char[WSP_STANDARD_STR_LEN_MAX]; if (*pCacheString == NULL) { - MSG_DEBUG( "WspLHeaderDecodeCacheControl:MemAlloc failed\n"); + MSG_DEBUG("WspLHeaderDecodeCacheControl:MemAlloc failed\n"); return; } @@ -3315,7 +3271,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa if (fieldValue[0] > 0x8b) { return; /* It's error detection. can be omitted. */ } - strncpy( (char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1); + strncpy((char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1); return; } @@ -3330,11 +3286,11 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa case 0x07: if (fieldValue[1] > 0x7f) { /* well known field name */ - strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 ); + strncpy((char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1); paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0'; } else { /* unknown field name */ - strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1); + strncpy((char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1); } break; /* secound */ @@ -3344,33 +3300,32 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa case 0x03: /* min-fresh */ case 0x04: - snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1)); + snprintf((char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger(fieldValue + 1)); break; default: break; } - snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString ); + snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString); } else { /* cache extentions */ /* In case of come directive of doesn't specified string style */ unsigned long stringLen; char szString[32]; - strncpy( (char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1); - stringLen = AcStrlen((char*)*pCacheString ); + strncpy((char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1); + stringLen = AcStrlen((char*)*pCacheString); if (stringLen + 1 < fieldValueLen) { - if (fieldValue[stringLen+ 1] > 0x7f) { - int untyped = (int)wspHeaderDecodeIntegerByLength( fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1 )); + int untyped = (int)wspHeaderDecodeIntegerByLength(fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1)); - snprintf( szString, sizeof(szString), "%d", untyped ); - strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 ); - strncat( (char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 ); + snprintf(szString, sizeof(szString), "%d", untyped); + strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1); + strncat((char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1); } else { if (fieldValue[fieldValueLen] == 0) { - strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 ); - strncat( (char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1); + strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1); + strncat((char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1); } } } diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h index a71a311..d526bab 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h @@ -30,7 +30,6 @@ class SmsPluginMsgCodec { public: - static SmsPluginMsgCodec* instance(); static bool checkInvalidPDU(const unsigned char *p_pkg_str, const int p_pkg_len); diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h index 6772c77..ff02955 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h @@ -121,7 +121,6 @@ private: int MakeWapUserData(unsigned short msgId, char **ppTotalData); bool checkCbOpt(sms_trans_svc_ctg_t svc_ctg); - }; #endif /* SMS_CDMA_PLUGIN_EVENT_HANDLER_H */ diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginParamCodec.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginParamCodec.h index b6924a0..25e9611 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginParamCodec.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginParamCodec.h @@ -30,7 +30,6 @@ class SmsPluginParamCodec { public: - static SmsPluginParamCodec* instance(); static int convertDigitToBcd(char *pDigit, int DigitLen, unsigned char *pBcd); diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h index ee83bc9..80d764a 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h @@ -327,7 +327,6 @@ typedef enum _sms_status_code_e { SMS_STATUS_PERMANENT_INVALID_DESTINATION = 0xCA, SMS_STATUS_PERMANENT_MESSAGE_EXPIRED = 0xCD, SMS_STATUS_PERMANENT_UNKNOWN_ERROR = 0xDF, - }sms_status_code_t; diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h index f2142fb..4f14716 100755 --- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h +++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h @@ -38,8 +38,8 @@ #define WSP_CODE_BUFFER_LEFT_LEN_MAX 1024 #define WSP_CODE_BUFFER_RIGHT_LEN_MAX 2048 -#define AcStrlen(x) ((x==NULL)?0:strlen(x)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define AcStrlen(x) ((x == NULL)?0:strlen(x)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) /*================================================================================================== @@ -76,20 +76,20 @@ private: msg_push_action_t convertSIActionStrToEnum(char* pAction); msg_push_action_t convertSLActionStrToEnum(char* pAction); - unsigned long wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer ); - unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar ); - void wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader); - unsigned long wspHeaderDecodeInteger( unsigned char* data ); - void wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString); - unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length ); - char* wspExtendedDecodeType(char contentType ); - void wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam); - void wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString); - void wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString ); - void wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString ); - void wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper ); - void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ); - void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ); + unsigned long wspRetriveUintvarDecode(unsigned char* sourceData, unsigned long* currentPointer); + unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar); + void wspDecodeHeader(unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader); + unsigned long wspHeaderDecodeInteger(unsigned char* data); + void wspHeaderDecodeQValue(unsigned long length, unsigned char* data, char** pDecodedString); + unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length); + char* wspExtendedDecodeType(char contentType); + void wspHeaderDecodeParameter(unsigned char* data, unsigned long length, char** pParam); + void wspHeaderDecodeCharset(unsigned long length, unsigned char* data, char**pDecodedString); + void wspHeaderDecodeVersion(unsigned long length, unsigned char* data, char** pDecodedString); + void wspHeaderDecodeDateValue(unsigned long length, unsigned char* data, char** pDecodedString); + void wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper); + void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString); + void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString); void wspHeaderDecodeCacheControl(unsigned char* fieldValue, unsigned long fieldValueLen, char** pCacheString); diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp index 99bb053..214a01e 100755 --- a/plugin/sms_plugin/SmsPluginCallback.cpp +++ b/plugin/sms_plugin/SmsPluginCallback.cpp @@ -52,7 +52,6 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v MSG_FATAL("%s", e.what()); return; } - } SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result) @@ -153,7 +152,6 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_ MSG_FATAL("%s", e.what()); return; } - } void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void *user_data) @@ -336,7 +334,6 @@ void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *use } SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, (MSG_SIM_COUNT_S *)data); - } @@ -364,7 +361,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d /* Reading TelSmsDatapackageInfo_t */ if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN) { - MSG_DEBUG ("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength); + MSG_DEBUG("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength); SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); @@ -506,8 +503,6 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d /* Call Event Handler */ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); - - } @@ -572,7 +567,6 @@ void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *use int sim_id = *((int*)data); SmsPluginSimMsg::instance()->setDelSimEvent(sim_id, true); - } @@ -625,7 +619,6 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us SmsPluginSimMsg::instance()->setSimEvent(0, bRet); else SmsPluginSetting::instance()->setResultFromSim(bRet); - } @@ -643,7 +636,6 @@ void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user paramCnt = *((int*)data); SmsPluginSetting::instance()->setParamCntEvent(paramCnt); - } @@ -763,13 +755,10 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da #if 0 /*Get the DCS value*/ - if (0x00 == (0x08 & smsParam->ParamIndicator)) - { + if (0x00 == (0x08 & smsParam->ParamIndicator)) { smscList.smscData[index].dcs = smsParam->TpDataCodingScheme; MSG_DEBUG("dcs : %d", smscList.smscData[index].dcs); - } - else - { + } else { smscList.smscData[index].dcs = MSG_ENCODE_GSM7BIT; MSG_DEBUG("DCS is not present"); } @@ -895,7 +884,7 @@ void TapiEventGetMailboxInfo(TapiHandle *handle, int result, void *data, void *u } TelSimMailboxList_t *list = (TelSimMailboxList_t *)data; - SMS_SIM_MAILBOX_LIST_S mbList = {0,}; + SMS_SIM_MAILBOX_LIST_S mbList = {0, }; if (list->count <= 0) { MSG_INFO("Mailbox list is empty"); @@ -940,7 +929,7 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_ } TelSimMessageWaitingResp_t *MwiInfo = (TelSimMessageWaitingResp_t *)data; - SMS_SIM_MWI_INFO_S simMwiInfo = {0,}; + SMS_SIM_MWI_INFO_S simMwiInfo = {0, }; memcpy(&simMwiInfo, MwiInfo, sizeof(SMS_SIM_MWI_INFO_S)); @@ -1018,7 +1007,7 @@ void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, voi } MSG_DEBUG("Setting result = [%d]", err); - if (svct->table.sst.service[TAPI_SIM_SST_MO_SMS_CTRL_BY_SIM] == 1){ + if (svct->table.sst.service[TAPI_SIM_SST_MO_SMS_CTRL_BY_SIM] == 1) { err = MsgSettingSetBool(moCtrlKey, true); } else { err = MsgSettingSetBool(moCtrlKey, false); @@ -1033,7 +1022,7 @@ void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, voi } MSG_DEBUG("Setting result = [%d]", err); - if (svct->table.ust.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1){ + if (svct->table.ust.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1) { err = MsgSettingSetBool(moCtrlKey, true); } else { err = MsgSettingSetBool(moCtrlKey, false); @@ -1192,8 +1181,6 @@ SmsPluginCallback* SmsPluginCallback::pInstance = NULL; SmsPluginCallback::SmsPluginCallback() { - - } @@ -1223,7 +1210,7 @@ void SmsPluginCallback::registerEvent() for (int i = 1; i <= count; ++i) { pTapiHandle = SmsPluginDSHandler::instance()->getTelHandle(i); -// int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle); +/* int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle); */ if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL) != TAPI_API_SUCCESS) MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_DEVICE_READY); @@ -1243,17 +1230,15 @@ void SmsPluginCallback::registerEvent() MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_PROP_NETWORK_SERVICE_TYPE); if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SIM_REFRESHED, TapiEventSimRefreshed, NULL) != TAPI_API_SUCCESS) MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED); -// if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL) != TAPI_API_SUCCESS) -// MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_REFRESH); -// if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS) -// MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SMS_CTRL); +/* if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_REFRESH, TapiEventSatSmsRefresh, NULL) != TAPI_API_SUCCESS) */ +/* MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_REFRESH); */ +/* if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SAT_MO_SMS_CTRL, TapiEventSatMoSmsCtrl, NULL) != TAPI_API_SUCCESS) */ +/* MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SAT_MO_SMS_CTRL); */ } } void SmsPluginCallback::deRegisterEvent() { - - } diff --git a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp index 4ab8907..e082c59 100755 --- a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp +++ b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp @@ -42,7 +42,6 @@ SmsPluginCbMsgHandler::SmsPluginCbMsgHandler() SmsPluginCbMsgHandler::~SmsPluginCbMsgHandler() { - } @@ -141,15 +140,15 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs if (err == MSG_SUCCESS) { MSG_CB_MSG_S cbOutMsg = {0, }; -// cbOutMsg.type = MSG_CB_SMS; + /*cbOutMsg.type = MSG_CB_SMS; */ cbOutMsg.type = msgInfo.msgType.subType; cbOutMsg.receivedTime = cbMsg->recvTime; - cbOutMsg.serialNum = encodeCbSerialNum (CbMsgPage.pageHeader.serialNum); + cbOutMsg.serialNum = encodeCbSerialNum(CbMsgPage.pageHeader.serialNum); cbOutMsg.messageId = cbMsg->msgId; cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData; memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText)); - cbOutMsg.cbTextLen= convertTextToUtf8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), cbMsg); + cbOutMsg.cbTextLen = convertTextToUtf8((unsigned char*)cbOutMsg.cbText, sizeof(cbOutMsg.cbText), cbMsg); memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type)); memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3); err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, &msgInfo); @@ -160,11 +159,10 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs } #if 0 - // insert message-id to internal CB message table + /* insert message-id to internal CB message table */ SmsPluginStorage *storageHandler = SmsPluginStorage::instance(); err = storageHandler->insertReceivedCBMessage(CbMsgPage); - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { MSG_DEBUG("insertReceivedCBMessage() Error !! [%d]", err); } #endif @@ -180,7 +178,6 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p MSG_BEGIN(); msg_error_t err = MSG_SUCCESS; TelSmsEtwsMsgType_t type = pEtwsMsg->EtwsMsgType; - //MSG_MESSAGE_INFO_S msgInfo = {}; SMS_ETWS_PRIMARY_S etwsPn = {0, }; MSG_CB_MSG_S cbOutMsg = {0, }; @@ -190,11 +187,10 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p return; } DecodeEtwsMsg(pEtwsMsg, &etwsPn); - //convertEtwsMsgToMsginfo(&CbMsgPage, &msgInfo, simIndex); cbOutMsg.type = MSG_ETWS_SMS; cbOutMsg.receivedTime = etwsPn.recvTime; - cbOutMsg.serialNum = encodeCbSerialNum (etwsPn.serialNum); + cbOutMsg.serialNum = encodeCbSerialNum(etwsPn.serialNum); cbOutMsg.messageId = etwsPn.msgId; cbOutMsg.etwsWarningType = etwsPn.warningType; memcpy (cbOutMsg.etwsWarningSecurityInfo, etwsPn.warningSecurityInfo, sizeof(cbOutMsg.etwsWarningSecurityInfo)); @@ -267,8 +263,7 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ MSG_DEBUG("codingScheme:[%d]", pCbPage->pageHeader.dcs.codingScheme); switch (pCbPage->pageHeader.dcs.codingScheme) { - case SMS_CHARSET_7BIT : - { + case SMS_CHARSET_7BIT: { MSG_DEBUG("GSM 7 BIT"); dataLen = (dataLen*8) / 7; @@ -294,9 +289,8 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ } break; - case SMS_CHARSET_8BIT : - case SMS_CHARSET_UCS2 : - { + case SMS_CHARSET_8BIT: + case SMS_CHARSET_UCS2: { MSG_DEBUG("UCS2 or 8BIT"); if (pCbPage->pageHeader.dcs.iso639Lang[0]) { @@ -360,7 +354,7 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR /* warning security information */ memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo)); /* 50bytes */ for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++) { - MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i] ); + MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i]); } } @@ -415,10 +409,9 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ int offset = 0; switch (pCbPage->pageHeader.dcs.codingScheme) { - case SMS_CHARSET_7BIT : - { + case SMS_CHARSET_7BIT: { for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) { - char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,}; + char cbMessage[MAX_CBMSG_PAGE_SIZE] = {0, }; dataLen = cbData[7+(i+1)*82 + i]; memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen); @@ -435,11 +428,10 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ } break; - case SMS_CHARSET_8BIT : - case SMS_CHARSET_UCS2 : - { + case SMS_CHARSET_8BIT: + case SMS_CHARSET_UCS2: { #if 0 - char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,}; + char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0, }; for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) { dataLen = cbData[7+(i+1)*82 + i]; @@ -457,7 +449,7 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ pCbPage->pageLength = dataLen; } #else - char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,}; + char cbMessage[MAX_CBMSG_PAGE_SIZE] = {0, }; for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) { if (pCbPage->pageHeader.dcs.iso639Lang[0]) { @@ -482,12 +474,12 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_ MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData); } -unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields ) +unsigned short SmsPluginCbMsgHandler::encodeCbSerialNum(SMS_CBMSG_SERIAL_NUM_S snFields) { unsigned short serialNum = 0; serialNum = ((snFields.geoScope & 0x03) << 14) | ((snFields.msgCode&0x03FF) << 4) | (snFields.updateNum&0x0F); - MSG_DEBUG ("serialNum (%x), geo(%x), mc(%x), un(%x)\n", serialNum, snFields.geoScope, snFields.msgCode, snFields.updateNum); + MSG_DEBUG("serialNum (%x), geo(%x), mc(%x), un(%x)\n", serialNum, snFields.geoScope, snFields.msgCode, snFields.updateNum); return serialNum; } @@ -496,49 +488,48 @@ int SmsPluginCbMsgHandler::CMAS_class(unsigned short message_id) { int ret = 0; - switch (message_id) - { - case 4370 : - case 4383 : + switch (message_id) { + case 4370: + case 4383: ret = MSG_CMAS_PRESIDENTIAL; break; - case 4371 : - case 4372 : - case 4384 : - case 4385 : + case 4371: + case 4372: + case 4384: + case 4385: ret = MSG_CMAS_EXTREME; break; - case 4373 : - case 4374 : - case 4375 : - case 4376 : - case 4377 : - case 4378 : - case 4386 : - case 4387 : - case 4388 : - case 4389 : - case 4390 : - case 4391 : + case 4373: + case 4374: + case 4375: + case 4376: + case 4377: + case 4378: + case 4386: + case 4387: + case 4388: + case 4389: + case 4390: + case 4391: ret = MSG_CMAS_SEVERE; break; - case 4379 : - case 4392 : + case 4379: + case 4392: ret = MSG_CMAS_AMBER; break; - case 4380 : - case 4393 : + case 4380: + case 4393: ret = MSG_CMAS_TEST; break; - case 4381 : - case 4394 : + case 4381: + case 4394: ret = MSG_CMAS_EXERCISE; break; - case 4382 : - case 4395 : + case 4382: + case 4395: ret = MSG_CMAS_OPERATOR_DEFINED; break; - default : + default: break; } @@ -587,7 +578,7 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg, bool bActivate = false; int MsgId_from = 0, MsgId_to = 0; - MSG_CB_CHANNEL_S cbChannelInfo = {0,}; + MSG_CB_CHANNEL_S cbChannelInfo = {0, }; msg_error_t err = MSG_SUCCESS; MsgDbHandler *dbHandle = getDbHandle(); @@ -620,9 +611,9 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage) SmsPluginStorage *storageHandler = SmsPluginStorage::instance(); err = storageHandler->isReceivedCBMessage(CbPage); - // check existing message with cb internal table; - if (err != MSG_ERR_DB_NORECORD) - { + + /* check existing message with cb internal table; */ + if (err != MSG_ERR_DB_NORECORD) { MSG_DEBUG("already received message: [%d]", CbPage.pageHeader.msgId); return 0; } @@ -867,15 +858,15 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, M memcpy(pMsgInfo->msgData, EtwsMsg->pageData, pMsgInfo->dataSize); } -int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg) +int SmsPluginCbMsgHandler::convertTextToUtf8(unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg) { int convertedTextSize = 0; - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; MsgTextConvert *textCvt = MsgTextConvert::instance(); if (!outBuf || !pCbMsg) { - MSG_DEBUG ("invalid param.\n"); + MSG_DEBUG("invalid param.\n"); return 0; } @@ -948,17 +939,15 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned unsigned char codingGrp = (dcsData & 0xF0) >> 4; switch (codingGrp) { - case 0x00 : - case 0x02 : - case 0x03 : - { + case 0x00: + case 0x02: + case 0x03: { pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS; pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData; } break; - case 0x01 : - { + case 0x01: { if (dcsData == 0x10 || dcsData == 0x11) { pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS; pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT; @@ -979,11 +968,10 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned } break; - case 0x04 : - case 0x05 : - case 0x06 : - case 0x07 : - { + case 0x04: + case 0x05: + case 0x06: + case 0x07: { pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS; pDcs->bCompressed = (dcsData & 0x20) ? true : false; @@ -1010,22 +998,19 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned } break; - case 0x09 : - { + case 0x09: { pDcs->bUDH = true; pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03); pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2); } break; - case 0x0E : - { + case 0x0E: { pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP; } break; - case 0x0F : - { + case 0x0F: { pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING; pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT; pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03); @@ -1096,7 +1081,7 @@ unsigned long SmsPluginCbMsgHandler::getRecvTime() void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayName, msg_sim_slot_id_t simIndex) { - MSG_CB_CHANNEL_S cbChannelInfo = {0,}; + MSG_CB_CHANNEL_S cbChannelInfo = {0, }; msg_error_t err = MSG_SUCCESS; MsgDbHandler *dbHandle = getDbHandle(); diff --git a/plugin/sms_plugin/SmsPluginConcatHandler.cpp b/plugin/sms_plugin/SmsPluginConcatHandler.cpp index b965cc4..9c6a649 100755 --- a/plugin/sms_plugin/SmsPluginConcatHandler.cpp +++ b/plugin/sms_plugin/SmsPluginConcatHandler.cpp @@ -301,7 +301,6 @@ void SmsPluginConcatHandler::handleSimConcatMsg(TapiHandle *handle, SMS_TPDU_S * dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData, msg.originAddress.address); if (dataSize > 0) { - convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo); /* set Sim Message ID */ msgInfo.msgId = msgId; @@ -315,8 +314,7 @@ void SmsPluginConcatHandler::handleSimConcatMsg(TapiHandle *handle, SMS_TPDU_S * if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex && g_strcmp0(concatList[index].originAddress.address, msg.originAddress.address) == 0) { memcpy(simIdList, concatList[index].simIdList, sizeof(int) * MAX_SIM_SMS_NUM); - for (int i = 0; i < 255; ++i) - { + for (int i = 0; i < 255; ++i) { MSG_DEBUG("sim id [%d]", simIdList[i]); } break; @@ -848,7 +846,7 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu, /** Convert Data values */ MsgTextConvert *textCvt = MsgTextConvert::instance(); if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) { - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; langInfo.bSingleShift = false; langInfo.bLockingShift = false; @@ -976,7 +974,7 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c /** Convert Data values */ MsgTextConvert *textCvt = MsgTextConvert::instance(); if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) { - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; langInfo.bSingleShift = false; langInfo.bLockingShift = false; diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp index 3b3e6fe..11f65dc 100755 --- a/plugin/sms_plugin/SmsPluginEventHandler.cpp +++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp @@ -58,7 +58,6 @@ SmsPluginEventHandler::SmsPluginEventHandler() SmsPluginEventHandler::~SmsPluginEventHandler() { - } @@ -84,7 +83,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus) if (sentInfo.bLast == true || NetStatus != MSG_NETWORK_SEND_SUCCESS) { /** Update Msg Status */ if (sentInfo.reqInfo.msgInfo.msgPort.valid == false) { -// SmsPluginStorage::instance()->updateSentMsg(&(sentInfo.reqInfo.msgInfo), NetStatus); + /*SmsPluginStorage::instance()->updateSentMsg(&(sentInfo.reqInfo.msgInfo), NetStatus); */ sentInfo.reqInfo.msgInfo.networkStatus = NetStatus; @@ -93,7 +92,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus) #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED MSG_DEBUG("Add phone log"); MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo)); -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; /* It should be set after adding phone log. */ } else { sentInfo.reqInfo.msgInfo.bRead = false; @@ -128,7 +127,6 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus) void SmsPluginEventHandler::handleMsgIncoming(TapiHandle *handle, SMS_TPDU_S *pTpdu) { - /** Make MSG_MESSAGE_INFO_S */ MSG_MESSAGE_INFO_S msgInfo; MSG_MESSAGE_INFO_S stored_msgInfo; @@ -407,7 +405,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms syncMLData.pushBodyLen = PushBodyLen; memcpy(syncMLData.pushBody, pPushBody, PushBodyLen); - syncMLData.wspHeaderLen= WspHeaderLen; + syncMLData.wspHeaderLen = WspHeaderLen; memcpy(syncMLData.wspHeader, pWspHeader, WspHeaderLen); /** Callback to MSG FW */ @@ -486,7 +484,6 @@ msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type void SmsPluginEventHandler::convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo) { - switch (pTpdu->tpduType) { case SMS_TPDU_SUBMIT : convertSubmitTpduToMsginfo(&pTpdu->data.submit, msgInfo); @@ -540,11 +537,6 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu memset(msgInfo->subject, 0x00, MAX_SUBJECT_LEN+1); /** What kind of time has to be saved?? (temporary store time) */ - -//CID 315780 (#1 of 1): Other violation (DC.SECURE_CODING_CRITICAL) -//dont_call: Calling localtime(time_t const *) is a DC.SECURE_CODING_CRITICAL defect. -// time_t curTime; -// localtime(&curTime); msgInfo->displayTime = time(NULL); /** Convert Address values */ @@ -566,7 +558,7 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu /** Convert Data values */ MsgTextConvert *textCvt = MsgTextConvert::instance(); if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) { - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; langInfo.bSingleShift = false; langInfo.bLockingShift = false; @@ -594,7 +586,6 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp /*** Comment below lines to save local UTC time..... (it could be used later.) ***/ if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) { - MSG_DEBUG("year : %d", pTpdu->timeStamp.time.absolute.year); MSG_DEBUG("month : %d", pTpdu->timeStamp.time.absolute.month); MSG_DEBUG("day : %d", pTpdu->timeStamp.time.absolute.day); @@ -798,12 +789,12 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp /** Convert Data values */ MsgTextConvert *textCvt = MsgTextConvert::instance(); if (pTpdu->dcs.codingScheme == SMS_CHARSET_7BIT) { - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; langInfo.bSingleShift = false; langInfo.bLockingShift = false; - for (int i = 0; i < pTpdu->userData.headerCnt; i++) { + for (int i = 0; i < pTpdu->userData.headerCnt; i++) { if (pTpdu->userData.header[i].udhType == SMS_UDH_SINGLE_SHIFT) { langInfo.bSingleShift = true; langInfo.singleLang = pTpdu->userData.header[i].udh.singleShift.langId; @@ -969,7 +960,6 @@ MSG_SUB_TYPE_T SmsPluginEventHandler::convertMsgSubType(SMS_PID_T pid) default : return MSG_NORMAL_SMS; } - } diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp index a0e9b06..5c3a876 100755 --- a/plugin/sms_plugin/SmsPluginMain.cpp +++ b/plugin/sms_plugin/SmsPluginMain.cpp @@ -82,7 +82,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle) pPluginHandle->pfGetDefaultNetworkSimId = SmsPlgGetDefaultNetworkSimId; MSG_DEBUG("SMS plugin: create handler OK"); - MSG_DEBUG ("SMS plugin %p", pPluginHandle); + MSG_DEBUG("SMS plugin %p", pPluginHandle); } return MSG_SUCCESS; @@ -212,7 +212,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo) } /* Check SIM is present or not */ - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx); MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -279,7 +279,7 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId) { /* Check SIM is present or not */ - char keyName[MAX_VCONFKEY_NAME_LEN]={0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx); MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -305,7 +305,7 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMs msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId) { /* Check SIM is present or not */ - char keyName[MAX_VCONFKEY_NAME_LEN]={0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx); MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -413,7 +413,6 @@ msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting) msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char* pFileData) { - int *simIdList = (int*)pFileData; try { SmsPluginStorage::instance()->addSmsSendOption(pMsgInfo, pSendOptInfo); @@ -433,7 +432,6 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_ msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId) { - try { SmsPluginDSHandler::instance()->getDefaultNetworkSimId(simId); } catch (MsgException& e) { @@ -522,7 +520,6 @@ _DBUS_ERROR: MSG_END(); return; - } diff --git a/plugin/sms_plugin/SmsPluginParamCodec.cpp b/plugin/sms_plugin/SmsPluginParamCodec.cpp index 2f953f1..bb40be6 100755 --- a/plugin/sms_plugin/SmsPluginParamCodec.cpp +++ b/plugin/sms_plugin/SmsPluginParamCodec.cpp @@ -28,15 +28,11 @@ ==================================================================================================*/ SmsPluginParamCodec::SmsPluginParamCodec() { - - } SmsPluginParamCodec::~SmsPluginParamCodec() { - - } @@ -121,8 +117,7 @@ int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam) **ppParam = 0x00; switch (pDCS->codingGroup) { - case SMS_GROUP_GENERAL: - { + case SMS_GROUP_GENERAL: { if (pDCS->msgClass != SMS_MSG_CLASS_NONE) **ppParam = 0x10 + pDCS->msgClass; @@ -131,8 +126,7 @@ int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam) } break; - case SMS_GROUP_CODING_CLASS: - { + case SMS_GROUP_CODING_CLASS: { **ppParam = 0xF0 + pDCS->msgClass; } break; @@ -265,9 +259,9 @@ int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S char* tmpAddress = new char[MAX_ADDRESS_LEN]; int tmplength = 0; - tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), (addrLen*4 )/7, 0, tmpAddress); + tmplength = SmsPluginUDCodec::unpack7bitChar(&(pTpdu[offset]), (addrLen*4)/7, 0, tmpAddress); - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; langInfo.bSingleShift = false; langInfo.bLockingShift = false; diff --git a/plugin/sms_plugin/SmsPluginSatHandler.cpp b/plugin/sms_plugin/SmsPluginSatHandler.cpp index dc2216e..85ccd50 100755 --- a/plugin/sms_plugin/SmsPluginSatHandler.cpp +++ b/plugin/sms_plugin/SmsPluginSatHandler.cpp @@ -57,7 +57,6 @@ SmsPluginSatHandler::SmsPluginSatHandler() SmsPluginSatHandler::~SmsPluginSatHandler() { - } @@ -159,12 +158,7 @@ void SmsPluginSatHandler::sendSms(TapiHandle *handle, void *pData) if (tpduLen <= 0) { sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS); return; - } //else if (tpduLen > MAX_TPDU_DATA_LEN) { - else if (tpduLen > MAX_SAT_TPDU_LEN) { //CID 358478: replacing check against MAX_TPDU_DATA_LEN (255) with check - // against MAX_SAT_TPDU_LEN (175). - // as mentioned above "The TPDU Maximum Length at SAT side is 175". - // Earlier MAX_TPDU_DATA_LEN was increased from 165 to 255 which creates confusion for prevent tool. - // Prevent tool thinks that it can take value of 255 and cause buffer overflow during memcpy below. + } else if (tpduLen > MAX_SAT_TPDU_LEN) { sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES); return; } @@ -181,7 +175,7 @@ void SmsPluginSatHandler::sendSms(TapiHandle *handle, void *pData) pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP; /* Set SMSC Address */ - SMS_ADDRESS_S smsc = {0,}; + SMS_ADDRESS_S smsc = {0, }; int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle); if (pSmsData->address.diallingNumberLen > 0) { @@ -233,10 +227,12 @@ void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, void *pData) TelSatMoSmCtrlIndData_t* pCtrlData = (TelSatMoSmCtrlIndData_t*)pData; -#if 0 // sangkoo 13.11.28 - if (bSendSmsbySat == true) {// Send SMS By SAT +#if 0 + if (bSendSmsbySat == true) { + /* Send SMS By SAT */ MSG_DEBUG("Event Noti for sending message by SAT : result = [%d]", pCtrlData->moSmsCtrlResult); - } else { // Send SMS By APP + } else { + /* Send SMS By APP */ SmsPluginTransport::instance()->setMoCtrlStatus(pCtrlData); } #else @@ -271,7 +267,7 @@ void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, void *pData) netStatus = MSG_NETWORK_SEND_SUCCESS; } - // Call Event Handler + /* Call Event Handler */ SmsPluginEventHandler::instance()->handleSentStatus(netStatus); } #endif @@ -288,22 +284,23 @@ void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, SMS_NETWORK_STATUS_T smsSt } else if (smsStatus == SMS_NETWORK_SEND_FAIL) { MSG_ERR("Sending SMS by SAT is failed"); sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SMS_RP_ERROR); - } else if (smsStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING){ + } else if (smsStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING) { MSG_ERR("Sending SMS by SAT is failed, but result is 'success'"); - //sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_ERROR_REQUIRED_VALUES_ARE_MISSING); + /* sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_ERROR_REQUIRED_VALUES_ARE_MISSING); */ sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS); - } else if (smsStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED){ + } else if (smsStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED) { MSG_ERR("Sending SMS is failed by MO control"); sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM); - } else if (smsStatus == SMS_NETWORK_SEND_FAIL_NO_ROUTING){ + } else if (smsStatus == SMS_NETWORK_SEND_FAIL_NO_ROUTING) { MSG_ERR("Sending SMS is failed by no routing"); sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_NETWORK_UNABLE_TO_PROCESS_COMMAND); - } else { /*Default case*/ + } else { + /*Default case*/ MSG_ERR("Sending SMS by SAT is failed"); sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SMS_RP_ERROR); } -#if 0 //P150109-07114 : no ticker and sound for sending SAT sms failure case. +#if 0 /* no ticker and sound for sending SAT sms failure case. */ if (smsStatus != SMS_NETWORK_SEND_SUCCESS) { MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, 0); } @@ -313,37 +310,30 @@ void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, SMS_NETWORK_STATUS_T smsSt #if 0 void SmsPluginSatHandler::finishSimMsgInit(msg_error_t Err) { - // SAT Handler is initializing SIM now - if (bInitSim == true) - { - // Init SMSC List and CB ID Info - try - { + /* SAT Handler is initializing SIM now */ + if (bInitSim == true) { + /* Init SMSC List and CB ID Info */ + try { if (bSMSPChanged == true) initSMSCList(); - } - catch (MsgException& e) - { - // Send Result to TAPI + } catch (MsgException& e) { + /* Send Result to TAPI */ sendResult(SMS_SAT_CMD_REFRESH, TAPI_SAT_R_ME_UNABLE_TO_PROCESS_COMMAND); MSG_FATAL("%s", e.what()); return; } - try - { + try { if (bCBMIChanged == true) initCBConfig(); - } - catch (MsgException& e) - { - // Send Result to TAPI + } catch (MsgException& e) { + /* Send Result to TAPI */ sendResult(SMS_SAT_CMD_REFRESH, TAPI_SAT_R_ME_UNABLE_TO_PROCESS_COMMAND); MSG_FATAL("%s", e.what()); return; } - // Send Result to TAPI + /* Send Result to TAPI */ sendResult(SMS_SAT_CMD_REFRESH, TAPI_SAT_R_SUCCESS); } } @@ -353,12 +343,11 @@ void SmsPluginSatHandler::initSim() { bInitSim = true; - // Init SIM Message - if (SmsPluginEventHandler::instance()->callbackInitSimBySat() != MSG_SUCCESS) - { + /* Init SIM Message */ + if (SmsPluginEventHandler::instance()->callbackInitSimBySat() != MSG_SUCCESS) { MSG_DEBUG("Init Sim Error"); - // Send Result to TAPI + /* Send Result to TAPI */ sendResult(SMS_SAT_CMD_REFRESH, TAPI_SAT_R_ME_UNABLE_TO_PROCESS_COMMAND); } } @@ -370,16 +359,14 @@ void SmsPluginSatHandler::initSMSCList() settingData.type = MSG_SMSC_LIST; - // Get Data From SIM + /* Get Data From SIM */ SmsPluginSetting::instance()->getConfigData(&settingData); MSG_DEBUG("total_count[%d]", settingData.option.smscList.totalCnt); MSG_DEBUG("selected[%d]", settingData.option.smscList.selected); - for (int i = 0; i < settingData.option.smscList.totalCnt; i++) - { + for (int i = 0; i < settingData.option.smscList.totalCnt; i++) { MSG_DEBUG("pid[%d]", settingData.option.smscList.smscData[i].pid); -// MSG_DEBUG("dcs[%d]", settingData.option.smscList.smscData[i].dcs); MSG_DEBUG("val_period[%d]", settingData.option.smscList.smscData[i].valPeriod); MSG_SEC_DEBUG("name[%s]", settingData.option.smscList.smscData[i].name); @@ -388,14 +375,12 @@ void SmsPluginSatHandler::initSMSCList() MSG_SEC_DEBUG("address[%s]", settingData.option.smscList.smscData[i].smscAddr.address); } - if (MsgSettingSetInt(SMSC_SELECTED, settingData.option.smscList.selected) != MSG_SUCCESS) - { + if (MsgSettingSetInt(SMSC_SELECTED, settingData.option.smscList.selected) != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", SMSC_SELECTED); return; } - if (MsgSettingSetInt(SMSC_TOTAL_COUNT, settingData.option.smscList.totalCnt) != MSG_SUCCESS) - { + if (MsgSettingSetInt(SMSC_TOTAL_COUNT, settingData.option.smscList.totalCnt) != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", SMSC_TOTAL_COUNT); return; } @@ -403,8 +388,7 @@ void SmsPluginSatHandler::initSMSCList() char keyName[MAX_VCONFKEY_NAME_LEN]; msg_error_t err = MSG_SUCCESS; - for (int i = 0; i < settingData.option.smscList.totalCnt; i++) - { + for (int i = 0; i < settingData.option.smscList.totalCnt; i++) { memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", SMSC_PID, i); @@ -450,14 +434,13 @@ void SmsPluginSatHandler::initSMSCList() break; } - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", keyName); } } -void SmsPluginSatHandler::initCBConfig() +void SmsPluginSatHandler::initCBConfig() { MSG_SETTING_S settingData; @@ -466,17 +449,15 @@ void SmsPluginSatHandler::initCBConfig() settingData.type = MSG_CBMSG_OPT; - // Get Data From SIM + /* Get Data From SIM */ SmsPluginSetting::instance()->getConfigData(&settingData); - if (MsgSettingSetBool(CB_RECEIVE, settingData.option.cbMsgOpt.bReceive) != MSG_SUCCESS) - { + if (MsgSettingSetBool(CB_RECEIVE, settingData.option.cbMsgOpt.bReceive) != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", CB_RECEIVE); return; } - if (MsgSettingSetInt(CB_MAX_SIM_COUNT, settingData.option.cbMsgOpt.maxSimCnt) != MSG_SUCCESS) - { + if (MsgSettingSetInt(CB_MAX_SIM_COUNT, settingData.option.cbMsgOpt.maxSimCnt) != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data [%s]", CB_MAX_SIM_COUNT); return; } @@ -484,8 +465,7 @@ void SmsPluginSatHandler::initCBConfig() err = MsgStoAddCBChannelInfo(dbHandle, &(settingData.option.cbMsgOpt.channelData), settingData.option.cbMsgOpt.simIndex); MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err); - if (err != MSG_SUCCESS) - { + if (err != MSG_SUCCESS) { THROW(MsgException::SMS_PLG_ERROR, "Error to set config data"); } } @@ -513,7 +493,7 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL pos++; -// pTpdu[pos++] = SmsPluginTransport::instance()->getMsgRef(); + /*pTpdu[pos++] = SmsPluginTransport::instance()->getMsgRef(); */ /* TP-DA */ @@ -563,11 +543,11 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL MSG_DEBUG("user data : [%s]", userData.data); - // check for user data whether it is 7-bit packed or not. + /* check for user data whether it is 7-bit packed or not. */ bool is7bitPacked = false; int bitValue = 0; for (int i = 0; i < userData.length; i++) { - bitValue = userData.data[i] & ( 1 << 7); + bitValue = userData.data[i] & (1 << 7); if (bitValue != 0) { is7bitPacked = true; MSG_DEBUG("user data is already 7-bit packed !!"); diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp index 1b00ccb..76b7e2a 100755 --- a/plugin/sms_plugin/SmsPluginSetting.cpp +++ b/plugin/sms_plugin/SmsPluginSetting.cpp @@ -218,7 +218,7 @@ void SmsPluginSetting::initConfigData(TapiHandle *handle) MSG_INFO("Parameter Count [%d]", paramCnt); MSG_SMSC_DATA_S tmpSmscData = {}; - MSG_SMSC_LIST_S tmpSmscList = {0,}; + MSG_SMSC_LIST_S tmpSmscList = {0, }; for (int index = 0; index < paramCnt; index++) { memset(&tmpSmscData, 0x00, sizeof(MSG_SMSC_DATA_S)); @@ -256,7 +256,7 @@ void SmsPluginSetting::initConfigData(TapiHandle *handle) if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND) { MSG_DEBUG("simStatus == [%d]", simStatus[sim_idx]); - MSG_CBMSG_OPT_S cbMsgOpt = {0,}; + MSG_CBMSG_OPT_S cbMsgOpt = {0, }; cbMsgOpt.simIndex = sim_idx; if (getCbConfig(&cbMsgOpt) == true) { @@ -276,21 +276,6 @@ void SmsPluginSetting::initConfigData(TapiHandle *handle) } } else { MSG_WARN("######## getCbConfig Fail !!! #######"); - -#if 0 - // CSC doesn't support CB Info any longer - if (MsgCscGetCBInfo(&cbMsgOpt) == true) { - err = addCbOpt(&cbMsgOpt); - - if (err == MSG_SUCCESS) { - MSG_DEBUG("######## Add CB Option From CSC Success !!! #######"); - } else { - MSG_DEBUG("######## Add CB Option from CSC Fail !!! return : %d #######", err); - } - } else { - MSG_DEBUG("######## MsgCscGetCBInfo Fail !!! #######"); - } -#endif } /*==================== Default Voice mail Setting ====================*/ @@ -412,7 +397,6 @@ void SmsPluginSetting::SimRefreshCb(TapiHandle *handle) } pthread_detach(thd); - } @@ -437,7 +421,6 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting) case MSG_SMSC_LIST : setParamList(&pSetting->option.smscList); addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList)); -// setSmscInfo(&pSetting->option.smscList); break; case MSG_CBMSG_OPT : if (setCbConfig(&pSetting->option.cbMsgOpt) == false) { @@ -460,7 +443,6 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting) switch (pSetting->type) { case MSG_SMSC_LIST : -// getParamList(&pSetting->option.smscList); getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList)); break; @@ -524,7 +506,7 @@ void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList) else pTmpSmscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL; - pTmpSmscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value + pTmpSmscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; /* app cannot set this value */ } } @@ -573,7 +555,7 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt) } #if 0 - // Set Setting Data into Vconf + /* Set Setting Data into Vconf */ memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, pCbOpt->simIndex); if (MsgSettingSetBool(keyName, pCbOpt->bReceive) != MSG_SUCCESS) { @@ -632,7 +614,6 @@ void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting, int simIndex) MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]); } - } @@ -829,7 +810,6 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList) memset(&sca, 0x00, sizeof(TelSmsAddressInfo_t)); if (strlen(pSmscData->smscAddr.address) > 0) { - if (pSmscData->smscAddr.address[0] == '+') sca.Ton = TAPI_SIM_TON_INTERNATIONAL; else @@ -879,8 +859,6 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt) for (int i = 1; i <= simCnt; i++) { MutexLocker lock(mx); - //if (i == pCbOpt->simIndex) - // continue; memset(keyName, 0x00, sizeof(keyName)); snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, i); simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName); @@ -927,7 +905,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt) msg_error_t err = MSG_SUCCESS; MsgDbHandler *dbHandle = getDbHandle(); - err = MsgStoAddCBChannelInfo(dbHandle, const_cast(&pCbOpt->channelData),i); + err = MsgStoAddCBChannelInfo(dbHandle, const_cast(&pCbOpt->channelData), i); if (err != MSG_SUCCESS) { MSG_DEBUG("MsgStoAddCBChannelInfo is failed [%d]", err); return false; @@ -1027,7 +1005,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt) return; } - TelSimMailBoxNumber_t mailboxInfo = {0,}; + TelSimMailBoxNumber_t mailboxInfo = {0, }; bool bExistVoicetype = false; int i = 0; @@ -1046,7 +1024,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt) return; if (pTmpSimMailboxList.count == 0) { - char num[MAX_PHONE_NUMBER_LEN + 1] = {0,}; + char num[MAX_PHONE_NUMBER_LEN + 1] = {0, }; mailboxInfo.mb_type = TAPI_SIM_MAILBOX_VOICE; mailboxInfo.rec_index = 1; @@ -1228,7 +1206,7 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count) } int ret = TAPI_API_SUCCESS; - TelSimMessageWaitingReq_t mwReq = {0,}; + TelSimMessageWaitingReq_t mwReq = {0, }; simMwiInfoMap::iterator iter = simMwiInfo.find(simIndex); if(iter == simMwiInfo.end()) { @@ -1490,7 +1468,7 @@ void SmsPluginSetting::setCbConfigEvent(TapiHandle *handle, const MSG_CBMSG_OPT_ if (bTapiResult == true) { MSG_DEBUG("Success to get cb config data"); - pair newCbOpt (simIndex, *pCbOpt); + pair newCbOpt(simIndex, *pCbOpt); cbOptMap::iterator it = cbOpt.find(simIndex); if (it == cbOpt.end()) { @@ -1516,7 +1494,7 @@ void SmsPluginSetting::setCbConfigEvent(TapiHandle *handle, const MSG_CBMSG_OPT_ MSG_CBMSG_OPT_S pTmpCbOpt; memset(&pTmpCbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S)); - pair newCbOpt (simIndex, pTmpCbOpt); + pair newCbOpt(simIndex, pTmpCbOpt); cbOpt.insert(newCbOpt); } @@ -1662,7 +1640,7 @@ void SmsPluginSetting::setMailboxInfoEvent(TapiHandle *handle, SMS_SIM_MAILBOX_L if (pTmpMailboxList.list[i].alpha_id[0] != '\0') { char unpackAlphaId[MAX_SIM_XDN_ALPHA_ID_LEN+8]; int tmpLen = 0; - MSG_LANG_INFO_S langInfo = {0,}; + MSG_LANG_INFO_S langInfo = {0, }; memset(unpackAlphaId, 0x00, sizeof(unpackAlphaId)); @@ -1687,7 +1665,7 @@ void SmsPluginSetting::setMailboxInfoEvent(TapiHandle *handle, SMS_SIM_MAILBOX_L SMS_SIM_MAILBOX_LIST_S pDummySimMailboxList; memset(&pDummySimMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S)); - pair newTmpList (simIndex, pDummySimMailboxList); + pair newTmpList(simIndex, pDummySimMailboxList); simMailboxList.insert(newTmpList); } @@ -1701,13 +1679,9 @@ bool SmsPluginSetting::getMailboxInfoEvent() { int ret = 0; - //mx.lock(); - bTapiResult = false; ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); - //mx.unlock(); - if (ret == ETIMEDOUT) { MSG_DEBUG("WARNING: TAPI callback TIME-OUT"); return false; @@ -1730,7 +1704,7 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I int mwiCnt = 0; char keyName[MAX_VCONFKEY_NAME_LEN]; - pair newList (index, *pMwiInfo); + pair newList(index, *pMwiInfo); simMwiInfoMap::iterator it = simMwiInfo.find(index); if (it == simMwiInfo.end()) { @@ -1749,7 +1723,7 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I if (pTmpsimMwiInfoList.b_cphs == true) { mwiCnt = pTmpsimMwiInfoList.cphs_mwi.b_voice1; } else { - mwiCnt = pTmpsimMwiInfoList.mwi_list.mw_info[0].voice_count; // Normal case + mwiCnt = pTmpsimMwiInfoList.mwi_list.mw_info[0].voice_count; } /* TODO :: Add operation for voice mail of line 2 */ @@ -1768,7 +1742,7 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I memset(&pTmpsimMwiInfo, 0x00, sizeof(SMS_SIM_MWI_INFO_S)); - pair newList (index, pTmpsimMwiInfo); + pair newList(index, pTmpsimMwiInfo); simMwiInfoMap::iterator it = simMwiInfo.find(index); if (it == simMwiInfo.end()) { @@ -1847,12 +1821,8 @@ bool SmsPluginSetting::getResultFromSim() MSG_DEBUG("getResultFromSim() is called ."); - //mx.lock(); /* Caller of this function MUST acquire the mutex before calling the TAPI API */ - ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT); - //mx.unlock(); - if (ret == ETIMEDOUT) { MSG_DEBUG("WARNING: TAPI callback TIME-OUT"); return false; @@ -1898,7 +1868,7 @@ void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt) { MSG_BEGIN(); - MSG_MESSAGE_INFO_S msgInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; msgInfo.addressList = NULL; unique_ptr addressListBuf(&msgInfo.addressList, unique_ptr_deleter); @@ -1927,7 +1897,7 @@ void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt) msgInfo.sim_idx = simIndex; #if 0 - if (simMwiInfo.b_cphs == false) { // Normal case + if (simMwiInfo.b_cphs == false) { snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new voice message", mwiCnt); } else { snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "New voice message"); @@ -1960,7 +1930,7 @@ void SmsPluginSetting::setSimChangeStatus(TapiHandle *handle, bool bInitializing int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle); pthread_t thd; - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; tapiRet = tel_get_sim_init_info(handle, &status, &cardChanged); MSG_INFO("Tapi Ret=[%d], SIM index [%d], SIM status [%d], CardChanged [%d]", tapiRet, simIndex, status, cardChanged); @@ -1972,11 +1942,11 @@ void SmsPluginSetting::setSimChangeStatus(TapiHandle *handle, bool bInitializing MsgSettingSetInt(keyName, MSG_SIM_STATUS_CHANGED); simStatus[simIndex] = MSG_SIM_STATUS_CHANGED; } else { - snprintf(keyName, sizeof(keyName),"%s/%d", MSG_SIM_CHANGED, simIndex); + snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, simIndex); MsgSettingSetInt(keyName, MSG_SIM_STATUS_NORMAL); simStatus[simIndex] = MSG_SIM_STATUS_NORMAL; } -// tel_handle_list.push_back(handle); + /* Modified to call initSimInfo for SIM separately */ MSG_DEBUG("calling initSimInfo"); if (pthread_create(&thd, NULL, &initSimInfo, handle) < 0) { @@ -1995,7 +1965,6 @@ void SmsPluginSetting::setSimChangeStatus(TapiHandle *handle, bool bInitializing MSG_DEBUG("Fail to set MSG_SIM_CHANGED to MSG_SIM_STATUS_NOT_FOUND"); simStatus[simIndex] = MSG_SIM_STATUS_NOT_FOUND; - } MSG_END(); diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp index 986cbb3..864a836 100755 --- a/plugin/sms_plugin/SmsPluginSimMsg.cpp +++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp @@ -57,8 +57,6 @@ SmsPluginSimMsg::SmsPluginSimMsg() SmsPluginSimMsg::~SmsPluginSimMsg() { - - } @@ -75,7 +73,7 @@ void SmsPluginSimMsg::initSimMessage(TapiHandle *handle) { MSG_BEGIN(); - char keyName[MAX_VCONFKEY_NAME_LEN] = {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle); snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx); @@ -157,7 +155,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) { tpdu.tpduType = SMS_TPDU_SUBMIT; tpdu.data.submit.dcs.msgClass = SMS_MSG_CLASS_NONE; - //SmsPluginTransport::instance()->setSmsSendOptions(&(tpdu.data.submit)); + /*SmsPluginTransport::instance()->setSmsSendOptions(&(tpdu.data.submit));*/ tpdu.data.submit.vpf = SMS_VPF_NOT_PRESENT; tpdu.data.submit.dcs.codingScheme = SMS_CHARSET_AUTO; } else { @@ -216,16 +214,15 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, } if (submitData.segCount > 1) { - if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ /* SUBMIT MSG */ + if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) { /* SUBMIT MSG */ tpdu.data.submit.bHeaderInd = true; } else { tpdu.data.deliver.bHeaderInd = true; } - } for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) { - if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ + if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) { memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S)); } else { memcpy(&(tpdu.data.deliver.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S)); @@ -312,7 +309,6 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInfo) { - msg_error_t err = MSG_SUCCESS; bool bSimSst = true; int tapiRet = TAPI_API_SUCCESS; @@ -402,7 +398,7 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) { /* Create TelSmsData_t data */ - TelSmsData_t simSmsData = {0,}; + TelSmsData_t simSmsData = {0, }; if (submitData.segCount == 1) { memcpy(&simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca)); @@ -613,7 +609,7 @@ void SmsPluginSimMsg::setSmsOptions(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_DELI pDeliver->dcs.codingGroup = SMS_GROUP_GENERAL; /* use encoding type of received message instead of message settings */ - //pDeliver->dcs.codingScheme = (SMS_CODING_SCHEME_T)MsgSettingGetInt(SMS_SEND_DCS); + /*pDeliver->dcs.codingScheme = (SMS_CODING_SCHEME_T)MsgSettingGetInt(SMS_SEND_DCS);*/ pDeliver->dcs.codingScheme = pMsgInfo->encodeType; MSG_DEBUG("DCS : %d", pDeliver->dcs.codingScheme); @@ -632,30 +628,30 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D pDeliver->timeStamp.format = SMS_TIME_ABSOLUTE; /* encode absolute time */ - struct tm timeinfo = {0,}; + struct tm timeinfo = {0, }; tzset(); localtime_r(&pMsgInfo->displayTime, &timeinfo); pDeliver->timeStamp.time.absolute.year = timeinfo.tm_year - 100; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.year is %d",pDeliver->timeStamp.time.absolute.year); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.year is %d", pDeliver->timeStamp.time.absolute.year); pDeliver->timeStamp.time.absolute.month = timeinfo.tm_mon + 1; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.month is %d",pDeliver->timeStamp.time.absolute.month); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.month is %d", pDeliver->timeStamp.time.absolute.month); pDeliver->timeStamp.time.absolute.day = timeinfo.tm_mday; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.day is %d",pDeliver->timeStamp.time.absolute.day); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.day is %d", pDeliver->timeStamp.time.absolute.day); pDeliver->timeStamp.time.absolute.hour = timeinfo.tm_hour; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.hour is %d",pDeliver->timeStamp.time.absolute.hour); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.hour is %d", pDeliver->timeStamp.time.absolute.hour); pDeliver->timeStamp.time.absolute.minute = timeinfo.tm_min; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.minute is %d",pDeliver->timeStamp.time.absolute.minute); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.minute is %d", pDeliver->timeStamp.time.absolute.minute); pDeliver->timeStamp.time.absolute.second = timeinfo.tm_sec; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.second is %d",pDeliver->timeStamp.time.absolute.second); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.second is %d", pDeliver->timeStamp.time.absolute.second); pDeliver->timeStamp.time.absolute.timeZone = 0; - MSG_DEBUG("pDeliver->timeStamp.time.absolute.timeZone is %d",pDeliver->timeStamp.time.absolute.timeZone); + MSG_DEBUG("pDeliver->timeStamp.time.absolute.timeZone is %d", pDeliver->timeStamp.time.absolute.timeZone); MSG_END(); } @@ -668,7 +664,7 @@ void SmsPluginSimMsg::setSimMsgCntEvent(TapiHandle *handle, const MSG_SIM_COUNT_ MSG_INFO("Sim Message Count is %d.", pSimMsgCnt->usedCount); int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle); - char keyName[MAX_VCONFKEY_NAME_LEN]= {0,}; + char keyName[MAX_VCONFKEY_NAME_LEN] = {0, }; for (int i = 0; i < pSimMsgCnt->usedCount; i++) { MSG_DEBUG("Sim Message Index is %d.", pSimMsgCnt->indexList[i]); @@ -726,7 +722,7 @@ void SmsPluginSimMsg::setSimMsgEvent(TapiHandle *handle, const MSG_MESSAGE_INFO_ memcpy(&simMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S)); simMsgInfo.addressList = &simAddrInfo; - memcpy(&simAddrInfo,pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S)); + memcpy(&simAddrInfo, pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S)); } cv.signal(); @@ -811,7 +807,7 @@ void SmsPluginSimMsg::setSaveSimMsgEvent(TapiHandle *handle, int simId, int resu void SmsPluginSimMsg::setSaveClass2MsgEvent(TapiHandle *handle, int simId, int result, MSG_MESSAGE_INFO_S *pMsgInfo) { msg_error_t err = MSG_SUCCESS; -// int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle); + /*int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle); */ if (result == TAPI_NETTEXT_SENDSMS_SUCCESS && simId >= 0 && pMsgInfo) { bool isNewSimMsg = true; diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp index c1e41b0..0093140 100755 --- a/plugin/sms_plugin/SmsPluginStorage.cpp +++ b/plugin/sms_plugin/SmsPluginStorage.cpp @@ -45,7 +45,6 @@ SmsPluginStorage::SmsPluginStorage() SmsPluginStorage::~SmsPluginStorage() { - } @@ -89,7 +88,6 @@ msg_error_t SmsPluginStorage::insertMsgRef(MSG_MESSAGE_INFO_S *pMsg, unsigned ch MSG_END(); return MSG_SUCCESS; - } @@ -230,13 +228,13 @@ msg_error_t SmsPluginStorage::updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_ne MSG_DEBUG("MsgExecQuery() : [%s]", sqlQuery); return MSG_ERR_DB_EXEC; } - //contacts-service is not used for gear + #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED if (status == MSG_NETWORK_SEND_SUCCESS) { MSG_DEBUG("MsgAddPhoneLog() : folderId [%d]", pMsgInfo->folderId); MsgAddPhoneLog(pMsgInfo); } -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ MSG_END(); return MSG_SUCCESS; @@ -353,7 +351,6 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int } return err; - } @@ -423,7 +420,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo) (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) { err = addClass2Message(pMsgInfo); } - else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS){ + else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { err = MSG_SUCCESS; } return err; @@ -431,7 +428,6 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo) /** Amend message information for type **/ if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS) { - MSG_DEBUG("Normal SMS"); if (pMsgInfo->msgType.classType == MSG_CLASS_2) { @@ -486,7 +482,6 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo) dbHandle->beginTrans(); if (pMsgInfo->nAddressCnt > 0) { - err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId); if (err != MSG_SUCCESS) { @@ -846,7 +841,6 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo) err = MsgStoCheckMsgCntFull(dbHandle, &(pMsgInfo->msgType), pMsgInfo->folderId); if (err != MSG_SUCCESS) { - if (err == MSG_ERR_MESSAGE_COUNT_FULL) { bool bAutoErase = false; @@ -891,7 +885,7 @@ msg_error_t SmsPluginStorage::isReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage) snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE GEO_SCOPE = %d AND MSG_CODE = %d AND MESSAGE_ID = %d AND UPDATE_NUM = %d", MSGFW_RECEIVED_CB_MSG_TABLE_NAME, CbPage.pageHeader.serialNum.geoScope, - CbPage.pageHeader.serialNum.msgCode,CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum); + CbPage.pageHeader.serialNum.msgCode, CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum); err = dbHandle->getTable(sqlQuery, &rowCnt, NULL); MSG_DEBUG("rowCnt: %d", rowCnt); @@ -902,7 +896,6 @@ msg_error_t SmsPluginStorage::isReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage) msg_error_t SmsPluginStorage::insertReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage) { - msg_error_t err = MSG_SUCCESS; unsigned int rowId = 0; @@ -916,17 +909,16 @@ msg_error_t SmsPluginStorage::insertReceivedCBMessage(SMS_CBMSG_PAGE_S CbPage) if (err != MSG_SUCCESS) return err; - // Add Folder + /* Add Folder */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);", MSGFW_RECEIVED_CB_MSG_TABLE_NAME, rowId, CbPage.pageHeader.serialNum.geoScope, - CbPage.pageHeader.serialNum.msgCode,CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum); + CbPage.pageHeader.serialNum.msgCode, CbPage.pageHeader.msgId, CbPage.pageHeader.serialNum.updateNum); if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; return MSG_SUCCESS; - } #endif @@ -957,8 +949,8 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou return err; } - char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0,}; - char appId[MAX_WAPPUSH_ID_LEN + 1] = {0,}; + char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0, }; + char appId[MAX_WAPPUSH_ID_LEN + 1] = {0, }; int appcode = 0, default_appcode = 0; bool found = false; char *_content_type = NULL, *_app_id = NULL; @@ -973,7 +965,7 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou dbHandle->getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, appId); appcode = dbHandle->getColumnToInt(index++); - //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id); + /* MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id); */ _content_type = strcasestr(pPushHeader, contentType); if (_content_type) { _app_id = strcasestr(pPushHeader, appId); @@ -1018,7 +1010,7 @@ msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode) std::list::iterator it = pushAppInfoList.begin(); int count = 0; for (; it != pushAppInfoList.end(); it++) { - if (index == count){ + if (index == count) { *appcode = it->appcode; break; } @@ -1045,7 +1037,7 @@ msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo) { MSG_BEGIN(); MsgDbHandler *dbHandle = getDbHandle(); - char sqlQuery[MAX_QUERY_LEN+1] = {0,}; + char sqlQuery[MAX_QUERY_LEN+1] = {0, }; msg_thread_id_t convId = 0; dbHandle->beginTrans(); diff --git a/plugin/sms_plugin/SmsPluginTpduCodec.cpp b/plugin/sms_plugin/SmsPluginTpduCodec.cpp index 50e1abe..51d63f4 100755 --- a/plugin/sms_plugin/SmsPluginTpduCodec.cpp +++ b/plugin/sms_plugin/SmsPluginTpduCodec.cpp @@ -32,15 +32,11 @@ ==================================================================================================*/ SmsPluginTpduCodec::SmsPluginTpduCodec() { - - } SmsPluginTpduCodec::~SmsPluginTpduCodec() { - - } @@ -192,8 +188,7 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu) #if 0 printf("\n\n[encodeSubmit] pTpdu data.\n"); - for (int i = 0; i < offset; i++) - { + for (int i = 0; i < offset; i++) { printf(" [%02x]", pTpdu[i]); } printf("\n\n"); @@ -532,7 +527,7 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S } #else - //For alphanumeric address test + /* For alphanumeric address test */ offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress)); @@ -558,7 +553,7 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S pDeliver->pid = 0x20; offset++; offset += SmsPluginParamCodec::decodeDCS((unsigned char*)address, &(pDeliver->dcs)); - // end test + /* end test */ #endif if (pDeliver->pid == 0x20 && pDeliver->originAddress.ton == SMS_TON_ALPHANUMERIC) { @@ -600,8 +595,7 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL #ifdef LOG_ENABLE printf("\n\n[decodeStatusReport] pTpdu data - Length [%d]\n", TpduLen); - for (int i = 0; i < TpduLen; i++) - { + for (int i = 0; i < TpduLen; i++) { printf(" [%02x]", pTpdu[i]); } printf("\n\n"); diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp index ee15199..1330a46 100755 --- a/plugin/sms_plugin/SmsPluginTransport.cpp +++ b/plugin/sms_plugin/SmsPluginTransport.cpp @@ -60,7 +60,6 @@ SmsPluginTransport::SmsPluginTransport() SmsPluginTransport::~SmsPluginTransport() { - } @@ -77,7 +76,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) { MSG_BEGIN(); - SMS_TPDU_S tpdu = {0,}; + SMS_TPDU_S tpdu = {0, }; tpdu.tpduType = SMS_TPDU_SUBMIT; @@ -94,7 +93,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) setSmsReportOption(pReqInfo, &tpdu); /* Set SMSC Options */ - SMS_ADDRESS_S smsc = {0,}; + SMS_ADDRESS_S smsc = {0, }; setSmscOptions(pReqInfo->msgInfo.sim_idx, &smsc); /* Get TAPI handle */ @@ -121,7 +120,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) { /* Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S */ - SMS_SUBMIT_DATA_S submitData = {{0},}; + SMS_SUBMIT_DATA_S submitData = {{0}, }; msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme), i); /* Insert message reference into db */ @@ -240,7 +239,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S)); - if ((segCnt + 1) == submitData.segCount && (i + 1)==pReqInfo->msgInfo.nAddressCnt) { + if ((segCnt + 1) == submitData.segCount && (i + 1) == pReqInfo->msgInfo.nAddressCnt) { sentInfo.bLast = true; bMoreMsg = FALSE; } else { @@ -253,7 +252,7 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) int svc_type; tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type); - if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){ + if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) { MSG_DEBUG("Network service is not available : [%d]", svc_type); SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING); MsgInsertTicker("Unable to send message. It will be sent when service available.", SMS_MESSAGE_SENDING_PENDING, false, 0); @@ -281,7 +280,6 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) MSG_DEBUG("retMoCtrlStatus = [%d]", retMoCtrlStatus); if (retMoCtrlStatus == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) { - if (bRetryByMoCtrl == false) { bRetryByMoCtrl = true; @@ -331,12 +329,12 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) } #ifdef MSG_SMS_REPORT - if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false) { + if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false) { if (pReqInfo->sendOptInfo.bDeliverReq == true) { MSG_DEBUG("Update Delivery Report Status : [%d] Msg ID : [%d]", err, tmpInfo.msgInfo.msgId); /* Adding delivery report status info. */ - MsgStoAddDeliveryReportStatus( tmpInfo.msgInfo.msgId, (unsigned char)tmpInfo.msgInfo.referenceId); + MsgStoAddDeliveryReportStatus(tmpInfo.msgInfo.msgId, (unsigned char)tmpInfo.msgInfo.referenceId); } } #endif @@ -381,7 +379,6 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo) if (tpdu.data.submit.userData.headerCnt > 0) tpdu.data.submit.userData.headerCnt--; - } } @@ -431,12 +428,9 @@ void SmsPluginTransport::sendDeliverReport(TapiHandle *handle, msg_error_t err) #if 0 tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL); - if (tapiRet == TAPI_API_SUCCESS) - { + if (tapiRet == TAPI_API_SUCCESS) { MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######"); - } - else - { + } else { MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet); } #endif @@ -457,7 +451,6 @@ void SmsPluginTransport::sendDeliverReport(TapiHandle *handle, msg_error_t err) /*response = TAPI_NETTEXT_PROTOCOL_ERROR; For gcf test [34.2.5.3 class2 message] */ response = TAPI_NETTEXT_SIM_FULL; - } MSG_DEBUG("err : [%d], response : [%02x]", err, response); @@ -573,7 +566,6 @@ void SmsPluginTransport::sendClass0DeliverReport(TapiHandle *handle, msg_error_t /*response = TAPI_NETTEXT_PROTOCOL_ERROR; For gcf test [34.2.5.3 class2 message] */ response = TAPI_NETTEXT_SIM_FULL; - } MSG_DEBUG("err : [%d], response : [%02x]", err, response); @@ -650,7 +642,7 @@ void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit) MSG_DEBUG("DCS : %d", pSubmit->dcs.codingScheme); - MSG_SMSC_LIST_S smscList = {0,}; + MSG_SMSC_LIST_S smscList = {0, }; SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList); int selectIdx = smscList.selected; @@ -737,7 +729,7 @@ void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TP void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc) { /* Set SMSC Options */ - MSG_SMSC_LIST_S smscList = {0,}; + MSG_SMSC_LIST_S smscList = {0, }; SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList); int selectIdx = smscList.selected; @@ -987,16 +979,14 @@ void SmsPluginTransport::setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstH pDstHeader->udhType = pSrcHeader->udhType; switch (pDstHeader->udhType) { - case SMS_UDH_CONCAT_8BIT : - { + case SMS_UDH_CONCAT_8BIT: { pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef; pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg; pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum; } break; - case SMS_UDH_CONCAT_16BIT : - { + case SMS_UDH_CONCAT_16BIT: { pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef; pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg; pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum; diff --git a/plugin/sms_plugin/SmsPluginUAManager.cpp b/plugin/sms_plugin/SmsPluginUAManager.cpp index 33b1df5..5530003 100755 --- a/plugin/sms_plugin/SmsPluginUAManager.cpp +++ b/plugin/sms_plugin/SmsPluginUAManager.cpp @@ -38,7 +38,6 @@ SmsPluginUAManager::SmsPluginUAManager() : mx(), cv() SmsPluginUAManager::~SmsPluginUAManager() { - } @@ -91,7 +90,7 @@ void SmsPluginUAManager::run() void SmsPluginUAManager::addReqEntity(SMS_REQUEST_INFO_S *request) { - SMS_REQUEST_INFO_S reqTmp = {0,}; + SMS_REQUEST_INFO_S reqTmp = {0, }; memcpy(&reqTmp, request, sizeof(SMS_REQUEST_INFO_S)); diff --git a/plugin/sms_plugin/SmsPluginUDCodec.cpp b/plugin/sms_plugin/SmsPluginUDCodec.cpp index e43d8a6..7662708 100755 --- a/plugin/sms_plugin/SmsPluginUDCodec.cpp +++ b/plugin/sms_plugin/SmsPluginUDCodec.cpp @@ -26,13 +26,11 @@ using namespace std; ==================================================================================================*/ SmsPluginUDCodec::SmsPluginUDCodec() { - } SmsPluginUDCodec::~SmsPluginUDCodec() { - } @@ -617,8 +615,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade pHeader->udhType = pTpdu[offset++]; switch (pHeader->udhType) { - case SMS_UDH_CONCAT_8BIT : - { + case SMS_UDH_CONCAT_8BIT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -634,8 +631,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_CONCAT_16BIT : - { + case SMS_UDH_CONCAT_16BIT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -652,8 +648,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_APP_PORT_8BIT : - { + case SMS_UDH_APP_PORT_8BIT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -667,8 +662,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_APP_PORT_16BIT : - { + case SMS_UDH_APP_PORT_16BIT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -684,8 +678,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_SPECIAL_SMS : - { + case SMS_UDH_SPECIAL_SMS: { IEDL = pTpdu[offset++]; if (IEDL != 2) @@ -699,8 +692,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_ALTERNATE_REPLY_ADDRESS : - { + case SMS_UDH_ALTERNATE_REPLY_ADDRESS: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -712,8 +704,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_SINGLE_SHIFT : - { + case SMS_UDH_SINGLE_SHIFT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -725,8 +716,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - case SMS_UDH_LOCKING_SHIFT : - { + case SMS_UDH_LOCKING_SHIFT: { IEDL = pTpdu[offset++]; if (IEDL == 0) @@ -738,8 +728,7 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade } break; - default : - { + default: { MSG_DEBUG("Not Supported Header Type [%02x]", pHeader->udhType); IEDL = pTpdu[offset++]; diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp index eab0306..39056c1 100755 --- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp +++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp @@ -30,10 +30,10 @@ #include #endif -static unsigned short wapPushPortList [] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F}; +static unsigned short wapPushPortList[] = {0x0b84, 0x0b85, 0x23F0, 0x23F1, 0x23F2, 0x23F3, 0xC34F}; #if 0 -const SMS_PUSH_APP_INFO_S pushDefaultApplication [] = +const SMS_PUSH_APP_INFO_S pushDefaultApplication[] = { {(char*)"text/vnd.wap.si", (char*)"X-Wap-Application-Id: x-wap-application:wml.ua\r\n", SMS_WAP_APPLICATION_PUSH_SI}, {(char*)"application/vnd.wap.sic", (char*)"X-Wap-Application-Id: x-wap-application:wml.ua\r\n", SMS_WAP_APPLICATION_PUSH_SIC}, @@ -265,7 +265,7 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = { { (char*)"application/vnd.wap.multipart.byteranges", 0x25 }, { (char*)"application/vnd.wap.multipart.alternative", 0x26 }, { (char*)"application/xml", 0x27 }, - { (char*)"text/xml",0x28 }, + { (char*)"text/xml", 0x28 }, { (char*)"application/vnd.wap.wbxml", 0x29 }, { (char*)"application/x-x968-cross-cert", 0x2a }, { (char*)"application/x-x968-ca-cert", 0x2b }, @@ -651,10 +651,10 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] = { const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = { - {(char*)"NETWPIN",0x00}, - {(char*)"USERPIN",0x01}, - {(char*)"USERNETWPIN",0x02}, - {(char*)"USERPINMAC",0x03} + {(char*)"NETWPIN", 0x00}, + {(char*)"USERPIN", 0x01}, + {(char*)"USERNETWPIN", 0x02}, + {(char*)"USERPINMAC", 0x03} }; @@ -712,7 +712,6 @@ SmsPluginWapPushHandler::SmsPluginWapPushHandler() SmsPluginWapPushHandler::~SmsPluginWapPushHandler() { - } @@ -742,7 +741,6 @@ bool SmsPluginWapPushHandler::IsWapPushMsg(SMS_USERDATA_S *pUserData) if (pUserData->header[i].udhType == SMS_UDH_APP_PORT_8BIT) { /** Have to check something??? */ } else if (pUserData->header[i].udhType == SMS_UDH_APP_PORT_16BIT) { - for (int j = 0; j < PortCount; j++) { if (pUserData->header[i].udh.appPort16bit.destPort == wapPushPortList[j]) { MSG_DEBUG("Wap Push Msg : [%04x]", wapPushPortList[j]); @@ -768,7 +766,6 @@ SMS_WAP_APP_CODE_T SmsPluginWapPushHandler::getAppCode(const char *pPushHeader) MSG_DEBUG("Application Count [%d]", appCount); for (int i = 0; i < appCount; i++) { - header = (unsigned char*)strcasestr(pPushHeader, pushDefaultApplication[i].pContentType); if (header != NULL) { @@ -860,7 +857,6 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi MSG_DEBUG("wspBodyLen [%d]", wspBodyLen); if (wspHeaderLen > 0) { - pWspHeader = new char[wspHeaderLen]; if (pWspHeader == NULL) { @@ -891,7 +887,6 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi wspBodyLen = PDUTypeDataLen - wspHeaderLen; if (wspBodyLen > 0) { - pWspBody = new char[wspBodyLen]; if (pWspBody == NULL) { @@ -1042,30 +1037,30 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML: case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML: MSG_DEBUG("Received DRM V2"); - // TODO: DRM V2 + /* TODO: DRM V2 */ break; case SMS_WAP_APPLICATION_PUSH_EMAIL: case SMS_WAP_APPLICATION_PUSH_EMAIL_XML: case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML: MSG_DEBUG("Received Email"); - // TODO: Email + /* TODO: Email */ break; case SMS_WAP_APPLICATION_PUSH_IMPS_CIR: MSG_DEBUG("Received IMPS CIR"); - // TODO: IMPS CIR + /* TODO: IMPS CIR */ break; case SMS_WAP_APPLICATION_LBS : MSG_DEBUG("Received LBS related message"); SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen); - // TODO: LBS + /* TODO: LBS */ break; case SMS_WAP_APPLICATION_PUSH_SIA : MSG_DEBUG("Received SIA"); - // TODO: SIA + /* TODO: SIA */ break; default: @@ -1095,8 +1090,7 @@ static void launchProcessByAppcode(int appcode) case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML: case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS: case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS: - case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION: - { + case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION: { connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (error) { MSG_DEBUG("Connecting to system bus failed: %s\n", error->message); @@ -1123,7 +1117,7 @@ static void launchProcessByAppcode(int appcode) goto _DBUS_ERROR; } - dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL, + dbus_proxy_service = g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.tizen.omadmservice", "/org/tizen/omadmservice", "org.tizen.omadmservice", NULL, &error); if (error) { @@ -1147,8 +1141,7 @@ static void launchProcessByAppcode(int appcode) } break; case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION: - case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML: - { + case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML: { connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if (error) { MSG_DEBUG("Connecting to system bus failed: %s\n", error->message); @@ -1226,8 +1219,8 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu msg_error_t err = MSG_SUCCESS; int pushEvt_cnt = 0; - char app_id[MAX_WAPPUSH_ID_LEN] = {0,}; - char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN] = {0,}; + char app_id[MAX_WAPPUSH_ID_LEN] = {0, }; + char content_type[MAX_WAPPUSH_CONTENT_TYPE_LEN] = {0, }; SmsPluginStorage *storageHandler = SmsPluginStorage::instance(); err = storageHandler->getRegisteredPushEvent(pPushHeader, &pushEvt_cnt, app_id, sizeof(app_id), content_type, sizeof(content_type)); @@ -1679,14 +1672,14 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen, xmlFreeDoc(xmlDoc); return; } else { - MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name); + MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n", topNode->name); } indNode = topNode; while (indNode != NULL) { if (!xmlStrcmp(indNode->name, (const xmlChar*)"sl")) { - MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name); + MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); break; } @@ -1815,7 +1808,6 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, while (indNode != NULL) { - xmlChar* tmpUrl = NULL; if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_OBJ)) { MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); @@ -1830,7 +1822,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, MSG_DEBUG("NO href value from the xmlDoc\n"); } } else if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_SVC)) { - MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name); + MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name); tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI); if (tmpUrl != NULL) { @@ -2051,7 +2043,6 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod *pXmlDoc = xmlParseMemory((char*)xmldata, AcStrlen((char*)xmldata)); } - } unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) @@ -2065,7 +2056,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate) memset(&timeStruct, 0x00, sizeof(struct tm)); /** check pDate */ - if (AcStrlen(pDate)<20) + if (AcStrlen(pDate) < 20) return 0; MSG_DEBUG("pDate [%s]", pDate); @@ -2159,7 +2150,6 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio /** signal-medium is default action value. */ return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM; - } msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pAction) @@ -2188,7 +2178,6 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio /** default SL action value is execute-low. */ return MSG_PUSH_SL_ACTION_EXECUTE_LOW; - } @@ -2202,7 +2191,7 @@ unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode(unsigned char* so decodedValue = wspDecodeUintvar(i + 1, sourceData + *currentPointer); *currentPointer = *currentPointer + i + 1; - MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue); + MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n", decodedValue); return decodedValue; } @@ -2256,7 +2245,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns szBuf[0] = 0x00; MSG_DEBUG("wspDecodeHeader: RAW data \n"); - for (loop = 0 ; loop<(int)encodedHeaderLen; loop++) { + for (loop = 0 ; loop < (int)encodedHeaderLen; loop++) { char szTempBuf[5]; szTempBuf[0] = 0x00; snprintf(szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop]); @@ -2272,7 +2261,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns } strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1); MSG_DEBUG("[%s]", szBuf); - MSG_DEBUG("fContentType=%d \n",fContentType); + MSG_DEBUG("fContentType=%d \n", fContentType); /* operation for content-type */ /* makes psuedo- content-type fieldcode */ /* content - type is processed with header. But it's come without field code. So existence of fContentType can decide adding content type header field code whether ContentType + general header is or not. */ @@ -2327,7 +2316,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns unsigned char* fieldName = (unsigned char*)gWapCodeBufferLeft; unsigned char* fieldValue = (unsigned char*)gWapCodeBufferRight; - strncpy((char*)fieldName, (char*)(encodedHeader + iEncodedHeader),WSP_CODE_BUFFER_LEFT_LEN_MAX-1); + strncpy((char*)fieldName, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_LEFT_LEN_MAX-1); fieldName[WSP_CODE_BUFFER_LEFT_LEN_MAX-1] = '\0'; iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldName) + 1; strncpy((char*)fieldValue, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1); @@ -2343,9 +2332,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns } else if (track > 0x7f) { /* In case of first byte is field code, else case is error. */ - /*if ((track & 0x7f) <= wspHeaderFieldCount) */ - { - + /*if ((track & 0x7f) <= wspHeaderFieldCount) { */ unsigned long fieldValueLen = encodedHeader[iEncodedHeader + 1]; unsigned char fieldValue[1275]; fieldCode = track & 0x7f; @@ -2367,7 +2354,6 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns /* field value is string */ /* In this case, it just copy field value. */ if ((fieldValueLen > LENGTH_QUOTE) && (fieldValueLen < 0x80)) { - /* string field value should be NULL terminated */ strncat((char*)temper, (char*)(encodedHeader + iEncodedHeader + 1), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); @@ -2391,9 +2377,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns it's decoded by above value. */ if (fieldValueLen < 0x20) { - if (fieldValueLen == LENGTH_QUOTE) { - /* field length is encoded in UINTVAR */ unsigned long uintvarLen = 0; fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen); @@ -2401,7 +2385,6 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2; } else { - if (fieldValueLen == 1) { /* field value is one byte integer over 0x80 */ /** make it two byte integer */ @@ -2440,251 +2423,240 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns switch (fieldCode) { /* accept charset */ /* It's normal way of field process. */ - case 0x01 : - { - unsigned long i = 0; - unsigned long code; - - /* Case of length of charset greater than 1 are two thigins. - 1. code length of charset is greater than 1. - 2. It include parameter. - 3. Or both of two - */ - if (1 != fieldValueLen) { - code = wspHeaderDecodeInteger(fieldValue); - /* Calculate iField. */ - if (fieldValue[0] < 0x80) - iField = fieldValue[0]; - else - iField = 1; - - while (wspCharset[i].charsetCode != code) - i++; - strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - /* If parameter exist */ - if (iField < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeQValue(fieldValueLen - iField, fieldValue + iField, ¶m); - strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - } else { - code = fieldValue[0] & 0x7f; + case 0x01: { + unsigned long i = 0; + unsigned long code; + + /* Case of length of charset greater than 1 are two thigins. + 1. code length of charset is greater than 1. + 2. It include parameter. + 3. Or both of two + */ + if (1 != fieldValueLen) { + code = wspHeaderDecodeInteger(fieldValue); + /* Calculate iField. */ + if (fieldValue[0] < 0x80) + iField = fieldValue[0]; + else + iField = 1; - while ((wspCharset[i].charsetCode != code) && (wspCharset[i].charsetCode != 0xffff )) i++; - strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + while (wspCharset[i].charsetCode != code) + i++; + strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + /* If parameter exist */ + if (iField < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeQValue(fieldValueLen - iField, fieldValue + iField, ¶m); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } + } else { + code = fieldValue[0] & 0x7f; + while ((wspCharset[i].charsetCode != code) && (wspCharset[i].charsetCode != 0xffff )) i++; + strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; + } + break; /* type encoding */ /* Like below routine, Same decoding routine process together. */ /* Accept-encoding */ - case 0x02 : + case 0x02: /* content-encoding */ - case 0x0b : - { - int integerValue; + case 0x0b: { + int integerValue; - integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); - if (integerValue > 2) { - MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n"); - break; - } - strncat((char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + if (integerValue > 2) { + MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n"); + break; } - break; + strncat((char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* contents type decoder */ /* accept */ - case 0x00 : + case 0x00: /* content-type */ - case 0x11 : - { - unsigned long contentsTypeCode; - unsigned long i = 0; - /* encoded content type length body */ - unsigned long tempLen; - MSG_DEBUG("fieldValueLen: %d", fieldValueLen); - - /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */ - if (0 == fieldValueLen) { - strncat((char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - break; - } - /* 01 AE --> 00 AE --> AE*/ - if (fieldValueLen == 2 && fieldValue[0] == 0) { - memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); - MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); - } - - if ((fieldValue[0] < 0x20) || (fieldValue[0] >= 0x80)) { - if (fieldValue[0] >= 0x80) { - tempLen = 1; - } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */ - fieldValue[3] = fieldValue[2]; - fieldValue[2] = fieldValue[1]; - fieldValue[1] = fieldValue[0]; - fieldValue[0] = 0x02; - tempLen = 2; - fieldValueLen = 3; - MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n"); - } else { - tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */ - } - - if (tempLen == 1) { - - char* szExtendedContent; - - contentsTypeCode = fieldValue[0] & 0x7f; - while ((wspContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspContentsTypeCount)) i++; + case 0x11: { + unsigned long contentsTypeCode; + unsigned long i = 0; + /* encoded content type length body */ + unsigned long tempLen; + MSG_DEBUG("fieldValueLen: %d", fieldValueLen); + + /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */ + if (0 == fieldValueLen) { + strncat((char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + break; + } + /* 01 AE --> 00 AE --> AE*/ + if (fieldValueLen == 2 && fieldValue[0] == 0) { + memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); + MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); + } - /* If specified content type doesn't exist */ - if (i < wspContentsTypeCount) - strncat((char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if ((fieldValue[0] < 0x20) || (fieldValue[0] >= 0x80)) { + if (fieldValue[0] >= 0x80) { + tempLen = 1; + } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */ + fieldValue[3] = fieldValue[2]; + fieldValue[2] = fieldValue[1]; + fieldValue[1] = fieldValue[0]; + fieldValue[0] = 0x02; + tempLen = 2; + fieldValueLen = 3; + MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n"); + } else { + tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */ + } - szExtendedContent = wspExtendedDecodeType((char)contentsTypeCode); + if (tempLen == 1) { + char* szExtendedContent; - if (szExtendedContent != NULL) { - MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n "); - strncat((char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - } else { - contentsTypeCode = wspHeaderDecodeInteger(fieldValue); + contentsTypeCode = fieldValue[0] & 0x7f; + while ((wspContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspContentsTypeCount)) i++; - while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++; + /* If specified content type doesn't exist */ + if (i < wspContentsTypeCount) + strncat((char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - /** If there is a Content-Type assigned, */ - if (i < wspUnregisteredContentsTypeCount) - strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + szExtendedContent = wspExtendedDecodeType((char)contentsTypeCode); - tempLen +=1; + if (szExtendedContent != NULL) { + MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n "); + strncat((char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } else { - tempLen = AcStrlen((char*)fieldValue) + 1; + contentsTypeCode = wspHeaderDecodeInteger(fieldValue); + + while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++; - strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen); + /** If there is a Content-Type assigned, */ + if (i < wspUnregisteredContentsTypeCount) + strncat((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + + tempLen +=1; } + } else { + tempLen = AcStrlen((char*)fieldValue) + 1; - /* If there is a parameter */ - if (tempLen < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeParameter(fieldValue + tempLen, fieldValueLen - tempLen, ¶m); - if (param != NULL) { - strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen); + } + + /* If there is a parameter */ + if (tempLen < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeParameter(fieldValue + tempLen, fieldValueLen - tempLen, ¶m); + if (param != NULL) { + strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } } - break; + } + break; /* language */ /* content-language */ - case 0x0c : + case 0x0c: /* accept-language */ - case 0x03 : - { - unsigned long i = 0; - unsigned long code; - unsigned long tempLen; - if ((fieldValue[0] < 0x20) || (fieldValue[0] > 0x80)) { - if (fieldValue[0] > 0x80) - tempLen = 1; - else - tempLen = fieldValue[0]; - } else { - tempLen = AcStrlen((char*)fieldValue) + 1; - } - - if (tempLen == 1) { - - code = wspHeaderDecodeInteger(fieldValue); - while (wspLanguage[i].languageCode != code) { - i++; - if (i == wspLanguageCount) - break; - } + case 0x03: { + unsigned long i = 0; + unsigned long code; + unsigned long tempLen; + if ((fieldValue[0] < 0x20) || (fieldValue[0] > 0x80)) { + if (fieldValue[0] > 0x80) + tempLen = 1; + else + tempLen = fieldValue[0]; + } else { + tempLen = AcStrlen((char*)fieldValue) + 1; + } - if (i < wspLanguageCount) { - strncat((char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - } else { - strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (tempLen == 1) { + code = wspHeaderDecodeInteger(fieldValue); + while (wspLanguage[i].languageCode != code) { + i++; + if (i == wspLanguageCount) + break; } - if (tempLen < fieldValueLen) { - char* param = NULL; - unique_ptr parambuf(¶m, unique_ptr_deleter); - wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, ¶m); - strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (i < wspLanguageCount) { + strncat((char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } + } else { + strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; + + if (tempLen < fieldValueLen) { + char* param = NULL; + unique_ptr parambuf(¶m, unique_ptr_deleter); + wspHeaderDecodeQValue(fieldValueLen - tempLen, fieldValue + tempLen, ¶m); + strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + } + break; /* integer */ /* Max-forwards */ - case 0x1e : + case 0x1e: /* content-length */ - case 0x0d : + case 0x0d: /* age */ - case 0x05 : + case 0x05: /* Bearer-indication */ - case 0x33 : + case 0x33: /* Push-Flag */ - case 0x34 : - { - - unsigned char temp[16]; - /* - if ((fieldValueLen == 2) && (fieldValue[0] > 0x7f)) - AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[1]); - else - */ - snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - break; + case 0x34: { + unsigned char temp[16]; + /* + if ((fieldValueLen == 2) && (fieldValue[0] > 0x7f)) + AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[1]); + else + */ + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* X-Wap-Application-Id */ - case 0x2f : - { - unsigned char temp[64]; - int integerValue; - - if (track == 0xaf) { /* WAP short-integer-encoded */ - if (fieldValueLen == 2 && fieldValue[0] == 0) { - memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen); - } - integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); - } else { - if (fieldValueLen == 2 && fieldValue[0] == 0) { - memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); - MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); - fieldValueLen = 1; - } - integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + case 0x2f: { + unsigned char temp[64]; + int integerValue; + + if (track == 0xaf) { /* WAP short-integer-encoded */ + if (fieldValueLen == 2 && fieldValue[0] == 0) { + memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen); } + integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + } else { + if (fieldValueLen == 2 && fieldValue[0] == 0) { + memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1); + MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n"); + fieldValueLen = 1; + } + integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + } - MSG_DEBUG("integerValue = [%02x]", integerValue); + MSG_DEBUG("integerValue = [%02x]", integerValue); - int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S); - for (int i = 0; i < count ; ++i) { - if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) { - snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken); - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); - break; - } + int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S); + for (int i = 0; i < count ; ++i) { + if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) { + snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + break; } } - break; + } + break; /* Accept-Application */ - case 0x32 : + case 0x32: if (0x80 == fieldValue[0]) { strncat((char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); } else { - unsigned char temp[16]; /* if ((fieldValueLen == 2) && (fieldValue[0] == 1)) @@ -2699,51 +2671,49 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns /* date */ /* last-modified */ - case 0x1d : + case 0x1d: /* if-unmodified-since */ - case 0x1b : + case 0x1b: /* if-range */ - case 0x1a : + case 0x1a: /* if-modified-since */ - case 0x17 : + case 0x17: /* expires */ - case 0x14 : + case 0x14: /* date */ - case 0x12 : - { - char* decodedString = NULL; - unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); - wspHeaderDecodeDateValue(fieldValueLen, fieldValue, &decodedString); - strncat((char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); - } - break; + case 0x12: { + char* decodedString = NULL; + unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); + wspHeaderDecodeDateValue(fieldValueLen, fieldValue, &decodedString); + strncat((char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); + } + break; /* connection */ - case 0x09 : + case 0x09: if (fieldValue[0] == 0x80) strncat((char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); break; /* accept-ranges */ - case 0x04 : + case 0x04: if (fieldValue[0] == 0x80) strncat((char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); if (fieldValue[0] == 0x81) strncat((char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1); break; /* content-md5 */ - case 0x0f : - { - unsigned char temp[1275]; - memcpy(temp, fieldValue, (size_t)fieldValueLen); - temp[fieldValueLen] = 0; - wspHeaderCopyDecodedString(temp, ¤tLength, &temper); - } - break; + case 0x0f: { + unsigned char temp[1275]; + memcpy(temp, fieldValue, (size_t)fieldValueLen); + temp[fieldValueLen] = 0; + wspHeaderCopyDecodedString(temp, ¤tLength, &temper); + } + break; /* Credential */ /* authorization */ - case 0x07 : + case 0x07: /* proxy - authorization */ - case 0x21 : + case 0x21: if (fieldValue[0] == 0x80) { char* addString = NULL; unique_ptr addStringbuf(&addString, unique_ptr_deleter); @@ -2768,9 +2738,9 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns /* Challenge */ /* www - auth */ - case 0x2d : + case 0x2d: /* Proxy-authenticate */ - case 0x20 : + case 0x20: if (0 == fieldValueLen) break; if (fieldValue[0] == 0x80) { @@ -2803,39 +2773,37 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns break; /* content -range */ - case 0x10 : - { - unsigned long first, len, last; + case 0x10: { + unsigned long first, len, last; - unsigned char temp[16]; - iField = 0; + unsigned char temp[16]; + iField = 0; - strncat((char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + strncat((char*)temper, " bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - first = wspRetriveUintvarDecode(fieldValue, &iField); - len = wspRetriveUintvarDecode(fieldValue, &iField); - /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. - */ - last = first + contentsLength - 1; + first = wspRetriveUintvarDecode(fieldValue, &iField); + len = wspRetriveUintvarDecode(fieldValue, &iField); + /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. + */ + last = first + contentsLength - 1; - snprintf((char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len); - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - break; + snprintf((char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* cache-control */ - case 0x08 : - { - char* cacheString = NULL; - unique_ptr cacheStringbuf(&cacheString, unique_ptr_deleter); + case 0x08: { + char* cacheString = NULL; + unique_ptr cacheStringbuf(&cacheString, unique_ptr_deleter); - wspHeaderDecodeCacheControl(fieldValue, fieldValueLen, &cacheString); - strncat((char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - break; + wspHeaderDecodeCacheControl(fieldValue, fieldValueLen, &cacheString); + strncat((char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* pragma */ - case 0x1f : + case 0x1f: if (fieldValue[0] == 0x80) { strncat((char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } else { @@ -2853,17 +2821,16 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns break; /* public */ - case 0x22 : + case 0x22: /* allow */ - case 0x06 : - { - unsigned long i = 0; - while (wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen) != wspMethodType[i].methodCode) i++; - strncat((char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - } - break; + case 0x06: { + unsigned long i = 0; + while (wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen) != wspMethodType[i].methodCode) i++; + strncat((char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* range */ - case 0x23 : + case 0x23: strncat((char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); if (fieldValue[0] == 0x80) { unsigned char temp[16]; @@ -2883,11 +2850,10 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns suffix = wspRetriveUintvarDecode(fieldValue, &iField); snprintf((char*)temp, sizeof(temp), "-%u", (unsigned int)suffix); - } break; /* retry-after */ - case 0x25 : + case 0x25: if (fieldValue[0] == 0x80) { char* temp = NULL; unique_ptr tempbuf(&temp, unique_ptr_deleter); @@ -2899,53 +2865,51 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns if (fieldValue[0] == 0x81) { unsigned char temp[16]; - snprintf((char*)temp, 16, "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen)); + snprintf((char*)temp, 16, "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen)); strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } break; /* transfer-encoding */ - case 0x27 : + case 0x27: /* No other cases allowed */ if (fieldValue[0] == 0x80) strncat((char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); break; /* vary */ - case 0x2a : - { - int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen); - if (integerValue > wspHeaderFieldCount) { - MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount); - break; - } - strncat((char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + case 0x2a: { + int integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen); + if (integerValue > wspHeaderFieldCount) { + MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n", wspHeaderFieldCount); + break; } - break; + strncat((char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; /* warning */ - case 0x2c : - { - unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; - - if (fieldValue[0] < 0x20) - iField = fieldValue[0]; - else - iField = 1; - - snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, iField)); - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); - if (iField < fieldValueLen) { - unsigned char agent[WSP_STANDARD_STR_LEN_MAX]; - unsigned char text[WSP_STANDARD_STR_LEN_MAX]; - strncpy((char*)agent, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1); - iField = iField + AcStrlen((char*)agent) + 1; - strncpy((char*)text, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1); - snprintf((char*)temp, sizeof(temp), " %s %s", agent, text); - wspHeaderCopyDecodedString(temp, ¤tLength, &temper); - } + case 0x2c: { + unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; + + if (fieldValue[0] < 0x20) + iField = fieldValue[0]; + else + iField = 1; + + snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, iField)); + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + if (iField < fieldValueLen) { + unsigned char agent[WSP_STANDARD_STR_LEN_MAX]; + unsigned char text[WSP_STANDARD_STR_LEN_MAX]; + strncpy((char*)agent, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); + iField = iField + AcStrlen((char*)agent) + 1; + strncpy((char*)text, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1); + snprintf((char*)temp, sizeof(temp), " %s %s", agent, text); + wspHeaderCopyDecodedString(temp, ¤tLength, &temper); } - break; + } + break; /* content-disposition */ - case 0x2e : + case 0x2e: if (fieldValue[0] == 0x80) strncat((char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); @@ -2964,39 +2928,37 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns } break; /* Profile-diff */ - case 0x36 : + case 0x36: temper[AcStrlen((char*)temper) + fieldValueLen] = '\0'; memcpy(temper, fieldValue, (size_t)fieldValueLen); break; /* Profile-Warning */ - case 0x37 : - { - unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; - - snprintf((char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue)); - temp[2] = temp[1]; - temp[1] = (unsigned char)0x30; - temp[3] = '\0'; - if (fieldValueLen > 1) { - /* copy warn-target - URI */ - strncat((char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); - if (fieldValueLen > (AcStrlen((char*)(fieldValue + 1)) + 1)) { - /* copy warn-date */ - char* decodedString = NULL; - unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); - wspHeaderDecodeDateValue(fieldValueLen - (AcStrlen((char*)(fieldValue + 1)) + 2), fieldValue + AcStrlen((char*)(fieldValue + 1)) + 1, &decodedString); - strncat((char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); - } + case 0x37: { + unsigned char temp[WSP_STANDARD_STR_LEN_MAX]; + + snprintf((char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue)); + temp[2] = temp[1]; + temp[1] = (unsigned char)0x30; + temp[3] = '\0'; + if (fieldValueLen > 1) { + /* copy warn-target - URI */ + strncat((char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); + if (fieldValueLen > (AcStrlen((char*)(fieldValue + 1)) + 1)) { + /* copy warn-date */ + char* decodedString = NULL; + unique_ptr decodedStringbuf(&decodedString, unique_ptr_deleter); + wspHeaderDecodeDateValue(fieldValueLen - (AcStrlen((char*)(fieldValue + 1)) + 2), fieldValue + AcStrlen((char*)(fieldValue + 1)) + 1, &decodedString); + strncat((char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1); } - strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); } - break; + strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1); + } + break; - default : + default: break; } - - } + /*}*/ } /* It deosn't finished decoding yet. */ if ((iEncodedHeader < encodedHeaderLen) && (fieldCode != 0xff)) { @@ -3016,7 +2978,6 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns /* add single header to total headers */ strncat((char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1); MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper); - } @@ -3025,7 +2986,6 @@ void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, uns *pHeader = outTemper; return; - } @@ -3044,11 +3004,11 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger(unsigned char* dat if (data[0] < 0x80) { unsigned long IntLen = 0; - IntLen = (data[0]>0x04) ? 0x04:data[0]; + IntLen = (data[0] > 0x04) ? 0x04:data[0]; MSG_DEBUG("WspLHeaderDecodeInteger: input %d , length %d\n", data[0], IntLen); - for (i=0; i 6) || (pTMData.tm_mon > 11) || (pTMData.tm_mday > 31)) { + MSG_DEBUG("WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData.tm_wday, pTMData.tm_mon, pTMData.tm_mday); + strncpy((char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1); + return; } #ifdef MSG_FW_FOR_DEBUG /** Date type selection */ - switch (wspMachineStatus.dateType) - { + switch (wspMachineStatus.dateType) { /* UNIX asciitime function */ - case UNIX_DATE_TYPE : + case UNIX_DATE_TYPE: snprintf((char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon], pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900); break; - case RFC1123_DATE_TYPE : + case RFC1123_DATE_TYPE: snprintf((char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData.tm_wday], pTMData.tm_mday, wspMonth[pTMData.tm_mon], pTMData.tm_year + 1900, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec); break; - case RFC850_DATE_TYPE : + case RFC850_DATE_TYPE: /* Have some Y2K Problems */ /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */ snprintf((char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData.tm_wday], pTMData.tm_mday, @@ -3374,7 +3329,6 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue(unsigned long length, uns pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900); return; - } void SmsPluginWapPushHandler::wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper) @@ -3490,7 +3444,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa case 0x07 : if (fieldValue[1] > 0x7f) { /* well known field name */ - strncpy((char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1); + strncpy((char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1); paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0'; } else { /* unknown field name */ @@ -3509,7 +3463,6 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa default : break; - } snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString); } else { @@ -3522,7 +3475,6 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa stringLen = AcStrlen((char*)*pCacheString); if (stringLen + 1 < fieldValueLen) { - if (fieldValue[stringLen+ 1] > 0x7f) { int untyped = (int)wspHeaderDecodeIntegerByLength(fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1)); @@ -3541,7 +3493,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa return; } -void SmsPluginWapPushHandler::getDisplayName(MSG_SUB_TYPE_T subType,char* displayName) +void SmsPluginWapPushHandler::getDisplayName(MSG_SUB_TYPE_T subType, char* displayName) { if (subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS) snprintf(displayName, MAX_ADDRESS_VAL_LEN + 1, "Push message"); diff --git a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h index e9097a7..2358217 100755 --- a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h +++ b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h @@ -77,7 +77,7 @@ private: void Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage); void Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_S *pCbPage); void DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PRIMARY_S *pEtwsPn); - unsigned short encodeCbSerialNum ( SMS_CBMSG_SERIAL_NUM_S snFields ); + unsigned short encodeCbSerialNum(SMS_CBMSG_SERIAL_NUM_S snFields); int CMAS_class(unsigned short message_id); bool checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg, msg_sim_slot_id_t simIndex); @@ -85,7 +85,7 @@ private: void MakeCbMsg(SMS_CBMSG_PAGE_S *CbPage, SMS_CBMSG_S *pCbMsg); void convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex); void convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, msg_sim_slot_id_t simIndex); - int convertTextToUtf8 (unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg); + int convertTextToUtf8(unsigned char* outBuf, int outBufSize, SMS_CBMSG_S* pCbMsg); void addToPageList(SMS_CBMSG_PAGE_S *CbPage); void removeFromPageList(SMS_CBMSG_PAGE_S *CbPage); @@ -95,7 +95,6 @@ private: void getDisplayName(unsigned short MsgId, char *pDisplayName, msg_sim_slot_id_t simIndex); vector pageList; - }; #endif /* SMS_PLUGIN_CBMSG_HANDLER_H */ diff --git a/plugin/sms_plugin/include/SmsPluginConcatHandler.h b/plugin/sms_plugin/include/SmsPluginConcatHandler.h index b42ebc8..4ab5533 100755 --- a/plugin/sms_plugin/include/SmsPluginConcatHandler.h +++ b/plugin/sms_plugin/include/SmsPluginConcatHandler.h @@ -94,9 +94,8 @@ public: bool IsConcatMsg(SMS_USERDATA_S *pUserData); void handleConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu); void handleSimConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList); -// void handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t SimMsgId, bool bRead); - -// void handleBrokenMsg(); +/* void handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t SimMsgId, bool bRead); */ +/* void handleBrokenMsg(); */ private: SmsPluginConcatHandler(); @@ -109,16 +108,15 @@ private: void convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo); void convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo); -// void convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo); +/* void convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo); */ void removeFromConcatList(unsigned short MsgRef, int simIndex, char *originAddress); -// void addToSimIdList(unsigned short MsgRef, msg_sim_id_t SimMsgId); -// void removeFromSimIdList(unsigned short MsgRef); +/* void addToSimIdList(unsigned short MsgRef, msg_sim_id_t SimMsgId); */ +/* void removeFromSimIdList(unsigned short MsgRef); */ vector concatList; -// vector simIdList; - +/* vector simIdList; */ }; #endif /* SMS_PLUGIN_CONCAT_HANDLER_H */ diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h index 758a0b8..5df8f70 100755 --- a/plugin/sms_plugin/include/SmsPluginStorage.h +++ b/plugin/sms_plugin/include/SmsPluginStorage.h @@ -49,8 +49,8 @@ public: msg_error_t updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInfo, unsigned char msgRef); msg_error_t updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_network_status_t Status); -// msg_error_t updateMsgRef(msg_message_id_t MsgId, unsigned char MsgRef); -// msg_error_t updateStatusReport(unsigned char MsgRef, msg_delivery_report_status_t Status, time_t DeliveryTime); +/* msg_error_t updateMsgRef(msg_message_id_t MsgId, unsigned char MsgRef); */ +/* msg_error_t updateStatusReport(unsigned char MsgRef, msg_delivery_report_status_t Status, time_t DeliveryTime); */ msg_error_t addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int *simIdList); msg_error_t insertSimMessage(int simId, int msgId); diff --git a/plugin/sms_plugin/include/SmsPluginTypes.h b/plugin/sms_plugin/include/SmsPluginTypes.h index 7969fff..3d74b7e 100755 --- a/plugin/sms_plugin/include/SmsPluginTypes.h +++ b/plugin/sms_plugin/include/SmsPluginTypes.h @@ -38,8 +38,7 @@ extern "C" #define MAX_USER_DATA_LEN 160 #define MAX_GSM_7BIT_DATA_LEN 160 #define MAX_UCS2_DATA_LEN 140 -//#define MAX_TPDU_DATA_LEN 165 -/* CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow */ +/* #define MAX_TPDU_DATA_LEN 165 */ #define MAX_TPDU_DATA_LEN 255 #define MAX_SMS_SEND_RETRY 4 #define MAX_SMSC_LEN 20 diff --git a/plugin/sms_plugin/include/SmsPluginUAManager.h b/plugin/sms_plugin/include/SmsPluginUAManager.h index 03afcde..99fc809 100755 --- a/plugin/sms_plugin/include/SmsPluginUAManager.h +++ b/plugin/sms_plugin/include/SmsPluginUAManager.h @@ -35,7 +35,7 @@ class SmsPluginUAManager : public MsgThread public: static SmsPluginUAManager* instance(); - //virtual void start(); + /* virtual void start(); */ void addReqEntity(SMS_REQUEST_INFO_S *request); diff --git a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h index b1cd370..c46f6e8 100755 --- a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h +++ b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h @@ -38,8 +38,8 @@ #define WSP_CODE_BUFFER_LEFT_LEN_MAX 1024 #define WSP_CODE_BUFFER_RIGHT_LEN_MAX 2048 -#define AcStrlen(x) ((x==NULL)?0:strlen(x)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define AcStrlen(x) ((x == NULL)?0:strlen(x)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) /*================================================================================================== @@ -77,23 +77,22 @@ private: msg_push_action_t convertSIActionStrToEnum(char* pAction); msg_push_action_t convertSLActionStrToEnum(char* pAction); - unsigned long wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer ); - unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar ); - void wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader); - unsigned long wspHeaderDecodeInteger( unsigned char* data ); - void wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString); - unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length ); - char* wspExtendedDecodeType(char contentType ); - void wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam); - void wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString); - void wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString ); - void wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString ); - void wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper ); - void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ); - void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString ); + unsigned long wspRetriveUintvarDecode(unsigned char* sourceData, unsigned long* currentPointer); + unsigned long wspDecodeUintvar(unsigned long length, unsigned char* userVar); + void wspDecodeHeader(unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader); + unsigned long wspHeaderDecodeInteger(unsigned char* data); + void wspHeaderDecodeQValue(unsigned long length, unsigned char* data, char** pDecodedString); + unsigned long wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length); + char* wspExtendedDecodeType(char contentType); + void wspHeaderDecodeParameter(unsigned char* data, unsigned long length, char** pParam); + void wspHeaderDecodeCharset(unsigned long length, unsigned char* data, char**pDecodedString); + void wspHeaderDecodeVersion(unsigned long length, unsigned char* data, char** pDecodedString); + void wspHeaderDecodeDateValue(unsigned long length, unsigned char* data, char** pDecodedString); + void wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper); + void wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString); + void wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString); void wspHeaderDecodeCacheControl(unsigned char* fieldValue, unsigned long fieldValueLen, char** pCacheString); - SMS_ADDRESS_S tmpAddress; SMS_TIMESTAMP_S tmpTimeStamp; }; diff --git a/proxy/MsgHandleControl.cpp b/proxy/MsgHandleControl.cpp index 611418c..323c3e4 100755 --- a/proxy/MsgHandleControl.cpp +++ b/proxy/MsgHandleControl.cpp @@ -39,7 +39,6 @@ MsgHandle::MsgHandle() : mCounter(0), mClientSock() MsgHandle::~MsgHandle() { - } @@ -81,7 +80,7 @@ void MsgHandle::closeHandle(MsgHandle* pHandle) if (MsgCloseContactSvc() != MSG_SUCCESS) { MSG_WARN("Fail to close contact service."); } -#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ removeDbHandle(); /* unregister db handler */ MSG_END(); @@ -157,7 +156,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I pDest->folderId = pSrc->folderId; pDest->msgType.mainType = pSrc->mainType; pDest->msgType.subType = pSrc->subType; - pDest->msgType.classType= pSrc->classType; + pDest->msgType.classType = pSrc->classType; pDest->storageId = pSrc->storageId; if (g_list_length(pSrc->addressList) > 0) { @@ -169,7 +168,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I memset(pDest->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pDest->nAddressCnt); for (int i = 0; i < pDest->nAddressCnt; i++) { - addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList,(guint)i); + addr_info = (msg_struct_s *)g_list_nth_data(pSrc->addressList, (guint)i); address = (MSG_ADDRESS_INFO_S *)addr_info->data; pDest->addressList[i].addressType = address->addressType; @@ -179,7 +178,6 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I strncpy(pDest->addressList[i].displayName, address->displayName, MAX_DISPLAY_NAME_LEN); } } else { - msg_struct_list_s *addr_info_s = pSrc->addr_list; if (addr_info_s && (addr_info_s->nCount > 0)) { @@ -269,7 +267,6 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I MSG_SEC_DEBUG("msgText = %s", pDest->msgText); } else if (pSrc->mainType == MSG_MMS_TYPE) { - pDest->bTextSms = false; pDest->dataSize = pSrc->dataSize; @@ -292,7 +289,7 @@ void MsgHandle::convertMsgStruct(const MSG_MESSAGE_HIDDEN_S *pSrc, MSG_MESSAGE_I /* change file extension in case of java MMS msg */ if (pSrc->subType == MSG_SENDREQ_JAVA_MMS) { char* pFileNameExt = NULL; - pFileNameExt = strstr(fileName,"DATA"); + pFileNameExt = strstr(fileName, "DATA"); if (pFileNameExt) snprintf(pFileNameExt, strlen("JAVA")+1, "JAVA"); } diff --git a/proxy/MsgHandleSetting.cpp b/proxy/MsgHandleSetting.cpp index 3984edd..31dcc08 100755 --- a/proxy/MsgHandleSetting.cpp +++ b/proxy/MsgHandleSetting.cpp @@ -26,7 +26,7 @@ if (a == NULL) { \ return MSG_ERR_NULL_POINTER; \ } \ - } while(0) + } while (0) /*================================================================================================== IMPLEMENTATION OF MsgHandle - Setting Member Functions @@ -77,7 +77,7 @@ msg_error_t MsgHandle::getSMSCOption(msg_struct_t msg_struct) } if (pEvent->result == MSG_SUCCESS) { - MSG_SMSC_LIST_S smsc_list_tmp = {0,}; + MSG_SMSC_LIST_S smsc_list_tmp = {0, }; int dataSize = 0; dataSize = sizeof(MSG_SMSC_LIST_S); @@ -121,7 +121,7 @@ msg_error_t MsgHandle::setSMSCOption(msg_struct_t msg_struct) msg_struct_s *pTmp = (msg_struct_s *)msg_struct; MSG_SMSC_LIST_HIDDEN_S *pTmpList = (MSG_SMSC_LIST_HIDDEN_S *)pTmp->data; - MSG_SMSC_LIST_S smsc_list_tmp = {0,}; + MSG_SMSC_LIST_S smsc_list_tmp = {0, }; smsc_list_tmp.totalCnt = pTmpList->smsc_list->nCount; smsc_list_tmp.selected = pTmpList->selected; @@ -149,7 +149,7 @@ msg_error_t MsgHandle::setSMSCOption(msg_struct_t msg_struct) /* Copy Cookie */ memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.smscList), &smsc_list_tmp, sizeof(MSG_SMSC_LIST_S)); @@ -217,7 +217,7 @@ msg_error_t MsgHandle::getCBOption(msg_struct_t msg_struct) if (pEvent->result == MSG_SUCCESS) { int i = 0; - MSG_CBMSG_OPT_S cb_opt_tmp = {0,}; + MSG_CBMSG_OPT_S cb_opt_tmp = {0, }; memcpy(&cb_opt_tmp, pEvent->data, sizeof(MSG_CBMSG_OPT_S)); MSG_CBMSG_OPT_HIDDEN_S *pTmp = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt->data; @@ -265,7 +265,7 @@ msg_error_t MsgHandle::setCBOption(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_CBMSG_OPT_S cb_opt_tmp = {0,}; + MSG_CBMSG_OPT_S cb_opt_tmp = {0, }; MSG_CBMSG_OPT_HIDDEN_S *cb_msg_opt = (MSG_CBMSG_OPT_HIDDEN_S *)cb_opt->data; cb_opt_tmp.bReceive = cb_msg_opt->bReceive; @@ -284,7 +284,7 @@ msg_error_t MsgHandle::setCBOption(msg_struct_t msg_struct) memcpy(&(cb_opt_tmp.channelData.channelInfo[i]), pStructTmp->data, sizeof(MSG_CB_CHANNEL_INFO_S)); } - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.cbMsgOpt), &cb_opt_tmp, sizeof(MSG_CBMSG_OPT_S)); @@ -376,7 +376,7 @@ msg_error_t MsgHandle::setSmsSendOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.smsSendOpt), sms_send_opt->data, sizeof(MSG_SMS_SENDOPT_S)); @@ -468,7 +468,7 @@ msg_error_t MsgHandle::setMmsSendOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.mmsSendOpt), mms_send_opt->data, sizeof(MSG_MMS_SENDOPT_S)); @@ -560,7 +560,7 @@ msg_error_t MsgHandle::setMmsRecvOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.mmsRecvOpt), mms_recv_opt->data, sizeof(MSG_MMS_RECVOPT_S)); @@ -652,7 +652,7 @@ msg_error_t MsgHandle::setPushMsgOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.pushMsgOpt), push_opt->data, sizeof(MSG_PUSHMSG_OPT_S)); @@ -750,7 +750,7 @@ msg_error_t MsgHandle::setVoiceMsgOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.voiceMailOpt), voice_opt->data, sizeof(MSG_VOICEMAIL_OPT_S)); @@ -842,7 +842,7 @@ msg_error_t MsgHandle::setGeneralOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.generalOpt), general_opt->data, sizeof(MSG_GENERAL_OPT_S)); @@ -934,7 +934,7 @@ msg_error_t MsgHandle::setMsgSizeOpt(msg_struct_t msg_struct) memcpy(pCmd->cmdCookie, mCookie, MAX_COOKIE_LEN); /* Copy Command Data */ - MSG_SETTING_S pSetting = {0,}; + MSG_SETTING_S pSetting = {0, }; pSetting.type = optionType; memcpy(&(pSetting.option.msgSizeOpt), msg_size_opt->data, sizeof(MSG_MSGSIZE_OPT_S)); diff --git a/proxy/MsgHandleStorage.cpp b/proxy/MsgHandleStorage.cpp index 29b6c5d..8ab2d4d 100755 --- a/proxy/MsgHandleStorage.cpp +++ b/proxy/MsgHandleStorage.cpp @@ -28,8 +28,8 @@ ==================================================================================================*/ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pSendOpt) { - MSG_MESSAGE_INFO_S msgInfo = {0,}; - MSG_SENDINGOPT_INFO_S sendOptInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; + MSG_SENDINGOPT_INFO_S sendOptInfo = {0, }; msgInfo.addressList = NULL; unique_ptr addressListBuf(&msgInfo.addressList, unique_ptr_deleter); @@ -38,7 +38,7 @@ int MsgHandle::addMessage(MSG_MESSAGE_HIDDEN_S *pMsg, const MSG_SENDINGOPT_S *pS convertMsgStruct(pMsg, &msgInfo); /* Covert MSG_SENDINGOPT_S to MSG_SENDINGOPT_INFO_S */ - MSG_MESSAGE_TYPE_S msgType = {0,}; + MSG_MESSAGE_TYPE_S msgType = {0, }; msgType.mainType = pMsg->mainType; msgType.subType = pMsg->subType; @@ -168,7 +168,7 @@ msg_error_t MsgHandle::updateMessage(const MSG_MESSAGE_HIDDEN_S *pMsg, const MSG convertMsgStruct(pMsg, &msgInfo); if (pSendOpt != NULL) { - MSG_MESSAGE_TYPE_S msgType = {0,}; + MSG_MESSAGE_TYPE_S msgType = {0, }; msgType.mainType = pMsg->mainType; msgType.subType = pMsg->subType; @@ -427,7 +427,7 @@ msg_error_t MsgHandle::deleteMessagesByList(msg_id_list_s *pMsgIdList) /* Copy Command Data */ memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &(pMsgIdList->nCount), sizeof(int)); - for (int i=0; inCount; i++) { + for (int i = 0; i < pMsgIdList->nCount; i++) { memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN+sizeof(int)+(sizeof(int)*i)), &(pMsgIdList->msgIdList[i]), sizeof(int)); } @@ -714,7 +714,7 @@ msg_error_t MsgHandle::getMessage(msg_message_id_t MsgId, MSG_MESSAGE_HIDDEN_S * convertMsgStruct(&msgInfo, pMsg); if (pSendOpt != NULL) { - MSG_MESSAGE_TYPE_S msgType = {0,}; + MSG_MESSAGE_TYPE_S msgType = {0, }; msgType.mainType = pMsg->mainType; msgType.subType = pMsg->subType; @@ -1175,7 +1175,7 @@ msg_error_t MsgHandle::backupMessage(msg_message_backup_type_t type, const char } MsgCloseFile(pFile); - char path[MSG_FILEPATH_LEN_MAX+1] = {0,}; + char path[MSG_FILEPATH_LEN_MAX+1] = {0, }; strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX); /* Allocate Memory to Command Data */ @@ -1223,7 +1223,7 @@ msg_error_t MsgHandle::restoreMessage(const char *backup_filepath) return MSG_ERR_UNKNOWN; } - char path[MSG_FILEPATH_LEN_MAX+1] = {0,}; + char path[MSG_FILEPATH_LEN_MAX+1] = {0, }; strncpy(path, backup_filepath, MSG_FILEPATH_LEN_MAX); /* Allocate Memory to Command Data */ @@ -1535,7 +1535,7 @@ msg_error_t MsgHandle::getThreadIdByAddress(msg_list_handle_t msg_address_list, memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &addrCnt, sizeof(int)); int addSize = sizeof(MSG_ADDRESS_INFO_S); for (int i = 0; i < addrCnt; i++) { - memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(addrCnt)+(addSize*i)+MAX_COOKIE_LEN), ((msg_struct_s *)(g_list_nth_data((GList *)msg_address_list,(guint)i)))->data, sizeof(MSG_ADDRESS_INFO_S)); + memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+sizeof(addrCnt)+(addSize*i)+MAX_COOKIE_LEN), ((msg_struct_s *)(g_list_nth_data((GList *)msg_address_list, (guint)i)))->data, sizeof(MSG_ADDRESS_INFO_S)); } /* Send Command to Messaging FW */ @@ -1839,8 +1839,8 @@ msg_error_t MsgHandle::getVobject(msg_message_id_t MsgId, void** encodedData) return pEvent->result; /* Decode Return Data */ - MSG_MESSAGE_INFO_S msgInfo = {0,}; - MSG_SENDINGOPT_INFO_S sendOptInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; + MSG_SENDINGOPT_INFO_S sendOptInfo = {0, }; msgInfo.addressList = NULL; unique_ptr addressListBuf(&msgInfo.addressList, unique_ptr_deleter); diff --git a/proxy/MsgHandleTransport.cpp b/proxy/MsgHandleTransport.cpp index b075528..71cb5ce 100755 --- a/proxy/MsgHandleTransport.cpp +++ b/proxy/MsgHandleTransport.cpp @@ -38,7 +38,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq) #ifdef CHECK_SENT_STATUS_CALLBACK if (MsgProxyListener::instance()->getSentStatusCbCnt() <= 0) - THROW(MsgException::SENT_STATUS_ERROR,"Register sent status callback"); + THROW(MsgException::SENT_STATUS_ERROR, "Register sent status callback"); #endif MSG_REQUEST_INFO_S reqInfo = {0}; @@ -60,7 +60,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq) /* In case MMS read report, get address value later. */ if (reqmsg->subType != MSG_READREPLY_MMS) { if (reqmsg->addr_list && (reqmsg->addr_list->nCount > 0) && (reqmsg->addr_list->nCount <= MAX_TO_ADDRESS_CNT)) { - MSG_DEBUG("Recipient address count [%d]", reqmsg->addr_list->nCount ); + MSG_DEBUG("Recipient address count [%d]", reqmsg->addr_list->nCount); } else if (g_list_length(reqmsg->addressList) > 0) { MSG_DEBUG("Recipient address count [%d]", g_list_length(reqmsg->addressList) ); } else { @@ -96,14 +96,14 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq) } else { /* in case of JAVA MMS msg, parse mms transaction id from pMmsData */ reqmsg->networkStatus = MSG_NETWORK_SENDING; - strncpy(trId, (char*)reqmsg->pMmsData+3,MMS_TR_ID_LEN); - MSG_SEC_DEBUG("JavaMMS transaction Id:%s ",trId); + strncpy(trId, (char*)reqmsg->pMmsData+3, MMS_TR_ID_LEN); + MSG_SEC_DEBUG("JavaMMS transaction Id:%s", trId); } /* Convert MSG_MESSAGE_S to MSG_MESSAGE_INFO_S */ convertMsgStruct(reqmsg, &(reqInfo.msgInfo)); - MSG_MESSAGE_TYPE_S msgType = {0,}; + MSG_MESSAGE_TYPE_S msgType = {0, }; msgType.mainType = reqmsg->mainType; msgType.subType = reqmsg->subType; @@ -168,7 +168,7 @@ msg_error_t MsgHandle::submitReq(MSG_REQUEST_S* pReq) /* Get Return Data */ MSG_EVENT_S* pEvent = (MSG_EVENT_S*) pEventData; - int ret[3] = {0,}; + int ret[3] = {0, }; memcpy(&ret, (void*)pEvent->data, sizeof(ret)); @@ -355,7 +355,7 @@ msg_error_t MsgHandle::regMmsConfMessageCallback(msg_mms_conf_msg_incoming_cb on memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &cmdParam, sizeof(cmdParam)); - MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, (pAppId)? cmdParam.appId:"NULL" ); + MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, (pAppId)? cmdParam.appId:"NULL"); /* Send Command to Messaging FW */ char* pEventData = NULL; @@ -609,7 +609,7 @@ msg_error_t MsgHandle::regPushMessageCallback(msg_push_msg_incoming_cb onPushMsg memcpy((void*)((char*)pCmd+sizeof(MSG_CMD_TYPE_T)+MAX_COOKIE_LEN), &cmdParam, sizeof(cmdParam)); - MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, (pAppId)? cmdParam.appId:"NULL" ); + MSG_DEBUG("reg new msg [%s], fd:%d, appId:%s", MsgDbgCmdStr(pCmd->cmdType), cmdParam.listenerFd, (pAppId)? cmdParam.appId:"NULL"); /* Send Command to Messaging FW */ char* pEventData = NULL; diff --git a/proxy/MsgProxyListener.cpp b/proxy/MsgProxyListener.cpp index 04e3a98..f235c9f 100755 --- a/proxy/MsgProxyListener.cpp +++ b/proxy/MsgProxyListener.cpp @@ -334,7 +334,6 @@ bool MsgProxyListener::regCBMessageIncomingEventCB(MsgHandle* pMsgHandle, int fd it->fd = fd; return true; } - } } @@ -767,7 +766,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) memcpy(&chInfo, (void*)((char*)pMsgEvent+sizeof(MSG_EVENT_TYPE_T)+sizeof(msg_error_t)), sizeof(chInfo)); - msg_struct_s status = {0,}; + msg_struct_s status = {0, }; MSG_SENT_STATUS_S statusData = {(msg_request_id_t)chInfo[0], (msg_network_status_t)chInfo[1]}; status.type = MSG_STRUCT_SENT_STATUS_INFO; @@ -805,7 +804,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) MsgNewMessageCBList matchList; for ( ; it != newMessageCBList.end() ; it++) { - if ( portKey == it->port) { + if (portKey == it->port) { matchList.push_back(*it); } } @@ -817,7 +816,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) for ( ; it != matchList.end(); it++ ) { MsgHandle* pHandle = it->hAddr; - MSG_MESSAGE_HIDDEN_S msgHidden = {0,}; + MSG_MESSAGE_HIDDEN_S msgHidden = {0, }; msgHidden.pData = NULL; msgHidden.pMmsData = NULL; @@ -851,7 +850,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) MSG_FATAL("%s", e.what()); } - msg_struct_s msg = {0,}; + msg_struct_s msg = {0, }; msg.type = MSG_STRUCT_MESSAGE_INFO; msg.data = &msgHidden; @@ -867,7 +866,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) /* address Memory Free */ if (msgHidden.addr_list!= NULL) { - for (int i=0; imsg_struct_info[i]; delete (MSG_ADDRESS_INFO_S *)addrInfo->data; addrInfo->data = NULL; @@ -880,7 +879,6 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) delete msgHidden.addr_list; msgHidden.addr_list = NULL; } - } } else if (pMsgEvent->eventType == MSG_EVENT_PLG_INCOMING_MMS_CONF) { @@ -893,7 +891,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) MsgDecodeMsgInfo((char *)pMsgEvent->data, &msgInfo); - MMS_RECV_DATA_S* pMmsRecvData = ( MMS_RECV_DATA_S*)msgInfo.msgData; + MMS_RECV_DATA_S* pMmsRecvData = (MMS_RECV_DATA_S*)msgInfo.msgData; char* appIdKey = (pMmsRecvData->msgAppId.valid)? pMmsRecvData->msgAppId.appId: NULL; @@ -929,7 +927,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) for ( ; it != matchList.end(); it++) { MsgHandle* pHandle = it->hAddr; - MSG_MESSAGE_HIDDEN_S msgHidden = {0,}; + MSG_MESSAGE_HIDDEN_S msgHidden = {0, }; msgHidden.pData = NULL; msgHidden.pMmsData = NULL; @@ -963,7 +961,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) MSG_FATAL("%s", e.what()); } - msg_struct_s msg = {0,}; + msg_struct_s msg = {0, }; msg.type = MSG_STRUCT_MESSAGE_INFO; msg.data = &msgHidden; @@ -995,7 +993,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) /* Here the retrieved message will be deleted from native storage. */ /* as of now, msg which have appId is considered as JAVA MMS message and it will be sent and handled in JAVA app. */ if (appIdKey) { - MSG_DEBUG("delete received JAVA MMS message:%s from native storage",tempFileName); + MSG_DEBUG("delete received JAVA MMS message:%s from native storage", tempFileName); pHandle->deleteMessage(msgInfo.msgId); } } @@ -1102,7 +1100,7 @@ void MsgProxyListener::handleEvent(const MSG_EVENT_S* pMsgEvent) for ( ; it != newCBMessageCBList.end(); it++) { MsgHandle* pHandle = it->hAddr; - msg_struct_s msg = {0,}; + msg_struct_s msg = {0, }; msg.type = MSG_STRUCT_CB_MSG; msg.data = pCbMsg; diff --git a/utils/MsgContact.cpp b/utils/MsgContact.cpp index 44a3820..02d898e 100755 --- a/utils/MsgContact.cpp +++ b/utils/MsgContact.cpp @@ -26,7 +26,7 @@ extern "C" { #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED #include -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ } /*================================================================================================== @@ -36,7 +36,7 @@ __thread bool isContactSvcConnected = false; MsgDbHandler ContactDbHandle; -// phonenumber minimum match digit. +/* phonenumber minimum match digit. */ #define PHONENUMBER_MIN_MATCH_DIGIT VCONFKEY_CONTACTS_SVC_PHONENUMBER_MIN_MATCH_DIGIT #define DEFAULT_MIN_MATCH_DIGIT 8 @@ -48,14 +48,12 @@ static int phonenumberMinMatchDigit = -1; int countryCodeLength(const char *src) { int ret = 0; - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 7: break; case 2: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 7: break; @@ -74,8 +72,7 @@ int countryCodeLength(const char *src) } break; case 3: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -94,8 +91,7 @@ int countryCodeLength(const char *src) } break; case 4: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 3: @@ -114,8 +110,7 @@ int countryCodeLength(const char *src) } break; case 5: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 3: @@ -134,8 +129,7 @@ int countryCodeLength(const char *src) } break; case 6: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -154,8 +148,7 @@ int countryCodeLength(const char *src) } break; case 8: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 4: @@ -174,8 +167,7 @@ int countryCodeLength(const char *src) } break; case 9: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -206,7 +198,7 @@ int countryCodeLength(const char *src) void normalizeNumber(const char *orig, char* dest, unsigned int destSize) { unsigned int pos = 0; - for (unsigned int i=0; (orig[i] && i 0 - && blockModeType == 1) { // For All contacts allow in blocking mode. + && blockModeType == 1) { /* For All contacts allow in blocking mode. */ isblock = false; } @@ -928,27 +919,23 @@ bool checkBlockingMode(char *address, bool *pisFavorites) contacts_list_destroy(personList, true); - switch (blockModeType) - { - case 2: // For Favorites allow in blocking mode. - { + switch (blockModeType) { + case 2: { /* For Favorites allow in blocking mode. */ if (isFavorites) isblock = false; break; } - case 3: // For Custom allow in blocking mode. - { + case 3: { /* For Custom allow in blocking mode. */ char *allowList = MsgSettingGetString(VCONFKEY_SETAPPL_BLOCKINGMODE_ALLOWED_CONTACT_LIST); char *temp = NULL; - char *personIdStr = strtok_r (allowList," ,", &temp); - while (personIdStr != NULL) - { + char *personIdStr = strtok_r(allowList, " ,", &temp); + while (personIdStr != NULL) { MSG_DEBUG("personIdStr [%s]", personIdStr); if (personId == atoi(personIdStr)) { MSG_DEBUG("In allow list."); isblock = false; break; } - personIdStr = strtok_r (NULL, " ,", &temp); + personIdStr = strtok_r(NULL, " ,", &temp); } if (allowList) { @@ -958,7 +945,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites) break; } - default: // Wrong blocking mode type. + default: /* Wrong blocking mode type. */ break; } @@ -972,7 +959,7 @@ bool checkBlockingMode(char *address, bool *pisFavorites) return false; #endif } -#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ int MsgContactGetMinMatchDigit() { @@ -1007,12 +994,11 @@ bool MsgIsNumber(const char* pSrc) { int len = strlen(pSrc); - for(int i = 0; i < len; ++i){ - - if(i == 0 && pSrc[i] == '+') + for (int i = 0; i < len; ++i) { + if (i == 0 && pSrc[i] == '+') continue; - if(pSrc[i] < '0' || pSrc[i] >'9'){ + if (pSrc[i] < '0' || pSrc[i] > '9') { return false; } } diff --git a/utils/MsgDebug.cpp b/utils/MsgDebug.cpp index f582248..1000bce 100755 --- a/utils/MsgDebug.cpp +++ b/utils/MsgDebug.cpp @@ -23,9 +23,8 @@ ==================================================================================================*/ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) { - switch ( cmdType ) - { -// 0 + switch ( cmdType ) { +/* 0 */ case MSG_CMD_OPEN_HANDLE: return "MSG_CMD_OPEN_HANDLE"; case MSG_CMD_CLOSE_HANDLE: @@ -36,7 +35,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_ADD_MSG"; case MSG_CMD_ADD_SYNCML_MSG: return "MSG_CMD_ADD_SYNCML_MSG"; -// 5 +/* 5 */ case MSG_CMD_UPDATE_MSG: return "MSG_CMD_UPDATE_MSG"; case MSG_CMD_UPDATE_READ: @@ -47,7 +46,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_DELETE_MSG"; case MSG_CMD_DELALL_MSGINFOLDER: return "MSG_CMD_DELALL_MSGINFOLDER"; -// 10 +/* 10 */ case MSG_CMD_MOVE_MSGTOFOLDER: return "MSG_CMD_MOVE_MSGTOFOLDER"; case MSG_CMD_MOVE_MSGTOSTORAGE: @@ -58,7 +57,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_GET_MSG"; case MSG_CMD_ADD_FOLDER: return "MSG_CMD_ADD_FOLDER"; -// 15 +/* 15 */ case MSG_CMD_UPDATE_FOLDER: return "MSG_CMD_UPDATE_FOLDER"; case MSG_CMD_DELETE_FOLDER: @@ -69,7 +68,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_ADD_FILTER"; case MSG_CMD_UPDATE_FILTER: return "MSG_CMD_UPDATE_FILTER"; -// 20 +/* 20 */ case MSG_CMD_DELETE_FILTER: return "MSG_CMD_DELETE_FILTER"; case MSG_CMD_GET_FILTERLIST: @@ -80,7 +79,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_GET_FILTER_OPERATION"; case MSG_CMD_SUBMIT_REQ: return "MSG_CMD_SUBMIT_REQ"; -// 25 +/* 25 */ case MSG_CMD_REG_SENT_STATUS_CB: return "MSG_CMD_REG_SENT_STATUS_CB"; case MSG_CMD_REG_STORAGE_CHANGE_CB: @@ -91,7 +90,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_REG_INCOMING_MMS_CONF_MSG_CB"; case MSG_CMD_REG_INCOMING_SYNCML_MSG_CB: return "MSG_CMD_REG_INCOMING_SYNCML_MSG_CB"; -// 30 +/* 30 */ case MSG_CMD_REG_INCOMING_LBS_MSG_CB: return "MSG_CMD_REG_INCOMING_LBS_MSG_CB"; case MSG_CMD_PLG_SENT_STATUS_CNF: @@ -102,7 +101,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_PLG_INCOMING_MSG_IND"; case MSG_CMD_PLG_INCOMING_MMS_CONF: return "MSG_CMD_PLG_INCOMING_MMS_CONF"; -// 35 +/* 35 */ case MSG_CMD_PLG_INCOMING_SYNCML_IND: return "MSG_CMD_PLG_INCOMING_SYNCML_IND"; case MSG_CMD_PLG_INCOMING_LBS_IND: @@ -113,7 +112,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_GET_THREADVIEWLIST"; case MSG_CMD_DELETE_THREADMESSAGELIST: return "MSG_CMD_DELETE_THREADMESSAGELIST"; -// 40 +/* 40 */ case MSG_CMD_GET_CONTACT_COUNT: return "MSG_CMD_GET_CONTACT_COUNT"; case MSG_CMD_GET_QUICKPANEL_DATA: @@ -124,7 +123,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_RESET_DB"; case MSG_CMD_GET_MEMSIZE: return "MSG_CMD_GET_MEMSIZE"; -// 45 +/* 45 */ case MSG_CMD_BACKUP_MESSAGE: return "MSG_CMD_BACKUP_MESSAGE"; case MSG_CMD_RESTORE_MESSAGE: @@ -135,7 +134,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_REG_SYNCML_MSG_OPERATION_CB"; case MSG_CMD_SYNCML_OPERATION: return "MSG_CMD_SYNCML_OPERATION"; -// 50 +/* 50 */ case MSG_CMD_GET_REPORT_STATUS: return "MSG_CMD_GET_REPORT_STATUS"; case MSG_CMD_GET_THREAD_ID_BY_ADDRESS: @@ -146,7 +145,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_GET_SMSC_OPT"; case MSG_CMD_GET_CB_OPT: return "MSG_CMD_GET_CB_OPT"; -// 55 +/* 55 */ case MSG_CMD_GET_SMS_SEND_OPT: return "MSG_CMD_GET_SMS_SEND_OPT"; case MSG_CMD_GET_MMS_SEND_OPT: @@ -157,7 +156,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_GET_PUSH_MSG_OPT"; case MSG_CMD_GET_VOICE_MSG_OPT: return "MSG_CMD_GET_VOICE_MSG_OPT"; -// 60 +/* 60 */ case MSG_CMD_GET_GENERAL_MSG_OPT: return "MSG_CMD_GET_GENERAL_MSG_OPT"; case MSG_CMD_GET_MSG_SIZE_OPT: @@ -168,7 +167,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_SET_CB_OPT"; case MSG_CMD_SET_SMS_SEND_OPT: return "MSG_CMD_SET_SMS_SEND_OPT"; -// 65 +/* 65 */ case MSG_CMD_SET_MMS_SEND_OPT: return "MSG_CMD_SET_MMS_SEND_OPT"; case MSG_CMD_SET_MMS_RECV_OPT: @@ -179,7 +178,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_SET_VOICE_MSG_OPT"; case MSG_CMD_SET_GENERAL_MSG_OPT: return "MSG_CMD_SET_GENERAL_MSG_OPT"; -// 70 +/* 70 */ case MSG_CMD_SET_MSG_SIZE_OPT: return "MSG_CMD_SET_MSG_SIZE_OPT"; case MSG_CMD_REG_INCOMING_PUSH_MSG_CB: @@ -190,7 +189,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_REG_INCOMING_CB_MSG_CB"; case MSG_CMD_PLG_INCOMING_CB_IND: return "MSG_CMD_PLG_INCOMING_CB_IND"; -// 75 +/* 75 */ case MSG_CMD_ADD_PUSH_EVENT: return "MSG_CMD_ADD_PUSH_EVENT"; case MSG_CMD_DELETE_PUSH_EVENT: @@ -201,7 +200,7 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) return "MSG_CMD_DELETE_MESSAGE_BY_LIST"; case MSG_CMD_SET_FILTER_ACTIVATION: return "MSG_CMD_SET_FILTER_ACTIVATION"; -//80 +/* 80 */ case MSG_CMD_ADD_SIM_MSG: return "MSG_CMD_ADD_SIM_MSG"; case MSG_CMD_PLG_RESEND_MESSAGE: @@ -227,9 +226,8 @@ const char * MsgDbgCmdStr(MSG_CMD_TYPE_T cmdType) const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) { - switch ( evtType ) - { -// 0 + switch ( evtType ) { +/* 0 */ case MSG_EVENT_OPEN_HANDLE: return "MSG_EVENT_OPEN_HANDLE"; case MSG_EVENT_CLOSE_HANDLE: @@ -240,7 +238,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_ADD_MSG"; case MSG_EVENT_ADD_SYNCML_MSG: return "MSG_EVENT_ADD_SYNCML_MSG"; -// 5 +/* 5 */ case MSG_EVENT_UPDATE_MSG: return "MSG_EVENT_UPDATE_MSG"; case MSG_EVENT_UPDATE_READ: @@ -251,7 +249,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_DELETE_MSG"; case MSG_EVENT_DELALL_MSGINFOLDER: return "MSG_EVENT_DELALL_MSGINFOLDER"; -// 10 +/* 10 */ case MSG_EVENT_MOVE_MSGTOFOLDER: return "MSG_EVENT_MOVE_MSGTOFOLDER"; case MSG_EVENT_MOVE_MSGTOSTORAGE: @@ -262,7 +260,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_GET_MSG"; case MSG_EVENT_ADD_FOLDER: return "MSG_EVENT_ADD_FOLDER"; -// 15 +/* 15 */ case MSG_EVENT_UPDATE_FOLDER: return "MSG_EVENT_UPDATE_FOLDER"; case MSG_EVENT_DELETE_FOLDER: @@ -273,7 +271,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_ADD_FILTER"; case MSG_EVENT_UPDATE_FILTER: return "MSG_EVENT_UPDATE_FILTER"; -//20 +/* 20 */ case MSG_EVENT_DELETE_FILTER: return "MSG_EVENT_DELETE_FILTER"; case MSG_EVENT_GET_FILTERLIST: @@ -284,7 +282,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_GET_FILTER_OPERATION"; case MSG_EVENT_SUBMIT_REQ: return "MSG_EVENT_SUBMIT_REQ"; -//25 +/* 25 */ case MSG_EVENT_REG_SENT_STATUS_CB: return "MSG_EVENT_REG_SENT_STATUS_CB"; case MSG_EVENT_REG_STORAGE_CHANGE_CB: @@ -295,7 +293,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_REG_INCOMING_MMS_CONF_MSG_CB"; case MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB: return "MSG_EVENT_REG_INCOMING_SYNCML_MSG_CB"; -// 30 +/* 30 */ case MSG_EVENT_REG_INCOMING_LBS_MSG_CB: return "MSG_EVENT_REG_INCOMING_LBS_MSG_CB"; case MSG_EVENT_PLG_SENT_STATUS_CNF: @@ -306,7 +304,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_PLG_INCOMING_MSG_IND"; case MSG_EVENT_PLG_INCOMING_MMS_CONF: return "MSG_EVENT_PLG_INCOMING_MMS_CONF"; -// 35 +/* 35 */ case MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND: return "MSG_EVENT_PLG_INCOMING_SYNCML_MSG_IND"; case MSG_EVENT_PLG_INCOMING_LBS_MSG_IND: @@ -317,7 +315,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_GET_THREADVIEWLIST"; case MSG_EVENT_DELETE_THREADMESSAGELIST: return "MSG_EVENT_DELETE_THREADMESSAGELIST"; -// 40 +/* 40 */ case MSG_EVENT_GET_CONTACT_COUNT: return "MSG_EVENT_GET_CONTACT_COUNT"; case MSG_EVENT_GET_QUICKPANEL_DATA: @@ -328,7 +326,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_RESET_DB"; case MSG_EVENT_GET_MEMSIZE: return "MSG_EVENT_GET_MEMSIZE"; -// 45 +/* 45 */ case MSG_EVENT_BACKUP_MESSAGE: return "MSG_EVENT_BACKUP_MESSAGE"; case MSG_EVENT_RESTORE_MESSAGE: @@ -339,7 +337,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_REG_SYNCML_MSG_OPERATION_CB"; case MSG_EVENT_SYNCML_OPERATION: return "MSG_EVENT_SYNCML_OPERATION"; -// 50 +/* 50 */ case MSG_EVENT_GET_REPORT_STATUS: return "MSG_EVENT_GET_REPORT_STATUS"; case MSG_EVENT_GET_THREAD_ID_BY_ADDRESS: @@ -350,7 +348,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_GET_SMSC_OPT"; case MSG_EVENT_GET_CB_OPT: return "MSG_EVENT_GET_CB_OPT"; -// 55 +/* 55 */ case MSG_EVENT_GET_SMS_SEND_OPT: return "MSG_EVENT_GET_SMS_SEND_OPT"; case MSG_EVENT_GET_MMS_SEND_OPT: @@ -361,7 +359,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_GET_PUSH_MSG_OPT"; case MSG_EVENT_GET_VOICE_MSG_OPT: return "MSG_EVENT_GET_VOICE_MSG_OPT"; -// 60 +/* 60 */ case MSG_EVENT_GET_GENERAL_MSG_OPT: return "MSG_EVENT_GET_GENERAL_MSG_OPT"; case MSG_EVENT_GET_MSG_SIZE_OPT: @@ -372,7 +370,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_SET_CB_OPT"; case MSG_EVENT_SET_SMS_SEND_OPT: return "MSG_EVENT_SET_SMS_SEND_OPT"; -// 65 +/* 65 */ case MSG_EVENT_SET_MMS_SEND_OPT: return "MSG_EVENT_SET_MMS_SEND_OPT"; case MSG_EVENT_SET_MMS_RECV_OPT: @@ -383,7 +381,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_SET_VOICE_MSG_OPT"; case MSG_EVENT_SET_GENERAL_MSG_OPT: return "MSG_EVENT_SET_GENERAL_MSG_OPT"; -// 70 +/* 70 */ case MSG_EVENT_SET_MSG_SIZE_OPT: return "MSG_EVENT_SET_MSG_SIZE_OPT"; case MSG_EVENT_REG_INCOMING_PUSH_MSG_CB: @@ -394,7 +392,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_REG_INCOMING_CB_MSG_CB"; case MSG_EVENT_PLG_INCOMING_CB_MSG_IND: return "MSG_EVENT_PLG_INCOMING_CB_MSG_IND"; -// 75 +/* 75 */ case MSG_EVENT_ADD_PUSH_EVENT: return "MSG_EVENT_ADD_PUSH_EVENT"; case MSG_EVENT_DELETE_PUSH_EVENT: @@ -405,7 +403,7 @@ const char * MsgDbgEvtStr(MSG_EVENT_TYPE_T evtType) return "MSG_EVENT_DELETE_MESSAGE_BY_LIST"; case MSG_EVENT_SET_FILTER_ACTIVATION: return "MSG_EVENT_SET_FILTER_ACTIVATION"; -// 80 +/* 80 */ case MSG_EVENT_ADD_SIM_MSG: return "MSG_EVENT_ADD_SIM_MSG"; case MSG_EVENT_PLG_RESEND_MESSAGE: diff --git a/utils/MsgDrmWrapper.cpp b/utils/MsgDrmWrapper.cpp index 835100d..80c4d3e 100755 --- a/utils/MsgDrmWrapper.cpp +++ b/utils/MsgDrmWrapper.cpp @@ -36,7 +36,7 @@ #include #include -#endif //MSG_DRM_SUPPORT +#endif /* MSG_DRM_SUPPORT */ #define MSG_MAX_DRM_FILE_PATH MSG_FILEPATH_LEN_MAX @@ -89,7 +89,7 @@ bool MsgDrmUnregisterFile(char *szFilename) drm_request_type_e request_type = DRM_REQUEST_TYPE_UNREGISTER_FILE; - int eDRMResult = drm_process_request(request_type, szFilename, NULL); // Unregister a DCF file + int eDRMResult = drm_process_request(request_type, szFilename, NULL); /* Unregister a DCF file */ if (DRM_RETURN_SUCCESS != eDRMResult) { MSG_DEBUG("drm_process_request : %d", eDRMResult); return false; @@ -131,7 +131,7 @@ bool MsgDrmConvertDmtoDcfType(char *inputFile, char *outputFile) MSG_SEC_DEBUG("Current File extension is .dm %s", inputFile); int ret; - FILE *fp = MsgOpenFile(inputFile, "rb");//Check fp + FILE *fp = MsgOpenFile(inputFile, "rb");/* Check fp */ if (fp == NULL) { MSG_DEBUG("[File Open Fail(Errno=%d)][ErrStr=%s]", errno, strerror(errno)); @@ -175,7 +175,7 @@ bool MsgDrmConvertDmtoDcfType(char *inputFile, char *outputFile) strncpy(outputFile, inputFile, pathLen - 2); strncat(outputFile, "dcf", 3); - readed_size = MsgReadFile(buffer, 1, bufLen, fp);//Check for error + readed_size = MsgReadFile(buffer, 1, bufLen, fp);/* Check for error */ MSG_DEBUG("fread read size = %d", readed_size); if (readed_size == 0) { MsgCloseFile(fp); @@ -272,7 +272,7 @@ bool MsgDrmGetDrmType(const char *szFileName, MSG_DRM_TYPE *eDRMType) return false; } - // Convert DRM_METHOD into MSG_DRM_TYPE + /* Convert DRM_METHOD into MSG_DRM_TYPE */ switch (drmInfo.oma_info.method) { case DRM_METHOD_TYPE_FORWARD_LOCK: *eDRMType = MSG_DRM_FORWARD_LOCK; @@ -307,13 +307,13 @@ bool MsgDrmGetMimeTypeEx(const char *szFileName, char *szMimeType, int nMimeType return false; } - char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0,}; + char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0, }; strncpy(strTemp, szFileName, strlen(szFileName)); drm_content_info_s tdcfContentinfo; memset(&tdcfContentinfo, 0x00, sizeof(drm_content_info_s)); - int eDRMResult = drm_get_content_info(strTemp, &tdcfContentinfo); // Get attribute of DRM File + int eDRMResult = drm_get_content_info(strTemp, &tdcfContentinfo); /* Get attribute of DRM File */ if (DRM_RETURN_SUCCESS == eDRMResult) { MSG_DEBUG("contentType = %s", tdcfContentinfo.mime_type); snprintf(szMimeType, nMimeTypeLen, "%s", tdcfContentinfo.mime_type); @@ -337,7 +337,7 @@ bool MsgDrmGetContentID(const char *szFileName, char *szContentID, int nContentI return false; } - char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0,}; + char strTemp[MSG_MAX_DRM_FILE_PATH + 1] = {0, }; strncpy(strTemp, szFileName, sizeof(strTemp)-1); diff --git a/utils/MsgGconfWrapper.cpp b/utils/MsgGconfWrapper.cpp index b7ff747..e3e621e 100755 --- a/utils/MsgGconfWrapper.cpp +++ b/utils/MsgGconfWrapper.cpp @@ -40,8 +40,7 @@ bool bUnknownAutoReject = false; msg_error_t MsgSettingSetString(const char *pKey, const char *pSetValue) { - if (pKey == NULL || pSetValue == NULL) - { + if (pKey == NULL || pSetValue == NULL) { MSG_DEBUG("IN Parameter is NULL"); return MSG_ERR_NULL_POINTER; } @@ -60,8 +59,7 @@ msg_error_t MsgSettingSetString(const char *pKey, const char *pSetValue) msg_error_t MsgSettingSetInt(const char *pKey, int nSetValue) { - if (pKey == NULL) - { + if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return MSG_ERR_NULL_POINTER; } @@ -80,8 +78,7 @@ msg_error_t MsgSettingSetInt(const char *pKey, int nSetValue) msg_error_t MsgSettingSetBool(const char *pKey, bool bSetValue) { - if (pKey == NULL) - { + if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return MSG_ERR_NULL_POINTER; } @@ -100,8 +97,7 @@ msg_error_t MsgSettingSetBool(const char *pKey, bool bSetValue) char* MsgSettingGetString(const char *pKey) { - if (pKey == NULL) - { + if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return NULL; } @@ -116,8 +112,7 @@ char* MsgSettingGetString(const char *pKey) int MsgSettingGetInt(const char *pKey) { - if (pKey == NULL) - { + if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return -1; } @@ -137,8 +132,7 @@ int MsgSettingGetInt(const char *pKey) int MsgSettingGetBool(const char *pKey, bool *pVal) { - if (pKey == NULL) - { + if (pKey == NULL) { MSG_DEBUG("IN Parameter is NULL"); return -1; } @@ -164,30 +158,28 @@ msg_error_t MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt) MSG_DEBUG("smsCnt = %d, mmsCnt = %d ##", SmsCnt, MmsCnt); - // Set Msg Count into VConf - if (MsgSettingSetIndicator(SmsCnt, MmsCnt) != MSG_SUCCESS) - { + /* Set Msg Count into VConf */ + if (MsgSettingSetIndicator(SmsCnt, MmsCnt) != MSG_SUCCESS) { MSG_DEBUG("MsgSettingSetIndicator() FAILED"); return MSG_ERR_SET_SETTING; } -// if (SmsCnt == 0 && MmsCnt == 0) -// { -// MSG_DEBUG("No New Message."); -// } -// else -// { -// MSG_DEBUG("New Message."); -// -// bool bNotification = true; -// -// if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) { -// MSG_DEBUG("MsgSettingGetBool is failed."); -// } -// -// if (bNotification) -// MsgChangePmState(); -// } +#if 0 + if (SmsCnt == 0 && MmsCnt == 0) { + MSG_DEBUG("No New Message."); + } else { + MSG_DEBUG("New Message."); + + bool bNotification = true; + + if (MsgSettingGetBool(MSG_SETTING_NOTIFICATION, &bNotification) != MSG_SUCCESS) { + MSG_DEBUG("MsgSettingGetBool is failed."); + } + + if (bNotification) + MsgChangePmState(); + } +#endif MSG_END(); @@ -197,7 +189,6 @@ msg_error_t MsgSettingHandleNewMsg(int SmsCnt, int MmsCnt) msg_error_t MsgSettingSetIndicator(int SmsCnt, int MmsCnt) { - if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_SMS_STATE, SmsCnt) != 0) return MSG_ERR_SET_SETTING; if (MsgSettingSetInt(VCONFKEY_MESSAGE_RECV_MMS_STATE, MmsCnt) != 0) diff --git a/utils/MsgIpcSocket.cpp b/utils/MsgIpcSocket.cpp index 564220f..c9c345a 100755 --- a/utils/MsgIpcSocket.cpp +++ b/utils/MsgIpcSocket.cpp @@ -49,22 +49,22 @@ msg_error_t MsgIpcClientSocket::connect(const char* path) sockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (sockfd < 0) { - THROW(MsgException::IPC_ERROR,"socket not opened %s",g_strerror(errno)); + THROW(MsgException::IPC_ERROR, "socket not opened %s", g_strerror(errno)); } struct sockaddr_un serverSA = {0, }; serverSA.sun_family = AF_UNIX; memset(serverSA.sun_path, 0x00, sizeof(serverSA.sun_path)); - strncpy(serverSA.sun_path, path, sizeof(serverSA.sun_path)-1); /* // "./socket" */ + strncpy(serverSA.sun_path, path, sizeof(serverSA.sun_path)-1); int len = strlen(serverSA.sun_path) + sizeof(serverSA.sun_family); if (::connect(sockfd, (struct sockaddr *)&serverSA, len) == CUSTOM_SOCKET_ERROR) { if(errno == EACCES) - THROW(MsgException::SECURITY_ERROR,"cannot connect server %s", g_strerror(errno)); + THROW(MsgException::SECURITY_ERROR, "cannot connect server %s", g_strerror(errno)); else - THROW(MsgException::IPC_ERROR,"cannot connect server %s", g_strerror(errno)); + THROW(MsgException::IPC_ERROR, "cannot connect server %s", g_strerror(errno)); } /* add fd for select() */ @@ -82,7 +82,7 @@ msg_error_t MsgIpcClientSocket::connect(const char* path) read(&rfd, &rlen); if (rfd == NULL) { - THROW(MsgException::IPC_ERROR,"rfd is NULL %s", g_strerror(errno)); + THROW(MsgException::IPC_ERROR, "rfd is NULL %s", g_strerror(errno)); } memcpy(&remotefd, rfd, sizeof(rlen)); @@ -125,7 +125,7 @@ void MsgIpcClientSocket::addfd(int fd) maxfd = fd; } -int MsgIpcClientSocket::writen (const char *buf, unsigned int len) +int MsgIpcClientSocket::writen(const char *buf, unsigned int len) { unsigned int nleft; int nwrite; @@ -175,7 +175,7 @@ int MsgIpcClientSocket::write(const char* buf, unsigned int len) return len; } -int MsgIpcClientSocket::readn( char *buf, unsigned int len ) +int MsgIpcClientSocket::readn(char *buf, unsigned int len ) { unsigned int nleft; int nread; @@ -188,7 +188,7 @@ int MsgIpcClientSocket::readn( char *buf, unsigned int len ) if (nread < 0) { MSG_FATAL("WARNING read value %d: %s", nread, g_strerror(errno)); return nread; - } else if( nread == 0 ) { + } else if (nread == 0) { break; } @@ -200,14 +200,14 @@ int MsgIpcClientSocket::readn( char *buf, unsigned int len ) return (len-nleft); } -bool MsgIpcClientSocket::wait_for_reply () +bool MsgIpcClientSocket::wait_for_reply() { int err = -1; fd_set fds; struct timeval tv; if (sockfd < 0) { - MSG_FATAL ("Invalid file description : [%d]", sockfd); + MSG_FATAL("Invalid file description : [%d]", sockfd); return false; } @@ -217,14 +217,14 @@ bool MsgIpcClientSocket::wait_for_reply () tv.tv_sec = 5; /* should be tuned */ tv.tv_usec = 0; - MSG_DEBUG ("wait for response [%d]", sockfd); + MSG_DEBUG("wait for response [%d]", sockfd); err = select(sockfd + 1, &fds, NULL, NULL, &tv); if (err == -1) { MSG_FATAL("select error[%d] fd[%d]", errno, sockfd); return false; } else if (err == 0) { - MSG_FATAL ("select timeout fd[%d]", sockfd); + MSG_FATAL("select timeout fd[%d]", sockfd); return false; } @@ -418,7 +418,7 @@ void MsgIpcServerSocket::close(int fd) if (fd == maxfd) { int newmax = 0; for (it = mapFds.begin() ; it != mapFds.end() ; it++) - newmax = (it->second > newmax )? it->second : newmax; + newmax = (it->second > newmax)? it->second : newmax; maxfd = newmax; } MSG_DEBUG("fd %d removal done", fd); @@ -427,7 +427,7 @@ void MsgIpcServerSocket::close(int fd) MSG_END(); } -int MsgIpcServerSocket::readn( int fd, char *buf, unsigned int len ) +int MsgIpcServerSocket::readn(int fd, char *buf, unsigned int len ) { size_t nleft; int nread; diff --git a/utils/MsgJsonParser.cpp b/utils/MsgJsonParser.cpp index 49fea89..35351c7 100755 --- a/utils/MsgJsonParser.cpp +++ b/utils/MsgJsonParser.cpp @@ -69,10 +69,10 @@ void msg_json_gen_free_obj(msg_json_gen_object *obj) } void msg_json_gen_set_child(msg_json_gen_object *parent, const char *key, msg_json_gen_object *child) { - if (parent == NULL || child == NULL) - { + if (parent == NULL || child == NULL) { return; } + switch(parent->type) { case MSG_JSON_GEN_OBJECT: if (key == NULL) { @@ -101,10 +101,10 @@ void msg_json_gen_set_child(msg_json_gen_object *parent, const char *key, msg_js } void msg_json_gen_set_value(msg_json_gen_object *parent, const char *key, long long int value) { - if (parent == NULL) - { + if (parent == NULL) { return; } + switch(parent->type) { case MSG_JSON_GEN_OBJECT: if (key == NULL) { @@ -119,10 +119,10 @@ void msg_json_gen_set_value(msg_json_gen_object *parent, const char *key, long l } void msg_json_gen_set_value(msg_json_gen_object *parent, const char *key, const char *value) { - if (parent == NULL) - { + if (parent == NULL) { return; } + switch(parent->type) { case MSG_JSON_GEN_OBJECT: if (key == NULL) { @@ -137,8 +137,7 @@ void msg_json_gen_set_value(msg_json_gen_object *parent, const char *key, const } char* msg_json_gen_make_json_msg(msg_json_gen_object *root_obj, unsigned long *len) { - if (root_obj == NULL) - { + if (root_obj == NULL) { return NULL; } JsonGenerator *generator = json_generator_new(); @@ -171,57 +170,41 @@ int msg_json_parser_get_value(msg_json_parser_object *json_obj) switch (json_node_get_value_type((JsonNode *) json_obj->value)) { case G_TYPE_STRING: - { - json_obj->type = MSG_JSON_PARSER_STRING; - json_obj->value = (void *)g_value_get_string(&value); - } + json_obj->type = MSG_JSON_PARSER_STRING; + json_obj->value = (void *)g_value_get_string(&value); break; case G_TYPE_INT: - { - json_obj->type = MSG_JSON_PARSER_INT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_int(&value); - } + json_obj->type = MSG_JSON_PARSER_INT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_int(&value); break; case G_TYPE_UINT: - { - json_obj->type = MSG_JSON_PARSER_UINT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_uint(&value); - } + json_obj->type = MSG_JSON_PARSER_UINT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_uint(&value); break; case G_TYPE_BOOLEAN: - { - json_obj->type = MSG_JSON_PARSER_BOOLEAN; - json_obj->value = NULL; - json_obj->number_value = g_value_get_boolean(&value); - } + json_obj->type = MSG_JSON_PARSER_BOOLEAN; + json_obj->value = NULL; + json_obj->number_value = g_value_get_boolean(&value); break; case G_TYPE_INT64: - { - json_obj->type = MSG_JSON_PARSER_INT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_int64(&value); - } + json_obj->type = MSG_JSON_PARSER_INT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_int64(&value); break; case G_TYPE_UINT64: - { - json_obj->type = MSG_JSON_PARSER_UINT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_uint64(&value); - } + json_obj->type = MSG_JSON_PARSER_UINT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_uint64(&value); break; case G_TYPE_DOUBLE: - { - json_obj->type = MSG_JSON_PARSER_REAL; - json_obj->value = NULL; - json_obj->float_value = (double)g_value_get_double(&value); - } + json_obj->type = MSG_JSON_PARSER_REAL; + json_obj->value = NULL; + json_obj->float_value = (double)g_value_get_double(&value); break; default: - { - MSG_DEBUG(" Entering node default case"); - } + MSG_DEBUG(" Entering node default case"); break; } @@ -247,57 +230,41 @@ int msg_json_parser_object_get_value(msg_json_parser_object *json_obj) switch (json_node_get_value_type((JsonNode *) node)) { case G_TYPE_STRING: - { - json_obj->type = MSG_JSON_PARSER_STRING; - json_obj->value = (void *)g_value_get_string(&value); - } + json_obj->type = MSG_JSON_PARSER_STRING; + json_obj->value = (void *)g_value_get_string(&value); break; case G_TYPE_INT: - { - json_obj->type = MSG_JSON_PARSER_INT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_int(&value); - } + json_obj->type = MSG_JSON_PARSER_INT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_int(&value); break; case G_TYPE_UINT: - { - json_obj->type = MSG_JSON_PARSER_UINT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_uint(&value); - } + json_obj->type = MSG_JSON_PARSER_UINT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_uint(&value); break; case G_TYPE_BOOLEAN: - { - json_obj->type = MSG_JSON_PARSER_BOOLEAN; - json_obj->value = NULL; - json_obj->number_value = g_value_get_boolean(&value); - } + json_obj->type = MSG_JSON_PARSER_BOOLEAN; + json_obj->value = NULL; + json_obj->number_value = g_value_get_boolean(&value); break; case G_TYPE_INT64: - { - json_obj->type = MSG_JSON_PARSER_INT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_int64(&value); - } + json_obj->type = MSG_JSON_PARSER_INT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_int64(&value); break; case G_TYPE_UINT64: - { - json_obj->type = MSG_JSON_PARSER_UINT; - json_obj->value = NULL; - json_obj->number_value = g_value_get_uint64(&value); - } + json_obj->type = MSG_JSON_PARSER_UINT; + json_obj->value = NULL; + json_obj->number_value = g_value_get_uint64(&value); break; case G_TYPE_DOUBLE: - { - json_obj->type = MSG_JSON_PARSER_REAL; - json_obj->value = NULL; - json_obj->float_value = (double)g_value_get_double(&value); - } + json_obj->type = MSG_JSON_PARSER_REAL; + json_obj->value = NULL; + json_obj->float_value = (double)g_value_get_double(&value); break; default: - { - MSG_DEBUG(" Entering node default case"); - } + MSG_DEBUG(" Entering node default case"); break; } @@ -337,7 +304,6 @@ void msg_json_parser_parse_buffer(msg_json_parser_handle handle, const char* val } if (jsonParser != NULL) { - /** Loads a JSON stream from a buffer and parses it */ gRet = json_parser_load_from_data(jsonParser, value, value_len, &error); if (gRet != TRUE) { @@ -347,7 +313,6 @@ void msg_json_parser_parse_buffer(msg_json_parser_handle handle, const char* val root = json_parser_get_root(jsonParser); if (root != NULL) { - json_obj->key = root_key; json_obj->value = root; parentType = json_node_get_node_type(root); @@ -367,7 +332,6 @@ void msg_json_parser_parse_buffer(msg_json_parser_handle handle, const char* val } } } else { - } return ; @@ -392,8 +356,7 @@ int msg_json_parser_get_next_child(const msg_json_parser_object *parent, msg_jso jNodeParentType = json_node_get_node_type((JsonNode *) parent->value); switch (jNodeParentType) { - case JSON_NODE_OBJECT: - { + case JSON_NODE_OBJECT: { /** Get the JSON object from JSON Parent Node */ tempObj = json_node_get_object((JsonNode *) parent->value); @@ -412,39 +375,27 @@ int msg_json_parser_get_next_child(const msg_json_parser_object *parent, msg_jso child->value = json_object_get_member(tempObj, child->key); /** Identify the node type of the JSOSNNode */ - jNodeChildType = json_node_get_node_type((JsonNode *) child->value); + jNodeChildType = json_node_get_node_type((JsonNode *)child->value); switch (jNodeChildType) { case JSON_NODE_OBJECT: - { - child->type = MSG_JSON_PARSER_OBJECT; - } + child->type = MSG_JSON_PARSER_OBJECT; break; case JSON_NODE_ARRAY: - { - child->type = MSG_JSON_PARSER_ARRAY; - } + child->type = MSG_JSON_PARSER_ARRAY; break; case JSON_NODE_VALUE: - { - lReturn = msg_json_parser_get_value(child); - } + lReturn = msg_json_parser_get_value(child); break; case JSON_NODE_NULL: - { - } break; default: - { - lReturn = 0; - } + lReturn = 0; break; } - } break; - case JSON_NODE_ARRAY: - { + case JSON_NODE_ARRAY: { /** Get the JSON array from the JSON node */ tempArray = json_node_get_array((JsonNode *) parent->value); @@ -464,36 +415,24 @@ int msg_json_parser_get_next_child(const msg_json_parser_object *parent, msg_jso switch (jNodeChildType) { case JSON_NODE_OBJECT: - { - child->type = MSG_JSON_PARSER_OBJECT; - } + child->type = MSG_JSON_PARSER_OBJECT; break; case JSON_NODE_ARRAY: - { - child->type = MSG_JSON_PARSER_ARRAY; - } + child->type = MSG_JSON_PARSER_ARRAY; break; case JSON_NODE_VALUE: - { - lReturn = msg_json_parser_get_value(child); - } + lReturn = msg_json_parser_get_value(child); break; case JSON_NODE_NULL: - { - } break; default: - { - lReturn = 0; - break; - } + lReturn = 0; + break; } - } break; case JSON_NODE_VALUE: - default: - { + default: { child->key = NULL; child->value = NULL; lReturn = 0; @@ -543,11 +482,9 @@ int msg_json_parser_get_child_by_name(const msg_json_parser_object *parent, jNodeParentType = json_node_get_node_type((JsonNode *) parent->value); switch (jNodeParentType) { - case JSON_NODE_OBJECT: - { + case JSON_NODE_OBJECT: { /** Get the JSON object from JSON Parent Node */ - tempObj = - json_node_get_object((JsonNode *) parent->value); + tempObj = json_node_get_object((JsonNode *) parent->value); /** Get the list of keys from the object node */ GList *members = json_object_get_members(tempObj); @@ -558,7 +495,6 @@ int msg_json_parser_get_child_by_name(const msg_json_parser_object *parent, /** Get the key by index from the list */ char *member = NULL; for (unsigned int i = 0; i < g_list_length(members); i++) { - member = (char *)g_list_nth_data(members, i); if (g_strcmp0((char *)name, member) == 0) { @@ -580,38 +516,25 @@ int msg_json_parser_get_child_by_name(const msg_json_parser_object *parent, switch (jNodeChildType) { case JSON_NODE_OBJECT: - { - child->type = MSG_JSON_PARSER_OBJECT; - } + child->type = MSG_JSON_PARSER_OBJECT; break; case JSON_NODE_ARRAY: - { - child->type = MSG_JSON_PARSER_ARRAY; - } + child->type = MSG_JSON_PARSER_ARRAY; break; case JSON_NODE_VALUE: - { - lReturn = msg_json_parser_get_value(child); - } + lReturn = msg_json_parser_get_value(child); break; case JSON_NODE_NULL: - { - - } break; default: - { - lReturn = -1; - } + lReturn = -1; break; } - } break; case JSON_NODE_ARRAY: case JSON_NODE_VALUE: - default: - { + default: { child->key = NULL; child->value = NULL; lReturn = -1; @@ -650,8 +573,7 @@ int msg_json_parser_get_child_count(msg_json_parser_object *object) jNodeParentType = json_node_get_node_type((JsonNode *) object->value); switch (jNodeParentType) { - case JSON_NODE_OBJECT: - { + case JSON_NODE_OBJECT: { MSG_DEBUG(" JSON_NODE_OBJECT "); tempObj = NULL; /** Get the JSON object from JSON Parent Node */ @@ -660,8 +582,7 @@ int msg_json_parser_get_child_count(msg_json_parser_object *object) count = json_object_get_size(tempObj); } break; - case JSON_NODE_ARRAY: - { + case JSON_NODE_ARRAY: { MSG_DEBUG(" JSON_NODE_ARRAY "); tempArray = NULL; /** Get the JSON array from the JSON node */ @@ -673,9 +594,6 @@ int msg_json_parser_get_child_count(msg_json_parser_object *object) break; case JSON_NODE_VALUE: default: - { - - } break; } diff --git a/utils/MsgMmsMessage.cpp b/utils/MsgMmsMessage.cpp index 33c5538..27af827 100755 --- a/utils/MsgMmsMessage.cpp +++ b/utils/MsgMmsMessage.cpp @@ -328,7 +328,6 @@ MMS_MEDIA_S *_MsgMmsGetMedia(MMS_PAGE_S *pPage, int mediaIdx) media = (MMS_MEDIA_S *)g_list_nth_data(pPage->medialist, mediaIdx); return media; - } int _MsgMmsGetTransitionCount(MMS_MESSAGE_DATA_S *pMsgData) @@ -410,50 +409,48 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i int pageCnt = 0; char *buf = NULL; - bufsize += sizeof(int); // Page cnt + bufsize += sizeof(int); /* Page cnt */ pageCnt = pMsgData->pageCnt; if (pMsgData->pagelist) { - for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) { - int mediaCnt = 0; MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); mediaCnt = page->mediaCnt; - bufsize += sizeof(int); // Media cnt + bufsize += sizeof(int); /* Media cnt */ if (page->medialist) { bufsize += sizeof(MMS_MEDIA_S) * mediaCnt; } - bufsize += sizeof(int) * 6;//Dur, Begin, End, Min, Max, Repeat + bufsize += sizeof(int) * 6; /* Dur, Begin, End, Min, Max, Repeat */ } } - bufsize += sizeof(int); // region count; + bufsize += sizeof(int); /* region count; */ if (pMsgData->regionlist) { int elementSize = g_list_length(pMsgData->regionlist); bufsize += elementSize * (sizeof(MMS_SMIL_REGION)); } - bufsize += sizeof(int); // attachment count; + bufsize += sizeof(int); /* attachment count; */ if (pMsgData->attachlist) { int elementSize = g_list_length(pMsgData->attachlist); bufsize += elementSize * sizeof(MMS_ATTACH_S); } - bufsize += sizeof(int); // transition count; + bufsize += sizeof(int); /* transition count; */ if (pMsgData->transitionlist) { int elementSize = g_list_length(pMsgData->transitionlist); bufsize += elementSize * sizeof(MMS_SMIL_TRANSITION); } - bufsize += sizeof(int); // meta count; + bufsize += sizeof(int); /* meta count; */ if (pMsgData->metalist) { int elementSize = g_list_length(pMsgData->metalist); bufsize += elementSize * sizeof(MMS_SMIL_META); @@ -469,7 +466,7 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i bufsize += sizeof(int) + filePathLen; - bufsize += sizeof(int); // type + bufsize += sizeof(int); /* type */ bufsize += sizeof(MMS_HEADER_DATA_S); bufsize += sizeof(MMS_MULTIPART_DATA_S); @@ -483,14 +480,14 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i int serial_index = 0; memcpy(buf, &pMsgData->backup_type, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] backup type = %d",serial_index++, offset, pMsgData->backup_type); + MSG_DEBUG("[#%2d][%5d] backup type = %d", serial_index++, offset, pMsgData->backup_type); offset += sizeof(int); - //smilFilePath + /* smilFilePath */ memcpy(buf + offset , &filePathLen, sizeof(int)); - // copy file path - MSG_SEC_DEBUG("[#%2d][%5d] smilFilePath = %s, len = %d",serial_index++, offset, pMsgData->szSmilFilePath, filePathLen); + /* copy file path */ + MSG_SEC_DEBUG("[#%2d][%5d] smilFilePath = %s, len = %d", serial_index++, offset, pMsgData->szSmilFilePath, filePathLen); offset += sizeof(int); if (filePathLen > 0) { @@ -498,22 +495,21 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i offset += filePathLen; } - // copy page count - MSG_DEBUG("[#%2d][%5d] page count = %d",serial_index++, offset, pMsgData->pageCnt); + /* copy page count */ + MSG_DEBUG("[#%2d][%5d] page count = %d", serial_index++, offset, pMsgData->pageCnt); memcpy(buf + offset, &(pMsgData->pageCnt), sizeof(int)); offset += sizeof(int); if (pMsgData->pagelist) { - for (int pageIdx = 0; pageIdx < pageCnt; pageIdx++) { MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); - MSG_DEBUG("[#%2d][%5d][%d page] media count = %d",serial_index++, offset, pageIdx, page->mediaCnt); + MSG_DEBUG("[#%2d][%5d][%d page] media count = %d", serial_index++, offset, pageIdx, page->mediaCnt); memcpy(buf + offset, &page->mediaCnt, sizeof(int)); offset += sizeof(int); if (page->medialist) { - for (int i = 0; i < page->mediaCnt; ++ i) { + for (int i = 0; i < page->mediaCnt; ++i) { MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, i); memcpy(buf + offset, media, sizeof(MMS_MEDIA_S)); offset += sizeof(MMS_MEDIA_S); @@ -536,26 +532,26 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i } } - MSG_DEBUG("[#%2d][%5d] region count = %d",serial_index++, offset, pMsgData->regionCnt); + MSG_DEBUG("[#%2d][%5d] region count = %d", serial_index++, offset, pMsgData->regionCnt); memcpy(buf + offset, &pMsgData->regionCnt, sizeof(int)); offset += sizeof(int); if (pMsgData->regionlist) { - for (int i = 0; i < pMsgData->regionCnt; ++ i) { + for (int i = 0; i < pMsgData->regionCnt; ++i) { MMS_SMIL_REGION *region = (MMS_SMIL_REGION *)g_list_nth_data(pMsgData->regionlist, i); memcpy(buf + offset, region, sizeof(MMS_SMIL_REGION)); offset += sizeof(MMS_SMIL_REGION); } } - MSG_DEBUG("[#%2d][%5d] attach count = %d",serial_index++, offset, pMsgData->attachCnt); + MSG_DEBUG("[#%2d][%5d] attach count = %d", serial_index++, offset, pMsgData->attachCnt); memcpy(buf + offset, &pMsgData->attachCnt, sizeof(int)); offset += sizeof(int); if (pMsgData->attachlist) { - for (int i = 0; i < pMsgData->attachCnt; ++ i) { + for (int i = 0; i < pMsgData->attachCnt; ++i) { MMS_ATTACH_S *attach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i); memcpy(buf + offset, attach, sizeof(MMS_ATTACH_S)); offset += sizeof(MMS_ATTACH_S); @@ -563,24 +559,24 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i } } - MSG_DEBUG("[#%2d][%5d] transition count = %d",serial_index++, offset, pMsgData->transitionCnt); + MSG_DEBUG("[#%2d][%5d] transition count = %d", serial_index++, offset, pMsgData->transitionCnt); memcpy(buf + offset, &pMsgData->transitionCnt, sizeof(int)); offset += sizeof(int); if (pMsgData->transitionlist) { - for (int i = 0; i < pMsgData->transitionCnt; ++ i) { + for (int i = 0; i < pMsgData->transitionCnt; ++i) { MMS_SMIL_TRANSITION *transition = (MMS_SMIL_TRANSITION *)g_list_nth_data(pMsgData->transitionlist, i); memcpy(buf + offset, transition, sizeof(MMS_SMIL_TRANSITION)); offset += sizeof(MMS_SMIL_TRANSITION); } } - MSG_DEBUG("[#%2d][%5d] meta count = %d",serial_index++, offset, pMsgData->metaCnt); + MSG_DEBUG("[#%2d][%5d] meta count = %d", serial_index++, offset, pMsgData->metaCnt); memcpy(buf + offset, &pMsgData->metaCnt, sizeof(int)); offset += sizeof(int); if (pMsgData->metalist) { - for (int i = 0; i < pMsgData->metaCnt; ++ i) { + for (int i = 0; i < pMsgData->metaCnt; ++i) { MMS_SMIL_META *meta = (MMS_SMIL_META *)g_list_nth_data(pMsgData->metalist, i); memcpy(buf + offset, meta, sizeof(MMS_SMIL_META)); @@ -588,22 +584,22 @@ char* _MsgMmsSerializeMessageData(const MMS_MESSAGE_DATA_S *pMsgData, unsigned i } } - MSG_DEBUG("[#%2d][%5d] root layout",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] root layout", serial_index++, offset); memcpy(buf + offset, &pMsgData->rootlayout, sizeof(MMS_SMIL_ROOTLAYOUT)); offset += sizeof(MMS_SMIL_ROOTLAYOUT); #ifdef FEATURE_JAVA_MMS - MSG_DEBUG("[#%2d][%5d] java mms",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] java mms", serial_index++, offset); memcpy(buf + offset, &pMsgData->msgAppId, sizeof(MMS_APPID_INFO_S)); offset += sizeof(MMS_APPID_INFO_S); #endif memcpy (buf + offset, &pMsgData->header, sizeof(MMS_HEADER_DATA_S)); - MSG_DEBUG("[#%2d][%5d] mms header",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] mms header", serial_index++, offset); offset += sizeof(MMS_HEADER_DATA_S); memcpy (buf + offset, &pMsgData->smil, sizeof(MMS_MULTIPART_DATA_S)); - MSG_DEBUG("[#%2d][%5d] mms smil",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] mms smil", serial_index++, offset); offset += sizeof(MMS_MULTIPART_DATA_S); *pSize = offset; @@ -638,13 +634,13 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa int type; memcpy(&type, pData, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] backup type = %d",serial_index++, offset, type); + MSG_DEBUG("[#%2d][%5d] backup type = %d", serial_index++, offset, type); offset += sizeof(int); pMsgData->backup_type = type; memcpy(&filePathLen, pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] smil path len = %d",serial_index, offset, filePathLen); + MSG_DEBUG("[#%2d][%5d] smil path len = %d", serial_index, offset, filePathLen); offset += sizeof(int); if (filePathLen > MSG_FILEPATH_LEN_MAX) { @@ -656,14 +652,14 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa if (filePathLen > 0) { memcpy(pMsgData->szSmilFilePath, pData + offset, filePathLen); - MSG_DEBUG("[#%2d][%5d] smil path = %s",serial_index, offset, pMsgData->szSmilFilePath); + MSG_DEBUG("[#%2d][%5d] smil path = %s", serial_index, offset, pMsgData->szSmilFilePath); offset += filePathLen; } serial_index++; memcpy(&(pMsgData->pageCnt), pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] page count = %d",serial_index++, offset, pMsgData->pageCnt); + MSG_DEBUG("[#%2d][%5d] page count = %d", serial_index++, offset, pMsgData->pageCnt); offset += sizeof(int); pageCnt = pMsgData->pageCnt; @@ -713,23 +709,24 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa offset += sizeof(int); pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage); -// if (pPage->medialist) { -// pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage); -// } else { -// free(pPage); -// pPage = NULL; -// } - +#if 0 + if (pPage->medialist) { + pMsgData->pagelist = g_list_append(pMsgData->pagelist, pPage); + } else { + free(pPage); + pPage = NULL; + } +#endif } pMsgData->pageCnt = g_list_length(pMsgData->pagelist); - //Processing Region List + /* Processing Region List */ memcpy(&pMsgData->regionCnt, pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] region count = %d",serial_index++, offset, pMsgData->regionCnt); + MSG_DEBUG("[#%2d][%5d] region count = %d", serial_index++, offset, pMsgData->regionCnt); offset += sizeof(int); - //MSG_DEBUG(" pBody->regionCnt: %d", pBody->regionCnt); + /* MSG_DEBUG(" pBody->regionCnt: %d", pBody->regionCnt); */ for (int i = 0; i < pMsgData->regionCnt; ++i) { pRegion = (MMS_SMIL_REGION *)calloc(sizeof(MMS_SMIL_REGION), 1); @@ -742,9 +739,9 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa pMsgData->regionlist = g_list_append(pMsgData->regionlist, pRegion); } - //Processing Attachment List + /* Processing Attachment List */ memcpy(&pMsgData->attachCnt, pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] attach count = %d",serial_index++, offset, pMsgData->attachCnt); + MSG_DEBUG("[#%2d][%5d] attach count = %d", serial_index++, offset, pMsgData->attachCnt); offset += sizeof(int); for (int i = 0; i < pMsgData->attachCnt; ++i) { @@ -766,9 +763,9 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa pMsgData->attachCnt = g_list_length(pMsgData->attachlist); - //Processing Transition List + /* Processing Transition List */ memcpy(&pMsgData->transitionCnt, pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] transition count = %d",serial_index++, offset, pMsgData->transitionCnt); + MSG_DEBUG("[#%2d][%5d] transition count = %d", serial_index++, offset, pMsgData->transitionCnt); offset += sizeof(int); for (int i = 0; i < pMsgData->transitionCnt; ++i) { @@ -782,9 +779,9 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa pMsgData->transitionlist = g_list_append(pMsgData->transitionlist, pTransition); } - //Processing Meta List + /* Processing Meta List */ memcpy(&pMsgData->metaCnt, pData + offset, sizeof(int)); - MSG_DEBUG("[#%2d][%5d] meta count = %d",serial_index++, offset, pMsgData->metaCnt); + MSG_DEBUG("[#%2d][%5d] meta count = %d", serial_index++, offset, pMsgData->metaCnt); offset += sizeof(int); for (int i = 0; i < pMsgData->metaCnt; ++i) { @@ -798,23 +795,23 @@ bool _MsgMmsDeserializeMessageData(MMS_MESSAGE_DATA_S *pMsgData, const char *pDa pMsgData->metalist = g_list_append(pMsgData->metalist, pMeta); } - MSG_DEBUG("[#%2d][%5d] root layout",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] root layout", serial_index++, offset); memcpy(&pMsgData->rootlayout, pData + offset, sizeof(MMS_SMIL_ROOTLAYOUT)); offset += sizeof(MMS_SMIL_ROOTLAYOUT); #ifdef FEATURE_JAVA_MMS - MSG_DEBUG("[#%2d][%5d] java mms",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] java mms", serial_index++, offset); memcpy(&pMsgData->msgAppId, pData + offset, sizeof(MMS_APPID_INFO_S)); offset += sizeof(MMS_APPID_INFO_S); -// MSG_DEBUG("java_app_id valid:%d, appId:%s repleToAppId:%s", pBody->msgAppId.valid, pBody->msgAppId.appId, pBody->msgAppId.replyToAppId); +/* MSG_DEBUG("java_app_id valid:%d, appId:%s repleToAppId:%s", pBody->msgAppId.valid, pBody->msgAppId.appId, pBody->msgAppId.replyToAppId); */ #endif memcpy(&pMsgData->header, pData + offset, sizeof(MMS_HEADER_DATA_S)); - MSG_DEBUG("[#%2d][%5d] mms header",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] mms header", serial_index++, offset); offset += sizeof(MMS_HEADER_DATA_S); memcpy(&pMsgData->smil, pData + offset, sizeof(MMS_MULTIPART_DATA_S)); - MSG_DEBUG("[#%2d][%5d] mms smil",serial_index++, offset); + MSG_DEBUG("[#%2d][%5d] mms smil", serial_index++, offset); offset += sizeof(MMS_MULTIPART_DATA_S); MSG_DEBUG("Final offset : %d", offset); @@ -846,19 +843,19 @@ void _MsgMmsMediaPrint(MMS_MEDIA_S *media) } if (media->mediatype == MMS_SMIL_MEDIA_INVALID) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_INVALID"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_INVALID"); } else if (media->mediatype == MMS_SMIL_MEDIA_IMG) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_IMG"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_IMG"); } else if (media->mediatype == MMS_SMIL_MEDIA_AUDIO) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_AUDIO"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_AUDIO"); } else if (media->mediatype == MMS_SMIL_MEDIA_VIDEO) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_VIDEO"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_VIDEO"); } else if (media->mediatype == MMS_SMIL_MEDIA_TEXT) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_TEXT"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_TEXT"); } else if (media->mediatype == MMS_SMIL_MEDIA_ANIMATE) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_ANIMATE"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_ANIMATE"); } else if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { - MSG_DEBUG("%-25s : %s", "Media type","MMS_SMIL_MEDIA_REF"); + MSG_DEBUG("%-25s : %s", "Media type", "MMS_SMIL_MEDIA_REF"); } else { MSG_DEBUG("%-25s : Unknown [%d]", "Media type", media->mediatype); } @@ -895,7 +892,6 @@ void _MsgMmsPagePrint(MMS_PAGE_S *page) } else { MSG_DEBUG("Not Exist Media Data in [%d]th", i); } - } } } @@ -918,7 +914,6 @@ void _MsgMmsPrint(MMS_MESSAGE_DATA_S *pMsgData) } else { MSG_DEBUG("Not Exist Page Data in [%d]th", i); } - } } @@ -935,7 +930,6 @@ void _MsgMmsPrint(MMS_MESSAGE_DATA_S *pMsgData) } } } - } MMS_ADDRESS_DATA_S *MsgMmsCreateAddress(int addressType, const char *addressVal) @@ -1048,73 +1042,75 @@ void MsgMmsInitHeader(MMS_HEADER_DATA_S *pMmsHeaderData) MMS_HEADER_DATA_S *MsgMmsCreateHeader() { - MMS_HEADER_DATA_S *pMmsHeaderData = (MMS_HEADER_DATA_S * )calloc(1, sizeof(MMS_HEADER_DATA_S)); + MMS_HEADER_DATA_S *pMmsHeaderData = (MMS_HEADER_DATA_S *)calloc(1, sizeof(MMS_HEADER_DATA_S)); if (pMmsHeaderData) { - pMmsHeaderData->bcc = NULL;// Bcc - pMmsHeaderData->cc = NULL;// Cc + pMmsHeaderData->bcc = NULL; /* Bcc */ + pMmsHeaderData->cc = NULL; /* Cc */ pMmsHeaderData->contentLocation[0] = '\0'; pMmsHeaderData->szContentType[0] = '\0'; pMmsHeaderData->date = 0; - pMmsHeaderData->bDeliveryReport = false; // X-Mms-Delivery-Report + pMmsHeaderData->bDeliveryReport = false; /* X-Mms-Delivery-Report */ pMmsHeaderData->delivery.type = MMS_TIMETYPE_NONE; pMmsHeaderData->delivery.time = 0; pMmsHeaderData->expiry.type = MMS_TIMETYPE_NONE; pMmsHeaderData->expiry.time = 0; - pMmsHeaderData->szFrom[0] = '\0';// From - pMmsHeaderData->messageClass = -1;//Personal | Advertisement | Informational | Auto + pMmsHeaderData->szFrom[0] = '\0'; /* From */ + pMmsHeaderData->messageClass = -1; /* Personal | Advertisement | Informational | Auto */ pMmsHeaderData->messageID[0]= '\0'; - pMmsHeaderData->messageType = -1;//MmsMsgType : ex) sendreq - pMmsHeaderData->mmsVersion = -1;//1.0 1.3 - pMmsHeaderData->messageSize = 0; // X-Mms-Message-Size - pMmsHeaderData->mmsPriority = -1;//_MSG_PRIORITY_TYPE_E : Low | Normal | High - pMmsHeaderData->bReadReport = 0;// X-Mms-Read-Report - // X-Mms-Report-Allowed - // X-Mms-Response-Status - // X-Mms-Response-Text - pMmsHeaderData->bHideAddress = false;// X-Mms-Sender-Visibility - pMmsHeaderData->mmsStatus = MSG_DELIVERY_REPORT_NONE;// X-Mms-Status - pMmsHeaderData->szSubject[0] = '\0';// Subject - pMmsHeaderData->to = NULL;// To + pMmsHeaderData->messageType = -1; /* MmsMsgType : ex) sendreq */ + pMmsHeaderData->mmsVersion = -1; /* 1.0 1.3 */ + pMmsHeaderData->messageSize = 0; /* X-Mms-Message-Size */ + pMmsHeaderData->mmsPriority = -1; /* MSG_PRIORITY_TYPE_E : Low | Normal | High */ + pMmsHeaderData->bReadReport = 0; /* X-Mms-Read-Report */ + pMmsHeaderData->bHideAddress = false; /* X-Mms-Sender-Visibility */ + pMmsHeaderData->mmsStatus = MSG_DELIVERY_REPORT_NONE; /* X-Mms-Status */ + pMmsHeaderData->szSubject[0] = '\0'; /* Subject */ + pMmsHeaderData->to = NULL; pMmsHeaderData->trID[0] = '\0'; - // X-Mms-Retrieve-Status - // X-Mms-Retrieve-Text - // X-Mms-Read-Status - // X-Mms-Reply-Charging - // X-Mms-Reply-Charging-Deadline - // X-Mms-Reply-Charging-ID - // X-Mms-Reply-Charging-Size - // X-Mms-Previously-Sent-By - // X-Mms-Previously-Sent-Date - // X-Mms-Store - // X-Mms-MM-State - // X-Mms-MM-Flags - // X-Mms-Store-Status - // X-Mms-Store-Status-Text - // X-Mms-Stored - // X-Mms-Attributes - // X-Mms-Totals - // X-Mms-Mbox-Totals - // X-Mms-Quotas - // X-Mms-Mbox-Quotas - // X-Mms-Message-Count - // Content - // X-Mms-Start - // Additional-headers - // X-Mms-Distribution-Indicator - // X-Mms-Element-Descriptor - // X-Mms-Limit - // X-Mms-Recommended-Retrieval-Mode - // X-Mms-Recommended-Retrieval-Mode-Text - // X-Mms-Status-Text - // X-Mms-Applic-ID - // X-Mms-Reply-Applic-ID - // X-Mms-Aux-Applic-Info - pMmsHeaderData->contentClass = -1;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich - // X-Mms-DRM-Content - // X-Mms-Adaptation-Allowed - // X-Mms-Replace-ID - // X-Mms-Cancel-ID - // X-Mms-Cancel-Status + pMmsHeaderData->contentClass = -1;/* text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */ +#if 0 + X-Mms-Report-Allowed + X-Mms-Response-Status + X-Mms-Response-Text + X-Mms-Retrieve-Status + X-Mms-Retrieve-Text + X-Mms-Read-Status + X-Mms-Reply-Charging + X-Mms-Reply-Charging-Deadline + X-Mms-Reply-Charging-ID + X-Mms-Reply-Charging-Size + X-Mms-Previously-Sent-By + X-Mms-Previously-Sent-Date + X-Mms-Store + X-Mms-MM-State + X-Mms-MM-Flags + X-Mms-Store-Status + X-Mms-Store-Status-Text + X-Mms-Stored + X-Mms-Attributes + X-Mms-Totals + X-Mms-Mbox-Totals + X-Mms-Quotas + X-Mms-Mbox-Quotas + X-Mms-Message-Count + Content + X-Mms-Start + Additional-headers + X-Mms-Distribution-Indicator + X-Mms-Element-Descriptor + X-Mms-Limit + X-Mms-Recommended-Retrieval-Mode + X-Mms-Recommended-Retrieval-Mode-Text + X-Mms-Status-Text + X-Mms-Applic-ID + X-Mms-Reply-Applic-ID + X-Mms-Aux-Applic-Info + X-Mms-DRM-Content + X-Mms-Adaptation-Allowed + X-Mms-Replace-ID + X-Mms-Cancel-ID + X-Mms-Cancel-Status +#endif } return pMmsHeaderData; @@ -1187,7 +1183,6 @@ static void __freeAddressListItem(gpointer data) MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)data; MsgMmsReleaseAddress(&pAddressData); - } int MsgMmsReleaseAddressList(MMSList **ppAddressList) @@ -1222,8 +1217,7 @@ static void removeLessGreaterMark(const char *szSrcID, char *szDest, int destSiz static bool IsMatchedMedia(MMS_MEDIA_S *media, MMS_MULTIPART_DATA_S *pMultipart) { if (strlen(pMultipart->szContentID) > 0) { - - char szTempContentID[MSG_MSG_ID_LEN + 1] = {0,}; + char szTempContentID[MSG_MSG_ID_LEN + 1] = {0, }; removeLessGreaterMark(pMultipart->szContentID, szTempContentID, sizeof(szTempContentID)); if (strcmp(media->szContentID, szTempContentID) == 0) { @@ -1262,17 +1256,14 @@ static bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DAT if (pMsgData->pagelist) { for (int pageIdx = 0; pageIdx < pMsgData->pageCnt; pageIdx++) { - MMS_PAGE_S *page = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, pageIdx); if (page && page->medialist) { - for (int mediaIdx = 0; mediaIdx < page->mediaCnt; mediaIdx++) { - MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx); - if (media) { // add media - if (IsMatchedMedia(media, pMultipart) == true) { //matched media + if (media) { /* add media */ + if (IsMatchedMedia(media, pMultipart) == true) { /* matched media */ insert_media = true; media->drmType = pMultipart->drmType; snprintf(media->szFilePath, sizeof(media->szFilePath), "%s", pMultipart->szFilePath); @@ -1284,9 +1275,9 @@ static bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DAT , pageIdx, mediaIdx, media, media->szFilePath, media->szFileName, media->szContentID, media->szContentLocation, media->szContentType); } } - } //end for media list + } /* end for media list */ } - } //end for page list + } /* end for page list */ } return insert_media; @@ -1383,7 +1374,7 @@ int MsgMmsConvertMmsMessageDataToMmsData(MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_S *p if (pMultipart) memcpy(pMultipart, &pSrc->smil, sizeof(MMS_MULTIPART_DATA_S)); pDst->smil = pMultipart; - } else if (pageCnt > 0) { // Multipart related + } else if (pageCnt > 0) { /* Multipart related */ MsgSmilGenerateSmilDoc(pSrc, &pRawData); if (pRawData) { MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); @@ -1424,7 +1415,7 @@ int MsgMmsConvertMmsMessageDataToMmsData(MMS_MESSAGE_DATA_S *pSrc, MMS_DATA_S *p } } - //Processing Attachment List + /* Processing Attachment List */ int attachCnt = _MsgMmsGetAttachCount(pSrc); for (int i = 0; i < attachCnt; ++i) { @@ -1458,8 +1449,7 @@ int MsgMmsGetSmilMultipart(MMSList *pMultipartList, MMS_MULTIPART_DATA_S **smil_ MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMultipartList, i); if (multipart) { - - if (strcasecmp(multipart->szContentType, smil_content_type) == 0 ) { + if (strcasecmp(multipart->szContentType, smil_content_type) == 0) { *smil_multipart = multipart; break; } @@ -1469,7 +1459,7 @@ int MsgMmsGetSmilMultipart(MMSList *pMultipartList, MMS_MULTIPART_DATA_S **smil_ return 0; } -//get content from filepath and save to pMultipartData +/* get content from filepath and save to pMultipartData */ int MsgMmsSetMultipartData(MMS_MULTIPART_DATA_S *pMultipart) { if (pMultipart->pMultipartData != NULL) @@ -1478,8 +1468,8 @@ int MsgMmsSetMultipartData(MMS_MULTIPART_DATA_S *pMultipart) if (g_file_get_contents((gchar*)pMultipart->szFilePath, (gchar**)&pMultipart->pMultipartData, (gsize*)&pMultipart->nMultipartDataLen, NULL) == false) return -1; - //Due to Get data for Backup message - //memset(pMultipart->szFilePath, 0x00, sizeof(pMultipart->szFilePath)); + /* Due to Get data for Backup message */ + /* memset(pMultipart->szFilePath, 0x00, sizeof(pMultipart->szFilePath)); */ return 0; } @@ -1490,17 +1480,15 @@ int MsgMmsSetMultipartListData(MMS_DATA_S *pMmsData) MMSList *multipart_list = pMmsData->multipartlist; if (multipart_list) { - if (pMmsData->smil) { MsgMmsSetMultipartData(pMmsData->smil); } for (int i = 0; i < (int)g_list_length(multipart_list); i++) { - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); if (pMultipart) { - MsgMmsSetMultipartData(pMultipart);//app file -> data + MsgMmsSetMultipartData(pMultipart);/* app file -> data */ } } } @@ -1509,7 +1497,7 @@ int MsgMmsSetMultipartListData(MMS_DATA_S *pMmsData) return 0; } -//pMultipartData set to file path +/* pMultipartData set to file path */ int MsgMmsSetMultipartFilePath(const char *dirPath, MMS_MULTIPART_DATA_S *pMultipart) { if (g_file_test(dirPath, G_FILE_TEST_IS_DIR) != true) { @@ -1524,7 +1512,7 @@ int MsgMmsSetMultipartFilePath(const char *dirPath, MMS_MULTIPART_DATA_S *pMulti /* remove space character of original file name */ msg_replace_space_char(pMultipart->szFilePath); - if (!MsgCreateFile (pMultipart->szFilePath, pMultipart->pMultipartData, pMultipart->nMultipartDataLen)) { + if (!MsgCreateFile(pMultipart->szFilePath, pMultipart->pMultipartData, pMultipart->nMultipartDataLen)) { MSG_SEC_DEBUG("Fail to set content to file [%s]", pMultipart->szFilePath); return -1; } @@ -1536,7 +1524,7 @@ int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData) { MSG_BEGIN(); - char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,}; + char working_dir[MSG_FILENAME_LEN_MAX+1] = {0, }; snprintf(working_dir, sizeof(working_dir), "%s", dirPath); @@ -1557,13 +1545,11 @@ int MsgMmsSetMultipartListFilePath(const char *dirPath, MMS_DATA_S *pMmsData) } if (multipart_list) { - for (int i = 0; i < (int)g_list_length(multipart_list); i++) { - MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(multipart_list, i); if (pMultipart) { - MsgMmsSetMultipartFilePath(working_dir, pMultipart);//data -> svc file + MsgMmsSetMultipartFilePath(working_dir, pMultipart); /* data -> svc file */ } } } @@ -1627,7 +1613,6 @@ void _MsgMmsMultipartPrint(MMS_MULTIPART_DATA_S *multipart) MSG_SEC_DEBUG("%-25s : %s", "Multipart content id", multipart->szContentID); MSG_SEC_DEBUG("%-25s : %s", "Multipart content location", multipart->szContentLocation); MSG_DEBUG("%-25s : %d", "Multipart drm type", multipart->drmType); - } bool _MsgMmsRemoveEmptyMedia(MMS_PAGE_S *pPage) @@ -1637,7 +1622,6 @@ bool _MsgMmsRemoveEmptyMedia(MMS_PAGE_S *pPage) int mediaCnt = g_list_length(pPage->medialist); for (int i = 0; i < mediaCnt; i++) { - GList *nth = g_list_nth(pPage->medialist, i); if (nth == NULL) @@ -1655,7 +1639,6 @@ bool _MsgMmsRemoveEmptyMedia(MMS_PAGE_S *pPage) nth->data = NULL; } - } pPage->medialist = g_list_remove_all(pPage->medialist, NULL); @@ -1665,7 +1648,7 @@ bool _MsgMmsRemoveEmptyMedia(MMS_PAGE_S *pPage) return true; } -//remove media object with no filepath +/* remove media object with no filepath */ bool _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg) { MMS_PAGE_S *pPage; @@ -1673,7 +1656,6 @@ bool _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg) int pageCnt = g_list_length(pMmsMsg->pagelist); for (int i = 0; i < pageCnt; i++) { - GList *nth = g_list_nth(pMmsMsg->pagelist, i); if (nth == NULL) @@ -1686,14 +1668,15 @@ bool _MsgMmsRemoveEmptyObject(MMS_MESSAGE_DATA_S *pMmsMsg) _MsgMmsRemoveEmptyMedia(pPage); -// if (g_list_length(pPage->medialist) == 0) { -// -// MSG_DEBUG("Found Empty Page [%d]", i); -// -// g_free(pPage); -// -// nth->data = NULL; -// } +#if 0 + if (g_list_length(pPage->medialist) == 0) { + MSG_DEBUG("Found Empty Page [%d]", i); + + g_free(pPage); + + nth->data = NULL; + } +#endif } pMmsMsg->pagelist = g_list_remove_all(pMmsMsg->pagelist, NULL); @@ -1715,7 +1698,7 @@ int MsgMmsCheckFilepathSmack(int fd, const char* ipc_filename) MSG_SEC_DEBUG("app_smack_label [%s]", app_smack_label); - char ipc_filepath[MSG_FILEPATH_LEN_MAX+1] = {0,}; + char ipc_filepath[MSG_FILEPATH_LEN_MAX+1] = {0, }; snprintf(ipc_filepath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_IPC_DATA_PATH, ipc_filename); gchar *serialized_data = NULL; diff --git a/utils/MsgSerialize.cpp b/utils/MsgSerialize.cpp index b0ae5aa..1876590 100755 --- a/utils/MsgSerialize.cpp +++ b/utils/MsgSerialize.cpp @@ -78,7 +78,7 @@ static mms_json_item_s mms_json_table[] = { {"header", MMS_HEADER, TYPE_INT}, {"multipart_list", MMS_MULTIPART_LIST, TYPE_ARRAY}, {"smil", MMS_SMIL_MULTIPART, TYPE_OBJECT}, -//multipart +/* multipart */ {"mp_type", MULTIPART_TYPE, TYPE_INT}, {"mp_ct", MULTIPART_CONTENT_TYPE, TYPE_STR}, {"mp_name", MULTIPART_NAME, TYPE_STR}, @@ -87,7 +87,7 @@ static mms_json_item_s mms_json_table[] = { {"mp_cid", MULTIPART_CONTENT_ID, TYPE_STR}, {"mp_cl", MULTIPART_CONTENT_LOCATION, TYPE_STR}, -//header +/* header */ {"h_cl", HEADER_CONTENT_LOCATION, TYPE_STR}, {"h_ct", HEADER_CONTENT_TYPE, TYPE_STR}, {"h_ct_int", HEADER_CONTENT_TYPE_INT, TYPE_INT}, @@ -105,7 +105,6 @@ static mms_json_item_s mms_json_table[] = { {"h_tid", HEADER_TRID, TYPE_STR}, {"h_cclass", HEADER_CONTENT_CLASS, TYPE_INT}, {"backup_type", MMS_BACKUP_TYPE, TYPE_INT}, - }; mms_json_enum_e get_mms_key_type(const char * key) @@ -189,8 +188,7 @@ int MsgParseHeader(msg_json_parser_object *parse_obj, MMS_HEADER_DATA_S *pheader if (parse_obj == NULL) return -1; - while(msg_json_parser_get_next_child(parse_obj, &child, index_child)) - { + while (msg_json_parser_get_next_child(parse_obj, &child, index_child)) { MSG_PRINT_PARSER_OBJECT(index_child, child); type = get_mms_key_type(child.key); @@ -296,8 +294,7 @@ int MsgParseMultipartData(msg_json_parser_object *parse_obj, MMS_MULTIPART_DATA_ if (parse_obj == NULL) return -1; - while(msg_json_parser_get_next_child(parse_obj, &child, index_child)) - { + while (msg_json_parser_get_next_child(parse_obj, &child, index_child)) { MSG_PRINT_PARSER_OBJECT(index_child, child); type = get_mms_key_type(child.key); @@ -347,13 +344,11 @@ int MsgParseMultipartListData(msg_json_parser_object *parse_obj, MMS_DATA_S *pMs if (parse_obj == NULL) return -1; - while(msg_json_parser_get_next_child(parse_obj, &child, index_child)) - { + while (msg_json_parser_get_next_child(parse_obj, &child, index_child)) { if (child.value != NULL && child.type != MSG_JSON_PARSER_NULL) { - MSG_PRINT_PARSER_OBJECT(index_child, child); - MMS_MULTIPART_DATA_S *pMultipart= MsgMmsCreateMultipart(); + MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { if (MsgParseMultipartData(&child, pMultipart) == 0) { @@ -385,10 +380,8 @@ int MsgParseMmsData(msg_json_parser_object *parse_obj, MMS_DATA_S *pMsgData) if (parse_obj == NULL) return -1; - while(msg_json_parser_get_next_child(parse_obj, &child, index_child)) - { + while (msg_json_parser_get_next_child(parse_obj, &child, index_child)) { if (child.key != NULL) { - MSG_PRINT_PARSER_OBJECT(index_child, child); type = get_mms_key_type(child.key); @@ -404,8 +397,7 @@ int MsgParseMmsData(msg_json_parser_object *parse_obj, MMS_DATA_S *pMsgData) if (pMsgData->header) MsgParseHeader(&child, pMsgData->header); break; - case MMS_SMIL_MULTIPART: - { + case MMS_SMIL_MULTIPART: { MMS_MULTIPART_DATA_S *pMultipart = MsgMmsCreateMultipart(); if (pMultipart) { if (MsgParseMultipartData(&child, pMultipart) == 0) { @@ -460,7 +452,7 @@ int MsgSerializeMmsJsonData(const MMS_DATA_S *pMsgData, char **pValue) MSG_JSON_OBJ_SET_INT(object_main, get_mms_key(MMS_BACKUP_TYPE), pMsgData->backup_type); - //smil multipart + /* smil multipart */ if (pMsgData->smil) { JsonObject *smil_object = NULL; @@ -469,7 +461,7 @@ int MsgSerializeMmsJsonData(const MMS_DATA_S *pMsgData, char **pValue) } if (pMsgData->multipartlist) { - //multipart + /* multipart */ array_multipart = json_array_new(); int list_count = g_list_length(pMsgData->multipartlist); @@ -477,7 +469,6 @@ int MsgSerializeMmsJsonData(const MMS_DATA_S *pMsgData, char **pValue) MSG_DEBUG("Page Count is [%d]", list_count); for (int i = 0; i < list_count; i++) { - MMS_MULTIPART_DATA_S *multipart = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMsgData->multipartlist, i); if (multipart) { @@ -495,7 +486,7 @@ int MsgSerializeMmsJsonData(const MMS_DATA_S *pMsgData, char **pValue) MSG_JSON_OBJ_SET_ARRAY(object_main, get_mms_key(MMS_MULTIPART_LIST), array_multipart); } - //header + /* header */ if (pMsgData->header) { MsgSerializeHeader(pMsgData->header, &object_header); @@ -571,18 +562,18 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) char *buf = NULL; int i; - bufsize += sizeof(int); // back-up type + bufsize += sizeof(int); /* back-up type */ int to_cnt = 0; int cc_cnt = 0; int bcc_cnt = 0; - bufsize += sizeof(int); // check header data + bufsize += sizeof(int); /* check header data */ if (pMsgData->header) { isExistHeader = 1; - bufsize += sizeof(MMS_HEADER_DATA_S); // header + bufsize += sizeof(MMS_HEADER_DATA_S); /* header */ to_cnt = g_list_length(pMsgData->header->to); cc_cnt = g_list_length(pMsgData->header->cc); @@ -595,37 +586,37 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) for (i = 0; i < to_cnt; i++) { MMS_ADDRESS_DATA_S *addr_data = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->to, i); if (addr_data && addr_data->address_val) { - bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address + bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); /* type, length, address */ } } for (i = 0; i < cc_cnt; i++) { MMS_ADDRESS_DATA_S *addr_data = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->cc, i); if (addr_data && addr_data->address_val) { - bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address + bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); /* type, length, address */ } } for (i = 0; i < bcc_cnt; i++) { MMS_ADDRESS_DATA_S *addr_data = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pMsgData->header->bcc, i); if (addr_data && addr_data->address_val) { - bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); // type, length, address + bufsize += (sizeof(int) + sizeof(int) + strlen(addr_data->address_val)); /* type, length, address */ } } } - bufsize += sizeof(int); // check smil data + bufsize += sizeof(int); /* check smil data */ if (pMsgData->smil) { isExistSmil = 1; - bufsize += (sizeof(MMS_MULTIPART_DATA_S) + (sizeof(char)*pMsgData->smil->nMultipartDataLen)); // smil data + bufsize += (sizeof(MMS_MULTIPART_DATA_S) + (sizeof(char)*pMsgData->smil->nMultipartDataLen)); /* smil data */ } - bufsize += sizeof(int); // check multipart list data + bufsize += sizeof(int); /* check multipart list data */ if (pMsgData->multipartlist) { isExistMultipart = 1; multipart_cnt = g_list_length(pMsgData->multipartlist); - bufsize += sizeof(int); // multipart count + bufsize += sizeof(int); /* multipart count */ for (i = 0; i < multipart_cnt; i++) { MMS_MULTIPART_DATA_S *multipart_data = (MMS_MULTIPART_DATA_S *)g_list_nth_data(pMsgData->multipartlist, i); @@ -642,12 +633,12 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) int serial_index = 0; int offset = 0; - // 1. Backup type + /* 1. Backup type */ memcpy(buf, &pMsgData->backup_type, sizeof(int)); MSG_DEBUG("[#%2d][%5d] backup type = %d", serial_index++, offset, pMsgData->backup_type); offset += sizeof(int); - // 2. Header Data + /* 2. Header Data */ memcpy(buf + offset, &isExistHeader, sizeof(int)); offset += sizeof(int); @@ -655,7 +646,7 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) memcpy(buf + offset, pMsgData->header, sizeof(MMS_HEADER_DATA_S)); offset += sizeof(MMS_HEADER_DATA_S); - // address + /* address */ memcpy(buf + offset, &to_cnt, sizeof(int)); MSG_DEBUG("[#%2d][%5d] TO Count = %d", serial_index++, offset, to_cnt); offset += sizeof(int); @@ -672,7 +663,7 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) } } - // address + /* address */ memcpy(buf + offset, &cc_cnt, sizeof(int)); MSG_DEBUG("[#%2d][%5d] CC Count = %d", serial_index++, offset, cc_cnt); offset += sizeof(int); @@ -689,7 +680,7 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) } } - // address + /* address */ memcpy(buf + offset, &bcc_cnt, sizeof(int)); MSG_DEBUG("[#%2d][%5d] BCC Count = %d", serial_index++, offset, bcc_cnt); offset += sizeof(int); @@ -707,7 +698,7 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) } } - // 3. Smil Data + /* 3. Smil Data */ memcpy(buf + offset, &isExistSmil, sizeof(int)); offset += sizeof(int); @@ -725,7 +716,7 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue) } } - // 4. Multipart list data + /* 4. Multipart list data */ memcpy(buf + offset, &isExistMultipart, sizeof(int)); offset += sizeof(int); @@ -787,12 +778,12 @@ int MsgDeserializeMmsData(char* value, int value_len, MMS_DATA_S **ppMmsData) return -1; - // 1. Backup type + /* 1. Backup type */ memcpy(&(pMmsData->backup_type), value, sizeof(int)); MSG_DEBUG("[#%2d][%5d] backup type = %d", deserial_index++, offset, pMmsData->backup_type); offset += sizeof(int); - // 2. Header Data + /* 2. Header Data */ memcpy(&isExistHeader, value + offset, sizeof(int)); offset += sizeof(int); @@ -868,7 +859,7 @@ int MsgDeserializeMmsData(char* value, int value_len, MMS_DATA_S **ppMmsData) } } - // 3. Smil Data + /* 3. Smil Data */ memcpy(&isExistSmil, value + offset, sizeof(int)); offset += sizeof(int); @@ -896,7 +887,7 @@ int MsgDeserializeMmsData(char* value, int value_len, MMS_DATA_S **ppMmsData) } } - // 4. Multipart list data + /* 4. Multipart list data */ memcpy(&isExistMultipart, value + offset, sizeof(int)); offset += sizeof(int); diff --git a/utils/MsgSmil.cpp b/utils/MsgSmil.cpp index 635e62c..b36737f 100755 --- a/utils/MsgSmil.cpp +++ b/utils/MsgSmil.cpp @@ -29,7 +29,7 @@ #define MSG_SMIL_COLOR_SIZE 10 #define MSG_STDSTR_SHORT 0x7F -typedef int HMsgSmil; //SmilDoc Handle +typedef int HMsgSmil; /* SmilDoc Handle */ typedef enum _SMIL_ELEMENT_T { ELEMENT_SMIL, @@ -105,7 +105,7 @@ __thread MMS_MEDIA_S *gMedia = NULL; __thread MMS_SMIL_TRANSITION *gTransition = NULL; __thread MMS_SMIL_META *gMeta = NULL; -//For Parse Smil +/* For Parse Smil */ static int MsgSmilGetColorValue(xmlChar *content); static int MsgSmilGetTime(char *pValue); static int MsgSmilAtoIHexa(char *pInput); @@ -118,7 +118,7 @@ static MmsSmilFontType MsgSmilGetFontTypeValue(char *pString); static xmlNodePtr MsgSmilGetNodeByElementName(xmlNodePtr pstNode, char *pszName); -//For Generate Smil +/* For Generate Smil */ static HMsgSmil MsgSmilCreateEmptySmilDoc(void); static HMsgSmil MsgSmilCreateSmilDoc(char *pszRawData); static bool MsgSmilDestroyDoc(HMsgSmil hSmilDoc); @@ -141,13 +141,13 @@ static void MsgSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue); int MsgSmilGetColorValue(xmlChar *content) { int color; - char color_inp[9] = {0,}; + char color_inp[9] = {0, }; - if (content[0] == '#') { // RGB value - snprintf(color_inp, sizeof(color_inp),"FF%s", (char *)&content[1]); + if (content[0] == '#') { /* RGB value */ + snprintf(color_inp, sizeof(color_inp), "FF%s", (char *)&content[1]); color = MsgSmilAtoIHexa(color_inp); } else if (content[0] == '0' && (content[1] == 'x' || content[1] == 'X')) { - snprintf(color_inp, sizeof(color_inp),"%s", (char *)&content[2]); + snprintf(color_inp, sizeof(color_inp), "%s", (char *)&content[2]); color = MsgSmilAtoIHexa(color_inp); } else { MSG_DEBUG("Invalid Color Value"); @@ -469,7 +469,6 @@ int MsgSmilGetFontSizeValue(char *pString) MmsSmilFontType MsgSmilGetFontTypeValue(char *pString) { - if (!strcmp(pString, "normal")) return MMS_SMIL_FONT_TYPE_NORMAL; else if (!strcmp(pString, "italic")) @@ -504,9 +503,8 @@ HMsgSmil MsgSmilCreateSmilDoc(char *pszRawData) MSG_BEGIN(); - // Destroy smil doc if present + /* Destroy smil doc if present */ if (NULL != __gpaMsgSmilDoc[nSmilDocNo]) { - if (false == MsgSmilDestroyDoc(nSmilDocNo)) { MSG_DEBUG("MsgSmilDestroyDoc: Failed!"); } @@ -530,7 +528,6 @@ HMsgSmil MsgSmilCreateSmilDoc(char *pszRawData) __gpaMsgSmilDoc[nSmilDocNo]->pSmilDoc = xmlParseMemory(pszRawData, strlen(pszRawData)); if (NULL == __gpaMsgSmilDoc[nSmilDocNo]->pSmilDoc) { - if (false == MsgSmilDestroyDoc(nSmilDocNo)) { MSG_DEBUG("MsgSmilDestroyDoc: Failed!"); } @@ -574,7 +571,7 @@ bool MsgSmilDestroyDoc(HMsgSmil hSmilDoc) } if (__gpaMsgSmilDoc[nSmilDocNo]->pstRootNode) { - //Need to Check + /* Need to Check */ } free(__gpaMsgSmilDoc[nSmilDocNo]); __gpaMsgSmilDoc[nSmilDocNo] = NULL; @@ -612,7 +609,7 @@ char *MsgSmilGetRawData(HMsgSmil hSmilDoc) MSG_BEGIN(); if (IsValidSmilDocNo(nSmilDocNo)) { - //xmlSaveFormatFileEnc("-", __gpaMmsSmilDoc[nSmilDocNo]->pSmilDoc, "UTF-8", 1); + /* xmlSaveFormatFileEnc("-", __gpaMmsSmilDoc[nSmilDocNo]->pSmilDoc, "UTF-8", 1); */ xmlDocDumpMemory(__gpaMsgSmilDoc[nSmilDocNo]->pSmilDoc, (xmlChar **)(&pszRawData) , NULL); if (NULL == pszRawData) { MSG_DEBUG("Invalid pSmilDoc (now wellformed document)"); @@ -679,7 +676,6 @@ bool MsgSmilAddPage(HMsgSmil hSmilDoc, MMS_PAGE_S *pstSmilPage) return false; } - return ret; } @@ -717,14 +713,13 @@ bool MsgSmilAddRootLayout(HMsgSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLay } MSG_SEC_DEBUG("Root Layout Element Name = %s", (char *)pstRootLayout->name); - if (pstSmilRootLayout->bBgColor == true) { // Replace value later - if ( ( (pstSmilRootLayout->bgColor & 0xFF000000) >> 24 ) > 0) {//check alpha value + if (pstSmilRootLayout->bBgColor == true) { /* Replace value later */ + if (((pstSmilRootLayout->bgColor & 0xFF000000) >> 24) > 0) { /* check alpha value */ xmlSetProp(pstRootLayout, (const xmlChar *)"backgroundColor", (const xmlChar *)MsgSmilColorValueToString(pstSmilRootLayout->bgColor)); } } - - //width + /* width */ if (true == pstSmilRootLayout->width.bUnitPercent) { snprintf(szBuf, MSG_STDSTR_SHORT, "%d%%", pstSmilRootLayout->width.value); xmlSetProp(pstRootLayout, (const xmlChar *)"width", (const xmlChar *)szBuf); @@ -738,7 +733,7 @@ bool MsgSmilAddRootLayout(HMsgSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLay } } - //Height + /* Height */ if (true == pstSmilRootLayout->height.bUnitPercent) { snprintf(szBuf, MSG_STDSTR_SHORT, "%d%%", pstSmilRootLayout->height.value); xmlSetProp(pstRootLayout, (const xmlChar *)"height", (const xmlChar *)szBuf); @@ -747,7 +742,6 @@ bool MsgSmilAddRootLayout(HMsgSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLay snprintf(szBuf, MSG_STDSTR_SHORT, "%d", pstSmilRootLayout->height.value); xmlSetProp(pstRootLayout, (const xmlChar *)"height", (const xmlChar *)szBuf); } else { - xmlSetProp(pstRootLayout, (const xmlChar *)"height", (const xmlChar *)"100%"); } } @@ -759,7 +753,6 @@ bool MsgSmilAddRootLayout(HMsgSmil hSmilDoc, MMS_SMIL_ROOTLAYOUT *pstSmilRootLay MSG_DEBUG("Invalid SmilDoc(hSmilDoc:%d)", nSmilDocNo); return false; } - } bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) @@ -803,28 +796,28 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) int attrType; MSG_SEC_DEBUG("AttributeType: (%s, %s) ", pstAttr->name, pstAttr->children->content); switch (attrType = MsgSmilGetAttrID((char *)pstAttr->name)) { - case ATTRIBUTE_WIDTH: - { -// int bUnitPercent; - -// if (strchr((char *)pstAttr->children->content, '%')) -// bUnitPercent = true; -// else -// bUnitPercent = false; + case ATTRIBUTE_WIDTH: { +#if 0 + int bUnitPercent; + if (strchr((char *)pstAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; +#endif nRootWidth = atoi((char *)pstAttr->children->content); } break; - case ATTRIBUTE_HEIGHT: - { -// int bUnitPercent; - -// if (strchr((char *)pstAttr->children->content, '%')) -// bUnitPercent = true; -// else -// bUnitPercent = false; + case ATTRIBUTE_HEIGHT: { +#if 0 + int bUnitPercent; + if (strchr((char *)pstAttr->children->content, '%')) + bUnitPercent = true; + else + bUnitPercent = false; +#endif nRootHeight = atoi((char *)pstAttr->children->content); } break; @@ -850,7 +843,7 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) if (pstSmilRegion->bBgColor == true) { MSG_DEBUG(" [Set Attribute] : BkGrd Color"); - if ( ( (pstSmilRegion->bgColor & 0xFF000000) >> 24 ) > 0) { + if (((pstSmilRegion->bgColor & 0xFF000000) >> 24) > 0) { xmlSetProp(pstRegion, (const xmlChar *)"backgroundColor", (const xmlChar *)MsgSmilColorValueToString(pstSmilRegion->bgColor)); MSG_DEBUG("[Set Attribute] : backgroundColor [%s]", MsgSmilColorValueToString(pstSmilRegion->bgColor)); } @@ -864,8 +857,8 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) MSG_DEBUG("[Set Attribute] : Width : [%s]", szBuf); } } else { - // Note: nRootWidth should be in terms of value(pixel) not unitpercent(%) - // Validation should be done before this. + /* Note: nRootWidth should be in terms of value(pixel) not unitpercent(%) */ + /* Validation should be done before this. */ if (pstSmilRegion->width.value >= 0 && pstSmilRegion->width.value <= nRootWidth && nRootWidth != 0) { @@ -884,8 +877,8 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) MSG_DEBUG("[Set Attribute] : Height : [%s]", szBuf); } } else { - // Note: nRootHeight should be in terms of value(pixel) not unitpercent(%) - // Validation should be done before this. + /* Note: nRootHeight should be in terms of value(pixel) not unitpercent(%) */ + /* Validation should be done before this. */ if (pstSmilRegion->height.value >= 0 && pstSmilRegion->height.value <= nRootHeight && nRootHeight != 0) { @@ -906,8 +899,8 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) MSG_DEBUG("[Set Attribute] : Left : [%s]", szBuf); } } else { - // Note: nRootWidth should be in terms of value(pixel) not unitpercent(%) - // Validation should be done before this. + /* Note: nRootWidth should be in terms of value(pixel) not unitpercent(%) */ + /* Validation should be done before this. */ if (pstSmilRegion->nLeft.value >= 0 && nRootWidth != 0) { int iLeft = (pstSmilRegion->nLeft.value * 100) / nRootWidth; @@ -925,8 +918,8 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) MSG_DEBUG("[Set Attribute] : Top : [%s]", szBuf); } } else { - // Note: nRootHeight should be in terms of value(pixel) not unitpercent(%) - // Validation should be done before this. + /* Note: nRootHeight should be in terms of value(pixel) not unitpercent(%) */ + /* Validation should be done before this. */ if (pstSmilRegion->nTop.value >= 0 && nRootHeight != 0) { int iTop = (pstSmilRegion->nTop.value * 100) / nRootHeight; @@ -936,7 +929,7 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) } } - //Fit Attribute + /* Fit Attribute */ if (MMSUI_IMAGE_REGION_FIT_MEET == pstSmilRegion->fit) { xmlSetProp(pstRegion, (const xmlChar *)"fit", (const xmlChar *)"meet"); MSG_DEBUG("[Set Attribute] : fit : [meet]"); @@ -946,7 +939,6 @@ bool MsgSmilAddRegion(HMsgSmil hSmilDoc, MMS_SMIL_REGION *pstSmilRegion) } MsgSmilInsertNode(pstLayoutList, pstRootLayoutList, pstRegion); - } else MSG_DEBUG("There is no attribute in node"); @@ -1067,7 +1059,6 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) /* Add attributes */ if (pstSmilMedia) { - if (strlen(pstSmilMedia->regionId) > 0) { xmlSetProp(pstMedia, (const xmlChar *)"region", (const xmlChar *)pstSmilMedia->regionId); MSG_DEBUG("[Set Attribute] Region Id : [%s]", pstSmilMedia->regionId); @@ -1092,17 +1083,17 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) } #if 0 - char szFilePathWithCid[MSG_MSG_ID_LEN + 5]; // for "cid:" + char szFilePathWithCid[MSG_MSG_ID_LEN + 5]; /* for "cid:" */ snprintf (szFilePathWithCid, sizeof(szFilePathWithCid), "cid:%s", pszContentID); MsgSmilSetAttribute(pstMedia, (char *)"src", szFilePathWithCid); #endif if (strlen(pstSmilMedia->szContentLocation) > 0) { - MsgSmilSetAttribute(pstMedia, (char *)"src", pstSmilMedia->szContentLocation); //using content Location in Smil + MsgSmilSetAttribute(pstMedia, (char *)"src", pstSmilMedia->szContentLocation); /* using content Location in Smil */ MSG_DEBUG("[Set Attribute] Src : [%s]", pstSmilMedia->szContentLocation); } - if ( ( (pstSmilMedia->sMedia.sText.nColor & 0xFF000000) >> 24 ) > 0) { + if (((pstSmilMedia->sMedia.sText.nColor & 0xFF000000) >> 24) > 0) { pstParam = xmlNewNode(NULL, (xmlChar *)"param"); if (NULL == pstParam) { @@ -1118,7 +1109,7 @@ xmlNode *MsgSmilCreateTextNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) MsgSmilInsertFirstChild(pstMedia, pstParam); } - if ( ( (pstSmilMedia->sMedia.sText.nBgColor & 0xFF000000) >> 24 ) > 0) { + if (((pstSmilMedia->sMedia.sText.nBgColor & 0xFF000000) >> 24) > 0) { pstParam = xmlNewNode(NULL, (xmlChar *)"param"); if (NULL == pstParam) { @@ -1241,19 +1232,18 @@ xmlNode *MsgSmilCreateMMNode(MMS_MEDIA_S *pstSmilMedia, char *pszContentID) } if (pstMedia) { - if (strlen(pstSmilMedia->regionId) > 0) { xmlSetProp(pstMedia, (const xmlChar *)"region", (const xmlChar *)pstSmilMedia->regionId); MSG_DEBUG("[Set Attribute] Region Id : [%s]", pstSmilMedia->regionId); } -#if 0 //set src attribute cid - char szFilePathWithCid[MSG_MSG_ID_LEN + 5]; // for "cid:" +#if 0 /* set src attribute cid */ + char szFilePathWithCid[MSG_MSG_ID_LEN + 5]; /* for "cid:" */ snprintf (szFilePathWithCid, sizeof(szFilePathWithCid), "cid:%s", pszContentID); MsgSmilSetAttribute(pstMedia, (char *)"src", szFilePathWithCid); #endif if (strlen(pstSmilMedia->szContentLocation) > 0) { - MsgSmilSetAttribute(pstMedia, (char *)"src", pstSmilMedia->szContentLocation); //using content Location in Smil + MsgSmilSetAttribute(pstMedia, (char *)"src", pstSmilMedia->szContentLocation); /* using content Location in Smil */ MSG_SEC_DEBUG("[Set Attribute] src : [%s]", pstSmilMedia->szContentLocation); } @@ -1304,8 +1294,7 @@ bool MsgSmilInsertNode(xmlNode *pstParent, xmlNode *pstLeftSibling, xmlNode *pst if (pstLeftSibling) { /* Parent Node is Unused */ - - while (pstLeftSibling->next !=NULL) + while (pstLeftSibling->next != NULL) pstLeftSibling = pstLeftSibling->next; if (NULL == xmlAddNextSibling(pstLeftSibling, pstCurr)) { @@ -1339,7 +1328,6 @@ void MsgSmilSetAttribute(xmlNode *pNode, char *szField, char *szValue) xmlNodePtr MsgSmilGetNodeByElementName(xmlNodePtr pstNode, char *pszName) { - if ((NULL != pstNode) && (NULL != pszName)) { xmlNodePtr pstTempNode; xmlNodePtr pstReturnNode; @@ -1347,7 +1335,6 @@ xmlNodePtr MsgSmilGetNodeByElementName(xmlNodePtr pstNode, char *pszName) pstTempNode = pstNode; for ( ; pstTempNode; pstTempNode = pstTempNode->next) { - if (0 == strcasecmp((char *)pstTempNode->name, pszName)) { MSG_SEC_DEBUG("Find Node : name [%s][%p]", (char *)pstTempNode->name, pstTempNode); return pstTempNode; @@ -1359,7 +1346,6 @@ xmlNodePtr MsgSmilGetNodeByElementName(xmlNodePtr pstNode, char *pszName) return pstReturnNode; } } - } } return NULL; @@ -1374,7 +1360,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) xmlNode *cur_node = NULL; - if (depth == 0) {//init + if (depth == 0) { /* init */ memset(gCmd, 0x00, ELEMENT_MAX); memset(&gRootlayout, 0x00, sizeof(MMS_SMIL_ROOTLAYOUT)); gRegion = NULL; @@ -1388,8 +1374,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) MSG_SEC_DEBUG("## [%d] node type : [Element], name: [%s] ##", depth, cur_node->name); if (cur_node->type == XML_ELEMENT_NODE) { - // Get Smil Element ===================================================== - + /* Get Smil Element */ switch (elementType = MsgSmilGetElementID((char *)cur_node->name)) { case ELEMENT_ROOTLAYOUT: gCmd[ELEMENT_ROOTLAYOUT] = true; @@ -1435,7 +1420,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) gCmd[ELEMENT_PAR] = true; break; - case ELEMENT_PARAM: // Need to check the original element type + case ELEMENT_PARAM: /* Need to check the original element type */ gCmd[ELEMENT_PARAM] = true; break; @@ -1510,18 +1495,16 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) break; } - //Get Smil Attribute ===================================================== + /* Get Smil Attribute */ xmlAttr *pAttr = cur_node->properties; SMIL_ATTRIBUTE_T paramType = ATTRIBUTE_UNKNOWN; for ( ; pAttr; pAttr = pAttr->next) { - MSG_SEC_DEBUG("## attribute type : name [%s] value [%s] ##", pAttr->name, pAttr->children->content); switch (attrType = MsgSmilGetAttrID((char *)pAttr->name)) { - case ATTRIBUTE_ID: - { + case ATTRIBUTE_ID: { if (gCmd[ELEMENT_REGION] && gRegion) { strncpy(gRegion->szID, (char *)pAttr->children->content, MAX_SMIL_REGION_ID - 1); } else if (gCmd[ELEMENT_TRANSITION] && gTransition) { @@ -1532,8 +1515,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) } break; - case ATTRIBUTE_TOP: - { + case ATTRIBUTE_TOP: { int bUnitPercent; int value; @@ -1551,8 +1533,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) } break; - case ATTRIBUTE_LEFT: - { + case ATTRIBUTE_LEFT: { int bUnitPercent; int value; @@ -1571,8 +1552,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) break; - case ATTRIBUTE_WIDTH: - { + case ATTRIBUTE_WIDTH: { int bUnitPercent; int value; @@ -1593,8 +1573,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) } break; - case ATTRIBUTE_HEIGHT: - { + case ATTRIBUTE_HEIGHT: { int bUnitPercent; int value; @@ -1653,10 +1632,9 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) } break; - case ATTRIBUTE_SRC: - { + case ATTRIBUTE_SRC: { if (gMedia) { - char szContentID[MSG_MSG_ID_LEN + 1] = {0,}; + char szContentID[MSG_MSG_ID_LEN + 1] = {0, }; int cLen; snprintf(szContentID, sizeof(szContentID), "%s", (char *)pAttr->children->content); @@ -1760,7 +1738,6 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) case ATTRIBUTE_NAME: if (gCmd[ELEMENT_PARAM]) { - if (!strcmp((char *)pAttr->children->content, "foreground-color") || !strcmp((char *)pAttr->children->content, "foregroundcolor")) paramType = ATTRIBUTE_FGCOLOR; else if (!strcmp((char *)pAttr->children->content, "background-color") || !strcmp((char *)pAttr->children->content, "backgroundcolor")) @@ -1849,7 +1826,7 @@ void MsgSmilParseNode(MMS_MESSAGE_DATA_S *pMmsMsg, xmlNode *a_node, int depth) } } - if (cur_node->children) {//child first + if (cur_node->children) { /* child first */ MsgSmilParseNode(pMmsMsg, cur_node->children, depth + 1); } @@ -1940,19 +1917,18 @@ bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc) hSmilDoc = MsgSmilCreateEmptySmilDoc(); if (INVALID_HOBJ == hSmilDoc) { - MSG_DEBUG("Invalid SmilDoc[%d]",hSmilDoc); + MSG_DEBUG("Invalid SmilDoc[%d]", hSmilDoc); return false; } - // Add Root Layout to Smil Document + /* Add Root Layout to Smil Document */ if (false == MsgSmilAddRootLayout(hSmilDoc, &(pstMsgMmsBody->rootlayout))) { MSG_DEBUG("MsgSmilAddRootLayout Failed"); MsgSmilDestroyDoc(hSmilDoc); } - //Add Region list to Smil Document + /* Add Region list to Smil Document */ nRegionCount = pstMsgMmsBody->regionCnt; - MSG_DEBUG(" Region Count = [%d]",nRegionCount); + MSG_DEBUG("Region Count = [%d]", nRegionCount); for (nIndex = 0; nIndex < nRegionCount; nIndex++) { - pstRegion = _MsgMmsGetSmilRegion(pstMsgMmsBody, nIndex); if (NULL == pstRegion) { MSG_DEBUG("pstRegion is NULL"); @@ -1967,11 +1943,10 @@ bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc) } } - // Add page list to Smil Document + /* Add page list to Smil Document */ nTotalPageNum = pstMsgMmsBody->pageCnt ; - MSG_DEBUG(" Page Count = [%d]",nTotalPageNum); + MSG_DEBUG("Page Count = [%d]", nTotalPageNum); for (nIndex = 0; nIndex < nTotalPageNum; nIndex++) { - pstPage = _MsgMmsGetPage(pstMsgMmsBody, nIndex); if (NULL == pstPage) { MSG_DEBUG("pstPage is NULL"); @@ -1979,7 +1954,7 @@ bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc) return false; } - // Add page to smil doc + /* Add page to smil doc */ if (false == MsgSmilAddPage(hSmilDoc, pstPage)) { MSG_DEBUG("Adding page to smil doc failed"); MsgSmilDestroyDoc(hSmilDoc); @@ -1987,9 +1962,8 @@ bool MsgSmilGenerateSmilDoc(MMS_MESSAGE_DATA_S *pstMsgMmsBody, char **ppSmilDoc) } nTotalMediaNum = pstPage->mediaCnt; - MSG_DEBUG(" Media Count = [%d]",nTotalMediaNum); + MSG_DEBUG("Media Count = [%d]", nTotalMediaNum); for (nMediaIndex = 0; nMediaIndex < nTotalMediaNum; nMediaIndex++) { - pstMedia = _MsgMmsGetMedia(pstPage, nMediaIndex); if (NULL == pstMedia) { MSG_DEBUG("pMedia is NULL"); diff --git a/utils/MsgSqliteWrapper.cpp b/utils/MsgSqliteWrapper.cpp index bc2f43a..9143e35 100755 --- a/utils/MsgSqliteWrapper.cpp +++ b/utils/MsgSqliteWrapper.cpp @@ -36,8 +36,10 @@ void __clear_db_handle(sqlite3 *pDB); /*================================================================================================== VARIABLES ==================================================================================================*/ -//__thread sqlite3 *handle = NULL; -//__thread sqlite3_stmt *stmt = NULL; +#if 0 +__thread sqlite3 *handle = NULL; +__thread sqlite3_stmt *stmt = NULL; +#endif /*================================================================================================== IMPLEMENTATION OF MsgDbHandler - Member Functions @@ -90,7 +92,6 @@ msg_error_t MsgDbHandler::connect() /* Use only in app side */ msg_error_t MsgDbHandler::connectReadOnly() { - int ret = 0; if (handle == NULL) { @@ -205,7 +206,7 @@ msg_error_t MsgDbHandler::getTable(const char *pQuery, int *pRowCnt, int *pColum ret = sqlite3_get_table(handle, pQuery, &result, pRowCnt, pColumnCnt, NULL); if (ret == SQLITE_OK) { - if (*pRowCnt == 0) {// when the no record return 'MSG_ERR_DB_NORECORD' + if (*pRowCnt == 0) { /* when the no record return 'MSG_ERR_DB_NORECORD' */ MSG_DEBUG("No Query Result"); return MSG_ERR_DB_NORECORD; } @@ -364,7 +365,7 @@ void MsgDbHandler::getMmapMutex(const char *shm_file_name) MSG_BEGIN(); if(!shm_file_name) { - MSG_FATAL ("NULL INPUT_PARAM"); + MSG_FATAL("NULL INPUT_PARAM"); return; } @@ -385,7 +386,7 @@ void MsgDbHandler::getMmapMutex(const char *shm_file_name) mmapMx = tmp; } -void MsgDbHandler::shm_mutex_timedlock (int sec) +void MsgDbHandler::shm_mutex_timedlock(int sec) { MSG_BEGIN(); if (!mmapMx) { @@ -600,7 +601,7 @@ msg_error_t MsgConvertStrWithEscape(const char *input, char **output) tmpStr[j++] = '%'; - for(i=0;i(self,tmp)); + gDbHandles.insert(std::pair(self, tmp)); } else { tmp = it->second; @@ -647,7 +648,7 @@ void removeDbHandle() MutexLocker locker(mu); tmp = it->second; delete tmp; - gDbHandles.erase (it); + gDbHandles.erase(it); } } @@ -655,7 +656,7 @@ void removeDbHandle() static int __msg_db_util_busyhandler(void *pData, int count) { if(20 - count > 0) { - struct timespec time = {0,}; + struct timespec time = {0, }; time.tv_sec = 0; time.tv_nsec = (count + 1) * 50 * 1000 * 1000; @@ -685,7 +686,7 @@ int __msg_db_util_open(const char *pszFilePath, sqlite3 **ppDB, int flags, const /* Open DB */ int rc = sqlite3_open_v2(pszFilePath, ppDB, flags, zVfs); if (SQLITE_OK != rc) { - MSG_ERR("sqlite3_open_v2 error(%d)",rc); + MSG_ERR("sqlite3_open_v2 error(%d)", rc); return rc; } diff --git a/utils/MsgTextConvert.cpp b/utils/MsgTextConvert.cpp index fb617da..e7ece03 100755 --- a/utils/MsgTextConvert.cpp +++ b/utils/MsgTextConvert.cpp @@ -79,332 +79,331 @@ MsgTextConvert::MsgTextConvert() extCharList[0x00C2] = MSG_CHAR_PORTUGUESE; extCharList[0x00E2] = MSG_CHAR_PORTUGUESE; - for (unsigned char i = 0; i < 128; i++) - { + for (unsigned char i = 0; i < 128; i++) { ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i; } - // GSM 7 bit Extension - ucs2toGSM7ExtList[0x005B] = 0x3C; // [ - ucs2toGSM7ExtList[0x005D] = 0x3E; // ] - ucs2toGSM7ExtList[0x007B] = 0x28; // { - ucs2toGSM7ExtList[0x007D] = 0x29; // } - ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break + /* GSM 7 bit Extension */ + ucs2toGSM7ExtList[0x005B] = 0x3C; /* [ */ + ucs2toGSM7ExtList[0x005D] = 0x3E; /* ] */ + ucs2toGSM7ExtList[0x007B] = 0x28; /* { */ + ucs2toGSM7ExtList[0x007D] = 0x29; /* } */ + ucs2toGSM7ExtList[0x000C] = 0x0A; /* Page Break */ ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */ - ucs2toGSM7ExtList[0x005E] = 0x14; // ^ - ucs2toGSM7ExtList[0x007C] = 0x40; // | - ucs2toGSM7ExtList[0x007E] = 0x3D; // ~ - ucs2toGSM7ExtList[0x20AC] = 0x65; // € - - // Turkish - ucs2toTurkishList[0x005B] = 0x3C; // [ - ucs2toTurkishList[0x005D] = 0x3E; // ] - ucs2toTurkishList[0x007B] = 0x28; // { - ucs2toTurkishList[0x007D] = 0x29; // } - ucs2toTurkishList[0x000C] = 0x0A; // Page Break + ucs2toGSM7ExtList[0x005E] = 0x14; /* ^ */ + ucs2toGSM7ExtList[0x007C] = 0x40; /* | */ + ucs2toGSM7ExtList[0x007E] = 0x3D; /* ~ */ + ucs2toGSM7ExtList[0x20AC] = 0x65; /* € */ + + /* Turkish */ + ucs2toTurkishList[0x005B] = 0x3C; /* [ */ + ucs2toTurkishList[0x005D] = 0x3E; /* ] */ + ucs2toTurkishList[0x007B] = 0x28; /* { */ + ucs2toTurkishList[0x007D] = 0x29; /* } */ + ucs2toTurkishList[0x000C] = 0x0A; /* Page Break */ ucs2toTurkishList[0x005C] = 0x2F; /* \ */ - ucs2toTurkishList[0x005E] = 0x14; // ^ - ucs2toTurkishList[0x007C] = 0x40; // | - ucs2toTurkishList[0x007E] = 0x3D; // ~ - ucs2toTurkishList[0x20AC] = 0x65; // € - ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA - ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE - ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE - ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON - ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON - ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE - ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS - ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA - ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA - - // Spanish - ucs2toSpanishList[0x005B] = 0x3C; // [ - ucs2toSpanishList[0x005D] = 0x3E; // ] - ucs2toSpanishList[0x007B] = 0x28; // { - ucs2toSpanishList[0x007D] = 0x29; // } - ucs2toSpanishList[0x000C] = 0x0A; // Page Break + ucs2toTurkishList[0x005E] = 0x14; /* ^ */ + ucs2toTurkishList[0x007C] = 0x40; /* | */ + ucs2toTurkishList[0x007E] = 0x3D; /* ~ */ + ucs2toTurkishList[0x20AC] = 0x65; /* € */ + ucs2toTurkishList[0x00E7] = 0x63; /* c LATIN SMALL LETTER S WITH CEDILLA */ + ucs2toTurkishList[0x011E] = 0x47; /* G LATIN CAPITAL LETTER G WITH BREVE */ + ucs2toTurkishList[0x011F] = 0x67; /* g LATIN SMALL LETTER G WITH BREVE */ + ucs2toTurkishList[0x01E6] = 0x47; /* G LATIN CAPITAL LETTER G WITH CARON */ + ucs2toTurkishList[0x01E7] = 0x67; /* g LATIN SMALL LETTER G WITH CARON */ + ucs2toTurkishList[0x0130] = 0x49; /* I LATIN CAPITAL LETTER I WITH DOT ABOVE */ + ucs2toTurkishList[0x0131] = 0x69; /* i LATIN SMALL LETTER DOTLESS */ + ucs2toTurkishList[0x015E] = 0x53; /* S LATIN CAPITAL LETTER S WITH CEDILLA */ + ucs2toTurkishList[0x015F] = 0x73; /* s LATIN SMALL LETTER S WITH CEDILLA */ + + /* Spanish */ + ucs2toSpanishList[0x005B] = 0x3C; /* [ */ + ucs2toSpanishList[0x005D] = 0x3E; /* ] */ + ucs2toSpanishList[0x007B] = 0x28; /* { */ + ucs2toSpanishList[0x007D] = 0x29; /* } */ + ucs2toSpanishList[0x000C] = 0x0A; /* Page Break */ ucs2toSpanishList[0x005C] = 0x2F; /* \ */ - ucs2toSpanishList[0x005E] = 0x14; // ^ - ucs2toSpanishList[0x007C] = 0x40; // | - ucs2toSpanishList[0x007E] = 0x3D; // ~ - ucs2toSpanishList[0x20AC] = 0x65; // € - ucs2toSpanishList[0x00C1] = 0x41; // A LATIN CAPITAL LETTER A WITH ACUTE - ucs2toSpanishList[0x00E1] = 0x61; // a LATIN SMALL LETTER A WITH ACUTE - ucs2toSpanishList[0x00CD] = 0x49; // I LATIN CAPITAL LETTER I WITH ACUTE - ucs2toSpanishList[0x00ED] = 0x69; // i LATIN SMALL LETTER I WITH ACUTE - ucs2toSpanishList[0x00D3] = 0x4F; // O LATIN CAPITAL LETTER O WITH ACUTE - ucs2toSpanishList[0x00F3] = 0x6F; // o LATIN SMALL LETTER O WITH ACUTE - ucs2toSpanishList[0x00DA] = 0x55; // U LATIN CAPITAL LETTER U WITH ACUTE - ucs2toSpanishList[0x00FA] = 0x75; // u LATIN SMALL LETTER U WITH ACUTE - - // Portuguese - ucs2toPortuList[0x005B] = 0x3C; // [ - ucs2toPortuList[0x005D] = 0x3E; // ] - ucs2toPortuList[0x007B] = 0x28; // { - ucs2toPortuList[0x007D] = 0x29; // } - ucs2toPortuList[0x000C] = 0x0A; // Page Break + ucs2toSpanishList[0x005E] = 0x14; /* ^ */ + ucs2toSpanishList[0x007C] = 0x40; /* | */ + ucs2toSpanishList[0x007E] = 0x3D; /* ~ */ + ucs2toSpanishList[0x20AC] = 0x65; /* € */ + ucs2toSpanishList[0x00C1] = 0x41; /* A LATIN CAPITAL LETTER A WITH ACUTE */ + ucs2toSpanishList[0x00E1] = 0x61; /* a LATIN SMALL LETTER A WITH ACUTE */ + ucs2toSpanishList[0x00CD] = 0x49; /* I LATIN CAPITAL LETTER I WITH ACUTE */ + ucs2toSpanishList[0x00ED] = 0x69; /* i LATIN SMALL LETTER I WITH ACUTE */ + ucs2toSpanishList[0x00D3] = 0x4F; /* O LATIN CAPITAL LETTER O WITH ACUTE */ + ucs2toSpanishList[0x00F3] = 0x6F; /* o LATIN SMALL LETTER O WITH ACUTE */ + ucs2toSpanishList[0x00DA] = 0x55; /* U LATIN CAPITAL LETTER U WITH ACUTE */ + ucs2toSpanishList[0x00FA] = 0x75; /* u LATIN SMALL LETTER U WITH ACUTE */ + + /* Portuguese */ + ucs2toPortuList[0x005B] = 0x3C; /* [ */ + ucs2toPortuList[0x005D] = 0x3E; /* ] */ + ucs2toPortuList[0x007B] = 0x28; /* { */ + ucs2toPortuList[0x007D] = 0x29; /* } */ + ucs2toPortuList[0x000C] = 0x0A; /* Page Break */ ucs2toPortuList[0x005C] = 0x2F; /* \ */ - ucs2toPortuList[0x005E] = 0x14; // ^ - ucs2toPortuList[0x007C] = 0x40; // | - ucs2toPortuList[0x007E] = 0x3D; // ~ - ucs2toPortuList[0x20AC] = 0x65; // € - ucs2toPortuList[0x00D4] = 0x0B; // O LATIN CAPITAL LETTER O WITH CIRCUMFLEX - ucs2toPortuList[0x00F4] = 0x0C; // o LATIN SMALL LETTER O WITH CIRCUMFLEX - ucs2toPortuList[0x00C1] = 0x0E; // A LATIN CAPITAL LETTER A WITH ACUTE - ucs2toPortuList[0x00E1] = 0x0F; // a LATIN SMALL LETTER A WITH ACUTE - ucs2toPortuList[0x00CA] = 0x1F; // E LATIN CAPITAL LETTER E WITH CIRCUMFLEX - ucs2toPortuList[0x00EA] = 0x05; // e LATIN SMALL LETTER E WITH CIRCUMFLEX - ucs2toPortuList[0x00C0] = 0x41; // A LATIN CAPITAL LETTER A WITH GRAVE - ucs2toPortuList[0x00E7] = 0x09; // c LATIN SMALL LETTER C WITH CEDILLA - ucs2toPortuList[0x00CD] = 0x49; // I LATIN CAPITAL LETTER I WITH ACUTE - ucs2toPortuList[0x00ED] = 0x69; // i LATIN SMALL LETTER I WITH ACUTE - ucs2toPortuList[0x00D3] = 0x4F; // O LATIN CAPITAL LETTER O WITH ACUTE - ucs2toPortuList[0x00F3] = 0x6F; // o LATIN SMALL LETTER O WITH ACUTE - ucs2toPortuList[0x00DA] = 0x55; // U LATIN CAPITAL LETTER U WITH ACUTE - ucs2toPortuList[0x00FA] = 0x75; // u LATIN SMALL LETTER U WITH ACUTE - ucs2toPortuList[0x00C3] = 0x61; // A LATIN CAPITAL LETTER A WITH TILDE - ucs2toPortuList[0x00E3] = 0x7B; // a LATIN SMALL LETTER A WITH TILDE - ucs2toPortuList[0x00D5] = 0x5C; // O LATIN CAPITAL LETTER O WITH TILDE - ucs2toPortuList[0x00F5] = 0x7C; // o LATIN SMALL LETTER O WITH TILDE - ucs2toPortuList[0x00C2] = 0x61; // A LATIN CAPITAL LETTER A WITH CIRCUMFLEX - ucs2toPortuList[0x00E2] = 0x7F; // a LATIN SMALL LETTER A WITH CIRCUMFLEX - ucs2toPortuList[0x03A6] = 0x12; // Φ GREEK CAPITAL LETTER PHI - ucs2toPortuList[0x0393] = 0x13; // Γ GREEK CAPITAL LETTER GAMMA - ucs2toPortuList[0x03A9] = 0x15; // Ω GREEK CAPITAL LETTER OMEGA - ucs2toPortuList[0x03A0] = 0x16; // Π GREEK CAPITAL LETTER PI - ucs2toPortuList[0x03A8] = 0x17; // Ψ GREEK CAPITAL LETTER PSI - ucs2toPortuList[0x03A3] = 0x18; // Σ GREEK CAPITAL LETTER SIGMA - ucs2toPortuList[0x0398] = 0x19; // Θ GREEK CAPITAL LETTER THETA - - - // character replacement table - replaceCharList[0x00E0] = 0x61; // a LATIN SMALL LETTER A WITH GRAVE - replaceCharList[0x00E1] = 0x61; // a LATIN SMALL LETTER A WITH ACUTE - replaceCharList[0x00E2] = 0x61; // a LATIN SMALL LETTER A WITH CIRCUMFLEX - replaceCharList[0x00E3] = 0x61; // a LATIN SMALL LETTER A WITH TILDE - replaceCharList[0x00E4] = 0x61; // a LATIN SMALL LETTER A WITH DIAERESIS - replaceCharList[0x00E5] = 0x61; // a LATIN SMALL LETTER A WITH RING ABOVE - replaceCharList[0x00E6] = 0x61; // a LATIN SMALL LETTER AE - replaceCharList[0x0101] = 0x61; // a LATIN SMALL LETTER A WITH MACRON - replaceCharList[0x0103] = 0x61; // a LATIN SMALL LETTER A WITH BREVE - replaceCharList[0x0105] = 0x61; // a LATIN SMALL LETTER A WITH OGONEK - replaceCharList[0x01CE] = 0x61; // a LATIN SMALL LETTER A WITH CARON - - replaceCharList[0x00C0] = 0x41; // A LATIN CAPITAL LETTER A WITH GRAVE - replaceCharList[0x00C1] = 0x41; // A LATIN CAPITAL LETTER A WITH ACUTE - replaceCharList[0x00C2] = 0x41; // A LATIN CAPITAL LETTER A WITH CIRCUMFLEX - replaceCharList[0x00C3] = 0x41; // A LATIN CAPITAL LETTER A WITH TILDE - replaceCharList[0x00C4] = 0x41; // A LATIN CAPITAL LETTER A WITH DIAERESIS - replaceCharList[0x00C5] = 0x41; // A LATIN CAPITAL LETTER A WITH RING ABOVE - replaceCharList[0x00C6] = 0x41; // A LATIN CAPITAL LETTER AE - replaceCharList[0x0100] = 0x41; // A LATIN CAPITAL LETTER A WITH MACRON - replaceCharList[0x0102] = 0x41; // A LATIN CAPITAL LETTER A WITH BREVE - replaceCharList[0x0104] = 0x41; // A LATIN CAPITAL LETTER A WITH OGONEK - replaceCharList[0x01CD] = 0x41; // A LATIN CAPITAL LETTER A WITH CARON - - replaceCharList[0x00E7] = 0x63; // c LATIN SMALL LETTER C WITH CEDILLA - replaceCharList[0x0107] = 0x63; // c LATIN SMALL LETTER C WITH ACUTE - replaceCharList[0x0109] = 0x63; // c LATIN SMALL LETTER C WITH CIRCUMFLEX - replaceCharList[0x010B] = 0x63; // c LATIN SMALL LETTER C WITH DOT ABOVE - replaceCharList[0x010D] = 0x63; // c LATIN SMALL LETTER C WITH CARON - - replaceCharList[0x00C7] = 0x43; // C LATIN CAPITAL LETTER C WITH CEDILLA - replaceCharList[0x0106] = 0x43; // C LATIN CAPITAL LETTER C WITH ACUTE - replaceCharList[0x0108] = 0x43; // C LATIN CAPITAL LETTER C WITH CIRCUMFLEX - replaceCharList[0x010A] = 0x43; // C LATIN CAPITAL LETTER C WITH DOT ABOVE - replaceCharList[0x010C] = 0x43; // C LATIN CAPITAL LETTER C WITH CARON - - replaceCharList[0x010F] = 0x64; // d LATIN SMALL LETTER D WITH CARON - replaceCharList[0x0111] = 0x64; // d LATIN SMALL LETTER D WITH STROKE - - replaceCharList[0x010E] = 0x44; // D LATIN CAPITAL LETTER D WITH CARON - replaceCharList[0x0110] = 0x44; // D LATIN CAPITAL LETTER D WITH STROKE - - replaceCharList[0x00E8] = 0x65; // e LATIN SMALL LETTER E WITH GRAVE - replaceCharList[0x00E9] = 0x65; // e LATIN SMALL LETTER E WITH ACUTE - replaceCharList[0x00EA] = 0x65; // e LATIN SMALL LETTER E WITH CIRCUMFLEX - replaceCharList[0x00EB] = 0x65; // e LATIN SMALL LETTER E WITH DIAERESIS - replaceCharList[0x0113] = 0x65; // e LATIN SMALL LETTER E WITH MACRON - replaceCharList[0x0115] = 0x65; // e LATIN SMALL LETTER E WITH BREVE - replaceCharList[0x0117] = 0x65; // e LATIN SMALL LETTER E WITH DOT ABOVE - replaceCharList[0x0119] = 0x65; // e LATIN SMALL LETTER E WITH OGONEK - replaceCharList[0x011B] = 0x65; // e LATIN SMALL LETTER E WITH CARON - replaceCharList[0x0259] = 0x65; // e LATIN SMALL LETTER SCHWA - - replaceCharList[0x00C8] = 0x45; // E LATIN CAPITAL LETTER E WITH GRAVE - replaceCharList[0x00C9] = 0x45; // E LATIN CAPITAL LETTER E WITH ACUTE - replaceCharList[0x00CA] = 0x45; // E LATIN CAPITAL LETTER E WITH CIRCUMFLEX - replaceCharList[0x00CB] = 0x45; // E LATIN CAPITAL LETTER E WITH DIAERESIS - replaceCharList[0x0112] = 0x45; // E LATIN CAPITAL LETTER E WITH MACRON - replaceCharList[0x0114] = 0x45; // E LATIN CAPITAL LETTER E WITH BREVE - replaceCharList[0x0116] = 0x45; // E LATIN CAPITAL LETTER E WITH DOT ABOVE - replaceCharList[0x0118] = 0x45; // E LATIN CAPITAL LETTER E WITH OGONEK - replaceCharList[0x011A] = 0x45; // E LATIN CAPITAL LETTER E WITH CARON - replaceCharList[0x018F] = 0x45; // E LATIN CAPITAL LETTER SCHWA - - replaceCharList[0x011D] = 0x67; // g LATIN SMALL LETTER G WITH CIRCUMFLEX - replaceCharList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE - replaceCharList[0x0121] = 0x67; // g LATIN SMALL LETTER G WITH DOT ABOVE - replaceCharList[0x0123] = 0x67; // g LATIN SMALL LETTER G WITH CEDILLA - replaceCharList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON - replaceCharList[0x01F5] = 0x67; // g LATIN SMALL LETTER G WITH ACUTE - replaceCharList[0x1E21] = 0x67; // g LATIN SMALL LETTER G WITH MACRON - - replaceCharList[0x011C] = 0x47; // G LATIN CAPITAL LETTER G WITH CIRCUMFLEX - replaceCharList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE - replaceCharList[0x0120] = 0x47; // G LATIN CAPITAL LETTER G WITH DOT ABOVE - replaceCharList[0x0122] = 0x47; // G LATIN CAPITAL LETTER G WITH CEDILLA - replaceCharList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON - replaceCharList[0x01F4] = 0x47; // G LATIN CAPITAL LETTER G WITH ACUTE - replaceCharList[0x1E20] = 0x47; // G LATIN CAPITAL LETTER G WITH MACRON - - replaceCharList[0x00EC] = 0x69; // i LATIN SMALL LETTER I WITH GRAVE - replaceCharList[0x00ED] = 0x69; // i LATIN SMALL LETTER I WITH ACUTE - replaceCharList[0x00EE] = 0x69; // i LATIN SMALL LETTER I WITH CIRCUMFLEX - replaceCharList[0x00EF] = 0x69; // i LATIN SMALL LETTER I WITH DIAERESIS - replaceCharList[0x0129] = 0x69; // i LATIN SMALL LETTER I WITH TILDE - replaceCharList[0x012B] = 0x69; // i LATIN SMALL LETTER I WITH MACRON - replaceCharList[0x012D] = 0x69; // i LATIN SMALL LETTER I WITH BREVE - replaceCharList[0x012F] = 0x69; // i LATIN SMALL LETTER I WITH OGONEK - replaceCharList[0x01D0] = 0x69; // i LATIN SMALL LETTER I WITH CARON - replaceCharList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS I - - replaceCharList[0x00CC] = 0x49; // I LATIN CAPITAL LETTER I WITH GRAVE - replaceCharList[0x00CD] = 0x49; // I LATIN CAPITAL LETTER I WITH ACUTE - replaceCharList[0x00CE] = 0x49; // I LATIN CAPITAL LETTER I WITH CIRCUMFLEX - replaceCharList[0x00CF] = 0x49; // I LATIN CAPITAL LETTER I WITH DIAERESIS - replaceCharList[0x0128] = 0x49; // I LATIN CAPITAL LETTER I WITH TILDE - replaceCharList[0x012A] = 0x49; // I LATIN CAPITAL LETTER I WITH MACRON - replaceCharList[0x012C] = 0x49; // I LATIN CAPITAL LETTER I WITH BREVE - replaceCharList[0x012E] = 0x49; // I LATIN CAPITAL LETTER I WITH OGONEK - replaceCharList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE - - replaceCharList[0x0137] = 0x6B; // k LATIN SMALL LETTER K WITH CEDILLA - - replaceCharList[0x0136] = 0x4B; // K LATIN CAPITAL LETTER K WITH CEDILLA - - replaceCharList[0x013A] = 0x6C; // l LATIN SMALL LETTER L WITH ACUTE - replaceCharList[0x013C] = 0x6C; // l LATIN SMALL LETTER L WITH CEDILLA - replaceCharList[0x013E] = 0x6C; // l LATIN SMALL LETTER L WITH CARON - replaceCharList[0x0140] = 0x6C; // l LATIN SMALL LETTER L WITH MIDDLE DOT - replaceCharList[0x0142] = 0x6C; // l LATIN SMALL LETTER L WITH STROKE - - replaceCharList[0x0139] = 0x4C; // L LATIN CAPITAL LETTER L WITH ACUTE - replaceCharList[0x013B] = 0x4C; // L LATIN CAPITAL LETTER L WITH CEDILLA - replaceCharList[0x013D] = 0x4C; // L LATIN CAPITAL LETTER L WITH CARON - replaceCharList[0x013F] = 0x4C; // L LATIN CAPITAL LETTER L WITH MIDDLE DOT - replaceCharList[0x0141] = 0x4C; // L LATIN CAPITAL LETTER L WITH STROKE - - replaceCharList[0x00F1] = 0x6E; // n LATIN SMALL LETTER N WITH TILDE - replaceCharList[0x0144] = 0x6E; // n LATIN SMALL LETTER N WITH ACUTE - replaceCharList[0x0146] = 0x6E; // n LATIN SMALL LETTER N WITH CEDILLA - replaceCharList[0x0148] = 0x6E; // n LATIN SMALL LETTER N WITH CARON - - replaceCharList[0x00D1] = 0x4E; // N LATIN CAPITAL LETTER N WITH TILDE - replaceCharList[0x0143] = 0x4E; // N LATIN CAPITAL LETTER N WITH ACUTE - replaceCharList[0x0145] = 0x4E; // N LATIN CAPITAL LETTER N WITH CEDILLA - replaceCharList[0x0147] = 0x4E; // N LATIN CAPITAL LETTER N WITH CARON - - replaceCharList[0x00F2] = 0x6F; // o LATIN SMALL LETTER O WITH GRAVE - replaceCharList[0x00F3] = 0x6F; // o LATIN SMALL LETTER O WITH ACUTE - replaceCharList[0x00F4] = 0x6F; // o LATIN SMALL LETTER O WITH CIRCUMFLEX - replaceCharList[0x00F5] = 0x6F; // o LATIN SMALL LETTER O WITH TILDE - replaceCharList[0x00F6] = 0x6F; // o LATIN SMALL LETTER O WITH DIAERESIS - replaceCharList[0x00F8] = 0x6F; // o LATIN SMALL LETTER O WITH STROKE - replaceCharList[0x014D] = 0x6F; // o LATIN SMALL LETTER O WITH MACRON - replaceCharList[0x014F] = 0x6F; // o LATIN SMALL LETTER O WITH BREVE - replaceCharList[0x01D2] = 0x6F; // o LATIN SMALL LETTER O WITH CARON - replaceCharList[0x01EB] = 0x6F; // o LATIN SMALL LETTER O WITH OGONEK - replaceCharList[0x0151] = 0x6F; // o LATIN SMALL LETTER O WITH DOUBLE ACUTE - replaceCharList[0x0153] = 0x6F; // LATIN SMALL LIGATURE OE - - replaceCharList[0x00D2] = 0x4F; // O LATIN CAPITAL LETTER O WITH GRAVE - replaceCharList[0x00D3] = 0x4F; // O LATIN CAPITAL LETTER O WITH ACUTE - replaceCharList[0x00D4] = 0x4F; // O LATIN CAPITAL LETTER O WITH CIRCUMFLEX - replaceCharList[0x00D5] = 0x4F; // O LATIN CAPITAL LETTER O WITH TILDE - replaceCharList[0x00D6] = 0x4F; // O LATIN CAPITAL LETTER O WITH DIAERESIS - replaceCharList[0x00D8] = 0x4F; // O LATIN CAPITAL LETTER O WITH STROKE - replaceCharList[0x014C] = 0x4F; // O LATIN CAPITAL LETTER O WITH MACRON - replaceCharList[0x014E] = 0x4F; // O LATIN CAPITAL LETTER O WITH BREVE - replaceCharList[0x01D1] = 0x4F; // O LATIN CAPITAL LETTER O WITH CARON - replaceCharList[0x01EA] = 0x4F; // O LATIN CAPITAL LETTER O WITH OGONEK - replaceCharList[0x0150] = 0x4F; // O LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - replaceCharList[0x0152] = 0x4F; // LATIN CAPITAL LIGATURE OE - - replaceCharList[0x0155] = 0x72; // r LATIN SMALL LETTER R WITH ACUTE - replaceCharList[0x0157] = 0x72; // r LATIN SMALL LETTER R WITH CEDILLA - replaceCharList[0x0159] = 0x72; // r LATIN SMALL LETTER R WITH CARON - - replaceCharList[0x0154] = 0x52; // R LATIN CAPITAL LETTER R WITH ACUTE - replaceCharList[0x0156] = 0x52; // R LATIN CAPITAL LETTER R WITH CEDILLA - replaceCharList[0x0158] = 0x52; // R LATIN CAPITAL LETTER R WITH CARON - - replaceCharList[0x015B] = 0x73; // s LATIN SMALL LETTER S WITH ACUTE - replaceCharList[0x015D] = 0x73; // s LATIN SMALL LETTER S WITH CIRCUMFLEX - replaceCharList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA - replaceCharList[0x0161] = 0x73; // s LATIN SMALL LETTER S WITH CARON - - replaceCharList[0x015A] = 0x53; // S LATIN CAPITAL LETTER S WITH ACUTE - replaceCharList[0x015C] = 0x53; // S LATIN CAPITAL LETTER S WITH CIRCUMFLEX - replaceCharList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA - replaceCharList[0x0160] = 0x53; // S LATIN CAPITAL LETTER S WITH CARON - - replaceCharList[0x00FE] = 0x74; // t LATIN CAPITAL LETTER THORN - replaceCharList[0x0163] = 0x74; // t LATIN SMALL LETTER T WITH CEDILLA - replaceCharList[0x0165] = 0x74; // t LATIN SMALL LETTER T WITH CARON - replaceCharList[0x0167] = 0x74; // t LATIN SMALL LETTER T WITH STROKE - replaceCharList[0x021B] = 0x74; // t LATIN SMALL LETTER T WITH COMMA BELOW - - replaceCharList[0x00DE] = 0x54; // T LATIN CAPITAL LETTER THORN - replaceCharList[0x0162] = 0x54; // T LATIN CAPITAL LETTER T WITH CEDILLA - replaceCharList[0x0164] = 0x54; // T LATIN CAPITAL LETTER T WITH CARON - replaceCharList[0x0166] = 0x54; // T LATIN CAPITAL LETTER T WITH STROKE - - replaceCharList[0x00F9] = 0x75; // u LATIN SMALL LETTER U WITH GRAVE - replaceCharList[0x00FA] = 0x75; // u LATIN SMALL LETTER U WITH ACUTE - replaceCharList[0x00FB] = 0x75; // u LATIN SMALL LETTER U WITH CIRCUMFLEX - replaceCharList[0x00FC] = 0x75; // u LATIN SMALL LETTER U WITH DIAERESIS - replaceCharList[0x0169] = 0x75; // u LATIN SMALL LETTER U WITH TILDE - replaceCharList[0x016B] = 0x75; // u LATIN SMALL LETTER U WITH MACRON - replaceCharList[0x016D] = 0x75; // u LATIN SMALL LETTER U WITH BREVE - replaceCharList[0x016F] = 0x75; // u LATIN SMALL LETTER U WITH RING ABOVE - replaceCharList[0x0171] = 0x75; // u LATIN SMALL LETTER U WITH DOUBLE ACUTE - replaceCharList[0x0173] = 0x75; // u LATIN SMALL LETTER U WITH OGONEK - replaceCharList[0x01D4] = 0x75; // u LATIN SMALL LETTER U WITH CARON - - replaceCharList[0x00D9] = 0x55; // U LATIN CAPITAL LETTER U WITH GRAVE - replaceCharList[0x00DA] = 0x55; // U LATIN CAPITAL LETTER U WITH ACUTE - replaceCharList[0x00DB] = 0x55; // U LATIN CAPITAL LETTER U WITH CIRCUMFLEX - replaceCharList[0x00DC] = 0x55; // U LATIN CAPITAL LETTER U WITH DIAERESIS - replaceCharList[0x0168] = 0x55; // U LATIN CAPITAL LETTER U WITH TILDE - replaceCharList[0x016A] = 0x55; // U LATIN CAPITAL LETTER U WITH MACRON - replaceCharList[0x016C] = 0x55; // U LATIN CAPITAL LETTER U WITH BREVE - replaceCharList[0x016E] = 0x55; // U LATIN CAPITAL LETTER U WITH RING ABOVE - replaceCharList[0x0170] = 0x55; // U LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - replaceCharList[0x0172] = 0x55; // U LATIN CAPITAL LETTER U WITH OGONEK - replaceCharList[0x01D3] = 0x55; // U LATIN CAPITAL LETTER U WITH CARON - - replaceCharList[0x00FD] = 0x79; // y LATIN SMALL LETTER Y WITH ACUTE - replaceCharList[0x00FF] = 0x79; // y LATIN SMALL LETTER Y WITH DIAERESIS - replaceCharList[0x0177] = 0x79; // y LATIN SMALL LETTER Y WITH CIRCUMFLEX - replaceCharList[0x0233] = 0x79; // y LATIN SMALL LETTER Y WITH MACRON - replaceCharList[0x1EF3] = 0x79; // y LATIN SMALL LETTER Y WITH GRAVE - replaceCharList[0x1EF9] = 0x79; // y LATIN SMALL LETTER Y WITH TILDE - - replaceCharList[0x00DD] = 0x59; // Y LATIN CAPITAL LETTER Y WITH ACUTE - replaceCharList[0x0176] = 0x59; // Y LATIN CAPITAL LETTER Y WITH CIRCUMFLEX - replaceCharList[0x0178] = 0x59; // Y LATIN CAPITAL LETTER Y WITH DIAERESIS - replaceCharList[0x0232] = 0x59; // Y LATIN CAPITAL LETTER Y WITH MACRON - replaceCharList[0x1EF2] = 0x59; // Y LATIN CAPITAL LETTER Y WITH GRAVE - replaceCharList[0x1EF8] = 0x59; // Y LATIN CAPITAL LETTER Y WITH TILDE - - replaceCharList[0x017A] = 0x7A; // z LATIN SMALL LETTER Z WITH ACUTE - replaceCharList[0x017C] = 0x7A; // z LATIN SMALL LETTER Z WITH DOT ABOVE - replaceCharList[0x017E] = 0x7A; // z LATIN SMALL LETTER Z WITH CARON - - replaceCharList[0x0179] = 0x5A; // Z LATIN CAPITAL LETTER Z WITH ACUTE - replaceCharList[0x017B] = 0x5A; // Z LATIN CAPITAL LETTER Z WITH DOT ABOVE - replaceCharList[0x017D] = 0x5A; // Z LATIN CAPITAL LETTER Z WITH CARON + ucs2toPortuList[0x005E] = 0x14; /* ^ */ + ucs2toPortuList[0x007C] = 0x40; /* | */ + ucs2toPortuList[0x007E] = 0x3D; /* ~ */ + ucs2toPortuList[0x20AC] = 0x65; /* € */ + ucs2toPortuList[0x00D4] = 0x0B; /* O LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ + ucs2toPortuList[0x00F4] = 0x0C; /* o LATIN SMALL LETTER O WITH CIRCUMFLEX */ + ucs2toPortuList[0x00C1] = 0x0E; /* A LATIN CAPITAL LETTER A WITH ACUTE */ + ucs2toPortuList[0x00E1] = 0x0F; /* a LATIN SMALL LETTER A WITH ACUTE */ + ucs2toPortuList[0x00CA] = 0x1F; /* E LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ + ucs2toPortuList[0x00EA] = 0x05; /* e LATIN SMALL LETTER E WITH CIRCUMFLEX */ + ucs2toPortuList[0x00C0] = 0x41; /* A LATIN CAPITAL LETTER A WITH GRAVE */ + ucs2toPortuList[0x00E7] = 0x09; /* c LATIN SMALL LETTER C WITH CEDILLA */ + ucs2toPortuList[0x00CD] = 0x49; /* I LATIN CAPITAL LETTER I WITH ACUTE */ + ucs2toPortuList[0x00ED] = 0x69; /* i LATIN SMALL LETTER I WITH ACUTE */ + ucs2toPortuList[0x00D3] = 0x4F; /* O LATIN CAPITAL LETTER O WITH ACUTE */ + ucs2toPortuList[0x00F3] = 0x6F; /* o LATIN SMALL LETTER O WITH ACUTE */ + ucs2toPortuList[0x00DA] = 0x55; /* U LATIN CAPITAL LETTER U WITH ACUTE */ + ucs2toPortuList[0x00FA] = 0x75; /* u LATIN SMALL LETTER U WITH ACUTE */ + ucs2toPortuList[0x00C3] = 0x61; /* A LATIN CAPITAL LETTER A WITH TILDE */ + ucs2toPortuList[0x00E3] = 0x7B; /* a LATIN SMALL LETTER A WITH TILDE */ + ucs2toPortuList[0x00D5] = 0x5C; /* O LATIN CAPITAL LETTER O WITH TILDE */ + ucs2toPortuList[0x00F5] = 0x7C; /* o LATIN SMALL LETTER O WITH TILDE */ + ucs2toPortuList[0x00C2] = 0x61; /* A LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ + ucs2toPortuList[0x00E2] = 0x7F; /* a LATIN SMALL LETTER A WITH CIRCUMFLEX */ + ucs2toPortuList[0x03A6] = 0x12; /* Φ GREEK CAPITAL LETTER PHI */ + ucs2toPortuList[0x0393] = 0x13; /* Γ GREEK CAPITAL LETTER GAMMA */ + ucs2toPortuList[0x03A9] = 0x15; /* Ω GREEK CAPITAL LETTER OMEGA */ + ucs2toPortuList[0x03A0] = 0x16; /* Π GREEK CAPITAL LETTER PI */ + ucs2toPortuList[0x03A8] = 0x17; /* Ψ GREEK CAPITAL LETTER PSI */ + ucs2toPortuList[0x03A3] = 0x18; /* Σ GREEK CAPITAL LETTER SIGMA */ + ucs2toPortuList[0x0398] = 0x19; /* Θ GREEK CAPITAL LETTER THETA */ + + + /* character replacement table */ + replaceCharList[0x00E0] = 0x61; /* a LATIN SMALL LETTER A WITH GRAVE */ + replaceCharList[0x00E1] = 0x61; /* a LATIN SMALL LETTER A WITH ACUTE */ + replaceCharList[0x00E2] = 0x61; /* a LATIN SMALL LETTER A WITH CIRCUMFLEX */ + replaceCharList[0x00E3] = 0x61; /* a LATIN SMALL LETTER A WITH TILDE */ + replaceCharList[0x00E4] = 0x61; /* a LATIN SMALL LETTER A WITH DIAERESIS */ + replaceCharList[0x00E5] = 0x61; /* a LATIN SMALL LETTER A WITH RING ABOVE */ + replaceCharList[0x00E6] = 0x61; /* a LATIN SMALL LETTER AE */ + replaceCharList[0x0101] = 0x61; /* a LATIN SMALL LETTER A WITH MACRON */ + replaceCharList[0x0103] = 0x61; /* a LATIN SMALL LETTER A WITH BREVE */ + replaceCharList[0x0105] = 0x61; /* a LATIN SMALL LETTER A WITH OGONEK */ + replaceCharList[0x01CE] = 0x61; /* a LATIN SMALL LETTER A WITH CARON */ + + replaceCharList[0x00C0] = 0x41; /* A LATIN CAPITAL LETTER A WITH GRAVE */ + replaceCharList[0x00C1] = 0x41; /* A LATIN CAPITAL LETTER A WITH ACUTE */ + replaceCharList[0x00C2] = 0x41; /* A LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ + replaceCharList[0x00C3] = 0x41; /* A LATIN CAPITAL LETTER A WITH TILDE */ + replaceCharList[0x00C4] = 0x41; /* A LATIN CAPITAL LETTER A WITH DIAERESIS */ + replaceCharList[0x00C5] = 0x41; /* A LATIN CAPITAL LETTER A WITH RING ABOVE */ + replaceCharList[0x00C6] = 0x41; /* A LATIN CAPITAL LETTER AE */ + replaceCharList[0x0100] = 0x41; /* A LATIN CAPITAL LETTER A WITH MACRON */ + replaceCharList[0x0102] = 0x41; /* A LATIN CAPITAL LETTER A WITH BREVE */ + replaceCharList[0x0104] = 0x41; /* A LATIN CAPITAL LETTER A WITH OGONEK */ + replaceCharList[0x01CD] = 0x41; /* A LATIN CAPITAL LETTER A WITH CARON */ + + replaceCharList[0x00E7] = 0x63; /* c LATIN SMALL LETTER C WITH CEDILLA */ + replaceCharList[0x0107] = 0x63; /* c LATIN SMALL LETTER C WITH ACUTE */ + replaceCharList[0x0109] = 0x63; /* c LATIN SMALL LETTER C WITH CIRCUMFLEX */ + replaceCharList[0x010B] = 0x63; /* c LATIN SMALL LETTER C WITH DOT ABOVE */ + replaceCharList[0x010D] = 0x63; /* c LATIN SMALL LETTER C WITH CARON */ + + replaceCharList[0x00C7] = 0x43; /* C LATIN CAPITAL LETTER C WITH CEDILLA */ + replaceCharList[0x0106] = 0x43; /* C LATIN CAPITAL LETTER C WITH ACUTE */ + replaceCharList[0x0108] = 0x43; /* C LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ + replaceCharList[0x010A] = 0x43; /* C LATIN CAPITAL LETTER C WITH DOT ABOVE */ + replaceCharList[0x010C] = 0x43; /* C LATIN CAPITAL LETTER C WITH CARON */ + + replaceCharList[0x010F] = 0x64; /* d LATIN SMALL LETTER D WITH CARON */ + replaceCharList[0x0111] = 0x64; /* d LATIN SMALL LETTER D WITH STROKE */ + + replaceCharList[0x010E] = 0x44; /* D LATIN CAPITAL LETTER D WITH CARON */ + replaceCharList[0x0110] = 0x44; /* D LATIN CAPITAL LETTER D WITH STROKE */ + + replaceCharList[0x00E8] = 0x65; /* e LATIN SMALL LETTER E WITH GRAVE */ + replaceCharList[0x00E9] = 0x65; /* e LATIN SMALL LETTER E WITH ACUTE */ + replaceCharList[0x00EA] = 0x65; /* e LATIN SMALL LETTER E WITH CIRCUMFLEX */ + replaceCharList[0x00EB] = 0x65; /* e LATIN SMALL LETTER E WITH DIAERESIS */ + replaceCharList[0x0113] = 0x65; /* e LATIN SMALL LETTER E WITH MACRON */ + replaceCharList[0x0115] = 0x65; /* e LATIN SMALL LETTER E WITH BREVE */ + replaceCharList[0x0117] = 0x65; /* e LATIN SMALL LETTER E WITH DOT ABOVE */ + replaceCharList[0x0119] = 0x65; /* e LATIN SMALL LETTER E WITH OGONEK */ + replaceCharList[0x011B] = 0x65; /* e LATIN SMALL LETTER E WITH CARON */ + replaceCharList[0x0259] = 0x65; /* e LATIN SMALL LETTER SCHWA */ + + replaceCharList[0x00C8] = 0x45; /* E LATIN CAPITAL LETTER E WITH GRAVE */ + replaceCharList[0x00C9] = 0x45; /* E LATIN CAPITAL LETTER E WITH ACUTE */ + replaceCharList[0x00CA] = 0x45; /* E LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ + replaceCharList[0x00CB] = 0x45; /* E LATIN CAPITAL LETTER E WITH DIAERESIS */ + replaceCharList[0x0112] = 0x45; /* E LATIN CAPITAL LETTER E WITH MACRON */ + replaceCharList[0x0114] = 0x45; /* E LATIN CAPITAL LETTER E WITH BREVE */ + replaceCharList[0x0116] = 0x45; /* E LATIN CAPITAL LETTER E WITH DOT ABOVE */ + replaceCharList[0x0118] = 0x45; /* E LATIN CAPITAL LETTER E WITH OGONEK */ + replaceCharList[0x011A] = 0x45; /* E LATIN CAPITAL LETTER E WITH CARON */ + replaceCharList[0x018F] = 0x45; /* E LATIN CAPITAL LETTER SCHWA */ + + replaceCharList[0x011D] = 0x67; /* g LATIN SMALL LETTER G WITH CIRCUMFLEX */ + replaceCharList[0x011F] = 0x67; /* g LATIN SMALL LETTER G WITH BREVE */ + replaceCharList[0x0121] = 0x67; /* g LATIN SMALL LETTER G WITH DOT ABOVE */ + replaceCharList[0x0123] = 0x67; /* g LATIN SMALL LETTER G WITH CEDILLA */ + replaceCharList[0x01E7] = 0x67; /* g LATIN SMALL LETTER G WITH CARON */ + replaceCharList[0x01F5] = 0x67; /* g LATIN SMALL LETTER G WITH ACUTE */ + replaceCharList[0x1E21] = 0x67; /* g LATIN SMALL LETTER G WITH MACRON */ + + replaceCharList[0x011C] = 0x47; /* G LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ + replaceCharList[0x011E] = 0x47; /* G LATIN CAPITAL LETTER G WITH BREVE */ + replaceCharList[0x0120] = 0x47; /* G LATIN CAPITAL LETTER G WITH DOT ABOVE */ + replaceCharList[0x0122] = 0x47; /* G LATIN CAPITAL LETTER G WITH CEDILLA */ + replaceCharList[0x01E6] = 0x47; /* G LATIN CAPITAL LETTER G WITH CARON */ + replaceCharList[0x01F4] = 0x47; /* G LATIN CAPITAL LETTER G WITH ACUTE */ + replaceCharList[0x1E20] = 0x47; /* G LATIN CAPITAL LETTER G WITH MACRON */ + + replaceCharList[0x00EC] = 0x69; /* i LATIN SMALL LETTER I WITH GRAVE */ + replaceCharList[0x00ED] = 0x69; /* i LATIN SMALL LETTER I WITH ACUTE */ + replaceCharList[0x00EE] = 0x69; /* i LATIN SMALL LETTER I WITH CIRCUMFLEX */ + replaceCharList[0x00EF] = 0x69; /* i LATIN SMALL LETTER I WITH DIAERESIS */ + replaceCharList[0x0129] = 0x69; /* i LATIN SMALL LETTER I WITH TILDE */ + replaceCharList[0x012B] = 0x69; /* i LATIN SMALL LETTER I WITH MACRON */ + replaceCharList[0x012D] = 0x69; /* i LATIN SMALL LETTER I WITH BREVE */ + replaceCharList[0x012F] = 0x69; /* i LATIN SMALL LETTER I WITH OGONEK */ + replaceCharList[0x01D0] = 0x69; /* i LATIN SMALL LETTER I WITH CARON */ + replaceCharList[0x0131] = 0x69; /* i LATIN SMALL LETTER DOTLESS I */ + + replaceCharList[0x00CC] = 0x49; /* I LATIN CAPITAL LETTER I WITH GRAVE */ + replaceCharList[0x00CD] = 0x49; /* I LATIN CAPITAL LETTER I WITH ACUTE */ + replaceCharList[0x00CE] = 0x49; /* I LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ + replaceCharList[0x00CF] = 0x49; /* I LATIN CAPITAL LETTER I WITH DIAERESIS */ + replaceCharList[0x0128] = 0x49; /* I LATIN CAPITAL LETTER I WITH TILDE */ + replaceCharList[0x012A] = 0x49; /* I LATIN CAPITAL LETTER I WITH MACRON */ + replaceCharList[0x012C] = 0x49; /* I LATIN CAPITAL LETTER I WITH BREVE */ + replaceCharList[0x012E] = 0x49; /* I LATIN CAPITAL LETTER I WITH OGONEK */ + replaceCharList[0x0130] = 0x49; /* I LATIN CAPITAL LETTER I WITH DOT ABOVE */ + + replaceCharList[0x0137] = 0x6B; /* k LATIN SMALL LETTER K WITH CEDILLA */ + + replaceCharList[0x0136] = 0x4B; /* K LATIN CAPITAL LETTER K WITH CEDILLA */ + + replaceCharList[0x013A] = 0x6C; /* l LATIN SMALL LETTER L WITH ACUTE */ + replaceCharList[0x013C] = 0x6C; /* l LATIN SMALL LETTER L WITH CEDILLA */ + replaceCharList[0x013E] = 0x6C; /* l LATIN SMALL LETTER L WITH CARON */ + replaceCharList[0x0140] = 0x6C; /* l LATIN SMALL LETTER L WITH MIDDLE DOT */ + replaceCharList[0x0142] = 0x6C; /* l LATIN SMALL LETTER L WITH STROKE */ + + replaceCharList[0x0139] = 0x4C; /* L LATIN CAPITAL LETTER L WITH ACUTE */ + replaceCharList[0x013B] = 0x4C; /* L LATIN CAPITAL LETTER L WITH CEDILLA */ + replaceCharList[0x013D] = 0x4C; /* L LATIN CAPITAL LETTER L WITH CARON */ + replaceCharList[0x013F] = 0x4C; /* L LATIN CAPITAL LETTER L WITH MIDDLE DOT */ + replaceCharList[0x0141] = 0x4C; /* L LATIN CAPITAL LETTER L WITH STROKE */ + + replaceCharList[0x00F1] = 0x6E; /* n LATIN SMALL LETTER N WITH TILDE */ + replaceCharList[0x0144] = 0x6E; /* n LATIN SMALL LETTER N WITH ACUTE */ + replaceCharList[0x0146] = 0x6E; /* n LATIN SMALL LETTER N WITH CEDILLA */ + replaceCharList[0x0148] = 0x6E; /* n LATIN SMALL LETTER N WITH CARON */ + + replaceCharList[0x00D1] = 0x4E; /* N LATIN CAPITAL LETTER N WITH TILDE */ + replaceCharList[0x0143] = 0x4E; /* N LATIN CAPITAL LETTER N WITH ACUTE */ + replaceCharList[0x0145] = 0x4E; /* N LATIN CAPITAL LETTER N WITH CEDILLA */ + replaceCharList[0x0147] = 0x4E; /* N LATIN CAPITAL LETTER N WITH CARON */ + + replaceCharList[0x00F2] = 0x6F; /* o LATIN SMALL LETTER O WITH GRAVE */ + replaceCharList[0x00F3] = 0x6F; /* o LATIN SMALL LETTER O WITH ACUTE */ + replaceCharList[0x00F4] = 0x6F; /* o LATIN SMALL LETTER O WITH CIRCUMFLEX */ + replaceCharList[0x00F5] = 0x6F; /* o LATIN SMALL LETTER O WITH TILDE */ + replaceCharList[0x00F6] = 0x6F; /* o LATIN SMALL LETTER O WITH DIAERESIS */ + replaceCharList[0x00F8] = 0x6F; /* o LATIN SMALL LETTER O WITH STROKE */ + replaceCharList[0x014D] = 0x6F; /* o LATIN SMALL LETTER O WITH MACRON */ + replaceCharList[0x014F] = 0x6F; /* o LATIN SMALL LETTER O WITH BREVE */ + replaceCharList[0x01D2] = 0x6F; /* o LATIN SMALL LETTER O WITH CARON */ + replaceCharList[0x01EB] = 0x6F; /* o LATIN SMALL LETTER O WITH OGONEK */ + replaceCharList[0x0151] = 0x6F; /* o LATIN SMALL LETTER O WITH DOUBLE ACUTE */ + replaceCharList[0x0153] = 0x6F; /* LATIN SMALL LIGATURE OE */ + + replaceCharList[0x00D2] = 0x4F; /* O LATIN CAPITAL LETTER O WITH GRAVE */ + replaceCharList[0x00D3] = 0x4F; /* O LATIN CAPITAL LETTER O WITH ACUTE */ + replaceCharList[0x00D4] = 0x4F; /* O LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ + replaceCharList[0x00D5] = 0x4F; /* O LATIN CAPITAL LETTER O WITH TILDE */ + replaceCharList[0x00D6] = 0x4F; /* O LATIN CAPITAL LETTER O WITH DIAERESIS */ + replaceCharList[0x00D8] = 0x4F; /* O LATIN CAPITAL LETTER O WITH STROKE */ + replaceCharList[0x014C] = 0x4F; /* O LATIN CAPITAL LETTER O WITH MACRON */ + replaceCharList[0x014E] = 0x4F; /* O LATIN CAPITAL LETTER O WITH BREVE */ + replaceCharList[0x01D1] = 0x4F; /* O LATIN CAPITAL LETTER O WITH CARON */ + replaceCharList[0x01EA] = 0x4F; /* O LATIN CAPITAL LETTER O WITH OGONEK */ + replaceCharList[0x0150] = 0x4F; /* O LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ + replaceCharList[0x0152] = 0x4F; /* LATIN CAPITAL LIGATURE OE */ + + replaceCharList[0x0155] = 0x72; /* r LATIN SMALL LETTER R WITH ACUTE */ + replaceCharList[0x0157] = 0x72; /* r LATIN SMALL LETTER R WITH CEDILLA */ + replaceCharList[0x0159] = 0x72; /* r LATIN SMALL LETTER R WITH CARON */ + + replaceCharList[0x0154] = 0x52; /* R LATIN CAPITAL LETTER R WITH ACUTE */ + replaceCharList[0x0156] = 0x52; /* R LATIN CAPITAL LETTER R WITH CEDILLA */ + replaceCharList[0x0158] = 0x52; /* R LATIN CAPITAL LETTER R WITH CARON */ + + replaceCharList[0x015B] = 0x73; /* s LATIN SMALL LETTER S WITH ACUTE */ + replaceCharList[0x015D] = 0x73; /* s LATIN SMALL LETTER S WITH CIRCUMFLEX */ + replaceCharList[0x015F] = 0x73; /* s LATIN SMALL LETTER S WITH CEDILLA */ + replaceCharList[0x0161] = 0x73; /* s LATIN SMALL LETTER S WITH CARON */ + + replaceCharList[0x015A] = 0x53; /* S LATIN CAPITAL LETTER S WITH ACUTE */ + replaceCharList[0x015C] = 0x53; /* S LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ + replaceCharList[0x015E] = 0x53; /* S LATIN CAPITAL LETTER S WITH CEDILLA */ + replaceCharList[0x0160] = 0x53; /* S LATIN CAPITAL LETTER S WITH CARON */ + + replaceCharList[0x00FE] = 0x74; /* t LATIN CAPITAL LETTER THORN */ + replaceCharList[0x0163] = 0x74; /* t LATIN SMALL LETTER T WITH CEDILLA */ + replaceCharList[0x0165] = 0x74; /* t LATIN SMALL LETTER T WITH CARON */ + replaceCharList[0x0167] = 0x74; /* t LATIN SMALL LETTER T WITH STROKE */ + replaceCharList[0x021B] = 0x74; /* t LATIN SMALL LETTER T WITH COMMA BELOW */ + + replaceCharList[0x00DE] = 0x54; /* T LATIN CAPITAL LETTER THORN */ + replaceCharList[0x0162] = 0x54; /* T LATIN CAPITAL LETTER T WITH CEDILLA */ + replaceCharList[0x0164] = 0x54; /* T LATIN CAPITAL LETTER T WITH CARON */ + replaceCharList[0x0166] = 0x54; /* T LATIN CAPITAL LETTER T WITH STROKE */ + + replaceCharList[0x00F9] = 0x75; /* u LATIN SMALL LETTER U WITH GRAVE */ + replaceCharList[0x00FA] = 0x75; /* u LATIN SMALL LETTER U WITH ACUTE */ + replaceCharList[0x00FB] = 0x75; /* u LATIN SMALL LETTER U WITH CIRCUMFLEX */ + replaceCharList[0x00FC] = 0x75; /* u LATIN SMALL LETTER U WITH DIAERESIS */ + replaceCharList[0x0169] = 0x75; /* u LATIN SMALL LETTER U WITH TILDE */ + replaceCharList[0x016B] = 0x75; /* u LATIN SMALL LETTER U WITH MACRON */ + replaceCharList[0x016D] = 0x75; /* u LATIN SMALL LETTER U WITH BREVE */ + replaceCharList[0x016F] = 0x75; /* u LATIN SMALL LETTER U WITH RING ABOVE */ + replaceCharList[0x0171] = 0x75; /* u LATIN SMALL LETTER U WITH DOUBLE ACUTE */ + replaceCharList[0x0173] = 0x75; /* u LATIN SMALL LETTER U WITH OGONEK */ + replaceCharList[0x01D4] = 0x75; /* u LATIN SMALL LETTER U WITH CARON */ + + replaceCharList[0x00D9] = 0x55; /* U LATIN CAPITAL LETTER U WITH GRAVE */ + replaceCharList[0x00DA] = 0x55; /* U LATIN CAPITAL LETTER U WITH ACUTE */ + replaceCharList[0x00DB] = 0x55; /* U LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ + replaceCharList[0x00DC] = 0x55; /* U LATIN CAPITAL LETTER U WITH DIAERESIS */ + replaceCharList[0x0168] = 0x55; /* U LATIN CAPITAL LETTER U WITH TILDE */ + replaceCharList[0x016A] = 0x55; /* U LATIN CAPITAL LETTER U WITH MACRON */ + replaceCharList[0x016C] = 0x55; /* U LATIN CAPITAL LETTER U WITH BREVE */ + replaceCharList[0x016E] = 0x55; /* U LATIN CAPITAL LETTER U WITH RING ABOVE */ + replaceCharList[0x0170] = 0x55; /* U LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ + replaceCharList[0x0172] = 0x55; /* U LATIN CAPITAL LETTER U WITH OGONEK */ + replaceCharList[0x01D3] = 0x55; /* U LATIN CAPITAL LETTER U WITH CARON */ + + replaceCharList[0x00FD] = 0x79; /* y LATIN SMALL LETTER Y WITH ACUTE */ + replaceCharList[0x00FF] = 0x79; /* y LATIN SMALL LETTER Y WITH DIAERESIS */ + replaceCharList[0x0177] = 0x79; /* y LATIN SMALL LETTER Y WITH CIRCUMFLEX */ + replaceCharList[0x0233] = 0x79; /* y LATIN SMALL LETTER Y WITH MACRON */ + replaceCharList[0x1EF3] = 0x79; /* y LATIN SMALL LETTER Y WITH GRAVE */ + replaceCharList[0x1EF9] = 0x79; /* y LATIN SMALL LETTER Y WITH TILDE */ + + replaceCharList[0x00DD] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH ACUTE */ + replaceCharList[0x0176] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ + replaceCharList[0x0178] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH DIAERESIS */ + replaceCharList[0x0232] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH MACRON */ + replaceCharList[0x1EF2] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH GRAVE */ + replaceCharList[0x1EF8] = 0x59; /* Y LATIN CAPITAL LETTER Y WITH TILDE */ + + replaceCharList[0x017A] = 0x7A; /* z LATIN SMALL LETTER Z WITH ACUTE */ + replaceCharList[0x017C] = 0x7A; /* z LATIN SMALL LETTER Z WITH DOT ABOVE */ + replaceCharList[0x017E] = 0x7A; /* z LATIN SMALL LETTER Z WITH CARON */ + + replaceCharList[0x0179] = 0x5A; /* Z LATIN CAPITAL LETTER Z WITH ACUTE */ + replaceCharList[0x017B] = 0x5A; /* Z LATIN CAPITAL LETTER Z WITH DOT ABOVE */ + replaceCharList[0x017D] = 0x5A; /* Z LATIN CAPITAL LETTER Z WITH CARON */ } @@ -444,7 +443,7 @@ int MsgTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int ma utf8Length = srcTextLen; } - int maxUCS2Length = utf8Length; // max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length + int maxUCS2Length = utf8Length; /* max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length */ WCHAR *pUCS2Text = NULL; unique_ptr buf(&pUCS2Text, unique_ptr_deleter); @@ -486,7 +485,7 @@ int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLe return -1; } - // null terminated string + /* null terminated string */ if ( srcTextLen == -1 ) { textLen = strlen((char*)pSrcText); srcTextLen = textLen; @@ -495,7 +494,7 @@ int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLe } GIConv cd; - int err=0; + int err = 0; cd = g_iconv_open("UTF16BE", "UTF8"); @@ -532,7 +531,7 @@ int MsgTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLe utf8Length = srcTextLen; - int maxUCS2Length = utf8Length; // max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length + int maxUCS2Length = utf8Length; /* max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length */ WCHAR pUCS2Text[maxUCS2Length]; memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR)); @@ -592,7 +591,7 @@ int MsgTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int ma { int utf8Length = 0; int ucs2Length = 0; - int maxUCS2Length = srcTextLen; // max # of UCS2 chars, NOT bytes. when all gsm7 chars are only one byte(-there is no extenstion), UCS2Length is maxUCS2 Length. otherwise(ex: gsm7 char starts with 0x1b) UCS2Length must be less than gsm7 legnth + int maxUCS2Length = srcTextLen; /* max # of UCS2 chars, NOT bytes. when all gsm7 chars are only one byte(-there is no extenstion), UCS2Length is maxUCS2 Length. otherwise(ex: gsm7 char starts with 0x1b) UCS2Length must be less than gsm7 legnth */ WCHAR pUCS2Text[maxUCS2Length]; memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR)); @@ -636,7 +635,7 @@ int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLe GIConv cd; int err = 0; - cd = g_iconv_open( "UTF8", "UTF16BE" ); + cd = g_iconv_open("UTF8", "UTF16BE"); if (cd > 0) { err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); @@ -677,9 +676,9 @@ int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxL } GIConv cd; - int err=0; + int err = 0; - cd = g_iconv_open( "UTF8", "EUCKR" ); + cd = g_iconv_open("UTF8", "EUCKR"); if (cd > 0) { err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); @@ -719,9 +718,9 @@ int MsgTextConvert::convertSHIFTJISToUTF8(OUT unsigned char *pDestText, IN int m } GIConv cd; - int err=0; + int err = 0; - cd = g_iconv_open( "UTF8", "SHIFT-JIS" ); + cd = g_iconv_open("UTF8", "SHIFT-JIS"); if (cd > 0) { err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); @@ -757,7 +756,7 @@ return: */ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_LANGUAGE_ID_T *pLangId, OUT bool *bIncludeAbnormalChar) { - // for UNICODE + /* for UNICODE */ int outTextLen = 0; unsigned char lowerByte, upperByte; @@ -775,9 +774,8 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma unsigned short inText; - // Get Language Type by checking each character - for (int index = 0; index < srcTextLen; index++) - { + /* Get Language Type by checking each character */ + for (int index = 0; index < srcTextLen; index++) { upperByte = pSrcText[index++]; lowerByte = pSrcText[index]; @@ -801,15 +799,14 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma MSG_DEBUG("charType : [%d]", currType); - for (int index = 0; index < srcTextLen; index++) - { + for (int index = 0; index < srcTextLen; index++) { upperByte = pSrcText[index++]; lowerByte = pSrcText[index]; inText = (upperByte << 8) & 0xFF00; inText = inText | lowerByte; - // Check Default Char + /* Check Default Char */ itChar = ucs2toGSM7DefList.find(inText); if (itChar != ucs2toGSM7DefList.end()) { @@ -819,7 +816,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma itExt = ucs2toGSM7ExtList.find(inText); if (itExt != ucs2toGSM7ExtList.end()) { - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen + 1) { MSG_DEBUG("Buffer Full."); break; @@ -843,7 +840,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma itExt = ucs2toTurkishList.find(inText); if (itExt != ucs2toTurkishList.end()) { - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen + 1) { MSG_DEBUG("Buffer Full."); break; @@ -867,7 +864,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma itExt = ucs2toSpanishList.find(inText); if (itExt != ucs2toSpanishList.end()) { - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen + 1) { MSG_DEBUG("Buffer Full."); break; @@ -891,7 +888,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma itExt = ucs2toPortuList.find(inText); if (itExt != ucs2toPortuList.end()) { - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen + 1) { MSG_DEBUG("Buffer Full."); break; @@ -921,7 +918,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma } } - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen) { MSG_DEBUG("Buffer full."); break; @@ -940,7 +937,7 @@ int MsgTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int ma #ifndef FEATURE_SMS_CDMA int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown) { - // for UNICODE + /* for UNICODE */ int outTextLen = 0; unsigned char lowerByte, upperByte; @@ -954,15 +951,14 @@ int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN in unsigned short inText; - for (int index = 0; index < srcTextLen; index++) - { + for (int index = 0; index < srcTextLen; index++) { upperByte = pSrcText[index++]; lowerByte = pSrcText[index]; inText = (upperByte << 8) & 0xFF00; inText = inText | lowerByte; - // Check Default Char + /* Check Default Char */ itChar = ucs2toGSM7DefList.find(inText); if (itChar != ucs2toGSM7DefList.end()) { @@ -971,7 +967,7 @@ int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN in itExt = ucs2toGSM7ExtList.find(inText); if (itExt != ucs2toGSM7ExtList.end()) { - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen + 1) { MSG_DEBUG("Buffer Full."); break; @@ -986,7 +982,7 @@ int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN in } } - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen) { MSG_DEBUG("Buffer full\n"); break; @@ -1005,7 +1001,7 @@ int MsgTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN in #else int MsgTextConvert::convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown) { - // for UNICODE + /* for UNICODE */ int outTextLen = 0; unsigned char lowerByte, upperByte; @@ -1019,15 +1015,14 @@ int MsgTextConvert::convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxL unsigned short inText; - for (int index = 0; index < srcTextLen; index++) - { + for (int index = 0; index < srcTextLen; index++) { upperByte = pSrcText[index++]; lowerByte = pSrcText[index]; inText = (upperByte << 8) & 0xFF00; inText = inText | lowerByte; - // Check Default Char + /* Check Default Char */ if (inText > 0x007f) { MSG_DEBUG("Abnormal character is included. inText : [%04x]", inText); *pUnknown = true; @@ -1036,12 +1031,11 @@ int MsgTextConvert::convertUCS2ToASCII(OUT unsigned char *pDestText, IN int maxL pDestText[outTextLen++] = (unsigned char)inText; - // prevent buffer overflow + /* prevent buffer overflow */ if (maxLength <= outTextLen) { MSG_DEBUG("Buffer full\n"); break; } - } #ifdef CONVERT_DUMP @@ -1074,27 +1068,26 @@ int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int ma return -1; } - for (int i = 0; i= 0x80) { - //error + /*error */ MSG_ERR(">>>>>>>a_pTextString[i]=%x, The alpha isn't the gsm 7bit code, Never Come here!!!\n", pSrcText[i]); return -1; } - if (pLangInfo->bLockingShift == true) { // National Language Locking Shift + if (pLangInfo->bLockingShift == true) { /* National Language Locking Shift */ MSG_DEBUG("Locking Shift [%d]", pLangInfo->lockingLang); if (pLangInfo->lockingLang == MSG_LANG_ID_TURKISH) { - // Check Escape + /* Check Escape */ if (g_TurkishLockingToUCS2[pSrcText[i]] == 0x001B) { i++; - if (pLangInfo->bSingleShift == true) { // National Language Single Shift + if (pLangInfo->bSingleShift == true) { /* National Language Single Shift */ MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang); if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH) { @@ -1110,20 +1103,20 @@ int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int ma lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } - } else { // GSM 7 bit Default Alphabet Extension Table + } else { /* GSM 7 bit Default Alphabet Extension Table */ lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } - } else { // TURKISH - National Language Locking Shift + } else { /* TURKISH - National Language Locking Shift */ lowerByte = g_TurkishLockingToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_TurkishLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8; } } else if (pLangInfo->lockingLang == MSG_LANG_ID_PORTUGUESE) { - // Check Escape + /* Check Escape */ if (g_PortuLockingToUCS2[pSrcText[i]] == 0x001B) { i++; - if (pLangInfo->bSingleShift == true) { // National Language Single Shift + if (pLangInfo->bSingleShift == true) { /* National Language Single Shift */ MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang); if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH) { @@ -1139,21 +1132,21 @@ int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int ma lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } - } else { // GSM 7 bit Default Alphabet Extension Table + } else { /* GSM 7 bit Default Alphabet Extension Table */ lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } - } else { // PORTUGUESE - National Language Locking Shift + } else { /* PORTUGUESE - National Language Locking Shift */ lowerByte = g_PortuLockingToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_PortuLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8; } } } else { - // Check Escape + /* Check Escape */ if (g_GSM7BitToUCS2[pSrcText[i]] == 0x001B) { i++; - if (pLangInfo->bSingleShift == true) { // National Language Single Shift + if (pLangInfo->bSingleShift == true) { /* National Language Single Shift */ MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang); if (pLangInfo->singleLang == MSG_LANG_ID_TURKISH) { @@ -1169,7 +1162,7 @@ int MsgTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int ma lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } - } else { // GSM 7 bit Default Alphabet Extension Table + } else { /* GSM 7 bit Default Alphabet Extension Table */ lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF; upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8; } @@ -1200,8 +1193,7 @@ void MsgTextConvert::convertDumpTextToHex(const unsigned char *pText, int length MSG_DEBUG(" Dump Text To Hex - Length :%d\n", length); MSG_DEBUG("======================================="); - for (int i = 0; i < length; i++ ) - { + for (int i = 0; i < length; i++) { MSG_DEBUG("[%02x]", pText[i]); } diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index f181a20..a502ce5 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -23,7 +23,7 @@ #include #include #include -#include //sync() +#include #include #include @@ -132,7 +132,7 @@ bool MakeThumbnail(char *srcPath, char *dstPath) return true; } -// File operation wrappers +/* File operation wrappers */ FILE *MsgOpenFile(const char *filepath, const char *opt) { if (!filepath || !opt) { @@ -183,7 +183,7 @@ int MsgFseek(FILE *pFile, long int offset, int origin) MSG_DEBUG("[FILE] pFile [%p], offset [%d], origin [%d]", pFile, offset, origin); try { - ret = fseek(pFile, offset, origin); // return 0, if success. + ret = fseek(pFile, offset, origin); /* return 0, if success. */ } catch (exception &e) { MSG_FATAL("%s", e.what()); return -1; @@ -237,7 +237,7 @@ long int MsgFtell(FILE *pFile) return -1L; } - long int ret = -1L; // -1L return if error occured. + long int ret = -1L; /* -1L return if error occured. */ try { ret = ftell(pFile); @@ -258,7 +258,7 @@ int MsgFflush(FILE *pFile) int ret = -1; try { - ret = fflush(pFile); // return 0 if success + ret = fflush(pFile); /* return 0 if success */ } catch (exception &e) { MSG_FATAL("%s", e.what()); } @@ -276,7 +276,7 @@ int MsgFsync(FILE *pFile) int ret = -1; try { - ret = fdatasync(pFile->_fileno); // return 0 if success + ret = fdatasync(pFile->_fileno); /* return 0 if success */ } catch (exception &e) { MSG_FATAL("%s", e.what()); } @@ -299,12 +299,12 @@ bool MsgCreateFileName(char *pFileName) return false; } - // Create Random Number + /* Create Random Number */ srandom((unsigned int)ts.tv_nsec); MSG_DEBUG("ts.tv_nsec : %d", ts.tv_nsec); - // between 1 - 1000000000 + /* between 1 - 1000000000 */ snprintf(pFileName, MSG_FILENAME_LEN_MAX, "MSG_%lu.DATA", random()%1000000000+1); } catch (exception& e) { MSG_FATAL("%s", e.what()); @@ -479,7 +479,7 @@ int MsgReadSmilFile(const char *pFileName, char **ppData) return -1; } - //ppData[FileSize] = '\0'; + /* ppData[FileSize] = '\0'; */ nSize = FileSize; MsgCloseFile(pFile); @@ -488,7 +488,7 @@ int MsgReadSmilFile(const char *pFileName, char **ppData) } -bool MsgWriteSmilFile(const char *pFilePath,char *pData, int DataSize) +bool MsgWriteSmilFile(const char *pFilePath, char *pData, int DataSize) { if(!pFilePath) { MSG_DEBUG("pFilePath is NULL"); @@ -553,15 +553,14 @@ void MsgDeleteFile(const char *pFileName) if (remove(fullPath) != 0) MSG_SEC_ERR("File Delete Error [%s]: %s", fullPath, g_strerror(errno)); } catch (exception &e) { - MSG_FATAL ("%s", e.what()); + MSG_FATAL("%s", e.what()); } - } void MsgDeleteSmilFile(const char *pFileName) { - if (!pFileName ) { + if (!pFileName) { MSG_FATAL("pFileName NULL"); return; } @@ -672,7 +671,7 @@ bool MsgWriteDataFromEncodeBuffer(FILE *pFile, char *pInBuffer, int *pPtr, int m MsgFflush(pFile); - memset( pInBuffer, 0, maxLen ); + memset(pInBuffer, 0, maxLen); *pPtr = 0; @@ -702,11 +701,11 @@ bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength } if (MsgWriteFile(pBuff, sizeof(char), TotalLength, pFile) != (size_t)TotalLength) { - MsgCloseFile( pFile ); + MsgCloseFile(pFile); return false; } - MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off + MsgFsync(pFile); /* file is written to device immediately, it prevents missing file data from unexpected power off */ MsgFflush(pFile); MsgCloseFile(pFile); @@ -714,7 +713,7 @@ bool MsgOpenCreateAndOverwriteFile(char *pFullPath, char *pBuff, int TotalLength } -char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int *npSize ) +char *MsgOpenAndReadMmsFile(const char *szFilePath, int offset, int size, int *npSize) { FILE *pFile = NULL; char *pData = NULL; @@ -727,7 +726,7 @@ char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int * *npSize = 0; - pFile = MsgOpenFile( szFilePath, "rb" ); + pFile = MsgOpenFile(szFilePath, "rb"); if (pFile == NULL) { MSG_ERR("Can't open file: %s", g_strerror(errno)); @@ -742,11 +741,13 @@ char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int * } else { readSize = size; } -// restore Kies backup data size greater than FM_READ_WRITE_BUFFER_MAX -// if (readSize > FM_READ_WRITE_BUFFER_MAX) { -// MSG_DEBUG("MsgOpenAndReadMmsFile: File size tried to read too big"); -// goto __CATCH; -// } +/* restore Kies backup data size greater than FM_READ_WRITE_BUFFER_MAX */ +#if 0 + if (readSize > FM_READ_WRITE_BUFFER_MAX) { + MSG_DEBUG("MsgOpenAndReadMmsFile: File size tried to read too big"); + goto __CATCH; + } +#endif pData = (char *)calloc(1, readSize + 1); if ( NULL == pData ) { @@ -754,7 +755,7 @@ char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int * goto __CATCH; } - if (MsgFseek( pFile, offset, SEEK_SET) < 0) { + if (MsgFseek(pFile, offset, SEEK_SET) < 0) { MSG_ERR("FmSeekFile failed : %s", g_strerror(errno) ); goto __CATCH; } @@ -772,21 +773,21 @@ char *MsgOpenAndReadMmsFile( const char *szFilePath, int offset, int size, int * __CATCH: if (pData) { - free( pData ); + free(pData); pData = NULL; } *npSize = 0; if (pFile != NULL) { - MsgCloseFile( pFile ); + MsgCloseFile(pFile); pFile = NULL; } return NULL; } -// it is equivalent to "rm -rf pDirPath" +/* it is equivalent to "rm -rf pDirPath" */ int MsgRmRf(char *pDirPath) { struct dirent *d = NULL; @@ -822,7 +823,6 @@ int MsgRmRf(char *pDirPath) MsgRmRf(path); if (rmdir(path) != 0) { - if (path != NULL) free(path); @@ -839,7 +839,6 @@ int MsgRmRf(char *pDirPath) MsgDrmUnregisterFile(path); if (remove(path) != 0) { - if (path != NULL) free(path); @@ -875,7 +874,7 @@ int MsgGetFileSize(const char *pFileName) } -// it is equivalent to "du dir_path" +/* it is equivalent to "du dir_path" */ unsigned int MsgDu(const char *pDirPath) { struct dirent *d = NULL; @@ -901,7 +900,7 @@ unsigned int MsgDu(const char *pDirPath) unsigned int totalFileSize = 0; for (readdir_r(dir, &entry, &d); d != NULL; readdir_r(dir, &entry, &d)) { - if( d->d_type == DT_DIR) { + if(d->d_type == DT_DIR) { snprintf(path, size, "%s/%s", pDirPath, d->d_name); if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0)) @@ -971,7 +970,7 @@ bool MsgAppendFile(const char *pFilePath, const char *pData, int DataSize) return false; } - MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off + MsgFsync(pFile); /*file is written to device immediately, it prevents missing file data from unexpected power off */ MsgFflush(pFile); MsgCloseFile(pFile); return true; @@ -990,14 +989,14 @@ void MsgMmsInitDir() return; } - // Remove temporal Mms folder (/opt/usr/data/msg-service/msgdata/*.dir) + /* Remove temporal Mms folder */ for (readdir_r(dir, &entry, &d); d != NULL; readdir_r(dir, &entry, &d)) { if (d->d_type == DT_DIR) { if ((strcmp(".", d->d_name) == 0) || (strcmp("..", d->d_name) == 0)) continue; if(strstr(d->d_name, ".dir") != NULL) { - char filePath[MSG_FILEPATH_LEN_MAX] = {0,}; + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; snprintf(filePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, d->d_name); MsgRmRf(filePath); @@ -1010,7 +1009,7 @@ void MsgMmsInitDir() closedir(dir); } -//mode : R_OK, W_OK, X_OK, or the existence test F_OK. +/* mode : R_OK, W_OK, X_OK, or the existence test F_OK. */ bool MsgAccessFile(const char *filepath, int mode) { int ret; @@ -1113,7 +1112,7 @@ bool MsgChown(const char *filepath, int uid, int gid) return true; } -bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize) +bool MsgCreateFile(const char *pFilePath, char *pData, int DataSize) { if(!pFilePath) { MSG_DEBUG("pFilePath is NULL"); @@ -1140,7 +1139,7 @@ bool MsgCreateFile(const char *pFilePath,char *pData, int DataSize) } MsgFflush(pFile); - MsgFsync( pFile); + MsgFsync(pFile); MsgCloseFile(pFile); return true; diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index 72ca1b5..7e8e0a3 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -71,7 +71,7 @@ bool MsgCheckFeatureSupport(const char *feature_name) return result; } -// Encoders +/* Encoders */ int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest) { int dataSize = 0; @@ -102,8 +102,7 @@ int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest) memcpy(p, &count, sizeof(int)); p = (void*)((char*)p + sizeof(int)); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(p, &(pRecipientList->recipientAddr[i]), sizeof(MSG_ADDRESS_INFO_S)); p = (void*)((char*)p + sizeof(MSG_ADDRESS_INFO_S)); } @@ -210,8 +209,7 @@ int MsgEncodeFolderList(msg_struct_list_s *pFolderList, char **ppDest) msg_struct_s *folder_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { folder_info = (msg_struct_s *)pFolderList->msg_struct_info[i]; memcpy(p, folder_info->data, sizeof(MSG_FOLDER_INFO_S)); p = (void*)((char*)p + sizeof(MSG_FOLDER_INFO_S)); @@ -237,8 +235,7 @@ int MsgEncodeFilterList(msg_struct_list_s *pFilterList, char **ppDest) msg_struct_s *filter_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { filter_info = (msg_struct_s *)pFilterList->msg_struct_info[i]; memcpy(p, filter_info->data, sizeof(MSG_FILTER_S)); p = (void*)((char*)p + sizeof(MSG_FILTER_S)); @@ -281,8 +278,7 @@ int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest) msg_struct_s *thread_info = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { thread_info = (msg_struct_s *)pThreadViewList->msg_struct_info[i]; memcpy(p, thread_info->data, sizeof(MSG_THREAD_VIEW_S)); p = (void*)((char*)p + sizeof(MSG_THREAD_VIEW_S)); @@ -307,8 +303,7 @@ int MsgEncodeConversationViewList(msg_struct_list_s *pConvViewList, char **ppDes memcpy(p, &count, sizeof(int)); p = (void*)((char*)p + sizeof(int)); - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(p, &(pConvViewList->msg_struct_info[i]), sizeof(msg_struct_list_s)); p = (void*)((char*)p + sizeof(msg_struct_list_s)); } @@ -488,8 +483,7 @@ int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest) } - -// Decoders +/* Decoders */ void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId) { memcpy(pMsgId, pSrc, sizeof(msg_message_id_t)); @@ -519,7 +513,7 @@ void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo) pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt]; memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt); - for (int i=0; inAddressCnt; i++) { + for (int i = 0; i < pMsgInfo->nAddressCnt; i++) { memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S)); } } @@ -535,14 +529,13 @@ void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I pSrc = pSrc + sizeof(MSG_SENDINGOPT_INFO_S); - if(pMsgInfo->nAddressCnt > 0) { pMsgInfo->addressList = NULL; pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt]; memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S) * pMsgInfo->nAddressCnt); - for (int i=0; inAddressCnt; i++) { + for (int i = 0; i < pMsgInfo->nAddressCnt; i++) { memcpy(&(pMsgInfo->addressList[i]), pSrc + (sizeof(MSG_ADDRESS_INFO_S)*i), sizeof(MSG_ADDRESS_INFO_S)); } } @@ -556,13 +549,12 @@ void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - pRecipientList->recipientCnt= count; + pRecipientList->recipientCnt = count; pRecipientList->recipientAddr = (MSG_ADDRESS_INFO_S*)new char[sizeof(MSG_ADDRESS_INFO_S)*count]; MSG_ADDRESS_INFO_S* pInfoTmp = pRecipientList->recipientAddr; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { memcpy(pInfoTmp, pSrc, sizeof(MSG_ADDRESS_INFO_S)); pSrc = pSrc + sizeof(MSG_ADDRESS_INFO_S); pInfoTmp++; @@ -577,19 +569,16 @@ void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - if( count > 0 ) - { + if( count > 0 ) { pFolderList->nCount = count; pFolderList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(msg_struct_t)); - if (pFolderList->msg_struct_info == NULL) - { + if (pFolderList->msg_struct_info == NULL) { pFolderList->nCount = 0; return; } msg_struct_s *pInfoTmp = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { pFolderList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s; pInfoTmp = (msg_struct_s *)pFolderList->msg_struct_info[i]; pInfoTmp->type = MSG_STRUCT_FOLDER_INFO; @@ -597,9 +586,7 @@ void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList) memcpy(pInfoTmp->data, pSrc, sizeof(MSG_FOLDER_INFO_S)); pSrc = pSrc + sizeof(MSG_FOLDER_INFO_S); } - } - else if ( count == 0 ) - { + } else if ( count == 0 ) { pFolderList->nCount = count; pFolderList->msg_struct_info = NULL; } @@ -613,8 +600,7 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) memcpy(&count, pSrc, sizeof(int)); pSrc = pSrc + sizeof(int); - if( count > 0 ) - { + if( count > 0 ) { pFilterList->nCount = count; pFilterList->msg_struct_info = (msg_struct_t *)calloc(count, sizeof(MSG_FILTER_S *)); @@ -625,8 +611,7 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) msg_struct_s *pStructTmp = NULL; - for (int i = 0; i < count; i++) - { + for (int i = 0; i < count; i++) { pFilterList->msg_struct_info[i] = (msg_struct_t )new msg_struct_s; pStructTmp = (msg_struct_s *)pFilterList->msg_struct_info[i]; pStructTmp->type = MSG_STRUCT_FILTER; @@ -634,13 +619,10 @@ void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList) memcpy(pStructTmp->data, pSrc, sizeof(MSG_FILTER_S)); pSrc = pSrc + sizeof(MSG_FILTER_S); } - } - else if ( count == 0 ) - { + } else if ( count == 0 ) { pFilterList->nCount = count; pFilterList->msg_struct_info = NULL; } - } @@ -701,7 +683,6 @@ void MsgDecodeReportStatus(char *pSrc, msg_struct_list_s *report_list) msg_struct_t *report_status = (msg_struct_t *)new char[sizeof(msg_struct_t)*count]; for (int i = 0; i < count; i++) { - msg_struct_s *report_status_item = new msg_struct_s; report_status_item->type = MSG_STRUCT_REPORT_STATUS_INFO; report_status_item->data = new MSG_REPORT_STATUS_INFO_S; @@ -733,7 +714,7 @@ void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo) memcpy(pThreadInfo, pSrc, sizeof(MSG_THREAD_VIEW_S)); } -// Event Encoder +/* Event Encoder */ int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent) { MSG_EVENT_S* pMsgEvent = NULL; @@ -793,7 +774,6 @@ int msg_verify_email(const char *raw) } for (int i = 0; raw[i]; i++) { - if (raw[i] == '@') { onlyNum = false; @@ -833,14 +813,12 @@ char* msg_clean_country_code(char *src) { int ret = 1; - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 7: break; case 2: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 7: break; @@ -860,8 +838,7 @@ char* msg_clean_country_code(char *src) } break; case 3: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -881,8 +858,7 @@ char* msg_clean_country_code(char *src) } break; case 4: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 3: @@ -902,8 +878,7 @@ char* msg_clean_country_code(char *src) } break; case 5: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 3: @@ -923,8 +898,7 @@ char* msg_clean_country_code(char *src) } break; case 6: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -944,8 +918,7 @@ char* msg_clean_country_code(char *src) } break; case 8: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 1: case 2: case 4: @@ -965,8 +938,7 @@ char* msg_clean_country_code(char *src) } break; case 9: - switch (src[ret++]-'0') - { + switch (src[ret++]-'0') { case 0: case 1: case 2: @@ -1027,8 +999,7 @@ msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort) int nameOrder = MsgGetContactNameOrder(); - switch (pSortRule->sortType) - { + switch (pSortRule->sortType) { case MSG_SORT_BY_DISPLAY_FROM : if (nameOrder == 0) snprintf(sql, sizeof(sql), "ORDER BY B.FIRST_NAME %s, B.LAST_NAME %s, B.ADDRESS_VAL, A.DISPLAY_TIME DESC;", order, order); @@ -1088,7 +1059,7 @@ msg_error_t msg_write_text_to_msg_info(MSG_MESSAGE_INFO_S *pMsgInfo, char *text) if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) { pMsgInfo->bTextSms = false; - // Save Message Data into File + /* Save Message Data into File */ char fileName[MSG_FILENAME_LEN_MAX+1]; memset(fileName, 0x00, sizeof(fileName)); @@ -1172,11 +1143,11 @@ gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementCha gchar *res; gsize result_len = 0; const gchar *p; - result_len = g_utf8_strlen (pszText, -1) + 1; //+1 for malloc of non-terminating chracter + result_len = g_utf8_strlen(pszText, -1) + 1; /* +1 for malloc of non-terminating chracter */ res = (gchar *)g_malloc (result_len * sizeof (gchar)); int i = 0; - for (p = pszText, i = 0; *p != '\0'; p = g_utf8_next_char (p), i++) { - res[i] = isascii(g_utf8_get_char (p)) ? *p : replacementChar; + for (p = pszText, i = 0; *p != '\0'; p = g_utf8_next_char(p), i++) { + res[i] = isascii(g_utf8_get_char(p)) ? *p : replacementChar; } res[i] = '\0'; return res; diff --git a/utils/MsgUtilMime.cpp b/utils/MsgUtilMime.cpp index 2c8e06c..aa1ccb6 100755 --- a/utils/MsgUtilMime.cpp +++ b/utils/MsgUtilMime.cpp @@ -243,7 +243,7 @@ static const MimeTable mimeTable[] = { /* 151 */ {"video/mpeg4", "mp4", true, MIME_VIDEO_MPEG4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/mp4", "mp4", true, MIME_VIDEO_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, - {"video/h263", ""/*,3gpp,mp4"*/,true, MIME_VIDEO_H263, MIME_VIDEO_H263, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, + {"video/h263", ""/*,3gpp,mp4"*/, true, MIME_VIDEO_H263, MIME_VIDEO_H263, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/3gpp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GPP, MIME_VIDEO_3GPP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/3gp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GP, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/avi", "avi", false, MIME_VIDEO_AVI, MIME_VIDEO_AVI, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, @@ -264,7 +264,6 @@ static const MimeTable mimeTable[] = { {"video/x-ms-wmv", "wmv", true, MIME_VIDEO_X_MS_WMV, MIME_VIDEO_X_MS_WMV, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/x-ms-asf", "asf", true, MIME_VIDEO_X_MS_ASF, MIME_VIDEO_X_MS_ASF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }, {"video/x-pv-pvx", "pvx", true, MIME_VIDEO_X_PV_PVX, MIME_VIDEO_X_PV_PVX, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY } - }; /********** MIME table information ***********/ @@ -538,7 +537,7 @@ int __MimeGetTableIndexInt(MimeType mime) index = (mime & 0x003f); /* If 'type' is zero, mimeTableIndex's array value have a minus value */ - // If 'type' is zero, mime type is '*\/*' + /* If 'type' is zero, mime type is '\*\/\*' */ if (type == 0) tableIndex = 0; else @@ -571,7 +570,7 @@ int __MimeGetTableIndexString(const char *szMime) return MIME_UNKNOWN; } - szMIMEType = (char * )malloc(strlen(szMime) + 1); + szMIMEType = (char *)malloc(strlen(szMime) + 1); if (szMIMEType == NULL) { MSG_DEBUG("szMime is NULL"); @@ -750,7 +749,6 @@ typedef struct { #define EXT_TABLE_SIZE (58) const ExtTableItem extTable[EXT_TABLE_SIZE] = { - /* text */ {"txt", MIME_MAINTYPE_TEXT, MIME_TEXT_PLAIN, "text/plain"}, {"html", MIME_MAINTYPE_TEXT, MIME_TEXT_HTML, "text/html"}, @@ -819,7 +817,6 @@ const ExtTableItem extTable[EXT_TABLE_SIZE] = { {"ro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML, "application/vnd.oma.drm.rights+wbxml"}, {"oro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RO_XML, "application/vnd.oma.drm.ro+xml"}, {"odf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_DCF, "application/vnd.oma.drm.dcf"}, - }; /* GetMimeType from File Extension */ @@ -836,9 +833,7 @@ bool MsgGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pM int extTableMainSize = sizeof(extTable)/sizeof(ExtTableItem); for (int i = 0; i < extTableMainSize; i++) { - if (strcasecmp(extTable[i].szExt, pExt) == 0) { - matchedItem = &extTable[i]; if (mainType == extTable[i].mainType) { @@ -945,4 +940,4 @@ bool MsgGetMainTypeFromMetaData(const char *pFileName, MimeMainType *mainType) metadata_extractor_destroy(metadata); return false; -} \ No newline at end of file +} diff --git a/utils/MsgUtilStorage.cpp b/utils/MsgUtilStorage.cpp index c424c99..942ce79 100755 --- a/utils/MsgUtilStorage.cpp +++ b/utils/MsgUtilStorage.cpp @@ -29,8 +29,6 @@ #include "MsgUtilFunction.h" #include "MsgUtilStorage.h" -//#include -//#include #include static int msgCntLimit[MSG_COUNT_LIMIT_MAILBOX_TYPE_MAX][MSG_COUNT_LIMIT_MSG_TYPE_MAX] = {{10, 10, 0, 10, 10}, {5, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {10, 10, 0, 0, 0}, {0, 0, 10, 0, 0}}; @@ -60,7 +58,7 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN char* pFileData = NULL; unique_ptr buf(&pFileData, unique_ptr_deleter); - // Get File Data + /* Get File Data */ if (pMsgInfo->bTextSms == false) { if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false) return 0; @@ -74,7 +72,7 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN char *imsi = MsgSettingGetString(keyName); - // Add Message + /* Add Message */ char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); @@ -100,7 +98,6 @@ unsigned int MsgStoAddMessageTable(MsgDbHandler *pDbHandle, const MSG_MESSAGE_IN pDbHandle->bindText(pFileData, 2); else pDbHandle->bindText(pMsgInfo->msgText, 2); - } if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) { @@ -125,7 +122,7 @@ msg_error_t MsgStoSetReadStatus(MsgDbHandler *pDbHandle, msg_message_id_t msgId, if (pDbHandle->execQuery(sqlQuery) != MSG_SUCCESS) return MSG_ERR_DB_EXEC; - // Get MAIN_TYPE, SUB_TYPE, STORAGE_ID + /* Get MAIN_TYPE, SUB_TYPE, STORAGE_ID */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT A.MAIN_TYPE, A.SUB_TYPE, B.CONV_ID \ FROM %s A, %s B WHERE A.MSG_ID = %d AND A.CONV_ID = B.CONV_ID;", @@ -204,7 +201,7 @@ msg_error_t MsgStoCheckMsgCntFull(MsgDbHandler *pDbHandle, const MSG_MESSAGE_TYP if (freeSpace < SMS_MINIMUM_SPACE && pMsgType->mainType == MSG_SMS_TYPE) err = MSG_ERR_MESSAGE_COUNT_FULL; - else if(freeSpace < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE) + else if (freeSpace < MMS_MINIMUM_SPACE && pMsgType->mainType == MSG_MMS_TYPE) err = MSG_ERR_MESSAGE_COUNT_FULL; } @@ -226,21 +223,21 @@ msg_error_t MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MES char sqlQuery[MAX_QUERY_LEN+1]; memset(sqlQuery, 0x00, sizeof(sqlQuery)); - if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_WAP_SI_SMS ||pMsgType->subType == MSG_WAP_SL_SMS)) { // PUSH + if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_WAP_SI_SMS ||pMsgType->subType == MSG_WAP_SL_SMS)) { /* PUSH */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d) AND FOLDER_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_INBOX_ID); - } else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_CB_SMS)) { // CB + } else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_CB_SMS)) { /* CB */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d) AND FOLDER_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_CB_SMS, MSG_CBMSGBOX_ID); - } else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_SYNCML_CP)) { // Provision + } else if ((pMsgType->mainType == MSG_SMS_TYPE) && (pMsgType->subType == MSG_SYNCML_CP)) { /* Provision */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d) AND FOLDER_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SYNCML_CP, MSG_INBOX_ID); - } else if ((pMsgType->mainType == MSG_SMS_TYPE)) { // SMS + } else if ((pMsgType->mainType == MSG_SMS_TYPE)) { /* SMS */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE NOT IN (%d, %d, %d, %d) AND FOLDER_ID = %d;", - MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_CB_SMS, MSG_SYNCML_CP, MSG_INBOX_ID); // etc SMS + MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_WAP_SI_SMS, MSG_WAP_SL_SMS, MSG_CB_SMS, MSG_SYNCML_CP, MSG_INBOX_ID); /* etc SMS */ } else if ((pMsgType->mainType == MSG_MMS_TYPE) && (pMsgType->subType == MSG_SENDREQ_MMS || pMsgType->subType == MSG_SENDCONF_MMS || pMsgType->subType == MSG_RETRIEVE_AUTOCONF_MMS || - pMsgType->subType == MSG_RETRIEVE_MANUALCONF_MMS || pMsgType->subType == MSG_NOTIFICATIONIND_MMS)) { // MMS + pMsgType->subType == MSG_RETRIEVE_MANUALCONF_MMS || pMsgType->subType == MSG_NOTIFICATIONIND_MMS)) { /* MMS */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT COUNT(MSG_ID) FROM %s WHERE MAIN_TYPE = %d AND SUB_TYPE IN (%d, %d, %d, %d, %d) AND FOLDER_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, pMsgType->mainType, MSG_SENDREQ_MMS, MSG_SENDCONF_MMS, MSG_RETRIEVE_AUTOCONF_MMS, MSG_RETRIEVE_MANUALCONF_MMS, MSG_NOTIFICATIONIND_MMS, folderId); } else { @@ -266,10 +263,9 @@ msg_error_t MsgStoCountMsgByLimitCategory(MsgDbHandler *pDbHandle, const MSG_MES int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t folderId) { int msgboxType = -1; - int msgType= -1; + int msgType = -1; - switch (folderId) - { + switch (folderId) { case MSG_INBOX_ID : msgboxType = MSG_COUNT_LIMIT_INBOX_TYPE; break; @@ -295,8 +291,7 @@ int MsgStoCheckMsgCntLimit(const MSG_MESSAGE_TYPE_S* pMsgType, msg_folder_id_t f return -1; } - switch (pMsgType->subType) - { + switch (pMsgType->subType) { case MSG_NORMAL_SMS: case MSG_REPLACE_TYPE1_SMS: case MSG_REPLACE_TYPE2_SMS: @@ -371,12 +366,11 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * char sqlQuery[MAX_QUERY_LEN+1]; - // Check if new address or not + /* Check if new address or not */ if (MsgExistAddress(pDbHandle, pMsg, pConvId) == true) { MSG_DEBUG("The address already exists. Conversation ID : [%d]", *pConvId); MsgStoUpdateAddress(pDbHandle, pMsg, *pConvId); } else { - *pConvId = 0; if (pMsg->threadId) @@ -390,16 +384,17 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * } /* insert address in loop */ - for (int i=0; inAddressCnt; i++) { - + for (int i = 0; i < pMsg->nAddressCnt; i++) { unsigned int addrId; MSG_CONTACT_INFO_S contactInfo; memset(&contactInfo, 0x00, sizeof(MSG_CONTACT_INFO_S)); - // Get Contact Info -// if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) { -// MSG_DEBUG("MsgGetContactInfo() fail."); -// } + /* Get Contact Info */ +#if 0 + if (MsgGetContactInfo(&(pMsg->addressList[i]), &contactInfo) != MSG_SUCCESS) { + MSG_DEBUG("MsgGetContactInfo() fail."); + } +#endif err = pDbHandle->getRowId(MSGFW_ADDRESS_TABLE_NAME, &addrId); if (err != MSG_SUCCESS) { @@ -407,7 +402,7 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * return err; } - // Add Address + /* Add Address */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, '%s', %d, %d, ?, ?, ?, ?, ?, '%s', 0);", MSGFW_ADDRESS_TABLE_NAME, addrId, *pConvId, pMsg->addressList[i].addressType, pMsg->addressList[i].recipientType, pMsg->addressList[i].addressVal, @@ -433,7 +428,7 @@ msg_error_t MsgStoAddAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S * } } - // set conversation display name by conv id + /* set conversation display name by conv id */ MsgStoSetConversationDisplayName(pDbHandle, *pConvId); return err; @@ -600,7 +595,7 @@ msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t co memset(pTmp->data, 0x00, sizeof(MSG_ADDRESS_INFO_S)); } -// rowCnt = (rowCnt > 10)? MAX_TO_ADDRESS_CNT: rowCnt; +/* rowCnt = (rowCnt > 10)? MAX_TO_ADDRESS_CNT: rowCnt; */ for (int i = 0; i < rowCnt; i++) { pTmp = (msg_struct_s *)pAddrlist->msg_struct_info[i]; @@ -611,7 +606,6 @@ msg_error_t MsgStoGetAddressByConvId(MsgDbHandler *pDbHandle, msg_thread_id_t co pDbHandle->getColumnToString(index++, MAX_ADDRESS_VAL_LEN, pAddr->addressVal); strncpy(pAddr->displayName, pAddr->addressVal, MAX_DISPLAY_NAME_LEN); - } pDbHandle->freeTable(); @@ -688,9 +682,9 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co int msg_direction = pDbHandle->columnInt(2); time_t disp_time = (time_t)pDbHandle->columnInt(3); int subject_length = pDbHandle->columnInt(4); - char subject[MAX_SUBJECT_LEN+1] = {0,}; + char subject[MAX_SUBJECT_LEN+1] = {0, }; snprintf(subject, sizeof(subject), "%s", pDbHandle->columnText(5)); - char msg_text[MAX_MSG_TEXT_LEN+1] = {0,}; + char msg_text[MAX_MSG_TEXT_LEN+1] = {0, }; snprintf(msg_text, sizeof(msg_text), "%s", pDbHandle->columnText(6)); pDbHandle->finalizeQuery(); @@ -809,7 +803,7 @@ msg_error_t MsgStoUpdateConversation(MsgDbHandler *pDbHandle, msg_thread_id_t co } pDbHandle->bindText(subject, 1); - pDbHandle->bindText(msg_text,2); + pDbHandle->bindText(msg_text, 2); if (pDbHandle->stepQuery() != MSG_ERR_DB_DONE) { MSG_DEBUG("stepQuery() Failed"); @@ -919,7 +913,6 @@ bool MsgExistAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, ms snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize, " OR "); } else { - tmpSize = strlen(sqlQuery); snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize, "ADDRESS_VAL LIKE '%s' ", @@ -929,7 +922,6 @@ bool MsgExistAddress(MsgDbHandler *pDbHandle, const MSG_MESSAGE_INFO_S *pMsg, ms tmpSize = strlen(sqlQuery); snprintf(sqlQuery+tmpSize, MAX_QUERY_LEN-tmpSize, " OR "); - } } @@ -1124,7 +1116,7 @@ msg_error_t MsgStoAddConversation(MsgDbHandler *pDbHandle, msg_thread_id_t *pCon return MSG_ERR_DB_EXEC; } } - // Add Conversation + /* Add Conversation */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, 0, 0, 0, 0, 0, 0, 0, '', '');", MSGFW_CONVERSATION_TABLE_NAME, *pConvId); @@ -1159,24 +1151,22 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, int contac return err; } - //contacts-service is not used for gear + /*contacts-service is not used for gear */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED int order = MsgGetContactNameOrder(); -#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#else /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ int order = 0; -#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ msg_struct_s *pAddrInfo = NULL; MSG_ADDRESS_INFO_S *address = NULL; - for (int i = 1; i <= rowCnt; i++) - { + for (int i = 1; i <= rowCnt; i++) { memset(displayName, 0x00, sizeof(displayName)); MsgDbHandler tmpDbHandle; - msg_struct_list_s addressList = {0,}; + msg_struct_list_s addressList = {0, }; MsgStoGetAddressByConvId(&tmpDbHandle, (msg_thread_id_t)pDbHandle->getColumnToInt(i), order, &addressList); - for (int j = 0; j < addressList.nCount; j++) - { + for (int j = 0; j < addressList.nCount; j++) { if (j >0) strncat(displayName, ", ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); @@ -1210,7 +1200,7 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, int contac pDbHandle->finalizeQuery(); - // free address list + /* free address list */ for (int j = 0; j < addressList.nCount; j++) { msg_struct_s *pStruct = (msg_struct_s *)addressList.msg_struct_info[j]; delete (MSG_ADDRESS_INFO_S *)pStruct->data; @@ -1235,14 +1225,14 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread char displayName[MAX_DISPLAY_NAME_LEN+1]; char sqlQuery[MAX_QUERY_LEN+1]; - msg_struct_list_s addressList = {0,}; + msg_struct_list_s addressList = {0, }; - //contacts-service is not used for gear + /* contacts-service is not used for gear */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED int order = MsgGetContactNameOrder(); -#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#else /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ int order = 0; -#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ msg_struct_s *pAddrInfo = NULL; MSG_ADDRESS_INFO_S *address = NULL; @@ -1251,8 +1241,7 @@ msg_error_t MsgStoSetConversationDisplayName(MsgDbHandler *pDbHandle, msg_thread MsgStoGetAddressByConvId(pDbHandle, convId, order, &addressList); - for (int j = 0; j < addressList.nCount; j++) - { + for (int j = 0; j < addressList.nCount; j++) { if (j >0) strncat(displayName, ", ", MAX_DISPLAY_NAME_LEN-strlen(displayName)); @@ -1334,8 +1323,7 @@ bool MsgExistConversation(MsgDbHandler *pDbHandle, msg_thread_id_t convId) if (err == MSG_ERR_DB_NORECORD) { pDbHandle->freeTable(); return false; - } - else if ( err != MSG_SUCCESS) { + } else if (err != MSG_SUCCESS) { pDbHandle->freeTable(); return false; } @@ -1361,7 +1349,7 @@ bool MsgExistMessage(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg) err = pDbHandle->getTable(sqlQuery, &rowCnt, NULL); - if ( err != MSG_SUCCESS) { + if (err != MSG_SUCCESS) { pDbHandle->freeTable(); return false; } @@ -1396,7 +1384,6 @@ bool MsgExistAddress(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg, msg_thr "SELECT ADDRESS_ID FROM %s WHERE ADDRESS_VAL LIKE '%%%%%s' AND CONV_ID= %d;", MSGFW_ADDRESS_TABLE_NAME, newPhoneNum, convId); } else { - snprintf(sqlQuery, sizeof(sqlQuery), "SELECT ADDRESS_ID FROM %s WHERE ADDRESS_VAL = '%s' AND CONV_ID= %d;", MSGFW_ADDRESS_TABLE_NAME, pMsg->addressList[index].addressVal, convId); @@ -1408,7 +1395,7 @@ bool MsgExistAddress(MsgDbHandler *pDbHandle, MSG_MESSAGE_INFO_S *pMsg, msg_thr pDbHandle->freeTable(); return false; } - else if ( err != MSG_SUCCESS) { + else if (err != MSG_SUCCESS) { pDbHandle->freeTable(); return false; } @@ -1458,7 +1445,7 @@ msg_error_t MsgStoAddCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pC #ifndef FEATURE_SMS_CDMA MSG_BEGIN(); - char sqlQuery[MAX_QUERY_LEN] = {0,}; + char sqlQuery[MAX_QUERY_LEN] = {0, }; pDbHandle->beginTrans(); @@ -1503,7 +1490,7 @@ msg_error_t MsgStoAddCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pC #else /* TODO: Add multisim for CDMA */ MSG_BEGIN(); - char sqlQuery[MAX_QUERY_LEN] = {0,}; + char sqlQuery[MAX_QUERY_LEN] = {0, }; pDbHandle->beginTrans(); @@ -1543,7 +1530,7 @@ msg_error_t MsgStoGetCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pC int rowCnt = 0, index = 0; - char sqlQuery[MAX_QUERY_LEN] = {0,}; + char sqlQuery[MAX_QUERY_LEN] = {0, }; memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CHANNEL_ACTIVATION, CHANNEL_FROM, CHANNEL_TO, CHANNEL_NAME FROM %s WHERE SIM_INDEX = %d;", MSGFW_CB_CHANNEL_INFO_TABLE_NAME, simIndex); @@ -1583,7 +1570,7 @@ msg_error_t MsgStoGetCBChannelInfo(MsgDbHandler *pDbHandle, MSG_CB_CHANNEL_S *pC int rowCnt = 0, index = 0; - char sqlQuery[MAX_QUERY_LEN] = {0,}; + char sqlQuery[MAX_QUERY_LEN] = {0, }; memset(sqlQuery, 0x00, sizeof(sqlQuery)); snprintf(sqlQuery, sizeof(sqlQuery), "SELECT CHANNEL_ACTIVATION, CHANNEL_CATEGORY, CHANNEL_LANGUAGE, CHANNEL_NAME FROM %s;", MSGFW_CDMA_CB_CHANNEL_INFO_TABLE_NAME); @@ -1734,9 +1721,9 @@ msg_error_t MsgStoGetConversationPreview(MsgDbHandler *pDbHandle, MSG_CONVERSATI if (pConv == NULL) return MSG_ERR_NULL_POINTER; - pConv->tcs_bc_level = -1; //init + pConv->tcs_bc_level = -1; /* init */ - //(MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER) + /*(MSG_ID INTEGER, TYPE INTEGER, VALUE TEXT, COUNT INTEGER) */ snprintf(sqlQuery, sizeof(sqlQuery), "SELECT TYPE, VALUE, COUNT " "FROM %s WHERE MSG_ID=%d;", @@ -1796,7 +1783,6 @@ msg_error_t MsgStoGetConversationMultipart(MsgDbHandler *pDbHandle, MSG_CONVERSA if (err == MSG_SUCCESS) { GList *multipart_list = NULL; for (int i = 0; i < rowCnt; i++) { - msg_struct_s *multipart_struct_s = new msg_struct_s; multipart_struct_s->type = MSG_STRUCT_MULTIPART_INFO; multipart_struct_s->data = new MMS_MULTIPART_DATA_S; @@ -1837,7 +1823,7 @@ msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATI snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MSG_ID, CONV_ID, FOLDER_ID, STORAGE_ID, MAIN_TYPE, SUB_TYPE, \ DISPLAY_TIME, DATA_SIZE, NETWORK_STATUS, READ_STATUS, PROTECTED, \ MSG_DIRECTION, SCHEDULED_TIME, SUBJECT, MSG_TEXT, ATTACHMENT_COUNT, SIM_INDEX\ - FROM %s WHERE MSG_ID=%d;", + FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId); msg_error_t err = dbHandle->getTable(sqlQuery, &rowCnt, &index); @@ -1871,8 +1857,8 @@ msg_error_t MsgStoGetConversationViewItem(msg_message_id_t msgId, MSG_CONVERSATI dbHandle->getColumnToString(index++, MAX_SUBJECT_LEN, pConv->subject); char *tmpText = g_strdup(dbHandle->getColumnToString(index++)); - //It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview - //pConv->attachCount = dbHandle->getColumnToInt(index++); + /*It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview */ + /*pConv->attachCount = dbHandle->getColumnToInt(index++); */ index++; pConv->simIndex = dbHandle->getColumnToInt(index++); @@ -1991,13 +1977,13 @@ msg_error_t MsgStoGetConversationViewList(msg_thread_id_t threadId, msg_struct_l pTmp->bRead = dbHandle->getColumnToInt(index++); pTmp->bProtected = dbHandle->getColumnToInt(index++); pTmp->direction = dbHandle->getColumnToInt(index++); - index++; // This field is reserved. + index++; /* This field is reserved. */ dbHandle->getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); tmpText[i] = g_strdup(dbHandle->getColumnToString(index++)); - //It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview - //pTmp->attachCount = dbHandle->getColumnToInt(index++); + /*It does Not need to Get attach count in MSG_MESSAGE_TABLE. see MsgStoGetConversationPreview */ + /*pTmp->attachCount = dbHandle->getColumnToInt(index++); */ index++; pTmp->simIndex = dbHandle->getColumnToInt(index++); } @@ -2051,7 +2037,7 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT dbHandle->connectReadOnly(); char *escapeAddressStr = NULL; - // Clear Out Parameter + /* Clear Out Parameter */ pThreadViewList->nCount = 0; pThreadViewList->msg_struct_info = NULL; @@ -2062,7 +2048,7 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT char sqlQuery[MAX_QUERY_LEN+1]; - // Search - Address, Name + /* Search - Address, Name */ memset(sqlQuery, 0x00, MAX_QUERY_LEN+1); snprintf(sqlQuery, MAX_QUERY_LEN, "SELECT A.CONV_ID, A.UNREAD_CNT, A.SMS_CNT, A.MMS_CNT, A.DISPLAY_NAME, " "A.MAIN_TYPE, A.SUB_TYPE, A.MSG_DIRECTION, A.DISPLAY_TIME, A.MSG_TEXT, " @@ -2104,9 +2090,9 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT MsgConvertStrWithEscape(pSearchString, &escapeAddressStr); MSG_DEBUG("escapeAddressStr [%s]", escapeAddressStr); dbHandle->bindText(escapeAddressStr, 1); - //dbHandle->bindText(escapeAddressStr, 2); - //dbHandle->bindText(escapeAddressStr, 3); - //dbHandle->bindText(escapeAddressStr, 4); + /*dbHandle->bindText(escapeAddressStr, 2); */ + /*dbHandle->bindText(escapeAddressStr, 3); */ + /*dbHandle->bindText(escapeAddressStr, 4); */ while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { memset(&threadView, 0x00, sizeof(threadView)); @@ -2152,7 +2138,6 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT IdList.insert(threadView.threadId); searchList.push(threadView); } - } dbHandle->finalizeQuery(); @@ -2163,7 +2148,7 @@ msg_error_t MsgStoSearchMessage(const char *pSearchString, msg_struct_list_s *pT } - // Add data to Out Parameter + /* Add data to Out Parameter */ pThreadViewList->nCount = searchList.size(); pThreadViewList->msg_struct_info = (msg_struct_t *)calloc(searchList.size(), sizeof(msg_struct_t)); if (pThreadViewList->msg_struct_info == NULL) @@ -2200,7 +2185,7 @@ msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pReje MsgDbHandler *dbHandle = getDbHandle(); dbHandle->connectReadOnly(); - // Clear Out Parameter + /* Clear Out Parameter */ pRejectMsgList->nCount = 0; pRejectMsgList->msg_struct_info = NULL; @@ -2208,7 +2193,7 @@ msg_error_t MsgStoGetRejectMsgList(const char *pNumber, msg_struct_list_s *pReje char sqlQuery[MAX_QUERY_LEN+1]; - // Search Reject Msg + /* Search Reject Msg */ memset(sqlQuery, 0x00, sizeof(sqlQuery)); if (pNumber != NULL) { @@ -2295,12 +2280,12 @@ msg_error_t MsgStoGetAddressList(const msg_thread_id_t threadId, msg_struct_list msg_error_t err = MSG_SUCCESS; - //contacts-service is not used for gear + /* contacts-service is not used for gear */ #ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED int order = MsgGetContactNameOrder(); -#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#else /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ int order = 0; -#endif // MSG_CONTACTS_SERVICE_NOT_SUPPORTED +#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */ err = MsgStoGetAddressByConvId(dbHandle, threadId, order, pAddrList); @@ -2314,7 +2299,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru MsgDbHandler *dbHandle = getDbHandle(); dbHandle->connectReadOnly(); - // Clear Out Parameter + /* Clear Out Parameter */ pMsgList->nCount = 0; pMsgList->msg_struct_info = NULL; @@ -2367,8 +2352,8 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru if (pListCond->pTextVal != NULL && multipartCnt > 0) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s C, %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND " - ,MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); + snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "FROM %s C, %s B, %s A WHERE A.CONV_ID > 0 AND A.CONV_ID = B.CONV_ID AND ", + MSGFW_MMS_MULTIPART_TABLE_NAME, MSGFW_ADDRESS_TABLE_NAME, MSGFW_MESSAGE_TABLE_NAME); } else { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); @@ -2378,7 +2363,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - //// folder + /* folder */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); if (pListCond->folderId == MSG_ALLBOX_ID) @@ -2391,7 +2376,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - //// thread + /* thread */ if (pListCond->threadId > 0) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.CONV_ID = %d ", pListCond->threadId); @@ -2399,7 +2384,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } - //// msg type + /* msg type */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); switch (pListCond->msgType) { @@ -2433,7 +2418,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - //// storage + /* storage */ if (pListCond->storageId > MSG_STORAGE_UNKNOWN) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.STORAGE_ID = %d ", pListCond->storageId); @@ -2441,7 +2426,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } - //// protected + /* protected */ if (pListCond->bProtected) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.PROTECTED = %d ", pListCond->bProtected); @@ -2449,7 +2434,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } - //// scheduled + /* scheduled */ if (pListCond->bScheduled) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.SCHEDULED_TIME > 0 "); @@ -2457,7 +2442,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } - //// sim index + /* sim index */ if (pListCond->simIndex > 0) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.SIM_INDEX = %d ", pListCond->simIndex); @@ -2465,7 +2450,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } - //// time range + /* time range */ if (pListCond->fromTime > 0) { memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND A.DISPLAY_TIME >= %u ", (unsigned int)pListCond->fromTime); @@ -2479,9 +2464,8 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } if (pListCond->pAddressVal == NULL) { - /// Text + /* Text */ if (pListCond->pTextVal != NULL) { - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); if (multipartCnt > 0) { snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), @@ -2494,12 +2478,10 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru MSGFW_DB_ESCAPE_CHAR, MSGFW_DB_ESCAPE_CHAR); } strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - } } else { - /// Text + /* Text */ if (pListCond->pTextVal != NULL) { - memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); if (multipartCnt > 0) { snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), @@ -2521,7 +2503,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - // Address + /* Address */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "(B.ADDRESS_VAL LIKE ? ESCAPE '%c' ", MSGFW_DB_ESCAPE_CHAR); @@ -2539,7 +2521,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), ")) "); strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); } else { - // Address + /* Address */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "AND (B.ADDRESS_VAL LIKE ? ESCAPE '%c' ", MSGFW_DB_ESCAPE_CHAR); @@ -2562,30 +2544,29 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru msg_struct_s *pSortRule = (msg_struct_s *)pListCond->sortRule; if (pSortRule->type != MSG_STRUCT_SORT_RULE) { - /// Order + /* Order */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.DISPLAY_TIME "); strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - /// Sorting type + /* Sorting type */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "DESC "); strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); } else { MSG_SORT_RULE_S *pTmp = (MSG_SORT_RULE_S *)pSortRule->data; - /// order // TODO: have to finish this + /* order : TODO: have to finish this */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); - switch (pTmp->sortType) - { - case MSG_SORT_BY_MSG_TYPE : + switch (pTmp->sortType) { + case MSG_SORT_BY_MSG_TYPE: snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.MAIN_TYPE "); break; - case MSG_SORT_BY_READ_STATUS : + case MSG_SORT_BY_READ_STATUS: snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.READ_STATUS "); break; - case MSG_SORT_BY_STORAGE_TYPE : + case MSG_SORT_BY_STORAGE_TYPE: snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ORDER BY A.STORAGE_ID "); break; default: @@ -2594,7 +2575,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - // Sorting type + /* Sorting type */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); if (pTmp->bAscending) snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "ASC "); @@ -2604,7 +2585,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); } - // offset & limit + /* offset & limit */ memset(sqlQuerySubset, 0x00, sizeof(sqlQuerySubset)); if (pListCond->offset >= 0 && pListCond->limit > 0) snprintf(sqlQuerySubset, sizeof(sqlQuerySubset), "LIMIT %d OFFSET %d;", pListCond->limit, pListCond->offset); @@ -2614,7 +2595,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncat(sqlQuery, sqlQuerySubset, MAX_QUERY_LEN-strlen(sqlQuery)); - //////// 'til here sqlQuery is complete. + /* 'til here sqlQuery is complete. */ queue searchList; @@ -2629,24 +2610,21 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru char *escapeAddressStr = NULL; if (pListCond->pAddressVal == NULL) { - /// Text + /* Text */ if (pListCond->pTextVal != NULL) { - MsgConvertStrWithEscape(pListCond->pTextVal, &escapeTextStr); MSG_DEBUG("escapeTextStr [%s]", escapeTextStr); dbHandle->bindText(escapeTextStr, 1); dbHandle->bindText(escapeTextStr, 2); if (multipartCnt > 0) dbHandle->bindText(escapeTextStr, 3); - } } else { - /// Text + /* Text */ if (pListCond->pTextVal != NULL) { - MsgConvertStrWithEscape(pListCond->pTextVal, &escapeTextStr); MSG_DEBUG("escapeTestStr [%s]", escapeTextStr); - // Address + /* Address */ MsgConvertStrWithEscape(pListCond->pAddressVal, &escapeAddressStr); MSG_DEBUG("escapeAddressStr [%s]", escapeAddressStr); @@ -2660,7 +2638,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru } } else { - // Address + /* Address */ MsgConvertStrWithEscape(pListCond->pAddressVal, &escapeAddressStr); MSG_DEBUG("escapeAddressStr [%s]", escapeAddressStr); dbHandle->bindText(escapeAddressStr, 1); @@ -2669,10 +2647,9 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru MSG_MESSAGE_HIDDEN_S *pTmp = NULL; - int lastMsgId = 0; // for comparing same msg id. + int lastMsgId = 0; /* for comparing same msg id. */ while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { - index = 0; int msgid = dbHandle->columnInt(index++); @@ -2685,8 +2662,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru pTmp = new MSG_MESSAGE_HIDDEN_S; - if(pTmp) - { + if(pTmp) { memset(pTmp, 0x00, sizeof(MSG_MESSAGE_HIDDEN_S)); pTmp->pData = NULL; @@ -2708,7 +2684,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru pTmp->bBackup = dbHandle->columnInt(index++); pTmp->priority = dbHandle->columnInt(index++); pTmp->direction = dbHandle->columnInt(index++); - index++; // This field is reserved. + index++; /* This field is reserved. */ strncpy(pTmp->subject, (char *)dbHandle->columnText(index++), MAX_SUBJECT_LEN); @@ -2756,7 +2732,7 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru strncpy(pAddr->displayName, pAddr->addressVal, MAX_DISPLAY_NAME_LEN); - // For GList *addressList + /* For GList *addressList */ msg_struct_s *addr_info_s = new msg_struct_s; memset(addr_info_s, 0x00, sizeof(msg_struct_s)); addr_info_s->type = MSG_STRUCT_ADDRESS_INFO; @@ -2773,7 +2749,6 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru pTmp->addressList = g_list_append(pTmp->addressList, addr_info_s); if (pTmp->addr_list->nCount >= MAX_TO_ADDRESS_CNT) { - delete pAddr; } else { @@ -2796,7 +2771,6 @@ msg_error_t MsgStoGetMessageList(const MSG_LIST_CONDITION_S *pListCond, msg_stru int offset = 0; while (!searchList.empty()) { - msg_struct_s *msg = new msg_struct_s; pMsgList->msg_struct_info[offset++] = (msg_struct_t)msg; @@ -2914,7 +2888,7 @@ msg_error_t MsgStoClearUniquenessTable() MsgDbHandler *dbHandle = getDbHandle(); - char sqlQuery[MAX_QUERY_LEN+1] = {0,}; + char sqlQuery[MAX_QUERY_LEN+1] = {0, }; snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = 0", MSGFW_UNIQUENESS_INFO_TABLE_NAME); err = dbHandle->execQuery(sqlQuery); diff --git a/utils/MsgVMessage.cpp b/utils/MsgVMessage.cpp index 141ed5e..f74c982 100755 --- a/utils/MsgVMessage.cpp +++ b/utils/MsgVMessage.cpp @@ -88,10 +88,10 @@ enum { enum { - // vMessage + /* vMessage */ VMSG_VALUE_NONE = 0, BEGIN_VMSG = 1, - VERSION_VMSG =2, + VERSION_VMSG = 2, BEGIN_VCARD = 3, VERSION_VCARD = 4, END_VCARD = 5, @@ -107,36 +107,36 @@ enum { TEL_VCARD_CELL = 14, DATE_VMSG = 15, - SUBJECT_VMSG =16 , + SUBJECT_VMSG = 16, FNAME_UTF8_VCARD = 17, NAME_UTF8_VCARD = 18, - // Encodings + /* Encodings */ VMSG_ATTR_ENCODING_QP = 19, VMSG_ATTR_ENCODING_BASE64_V21 = 20, VMSG_ATTR_ENCODING_BASE64_V30 = 21, - // Message type indication + /* Message type indication */ VMSG_INDICATION_MESSAGE_TYPE = 22, VMSG_INDICATION_MESSAGE_TYPE_INET = 23, VMSG_INDICATION_MESSAGE_TYPE_MSG = 24, - // Read status indication + /* Read status indication */ VMSG_INDICATION_READ_STATUS = 25, VMSG_INDICATION_READ_STATUS_READ = 26, VMSG_INDICATION_READ_STATUS_UNREAD = 27, - // Mailbox status indication + /* Mailbox status indication */ VMSG_INDICATION_MSG_BOX = 28, VMSG_INDICATION_MSG_BOX_SENT = 29, VMSG_INDICATION_MSG_BOX_INBOX = 30, VMSG_INDICATION_MSG_BOX_DRAFT = 31, - // Character set + /* Character set */ VMSG_ATTR_CHARSET_PROPERTY = 32, - // Language + /* Language */ VMSG_ATTR_LANGUAGE_PROPERTY = 33, VMSG_DATA_SEPARATOR = 34, @@ -148,7 +148,7 @@ enum { KEY_BODY = 39, KEY_DATE = 40, - //DECODER + /* DECODER */ VMSG_VCARD_TEL = 41, VMSG_MSG_BEGIN = 42, VMSG_MSG_END = 43, @@ -162,8 +162,7 @@ bool needCharset = false; static void __msgsvc_vmsg_initial(void) { if (NULL == *content_name) { - - // vMessage + /* vMessage */ content_name[BEGIN_VMSG] = "BEGIN:VMSG"; content_name[VERSION_VMSG] = "VERSION:1.1"; content_name[BEGIN_VCARD] = "BEGIN:VCARD"; @@ -186,31 +185,31 @@ static void __msgsvc_vmsg_initial(void) content_name[FNAME_UTF8_VCARD] = "FN;CHARSET=UTF-8:"; content_name[NAME_UTF8_VCARD] = "N;CHARSET=UTF-8:"; - // Encodings + /* Encodings */ content_name[VMSG_ATTR_ENCODING_QP] = "ENCODING=QUOTED-PRINTABLE"; content_name[VMSG_ATTR_ENCODING_BASE64_V21] = "ENCODING=BASE64"; content_name[VMSG_ATTR_ENCODING_BASE64_V30] = "ENCODING=b"; - // Message type indication + /* Message type indication */ content_name[VMSG_INDICATION_MESSAGE_TYPE] = "X-IRMC-TYPE"; content_name[VMSG_INDICATION_MESSAGE_TYPE_INET] = "INET"; content_name[VMSG_INDICATION_MESSAGE_TYPE_MSG] = "MSG"; - // Read status indication + /* Read status indication */ content_name[VMSG_INDICATION_READ_STATUS] = "X-IRMC-STATUS"; content_name[VMSG_INDICATION_READ_STATUS_READ] = "READ"; content_name[VMSG_INDICATION_READ_STATUS_UNREAD] = "UNREAD"; - // Mailbox status indication + /* Mailbox status indication */ content_name[VMSG_INDICATION_MSG_BOX] = "X-IRMC-BOX"; content_name[VMSG_INDICATION_MSG_BOX_SENT] = "SENT"; content_name[VMSG_INDICATION_MSG_BOX_INBOX] = "INBOX"; content_name[VMSG_INDICATION_MSG_BOX_DRAFT] = "DRAFT"; - // Character set + /* Character set */ content_name[VMSG_ATTR_CHARSET_PROPERTY] = "CHARSET"; - // Language + /* Language */ content_name[VMSG_ATTR_LANGUAGE_PROPERTY] = "LANGUAGE"; content_name[VMSG_DATA_SEPARATOR] = ":"; @@ -271,7 +270,7 @@ static int __msgsvc_vmsg_append_str(char **buf, int *buf_size, int len, const ch *r = '\\'; r++; str_len++; - if (*buf_sizepTop == NULL)\ @@ -414,7 +413,7 @@ pMessage->pCur = pObject; #define INSERT_VBODY_OBJ pObject = (VObject*)calloc(1, sizeof(VObject)); \ if ( !pObject )\ {\ - vmsg_free_vtree_memory( pMessage );\ + vmsg_free_vtree_memory(pMessage);\ return false;\ }\ if (pBody->pTop == NULL)\ @@ -431,7 +430,7 @@ pBody->pCur = pObject; #define INSERT_VCARD_OBJ pObject = (VObject*)calloc(1, sizeof(VObject)); \ if ( !pObject )\ {\ - vmsg_free_vtree_memory( pMessage );\ + vmsg_free_vtree_memory(pMessage);\ return false;\ }\ if (pCard->pTop == NULL)\ @@ -448,7 +447,7 @@ pCard->pCur = pObject; #define INSERT_PARAM param = (VParam*)calloc(1, sizeof(VParam));\ if (!param)\ {\ - vmsg_free_vtree_memory( pMessage );\ + vmsg_free_vtree_memory(pMessage);\ if (pObject != NULL)\ {\ free(pObject);\ @@ -479,7 +478,6 @@ char* _convert_tm_to_vdata_str(const struct tm * tm) bool _convert_vdata_str_to_tm(const char* szText, struct tm * tm) { - if (szText == NULL) return false; if (strlen(szText) < 15) return false; if (szText[8] != 'T') return false; @@ -487,7 +485,7 @@ bool _convert_vdata_str_to_tm(const char* szText, struct tm * tm) char szBuff[8]={0}; memset(tm, 0, sizeof(struct tm)); - // year, month, day + /* year, month, day */ memcpy(szBuff, &(szText[0]), 4); szBuff[4] = '\0'; tm->tm_year = atol(szBuff) - 1900; @@ -506,7 +504,7 @@ bool _convert_vdata_str_to_tm(const char* szText, struct tm * tm) if ((tm->tm_mday > 31) || (tm->tm_mday < 1)) tm->tm_mday = 31; - // hour, minute, second + /* hour, minute, second */ memcpy(szBuff, &(szText[9]), 2); szBuff[2] = '\0'; tm->tm_hour = atol(szBuff); @@ -546,62 +544,61 @@ int msgsvc_check_utf8(char c) return MSG_ERR_INVALID_PARAMETER; } -char* __msgsvc_vmsg_convert_tm_to_vdata_str( struct tm * tm) +char* __msgsvc_vmsg_convert_tm_to_vdata_str(struct tm * tm) { char str[22] = {0, }; char APM[3] = {0, }; char month[15] = {0, }; int mon = 0; int hour = 0; - mon = tm->tm_mon +1; + mon = tm->tm_mon + 1; if (tm->tm_hour >= 12) - strcpy(APM,"PM"); + strcpy(APM, "PM"); else - strcpy(APM,"AM"); + strcpy(APM, "AM"); if (tm->tm_hour > 12) hour = tm->tm_hour - 12; else hour = tm->tm_hour; - switch(mon) - { + switch(mon) { case 1: - strcpy(month,"Jan"); + strcpy(month, "Jan"); break; case 2: - strcpy(month,"Feb"); + strcpy(month, "Feb"); break; case 3: - strcpy(month,"Mar"); + strcpy(month, "Mar"); break; case 4: - strcpy(month,"Apr"); + strcpy(month, "Apr"); break; case 5: - strcpy(month,"May"); + strcpy(month, "May"); break; case 6: - strcpy(month,"Jun"); + strcpy(month, "Jun"); break; case 7: - strcpy(month,"Jul"); + strcpy(month, "Jul"); break; case 8: - strcpy(month,"Aug"); + strcpy(month, "Aug"); break; case 9: - strcpy(month,"Sep"); + strcpy(month, "Sep"); break; case 10: - strcpy(month,"Oct"); + strcpy(month, "Oct"); break; case 11: - strcpy(month,"Nov"); + strcpy(month, "Nov"); break; case 12: - strcpy(month,"Dec"); + strcpy(month, "Dec"); break; default: MSG_DEBUG("invalid month number"); @@ -728,8 +725,7 @@ static inline int __msgsvc_vmsg_append_box_type(MSG_MESSAGE_INFO_S *pMsg, char * { MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_INDICATION_MSG_BOX]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_DATA_SEPARATOR]); - switch(pMsg->folderId) - { + switch(pMsg->folderId) { case MSG_INBOX_ID: MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_INDICATION_MSG_BOX_INBOX]); @@ -742,7 +738,7 @@ static inline int __msgsvc_vmsg_append_box_type(MSG_MESSAGE_INFO_S *pMsg, char * MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_INDICATION_MSG_BOX_DRAFT]); break; default: - // Discard User Defined, outbox or Spam folder's messages. + /* Discard User Defined, outbox or Spam folder's messages. */ MSG_DEBUG("Invalid or unhandled msg box"); } MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); @@ -751,7 +747,7 @@ static inline int __msgsvc_vmsg_append_box_type(MSG_MESSAGE_INFO_S *pMsg, char * static inline int __msgsvc_vmsg_append_msg_type(MSG_MESSAGE_INFO_S *pMsg, char **buf, int *buf_size, int len) { - //TO DO check with msg text contains Only PrintableAscii if true then else handle INET_TYPE + /* TO DO check with msg text contains Only PrintableAscii if true then else handle INET_TYPE */ MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_INDICATION_MESSAGE_TYPE]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_DATA_SEPARATOR]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_INDICATION_MESSAGE_TYPE_MSG]); @@ -772,7 +768,7 @@ static inline int __msgsvc_vmsg_append_origin_address_vcard(MSG_MESSAGE_INFO_S * strcpy(originAddress, pMsg->addressList[0].addressVal); } - needCharset = true; //as per android + needCharset = true; /* as per android */ if (strlen(originAddress) > 0) { MSG_CONTACT_INFO_S contactInfo; @@ -820,16 +816,14 @@ static inline int __msgsvc_vmsg_append_origin_address_vcard(MSG_MESSAGE_INFO_S * static inline int __msgsvc_vmsg_append_recipient_address_vcard(MSG_MESSAGE_INFO_S *pMsg, char **buf, int *buf_size, int len) { - //To do MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[BEGIN_VCARD]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VERSION_VCARD]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); - needCharset = true; //as per android + needCharset = true; /* as per android */ - for(int i = 0; i < pMsg->nAddressCnt; ++i) - { + for (int i = 0; i < pMsg->nAddressCnt; ++i) { char originAddress[MAX_ADDRESS_VAL_LEN + 1] = {0, }; bool isDisplayName = false; @@ -892,7 +886,7 @@ static inline int __msgsvc_vmsg_append_msg_body(MSG_MESSAGE_INFO_S *pMsg, char * MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[BEGIN_VBODY]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); - //Date: + /* Date: */ tzset(); localtime_r(&(pMsg->displayTime), &display_time); char *msgDate = __msgsvc_vmsg_convert_tm_to_vdata_str(&display_time); @@ -905,7 +899,7 @@ static inline int __msgsvc_vmsg_append_msg_body(MSG_MESSAGE_INFO_S *pMsg, char * g_free(msgDate); } - //Subject: + /* Subject: */ if (pMsg->subject[0] != '\0') { MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_BODY_PROPERTY_SUBJECT]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[VMSG_DATA_SEPARATOR]); @@ -913,13 +907,10 @@ static inline int __msgsvc_vmsg_append_msg_body(MSG_MESSAGE_INFO_S *pMsg, char * MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); } - //body: - if(pMsg->msgType.mainType == MSG_SMS_TYPE) - { - if(pMsg->msgType.subType == MSG_NORMAL_SMS) - { - if (pMsg->bTextSms == false) - { + /* body: */ + if(pMsg->msgType.mainType == MSG_SMS_TYPE) { + if(pMsg->msgType.subType == MSG_NORMAL_SMS) { + if (pMsg->bTextSms == false) { char* pFileData = NULL; unique_ptr buff(&pFileData, unique_ptr_deleter); @@ -931,12 +922,10 @@ static inline int __msgsvc_vmsg_append_msg_body(MSG_MESSAGE_INFO_S *pMsg, char * msgText = (char *)calloc(1, fileSize); memcpy(msgText, pFileData, fileSize); - MSGSVC_VMSG_APPEND_STR_FREE(buf,buf_size, len, msgText); + MSGSVC_VMSG_APPEND_STR_FREE(buf, buf_size, len, msgText); g_free(msgText); - } - else - { - MSGSVC_VMSG_APPEND_STR(buf,buf_size, len, pMsg->msgText); + } else { + MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, pMsg->msgText); } } } @@ -953,7 +942,6 @@ static inline int __msgsvc_vmsg_append_msg_body(MSG_MESSAGE_INFO_S *pMsg, char * static inline int __msgsvc_vmsg_append_msg_envelope(MSG_MESSAGE_INFO_S *pMsg, char **buf, int *buf_size, int len) { - MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, content_name[BEGIN_VENV]); MSGSVC_VMSG_APPEND_STR(buf, buf_size, len, MSGSVC_CRLF); @@ -996,18 +984,18 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) VParam* param = NULL; VTree * pBody = NULL; VTree * pCard = NULL; - VTree * pCurrent= NULL; + VTree * pCurrent = NULL; struct tm display_time; char* encoded_data = NULL; VTree* pMessage = NULL; - //to encode sms + /* to encode sms */ if (pMsg->msgType.mainType == MSG_SMS_TYPE && pMsg->msgType.subType == MSG_NORMAL_SMS) { return MsgVMessageEncodeSMS(pMsg); } - //to encode mms + /* to encode mms */ if (pMessage == NULL) { pMessage = (VTree *)malloc(sizeof(VTree)); if (!pMessage) { @@ -1017,11 +1005,10 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pMessage->pTop = NULL; pMessage->pCur = NULL; pMessage->pNext = NULL; - } pCurrent = pMessage; - //Insert VObject (X-MESSAGE-TYPE) to VMessage tree + /* Insert VObject (X-MESSAGE-TYPE) to VMessage tree */ INSERT_VMSG_OBJ; pObject->property = VMSG_TYPE_MSGTYPE; @@ -1029,7 +1016,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) if (pMsg->msgType.mainType == MSG_MMS_TYPE && (pMsg->msgType.subType == MSG_SENDREQ_MMS || pMsg->msgType.subType == MSG_SENDCONF_MMS)) pObject->pszValue[0] = strdup("MMS SEND"); #if 0 - else if(pMsg->msgType.mainType == MSG_MMS_TYPE && pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) + else if (pMsg->msgType.mainType == MSG_MMS_TYPE && pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) pObject->pszValue[0] = strdup("MMS NOTIFICATION"); #endif @@ -1042,13 +1029,12 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pObject->valueCount = 1; - //Insert VObject (X-IRMC-BOX) to VMessate tree + /* Insert VObject (X-IRMC-BOX) to VMessate tree */ INSERT_VMSG_OBJ; pObject->property = VMSG_TYPE_MSGBOX; - switch(pMsg->folderId) - { + switch(pMsg->folderId) { case MSG_INBOX_ID: pObject->pszValue[0] = strdup("INBOX"); break; @@ -1062,13 +1048,13 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pObject->pszValue[0] = strdup("DRAFTBOX"); break; default: - // Discard User Defined or Spam folder's messages. + /* Discard User Defined or Spam folder's messages. */ goto __CATCH_FAIL__; } pObject->valueCount = 1; - //Insert VObject (X-SS-DT) to VMessage tree + /* Insert VObject (X-SS-DT) to VMessage tree */ INSERT_VMSG_OBJ; pObject->property = VMSG_TYPE_DATE; @@ -1078,7 +1064,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pObject->valueCount = 1; - //Insert Vobject read status to VMessage tree + /* Insert Vobject read status to VMessage tree */ INSERT_VMSG_OBJ; pObject->property = VMSG_TYPE_STATUS; @@ -1091,7 +1077,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pObject->valueCount = 1; - //Insert VBody tree for message body; + /* Insert VBody tree for message body; */ pBody = (VTree*)calloc(1, sizeof(VTree)); if ( !pBody ) goto __CATCH_FAIL__; @@ -1103,30 +1089,28 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) pCurrent = pBody; if (strlen(pMsg->subject) > 0) { - //Insert Subject object + /* Insert Subject object */ INSERT_VBODY_OBJ; pObject->property = VMSG_TYPE_SUBJECT; pObject->pszValue[0] = strdup(pMsg->subject); pObject->valueCount = 1; } - //Insert VBody object + /* Insert VBody object */ INSERT_VBODY_OBJ; pObject->property = VMSG_TYPE_BODY; if (pMsg->msgType.mainType == MSG_MMS_TYPE) { - //Insert VBody for mms raw data; + /* Insert VBody for mms raw data; */ char* pFileData = NULL; unique_ptr buf(&pFileData, unique_ptr_deleter); MMS_DATA_S *pMmsData = NULL; int fileSize = 0; char* msgText = NULL; #if 0 - char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; + char filePath[MSG_FILEPATH_LEN_MAX] = {0, }; if(pMsg->msgType.subType == MSG_NOTIFICATIONIND_MMS) pFileData = MsgOpenAndReadMmsFile(pMsg->msgData, 0, -1, &fileSize); - - else - { + else { err = MsgStoGetMmsRawFilePath(pDbHandle, pMsg->msgId, filePath); if (err != MSG_SUCCESS) @@ -1138,7 +1122,6 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) if (pMsg->bTextSms == false) { if (MsgOpenAndReadFile(pMsg->msgData, &pFileData, &fileSize) == false) { - //CID 16205: Memory leak in case of failure goto __CATCH_FAIL__; } } else { @@ -1158,7 +1141,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) int serializedDataSize = 0; if (pMmsData) { - MsgMmsSetMultipartListData(pMmsData);//app file -> data + MsgMmsSetMultipartListData(pMmsData); /* app file -> data */ serializedDataSize = MsgSerializeMms(pMmsData, &pFileData); } @@ -1184,14 +1167,14 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) } } - // Insert parameter for base64 encoding + /* Insert parameter for base64 encoding */ MSG_DEBUG("before to start INSERT_PARAM"); INSERT_PARAM; pObject->pParam = param; param->parameter = VMSG_PARAM_ENCODING; param->paramValue = VMSG_ENC_PARAM_BASE64; - // Add VCard tree for recipient address information. + /* Add VCard tree for recipient address information. */ for (int i = 0; i < pMsg->nAddressCnt; ++i) { pCard = (VTree*)calloc(1, sizeof(VTree)); if ( !pCard ) @@ -1206,7 +1189,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) INSERT_VCARD_OBJ; pObject->property = VCARD_TYPE_TEL; - pObject->pszValue [0] = strdup(pMsg->addressList[i].addressVal); + pObject->pszValue[0] = strdup(pMsg->addressList[i].addressVal); pObject->valueCount = 1; } MSG_DEBUG("before to start vmsg_encode"); @@ -1217,14 +1200,13 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg) return encoded_data; __CATCH_FAIL__ : - vmsg_free_vtree_memory( pMessage ); + vmsg_free_vtree_memory(pMessage); return NULL; } char *MsgVMessageEncodeSMS(MSG_MESSAGE_INFO_S *pMsg) { - MSG_BEGIN(); char *buf = NULL; @@ -1275,7 +1257,7 @@ bool __msgsvc_vmsg_convert_vdata_to_tm_str(const char* szText, struct tm * tm) if (token && token[0]) { g_strstrip(token[0]); strptime(token[0], "%I:%M%p", tm); - }else { + } else { g_strfreev(token); return false; } @@ -1357,7 +1339,7 @@ static inline int __msgsvc_vmsg_check_quoted(char *src, int max, int *quoted) *quoted = TRUE; return TRUE; } - }else if (':' == *src) { + } else if (':' == *src) { break; } src++; @@ -1717,7 +1699,7 @@ static char* __msgsvc_vmsg_remove_escape_char(char *str) *r = *n; s++; break; - case 0xA1: // en/em backslash + case 0xA1: /* en/em backslash */ if (*(n+1) && 0xAC == *(n+1)) { *r = *n; r++; @@ -1725,7 +1707,7 @@ static char* __msgsvc_vmsg_remove_escape_char(char *str) s+=2; } break; - case 0x81: // en/em backslash + case 0x81: /* en/em backslash */ if (*(n+1) && 0x5F == *(n+1)) { *r = *n; r++; @@ -1739,8 +1721,7 @@ static char* __msgsvc_vmsg_remove_escape_char(char *str) } r++; s++; - } - else { + } else { *r = *s; r++; s++; @@ -1765,7 +1746,8 @@ static inline msg_error_t __msgsvc_vmsg_get_read_status(MSG_MESSAGE_INFO_S *pMsg pMsg->bRead = false; else return MSG_ERR_INVALID_PARAMETER; - MSG_DEBUG("pMsg->bRead = %d",pMsg->bRead); + + MSG_DEBUG("pMsg->bRead = %d", pMsg->bRead); return MSG_SUCCESS; } @@ -1780,22 +1762,21 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_box(MSG_MESSAGE_INFO_S *pMsg, ch if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_DRAFT]) == 0) { pMsg->folderId = MSG_DRAFT_ID; - pMsg->direction=MSG_DIRECTION_TYPE_MO; - pMsg->networkStatus=MSG_NETWORK_NOT_SEND; + pMsg->direction = MSG_DIRECTION_TYPE_MO; + pMsg->networkStatus = MSG_NETWORK_NOT_SEND; } else if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_INBOX]) == 0) { pMsg->folderId = MSG_INBOX_ID; - pMsg->direction=MSG_DIRECTION_TYPE_MT; - pMsg->networkStatus=MSG_NETWORK_RECEIVED; - } - else if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_SENT]) == 0) { + pMsg->direction = MSG_DIRECTION_TYPE_MT; + pMsg->networkStatus = MSG_NETWORK_RECEIVED; + } else if (strcmp(temp, content_name[VMSG_INDICATION_MSG_BOX_SENT]) == 0) { pMsg->folderId = MSG_SENTBOX_ID; - pMsg->direction=MSG_DIRECTION_TYPE_MO; - pMsg->networkStatus=MSG_NETWORK_SEND_SUCCESS; - } - else + pMsg->direction = MSG_DIRECTION_TYPE_MO; + pMsg->networkStatus = MSG_NETWORK_SEND_SUCCESS; + } else return MSG_ERR_INVALID_PARAMETER; - MSG_DEBUG("pMsg->folderId = %d",pMsg->folderId); + + MSG_DEBUG("pMsg->folderId = %d", pMsg->folderId); return MSG_SUCCESS; } @@ -1814,18 +1795,19 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_type(MSG_MESSAGE_INFO_S *pMsg, c pMsg->msgType.classType = MSG_CLASS_NONE; } else if (strcmp(temp, content_name[VMSG_INDICATION_MESSAGE_TYPE_INET]) == 0) { - //To do + /* To do */ } else return MSG_ERR_INVALID_PARAMETER; - MSG_DEBUG("pMsg->msgType.subType = %d",pMsg->msgType.subType); + + MSG_DEBUG("pMsg->msgType.subType = %d", pMsg->msgType.subType); return MSG_SUCCESS; } static inline msg_error_t __msgsvc_vmsg_get_address(MSG_MESSAGE_INFO_S *pMsg, char *prefix, char *val, int* vCardCnt) { char *temp; - MSG_DEBUG("vCardCnt is : %d",*vCardCnt); + MSG_DEBUG("vCardCnt is : %d", *vCardCnt); if ((pMsg->folderId == MSG_SENTBOX_ID || pMsg->folderId == MSG_DRAFT_ID) && *vCardCnt == 1) return MSG_SUCCESS; @@ -1839,8 +1821,8 @@ static inline msg_error_t __msgsvc_vmsg_get_address(MSG_MESSAGE_INFO_S *pMsg, ch MSG_ADDRESS_INFO_S * addrInfo = NULL; pMsg->nAddressCnt++; - MSG_DEBUG("Address is : %s",temp); - MSG_DEBUG("Address Cnt : %d",pMsg->nAddressCnt); + MSG_DEBUG("Address is : %s", temp); + MSG_DEBUG("Address Cnt : %d", pMsg->nAddressCnt); if (pMsg->addressList == NULL) { @@ -1857,7 +1839,7 @@ static inline msg_error_t __msgsvc_vmsg_get_address(MSG_MESSAGE_INFO_S *pMsg, ch pMsg->addressList[pMsg->nAddressCnt-1].addressType = MSG_ADDRESS_TYPE_PLMN; pMsg->addressList[pMsg->nAddressCnt-1].recipientType = MSG_RECIPIENTS_TYPE_TO; strncpy(pMsg->addressList[pMsg->nAddressCnt-1].addressVal, temp, MAX_ADDRESS_VAL_LEN); - MSG_DEBUG("pMsg->addressList[pMsg->nAddressCnt-1].addressVal = %s",pMsg->addressList[pMsg->nAddressCnt-1].addressVal); + MSG_DEBUG("pMsg->addressList[pMsg->nAddressCnt-1].addressVal = %s", pMsg->addressList[pMsg->nAddressCnt-1].addressVal); return MSG_SUCCESS; } @@ -1889,7 +1871,7 @@ static inline msg_error_t __msgsvc_vmsg_get_msg_subject(MSG_MESSAGE_INFO_S *pMsg if (temp && temp[0] != '\0') strncpy(pMsg->subject, temp, MAX_SUBJECT_LEN); - MSG_DEBUG("pMsg->subject = %s",pMsg->subject); + MSG_DEBUG("pMsg->subject = %s", pMsg->subject); return MSG_SUCCESS; } @@ -1953,13 +1935,12 @@ static inline msg_error_t __msgsvc_vmsg_get_msg(int ver, char *vmsg, MSG_MESSAGE type = __msgsvc_vmsg_check_content_type(&cursor); if (VMSG_VALUE_NONE == type) { - if (isDateAvailable == true) { isDateAvailable = false; - //body decoding + /* body decoding */ MSG_DEBUG("Decoding body :"); bodyStart = __msgsvc_vmsg_pass_unsupported(bodyStart); - int i =0; + int i = 0; char tempMsgText[MAX_MSG_TEXT_LEN + 1] = {0, }; while (bodyStart) { if (i >= MAX_MSG_TEXT_LEN) @@ -1995,7 +1976,7 @@ static inline msg_error_t __msgsvc_vmsg_get_msg(int ver, char *vmsg, MSG_MESSAGE g_free(prefix); g_free(val); return MSG_SUCCESS; - }else { + } else { new_start = __msgsvc_vmsg_pass_unsupported(cursor); if (new_start) { cursor = new_start; @@ -2088,7 +2069,7 @@ msg_error_t MsgVMessageDecodeSMS(const char *vmsg_stream, MSG_MESSAGE_INFO_S *pM vmsg = __msgsvc_vmsg_check_word(vmsg, "BEGIN:VMSG"); MSG_ERR_RET_VM(NULL == vmsg, MSG_ERR_INVALID_PARAMETER, "Invalid parameter : The vmsg is invalid."); - //check for mms() + /* check for mms() */ MMSsend = vmsg; MMSretrieve = vmsg; MMSnoti = vmsg; @@ -2102,7 +2083,7 @@ msg_error_t MsgVMessageDecodeSMS(const char *vmsg_stream, MSG_MESSAGE_INFO_S *pM MMSnoti = __msgsvc_vmsg_check_word(MMSnoti, "X-MESSAGE-TYPE:MMS NOTIFICATION"); MSG_ERR_RET_VM(NULL != MMSnoti, MSG_ERR_INVALID_MESSAGE, "Invalid parameter : The vmsg format is invalid."); - //decode sms() + /* decode sms() */ __msgsvc_vmsg_initial(); vmsg = __msgsvc_vmsg_check_word(vmsg, "VERSION:1.1"); diff --git a/vobject-engine/include/VTypes.h b/vobject-engine/include/VTypes.h index 655b53f..15f7873 100755 --- a/vobject-engine/include/VTypes.h +++ b/vobject-engine/include/VTypes.h @@ -98,7 +98,7 @@ struct _VObject VObject* pParent; VObject* pChild; - char* pszGroupName; //VDATA_GROUPNAME_SUPPORTED + char* pszGroupName; /* VDATA_GROUPNAME_SUPPORTED */ }; struct _ValueObj @@ -112,4 +112,4 @@ struct _ValueObj #endif /* __cplusplus */ -#endif // _VTYPES_H +#endif /* _VTYPES_H */ diff --git a/vobject-engine/include/vobject.h b/vobject-engine/include/vobject.h index 4e3cb87..e2abe40 100755 --- a/vobject-engine/include/vobject.h +++ b/vobject-engine/include/vobject.h @@ -29,14 +29,13 @@ extern "C" { #endif /* __cplusplus */ -//#define ORG_ENABLE_TRACE +/* #define ORG_ENABLE_TRACE */ #define FEATURE_SHIFT_JIS #ifdef ORG_ENABLE_TRACE #define USER_TAG "MSG_FW" #define VDATA_TRACE(fmt, arg...) \ - do\ - {\ + do {\ SLOG(LOG_DEBUG, USER_TAG, "\n[calendarui] %s:%d: " fmt "\n", __FUNCTION__, __LINE__, ##arg); \ } while (0) @@ -45,14 +44,13 @@ extern "C" { #define SysRequireEx(expr, retValue) \ if (!(expr)) { \ - fprintf(stderr,"INVALID_PARAM (%d lines in %s)\n", __LINE__,__FILE__); \ + fprintf(stderr, "INVALID_PARAM (%d lines in %s)\n", __LINE__, __FILE__); \ return retValue; }\ else {;} #else #define USER_TAG "MSG_SERVICE" #define VDATA_TRACE(fmt, arg...) \ - do\ - {\ + do { \ SLOG(LOG_DEBUG, USER_TAG, "\n[calendarui] %s:%d: " fmt "\n", __FUNCTION__, __LINE__, ##arg); \ } while (0) @@ -60,29 +58,29 @@ extern "C" { #define SysRequireEx(expr, retValue) #endif -#define VDATA_TRACE_BEGINE //VDATA_TRACE(">>>>>> start. >>>>>>"); //usleep(1000); -#define VDATA_TRACE_END //VDATA_TRACE(">>>>>> end. >>>>>>"); +#define VDATA_TRACE_BEGINE /* VDATA_TRACE(">>>>>> start. >>>>>>"); usleep(1000); */ +#define VDATA_TRACE_END /* VDATA_TRACE(">>>>>> end. >>>>>>"); */ /****************************************************************************************************/ /* FUNCTION DECLARATION */ /****************************************************************************************************/ -int _VIsSpace( char ); -int _VRLSpace( char * ); -int _VRTSpace( char * ); -int _VUnescape( char* ); -int _VEscape(char*); -int _VManySpace2Space( char * ); -int _VB64Decode( char *, char * ); -int _VB64Encode( char *, char *, int ); -int _VUnfolding( char * ); -void _VFolding( char *, char * ); -int _VQPDecode( char * ); -int _VQPEncode( char *, char * ); +int _VIsSpace(char); +int _VRLSpace(char *); +int _VRTSpace(char *); +int _VUnescape(char*); +int _VEscape(char *); +int _VManySpace2Space(char *); +int _VB64Decode(char *, char *); +int _VB64Encode(char *, char *, int); +int _VUnfolding(char *); +void _VFolding(char *, char *); +int _VQPDecode(char *); +int _VQPEncode(char *, char *); -void _VFoldingQP( char *result, char *contentline ); -void _VFoldingNoSpace( char *result, char *contentline ); +void _VFoldingQP(char *result, char *contentline); +void _VFoldingNoSpace(char *result, char *contentline); int _VManyCRLF2CRLF(char *pIn); -int _VUnfoldingNoSpec( char *string, int vType ); +int _VUnfoldingNoSpec(char *string, int vType); #ifdef __cplusplus }