From: Jan Olszak Date: Fri, 26 Oct 2012 08:37:54 +0000 (+0200) Subject: Removal of compilation warnings. X-Git-Tag: 2.1b_release~6^2~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1f4888e8e37727f9576878c6bf485469d385fdc;p=framework%2Fweb%2Fwrt-commons.git Removal of compilation warnings. [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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c50c3e3..ee257f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/modules/auto_save_dao/orm/autosave_db b/modules/auto_save_dao/orm/autosave_db index aef6234..5f79edf 100644 --- a/modules/auto_save_dao/orm/autosave_db +++ b/modules/auto_save_dao/orm/autosave_db @@ -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() diff --git a/modules/core/src/atomic.cpp b/modules/core/src/atomic.cpp index 65af06e..f61a4dd 100644 --- a/modules/core/src/atomic.cpp +++ b/modules/core/src/atomic.cpp @@ -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(&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(&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(&m_value)) != TRUE; } void Atomic::operator++() { - g_atomic_int_inc(&m_value); + g_atomic_int_inc(const_cast(&m_value)); } Atomic::operator ValueType() const { - return g_atomic_int_get(&m_value); + return g_atomic_int_get(const_cast(&m_value)); } } // namespace DPL diff --git a/modules/db/include/dpl/db/orm.h b/modules/db/include/dpl/db/orm.h index fa4ea3a..8ba96c4 100644 --- a/modules/db/include/dpl/db/orm.h +++ b/modules/db/include/dpl/db/orm.h @@ -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 Type; - Assert(columnIndex >= 0 && columnIndex < m_columns.size()); + Assert(columnIndex < m_columns.size()); Type* pColumn = dynamic_cast(m_columns.at(columnIndex)); Assert(pColumn); pColumn->SetColumnData(data); @@ -400,7 +402,7 @@ public: { typedef CustomColumn Type; ColumnIndex index = CustomRowUtil::GetColumnIndex(ColumnData::GetColumnName()); - Assert(index >= 0 && index < m_columns.size()); + Assert(index < m_columns.size()); Type* pColumn = dynamic_cast(m_columns.at(index)); Assert(pColumn); return pColumn->GetColumnData(); diff --git a/modules/db/include/dpl/db/orm_generator.h b/modules/db/include/dpl/db/orm_generator.h index f374b8f..8bd9fdb 100644 --- a/modules/db/include/dpl/db/orm_generator.h +++ b/modules/db/include/dpl/db/orm_generator.h @@ -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 \ 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 Delete; \ typedef Update 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 diff --git a/modules/db/include/dpl/db/orm_macros.h b/modules/db/include/dpl/db/orm_macros.h index 804f59a..c70a3b0 100644 --- a/modules/db/include/dpl/db/orm_macros.h +++ b/modules/db/include/dpl/db/orm_macros.h @@ -23,10 +23,10 @@ //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() diff --git a/modules/db/include/dpl/db/sql_connection.h b/modules/db/include/dpl/db/sql_connection.h index 963ee7e..f973772 100644 --- a/modules/db/include/dpl/db/sql_connection.h +++ b/modules/db/include/dpl/db/sql_connection.h @@ -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 }; }; diff --git a/modules/dbus/include/dpl/dbus/connection.h b/modules/dbus/include/dpl/dbus/connection.h index 886038c..49e8197 100644 --- a/modules/dbus/include/dpl/dbus/connection.h +++ b/modules/dbus/include/dpl/dbus/connection.h @@ -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) { } diff --git a/modules/encryption/src/resource_decryption.cpp b/modules/encryption/src/resource_decryption.cpp index e8f1590..b15deb6 100644 --- a/modules/encryption/src/resource_decryption.cpp +++ b/modules/encryption/src/resource_decryption.cpp @@ -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); } diff --git a/modules/localization/src/w3c_file_localization.cpp b/modules/localization/src/w3c_file_localization.cpp index bb19521..65af92c 100644 --- a/modules/localization/src/w3c_file_localization.cpp +++ b/modules/localization/src/w3c_file_localization.cpp @@ -121,7 +121,7 @@ DPL::Optional 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) { diff --git a/modules/utils/include/dpl/utils/file_utils.h b/modules/utils/include/dpl/utils/file_utils.h index 4248f70..6cdfefd 100644 --- a/modules/utils/include/dpl/utils/file_utils.h +++ b/modules/utils/include/dpl/utils/file_utils.h @@ -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 diff --git a/modules/utils/src/folder_size.cpp b/modules/utils/src/folder_size.cpp index bc2afdb..2982d44 100644 --- a/modules/utils/src/folder_size.cpp +++ b/modules/utils/src/folder_size.cpp @@ -115,10 +115,11 @@ const int stepSize = 1024; template struct Pre; + template struct Pre { - static const double value = Pre::value * stepSize; + static const double value; static std::string printSize(double fileSize) { if(fileSize >= Pre::value) { @@ -145,9 +146,14 @@ struct Pre<> } }; + const double Pre<>::value = 1.0; +template const double Pre::value(Pre<>::value * stepSize); + typedef Pre FolderSizeToStringType; + + } //anonymous namespace diff --git a/modules/utils/src/wrt_global_settings.cpp b/modules/utils/src/wrt_global_settings.cpp index 1a420f7..7927841 100644 --- a/modules/utils/src/wrt_global_settings.cpp +++ b/modules/utils/src/wrt_global_settings.cpp @@ -48,8 +48,8 @@ enum MachineType }; struct Settings { - int testModes; bool isEmulator; + int testModes; Settings() : isEmulator(false), testModes(0) diff --git a/modules/widget_dao/dao/config_parser_data.cpp b/modules/widget_dao/dao/config_parser_data.cpp index d2550cc..dde154f 100644 --- a/modules/widget_dao/dao/config_parser_data.cpp +++ b/modules/widget_dao/dao/config_parser_data.cpp @@ -25,6 +25,9 @@ #include 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) { diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index e899087..15b8b59 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -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); diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h index c3891c4..ff2fc09 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h @@ -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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index a0e3a99..7ec8a25 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -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;