Updated GSM encoding code to handle terminating null
authorDinesh Dwivedi <dinesh.d@samsung.com>
Mon, 1 Apr 2013 17:23:20 +0000 (22:53 +0530)
committerso.yu <so.yu@samsung.com>
Tue, 2 Apr 2013 11:34:47 +0000 (20:34 +0900)
Change-Id: Ic9cdee53563330afa36f11692201b826d494dfe5
Signed-off-by: Dinesh Dwivedi <dinesh.d@samsung.com>
src/text/FText_GsmEncodingCore.cpp

index 53146f1..7805c16 100644 (file)
@@ -191,7 +191,7 @@ _GsmEncodingCore::GetCharCount(const byte* pSrc, int srcLength, int& retLength)
                byte* pGsmByte = (byte*) pSrc;
                while (srcLength > 1)
                {
-                       SysTryReturnResult(NID_TEXT, not (*pGsmByte & 0x80), E_INVALID_ENCODING_RANGE, 
+                       SysTryReturnResult(NID_TEXT, not (*pGsmByte & 0x80), E_INVALID_ENCODING_RANGE,
                                        "[%s] Encoding failed. String contains code pointing outside of bounds by GSM encdoing.", GetErrorMessage(E_INVALID_ENCODING_RANGE));
                        if (*pGsmByte == 0x1B)
                        {
@@ -289,6 +289,7 @@ _GsmEncodingCore::EncodeN(const wchar_t* pSrc, int srcLength, int& retLength)
 wchar_t*
 _GsmEncodingCore::DecodeN(const byte* pSrc, int srcLength, int& retLength)
 {
+       // 0 in GSM is mapped to 0x40 ['@'] in UNICODE, following code is to handle terminating null.
        if (srcLength > 1 && pSrc && pSrc[srcLength - 1] == '\0')
        {
                --srcLength;