From: Kyeonghun Lee Date: Wed, 23 Nov 2016 10:38:03 +0000 (+0900) Subject: crash issue on 64bit environment fixed X-Git-Tag: submit/tizen_3.0/20161124.052156~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c445232714a542ac0ba5f0634730819477568cec;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git crash issue on 64bit environment fixed Change-Id: I1e0ee95b6356c3f175d0383e65d4f1e5eb3e622d Signed-off-by: Kyeonghun Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aabf9a..f5bea00 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ ADD_DEFINITIONS(-DTZ_SYS_RO_APP_PATH="${TZ_SYS_RO_APP}") ADD_DEFINITIONS(-DTZ_SYS_GLOBALUSER_DATA_PATH="${TZ_SYS_GLOBALUSER_DATA}") ADD_DEFINITIONS(-DTZ_SYS_GLOBALUSER_DB_PATH="${TZ_SYS_GLOBALUSER_DB}") ADD_DEFINITIONS(-DTZ_SYS_HOME_PATH="${TZ_SYS_HOME}") +ADD_DEFINITIONS(-DLIBDIR="${LIBDIR}") CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) diff --git a/include/framework/MsgPluginManager.h b/include/framework/MsgPluginManager.h index 25ec2ff..585ba09 100755 --- a/include/framework/MsgPluginManager.h +++ b/include/framework/MsgPluginManager.h @@ -94,8 +94,8 @@ typedef struct { } MSG_PLG_TABLE_T; static const MSG_PLG_TABLE_T __msg_plg_items[] = { - { MSG_SMS_TYPE, "/usr/lib/libmsg_sms_plugin.so" }, - { MSG_MMS_TYPE, "/usr/lib/libmsg_mms_plugin.so" } + { MSG_SMS_TYPE, LIBDIR"/libmsg_sms_plugin.so" }, + { MSG_MMS_TYPE, LIBDIR"/libmsg_mms_plugin.so" } }; diff --git a/packaging/msg-service.spec b/packaging/msg-service.spec index 531f279..06d18f3 100755 --- a/packaging/msg-service.spec +++ b/packaging/msg-service.spec @@ -134,6 +134,7 @@ Description: Message manager application %define APP_LOCALEDIR %{APP_RESDIR}/locale %define APP_MANIFESTDIR %{TZ_SYS_RO_PACKAGES} %endif +%define LIBDIR %{_libdir} %prep %setup -q diff --git a/utils/MsgTextConvert.cpp b/utils/MsgTextConvert.cpp index cf0639f..ffb3e61 100755 --- a/utils/MsgTextConvert.cpp +++ b/utils/MsgTextConvert.cpp @@ -469,10 +469,10 @@ return : */ int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen) { - int textLen; + gsize textLen; unsigned char *unicodeTemp = (unsigned char*)pDestText; - int ucs2Length = 0; - int remainedBuffer = maxLength; + gsize ucs2Length = 0; + gsize remainedBuffer = maxLength; #ifdef CONVERT_DUMP int srcLen = srcTextLen; @@ -618,7 +618,8 @@ return : */ int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen) { - int remainedBuffer = maxLength; + gsize textLen; + gsize remainedBuffer = maxLength; int utf8Length; #ifdef CONVERT_DUMP @@ -632,13 +633,20 @@ int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLe return false; } + if ( srcTextLen == -1 ) { + textLen = strlen((char*)pSrcText); + srcTextLen = textLen; + } else { + textLen = srcTextLen; + } + GIConv cd; int err = 0; cd = g_iconv_open("UTF8", "UTF16BE"); if (cd > 0) { - err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); + err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer); } if (err != 0) @@ -661,7 +669,8 @@ int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLe int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen) { - int remainedBuffer = maxLength; + gsize textLen; + gsize remainedBuffer = maxLength; int utf8Length; #ifdef CONVERT_DUMP @@ -675,13 +684,20 @@ int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxL return false; } + if ( srcTextLen == -1 ) { + textLen = strlen((char*)pSrcText); + srcTextLen = textLen; + } else { + textLen = srcTextLen; + } + GIConv cd; int err = 0; cd = g_iconv_open("UTF8", "EUCKR"); if (cd > 0) { - err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); + err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer); } MSG_DEBUG("g_iconv() return value = %d", err); @@ -703,7 +719,8 @@ int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxL int MsgTextConvert::convertSHIFTJISToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen) { - int remainedBuffer = maxLength; + gsize textLen; + gsize remainedBuffer = maxLength; int utf8Length; #ifdef CONVERT_DUMP @@ -717,13 +734,20 @@ int MsgTextConvert::convertSHIFTJISToUTF8(OUT unsigned char *pDestText, IN int m return false; } + if ( srcTextLen == -1 ) { + textLen = strlen((char*)pSrcText); + srcTextLen = textLen; + } else { + textLen = srcTextLen; + } + GIConv cd; int err = 0; cd = g_iconv_open("UTF8", "SHIFT-JIS"); if (cd > 0) { - err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer); + err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer); } MSG_DEBUG("g_iconv() return value = %d", err);