diff options
author | Sang-Hun Chung <sanghunchung@review.tizen.org> | 2015-12-21 00:49:57 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2015-12-21 00:49:57 -0800 |
commit | 2dd8fb09404f336db1cb22f09532fa4bd2f12a3a (patch) | |
tree | 0d739a0f2586c3a1b0aaef7b56d2995df2b0ad45 | |
parent | 5dade2d5f48d642fb3f84a5017dc3add5598a7b7 (diff) | |
parent | 8dbef3f5ff22ff48e219ee40d507102d69194a69 (diff) | |
download | msg-service-accepted/tizen/tv/20151224.064508.tar.gz msg-service-accepted/tizen/tv/20151224.064508.tar.bz2 msg-service-accepted/tizen/tv/20151224.064508.zip |
Merge "Change type of input parameter for string setter API" into tizensubmit/tizen/20151224.044747accepted/tizen/wearable/20151224.064523accepted/tizen/tv/20151224.064508accepted/tizen/mobile/20151224.064447
-rwxr-xr-x | include/framework/MsgCmdHandler.h | 2 | ||||
-rwxr-xr-x | include/mapi/msg.h | 15 | ||||
-rwxr-xr-x | include/mapi/msg_private.h | 30 | ||||
-rwxr-xr-x | mapi/msg_filter.cpp | 2 | ||||
-rwxr-xr-x | mapi/msg_message.cpp | 2 | ||||
-rwxr-xr-x | mapi/msg_mms.cpp | 56 | ||||
-rwxr-xr-x | mapi/msg_setting.cpp | 10 | ||||
-rwxr-xr-x | mapi/msg_storage.cpp | 70 | ||||
-rwxr-xr-x | mapi/msg_svc.cpp | 12 |
9 files changed, 112 insertions, 87 deletions
diff --git a/include/framework/MsgCmdHandler.h b/include/framework/MsgCmdHandler.h index ffe0462..4082cfa 100755 --- a/include/framework/MsgCmdHandler.h +++ b/include/framework/MsgCmdHandler.h @@ -108,4 +108,4 @@ int MsgUpdateIMSIHandler(const MSG_CMD_S *pCmd, char **ppEvent); #ifdef FEATURE_SMS_CDMA int MsgCheckUniquenessHandler(const MSG_CMD_S *pCmd, char **ppEvent); #endif -#endif // MSG_CMD_HANDLER_H +#endif /* MSG_CMD_HANDLER_H */ diff --git a/include/mapi/msg.h b/include/mapi/msg.h index ac6fa8d..d824233 100755 --- a/include/mapi/msg.h +++ b/include/mapi/msg.h @@ -332,7 +332,7 @@ int msg_get_list_handle(msg_struct_t msg_struct_handle, int field, void **value) * * @param[in] msg_struct_handle A pointer of message structure type * @param[in] field The enumeration to get a value of specific field - * @param[out] value The requested integer value + * @param[in] value The requested integer value * * @return @c 0 on success, * otherwise a negative error value @@ -356,7 +356,7 @@ int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int value); * * @param[in] msg_struct_handle A pointer of message structure type * @param[in] field The enumeration to get a value of specific field - * @param[out] value The requested string + * @param[in] value The requested string * @param[in] size The requested size of string to set * * @return @c 0 on success, @@ -365,11 +365,12 @@ int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int value); * @retval MSG_SUCCESS Successfully done * @retval MSG_ERR_NULL_POINTER Input parameter (msg_struct_handle/value) is NULL * @retval MSG_ERR_INVALID_PARAMETER Input parameter (field) is not valid + * @retval MSG_ERR_MEMORY_ERROR Memory error * @retval MSG_ERR_NOT_SUPPORTED Not supported * */ -int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size); +int msg_set_str_value(msg_struct_t msg_struct_handle, int field, const char *value, int size); /** @@ -383,7 +384,7 @@ int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, in * * @param[in] msg_struct_handle A pointer of message structure type * @param[in] field The enumeration to get a value of specific field - * @param[out] value The requested boolean value + * @param[in] value The requested boolean value * * @return @c 0 on success, * otherwise a negative error value @@ -407,7 +408,7 @@ int msg_set_bool_value(msg_struct_t msg_struct_handle, int field, bool value); * * @param[in] msg_struct_handle A pointer of message structure type * @param[in] field The enumeration to get a value of specific field - * @param[out] value The requested structure handle to set + * @param[in] value The requested structure handle to set * * @return @c 0 on success, * otherwise a negative error value @@ -431,7 +432,7 @@ int msg_set_struct_handle(msg_struct_t msg_struct_handle, int field, msg_struct_ * * @param[in] msg_struct_handle A pointer of message structure type * @param[in] field The enumeration to get a value of specific field - * @param[out] value The requested list handle to set + * @param[in] value The requested list handle to set * * @return @c 0 on success, * otherwise a negative error value @@ -476,7 +477,7 @@ int msg_get_mms_struct(msg_struct_t msg_struct_handle, msg_struct_t mms_struct_h * @remarks Use valid structure handle. * * @param[in] msg_struct_handle A pointer of message structure type - * @param[out] mms_struct_handle The MMS structure handle to set + * @param[in] mms_struct_handle The MMS structure handle to set * * @return @c 0 on success, * otherwise a negative error value diff --git a/include/mapi/msg_private.h b/include/mapi/msg_private.h index 616156f..a24287e 100755 --- a/include/mapi/msg_private.h +++ b/include/mapi/msg_private.h @@ -71,7 +71,7 @@ int msg_message_get_list_hnd(void *data, int field, void **value); int msg_message_set_int_value(void *data, int field, int value); int msg_message_set_bool_value(void *data, int field, bool value); -int msg_message_set_str_value(void *data, int field, char *value, int size); +int msg_message_set_str_value(void *data, int field, const char *value, int size); 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); @@ -90,7 +90,7 @@ int msg_get_filter_info_int(void *filter, int field, int *value); int msg_get_filter_info_str(void *filter, int field, char *value, int size); int msg_set_filter_info_bool(void *filter, int field, bool value); int msg_set_filter_info_int(void *filter, int field, int value); -int msg_set_filter_info_str(void *filter, int field, char *value, int size); +int msg_set_filter_info_str(void *filter, int field, const char *value, int size); /* mms */ @@ -105,7 +105,7 @@ int msg_mms_get_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s int msg_mms_get_list_handle(msg_struct_s *msg_struct, int field, msg_list_handle_t *value); int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value); -int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size); +int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, const char *value, int size); int msg_mms_set_bool_value(msg_struct_s *msg_struct, int field, bool value); int msg_mms_set_struct_handle(msg_struct_s *msg_struct, int field, msg_struct_s *value); @@ -122,7 +122,7 @@ int msg_setting_get_bool_value(msg_struct_s *msg_struct, int field, bool *value) int msg_setting_get_list_handle(msg_struct_s *msg_struct, int field, void **value); int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value); -int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size); +int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, const char *value, int size); int msg_setting_set_bool_value(msg_struct_s *msg_struct, int field, bool value); int msg_get_smsc_opt_int(void *smsc_opt, int field, int *value); @@ -132,7 +132,7 @@ int msg_get_smsc_opt_list(void *smsc_opt, int field, void **value); int msg_get_smsc_info_int(void *smsc_info, int field, int *value); int msg_set_smsc_info_int(void *smsc_info, int field, int value); int msg_get_smsc_info_str(void *smsc_info, int field, char *value, int size); -int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size); +int msg_set_smsc_info_str(void *smsc_info, int field, const char *val, int size); int msg_get_cb_option_int(void *cb_opt, int field, int *value); int msg_set_cb_option_int(void *cb_opt, int field, int value); @@ -145,7 +145,7 @@ int msg_set_cb_channel_info_int(void *cb_ch_info, int field, int value); int msg_get_cb_channel_info_bool(void *cb_ch_info, int field, bool *value); int msg_set_cb_channel_info_bool(void *cb_ch_info, int field, bool value); int msg_get_cb_channel_info_str(void *cb_ch_info, int field, char *value, int size); -int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size); +int msg_set_cb_channel_info_str(void *cb_ch_info, int field, const char *val, int size); int msg_get_sms_send_opt_int(void *sms_send_opt, int field, int *value); int msg_set_sms_send_opt_int(void *sms_send_opt, int field, int value); @@ -170,14 +170,14 @@ int msg_set_push_msg_opt_bool(void *push_msg_opt, int field, bool value); int msg_get_voice_msg_opt_int(void *voice_msg_opt, int field, int *value); int msg_set_voice_msg_opt_int(void *voice_msg_opt, int field, int value); int msg_get_voice_msg_opt_str(void *voice_msg_opt, int field, char *value, int size); -int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size); +int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, const char *val, int size); int msg_get_general_opt_int(void *general_opt, int field, int *value); int msg_set_general_opt_int(void *general_opt, int field, int value); int msg_get_general_opt_bool(void *general_opt, int field, bool *value); int msg_set_general_opt_bool(void *general_opt, int field, bool value); int msg_get_general_opt_str(void *general_opt, int field, char *value, int size); -int msg_set_general_opt_str(void *general_opt, int field, char *val, int size); +int msg_set_general_opt_str(void *general_opt, int field, const char *val, int size); int msg_get_msgsize_opt_int(void *size_opt, int field, int *value); int msg_set_msgsize_opt_int(void *size_opt, int field, int value); @@ -185,7 +185,7 @@ int msg_set_msgsize_opt_int(void *size_opt, int field, int value); /* Wap Push */ int msg_push_config_get_str(void *event_info, int field, char *value, int size); int msg_push_config_get_bool(void *event_info, int field, bool *value); -int msg_push_config_set_str(void *event_info, int field, char *value, int size); +int msg_push_config_set_str(void *event_info, int field, const char *value, int size); int msg_push_config_set_bool(void *event, int field, bool value); /* added internal apis for new managed api (storage) */ @@ -229,8 +229,8 @@ int msg_sortrule_set_int(void *sort_info, int field, int value); int msg_folder_info_set_int(void *folder_info, int field, int value); int msg_list_condition_set_int(void *condition_info, int field, int value); int msg_report_status_set_int(void *report_info, int field, int value); -int msg_folder_info_set_str(void *folder_info, int field, char *value, int size); -int msg_list_condition_set_str(void *condition_info, int field, char *value, int size); +int msg_folder_info_set_str(void *folder_info, int field, const char *value, int size); +int msg_list_condition_set_str(void *condition_info, int field, const char *value, int size); int msg_sendopt_set_bool(void *send_opt, int field, bool value); int msg_sortrule_set_bool(void *sort_rule, int field, bool value); int msg_list_condition_set_bool(void *data, int field, bool value); @@ -241,9 +241,9 @@ int msg_list_condition_set_struct_handle(msg_struct_s *msg_struct, int field, ms int msg_address_info_set_int(void *addrinfo, int field, int value); int msg_mms_sendopt_set_int(void *opt_info, int field, int value); int msg_reject_message_set_int(void *msg_info, int field, int value); -int msg_address_info_set_str(void *addr_info, int field, char *value, int size); -int msg_media_info_set_str(void *media_info, int field, char *value, int size); -int msg_reject_message_set_str(void *msg_info, int field, char *value, int size); +int msg_address_info_set_str(void *addr_info, int field, const char *value, int size); +int msg_media_info_set_str(void *media_info, int field, const char *value, int size); +int msg_reject_message_set_str(void *msg_info, int field, const char *value, int size); int msg_mms_sendopt_set_bool(void *option, int field, bool value); int msg_sms_sendopt_set_bool(void *option, int field, bool value); @@ -260,5 +260,5 @@ int msg_media_item_get_int(void *data, int field, int *value); int msg_conversation_get_list_hnd(void *data, int field, void **value); int msg_multipart_get_str_value(void *data, int field, char *value, int size); int msg_multipart_get_int_value(void *data, int field, int *value); -int msg_multipart_set_str_value(void *data, int field, char *value, int size); +int msg_multipart_set_str_value(void *data, int field, const char *value, int size); #endif /* MSG_PRIVATE_H_ */ diff --git a/mapi/msg_filter.cpp b/mapi/msg_filter.cpp index e2f07e6..81e444a 100755 --- a/mapi/msg_filter.cpp +++ b/mapi/msg_filter.cpp @@ -327,7 +327,7 @@ int msg_set_filter_info_int(void *filter, int field, int value) return err; } -int msg_set_filter_info_str(void *filter, int field, char *value, int size) +int msg_set_filter_info_str(void *filter, int field, const char *value, int size) { if (!filter || !value) return MSG_ERR_NULL_POINTER; diff --git a/mapi/msg_message.cpp b/mapi/msg_message.cpp index 9c0073c..8ba2cd1 100755 --- a/mapi/msg_message.cpp +++ b/mapi/msg_message.cpp @@ -516,7 +516,7 @@ int msg_message_set_bool_value(void *data, int field, bool value) return ret; } -int msg_message_set_str_value(void *data, int field, char *value, int size) +int msg_message_set_str_value(void *data, int field, const char *value, int size) { if (!data || !value) return MSG_ERR_NULL_POINTER; diff --git a/mapi/msg_mms.cpp b/mapi/msg_mms.cpp index 9137133..7073543 100755 --- a/mapi/msg_mms.cpp +++ b/mapi/msg_mms.cpp @@ -993,8 +993,11 @@ int msg_mms_set_int_value(msg_struct_s *msg_struct, int field, int value) return err; } -int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size) +int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, const char *value, int size) { + if (value == NULL) + return MSG_ERR_NULL_POINTER; + msg_error_t err = MSG_SUCCESS; switch (msg_struct->type) { @@ -1005,21 +1008,18 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int else if (field == MSG_MMS_MEDIA_FILENAME_STR) { strncpy(mms_media_data->szFileName, value, MSG_FILEPATH_LEN_MAX); } else if (field == MSG_MMS_MEDIA_FILEPATH_STR) { + MSG_SEC_DEBUG("media file path = %s", value); + strncpy(mms_media_data->szFilePath, value, MSG_FILEPATH_LEN_MAX); + char *filename = NULL; - if (value != NULL) { - MSG_SEC_DEBUG("media file path = %s", value); - strncpy(mms_media_data->szFilePath, value, MSG_FILEPATH_LEN_MAX); - filename = strrchr(value, '/'); - if (filename != NULL) { - strncpy(mms_media_data->szFileName, filename + 1, MSG_FILENAME_LEN_MAX); - strncpy(mms_media_data->szContentID, filename + 1, MSG_MSG_ID_LEN); - } else { - strncpy(mms_media_data->szFileName, value + 1, MSG_FILENAME_LEN_MAX); - strncpy(mms_media_data->szContentID, value + 1, MSG_MSG_ID_LEN); - } + filename = (char *)strrchr(value, '/'); + + if (filename != NULL) { + strncpy(mms_media_data->szFileName, filename + 1, MSG_FILENAME_LEN_MAX); + strncpy(mms_media_data->szContentID, filename + 1, MSG_MSG_ID_LEN); } else { - MSG_DEBUG("media file path is NULL"); - err = MSG_ERR_INVALID_PARAMETER; + strncpy(mms_media_data->szFileName, value, MSG_FILENAME_LEN_MAX); + strncpy(mms_media_data->szContentID, value, MSG_MSG_ID_LEN); } } else if (field == MSG_MMS_MEDIA_CONTENT_ID_STR) __removeLessGreaterMark(value, mms_media_data->szContentID, MSG_MSG_ID_LEN); @@ -1042,26 +1042,18 @@ int msg_mms_set_str_value(msg_struct_s *msg_struct, int field, char *value, int if (field == MSG_MMS_ATTACH_FILENAME_STR) { strncpy(mms_attach_data->szFileName, value, MSG_FILENAME_LEN_MAX); } else if (field == MSG_MMS_ATTACH_FILEPATH_STR) { - char *filename = NULL; - char *filepath = value; - - if (filepath != NULL) { - MSG_SEC_DEBUG("attach file path = %s", filepath); - mms_attach_data->mediatype = MIME_UNKNOWN; - mms_attach_data->fileSize = -1; + MSG_SEC_DEBUG("attach file path = %s", value); + mms_attach_data->mediatype = MIME_UNKNOWN; + mms_attach_data->fileSize = -1; - strncpy(mms_attach_data->szFilePath, filepath, MSG_FILEPATH_LEN_MAX); - - filename = strrchr(filepath, '/'); - if (filename != NULL) { - strncpy(mms_attach_data->szFileName, filename + 1, MSG_FILENAME_LEN_MAX); - } else { - strncpy(mms_attach_data->szFileName, filepath, MSG_FILENAME_LEN_MAX); - } + strncpy(mms_attach_data->szFilePath, value, MSG_FILEPATH_LEN_MAX); + char *filename = NULL; + filename = (char *)strrchr(value, '/'); + if (filename != NULL) { + strncpy(mms_attach_data->szFileName, filename + 1, MSG_FILENAME_LEN_MAX); } else { - MSG_DEBUG("attach file path is NULL"); - err = MSG_ERR_INVALID_PARAMETER; + strncpy(mms_attach_data->szFileName, value, MSG_FILENAME_LEN_MAX); } } else if (field == MSG_MMS_ATTACH_DRM_FULLPATH_STR) { strncpy(mms_attach_data->szDrm2FullPath, value, MSG_FILEPATH_LEN_MAX); @@ -1567,7 +1559,7 @@ int msg_multipart_get_int_value(void *data, int field, int *value) return ret; } -int msg_multipart_set_str_value(void *data, int field, char *value, int size) +int msg_multipart_set_str_value(void *data, int field, const char *value, int size) { if (!data || !value) return MSG_ERR_NULL_POINTER; diff --git a/mapi/msg_setting.cpp b/mapi/msg_setting.cpp index 1bdf954..946c128 100755 --- a/mapi/msg_setting.cpp +++ b/mapi/msg_setting.cpp @@ -197,7 +197,7 @@ int msg_setting_set_int_value(msg_struct_s *msg_struct, int field, int value) return err; } -int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, char *value, int size) +int msg_setting_set_str_value(msg_struct_s *msg_struct, int field, const char *value, int size) { int err = MSG_SUCCESS; @@ -464,7 +464,7 @@ int msg_get_smsc_info_str(void *smsc_info, int field, char *value, int size) return MSG_SUCCESS; } -int msg_set_smsc_info_str(void *smsc_info, int field, char *val, int size) +int msg_set_smsc_info_str(void *smsc_info, int field, const char *val, int size) { if (!smsc_info) return MSG_ERR_NULL_POINTER; @@ -824,7 +824,7 @@ int msg_get_cb_channel_info_str(void *cb_ch_info, int field, char *value, int si return MSG_SUCCESS; } -int msg_set_cb_channel_info_str(void *cb_ch_info, int field, char *val, int size) +int msg_set_cb_channel_info_str(void *cb_ch_info, int field, const char *val, int size) { if (!cb_ch_info) return MSG_ERR_NULL_POINTER; @@ -1635,7 +1635,7 @@ int msg_get_voice_msg_opt_str(void *voice_msg_opt, int field, char *value, int s return MSG_SUCCESS; } -int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, char *val, int size) +int msg_set_voice_msg_opt_str(void *voice_msg_opt, int field, const char *val, int size) { if (!voice_msg_opt) return MSG_ERR_NULL_POINTER; @@ -1859,7 +1859,7 @@ int msg_get_general_opt_str(void *general_opt, int field, char *value, int size) return MSG_SUCCESS; } -int msg_set_general_opt_str(void *general_opt, int field, char *val, int size) +int msg_set_general_opt_str(void *general_opt, int field, const char *val, int size) { if (!general_opt) return MSG_ERR_NULL_POINTER; diff --git a/mapi/msg_storage.cpp b/mapi/msg_storage.cpp index 0a42eff..ed679f6 100755 --- a/mapi/msg_storage.cpp +++ b/mapi/msg_storage.cpp @@ -1976,7 +1976,7 @@ int msg_sendopt_get_struct_handle(msg_struct_s *msg_struct, int field, void **va *value = (void *)sendopt->smsSendOpt; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -1997,7 +1997,7 @@ int msg_syncml_get_struct_handle(msg_struct_s *msg_struct, int field, void **val *value = (void *)pSync->msg; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2018,7 +2018,7 @@ int msg_thread_index_get_struct_handle(msg_struct_s *msg_struct, int field, void *value = (void *)pIndex->msgAddrInfo; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2040,7 +2040,7 @@ int msg_list_condition_get_struct_handle(msg_struct_s *msg_struct, int field, vo *value = (void *)pCond->sortRule; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2227,7 +2227,7 @@ int msg_syncml_info_set_int(void *syncml_info, int field, int value) pSync->pinCode = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2257,7 +2257,7 @@ int msg_count_info_set_int(void *count_info, int field, int value) pCount->nMms = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2287,7 +2287,7 @@ int msg_thread_count_set_int(void *count_info, int field, int value) pCount->mmsMsgCount = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2308,7 +2308,7 @@ int msg_thread_index_set_int(void *index_info, int field, int value) pIndex->contactId = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2329,7 +2329,7 @@ int msg_sortrule_set_int(void *sort_info, int field, int value) pSort->sortType = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2353,7 +2353,7 @@ int msg_folder_info_set_int(void *folder_info, int field, int value) pFolder->folderType = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2399,7 +2399,7 @@ int msg_list_condition_set_int(void *condition_info, int field, int value) pCond->simIndex = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2427,14 +2427,14 @@ int msg_report_status_set_int(void *report_info, int field, int value) pReport->statusTime = value; break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } return err; } -int msg_folder_info_set_str(void *folder_info, int field, char *value, int size) +int msg_folder_info_set_str(void *folder_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; @@ -2451,7 +2451,7 @@ int msg_folder_info_set_str(void *folder_info, int field, char *value, int size) strncpy(pFolder->folderName, value, _len); break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2459,26 +2459,48 @@ int msg_folder_info_set_str(void *folder_info, int field, char *value, int size) } -int msg_list_condition_set_str(void *condition_info, int field, char *value, int size) +int msg_list_condition_set_str(void *condition_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; if (!condition_info || !value) return MSG_ERR_NULL_POINTER; + if (size <= 0) { + return MSG_ERR_INVALID_PARAMETER; + } + MSG_LIST_CONDITION_S *cond = (MSG_LIST_CONDITION_S *)condition_info; switch (field) { case MSG_LIST_CONDITION_ADDRESS_VALUE_STR: - if (size) - cond->pAddressVal = value; + if (size) { + if (cond->pAddressVal) { + delete cond->pAddressVal; + cond->pAddressVal = NULL; + } + cond->pAddressVal = (char *)new char[size+1]; + if (cond->pAddressVal) + memcpy(cond->pAddressVal, value, sizeof(char)*size); + else + return MSG_ERR_MEMORY_ERROR; + } break; case MSG_LIST_CONDITION_TEXT_VALUE_STR: - if (size) - cond->pTextVal = value; + if (size) { + if (cond->pTextVal) { + delete cond->pTextVal; + cond->pTextVal = NULL; + } + cond->pTextVal = (char *)new char[size+1]; + if (cond->pTextVal) + memcpy(cond->pTextVal, value, sizeof(char)*size); + else + return MSG_ERR_MEMORY_ERROR; + } break; default: - err = MSG_ERR_UNKNOWN; + err = MSG_ERR_INVALID_PARAMETER; break; } @@ -2743,7 +2765,7 @@ int msg_reject_message_set_int(void *msg_info, int field, int value) return err; } -int msg_address_info_set_str(void *addr_info, int field, char *value, int size) +int msg_address_info_set_str(void *addr_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; @@ -2772,7 +2794,7 @@ int msg_address_info_set_str(void *addr_info, int field, char *value, int size) return err; } -int msg_media_info_set_str(void *media_info, int field, char *value, int size) +int msg_media_info_set_str(void *media_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; @@ -2806,7 +2828,7 @@ int msg_media_info_set_str(void *media_info, int field, char *value, int size) return err; } -int msg_reject_message_set_str(void *msg_info, int field, char *value, int size) +int msg_reject_message_set_str(void *msg_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; @@ -3010,7 +3032,7 @@ int msg_push_config_get_bool(void *event_info, int field, bool *value) return ret; } -int msg_push_config_set_str(void *event_info, int field, char *value, int size) +int msg_push_config_set_str(void *event_info, int field, const char *value, int size) { msg_error_t err = MSG_SUCCESS; diff --git a/mapi/msg_svc.cpp b/mapi/msg_svc.cpp index 14b52c5..bc96798 100755 --- a/mapi/msg_svc.cpp +++ b/mapi/msg_svc.cpp @@ -460,6 +460,16 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle) delete (msg_struct_s *)pCond->sortRule; pCond->sortRule = NULL; + if (pCond->pAddressVal) { + delete pCond->pAddressVal; + pCond->pAddressVal = NULL; + } + + if (pCond->pTextVal) { + delete pCond->pTextVal; + pCond->pTextVal = NULL; + } + delete (MSG_LIST_CONDITION_S*)(msg_struct->data); msg_struct->data = NULL; @@ -1152,7 +1162,7 @@ EXPORT_API int msg_set_int_value(msg_struct_t msg_struct_handle, int field, int return err; } -EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, char *value, int size) +EXPORT_API int msg_set_str_value(msg_struct_t msg_struct_handle, int field, const char *value, int size) { CHECK_MSG_SUPPORTED(MSG_TELEPHONY_SMS_FEATURE); msg_error_t err = MSG_SUCCESS; |