Fix svace issues 10/173210/3
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 20 Mar 2018 05:07:36 +0000 (14:07 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 20 Mar 2018 05:09:21 +0000 (14:09 +0900)
WGID-328328,328330,328332,328333,328334,
     328337,328339,328343,328345

Change-Id: I036d0c94c130a7ef1b6bca7db75b6cbec74ab6a0
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
packaging/org.tizen.download-manager.spec
src/download-manager-history-db.cpp

index 898f58c..cd279a6 100755 (executable)
@@ -1,7 +1,7 @@
 %define _ux_define tizen2.3
 Name:  org.tizen.download-manager
 Summary:       Application for support of the content download
-Version:       0.3.28
+Version:       0.3.29
 Release:       1
 License:       Flora-1.1
 Group:         misc
index 1fa15f8..e31cd8c 100755 (executable)
@@ -116,53 +116,53 @@ bool DownloadHistoryDB::createItemToDB(Item *item)
        /* binding values */
        if (sqlite3_bind_int(stmt, 1, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getDownloadType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 3, item->getContentType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 4, item->getState()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 5, item->getContentName().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 6, item->getUrl().c_str(), -1, NULL) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 7, item->getFileName().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 8, item->getReqHeaderField().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 9, item->getReqHeaderValue().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 10, item->getInstallDir().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_double(stmt, 11, time(NULL)) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_double:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
 
        ret = sqlite3_step(stmt);
@@ -209,63 +209,63 @@ bool DownloadHistoryDB::updateHistoryToDB(Item *item)
        /* binding values */
        if (sqlite3_bind_int(stmt, 1, item->getDownloadType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getContentType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 3, item->getState()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 4, item->getErrorCode()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 5, item->getTitle().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 6, item->getRegisteredFilePath().c_str(),
                        -1, NULL) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 7, item->getUrl().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 8, item->getFileName().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 9, item->getReqHeaderField().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 10, item->getReqHeaderValue().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 11, item->getInstallDir().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_double(stmt, 12, item->getFinishedTime()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_double:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 13, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        ret = sqlite3_step(stmt);
 
@@ -309,20 +309,20 @@ bool DownloadHistoryDB::updateCanceledItemToDB(Item *item)
        /* binding values */
        if (sqlite3_bind_int(stmt, 1, item->getState()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getErrorCode()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_double(stmt, 3, item->getFinishedTime()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_double:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 4, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        ret = sqlite3_step(stmt);
 
@@ -368,11 +368,11 @@ bool DownloadHistoryDB::updateNotiUrlToHistoryDB(Item *item)
        if (sqlite3_bind_text(stmt, 1, item->installNotifyUrl().c_str(), -1, NULL) !=
                SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        ret = sqlite3_step(stmt);
 
@@ -423,63 +423,63 @@ bool DownloadHistoryDB::updateDownloadInfoToDB(Item *item)
        /* binding values */
        if (sqlite3_bind_int(stmt, 1, item->getDownloadType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getContentType()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 3, item->getState()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 4, item->getTitle().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 5, item->getEtag().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_text(stmt, 6, item->getTempPath().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
 #ifdef _ENABLE_OMA_DOWNLOAD
        if (sqlite3_bind_text(stmt, 7, item->installNotifyUrl().c_str(), -1, NULL) !=
                        SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_text:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_double(stmt, 8, time(NULL)) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_double:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int64(stmt, 9, (sqlite_int64)item->getFileSize()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int64:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 10, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
 #else
        if (sqlite3_bind_double(stmt, 7, time(NULL)) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_double:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int64(stmt, 8, (sqlite_int64)item->getFileSize()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int64:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 9, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
 #endif
        ret = sqlite3_step(stmt);
@@ -525,11 +525,11 @@ bool DownloadHistoryDB::updateStateToDB(Item *item)
        /* binding values */
        if (sqlite3_bind_int(stmt, 1, item->getState()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        if (sqlite3_bind_int(stmt, 2, item->getHistoryId()) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s", sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
 
        ret = sqlite3_step(stmt);
@@ -892,7 +892,7 @@ bool DownloadHistoryDB::deleteItem(unsigned int historyId)
        if (sqlite3_bind_int(stmt, 1, historyId) != SQLITE_OK) {
                DM_LOGE("Fail to call sqlite3_bind_int:%s",
                                sqlite3_errmsg(historyDb));
-               return false;
+               FINALIZE_ON_ERROR(stmt);
        }
        ret = sqlite3_step(stmt);
        if (ret != SQLITE_OK && ret != SQLITE_DONE)
@@ -936,7 +936,7 @@ bool DownloadHistoryDB::deleteMultipleItem(queue <unsigned int> &q)
                if (sqlite3_bind_int(stmt, 1, historyId) != SQLITE_OK) {
                        DM_LOGE("Fail to call sqlite3_bind_int:%s",
                                        sqlite3_errmsg(historyDb));
-                       return false;
+                       FINALIZE_ON_ERROR(stmt);
                }
                ret = sqlite3_step(stmt);
                if (ret != SQLITE_OK && ret != SQLITE_DONE)