diff options
author | Dowon Park <dowon.park@samsung.com> | 2013-03-21 18:56:30 +0900 |
---|---|---|
committer | Dowon Park <dowon.park@samsung.com> | 2013-03-21 18:56:30 +0900 |
commit | 944b3ced0efce1413a3a822bede2d464e42d4f8e (patch) | |
tree | dd3a4af05d4e54073c848183ada12e67189c8f03 /common | |
parent | 47aaa76f4ba29602e92773424c89891e6cf610cd (diff) | |
download | message-app-944b3ced0efce1413a3a822bede2d464e42d4f8e.tar.gz message-app-944b3ced0efce1413a3a822bede2d464e42d4f8e.tar.bz2 message-app-944b3ced0efce1413a3a822bede2d464e42d4f8e.zip |
Apply latest codes migration
Change-Id: Id3b1cf74a1f0f222d256c80d86c8259f745466a2
Diffstat (limited to 'common')
-rwxr-xr-x | common/msg-ui-common-utility.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/common/msg-ui-common-utility.c b/common/msg-ui-common-utility.c index ce2e954..0e5af10 100755 --- a/common/msg-ui-common-utility.c +++ b/common/msg-ui-common-utility.c @@ -306,8 +306,11 @@ Eina_Strbuf *msg_common_get_markup_text(const char *src, char *fontcolor, char * Eina_Strbuf *font_buf = NULL; char *token = NULL; char *tmp_buf = NULL; - char *remained_string = NULL; + char *tmp_str = NULL; + int tmp_str_len = 0; int src_text_len = 0; + size_t start = 0; + size_t end = 0; src_text_len = strlen(src_text); D_MSG("src_text_len : %d", src_text_len); @@ -352,33 +355,50 @@ Eina_Strbuf *msg_common_get_markup_text(const char *src, char *fontcolor, char * snprintf(tmp_buf, src_text_len + 1, "%s\n", (char *) src_text); - token = strtok_r(tmp_buf, "\n", &remained_string); + while (tmp_buf[start] != '\0') { + end = strcspn(tmp_buf + start, "\n"); - int token_len = 0; + if (end == 0) { + eina_strbuf_append(markup_text, "<br>"); + start += (tmp_buf[start + end] != '\0') ? end + 1 : end; + continue; + } + + token = (char *)calloc(1, sizeof(char) * (end + 1)); + if (token == NULL) { + D_EMSG("calloc is failed"); + break; + } + + strncpy(token, tmp_buf + start, end); - while (token) { char *tmp_str = elm_entry_utf8_to_markup(token); if (!tmp_str) { D_EMSG("elm_entry_utf8_to_markup() is failed, [%s]. Stop parsing entry text", token); + free(token); break; } - token_len = strlen(tmp_str); + tmp_str_len = strlen(tmp_str); - if (tmp_str[token_len - 1] == 0x0D) { /* if Enter is added via Window system, CR+LF is added. */ + if (tmp_str[tmp_str_len - 1] == 0x0D) { /* if Enter is added via Window system, CR+LF is added. */ D_MSG("CR length is decreased"); - token_len = token_len - 1; + tmp_str_len = tmp_str_len - 1; } - if (!__msg_common_make_normal_markup_text(markup_text, font_buf, tmp_str, token_len)) + if (!__msg_common_make_normal_markup_text(markup_text, font_buf, tmp_str, tmp_str_len)) D_MSG("__msg_common_make_normal_markup_text is failed"); if (tmp_str) free(tmp_str); - token = strtok_r(NULL, "\n", &remained_string); if (token) + free(token); + + start += (tmp_buf[start+end] != '\0') ? end + 1 : end; + + if (start != end) eina_strbuf_append(markup_text, "<br>"); } @@ -1562,10 +1582,10 @@ char *msg_common_make_message_detail_text(msg_handle_t msgHandle, int msgId) msg_struct_list_s report_list = {0,}; MSG_DETAIL_REPORT_LIST_S *report_data_list = NULL; msg_struct_t mms_send_opt = NULL; - msg_get_struct_handle(sendOpt, MSG_SEND_OPT_MMS_OPT_HND, &mms_send_opt); - msg_get_bool_value(mms_send_opt, MSG_MMS_SENDOPT_DELIVERY_REPORT_BOOL, &delivery_flag); - msg_get_bool_value(mms_send_opt, MSG_MMS_SENDOPT_READ_REPLY_BOOL, &read_flag); + msg_get_bool_value(sendOpt, MSG_SEND_OPT_DELIVER_REQ_BOOL, &delivery_flag); + msg_get_struct_handle(sendOpt, MSG_SEND_OPT_MMS_OPT_HND, &mms_send_opt); + msg_get_bool_value(mms_send_opt, MSG_MMS_SENDOPTION_READ_REQUEST_BOOL, &read_flag); // getting delivery & read report information if (delivery_flag || read_flag) { |