From: Jinkun Jang Date: Fri, 15 Mar 2013 16:16:55 +0000 (+0900) Subject: merge with master X-Git-Tag: 2.1b_release~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9aaf5d5ad9141959c4bbeee48ff252413efd0fcd;p=framework%2Fosp%2Fjson.git merge with master --- diff --git a/inc/FWebJsonJsonArray.h b/inc/FWebJsonJsonArray.h index 6796284..6c55039 100755 --- a/inc/FWebJsonJsonArray.h +++ b/inc/FWebJsonJsonArray.h @@ -286,7 +286,9 @@ public: * else @c false * @exception E_SUCCESS The method is successful. * @exception E_OBJ_NOT_FOUND The @c pJsonValue is not found. - * @see Add(), RemoveAt(), RemoveAll() + * @see Add() + * @see RemoveAt() + * @see RemoveAll() */ virtual result Remove(IJsonValue* const& pJsonValue, bool deallocate = false); diff --git a/packaging/osp-json.spec b/packaging/osp-json.spec index 728ce82..b6e7d12 100755 --- a/packaging/osp-json.spec +++ b/packaging/osp-json.spec @@ -3,7 +3,7 @@ Name: osp-json Summary: osp json library -Version: 1.2.0.0 +Version: 1.2.1.0 Release: 2 Group: System/Libraries License: TO_BE/FILLED_IN diff --git a/src/FWebJsonJsonArray.cpp b/src/FWebJsonJsonArray.cpp index 03ae0d8..e229517 100644 --- a/src/FWebJsonJsonArray.cpp +++ b/src/FWebJsonJsonArray.cpp @@ -368,27 +368,27 @@ JsonArray::RemoveItems(int startIndex, int count, bool deallocate) void JsonArray::RemoveAll(bool deallocate) { - ClearLastResult(); - int count = GetCount(); - SysTryReturnVoidResult(NID_WEB_JSON, count > 0, E_SUCCESS, "[E_SUCCESS] Count is zero."); - if (deallocate == true) + if (count > 0) { - unique_ptr pList(GetItemsN(0, count)); - SysTryReturnVoidResult(NID_WEB_JSON, pList.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - result r = E_SUCCESS; - for (int i = count-1; i >= 0 ; i--) + if (deallocate == true) { - IJsonValue* pValue = null; - r = pList->GetAt(i, pValue); - SysTryReturnVoidResult(NID_WEB_JSON, pValue, r, "[%s] Propagating.", GetErrorMessage(r)); - - _JsonUtils::DeallocateItem(pValue); + unique_ptr pList(GetItemsN(0, count)); + SysTryReturnVoidResult(NID_WEB_JSON, pList.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + result r = E_SUCCESS; + for (int i = count-1; i >= 0 ; i--) + { + IJsonValue* pValue = null; + r = pList->GetAt(i, pValue); + SysTryReturnVoidResult(NID_WEB_JSON, pValue, r, "[%s] Propagating.", GetErrorMessage(r)); + + _JsonUtils::DeallocateItem(pValue); + } } + //Call Base class function + ArrayListT::RemoveAll(); } - //Call Base class function - ArrayListT::RemoveAll(); } diff --git a/src/FWebJsonJsonObject.cpp b/src/FWebJsonJsonObject.cpp index 90deea5..e5c1a4a 100644 --- a/src/FWebJsonJsonObject.cpp +++ b/src/FWebJsonJsonObject.cpp @@ -358,43 +358,39 @@ JsonObject::Remove(const String* const& pKey, bool deallocate) void JsonObject::RemoveAll(bool deallocate) { - ClearLastResult(); - int paircount = GetCount(); - if (paircount <= 0) - { - return; - } - - if (deallocate == true) + if (paircount > 0) { - const String* pKey = null; - IJsonValue* pValue = null; + if (deallocate == true) + { + const String* pKey = null; + IJsonValue* pValue = null; - unique_ptr pKeyList(GetKeysN()); - SysTryReturnVoidResult(NID_WEB_JSON, pKeyList.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + unique_ptr pKeyList(GetKeysN()); + SysTryReturnVoidResult(NID_WEB_JSON, pKeyList.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); - result r = E_SUCCESS; - for (int i = 0; i < paircount; i++) - { - //get value and key - r = pKeyList->GetAt(i, pKey); - SysTryReturnVoidResult(NID_WEB_JSON, pKey, r, "[%s] Propagating.", GetErrorMessage(r)); + result r = E_SUCCESS; + for (int i = 0; i < paircount; i++) + { + //get value and key + r = pKeyList->GetAt(i, pKey); + SysTryReturnVoidResult(NID_WEB_JSON, pKey, r, "[%s] Propagating.", GetErrorMessage(r)); - r = GetValue(pKey, pValue); - SysTryReturnVoidResult(NID_WEB_JSON, pValue, r, "[%s] Propagating.", GetErrorMessage(r)); + r = GetValue(pKey, pValue); + SysTryReturnVoidResult(NID_WEB_JSON, pValue, r, "[%s] Propagating.", GetErrorMessage(r)); - //Remove entry from base class - HashMapT::Remove(pKey); + //Remove entry from base class + HashMapT::Remove(pKey); - //free key and value memory - delete pKey; - _JsonUtils::DeallocateItem(pValue); + //free key and value memory + delete pKey; + _JsonUtils::DeallocateItem(pValue); + } } + //Call Baseclass function + HashMapT::RemoveAll(); } - //Call Baseclass function - HashMapT::RemoveAll(); } diff --git a/src/FWebJson_JsonWriterImpl.cpp b/src/FWebJson_JsonWriterImpl.cpp index e5a4dca..d247c7e 100644 --- a/src/FWebJson_JsonWriterImpl.cpp +++ b/src/FWebJson_JsonWriterImpl.cpp @@ -134,8 +134,11 @@ _JsonWriterImpl::Compose(const IJsonValue* pValue, ByteBuffer& buffer) } buffer.Clear(); + r = buffer.CopyFrom(*pByteBuf); SysTryReturn(NID_WEB_JSON, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + buffer.Flip(); } else {