diff options
author | George Hazan <george.hazan@gmail.com> | 2015-05-23 21:53:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-05-23 21:53:52 +0000 |
commit | 1e089e1f91c7280712d03947d60c0d922a414c34 (patch) | |
tree | 0baeff1d89a5195c5327d3d03b16fc112d163750 /plugins/FTPFileYM/src/dbentry.cpp | |
parent | 42f33aaf630e67c1b25d6cf9ca2ba1886e88d2f6 (diff) |
FTPFile to use standard locks
git-svn-id: http://svn.miranda-ng.org/main/trunk@13806 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/src/dbentry.cpp')
-rw-r--r-- | plugins/FTPFileYM/src/dbentry.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
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 <http://www.gnu.org/licenses/>. #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);
+}
|