From 9fea28ac13cb349f3b5a9c891a8e0ef351095d09 Mon Sep 17 00:00:00 2001 From: Sangkoo Kim Date: Mon, 21 Dec 2015 19:57:53 +0900 Subject: [PATCH] Apply modified API - str setter Change-Id: I6917e5dd9c542917977474bf8432af3224dc53b6 --- src/messages.c | 34 +++++++++++++++++----------------- src/messages_push.c | 24 ++++++++++++------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/messages.c b/src/messages.c index 97d3c85..5d2b841 100644 --- a/src/messages.c +++ b/src/messages.c @@ -275,7 +275,7 @@ int messages_add_address(messages_message_h msg, const char *address, messages_r return MESSAGES_ERROR_INVALID_PARAMETER; } - ret = msg_set_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, (char *)address, strlen(address)); + ret = msg_set_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, address, strlen(address)); if (MSG_SUCCESS != ret) return ERROR_CONVERT(ret); @@ -579,10 +579,10 @@ int messages_search_message(messages_service_h service, messages_message_box_e m msg_set_int_value(listCond, MSG_LIST_CONDITION_MSGTYPE_INT, _messages_convert_msgtype_to_fw(type)); if (NULL != keyword) - msg_set_str_value(listCond, MSG_LIST_CONDITION_TEXT_VALUE_STR, strdup(keyword), strlen(keyword)); + msg_set_str_value(listCond, MSG_LIST_CONDITION_TEXT_VALUE_STR, keyword, strlen(keyword)); if (NULL != address) - msg_set_str_value(listCond, MSG_LIST_CONDITION_ADDRESS_VALUE_STR, strdup(address), strlen(address)); + msg_set_str_value(listCond, MSG_LIST_CONDITION_ADDRESS_VALUE_STR, address, strlen(address)); /* Search */ msg_set_bool_value(listCond, MSG_LIST_CONDITION_AND_OPERATER_BOOL, true); @@ -872,7 +872,7 @@ int messages_set_text(messages_message_h msg, const char *text) LOGE("[%s] INVALID_PARAMETER(0x%08x) : the length of body exceeded the max, 1530 .", __FUNCTION__, MESSAGES_ERROR_INVALID_PARAMETER); return MESSAGES_ERROR_INVALID_PARAMETER; } - ret = ERROR_CONVERT(msg_set_str_value(_msg->msg_h, MSG_MESSAGE_SMS_DATA_STR, (char *)text, len)); + ret = ERROR_CONVERT(msg_set_str_value(_msg->msg_h, MSG_MESSAGE_SMS_DATA_STR, text, len)); } else if (IS_MMS(type)) { CHECK_MESSAGES_SUPPORTED(MESSAGES_TELEPHONY_MMS_FEATURE); @@ -1150,7 +1150,7 @@ int messages_mms_set_subject(messages_message_h msg, const char *subject) return MESSAGES_ERROR_INVALID_PARAMETER; } - ret = msg_set_str_value(_msg->msg_h, MSG_MESSAGE_SUBJECT_STR, (char *)subject, strlen(subject)); + ret = msg_set_str_value(_msg->msg_h, MSG_MESSAGE_SUBJECT_STR, subject, strlen(subject)); return ERROR_CONVERT(ret); } @@ -1364,7 +1364,7 @@ int _messages_save_mms_data(messages_message_s * msg) if (NULL == image) { msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, ®ion); - msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Text", 4); + msg_set_str_value(region, MSG_MMS_REGION_ID_STR, "Text", 4); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_WIDTH_INT, 100); @@ -1372,7 +1372,7 @@ int _messages_save_mms_data(messages_message_s * msg) msg_set_int_value(region, MSG_MMS_REGION_BGCOLOR_INT, 0xffffff); } else if (NULL == msg->text) { msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, ®ion); - msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Image", 5); + msg_set_str_value(region, MSG_MMS_REGION_ID_STR, "Image", 5); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_WIDTH_INT, 100); @@ -1380,7 +1380,7 @@ int _messages_save_mms_data(messages_message_s * msg) msg_set_int_value(region, MSG_MMS_REGION_BGCOLOR_INT, 0xffffff); } else { msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, ®ion); - msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Image", 5); + msg_set_str_value(region, MSG_MMS_REGION_ID_STR, "Image", 5); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_WIDTH_INT, 100); @@ -1388,7 +1388,7 @@ int _messages_save_mms_data(messages_message_s * msg) msg_set_int_value(region, MSG_MMS_REGION_BGCOLOR_INT, 0xffffff); msg_list_add_item(mms_data, MSG_STRUCT_MMS_REGION, ®ion); - msg_set_str_value(region, MSG_MMS_REGION_ID_STR, (char *)"Text", 4); + msg_set_str_value(region, MSG_MMS_REGION_ID_STR, "Text", 4); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_LEFT_INT, 0); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_TOP_INT, 50); msg_set_int_value(region, MSG_MMS_REGION_LENGTH_WIDTH_INT, 100); @@ -1404,13 +1404,13 @@ int _messages_save_mms_data(messages_message_s * msg) if (MESSAGES_MEDIA_IMAGE == image->media_type) { msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media); msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_IMG); - msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Image", 5); - msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)image->filepath, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, "Image", 5); + msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (const char *)image->filepath, MSG_FILEPATH_LEN_MAX); } else if (MESSAGES_MEDIA_VIDEO == image->media_type) { msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media); msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_VIDEO); - msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Image", 5); - msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)image->filepath, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, "Image", 5); + msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (const char *)image->filepath, MSG_FILEPATH_LEN_MAX); } } @@ -1418,7 +1418,7 @@ int _messages_save_mms_data(messages_message_s * msg) msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media); msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_AUDIO); msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Audio", 5); - msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)audio->filepath, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (const char *)audio->filepath, MSG_FILEPATH_LEN_MAX); } if (NULL != msg->text) { @@ -1426,8 +1426,8 @@ int _messages_save_mms_data(messages_message_s * msg) if (MESSAGES_ERROR_NONE == ret) { msg_list_add_item(page, MSG_STRUCT_MMS_MEDIA, &media); msg_set_int_value(media, MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_TEXT); - msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, (char *)"Text", 4); - msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (char *)filepath, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(media, MSG_MMS_MEDIA_REGION_ID_STR, "Text", 4); + msg_set_str_value(media, MSG_MMS_MEDIA_FILEPATH_STR, (const char *)filepath, MSG_FILEPATH_LEN_MAX); msg_get_struct_handle(media, MSG_MMS_MEDIA_SMIL_TEXT_HND, &smil_text); msg_set_int_value(smil_text, MSG_MMS_SMIL_TEXT_COLOR_INT, 0x000000); @@ -1443,7 +1443,7 @@ int _messages_save_mms_data(messages_message_s * msg) attach = g_slist_nth_data(msg->attachment_list, i); if (image != attach && audio != attach) { msg_list_add_item(mms_data, MSG_STRUCT_MMS_ATTACH, &mms_attach); - msg_set_str_value(mms_attach, MSG_MMS_ATTACH_FILEPATH_STR, (char *)attach->filepath, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(mms_attach, MSG_MMS_ATTACH_FILEPATH_STR, (const char *)attach->filepath, MSG_FILEPATH_LEN_MAX); } } diff --git a/src/messages_push.c b/src/messages_push.c index e68dc5b..4283eb4 100644 --- a/src/messages_push.c +++ b/src/messages_push.c @@ -131,9 +131,9 @@ int messages_push_register(messages_service_h service, const char *content_type, } push_info = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)app_id, MAX_WAPPUSH_ID_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pkg_name, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, app_id, MAX_WAPPUSH_ID_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, (const char *)pkg_name, MSG_FILEPATH_LEN_MAX); free(pkg_name); ret = msg_add_push_event(_svc->service_h, push_info); @@ -167,9 +167,9 @@ int messages_push_deregister(messages_service_h service, const char *content_typ } push_info = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)app_id, MAX_WAPPUSH_ID_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pkg_name, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, app_id, MAX_WAPPUSH_ID_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, (const char *)pkg_name, MSG_FILEPATH_LEN_MAX); free(pkg_name); ret = msg_delete_push_event(_svc->service_h, push_info); @@ -206,14 +206,14 @@ int messages_push_reregister(messages_service_h service, const char *content_typ } push_info = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)app_id, MAX_WAPPUSH_ID_LEN); - msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pkg_name, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, app_id, MAX_WAPPUSH_ID_LEN); + msg_set_str_value(push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, (const char *)pkg_name, MSG_FILEPATH_LEN_MAX); dst_push_info = msg_create_struct(MSG_STRUCT_PUSH_CONFIG_INFO); - msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, (char *)dst_content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); - msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, (char *)dst_app_id, MAX_WAPPUSH_ID_LEN); - msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, pkg_name, MSG_FILEPATH_LEN_MAX); + msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_CONTENT_TYPE_STR, dst_content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN); + msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_APPLICATON_ID_STR, dst_app_id, MAX_WAPPUSH_ID_LEN); + msg_set_str_value(dst_push_info, MSG_PUSH_CONFIG_PACKAGE_NAME_STR, (const char *)pkg_name, MSG_FILEPATH_LEN_MAX); free(pkg_name); ret = msg_update_push_event(_svc->service_h, push_info, dst_push_info); -- 2.34.1