Fixed defects detected by static analysis tool 53/172353/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 13 Mar 2018 10:04:47 +0000 (19:04 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 13 Mar 2018 10:20:44 +0000 (19:20 +0900)
Change-Id: I3008dbaa678c51ef71fca432bcc2d79a370b7a26

21 files changed:
binary_xmlresource/binary_xmlresource.cpp
binary_xmlresource/include/interface/imetadata_provider.h
binary_xmlresource/include/interface/iparserinfo_provider.h
binary_xmlresource/include/label_properties_bin_parser.h
binary_xmlresource/include/metadata_provider.h
binary_xmlresource/include/parserinfo_provider.h
binary_xmlresource/label_properties_bin_parser.cpp
res/simple_debug.cpp
res/simple_debug.h
scl/gwes/efl/sclevents-efl.cpp
scl/sclresourcecache.cpp
xml2binary/encode_key_coordinate_frame.cpp
xml2binary/include/imetadata_helper.h
xml2binary/include/istring_encoder.h
xml2binary/include/metadata_handler.h
xml2binary/include/resource_storage.h
xml2binary/include/resource_storage_impl.h
xml2binary/include/string_encoder.h
xml2binary/metadata_handler.cpp
xmlresource/include/layout_parser_helper.h
xmlresource/layout_parser_helper.cpp

index ee01cca..f7efd9c 100644 (file)
@@ -36,6 +36,8 @@ BinResource::BinResource() {
     m_autopopup_configure_parser = NULL;
     m_magnifier_configure_parser = NULL;
     m_nine_patch_file_list_parser = NULL;
+
+    memset(m_info, 0x00, sizeof(m_info));
 }
 
 BinResource::~BinResource() {
index 038f58e..4f30d7b 100644 (file)
@@ -20,7 +20,7 @@
 class IMetadata_Provider{
     public:
         virtual void set_current_metadata_record(const char* record_name) = 0;
-        virtual const int get_width(const char* fieldName)const = 0;
+        virtual int get_width(const char* fieldName)const = 0;
         virtual ~IMetadata_Provider() {}
 };
 #endif
index 60da595..acabba2 100644 (file)
@@ -31,7 +31,7 @@
 class IParserInfo_Provider: public IString_Provider{
     public:
         virtual void set_current_metadata_record(const char* record_name) = 0;
-        virtual const int get_width(const char* field_name) const = 0;
+        virtual int get_width(const char* field_name) const = 0;
         virtual const char* get_string_by_id(const int id) const = 0;
         virtual ~IParserInfo_Provider() {}
 };
index c9e4eac..694d268 100644 (file)
@@ -30,7 +30,7 @@ class BinLabelPropertyParser {
         static BinLabelPropertyParser *get_instance();
     void init(const FileStorage& storage, int, int, IParserInfo_Provider*);
     PSclLabelPropertiesTable get_label_properties_frame();
-    const int get_size();
+    int get_size();
 
     private:
     BinLabelPropertyParser();
index 217030b..39c5e0a 100644 (file)
@@ -28,7 +28,7 @@ class Metadata_Provider:public IMetadata_Provider{
             curRecordIndex = -1;
         }
 
-        const int get_width(const char* field_name)const {
+        int get_width(const char* field_name)const {
             const MetaData* metadata = m_metadataParser->get_metadata();
             const MetaData_Record& metadata_record = metadata->m_vec_metadata_record.at(curRecordIndex);
             std::vector<MetaData_Field>::const_iterator it;
index 36593e0..bd01ec5 100644 (file)
@@ -32,7 +32,7 @@ class ParserInfo_Provider: public IParserInfo_Provider{
                 m_metadataProvider->set_current_metadata_record(record_name);
             }
         }
-         const int get_width(const char* field_name)const {
+        int get_width(const char* field_name)const {
             assert(m_metadataProvider != NULL);
             if (m_metadataProvider != NULL)
                 return m_metadataProvider->get_width(field_name);
index 9c0031a..9db7bb0 100644 (file)
@@ -39,7 +39,7 @@ void BinLabelPropertyParser::init(const FileStorage& storage, int offset, int si
     this->parser_info_provider = provider;
     parsing_label_properties_frame();
 }
-const int
+int
 BinLabelPropertyParser::get_size() {
     return m_size;
 }
index 1e2b932..e1dbedb 100644 (file)
@@ -58,7 +58,7 @@ SclLog::get_instance() {
 }
 
 void
-SclLog::log(enum LOG_LEVEL level, char* fmt, ...) {
+SclLog::log(enum LOG_LEVEL level, const char* fmt, ...) {
     static const char *log_message[MAX_LOG_LEVEL] = {
         "message", "warning", "debug", "error"
     };
@@ -115,7 +115,7 @@ SclLog::log(enum LOG_LEVEL level, char* fmt, ...) {
 }
 
 void
-SCLLOG(enum SclLog::LOG_LEVEL level, char* fmt, ...) {
+SCLLOG(enum SclLog::LOG_LEVEL level, const char* fmt, ...) {
     SclLog *log = SclLog::get_instance();
     if (log) {
         char str_log[128];
@@ -135,7 +135,7 @@ SCLLOG_TIME_BEGIN() {
 }
 
 void
-SCLLOG_TIME_END(char *msg) {
+SCLLOG_TIME_END(const char *msg) {
     gettimeofday(&g_time_end, NULL);
 
     long diff = (g_time_end.tv_sec - g_time_begin.tv_sec) * 1000000 + g_time_end.tv_usec - g_time_begin.tv_usec;
index f4aa268..4f9a9cc 100644 (file)
@@ -30,7 +30,7 @@ class SclLog {
         };
 
         static SclLog* get_instance();
-        void log(enum LOG_LEVEL, char* fmt, ...);
+        void log(enum LOG_LEVEL, const char* fmt, ...);
         ~SclLog();
     private:
         SclLog();
@@ -39,8 +39,8 @@ class SclLog {
 };
 
 
-void SCLLOG(enum SclLog::LOG_LEVEL level, char* fmt, ...);
+void SCLLOG(enum SclLog::LOG_LEVEL level, const char* fmt, ...);
 
 void SCLLOG_TIME_BEGIN();
-void SCLLOG_TIME_END(char *msg);
+void SCLLOG_TIME_END(const char *msg);
 #endif
index cf1fd9c..868f653 100644 (file)
@@ -889,9 +889,10 @@ static Eina_Bool mouse_move(void *data, int type, void *event_info)
                 (elm_win_wl_window_get(static_cast<Evas_Object*>(windows->get_magnifier_window())));
             if (wl_base_window && (unsigned int)ecore_wl_window_id_get(wl_base_window) == ev->window) {
                 SclRectangle base_rect;
-                get_window_rect(windows->get_base_window(), &base_rect);
-                root_x = ev->x + base_rect.x;
-                root_y = ev->y + base_rect.y;
+                if (get_window_rect(windows->get_base_window(), &base_rect)) {
+                    root_x = ev->x + base_rect.x;
+                    root_y = ev->y + base_rect.y;
+                }
             } else if (wl_magnifier_window && (unsigned int)ecore_wl_window_id_get(wl_magnifier_window) == ev->window) {
                 SclRectangle magnifier_rect = { 0, 0, 0, 0 };
                 if (get_window_rect(windows->get_magnifier_window(), &magnifier_rect)) {
index ed0d9f3..e94a810 100644 (file)
@@ -37,7 +37,15 @@ CSCLResourceCache::CSCLResourceCache()
     SCL_DEBUG();
 
     memset(mCurThemename, 0x00, sizeof(mCurThemename));
-    memset(&mCurBaseLayout, 0x00, sizeof(SclLayout));
+
+    memset(&mCurBaseLayout, 0x00, sizeof(mCurBaseLayout));
+    memset(mCurPopupLayout, 0x00, sizeof(mCurPopupLayout));
+
+    memset(mCurBaseLayoutKeyCoordinates, 0x00, sizeof(mCurBaseLayoutKeyCoordinates));
+    memset(mCurPopupLayoutKeyCoordinates, 0x00, sizeof(mCurPopupLayoutKeyCoordinates));
+
+    memset(mCurBaseButtonContext, 0x00, sizeof(mCurBaseButtonContext));
+    memset(mCurPopupButtonContext, 0x00, sizeof(mCurPopupButtonContext));
 
     mCurStartingCoordinates.x = 0;
     mCurStartingCoordinates.y = 0;
index c966e3f..87566c6 100644 (file)
@@ -183,7 +183,7 @@ encode_key_coordinate_record(ResourceStorage& storage, const PSclLayoutKeyCoordi
     }
 }
 
-const int get_layout_num(const PSclLayoutKeyCoordinatePointerTable keyCoordinatePointerFrame) {
+int get_layout_num(const PSclLayoutKeyCoordinatePointerTable keyCoordinatePointerFrame) {
     assert(keyCoordinatePointerFrame != NULL);
     int layout_num = MAX_SCL_LAYOUT;
     for ( int i = 0; i < MAX_SCL_LAYOUT; ++i ) {
@@ -197,7 +197,7 @@ const int get_layout_num(const PSclLayoutKeyCoordinatePointerTable keyCoordinate
     return layout_num;
 }
 
-const int get_key_num(const PSclLayoutKeyCoordinatePointerTable keyCoordinatePointerFrame, const int layout_no) {
+int get_key_num(const PSclLayoutKeyCoordinatePointerTable keyCoordinatePointerFrame, const int layout_no) {
     assert(keyCoordinatePointerFrame != NULL);
     int key_num = MAX_KEY;
 
index 22765a9..698f98b 100644 (file)
@@ -20,7 +20,7 @@
 class IMetaData_Helper{
     public:
         virtual void set_current_metadata_record(const char* record_name) = 0;
-        virtual const unsigned short get_width(const char* field_name) const = 0;
+        virtual unsigned short get_width(const char* field_name) const = 0;
         virtual ~IMetaData_Helper() {}
 };
 #endif
index 416469b..08711c3 100644 (file)
@@ -20,7 +20,7 @@
 class ResourceStorage;
 class IString_Encoder{
     public:
-        virtual const int add(const char*) = 0;
+        virtual int add(const char*) = 0;
         virtual int encode() const = 0;
         virtual int encode(int& offset) const = 0;
         virtual int encode(ResourceStorage&) const = 0;
index 68987eb..c2f9538 100644 (file)
@@ -44,12 +44,11 @@ class MetaData_Handler:private IMetaData_Encoder, IMetaData_Parser, public IMeta
         // encode all strings and output to storage
         int encode(ResourceStorage& storage)const;
 
-        const unsigned short get_width(const char* field_name) const;
+        unsigned short get_width(const char* field_name) const;
 
     private:
-        const unsigned short
-            get_width(const char* name, const MetaData_Record& metadata_record) const;
-        const int find_metadata_record_index(const char* name)const;
+        unsigned short get_width(const char* name, const MetaData_Record& metadata_record) const;
+        int find_metadata_record_index(const char* name) const;
         int parsing_field(const xmlNodePtr node, MetaData_Field& data, const MetaData_Width& metadataWidth);
         int parsing_record(const xmlNodePtr curNode, MetaData_Record& metadataRecord, const MetaData_Width& metadataWidth);
         int parsing_metadata_type(const xmlNodePtr curNode, MetaData_Width& metadataWidth);
index 56e997d..9221fbe 100644 (file)
@@ -76,10 +76,10 @@ class ResourceStorage{
         int random_put(T data, int width, int random_offset);
 
     // get the current used size
-    const int get_size() const;
+    int get_size() const;
 
     // get the capability of the storage
-    const int capability() const;
+    int capability() const;
 
     // put the storage array to file
     // the fileName assigned
index fb5553b..ddc9b89 100644 (file)
@@ -43,7 +43,7 @@ inline ResourceStorage::
     m_capability = 0;
 }
 
-inline const int ResourceStorage::
+inline int ResourceStorage::
 get_size() const {
     return m_size;
 }
@@ -68,7 +68,7 @@ put(const char* str) {
     m_size += 1;
 }
 
-inline const int ResourceStorage::
+inline int ResourceStorage::
 capability() const {
     return m_capability;
 }
index f7be516..9a7c0b7 100644 (file)
@@ -36,7 +36,7 @@ class String_Encoder:public IString_Encoder{
 
         /* @ insert str to string vector */
         /* @ return the ID of the str */
-        const int add(const char* str) {
+        int add(const char* str) {
             if (str == NULL) return -1;
 
             std::string str_temp = std::string(str);
index 1cced1e..f002323 100644 (file)
@@ -59,7 +59,7 @@ encode(ResourceStorage& storage)const {
     return storage.get_size();
 }
 
-const unsigned short MetaData_Handler::
+unsigned short MetaData_Handler::
 get_width(const char* field_name) const {
     if (field_name == NULL) return 0;
 
@@ -73,7 +73,7 @@ get_width(const char* field_name) const {
     return width;
 }
 
-const unsigned short MetaData_Handler::
+unsigned short MetaData_Handler::
 get_width(const char* name, const MetaData_Record& metadata_record) const {
     assert(name);
     for (size_t i = 0; i < metadata_record.vField.size(); ++i) {
@@ -84,7 +84,7 @@ get_width(const char* name, const MetaData_Record& metadata_record) const {
     return 0;
 }
 
-const int MetaData_Handler::
+int MetaData_Handler::
 find_metadata_record_index(const char* name)const {
     assert(name);
 
index c6c0b82..e928af3 100644 (file)
@@ -30,7 +30,7 @@ class RotationHelper{
         static const std::string pcLandscape;
         static const std::string toString(const int val);
 
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class PopStyleHelper{
     public:
@@ -44,7 +44,7 @@ class PopStyleHelper{
         static const std::string pcPopup;
         static const std::string pcPopup_Grab;
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class ButtonTypeHelper{
     public:
@@ -75,7 +75,7 @@ class ButtonTypeHelper{
 
         static const std::string toString(const int val);
 
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class ShiftStateHelper{
     public:
@@ -91,7 +91,7 @@ class ShiftStateHelper{
 
         static const std::string toString(const int val);
 
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class ButtonStateHelper{
     public:
@@ -105,7 +105,7 @@ class ButtonStateHelper{
         static const std::string pcPressed;
         static const std::string pcDisabled ;
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class KeyTypeHelper{
     public:
@@ -127,7 +127,7 @@ class KeyTypeHelper{
         static const std::string pcUser;
         static const std::string toString(const int val);
 
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class PopupTypeHelper {
     public:
@@ -151,7 +151,7 @@ class PopupTypeHelper {
         static const std::string pcAuto_Popup;
 
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class DragStateHelper{
     public:
@@ -176,7 +176,7 @@ class DragStateHelper{
 
         static const std::string toString(const int val);
 
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 class ExtraOptionHelper {
     public:
@@ -200,7 +200,7 @@ class ExtraOptionHelper {
         static const std::string pcOption_4_directions_return_curve;
 
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 
 class MultitouchTypeHelper{
@@ -217,7 +217,7 @@ class MultitouchTypeHelper{
         static const std::string pcGrab_Sub_Events;
 
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
+        static int Int(const std::string str);
 };
 
 class BOOLTypeHelper{
@@ -227,15 +227,15 @@ class BOOLTypeHelper{
         static const std::string pcFalse;
 
         static const std::string toString(const bool val);
-        static const int Bool(const std::string str);
+        static int Bool(const std::string str);
 };
 class INTTypeHelper{
     public:
         static const int DEFAULT = 0;
         static const std::string dextoString(const int val);
         static const std::string toString(const int val);
-        static const int Int(const std::string str);
-        static const int dexInt(const std::string str);
+        static int Int(const std::string str);
+        static int dexInt(const std::string str);
 };
 
 #endif
index 49b9387..4addf8d 100644 (file)
@@ -34,7 +34,7 @@ const string RotationHelper::toString(const int val) {
             return pcLandscape;
     }
 }
-const int RotationHelper::Int(const string str) {
+int RotationHelper::Int(const string str) {
     if (str ==  pcPortrait) {
         return PORTRAIT;
     } else if (str ==  pcLandscape) {
@@ -61,7 +61,7 @@ const string PopStyleHelper::toString(const int val) {
     }
 }
 
-const int PopStyleHelper::Int(const string str) {
+int PopStyleHelper::Int(const string str) {
     if (str ==  pcBase) {
         return BASE;
     } else if (str ==  pcPopup) {
@@ -111,7 +111,7 @@ const string ButtonTypeHelper::toString(const int val) {
     }
 }
 
-const int ButtonTypeHelper::Int(const string str) {
+int ButtonTypeHelper::Int(const string str) {
     if (str ==  pcNormal) {
         return NORMAL;
     } else if (str ==  pcGrab) {
@@ -154,7 +154,7 @@ const string ShiftStateHelper::toString(const int val) {
     }
 }
 
-const int ShiftStateHelper::Int(const string str) {
+int ShiftStateHelper::Int(const string str) {
     if (str ==  pcOn) {
         return ON;
     } else if (str ==  pcOff) {
@@ -181,7 +181,7 @@ const string ButtonStateHelper::toString(const int val) {
             return pcNormal;
     }
 }
-const int ButtonStateHelper::Int(const string str) {
+int ButtonStateHelper::Int(const string str) {
     if (str ==  pcNormal) {
         return NORMAL;
     } else if (str ==  pcPressed) {
@@ -218,7 +218,7 @@ const string KeyTypeHelper::toString(const int val) {
     }
 }
 
-const int KeyTypeHelper::Int(const string str) {
+int KeyTypeHelper::Int(const string str) {
     if (str ==  pcNone) {
         return NONE;
     } else if (str ==  pcChar) {
@@ -264,7 +264,7 @@ const string PopupTypeHelper::toString(const int val) {
             return pcNone;
     }
 }
-const int PopupTypeHelper::Int(const string str) {
+int PopupTypeHelper::Int(const string str) {
     if (str ==  pcNone) {
         return NONE;
     } else if (str ==  pcBtn_Release_Popup) {
@@ -313,7 +313,7 @@ const string DragStateHelper::toString(const int val) {
     }
 }
 
-const int DragStateHelper::Int(const string str) {
+int DragStateHelper::Int(const string str) {
     if (str ==  pcNone) {
         return NONE;
     } else if (str ==  pcLeft) {
@@ -361,7 +361,7 @@ const string ExtraOptionHelper::toString(const int val) {
             return pcOption_4_directions;
     }
 }
-const int ExtraOptionHelper::Int(const string str) {
+int ExtraOptionHelper::Int(const string str) {
     if (str ==  pcOption_4_directions) {
         return OPTION_4_DIRECTIONS;
     } else if (str ==  pcOption_8_directions) {
@@ -397,7 +397,7 @@ const string MultitouchTypeHelper::toString(const int val) {
             return pcExclusive;
     }
 }
-const int MultitouchTypeHelper::Int(const string str) {
+int MultitouchTypeHelper::Int(const string str) {
     if (str ==  pcExclusive) {
         return EXCLUSIVE;
     } else if (str ==  pcCooperative) {
@@ -416,7 +416,7 @@ const string BOOLTypeHelper::toString(const bool val) {
     if (val) return pcTrue;
     return pcFalse;
 }
-const int BOOLTypeHelper::Bool(const string str) {
+int BOOLTypeHelper::Bool(const string str) {
     if (str ==  pcFalse) {
         return false;
     } else if (str ==  pcTrue) {
@@ -436,7 +436,7 @@ const string INTTypeHelper::toString(const int val) {
     snprintf(temp, sizeof(temp), "%d", val);
     return string(temp);
 }
-const int INTTypeHelper::Int(const string str) {
+int INTTypeHelper::Int(const string str) {
     int val = 0;
     stringstream convertor(str);
 
@@ -447,7 +447,7 @@ const int INTTypeHelper::Int(const string str) {
 
     return val;
 }
-const int INTTypeHelper::dexInt(const string str) {
+int INTTypeHelper::dexInt(const string str) {
     int val = 0;
     stringstream convertor(str);