Fix the svace and coverity issue 89/315689/8 accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.232037 accepted/tizen/unified/20240821.081502 accepted/tizen/unified/dev/20240822.230400 accepted/tizen/unified/toolchain/20241004.101755 accepted/tizen/unified/x/20240822.014253 accepted/tizen/unified/x/asan/20241014.000130 tizen_9.0_m2_release
authorYoungHun Kim <yh8004.kim@samsung.com>
Tue, 6 Aug 2024 07:00:36 +0000 (16:00 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Tue, 20 Aug 2024 03:22:24 +0000 (12:22 +0900)
 - UNINIT.CTOR.MANY COMPARE_RESULT_OF_NEW etc

Change-Id: Ia0302a06605aec731f3b970ad443486a6c66c7f6

31 files changed:
include_internal/CImageCodec.h
include_internal/CModelInfo.h
include_internal/CMultiview.h
include_internal/CResourceInfo.h
include_internal/CResourceInfoDB.h
include_internal/CVideoCapability.h
include_internal/CVideoCodecNDecoding.h
include_internal/CVideoEncoder.h
include_internal/parser/CCategory.h
include_internal/parser/CResourceTableProviderDefault.h
include_internal/parser/CResourceTableProviderLicense.h
include_internal/parser/element/CCapabilityElement.h
include_internal/parser/element/CCategoryElement.h
include_internal/parser/element/CDecodingElement.h
include_internal/parser/element/CElement.h
packaging/resource-information.spec
src/CImageCodec.cpp
src/CModelInfo.cpp
src/CMultiview.cpp
src/CResourceInfo.cpp
src/CResourceInfoDB.cpp
src/CVideoCodec.cpp
src/CVideoResolution.cpp
src/parser/CResourceTableProviderDefault.cpp
src/parser/element/CCategoryElement.cpp
src/parser/element/CElement.cpp
src/parser/element/CResourceInfoDoc.cpp
src/parser/ri-resource-info-dbmaker.cpp
src/parser/ri-resource-info-parser.cpp
src/ri-api.cpp
src/ri-video-capability.cpp

index 445a84fcc28d9d66f54a6373cd9a5a1b1a18f6a2..a3c7d1d360a88763fdc68b5ab3b3f7289602a667 100644 (file)
@@ -21,7 +21,7 @@
 
 class CImageCodec {
 public:
-       CImageCodec(std::string name);
+       CImageCodec(std::string name) : m_name(name) {}
        ~CImageCodec();
 
        void SetMaxResolution(int w, int h) { m_width_max = w, m_height_max = h; }
@@ -31,10 +31,10 @@ public:
 
 private:
        std::string m_name;
-       int m_width_max;
-       int m_height_max;
-       int m_width_min;
-       int m_height_min;
+       int m_width_max {};
+       int m_height_max {};
+       int m_width_min {};
+       int m_height_min {};
 };
 
 #endif// __CIMAGE_CODEC_H__
index fd98baf6566c93d7054a49e5b4e07fe71d3763e0..6102e96906de0917de657243ad9cfdac94cc2974 100644 (file)
@@ -51,8 +51,8 @@ private:
        int ReadIndex(std::string filename) const;
        std::string GetChipSetName(void);
 
-       bool m_has_dedicated_category_h264_fhd_portrait;
-       bool m_exclusive_bw_for_h264_fhd_n_decoding;
+       bool m_has_dedicated_category_h264_fhd_portrait {};
+       bool m_exclusive_bw_for_h264_fhd_n_decoding {};
 
        std::string m_chipset_name;
        std::map<std::string, eChipSet> m_chipset_info;
index 68d476f9b7eac3089b2321dbf76630077ccecc4a..13da5d79cdc466b5a4260f37a29e72fbccf981b9 100644 (file)
@@ -55,7 +55,7 @@ private:
        void Init(void);
        void SetPolicy(const int strategy, const ReclaimPolicy reclaim, const InterlacedPlayback interlaced, const SeamlessPlayback seamless, const AV1DualDecoding dual_decoding);
 
-       int strategy_;
+       int strategy_ {};
        ReclaimPolicy reclaim_policy_;
        InterlacedPlayback interlaced_playback_;
        SeamlessPlayback seamless_playback_;
index 441306d9386ccfda59cab31c6413e734b36dd5e1..bc1285af296775a3aa8fc705c38f4a19737ca850 100644 (file)
@@ -25,8 +25,8 @@
 class CResourceInfo
 {
 public:
-       CResourceInfo();
-       ~CResourceInfo();
+       CResourceInfo() {}
+       ~CResourceInfo() {};
 
        static CResourceInfo* GetInstance(void);
        ri_rsc_category_e GetVideoCategoryID(const char *codec_name, int color_depth, int h_size, int framerate, int sampling_format);
@@ -39,7 +39,7 @@ public:
        int GetCapableAudioDecoderCategoryID(ri_audio_category_option_request_s* option);
 
 private:
-       static CResourceInfom_instance;
+       static CResourceInfo *m_instance;
 
        ri_color_depth GetColorDepthID(int color_depth, int sampling_format);
        ri_framerate GetFrameRateID(int framerate);
index a2017d8ecbd3a05c75888d751174c0808b265dbe..74882b5ba561daeae451fbb1787240e362f293f5 100644 (file)
@@ -44,8 +44,8 @@ class CategoryElement;
 class CResourceInfoDB
 {
 public:
-       CResourceInfoDB();
-       ~CResourceInfoDB();
+       CResourceInfoDB() {}
+       ~CResourceInfoDB() {}
        static CResourceInfoDB* GetInstance(void);
 
        ri_rsc_category_e IsSupportedVideoFormat(ri_rsc_category_e decoder_id);
@@ -125,7 +125,7 @@ public:
        ri_device_common_attr_s *GetDeviceAttr(int device_id);
 
 private:
-       static CResourceInfoDBm_instance;
+       static CResourceInfoDB *m_instance;
 
        std::map<int, ri_resource_category_s*> m_resource_categories;
        std::map<int, ri_device_common_attr_s*> m_device_attr_map_by_dev_id;
@@ -145,9 +145,9 @@ private:
        std::map<int, CVideoDecoder *> m_video_decoders;
        std::map<std::string, std::vector<VideoCapability *>> video_capabilities_;
 
-       int m_system_bw;
-       int m_vdecs;
-       int m_n_scalers;
+       int m_system_bw {};
+       int m_vdecs {};
+       int m_n_scalers {};
 
        bool GetDeviceNodePathNames(int category, char** device_node);
        bool GetClassOptions(const char *codec, ri_video_decoder_class_e class_value, bool *is_uhd_decoder, int *class_cat, bool *is_class_uhd, char **class_device_node);
@@ -158,6 +158,6 @@ private:
        bool IsScaler(int category);
        void InitVideoDecCategories(void);
        bool IsCodecSupporting2KPortrait(std::string codec_name);
-       CCategoryIdBuilderGetVideoDecCategoryBuilder(std::string codec_name);
+       CCategoryIdBuilder *GetVideoDecCategoryBuilder(std::string codec_name);
 };
 #endif //_RESOURCE_INFO_DB_H_
index 972055645bdb2b5222d0dfc7e7d766cb585a9672..ae7448070cd6aecba3e8578528f38f918eafe506 100644 (file)
@@ -19,8 +19,8 @@
 
 class VideoCapability {
 public:
-       VideoCapability(const std::string device, const int w, const int h, const int fps): device_(device), width_(w), height_(h), fps_(fps) {}
-       VideoCapability(const VideoCapability& capa): device_(""), width_(0), height_(0), fps_(0) {
+       VideoCapability(const std::string device, const int w, const int h, const int fps) : device_(device), width_(w), height_(h), fps_(fps) {}
+       VideoCapability(const VideoCapability& capa) : device_(""), width_(0), height_(0), fps_(0) {
                device_ = capa.GetDeviceProperty();
                width_ = capa.GetWidth();
                height_ = capa.GetHeight();
index 4d93971f8707059135076cc6f3f77b1ad81774ca..f402e647dc4afd61b061781ef96b51596d931aba 100644 (file)
@@ -21,7 +21,8 @@
 class CVideoCodecNDecoding
 {
 public:
-       CVideoCodecNDecoding(std::string codec_name, int rsz, int framerate):m_name(codec_name), m_max_rsz(rsz), m_max_fps(framerate) { }
+       CVideoCodecNDecoding(std::string codec_name, int rsz, int framerate)
+               : m_name(codec_name), m_max_rsz(rsz), m_max_fps(framerate) { }
        ~CVideoCodecNDecoding() = default;
 
        void SetMaxResolution(int rsz) { m_max_rsz = rsz; }
@@ -33,8 +34,8 @@ public:
 
 private:
        std::string m_name;
-       int m_max_rsz;
-       int m_max_fps;
-       int m_category_id;
+       int m_max_rsz {};
+       int m_max_fps {};
+       int m_category_id {};
 };
 #endif //__CVideoCodecNDecoding_H__
index 526f3ad2bcadbf3cf25744616b4cb6f385feb457..a853bc6cbdb80da6bb9140e9a598f6accfdba8a5 100644 (file)
@@ -31,16 +31,16 @@ public:
        unsigned long long GetMaxBandWidthMultiEncodingSingle(void) const;
 
 private:
-       CVideoEncoder():max_w_(0), max_h_(0), max_fps_(0), max_w_multi_(0), max_h_multi_(0), max_fps_multi_(0), margin_(0) {}
+       CVideoEncoder() {}
        ~CVideoEncoder() = default;
 
-       int max_w_;
-       int max_h_;
-       int max_fps_;
-       int max_w_multi_;
-       int max_h_multi_;
-       int max_fps_multi_;
-       int margin_;
+       int max_w_ {};
+       int max_h_ {};
+       int max_fps_ {};
+       int max_w_multi_ {};
+       int max_h_multi_ {};
+       int max_fps_multi_ {};
+       int margin_ {};
 };
 
 #endif //__CVIDEO_ENCODER_H__
\ No newline at end of file
index 37224283868c473d9561c0e1aaf5ce312442a58a..55a2364f731e246aefb5052ffe3b6d80a69f940e 100644 (file)
@@ -45,12 +45,12 @@ public:
 \r
 private:\r
        std::string m_name;\r
-       ri_rsc_category_e m_id;\r
-       category_type_e m_type;\r
+       ri_rsc_category_e m_id {};\r
+       category_type_e m_type {};\r
        std::string m_codec_name;\r
-       ri_resolution m_rsz;\r
-       int m_framerate;\r
-       bool m_n_decoding;\r
+       ri_resolution m_rsz {};\r
+       int m_framerate {};\r
+       bool m_n_decoding {};\r
 };\r
 \r
 #endif//__CCATEGORY_H_\r
index b0ee3060d9e545d4351db4f24008e5f976de00c2..7ad1be3ec775077f73ea78e7d8467b45774ae39c 100644 (file)
 class CResourceTableProviderDefault
 {
 public:
-       CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android);
+       CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android)
+               :table_index_(table_index), product_type_(product_type), support_android_(support_android) {}
        ~CResourceTableProviderDefault() = default;
 
 private:
        std::string FindResourceTablePath(const std::map<int, std::string> &table_paths, const int index) const;
        std::string FindResourceTablePathAOT(const std::map<int, std::string> &table_paths, const int index) const;
 
-       int table_index_;
-       int product_type_;
-       bool support_android_;
+       int table_index_ {};
+       int product_type_ {};
+       bool support_android_ {};
 };
 
 #endif // __CRESOURCE_PROVIDER_TABLE_DEFAULT_H__
index 9d439b147bfc48cea54ce04a908cf3c2326e1e42..174ce3c6dbea21ccae4a576d18f39ba52a74c080 100644 (file)
 class CResourceTableProviderLicense\r
 {\r
 public:\r
-       CResourceTableProviderLicense(const int table_index):table_index_(table_index) {};\r
+       CResourceTableProviderLicense(const int table_index) :table_index_(table_index) {};\r
        ~CResourceTableProviderLicense() = default;\r
 \r
        std::string GetResourceTablePath(void) const;\r
 \r
 private:\r
-       int table_index_;\r
+       int table_index_ {};\r
  };\r
 \r
 #endif //__CRESOURCE_TABLE_PROVIDER_LICENSE_H__\r
index 34e173c97eef371695b40df70cd5edf08e4f86ae..cab3c0260b0aaf1f315a24c0c4abd8c377731c78 100644 (file)
@@ -21,7 +21,7 @@
 
 class CapabilityElement : public Element {
 public:
-       CapabilityElement(const std::string device, const int w, const int h, const int fps): device_(device), width_(w), height_(h), fps_(fps) {};
+       CapabilityElement(const std::string device, const int w, const int h, const int fps) : device_(device), width_(w), height_(h), fps_(fps) {};
        ~CapabilityElement() = default;
 
        std::string GetDevice(void) const { return device_; }
@@ -30,10 +30,10 @@ public:
        int GetFPS(void) const { return fps_; }
 
 private:
-       CapabilityElement(): device_(""), width_(0), height_(0), fps_(0) {};
+       CapabilityElement() {}
 
        std::string device_;
-       int width_;
-       int height_;
-       int fps_;
+       int width_ {};
+       int height_ {};
+       int fps_ {};
 };
\ No newline at end of file
index 6ecfc265a75854efff844525f4f7dcc98a30bcf5..efa048a14a9ce181c250beaebd44d38e4e40e780 100644 (file)
@@ -23,7 +23,7 @@
 class CategoryElement : public Element\r
 {\r
 public:\r
-       CategoryElement(void){}\r
+       CategoryElement(void) : Element() {}\r
        CategoryElement(char *category_name, char *category_type, int class_id, bool is_uhd_device);\r
        ~CategoryElement(void);\r
 \r
@@ -135,8 +135,8 @@ public:
 // LCOV_EXCL_END\r
 \r
 protected:\r
-       ri_rsc_category_e m_promotion_category_enum;\r
-       ri_rsc_category_e m_category_enum;\r
+       ri_rsc_category_e m_promotion_category_enum { RI_CATEGORY_NONE };\r
+       ri_rsc_category_e m_category_enum { RI_CATEGORY_NONE };\r
 private:\r
 };\r
 \r
index a646030fd0a0f7796a2c1b7b1dca8cf58e287646..5b038581e1821cf3120f7eb3679b17c79c049689 100644 (file)
@@ -20,7 +20,7 @@
 
 class DecodingElement : public Element {
 public:
-       DecodingElement(const std::string codec): codec_(codec) {}
+       DecodingElement(const std::string codec) : codec_(codec) {}
        ~DecodingElement();
 
        void SetCodec(const std::string codec) { codec_ = codec; }
@@ -31,7 +31,7 @@ public:
        void ReleaseChildElement(void) override;
 
 private:
-       DecodingElement(): codec_("empty") {}
+       DecodingElement() : codec_("empty") {}
 
        std::string codec_;
 };
\ No newline at end of file
index 3637febf01cdbdf4f56b9535adac6eb63518f105..2f3cbfb7391d687b3255ed50fddb34a36402a6aa 100644 (file)
 class Element\r
 {\r
 public:\r
-       Element(void);\r
-       Element(char *element_name, char *element_type, int class_id, bool is_uhd_device);\r
-       Element(char *element_name, char *element_type);\r
-       Element(char *element_name);\r
+       Element(void) {}\r
+       Element(char *element_name, char *element_type, int class_id, bool is_uhd_device)\r
+               : m_element_name(element_name), m_element_type(element_type), m_class_id(class_id), m_is_uhd_decoder(is_uhd_device) { SetElementAttr(ELEMENT_CATEGORY); }\r
+       Element(char *element_name, char *element_type)\r
+               : m_element_name(element_name), m_element_type(element_type) {}\r
+       Element(char *element_name)\r
+               : m_element_name(element_name) {}\r
        virtual ~Element(void){}\r
 \r
        virtual void SetElementAttr(ri_element_attribute_e element_attr);\r
@@ -67,28 +70,28 @@ public:
        virtual int GetMaxResolution(void) { return m_max_rez; }\r
 \r
 protected:\r
-       ri_element_attribute_e m_element_attr; //category, device, feature\r
-       char *m_element_name;\r
-       char *m_element_type;\r
-       unsigned int m_element_bw;\r
-       ri_mem_cluster_s* m_element_mem_cluster;\r
-       int m_id;\r
-       int m_class_id; //for category\r
+       ri_element_attribute_e m_element_attr { ELEMENT_ROOT }; //category, device, feature\r
+       char *m_element_name {};\r
+       char *m_element_type {};\r
+       unsigned int m_element_bw {};\r
+       ri_mem_cluster_s* m_element_mem_cluster {};\r
+       int m_id {};\r
+       int m_class_id {}; //for category\r
 \r
        std::set<Element*> m_child_element;\r
-       int m_sharable_count;\r
-       int m_mixing;\r
-       bool m_is_uhd_decoder;\r
-       int m_device_id;\r
-       int m_is_main_device;\r
-       int m_max_rez;\r
-       bool m_is_support_overlay;\r
-       int m_max_sampling_format;\r
-       char *m_element_codec_name;\r
+       int m_sharable_count {};\r
+       int m_mixing {};\r
+       bool m_is_uhd_decoder {};\r
+       int m_device_id {};\r
+       int m_is_main_device {};\r
+       int m_max_rez {};\r
+       bool m_is_support_overlay {};\r
+       int m_max_sampling_format {};\r
+       char *m_element_codec_name {};\r
 \r
-       char *m_device_path;\r
-       char *m_omx_comp_name;\r
-       char *m_audio_codec;\r
+       char *m_device_path {};\r
+       char *m_omx_comp_name {};\r
+       char *m_audio_codec {};\r
 \r
 private:\r
 };\r
index 5341b742797b79ea60a0089f9233604eb2dd63b3..ebe781f684ae2d4db2ec5470971afd2491bd9a67 100644 (file)
@@ -1,7 +1,7 @@
 Name:       resource-information
 Summary:    Resource Information
 Version:    0.1
-Release:    1
+Release:    2
 Group:      Multimedia/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index ab560867639679b4ea044969d1c41e04e27119e1..903401fb62d2b24c545b212f861b8cf18ee87288 100644 (file)
 #include <assert.h>
 #include <CImageCodec.h>
 
-CImageCodec::CImageCodec(std::string name)
-{
-       m_name = name;
-}
-
 // LCOV_EXCL_START
 CImageCodec::~CImageCodec()
 {
index 825a0a0042621c6032ecf7f8482e7dd459e2a012..8dc3b96cbcbc8e4b4ae552d210513b5b25d1f0f8 100644 (file)
@@ -39,7 +39,7 @@ CModelInfo& CModelInfo::GetInstance(void)
        return instance_;
 }
 
-CModelInfo::CModelInfo(void): m_has_dedicated_category_h264_fhd_portrait(false), m_exclusive_bw_for_h264_fhd_n_decoding(false)
+CModelInfo::CModelInfo(void) : m_has_dedicated_category_h264_fhd_portrait(false), m_exclusive_bw_for_h264_fhd_n_decoding(false)
 {
        InitFeatures();
 }
index 9e4dba70616a346d36e623bb1abe951949d8a4c8..63dcb84935d9207b3bd5aa284135b544cf932e6a 100644 (file)
@@ -25,7 +25,7 @@
 
 // LCOV_EXCL_START
 
-CMultiview::CMultiview(void):strategy_(RI_MV_STRATEGY_NOT_SUPPORT), reclaim_policy_(ReclaimPolicy::Default), interlaced_playback_(InterlacedPlayback::All), \
+CMultiview::CMultiview(void) : strategy_(RI_MV_STRATEGY_NOT_SUPPORT), reclaim_policy_(ReclaimPolicy::Default), interlaced_playback_(InterlacedPlayback::All),
                                                        seamless_playback_(SeamlessPlayback::All), av1_dual_decoding_(AV1DualDecoding::Support)
 {
        Init();
index eb1a04243819203f9c21bc1f24f924b1c9bd69a5..88b844188e82e6553ef486fd4ec38691bbf0edc0 100644 (file)
 
 CResourceInfo* CResourceInfo::m_instance = NULL;
 
-CResourceInfo::CResourceInfo(void)
-{
-}
-
-CResourceInfo::~CResourceInfo(void){}
-
 CResourceInfo* CResourceInfo::GetInstance(void)
 {
        if (m_instance == NULL) {
@@ -89,19 +83,19 @@ ri_rsc_category_e CResourceInfo::GetCapableVideoCategoryID(std::string codec_nam
 
        int rsz_id = GetResolutionID(width, height, n_decoding, codec_name);
        if (rsz_id == RI_RESOLUTION_UNDEFINED) {
-               RI_ERR("failed to get resolution id codec(%s)/h(%d)/v(%d)\n", codec_name.c_str(), width, height);
+               RI_ERR("failed to get resolution id codec(%s)/h(%d)/v(%d)", codec_name.c_str(), width, height);
                return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
        }
 
        int color_depth_id = GetColorDepthID(color_depth, sampling_format);
        if (color_depth_id == (ri_color_depth) RI_ERROR) {
-               RI_ERR("failed to get color depth id(%d)\n", color_depth_id);
+               RI_ERR("failed to get color depth id(%d)", color_depth_id);
                return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
        }
 
        int framerate_id = GetFrameRateID(framerate);
        if (framerate_id == RI_FRAMERATE_UNDEFINED) {
-               RI_ERR("failed to get framerate(%d)\n",framerate_id);
+               RI_ERR("failed to get framerate(%d)",framerate_id);
                return RI_CATEGORY_VIDEO_DECODER_NOT_SUPPORTED;
        }
 
@@ -121,7 +115,7 @@ ri_rsc_category_e CResourceInfo::GetCapableVideoCategoryID(std::string codec_nam
 // LCOV_EXCL_END
        RI_INFO("n_decoding(%d), category id : %d", n_decoding, category_id);
 
-       return (n_decoding) ? db->IsNDecodingSupportedVideoFormat((ri_rsc_category_e) category_id):db->IsSupportedVideoFormat((ri_rsc_category_e) category_id);
+       return (n_decoding) ? db->IsNDecodingSupportedVideoFormat((ri_rsc_category_e) category_id) :db->IsSupportedVideoFormat((ri_rsc_category_e) category_id);
 }
 
 ri_rsc_category_e CResourceInfo::GetCapableVideoCategoryID(ri_video_category_option_request_s* option, bool n_decoding)
@@ -134,7 +128,7 @@ ri_rsc_category_e CResourceInfo::GetCapableVideoCategoryID(ri_video_property* pr
        ri_rsc_category_e category_id = GetCapableVideoCategoryID(prop->codec_name, prop->width, prop->height, prop->fps, prop->sampling_format, prop->color_depth, n_decoding);
        if (prop->detiled)
                return ToCategoryDedicatedToDetiled(category_id);
-       return (prop->progressive) ? ToCategoryDedicatedToProgressive(category_id):category_id;
+       return (prop->progressive) ? ToCategoryDedicatedToProgressive(category_id) :category_id;
 }
 
 ri_rsc_category_e CResourceInfo::ToCategoryDedicatedToProgressive(ri_rsc_category_e category_id)
@@ -383,7 +377,7 @@ ri_color_depth CResourceInfo::GetColorDepthID(int color_depth, int sampling_form
        } else if (color_depth == 10) { //sampling_format, RI_SAMPLING_FORMAT_OTHERS
                return RI_COLOR_DEPTH_10BIT;
        } else {
-               RI_ERR("unknown color depth (%d)\n", color_depth);
+               RI_ERR("unknown color depth (%d)", color_depth);
                return (ri_color_depth)-1;
        }
 }
@@ -399,7 +393,7 @@ ri_framerate CResourceInfo::GetFrameRateID(int framerate)
        } else if (IS_FRAMERATE_120P(framerate)) {
                framerate_e = RI_FRAMERATE_120;
        } else {
-               RI_ERR("unexpected frame rate (%d)\n", framerate);
+               RI_ERR("unexpected frame rate (%d)", framerate);
        }
 
        return framerate_e;
index 9eeb61723aedd62b64f477604b690f1e4d36e707..8c61506f6e09a725957e35494ede2d03395b21de 100644 (file)
 
 static pthread_mutex_t db_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-CResourceInfoDB::CResourceInfoDB(void)
-{
-       m_system_bw = 0;
-}
-
-CResourceInfoDB::~CResourceInfoDB(void){}
-
 CResourceInfoDB* CResourceInfoDB::m_instance = NULL;
 
 CResourceInfoDB* CResourceInfoDB::GetInstance(void)
@@ -367,7 +360,7 @@ const char *CResourceInfoDB::GetDeviceName(const int device_id)
                if (IsVirtualDeviceIdScaler(device_id)) {
                        name = GetDeviceNameScaler(device_id);
                        RI_INFO("DEVICE ID : %d, DEVICE NAME : %s", device_id, name.c_str());
-                       return strdup(name.c_str());
+                       return name.c_str();
                }
 
                RI_INFO("[NULL] DEVICE ID : %d CANNOT GET NAME", device_id);
index 5bfc2243aca050f7bf00fe0a4b8d347a5585649e..cbc7af1d145e355d8a411b00c7687d11f178195c 100644 (file)
@@ -17,8 +17,8 @@
 #include <ri-debug.h>
 #include <CVideoCodec.h>
 
-CVideoCodec::CVideoCodec(const std::string name, const unsigned int resolution, const int fps, const bool support_2k_portrait):\
-       name_(name), max_resolution_(resolution), max_fps_(fps), support_2k_portrait_(support_2k_portrait), vr360_codec_(false)
+CVideoCodec::CVideoCodec(const std::string name, const unsigned int resolution, const int fps, const bool support_2k_portrait)
+       name_(name), max_resolution_(resolution), max_fps_(fps), support_2k_portrait_(support_2k_portrait), vr360_codec_(false)
 {
        InitResolutions();
        auto it = vr360_codecs_.find(name);
index ca819c9a570f479ee6a192114a388a64822a5c4e..a58c30614b05c2ddc12801e9843eeb8e14c11244 100644 (file)
@@ -39,7 +39,7 @@ static resolution_size_s default_size[] = {
        {7680, 4320, 4320, 7680}  /** RI_RESOLUTION_8K_UHD */
 };
 
-CVideoResolution::CVideoResolution(const unsigned int resolution):resolution_(resolution), w_(0), h_(0), wp_(0), hp_(0)
+CVideoResolution::CVideoResolution(const unsigned int resolution) :resolution_(resolution), w_(0), h_(0), wp_(0), hp_(0)
 {
        if (!ValidResolution(resolution))
                return;
index e5469f302a7ac63a7dc51c0186c6fc3c771bc118..170737d27905c1aaf393a13fbe7195a2bf797fba 100644 (file)
 #include <CResourceTableProvider.h>
 #include <CResourceTableProviderDefault.h>
 
-CResourceTableProviderDefault::CResourceTableProviderDefault(const int table_index, const int product_type, const bool support_android):table_index_(table_index), product_type_(product_type), support_android_(support_android)
-{
-}
-
 std::string CResourceTableProviderDefault::FindResourceTablePath(const std::map<int, std::string> &table_paths, const int index) const
 {
        auto it = table_paths.find(index);
index d4498e1df9a8a519986b05fb52033891ca1bb435..f74b7709ec6ef12e7f0f740e846325bcbb437417 100644 (file)
@@ -24,9 +24,8 @@ CategoryElement::CategoryElement(char *category_name, char *category_type, int c
        m_element_name = category_name;
        m_element_type = category_type;
        m_class_id = class_id;
-       m_id = 0;
-       SetElementAttr(ELEMENT_CATEGORY);
        m_is_uhd_decoder = is_uhd_device;
+       SetElementAttr(ELEMENT_CATEGORY);
 }
 
 CategoryElement::~CategoryElement()
@@ -65,6 +64,6 @@ void CategoryElement::PrintInfo(void)
                else
                        device->PrintInfo();
        }
-       RI_DBG("---------------------------------------------\n");
+       RI_DBG("---------------------------------------------");
 }
 // LCOV_EXCL_STOP
index 335c0885ff161bf883a721c0a47b2c98cf41b141..f964a9732fa7e2fd44d324af90808e28377af69e 100644 (file)
 #include <cstddef>
 #include <CElement.h>
 
-
-Element::Element(void):m_element_name(NULL), m_element_type(NULL), m_class_id(0)
-{}
-
-Element::Element(char *element_name, char *element_type, int class_id, bool is_uhd_device)
-:m_element_name(element_name), m_element_type(element_type), m_class_id(class_id), m_is_uhd_decoder(is_uhd_device)
-{}
-
-Element::Element(char *element_name, char *element_type):m_element_name(element_name), m_element_type(element_type), m_class_id(0)
-{}
-
-Element::Element(char *element_name):m_element_name(element_name), m_element_type(NULL), m_class_id(0)
-{}
-
 void Element::SetElementAttr(ri_element_attribute_e element_attr)
 {
-       //RI_DBG("[DEVICE ELEMENT] element attr : %s", element_attr);
        m_element_attr = element_attr;
 }
 
index e5351c6b9590831d1730bfdda8a6902cb3f69ac9..b91f055df3d47f29658d3ef2dd5252d120faec5c 100644 (file)
@@ -83,8 +83,9 @@ void ResourceInfoDoc::PrintInfo(void)
 {
        RI_DBG("\n---------------- INFORMATION ----------------");
        for (auto &it : category_elements_) {
-               CategoryElement* category = dynamic_cast<CategoryElement*>(it);
-               category->PrintInfo();
+               CategoryElement *category = dynamic_cast<CategoryElement*>(it);
+               if (category)
+                       category->PrintInfo();
        }
 }
 // LCOV_EXCL_STOP
index 8a2c8d5ce095ca39ab253e83b226833c88c109c9..67cca97b059e93d65c4d0f94a31adf3277bf0c4f 100644 (file)
@@ -26,10 +26,10 @@ static void CopyToResourceCategory(CategoryElement* category_element, ri_resourc
        category->is_uhd_device = category_element->IsUHDDecoder();
 
        char *category_name = category_element->GetElementName();
-       category->name = (category_name == NULL) ? strndup("", strlen("")): strndup(category_name, strlen(category_name));
+       category->name = (category_name == NULL) ? strndup("", strlen("")) : strndup(category_name, strlen(category_name));
 
        char *codec_name = category_element->GetCodecName();
-       category->codec = (codec_name == NULL) ? strndup("", strlen("")): strndup(codec_name, strlen(codec_name));
+       category->codec = (codec_name == NULL) ? strndup("", strlen("")) : strndup(codec_name, strlen(codec_name));
 }
 
 static void CopyToDevice(DeviceElement* dev_element, CategoryElement* category_element, ri_device_common_attr_s* device)
@@ -47,7 +47,7 @@ static void CopyToDevice(DeviceElement* dev_element, CategoryElement* category_e
        device->audio_codec = dev_element->GetAudioCodec();
 
        char *dev_name = dev_element->GetElementName();
-       device->name = (dev_name == NULL) ? strndup("", strlen("")): strndup(dev_name, strlen(dev_name));
+       device->name = (dev_name == NULL) ? strndup("", strlen("")) : strndup(dev_name, strlen(dev_name));
 
        ri_mem_cluster_s* mem_info = dev_element->GetDeviceMemCluster();
 
@@ -79,7 +79,7 @@ static void CopyToDeviceUniqueAttritue(DeviceElement* dev_elem, CategoryElement*
        //RI_INFO("id(%d)/support_overlay(%d)/max_rez(%d)/max_sampling(%d)", attr->id, attr->support_overlay, attr->max_rez, attr->max_sampling_format);
 
        char *dev_name = dev_elem->GetElementName();
-       attr->name = (dev_name == NULL) ? strndup("", strlen("")): strndup(dev_name, strlen(dev_name));
+       attr->name = (dev_name == NULL) ? strndup("", strlen("")) : strndup(dev_name, strlen(dev_name));
 }
 
 int ConstructResourceDB(void *InfoDB, std::vector<CategoryElement*>* device_info)
index fd5bc90207627e213b1f8b795e2dea7f4666048c..5718771028ee867ccd2669b3ab2548c555ec8962 100644 (file)
@@ -561,7 +561,7 @@ int ParseXMLFile(void* InfoDB)
        fileSize = m_GetXMLRawData(filename.c_str(), &xmlRawData);
 
        if (fileSize == -1) {
-               RI_ERR("fail to get XMLdata\n");
+               RI_ERR("fail to get XMLdata");
                if (xmlRawData) {
                        free(xmlRawData);
                        xmlRawData = NULL;
@@ -613,7 +613,7 @@ int ParseXMLFile(void* InfoDB, const char *filename)
        int fileSize = 0;
 
        if (filename == NULL) {
-               printf("Invalid resource file path\n");
+               RI_ERR("Invalid resource file path");
                return -1;
        }
 
@@ -624,7 +624,7 @@ int ParseXMLFile(void* InfoDB, const char *filename)
        fileSize = m_GetXMLRawData(filename, &xmlRawData);
 
        if (fileSize == -1) {
-               printf("fail to get XML data (%s)\n", filename);
+               RI_ERR("fail to get XML data (%s)", filename);
 
                //variable xmlRawData going out of scope leaks the storage it points to.
                if (xmlRawData) {
@@ -729,7 +729,7 @@ int m_ParseResourceInfo(char *xmlRawData, int rawDataSize)
 
        xmlParser = XML_ParserCreate(NULL);
        if (!xmlParser) {
-               RI_ERR("parser create error\n");
+               RI_ERR("parser create error");
                return PARSE_ERROR;
        }
 
@@ -737,7 +737,7 @@ int m_ParseResourceInfo(char *xmlRawData, int rawDataSize)
        XML_SetCharacterDataHandler (xmlParser, m_ProcessCharacterData);
 
        if (XML_Parse(xmlParser, xmlRawData, rawDataSize, 1) == XML_STATUS_ERROR) {
-               RI_ERR("Failed to parse xml data (Error from expat library)\n");
+               RI_ERR("Failed to parse xml data (Error from expat library)");
                return PARSE_ERROR;
        }
 
@@ -998,29 +998,6 @@ void m_ProcessDeviceStartElement(const char **atts)
        int max_sampling_format = m_GetIntAttributeValue(atts, "max_format");
 
        DeviceElement* pDeviceElement = new DeviceElement(device_name, pCategoryElement->GetElementType(), device_bw, mem_cluster_info, sharable_count, mixing, device_enum_type, is_main_device);
-
-       if (pDeviceElement == NULL) {
-               RI_ERR("cannot get device element. Dev[%s]", device_name);
-
-               if (device_name) {
-                       free(device_name);
-                       device_name = NULL;
-               }
-
-               free(mem_cluster_info);
-               mem_cluster_info = NULL;
-
-               if (omx) {
-                       free(omx);
-                       omx = NULL;
-               }
-
-               if (audio_codec)
-                       free(audio_codec);
-
-               return;
-       }
-
        pDeviceElement->SetElementID(g_ResourceID++);
        pDeviceElement->SetDevicePath(device_path);
        pDeviceElement->SetOmxCompName(omx);
@@ -1112,6 +1089,9 @@ void m_ProcessVCodecStartElement(const char **atts, CResourceInfoDB* InfoDB)
 
        if (w_8k > 0 || h_8k > 0 || wp_8k > 0 || hp_8k > 0)
                InfoDB->Set8KSize(codec_name, w_8k, h_8k, wp_8k, hp_8k);
+
+       if (codec_name)
+               free(codec_name);
 }
 
 void m_ProcessCategoryStartElement(const char **atts)
@@ -1173,22 +1153,6 @@ void m_ProcessCategoryStartElement(const char **atts)
 
        /* Put the element into the Category Class */
        CategoryElement* pCategoryElement = new CategoryElement(category_name, category_type, category_class_id, is_uhd);
-
-       if (pCategoryElement == NULL) {
-               RI_ERR("cannot get category element. Cat[%s]", category_name);
-
-               if (category_name) {
-                       free(category_name);
-                       category_name = NULL;
-               }
-
-               if (category_type) {
-                       free(category_type);
-                       category_type = NULL;
-               }
-               return;
-       }
-
        pCategoryElement->SetCategoryEnum(category_id);
        pCategoryElement->SetCodecName(codec_name);
 
@@ -1235,7 +1199,7 @@ int m_GetStringAttributeValue(const char** atts, const char *attribute_name, cha
 
        *attribute_value = strndup(value, strlen(value));
 
-       return (*attribute_value) ? PARSE_OK:PARSE_ERROR;
+       return (*attribute_value) ? PARSE_OK : PARSE_ERROR;
 }
 
 
@@ -1243,7 +1207,7 @@ const char *m_GetAttributeValue(const char **atts, const char *attribute_name)
 {
        /*
        Attributes are passed to the start handler as a pointer to a vector of char pointers.
-       Each attribute seen in a start (or empty) tag occupies 2 consecutive places in this vector: the attribute name followed by the attribute value. 
+       Each attribute seen in a start (or empty) tag occupies 2 consecutive places in this vector : the attribute name followed by the attribute value.
        These pairs are terminated by a null pointer.
        Note that an empty tag generates a call to both start and end handlers (in that order).
        */
index 4b1d06b8e679559cee782bba0cd2a3c961e6b579..c63a625564a3f9f2713b84a0be54a953d9d54953 100644 (file)
@@ -154,6 +154,10 @@ ri_video_property_h ri_create_video_property(const char *vcodec, int w, int h, i
        RI_RETURN_NULL_IF_NULL(vcodec, "invalid param");
 
        ri_video_property *prop = (ri_video_property*) calloc(1, sizeof(ri_video_property));
+
+       if (!prop)
+               return NULL;
+
        prop->width = w;
        prop->height = h;
        prop->fps = fps;
@@ -204,6 +208,10 @@ ri_rsc_category_e ri_get_capable_video_category(ri_video_property_h prop)
 ri_video_encoder_property_h ri_create_video_encoder_property(const int w, const int h, const int fps)
 {
        ri_video_encoder_property *prop = (ri_video_encoder_property*) calloc(1, sizeof(ri_video_encoder_property));
+
+       if (!prop)
+               return NULL;
+
        prop->width = w;
        prop->height = h;
        prop->fps = fps;
index 8ad9ce97cc7f7e98bac0ee60b9ab77d62db90b3a..57c919dff43bc8b73521debd3caa651e1f10fc65 100644 (file)
@@ -32,7 +32,10 @@ ri_video_decoding_property_h ri_create_video_decoding_property(const char *codec
        }
 
        ri_video_decoding_property* prop = (ri_video_decoding_property*) calloc(1, sizeof(ri_video_decoding_property));
-       prop->codec_name = strdup(codec_name);
+
+       if (prop)
+               prop->codec_name = strdup(codec_name);
+
        return prop;
 }
 
@@ -111,6 +114,8 @@ int ri_get_dual_decoding_capability(const ri_video_decoding_property_h prop, ri_
 
        for (auto it : capabilities) {
                ri_video_capability* capa = (ri_video_capability *) calloc(1, sizeof(ri_video_capability));
+               if (!capa)
+                       continue;
                capa->device_prop = (it->GetDeviceProperty().compare("main") == 0) ? RI_DEVICE_PROPERTY_MAIN : RI_DEVICE_PROPERTY_SUB;
                capa->width = it->GetWidth();
                capa->height = it->GetHeight();