From 9e5f41ed6ebe64a789916794626485460078c420 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Sat, 19 Jan 2019 01:29:33 +0100 Subject: - Code style fix - Improved vpp binary api interface - Correction in object pool destructor - Fix error in Memif Connector Change-Id: Id1dd9219fc1ac0b3717ae019ebff17373bebc635 Signed-off-by: Mauro Sardara --- .../manifest_format_json_libparc_deprecated.cc | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) mode change 100755 => 100644 libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc (limited to 'libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc') diff --git a/libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc b/libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc old mode 100755 new mode 100644 index d0365d2fe..a3a47e62b --- a/libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc +++ b/libtransport/src/hicn/transport/core/manifest_format_json_libparc_deprecated.cc @@ -29,23 +29,23 @@ namespace core { namespace { template -TRANSPORT_ALWAYS_INLINE void checkPointer(T* pointer) { +TRANSPORT_ALWAYS_INLINE void checkPointer(T *pointer) { if (pointer == nullptr) { throw errors::NullPointerException(); } } template -TRANSPORT_ALWAYS_INLINE void setValueToJson(PARCJSON* root, EnumType value) { +TRANSPORT_ALWAYS_INLINE void setValueToJson(PARCJSON *root, EnumType value) { parcJSON_AddInteger(root, JSONKey::key, static_cast(value)); } template -TRANSPORT_ALWAYS_INLINE EnumType getValueFromJson(PARCJSON* root) { +TRANSPORT_ALWAYS_INLINE EnumType getValueFromJson(PARCJSON *root) { checkPointer(root); - PARCJSONValue* value = parcJSON_GetValueByName(root, JSONKey::key); + PARCJSONValue *value = parcJSON_GetValueByName(root, JSONKey::key); EnumType ret = static_cast(parcJSONValue_GetInteger(value)); // parcJSONValue_Release(&value); @@ -65,17 +65,17 @@ JSONManifestEncoder::~JSONManifestEncoder() { } } -TRANSPORT_ALWAYS_INLINE SONManifestEncoder& JSONManifestEncoder::encodeImpl( - Packet& packet) { - char* json_string = parcJSON_ToString(root_); - packet.setPayload(reinterpret_cast(json_string), +TRANSPORT_ALWAYS_INLINE SONManifestEncoder &JSONManifestEncoder::encodeImpl( + Packet &packet) { + char *json_string = parcJSON_ToString(root_); + packet.setPayload(reinterpret_cast(json_string), std::strlen(json_string)); parcMemory_Deallocate(&json_string); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& JSONManifestEncoder::clearImpl() { +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder &JSONManifestEncoder::clearImpl() { if (root_) { parcJSON_Release(&root_); } @@ -85,35 +85,35 @@ TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& JSONManifestEncoder::clearImpl() { return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::setHashAlgorithmImpl(HashAlgorithm algorithm) { setValueToJson(root_, algorithm); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::setManifestTypeImpl(ManifestType manifest_type) { setValueToJson(root_, manifest_type); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::setNextSegmentCalculationStrategyImpl( NextSegmentCalculationStrategy strategy) { setValueToJson(root_, strategy); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& -JSONManifestEncoder::setBaseNameImpl(const core::Name& base_name) { +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & +JSONManifestEncoder::setBaseNameImpl(const core::Name &base_name) { parcJSON_AddString(root_, JSONKey::key, base_name.toString().c_str()); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::addSuffixAndHashImpl(uint32_t suffix, - utils::CryptoHash& hash) { + utils::CryptoHash &hash) { throw errors::NotImplementedException(); // PARCJSONValue *value = parcJSON_GetValueByName(root_, // JSONKey::key); @@ -151,17 +151,17 @@ JSONManifestEncoder::addSuffixAndHashImpl(uint32_t suffix, return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::setIsFinalManifestImpl(bool is_last) { parcJSON_AddBoolean(root_, JSONKey::final_manifest, is_last); return *this; } -TRANSPORT_ALWAYS_INLINE JSONManifestEncoder& +TRANSPORT_ALWAYS_INLINE JSONManifestEncoder & JSONManifestEncoder::setSuffixHashListImpl( - const SuffixHashList& name_hash_list) { - for (auto& suffix : name_hash_list) { + const SuffixHashList &name_hash_list) { + for (auto &suffix : name_hash_list) { addSuffixAndHashImpl(suffix.first, suffix.second); } @@ -178,18 +178,18 @@ TRANSPORT_ALWAYS_INLINE JSONManifestDecoder::~JSONManifestDecoder() { } TRANSPORT_ALWAYS_INLINE void JSONManifestDecoder::decodeImpl( - const uint8_t* payload, std::size_t payload_size) { - PARCBuffer* b = parcBuffer_Wrap(const_cast(payload), payload_size, + const uint8_t *payload, std::size_t payload_size) { + PARCBuffer *b = parcBuffer_Wrap(const_cast(payload), payload_size, 0, payload_size); clearImpl(); root_ = parcJSON_ParseBuffer(b); parcBuffer_Release(&b); - char* str = parcJSON_ToString(root_); + char *str = parcJSON_ToString(root_); } -TRANSPORT_ALWAYS_INLINE JSONManifestDecoder& JSONManifestDecoder::clearImpl() { +TRANSPORT_ALWAYS_INLINE JSONManifestDecoder &JSONManifestDecoder::clearImpl() { if (root_) { parcJSON_Release(&root_); } @@ -261,11 +261,11 @@ JSONManifestDecoder::getSuffixHashListImpl() { TRANSPORT_ALWAYS_INLINE core::Name JSONManifestDecoder::getBaseNameImpl() const { checkPointer(root_); - PARCJSONValue* value = + PARCJSONValue *value = parcJSON_GetValueByName(root_, JSONKey::key); - PARCBuffer* b = parcJSONValue_GetString(value); - char* string = parcBuffer_ToString(b); + PARCBuffer *b = parcJSONValue_GetString(value); + char *string = parcBuffer_ToString(b); core::Name ret(string); @@ -277,7 +277,7 @@ TRANSPORT_ALWAYS_INLINE core::Name JSONManifestDecoder::getBaseNameImpl() TRANSPORT_ALWAYS_INLINE bool JSONManifestDecoder::getIsFinalManifestImpl() { checkPointer(root_); - PARCJSONValue* value = + PARCJSONValue *value = parcJSON_GetValueByName(root_, JSONKey::final_manifest); bool ret = parcJSONValue_GetBoolean(value); -- cgit 1.2.3-korg