From 78a6307ce4de2cc1ee9f9bca621239db5273f212 Mon Sep 17 00:00:00 2001 From: SeungWon Lee Date: Thu, 4 Apr 2013 21:45:00 +0900 Subject: [PATCH] Fix N_SE-32099 : zero length string may not save to setting.xml Change-Id: I1fba257362afe98018eec70790a9f83433a44f32 Signed-off-by: SeungWon Lee --- src/app/FApp_AppSettingImpl.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/app/FApp_AppSettingImpl.cpp b/src/app/FApp_AppSettingImpl.cpp index 4502758..949a767 100644 --- a/src/app/FApp_AppSettingImpl.cpp +++ b/src/app/FApp_AppSettingImpl.cpp @@ -948,10 +948,10 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value) { const xmlChar* pPropValue = reinterpret_cast("value"); - std::unique_ptr pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value)); - if (pBuf) + if (value.IsEmpty()) { - xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast(pBuf->GetPointer())); + const xmlChar* pZeroLength = reinterpret_cast(""); + xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, pZeroLength); if (attrPtr) { return true; @@ -959,7 +959,19 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value) } else { - SysLog(NID_APP, "StringToUtf8N is failed."); + std::unique_ptr pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value)); + if (pBuf) + { + xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast(pBuf->GetPointer())); + if (attrPtr) + { + return true; + } + } + else + { + SysLog(NID_APP, "StringToUtf8N is failed."); + } } return false; } -- 2.7.4