[devel_3.0_main] Cherry-pick Beautification of source-code. 80383
[platform/framework/native/appfw.git] / src / base / FBase_StringConverter.cpp
index a586c7c..31c69c5 100644 (file)
 * @file                        FBase_StringConverter.cpp
 * @brief               This is the implementation for _StringConverter class.
 */
-
-#include <stdlib.h>
 #include <new>
 #include <FBaseResult.h>
-#include "FBase_StringConverter.h"
 #include <FBaseSysLog.h>
-
-
+#include "FBase_StringConverter.h"
+#include "FBaseUtil_IcuConverter.h"
 
 namespace Tizen { namespace Base
 {
@@ -39,20 +36,7 @@ _StringConverter::CopyToCharArrayN(const String& str)
 char*
 _StringConverter::CopyToCharArrayN(const wchar_t* pValue)
 {
-       char* pRet = null;
-
-       int len = wcstombs(0, pValue, 0);
-       SysTryReturn(NID_BASE, len != -1, null, E_INVALID_ARG, "[%s] Invalid argument is used. Invalid string.",
-               GetErrorMessage(E_INVALID_ARG));
-
-       pRet = new (std::nothrow) char[len + 1];
-       SysTryReturn(NID_BASE, pRet != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
-               GetErrorMessage(E_OUT_OF_MEMORY));
-
-       len = wcstombs(pRet, pValue, len);
-       pRet[len] = 0;
-
-       return pRet;
+       return Tizen::Base::Utility::WcharToUtf8N(pValue);
 }
 
 }} //Tizen::Base