crash issue on 64bit environment fixed 00/99600/1
authorKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 23 Nov 2016 10:38:03 +0000 (19:38 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 23 Nov 2016 10:38:03 +0000 (19:38 +0900)
Change-Id: I1e0ee95b6356c3f175d0383e65d4f1e5eb3e622d
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
CMakeLists.txt
include/framework/MsgPluginManager.h
packaging/msg-service.spec
utils/MsgTextConvert.cpp

index 7aabf9a..f5bea00 100755 (executable)
@@ -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)
index 25ec2ff..585ba09 100755 (executable)
@@ -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" }
 };
 
 
index 531f279..06d18f3 100755 (executable)
@@ -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
index cf0639f..ffb3e61 100755 (executable)
@@ -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);