From: Joohyun Kim Date: Tue, 21 May 2013 01:09:07 +0000 (+0900) Subject: Optimize font change code X-Git-Tag: accepted/tizen/20130912.081851^2~314^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b2239a08c0211bf39a4b3eb3212b19061e8dcac;p=platform%2Fframework%2Fnative%2Fappfw.git Optimize font change code Change-Id: I74a2a123a59ecceb1e2723b7d92cf9fe4f9219f8 Signed-off-by: Joohyun Kim --- diff --git a/src/system/FSys_SettingInfoImpl.cpp b/src/system/FSys_SettingInfoImpl.cpp index 34f1ee0..bea42de 100644 --- a/src/system/FSys_SettingInfoImpl.cpp +++ b/src/system/FSys_SettingInfoImpl.cpp @@ -18,6 +18,7 @@ * @file FSys_SettingInfoImpl.cpp * @brief This is the implementation file for _SysSettingInfoImpl class. */ +#include #include #include @@ -28,8 +29,11 @@ #include #include #include + #include "FSys_SettingClient.h" +using namespace std; + using namespace Tizen::App; using namespace Tizen::Base; using namespace Tizen::Base::Collection; @@ -477,15 +481,14 @@ _SettingInfoImpl::SetValueForFont(const Tizen::Base::String& key, Tizen::Base::S } else if(key == _FONT_TYPE) { - char* pFontType = null; int res = 0; r = E_SUCCESS; - pFontType = _StringConverter::CopyToCharArrayN(value); - SysTryReturnResult(NID_SYS, pFontType != null, E_SYSTEM, "It is failed to convert String to string."); - SysLog(NID_SYS, "Requested font type is %s.", pFontType); - res = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, pFontType); - delete [] pFontType; + unique_ptr pFontType(_StringConverter::CopyToCharArrayN(value)); + SysTryReturnResult(NID_SYS, pFontType.get() != null, E_SYSTEM, "It is failed to convert String to string."); + SysLog(NID_SYS, "Requested font type is %s.", pFontType.get()); + res = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_FONT_TYPE, pFontType.get()); + SysTryReturnResult(NID_SYS, res != SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, E_INVALID_ARG, "It is not valid font type."); SysTryReturnResult(NID_SYS, res == SYSTEM_SETTINGS_ERROR_NONE, E_SYSTEM, "It is failed to set font type."); } return r;