merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:55 +0000 (01:16 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:55 +0000 (01:16 +0900)
inc/FWebJsonJsonArray.h
packaging/osp-json.spec
src/FWebJsonJsonArray.cpp
src/FWebJsonJsonObject.cpp
src/FWebJson_JsonWriterImpl.cpp

index 6796284..6c55039 100755 (executable)
@@ -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);
 
index 728ce82..b6e7d12 100755 (executable)
@@ -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
index 03ae0d8..e229517 100644 (file)
@@ -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<JsonValueList> 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<JsonValueList> 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<IJsonValue*>::RemoveAll();
        }
-       //Call Base class function
-       ArrayListT<IJsonValue*>::RemoveAll();
 }
 
 
index 90deea5..e5c1a4a 100644 (file)
@@ -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<JsonKeyList> pKeyList(GetKeysN());
-               SysTryReturnVoidResult(NID_WEB_JSON, pKeyList.get(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+                       unique_ptr<JsonKeyList> 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<const String*, IJsonValue*>::Remove(pKey);
+                               //Remove entry from base class
+                               HashMapT<const String*, IJsonValue*>::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<const String*, IJsonValue*>::RemoveAll();
        }
-       //Call Baseclass function
-       HashMapT<const String*, IJsonValue*>::RemoveAll();
 }
 
 
index e5a4dca..d247c7e 100644 (file)
@@ -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
        {