From: Hwankyu Jhun Date: Fri, 23 Sep 2022 06:06:51 +0000 (+0000) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/unified/20220927.132320~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=2cd1b66bbab34dc032eb988635e453cf8a20d435;p=platform%2Fcore%2Fbase%2Fbundle.git Fix static analysis issues The following issues are fixed: - INEFFECTIVE_MOVE - FORWARD_NULL - ODR_VIOLATION Change-Id: I5a7fcdf7b5e0b5b3e17614a09aaa87ac83be6d80 Signed-off-by: Hwankyu Jhun --- diff --git a/parcel/parcel.cc b/parcel/parcel.cc index 2c3e13f..705fa9b 100644 --- a/parcel/parcel.cc +++ b/parcel/parcel.cc @@ -28,7 +28,7 @@ Parcel::Impl::Impl(Parcel* parent, bool big_endian) : parent_(parent), big_endian_(big_endian) { } -Parcel::Impl::~Impl() = default; +Parcel::Impl::~Impl() {} void Parcel::Impl::Write(const void* buf, uint32_t size) { auto* p = reinterpret_cast(buf); @@ -129,10 +129,10 @@ Parcel::Parcel(const void* buf, uint32_t size, bool big_endian) impl_->Write(buf, size); } -Parcel::~Parcel() = default; +Parcel::~Parcel() {}; Parcel::Parcel(const Parcel& p) - : impl_(new Impl(this)) { + : impl_(new Impl(this)) { impl_->big_endian_ = p.impl_->big_endian_; impl_->data_ = p.impl_->data_; impl_->reader_ = p.impl_->reader_; @@ -147,7 +147,8 @@ Parcel& Parcel::operator = (const Parcel& p) { return *this; } -Parcel::Parcel(Parcel&& p) noexcept { +Parcel::Parcel(Parcel&& p) noexcept + : impl_(new Impl(this)) { impl_ = std::move(p.impl_); impl_->parent_ = this; } diff --git a/src/bundle-internal.cc b/src/bundle-internal.cc index 8b50c7b..8088c60 100644 --- a/src/bundle-internal.cc +++ b/src/bundle-internal.cc @@ -30,8 +30,6 @@ namespace internal { static const int CHECKSUM_LENGTH = 32; -Bundle::Bundle() = default; - Bundle::Bundle(unsigned char* raw, int size, bool base64) { int ret; if (base64) @@ -48,8 +46,6 @@ Bundle::Bundle(int argc, char** argv) { THROW(ret); } -Bundle::~Bundle() = default; - Bundle::Bundle(const Bundle& b) { map_ = b.map_; list_ = b.list_; @@ -121,7 +117,7 @@ void Bundle::Set(const std::string& key, int index, if (iter == map_.end()) THROW(BUNDLE_ERROR_KEY_NOT_AVAILABLE); - int ret = iter->second->SetValue(index, std::move(value)); + int ret = iter->second->SetValue(index, value); if (ret != BUNDLE_ERROR_NONE) THROW(ret); } @@ -286,7 +282,7 @@ std::vector Bundle::Export() { std::unique_ptr base64_bytes_ptr(base64_bytes, g_free); - argv.push_back(std::move(base64_bytes)); + argv.push_back(base64_bytes); } return argv; diff --git a/src/bundle-internal.h b/src/bundle-internal.h index 1b46a73..19813dd 100644 --- a/src/bundle-internal.h +++ b/src/bundle-internal.h @@ -49,10 +49,10 @@ class Bundle { ByteArray = BUNDLE_TYPE_BYTE_ARRAY, }; - Bundle(); + Bundle() = default; Bundle(unsigned char* raw, int size, bool base64 = true); Bundle(int argc, char** argv); - virtual ~Bundle(); + virtual ~Bundle() = default; Bundle(const Bundle& b); Bundle& operator = (const Bundle& b); diff --git a/src/json-internal.cc b/src/json-internal.cc index f658fc7..882af4c 100644 --- a/src/json-internal.cc +++ b/src/json-internal.cc @@ -26,8 +26,6 @@ Json::Json(std::string json) : json_(std::move(json)) { Json::Json(Bundle* b) : b_(b) { } -Json::~Json() = default; - Bundle* Json::ToBundle() { if (json_.empty()) return nullptr; diff --git a/src/json-internal.h b/src/json-internal.h index 61572da..a1f175a 100644 --- a/src/json-internal.h +++ b/src/json-internal.h @@ -32,7 +32,7 @@ class Json { public: explicit Json(std::string json); explicit Json(Bundle* b); - virtual ~Json(); + virtual ~Json() = default; Bundle* ToBundle(); std::string ToString(); diff --git a/src/key-info-internal.cc b/src/key-info-internal.cc index e89ac79..e7c7f6f 100644 --- a/src/key-info-internal.cc +++ b/src/key-info-internal.cc @@ -48,8 +48,6 @@ KeyInfo::KeyInfo(std::vector encoded_bytes) { THROW(ret); } -KeyInfo::~KeyInfo() = default; - KeyInfo::KeyInfo(const KeyInfo& key_info) { type_ = key_info.type_; key_ = key_info.key_; diff --git a/src/key-info-internal.h b/src/key-info-internal.h index 9fa1e24..b26ba5b 100644 --- a/src/key-info-internal.h +++ b/src/key-info-internal.h @@ -31,7 +31,7 @@ class KeyInfo { KeyInfo(int type, std::string key, std::vector> values); explicit KeyInfo(std::vector encoded_bytes); - virtual ~KeyInfo(); + virtual ~KeyInfo() = default; KeyInfo(const KeyInfo& key_info); KeyInfo& operator = (const KeyInfo& key_info);