Use bundle_init_byte_array instead of bundle_add_byte_array 71/211571/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 6 Aug 2019 23:14:26 +0000 (08:14 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 7 Aug 2019 09:29:36 +0000 (18:29 +0900)
The bundle_add_byte_array function will be changed.

Requires:
 - https://review.tizen.org/gerrit/#/c/platform/core/base/bundle/+/211570/

Change-Id: I1465f336564da1fe3081dc02e09637422849ca7e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/common/json-utils.cc
src/common/ut/json-utils.cc
src/messageport/messageport_instance.cc

index 8d52373..59f7209 100644 (file)
@@ -81,7 +81,7 @@ int BundleAddByteStreamArray(const std::string& key, const picojson::value& valu
     bytes_array.push_back(JsonArrayToByteStream(elem.get<picojson::array>()));
   }
 
-  int ret = bundle_add_byte_array(bundle_data, key.c_str(), nullptr, bytes_array.size());
+  int ret = bundle_init_byte_array(bundle_data, key.c_str(), bytes_array.size());
   if (BUNDLE_ERROR_NONE != ret) {
     return ret;
   }
index 935b776..13cdcb0 100644 (file)
@@ -366,7 +366,7 @@ TEST_F(BundleToJsonTest, BytesArrayConversion) {
   string key = "key";
   vector<vector<unsigned char>> value = {{0, 126, 255}, {1, 127, 254}};
 
-  ASSERT_EQ(bundle_add_byte_array(bundleData, key.c_str(), nullptr, value.size()),
+  ASSERT_EQ(bundle_init_byte_array(bundleData, key.c_str(), value.size()),
             BUNDLE_ERROR_NONE);
   ASSERT_EQ(
       bundle_set_byte_array_element(bundleData, key.c_str(), 0, value[0].data(), value[0].size()),
index eb66d20..e6781e2 100644 (file)
@@ -319,9 +319,9 @@ void MessageportInstance::RemoteMessagePortSendmessage(const picojson::value& ar
       LoggerD("value is byte stream array");
       std::vector<picojson::value> byteStreamArray = (*it).get("value").get<picojson::array>();
       const size_t size = byteStreamArray.size();
-      result = bundle_add_byte_array(bundle, (*it).get("key").to_str().c_str(), nullptr, size);
+      result = bundle_init_byte_array(bundle, (*it).get("key").to_str().c_str(), size);
       if (BUNDLE_ERROR_NONE != result) {
-        LoggerE("bundle_add_byte_array failed, error: %d (%s)", result, get_error_message(result));
+        LoggerE("bundle_init_byte_array failed, error: %d (%s)", result, get_error_message(result));
       }
       size_t i = 0;