Merge "[3.0][ACR]Modify IteratorT/RandomIteratorT/PairIteratorT to satisfy the reqire...
[platform/framework/native/appfw.git] / src / text / FText_EncodingImpl.cpp
index c5ae8f4..92471e2 100644 (file)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
@@ -133,7 +132,7 @@ _EncodingImpl::Encode(const wchar_t* pSrc, int srcLength, ByteBuffer*& pByteBuff
 
        std::unique_ptr<byte[]> pDst(__pEncodingCore->EncodeN(pSrc, srcLength, retLength));
        r = GetLastResult();
-       SysTryReturnResult(NID_TEXT, (pDst != null), r, "[%s] Decoding failed", GetErrorMessage(r));
+       SysTryReturnResult(NID_TEXT, (pDst != null), r, "[%s] Encoding failed", GetErrorMessage(r));
 
        ByteBuffer* pOutBuffer = pByteBuffer;
        if (retLength > 0)
@@ -538,21 +537,18 @@ _EncodingImpl::GetAvailableEncodingsImplN(void)
        ClearLastResult();
        result r = E_SUCCESS;
 
-       std::unique_ptr<LinkedList, AllElementsDeleter> pList(new (std::nothrow) LinkedList());
+       std::unique_ptr< LinkedList > pList(new (std::nothrow) LinkedList(SingleObjectDeleter));
 
        SysTryReturn(NID_TEXT, pList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
 
        for (int i = 0; i < AVAILABLE_ENCODING_COUNT; i++)
        {
-               String* pEncodingStr = new (std::nothrow) String(availableEncodings[i]);
+               std::unique_ptr< String > pEncodingStr(new (std::nothrow) String(availableEncodings[i]));
                SysTryReturn(NID_TEXT, pEncodingStr, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
 
-               r = pList->Add(*pEncodingStr);
-               if(IsFailed(r))
-               {
-                       delete pEncodingStr;
-                       SysTryReturn(NID_TEXT, !IsFailed(r), null, r, "[%s] Unable to add encoding to list", GetErrorMessage(r));
-               }
+               r = pList->Add(*(pEncodingStr.get()));
+               SysTryReturn(NID_TEXT, !IsFailed(r), null, r, "[%s] Unable to add encoding to list", GetErrorMessage(r));
+               pEncodingStr.release();
        }
 
        return pList.release();