Removal of compilation warnings.
authorJan Olszak <j.olszak@samsung.com>
Fri, 26 Oct 2012 08:37:54 +0000 (10:37 +0200)
committerJihoon Chung <jihoon.chung@samsung.com>
Fri, 2 Nov 2012 04:59:40 +0000 (13:59 +0900)
[Issue#] N/A
[Bug] Compilation warnings
[Cause] N/A
[Solution] Removed KW comments, renamed table from SettignsList to SettingsList, removed factory_widget and related methods, error codes, exceptions.
[Verification] See compilation warnings. Build wrt-commons. Test dao and dpl.

Change-Id: Ia6d5eaec165b7c5cc57e68ee0b75cc07c996ed58

17 files changed:
CMakeLists.txt
modules/auto_save_dao/orm/autosave_db
modules/core/src/atomic.cpp
modules/db/include/dpl/db/orm.h
modules/db/include/dpl/db/orm_generator.h
modules/db/include/dpl/db/orm_macros.h
modules/db/include/dpl/db/sql_connection.h
modules/dbus/include/dpl/dbus/connection.h
modules/encryption/src/resource_decryption.cpp
modules/localization/src/w3c_file_localization.cpp
modules/utils/include/dpl/utils/file_utils.h
modules/utils/src/folder_size.cpp
modules/utils/src/wrt_global_settings.cpp
modules/widget_dao/dao/config_parser_data.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h

index c50c3e3..ee257f0 100644 (file)
@@ -170,6 +170,7 @@ ADD_DEFINITIONS("-std=c++0x")
 SET(DPL_3RDPARTY_INCLUDE_DIR
     ${PROJECT_SOURCE_DIR}/3rdparty)
 
+
 # Set names of binaries being created
 SET(TARGET_DPL_EFL "lib${PROJECT_NAME}-efl")
 SET(TARGET_DPL_DBUS_EFL "lib${PROJECT_NAME}-dbus-efl")
index aef6234..5f79edf 100644 (file)
@@ -3,7 +3,7 @@ SQL(
 )
 
 CREATE_TABLE(AutoSaveSubmitFormElement)
-    COLUMN_NOT_NULL(address,    VARCHAR(256))
+    COLUMN_NOT_NULL(address,    VARCHAR(256),)
     COLUMN_NOT_NULL(key,        TEXT,)
     COLUMN_NOT_NULL(value,      TEXT,)
 CREATE_TABLE_END()
index 65af06e..f61a4dd 100644 (file)
@@ -30,26 +30,26 @@ Atomic::Atomic(ValueType value)
 
 Atomic::ValueType Atomic::ExchangeAndAdd(ValueType value)
 {
-    return g_atomic_int_exchange_and_add(&m_value, value);
+    return g_atomic_int_exchange_and_add(const_cast<gint* >(&m_value), value);
 }
 
 bool Atomic::CompareAndExchange(ValueType oldValue, ValueType newValue)
 {
-    return g_atomic_int_compare_and_exchange(&m_value, oldValue, newValue);
+    return g_atomic_int_compare_and_exchange(const_cast<gint* >(&m_value), oldValue, newValue);
 }
 
 bool Atomic::operator--()
 {
-    return g_atomic_int_dec_and_test(&m_value) != TRUE;
+    return g_atomic_int_dec_and_test(const_cast<gint* >(&m_value)) != TRUE;
 }
 
 void Atomic::operator++()
 {
-    g_atomic_int_inc(&m_value);
+    g_atomic_int_inc(const_cast<gint* >(&m_value));
 }
 
 Atomic::operator ValueType() const
 {
-    return g_atomic_int_get(&m_value);
+    return g_atomic_int_get(const_cast<gint* >(&m_value));
 }
 } // namespace DPL
index fa4ea3a..8ba96c4 100644 (file)
@@ -189,6 +189,8 @@ public:
       m_relation(Relation)
     {}
 
+    virtual ~CompareBinaryColumn() {}
+
     virtual std::string GetString() const
     {
         std::string statement;
@@ -389,7 +391,7 @@ public:
     void SetColumnData(ColumnIndex columnIndex, ColumnType data)
     {
         typedef CustomColumn<ColumnType> Type;
-        Assert(columnIndex >= 0 && columnIndex < m_columns.size());
+        Assert(columnIndex < m_columns.size());
         Type* pColumn = dynamic_cast<Type*>(m_columns.at(columnIndex));
         Assert(pColumn);
         pColumn->SetColumnData(data);
@@ -400,7 +402,7 @@ public:
     {
         typedef CustomColumn<typename ColumnData::ColumnType> Type;
         ColumnIndex index = CustomRowUtil<ColumnList>::GetColumnIndex(ColumnData::GetColumnName());
-        Assert(index >= 0 && index < m_columns.size());
+        Assert(index < m_columns.size());
         Type* pColumn = dynamic_cast<Type*>(m_columns.at(index));
         Assert(pColumn);
         return pColumn->GetColumnData();
index f374b8f..8bd9fdb 100644 (file)
@@ -72,7 +72,7 @@ namespace ORM {
         typedef TYPE ColumnType; \
         static const char* GetTableName() { return GetName(); } \
         static const char* GetColumnName() { return STRINGIFY(FIELD); } \
-        static void SetRowField(Row& row, const TYPE& value) { row.Set_##FIELD(value);} \
+        static void SetRowField(Row& row, const TYPE& _value) { row.Set_##FIELD(_value);} \
     };
 
 #define INT         int
@@ -82,8 +82,8 @@ namespace ORM {
 #define VARCHAR(x)  DPL::String
 #define TEXT        DPL::String
 
-#define SQL(args...)
-#define TABLE_CONSTRAINTS(args...)
+#define SQL(...)
+#define TABLE_CONSTRAINTS(...)
 #define OPTIONAL(type) DPL::Optional< type >
 #define DATABASE_START(db_name)                                 \
     namespace db_name                                           \
@@ -124,8 +124,8 @@ namespace ORM {
         class RowBase;                                                          \
         inline std::ostream& operator<<(std::ostream& ostr, const RowBase& row); \
     }
-#define COLUMN_NOT_NULL(name, type, args...)
-#define COLUMN(name, type, args...)
+#define COLUMN_NOT_NULL(name, type, ...)
+#define COLUMN(name, type, ...)
 #define CREATE_TABLE_END()
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -142,11 +142,11 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { class RowBase {                 \
    public: friend std::ostream& operator<<(std::ostream&, const RowBase&);
-#define COLUMN_NOT_NULL(name, type, args...)                                \
+#define COLUMN_NOT_NULL(name, type, ...)                                \
         protected: type name; bool m_##name##_set;                          \
-        public:  void Set_##name(const type& value) {                       \
+        public:  void Set_##name(const type& _value) {                       \
                      m_##name##_set = true;                                 \
-                     this->name = value;                                     \
+                     this->name = _value;                                     \
         }                                                                   \
         public:  type Get_##name() const {                                  \
                      if ( !m_##name##_set ) {                               \
@@ -156,11 +156,11 @@ namespace ORM {
                      return name;                                           \
         }
 
-#define COLUMN(name, type, args...)                                         \
+#define COLUMN(name, type, ...)                                         \
         protected: OPTIONAL(type) name; bool m_##name##_set;                \
-        public:  void Set_##name(const OPTIONAL(type)& value) {             \
+        public:  void Set_##name(const OPTIONAL(type)& _value) {             \
                      m_##name##_set = true;                                 \
-                     this->name = value;                                     \
+                     this->name = _value;                                     \
         }                                                                   \
         public:  OPTIONAL(type) Get_##name() const {                        \
                      if ( !m_##name##_set ) {                               \
@@ -181,8 +181,8 @@ namespace ORM {
 // RowBase ostream operator<<
 
 #define CREATE_TABLE(name) std::ostream& name::operator<<(std::ostream& ostr, const RowBase& row) { using ::operator<< ; ostr << STRINGIFY(name) << " (";
-#define COLUMN_NOT_NULL(name, type, args...) ostr << " '" << row.name << "'" ;
-#define COLUMN(name, type, args...)          ostr << " '" << row.name << "'" ;
+#define COLUMN_NOT_NULL(name, type, ...) ostr << " '" << row.name << "'" ;
+#define COLUMN(name, type, ...)          ostr << " '" << row.name << "'" ;
 #define CREATE_TABLE_END() ostr << " )" ; return ostr; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -196,8 +196,8 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { class RowBase2 : public RowBase { \
     public: bool operator==(const RowBase2& row) const { return true
-#define COLUMN_NOT_NULL(name, type, args...) && (this->name == row.name)
-#define COLUMN(name, type, args...)          && (this->name == row.name)
+#define COLUMN_NOT_NULL(name, type, ...) && (this->name == row.name)
+#define COLUMN(name, type, ...)          && (this->name == row.name)
 #define CREATE_TABLE_END() ; } }; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -211,8 +211,8 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { class RowBase3 : public RowBase2 { \
     public: bool operator<(const RowBase3& row) const {
-#define COLUMN_NOT_NULL(name, type, args...) if (this->name < row.name) { return true; } if (this->name > row.name) { return false; }
-#define COLUMN(name, type, args...)          if (this->name < row.name) { return true; } if (this->name > row.name) { return false; }
+#define COLUMN_NOT_NULL(name, type, ...) if (this->name < row.name) { return true; } if (this->name > row.name) { return false; }
+#define COLUMN(name, type, ...)          if (this->name < row.name) { return true; } if (this->name > row.name) { return false; }
 #define CREATE_TABLE_END() return false; } }; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -226,8 +226,8 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { class RowBase4 : public RowBase3 { \
     public: bool IsSignatureMatching(const RowBase4& row) const { return true
-#define COLUMN_NOT_NULL(name, type, args...) && (this->m_##name##_set == row.m_##name##_set)
-#define COLUMN(name, type, args...)          && (this->m_##name##_set == row.m_##name##_set)
+#define COLUMN_NOT_NULL(name, type, ...) && (this->m_##name##_set == row.m_##name##_set)
+#define COLUMN(name, type, ...)          && (this->m_##name##_set == row.m_##name##_set)
 #define CREATE_TABLE_END() ; } }; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -241,8 +241,8 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { class RowBase5 : public RowBase4 { \
     public: RowBase5() {
-#define COLUMN_NOT_NULL(name, type, args...) m_##name##_set = false;
-#define COLUMN(name, type, args...)          m_##name##_set = false;
+#define COLUMN_NOT_NULL(name, type, ...) m_##name##_set = false;
+#define COLUMN(name, type, ...)          m_##name##_set = false;
 #define CREATE_TABLE_END() } }; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -257,8 +257,8 @@ namespace ORM {
 #define CREATE_TABLE(name) namespace name { class Row : public RowBase5 { \
     public: template<typename Visitor>                                    \
     void VisitColumns(Visitor& visitor) const {
-#define COLUMN_NOT_NULL(name, type, args...) visitor.Visit(STRINGIFY(name), this->name, this->m_##name##_set);
-#define COLUMN(name, type, args...)          visitor.Visit(STRINGIFY(name), this->name, this->m_##name##_set);
+#define COLUMN_NOT_NULL(name, type, ...) visitor.Visit(STRINGIFY(name), this->name, this->m_##name##_set);
+#define COLUMN(name, type, ...)          visitor.Visit(STRINGIFY(name), this->name, this->m_##name##_set);
 #define CREATE_TABLE_END() } }; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -272,8 +272,8 @@ namespace ORM {
 
 #define CREATE_TABLE(name) namespace name { \
     static const char* GetName() { return STRINGIFY(name); }
-#define COLUMN_NOT_NULL(name, type, args...) DECLARE_COLUMN(name, type)
-#define COLUMN(name, type, args...) DECLARE_COLUMN(name, OPTIONAL(type))
+#define COLUMN_NOT_NULL(name, type, ...) DECLARE_COLUMN(name, type)
+#define COLUMN(name, type, ...) DECLARE_COLUMN(name, OPTIONAL(type))
 #define CREATE_TABLE_END() }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -286,8 +286,8 @@ namespace ORM {
 // ColumnList typedef
 
 #define CREATE_TABLE(name) namespace name { typedef DPL::TypeListDecl<
-#define COLUMN_NOT_NULL(name, type, args...) name,
-#define COLUMN(name, type, args...) name,
+#define COLUMN_NOT_NULL(name, type, ...) name,
+#define COLUMN(name, type, ...) name,
 #define CREATE_TABLE_END() DPL::TypeListGuard>::Type ColumnList; }
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -328,8 +328,8 @@ namespace ORM {
         };                                                                  \
     }
 
-#define COLUMN_NOT_NULL(name, type, args...)
-#define COLUMN(name, type, args...)
+#define COLUMN_NOT_NULL(name, type, ...)
+#define COLUMN(name, type, ...)
 #define CREATE_TABLE_END()
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
@@ -348,8 +348,8 @@ namespace ORM {
         typedef Delete<TableDefinition> Delete; \
         typedef Update<TableDefinition> Update; \
     }
-#define COLUMN_NOT_NULL(name, type, args...)
-#define COLUMN(name, type, args...)
+#define COLUMN_NOT_NULL(name, type, ...)
+#define COLUMN(name, type, ...)
 #define CREATE_TABLE_END()
 
 #include ORM_GENERATOR_DATABASE_NAME_LOCAL
index 804f59a..c70a3b0 100644 (file)
 //Do not include this file directly! It is used only for SQL code generation.
 
 #define CREATE_TABLE(name) CREATE TABLE name (
-#define COLUMN(name, type, args...) name type args ,
-#define COLUMN_NOT_NULL(name, type, args...) name type args not null,
-#define SQL(args...) args
-#define TABLE_CONSTRAINTS(args...) args ,
+#define COLUMN(name, type, ...) name type __VA_ARGS__ ,
+#define COLUMN_NOT_NULL(name, type, ...) name type __VA_ARGS__ not null,
+#define SQL(...) __VA_ARGS__
+#define TABLE_CONSTRAINTS(...) __VA_ARGS__ ,
 #define CREATE_TABLE_END() CHECK(1) );
 #define DATABASE_START(db_name)
 #define DATABASE_END()
index 963ee7e..f973772 100644 (file)
@@ -386,7 +386,7 @@ public:
              *      that need that switched do CRW
              */
             RW = SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
-            CRW = RW | SQLITE_OPEN_CREATE,
+            CRW = RW | SQLITE_OPEN_CREATE
         };
     };
 
index 886038c..49e8197 100644 (file)
@@ -172,9 +172,9 @@ private:
 
     struct ObjectRegistration
     {
-        ObjectRegistration(guint registrationId, const ObjectPtr& object)
-            : registrationId(registrationId),
-              object(object)
+        ObjectRegistration(guint _registrationId, const ObjectPtr& _object)
+            : registrationId(_registrationId),
+              object(_object)
         {
         }
 
index e8f1590..b15deb6 100644 (file)
@@ -61,8 +61,13 @@ void ResourceDecryptor::SetDecryptionKey(std::string userKey)
         ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed,
                 "Failed to get decryption key");
     }
+
     m_decKey = new AES_KEY;
-    fread(m_decKey, 1, sizeof(AES_KEY),fp);
+    size_t resultSize =fread(m_decKey, 1, sizeof(AES_KEY),fp);
+    if (resultSize!= sizeof(AES_KEY))
+        ThrowMsg(ResourceDecryptor::Exception::GetDecKeyFailed,
+                "Failed to get AES key");
+
     fclose(fp);
 }
 
index bb19521..65af92c 100644 (file)
@@ -121,7 +121,7 @@ DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
         }
         if (req.find(LOCALE_PREFIX) == 0) {
             req.erase(0, LOCALE_PREFIX.length());
-            int position = req.find('/');
+            size_t position = req.find('/');
             // should always be >0 as correct locales path is
             // always locales/xx/ or locales/xx-XX/
             if (position != std::string::npos && position > 0) {
index 4248f70..6cdfefd 100644 (file)
@@ -34,6 +34,7 @@ DECLARE_EXCEPTION_TYPE(DPL::Exception, CreateDirectoryException)
 DECLARE_EXCEPTION_TYPE(DPL::Exception, RemoveDirectoryException)
 
 bool FileExists(const DPL::String& absolutePath);
+bool DirectoryExists(const DPL::String& absolutePath);
 
 /**
  * Creates specified path recursively.
@@ -41,8 +42,7 @@ bool FileExists(const DPL::String& absolutePath);
  * @param mode Mode for the non-existing parts of the path (e.g. 0755).
  * @throw DPL::CommonException::::InternalError If sth bad happens.
  */
-void MakePath(const std::string& path,
-        mode_t mode);
+void MakePath(const std::string& path, mode_t mode);
 
 /**
  * Removes specified directory recursively.
@@ -50,6 +50,7 @@ void MakePath(const std::string& path,
  * @throw FileUtils::DirectoryRemoveException If an error occured.
  */
 void RemoveDir(const std::string& path);
-};
+
+} // namespace FileUtils
 
 #endif
index bc2afdb..2982d44 100644 (file)
@@ -115,10 +115,11 @@ const int stepSize = 1024;
 template<typename... Rest>
 struct Pre;
 
+
 template<typename Postfix, typename... Rest>
 struct Pre<Postfix, Rest...>
 {
-    static const double value = Pre<Rest...>::value * stepSize;
+    static const double value;
     static std::string printSize(double fileSize)
     {
         if(fileSize >= Pre<Rest...>::value) {
@@ -145,9 +146,14 @@ struct Pre<>
         }
 
 };
+
 const double Pre<>::value = 1.0;
+template<typename Postfix, typename... Params> const double Pre<Postfix, Params...>::value(Pre<>::value * stepSize);
+
 
 typedef Pre<PrefixGB, PrefixMB, PrefixKB, PrefixB> FolderSizeToStringType;
+
+
 } //anonymous namespace
 
 
index 1a420f7..7927841 100644 (file)
@@ -48,8 +48,8 @@ enum MachineType
 };
 
 struct Settings {
-    int testModes;
     bool isEmulator;
+    int testModes;
 
     Settings()
     : isEmulator(false), testModes(0)
index d2550cc..dde154f 100644 (file)
@@ -25,6 +25,9 @@
 #include <libxml/xmlstring.h>
 
 namespace WrtDB {
+bool IsSpace(const xmlChar* str);
+bool CopyChar(xmlChar* out, xmlChar* in);
+
 
 bool IsSpace(const xmlChar* str)
 {
@@ -87,6 +90,8 @@ bool IsSpace(const xmlChar* str)
                 case 0xa9:
                 case 0xaf:
                     return true;
+                default:
+                    return false;
                 }
             case 0x81:
                 if (*(str + 2) == 0x9f) {
index e899087..15b8b59 100644 (file)
@@ -466,8 +466,6 @@ void WidgetDAO::registerWidgetFeatures(DbWidgetHandle widgetHandle,
         wrt::FeatureParam::Row featureParam;
         featureParam.Set_widget_feature_id(widgetFeatureID);
 
-        ConfigParserData::ParamsList::const_iterator iter;
-
         FOREACH(iter, pWidgetFeature->paramsList)
         {
             featureParam.Set_name(iter->name);
index c3891c4..ff2fc09 100644 (file)
@@ -254,7 +254,7 @@ enum AppType
 {
     APP_TYPE_UNKNOWN = 0, // unknown
     APP_TYPE_WAC20, // WAC 2.0
-    APP_TYPE_TIZENWEBAPP, // Tizen webapp
+    APP_TYPE_TIZENWEBAPP // Tizen webapp
 };
 
 class WidgetType
@@ -297,7 +297,7 @@ enum PackagingType
 {
     PKG_TYPE_UNKNOWN = 0, // unknown
     PKG_TYPE_TIZEN_WEBAPP, // Tizen webapp
-    PKG_TYPE_TIZEN_WITHSVCAPP, // Tizen webapp with C++ service app
+    PKG_TYPE_TIZEN_WITHSVCAPP // Tizen webapp with C++ service app
 };
 
 class PkgType
index a0e3a99..7ec8a25 100644 (file)
@@ -43,7 +43,7 @@ class ConfigParserData
   public:
     struct Param
     {
-        Param(const DPL::String& name) : name(name)
+        Param(const DPL::String& _name) : name(_name)
         {
         }
         DPL::String name;
@@ -59,9 +59,9 @@ class ConfigParserData
 
     struct Feature
     {
-        Feature(const DPL::String& name,
-                bool required = true) : name(name),
-            required(required)
+        Feature(const DPL::String& _name,
+                bool _required = true) : name(_name),
+            required(_required)
         {
         }
         DPL::String name;
@@ -79,7 +79,7 @@ class ConfigParserData
 
     struct Icon
     {
-        Icon(const DPL::String& src) : src(src)
+        Icon(const DPL::String& _src) : src(_src)
         {
         }
         DPL::String src;
@@ -109,11 +109,11 @@ class ConfigParserData
 
     struct Preference
     {
-        Preference(const DPL::String& name,
-                bool readonly = false) :
-            name(name),
+        Preference(const DPL::String& _name,
+                bool _readonly = false) :
+            name(_name),
             value(),
-            readonly(readonly)
+            readonly(_readonly)
         {
         }
         DPL::String name;