Merge "Optimising GetHashCode()" into devel_3.0_main
[platform/framework/native/appfw.git] / src / text / FTextEncoding.cpp
index 71561c3..d6a2c5a 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);
@@ -124,17 +123,12 @@ Encoding::GetEncodingN(const Tizen::Base::String& encodingType)
        ClearLastResult();
        result r = E_SUCCESS;
 
-       _EncodingImpl* pEncodingImpl = new (std::nothrow) _EncodingImpl();
+       std::unique_ptr< _EncodingImpl > pEncodingImpl(new (std::nothrow) _EncodingImpl());
        SysTryReturn(NID_TEXT, pEncodingImpl != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
 
        r = pEncodingImpl->Construct(encodingType);
-       SysTryCatch(NID_TEXT, (!IsFailed(r)), , r, "[%s] Encoder construct failed.", GetErrorMessage(r));
-
-       return pEncodingImpl;
-
-CATCH:
-       delete pEncodingImpl;
-       return null;
+       SysTryReturn(NID_TEXT, !IsFailed(r), null, r , "[%s] Encoder construct failed.", GetErrorMessage(r));
+       return pEncodingImpl.release();
 }
 
 String