From 1e089e1f91c7280712d03947d60c0d922a414c34 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 23 May 2015 21:53:52 +0000 Subject: FTPFile to use standard locks git-svn-id: http://svn.miranda-ng.org/main/trunk@13806 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FTPFileYM/src/dbentry.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'plugins/FTPFileYM/src/dbentry.cpp') diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index b389c40430..82e21a2843 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . #include "common.h" int DBEntry::entryID; -Mutex DBEntry::mutexDB; +mir_cs DBEntry::mutexDB; DBEntry::DBEntry() { } @@ -113,20 +113,17 @@ void DBEntry::remove(int fileID) bool DBEntry::entryExists(GenericJob *job) { - Lock *lock = new Lock(mutexDB); + mir_cslock lock(mutexDB); DBEntry *entry = getFirts(); while (entry != NULL) { if (entry->iFtpNum == job->iFtpNum && !strcmp(entry->szFileName, job->szSafeFileName)) - { - delete lock; return true; - } + entry = getNext(entry); } - delete lock; return false; } @@ -135,7 +132,7 @@ void DBEntry::add(GenericJob *job) if (entryExists(job)) return; - Lock *lock = new Lock(mutexDB); + mir_cslock lock(mutexDB); int id = db_get_dw(0, MODULE_FILES, "NextFileID", 0); DB::setByteF(0, MODULE_FILES, "Ftp%d", id, job->iFtpNum); DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->szSafeFileName); @@ -149,8 +146,6 @@ void DBEntry::add(GenericJob *job) db_set_dw(0, MODULE_FILES, "NextFileID", id + 1); job->fileID = id; - - delete lock; } void DBEntry::setDeleteTS(GenericJob *job) @@ -161,8 +156,5 @@ void DBEntry::setDeleteTS(GenericJob *job) deleteTS += (job->tab->iOptAutoDelete * 60); DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->fileID, deleteTS); } - else - { - DB::deleteSettingF(0, MODULE_FILES, "DeleteTS%d", job->fileID); - } -} \ No newline at end of file + else DB::deleteSettingF(0, MODULE_FILES, "DeleteTS%d", job->fileID); +} -- cgit v1.2.3