Compilation warnings. Deprecated code. Part 1
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 5 Feb 2013 14:00:37 +0000 (15:00 +0100)
committerGerrit Code Review <gerrit2@kim11>
Thu, 7 Feb 2013 09:37:13 +0000 (18:37 +0900)
[Issue#]       LINUXWRT-6
[Bug]          Compilation warnings
[Cause]        N/A
[Solution]     Remove them
[Verification] Build repository. Run dao tests and dpl tests. Other repositories should be able to be built: wrt-installer,wrt-plugins-common,wrt

Change-Id: Idfee10320ff474d5c8eee817215db3fb05777934

18 files changed:
3rdparty/minizip/miniunz.c
3rdparty/minizip/minizip.c
modules/core/src/atomic.cpp
modules/support/wrt_plugin_export.h
modules/test/src/test_results_collector.cpp
modules/widget_dao/dao/feature_dao.cpp
modules/widget_dao/dao/plugin_dao.cpp
modules/widget_dao/dao/property_dao.cpp
modules/widget_dao/dao/property_dao_read_only.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/property_dao_read_only.h
modules/widget_dao/include/dpl/wrt-dao-rw/property_dao.h
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
tests/dao/TestCases_PropertyDAO.cpp
tests/dao/TestCases_WidgetDAO.cpp
tests/dpl/core/test_string.cpp
tests/dpl/db/orm/dpl_orm_test_db
tests/dpl/dbus/dbus_test.cpp

index 9ed009f..233e52d 100644 (file)
@@ -311,7 +311,6 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
     uInt size_buf;
 
     unz_file_info64 file_info;
-    uLong ratio=0;
     err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
 
     if (err!=UNZ_OK)
@@ -469,7 +468,6 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
     uLong i;
     unz_global_info64 gi;
     int err;
-    FILE* fout=NULL;
 
     err = unzGetGlobalInfo64(uf,&gi);
     if (err!=UNZ_OK)
@@ -503,7 +501,6 @@ int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,passwo
     int opt_overwrite;
     const char* password;
 {
-    int err = UNZ_OK;
     if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
     {
         printf("file %s not found in the zipfile\n",filename);
index a0a327b..ad2f4c7 100644 (file)
@@ -215,7 +215,7 @@ int isLargeFile(const char* filename)
 
   if(pFile != NULL)
   {
-    int n = fseeko64(pFile, 0, SEEK_END);
+    (void)fseeko64(pFile, 0, SEEK_END);
 
     pos = ftello64(pFile);
 
index cb5a585..032fbb8 100644 (file)
@@ -31,7 +31,7 @@ Atomic::Atomic(ValueType value)
 
 Atomic::ValueType Atomic::ExchangeAndAdd(ValueType value)
 {
-    return g_atomic_int_exchange_and_add(const_cast<gint* >(&m_value), value);
+    return g_atomic_int_add(const_cast<gint* >(&m_value), value);
 }
 
 bool Atomic::CompareAndExchange(ValueType oldValue, ValueType newValue)
index f57c59e..d091809 100644 (file)
@@ -140,7 +140,7 @@ typedef enum class_definition_iframe_behaviour_e
     //object should be copied as reference to each iframe
     REFERENCE,
     //object should be created for each iframe and NOT inform plugin
-    CREATE_INSTANCE,
+    CREATE_INSTANCE
 } class_definition_iframe_behaviour_t;
 
 typedef enum class_definition_iframe_notice_e
index c9c6ea4..cde4567 100644 (file)
@@ -608,7 +608,7 @@ class XmlCollector
             ThrowMsg(DPL::Exception, DPL::GetErrnoString(error));
         }
 
-        if (0 > fprintf(m_fp.Get(), m_outputBuffer.c_str()))
+        if (m_outputBuffer.size() != fwrite(m_outputBuffer.c_str(), 1, m_outputBuffer.size(), m_fp.Get()))
         {
             int error = errno;
             ThrowMsg(DPL::Exception, DPL::GetErrnoString(error));
index 2a272d2..8fadeeb 100755 (executable)
@@ -91,7 +91,7 @@ FeatureHandle RegisterFeature(const PluginMetafileData::Feature &feature,
 
                 WRT_DB_INSERT(insert, DeviceCapabilities, &WrtDatabase::interface())
                 insert->Values(row);
-                deviceCapID = insert->Execute();
+                deviceCapID = static_cast<int>(insert->Execute());
             }
 
             FeatureDeviceCapProxy::Row row;
index 804c739..bdbd993 100644 (file)
@@ -70,7 +70,7 @@ DbPluginHandle PluginDAO::registerPlugin(const PluginMetafileData& metafile,
 
             WRT_DB_INSERT(insert, PluginProperties, &WrtDatabase::interface())
             insert->Values(row);
-            handle = insert->Execute();
+            handle = static_cast<WrtDB::DbWidgetHandle>(insert->Execute());
             LogDebug(" >> Plugin Registered. Handle: " << handle);
         }
         transaction.Commit();
index a3cc3a9..14fcb51 100644 (file)
 
 namespace WrtDB {
 namespace PropertyDAO {
-//deprecated
-void RemoveProperty(DbWidgetHandle widgetHandle,
-                    const PropertyDAOReadOnly::WidgetPropertyKey &key)
-{
-    RemoveProperty(WidgetDAOReadOnly::getTzAppId(widgetHandle),key);
-}
 
 void RemoveProperty(TizenAppId tzAppid,
                     const PropertyDAOReadOnly::WidgetPropertyKey &key)
@@ -137,13 +131,6 @@ void SetProperty(TizenAppId tzAppid,
     }
 }
 
-//deprecated
-void RegisterProperties(DbWidgetHandle widgetHandle,
-                        const WidgetRegisterInfo &regInfo)
-{
-    RegisterProperties(WidgetDAOReadOnly::getTzAppId(widgetHandle),regInfo);
-}
-
 void RegisterProperties(TizenAppId tzAppid,
                         const WidgetRegisterInfo &regInfo)
 {
index 54ea797..c95f070 100644 (file)
@@ -108,12 +108,6 @@ DPL::OptionalInt CheckPropertyReadFlag(TizenAppId tzAppid,
     }
 }
 
-//deprecated
-WidgetPropertyKeyList GetPropertyKeyList(DbWidgetHandle widgetHandle)
-{
-    return GetPropertyKeyList(WidgetDAOReadOnly::getTzAppId(widgetHandle));
-}
-
 WidgetPropertyKeyList GetPropertyKeyList(TizenAppId tzAppid)
 {
     LogDebug("Get PropertyKey list. appid: " << tzAppid);
@@ -169,13 +163,6 @@ WidgetPreferenceList GetPropertyList(TizenAppId tzAppId)
     }
 }
 
-//deprecated
-WidgetPropertyValue GetPropertyValue(DbWidgetHandle widgetHandle,
-                                     const WidgetPropertyKey &key)
-{
-    return GetPropertyValue(WidgetDAOReadOnly::getTzAppId(widgetHandle),key);
-}
-
 WidgetPropertyValue GetPropertyValue(TizenAppId tzAppid,
                                      const WidgetPropertyKey &key)
 {
index 3beb2ba..eef1558 100644 (file)
@@ -70,32 +70,6 @@ WidgetDAO::~WidgetDAO()
 {
 }
 
-void WidgetDAO::removeProperty(
-        const PropertyDAOReadOnly::WidgetPropertyKey &key)
-{
-    Try {
-        PropertyDAO::RemoveProperty(m_widgetHandle, key);
-    }
-    Catch(PropertyDAOReadOnly::Exception::ReadOnlyProperty){
-        ReThrowMsg(WidgetDAO::Exception::DatabaseError,
-                   "Failure during removing property");
-    }
-}
-
-void WidgetDAO::setProperty(
-        const PropertyDAOReadOnly::WidgetPropertyKey &key,
-        const PropertyDAOReadOnly::WidgetPropertyValue &value,
-        bool readOnly)
-{
-    Try {
-        PropertyDAO::SetProperty(m_widgetHandle, key, value, readOnly);
-    }
-    Catch(PropertyDAOReadOnly::Exception::ReadOnlyProperty){
-        ReThrowMsg(WidgetDAO::Exception::DatabaseError,
-                   "Failure during setting/updating property");
-    }
-}
-
 void WidgetDAO::setTizenAppId(const DPL::OptionalString& tzAppId)
 {
     SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
@@ -267,21 +241,6 @@ void WidgetDAO::registerWidget(
     SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
 }
 
-void WidgetDAO::registerWidget(
-        WrtDB::DbWidgetHandle handle,
-        const WidgetRegisterInfo &widgetRegInfo,
-        const IWacSecurity &wacSecurity)
-{
-    LogDebug("Registering widget");
-    SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
-    {
-        DPL::DB::ORM::wrt::ScopedTransaction transaction(&WrtDatabase::interface());
-        registerWidgetInternal(generateTizenId(), widgetRegInfo, wacSecurity, handle);
-        transaction.Commit();
-    }
-    SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register widget")
-}
-
 DbWidgetHandle WidgetDAO::registerWidget(
             const WidgetRegisterInfo &pWidgetRegisterInfo,
             const IWacSecurity &wacSecurity)
@@ -295,7 +254,7 @@ DbWidgetHandle WidgetDAO::registerWidget(
         widgetHandle = rand();
     } while (isWidgetInstalled(widgetHandle));
 
-    registerWidget(widgetHandle, pWidgetRegisterInfo, wacSecurity);
+    registerWidget(*pWidgetRegisterInfo.configInfo.tizenAppId, pWidgetRegisterInfo, wacSecurity);
     return widgetHandle;
 }
 
@@ -326,7 +285,7 @@ void WidgetDAO::registerWidgetInternal(
 
     registerWidgetStartFile(widgetHandle, widgetRegInfo);
 
-    PropertyDAO::RegisterProperties(widgetHandle, widgetRegInfo);
+    PropertyDAO::RegisterProperties(tzAppId, widgetRegInfo);
 
     registerWidgetFeatures(widgetHandle, widgetRegInfo);
 
@@ -523,7 +482,7 @@ void WidgetDAO::registerWidgetIcons(DbWidgetHandle widgetHandle,
 
             WRT_DB_INSERT(insert, wrt::WidgetIcon, &WrtDatabase::interface())
             insert->Values(row);
-            icon_id = insert->Execute();
+            icon_id = static_cast<int>(insert->Execute());
         }
 
         FOREACH(j, i->availableLocales)
@@ -554,7 +513,7 @@ void WidgetDAO::registerWidgetStartFile(DbWidgetHandle widgetHandle,
 
             WRT_DB_INSERT(insert, WidgetStartFile, &WrtDatabase::interface())
             insert->Values(row);
-            startFileID = insert->Execute();
+            startFileID = static_cast<int>(insert->Execute());
         }
 
         FOREACH(j, i->propertiesForLocales)
@@ -590,7 +549,7 @@ void WidgetDAO::registerWidgetFeatures(DbWidgetHandle widgetHandle,
         {
             WRT_DB_INSERT(insert, wrt::WidgetFeature, &WrtDatabase::interface())
             insert->Values(widgetFeature);
-            widgetFeatureID = insert->Execute();
+            widgetFeatureID = static_cast<int>(insert->Execute());
         }
 
         // Insert into table FeatureParam
index 69b21c2..beb3101 100644 (file)
@@ -69,12 +69,6 @@ DPL::OptionalInt CheckPropertyReadFlag(DbWidgetHandle widgetHandle,
 DPL::OptionalInt CheckPropertyReadFlag(TizenAppId tzAppid,
                                   const WidgetPropertyKey &key);
 
-//deprecated
-/* This method gets widget property key list
- */
-WidgetPropertyKeyList GetPropertyKeyList(DbWidgetHandle widgetHandle)
-                            __attribute__((deprecated));
-
 /* This method gets widget property key list
  */
 WidgetPropertyKeyList GetPropertyKeyList(TizenAppId tzAppid);
@@ -89,12 +83,6 @@ WidgetPreferenceList GetPropertyList(DbWidgetHandle widgetHandle)
  */
 WidgetPreferenceList GetPropertyList(TizenAppId tzAppid);
 
-//deprecated
-/* This method get widget property value
- */
-WidgetPropertyValue GetPropertyValue(DbWidgetHandle widgetHandle,
-                                     const WidgetPropertyKey &key);
-
 /* This method get widget property value
  */
 WidgetPropertyValue GetPropertyValue(TizenAppId tzAppid,
index 95c3b6b..318dfe5 100644 (file)
@@ -31,11 +31,6 @@ struct WidgetRegisterInfo; //forward declaration
 
 namespace PropertyDAO {
 
-//deprecated
-void RemoveProperty(DbWidgetHandle widgetHandle,
-                    const PropertyDAOReadOnly::WidgetPropertyKey &key)
-                                        __attribute__((deprecated));
-
 void RemoveProperty(TizenAppId tzAppid,
                     const PropertyDAOReadOnly::WidgetPropertyKey &key);
 
@@ -55,14 +50,6 @@ void SetProperty(TizenAppId tzAppid,
                  const PropertyDAOReadOnly::WidgetPropertyValue &value,
                  bool readOnly = false);
 
-//deprecated
-/* This method registers properties for widget.
- * Properties unregistering is done via "delete cascade" mechanism in SQL
- */
-void RegisterProperties(DbWidgetHandle widgetHandle,
-                        const WidgetRegisterInfo &regInfo)
-                                        __attribute__((deprecated));
-
 /* This method registers properties for widget.
  * Properties unregistering is done via "delete cascade" mechanism in SQL
  */
index ec2a673..4dda147 100644 (file)
@@ -100,11 +100,6 @@ class WidgetDAO : public WidgetDAOReadOnly
             const WidgetRegisterInfo &widgetRegInfo,
             const IWacSecurity &wacSecurity);
 
-    static void registerWidget(
-            WrtDB::DbWidgetHandle handle,
-            const WidgetRegisterInfo &widgetRegInfo,
-            const IWacSecurity &wacSecurity) __attribute__((deprecated));
-
     /**
      * This method removes a widget's information from EmDB.
      *
index e72b01b..0024110 100644 (file)
@@ -31,7 +31,7 @@
 using namespace WrtDB;
 using namespace WrtDB::PropertyDAOReadOnly;
 
-// Widgets used 2000, 2001, 2002, 2003(saved by wrt_dao_tests_prepare_db.sh)
+// Widgets used "tizenid201", "tizenid202", "tizenid203", 2003(saved by wrt_dao_tests_prepare_db.sh)
 
 #define RUNNER_ASSERT_WHAT_EQUALS(in, test)                   \
     {std::string tmp(in);                                     \
@@ -53,11 +53,11 @@ Expected: data received should match those, which were inserted in prepare scrip
 RUNNER_TEST(property_dao_get_lists)
 {
     {//property list
-        std::map<WidgetHandle, size_t> prefsMap;
-        prefsMap.insert(std::pair<WidgetHandle, size_t>(2000, 2));
-        prefsMap.insert(std::pair<WidgetHandle, size_t>(2001, 1));
-        prefsMap.insert(std::pair<WidgetHandle, size_t>(2002, 2));
-        prefsMap.insert(std::pair<WidgetHandle, size_t>(1, 0)); //no widget
+        std::map<WrtDB::TizenAppId, size_t> prefsMap;
+        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid201", 2));
+        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid202", 1));
+        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"tizenid203", 2));
+        prefsMap.insert(std::pair<WrtDB::TizenAppId, size_t>(L"non_exists", 0)); //no widget
 
         FOREACH(it, prefsMap) {
             PropertyDAOReadOnly::WidgetPreferenceList prefs =
@@ -78,13 +78,13 @@ RUNNER_TEST(property_dao_get_lists)
         orig_2002.push_back(DPL::FromUTF8String("key1_for_2002"));
         orig_2002.push_back(DPL::FromUTF8String("key2_for_2002"));
 
-        std::map<WidgetHandle, WidgetPropertyKeyList *> prefsKeyMap;
-        prefsKeyMap.insert(std::pair<WidgetHandle, WidgetPropertyKeyList *>(
-                2000, &orig_2000));
-        prefsKeyMap.insert(std::pair<WidgetHandle, WidgetPropertyKeyList *>(
-                2001, &orig_2001));
-        prefsKeyMap.insert(std::pair<WidgetHandle, WidgetPropertyKeyList *>(
-                2002, &orig_2002));
+        std::map<WrtDB::TizenAppId, WidgetPropertyKeyList *> prefsKeyMap;
+        prefsKeyMap.insert(std::pair<WrtDB::TizenAppId, WidgetPropertyKeyList *>(
+                L"tizenid201", &orig_2000));
+        prefsKeyMap.insert(std::pair<WrtDB::TizenAppId, WidgetPropertyKeyList *>(
+                L"tizenid202", &orig_2001));
+        prefsKeyMap.insert(std::pair<WrtDB::TizenAppId, WidgetPropertyKeyList *>(
+                L"tizenid203", &orig_2002));
 
         FOREACH(it_out, prefsKeyMap) {
             WidgetPropertyKeyList got = PropertyDAOReadOnly::GetPropertyKeyList(
@@ -106,38 +106,38 @@ Expected: given operation should works
 */
 RUNNER_TEST(property_dao_set_update_remove)
 {
-    WidgetPropertyKeyList keys = PropertyDAOReadOnly::GetPropertyKeyList(2000);
+    WidgetPropertyKeyList keys = PropertyDAOReadOnly::GetPropertyKeyList(L"tizenid201");
 
     //ADD
-    PropertyDAO::SetProperty(2000,
+    PropertyDAO::SetProperty(L"tizenid201",
                              DPL::FromUTF8String("new_key"),
                              DPL::FromUTF8String("new_value1"));
 
     RUNNER_ASSERT_MSG(
-        keys.size() + 1 == PropertyDAOReadOnly::GetPropertyKeyList(2000).size(),
+        keys.size() + 1 == PropertyDAOReadOnly::GetPropertyKeyList(L"tizenid201").size(),
         "new property not added");
     RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(
-        PropertyDAOReadOnly::GetPropertyValue(2000,
+        PropertyDAOReadOnly::GetPropertyValue(L"tizenid201",
                                               DPL::FromUTF8String("new_key")),
         "new_value1");
 
     //UPDATE
-    PropertyDAO::SetProperty(2000,
+    PropertyDAO::SetProperty(L"tizenid201",
                              DPL::FromUTF8String("new_key"),
                              DPL::FromUTF8String("new_value2"));
     RUNNER_ASSERT_MSG(
-        keys.size() + 1 == PropertyDAOReadOnly::GetPropertyKeyList(2000).size(),
+        keys.size() + 1 == PropertyDAOReadOnly::GetPropertyKeyList(L"tizenid201").size(),
         "new property not added");
     RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(
-        PropertyDAOReadOnly::GetPropertyValue(2000,
+        PropertyDAOReadOnly::GetPropertyValue(L"tizenid201",
                                               DPL::FromUTF8String("new_key")),
         "new_value2");
 
     //REMOVE
-    PropertyDAO::RemoveProperty(2000, DPL::FromUTF8String("new_key"));
+    PropertyDAO::RemoveProperty(L"tizenid201", DPL::FromUTF8String("new_key"));
 
     RUNNER_ASSERT_MSG(
-        keys.size() == PropertyDAOReadOnly::GetPropertyKeyList(2000).size(),
+        keys.size() == PropertyDAOReadOnly::GetPropertyKeyList(L"tizenid201").size(),
         "property not removed");
 
 }
@@ -151,12 +151,12 @@ RUNNER_TEST(property_dao_get_value)
 {
     RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(
             PropertyDAOReadOnly::GetPropertyValue(
-                    2000, DPL::FromUTF8String("key1_for_2000")),
+                    L"tizenid201", DPL::FromUTF8String("key1_for_2000")),
                 "value_for_key1_2000");
 
     RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(
             PropertyDAOReadOnly::GetPropertyValue(
-                    2000, DPL::FromUTF8String("key2_for_2000")),
+                    L"tizenid201", DPL::FromUTF8String("key2_for_2000")),
                 "value_for_key2_2000");
 }
 
index 0add48d..2f9533d 100644 (file)
@@ -57,7 +57,7 @@ public:
     virtual bool isWacSigned() const { return mWacSigned; }
     virtual void getCertificateChainList(CertificateChainList& /*lst*/) const {}
     virtual void getCertificateChainList(CertificateChainList& /*lst*/,
-        CertificateSource source) const {}
+        CertificateSource /*source*/) const {}
 
     WrtDB::WidgetCertificateDataList& getCertificateListRef()
     {
index dea0a22..e64ab73 100644 (file)
@@ -80,7 +80,7 @@ int wbxml_base64_decode(const char *buffer, char **result)
     /* Malloc result buffer */
     if ((*result = (char*) malloc(nbytesdecoded + 1)) == NULL)
         return 0;
-    memset(*result, nbytesdecoded + 1, 0);
+    memset(*result, 0, nbytesdecoded + 1);
 
     bufout = *result;
     bufin = buffer;
index 8191624..0d1963b 100644 (file)
@@ -38,27 +38,27 @@ SQL(
 )
 
 CREATE_TABLE(TestTableJoin1)
-    COLUMN_NOT_NULL(TestID, INT)
-    COLUMN_NOT_NULL(TestText, TEXT)
-    COLUMN(TestNumber,      INT)
+    COLUMN_NOT_NULL(TestID, INT,)
+    COLUMN_NOT_NULL(TestText, TEXT,)
+    COLUMN(TestNumber,      INT,)
     TABLE_CONSTRAINTS(
         PRIMARY KEY(TestID)
     )
 CREATE_TABLE_END()
 
 CREATE_TABLE(TestTableJoin2)
-    COLUMN_NOT_NULL(TestID, INT)
-    COLUMN_NOT_NULL(TestText1,       TEXT)
-    COLUMN_NOT_NULL(TestText2,       TEXT)
+    COLUMN_NOT_NULL(TestID, INT,)
+    COLUMN_NOT_NULL(TestText1,       TEXT,)
+    COLUMN_NOT_NULL(TestText2,       TEXT,)
     TABLE_CONSTRAINTS(
         PRIMARY KEY(TestID)
     )
 CREATE_TABLE_END()
 
 CREATE_TABLE(TestTableJoin3)
-    COLUMN_NOT_NULL(TestID, INT)
-    COLUMN(Value3,          INT)
-    COLUMN(TestText33,      TEXT)
+    COLUMN_NOT_NULL(TestID, INT,)
+    COLUMN(Value3,          INT,)
+    COLUMN(TestText33,      TEXT,)
     TABLE_CONSTRAINTS(
         PRIMARY KEY(TestID)
     )
@@ -85,4 +85,4 @@ SQL(
     INSERT INTO TestTableJoin3 VALUES(6, 222, "test 4");
     INSERT INTO TestTableJoin3 (TestID, TestText33) VALUES(7, "test 5");
     INSERT INTO TestTableJoin3 (TestID, TestText33) VALUES(10, "test 6");
-)
\ No newline at end of file
+)
index 6071f9f..2ef9a1d 100644 (file)
@@ -47,6 +47,8 @@ void DBusTest::run(unsigned int timeout)
                                                 __LINE__,
                                                 m_message);
 
+    case Status::SUCCESS:
+    case Status::NONE:
     default:
         break;
     }