From c949929a5d746b3e56e04a9927c65070748bf368 Mon Sep 17 00:00:00 2001 From: Dinesh Dwivedi Date: Mon, 1 Apr 2013 22:53:20 +0530 Subject: [PATCH] Updated GSM encoding code to handle terminating null Change-Id: Ic9cdee53563330afa36f11692201b826d494dfe5 Signed-off-by: Dinesh Dwivedi --- src/text/FText_GsmEncodingCore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/text/FText_GsmEncodingCore.cpp b/src/text/FText_GsmEncodingCore.cpp index 53146f1..7805c16 100644 --- a/src/text/FText_GsmEncodingCore.cpp +++ b/src/text/FText_GsmEncodingCore.cpp @@ -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; -- 2.7.4