#ifdef FEATURE_SMS_CDMA
int MsgCheckUniquenessHandler(const MSG_CMD_S *pCmd, char **ppEvent);
#endif
-#endif // MSG_CMD_HANDLER_H
+#endif /* MSG_CMD_HANDLER_H */
*
* @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
*
* @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,
* @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);
/**
*
* @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
*
* @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
*
* @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
* @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
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);
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 */
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);
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);
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);
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);
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);
/* 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) */
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);
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);
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_ */
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;
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;
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) {
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);
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);
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;
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;
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;
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;
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;
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;
*value = (void *)sendopt->smsSendOpt;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
*value = (void *)pSync->msg;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
*value = (void *)pIndex->msgAddrInfo;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
*value = (void *)pCond->sortRule;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pSync->pinCode = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pCount->nMms = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pCount->mmsMsgCount = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pIndex->contactId = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pSort->sortType = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pFolder->folderType = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
pCond->simIndex = value;
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
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;
strncpy(pFolder->folderName, value, _len);
break;
default:
- err = MSG_ERR_UNKNOWN;
+ err = MSG_ERR_INVALID_PARAMETER;
break;
}
}
-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;
}
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;
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;
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;
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;
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;
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;