From 6a1a045e620dba38a7a64070af59d1a91b104921 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 26 Aug 2015 17:25:14 +0000 Subject: massive code cleaning due to numerous name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@15036 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FTPFileYM/src/dbentry.cpp | 94 ++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 51 deletions(-) (limited to 'plugins/FTPFileYM/src/dbentry.cpp') diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index de808096ac..625f0a023a 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -22,16 +22,17 @@ int DBEntry::entryID; mir_cs DBEntry::mutexDB; DBEntry::DBEntry() -{ } +{ +} DBEntry::DBEntry(DBEntry *entry) { - this->fileID = entry->fileID; - this->iFtpNum = entry->iFtpNum; - mir_strcpy(this->szFileName, entry->szFileName); + m_fileID = entry->m_fileID; + m_iFtpNum = entry->m_iFtpNum; + mir_strcpy(m_szFileName, entry->m_szFileName); } -DBEntry *DBEntry::getFirts() +DBEntry* DBEntry::getFirst() { entryID = 0; DBEntry *entry = new DBEntry(); @@ -43,17 +44,14 @@ DBEntry *DBEntry::getNext(DBEntry *entry) char szValue[256]; int count = db_get_dw(0, MODULE_FILES, "NextFileID", 0); - for (; entryID < count; entryID++) - { + for (; entryID < count; entryID++) { int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", entryID, -1); - if (ftpNum != -1) - { - if (!DB::getAStringF(0, MODULE_FILES, "Filename%d", entryID, szValue)) - { - entry->fileID = entryID; - entry->iFtpNum = ftpNum; - mir_strcpy(entry->szFileName, szValue); - entry->deleteTS = DB::getDwordF(0, MODULE_FILES, "DeleteTS%d", entryID, 0); + if (ftpNum != -1) { + if (!DB::getAStringF(0, MODULE_FILES, "Filename%d", entryID, szValue)) { + entry->m_fileID = entryID; + entry->m_iFtpNum = ftpNum; + mir_strcpy(entry->m_szFileName, szValue); + entry->m_deleteTS = DB::getDwordF(0, MODULE_FILES, "DeleteTS%d", entryID, 0); entryID++; return entry; } @@ -67,36 +65,33 @@ DBEntry *DBEntry::getNext(DBEntry *entry) void DBEntry::cleanupDB() { int count = 0; - - DBEntry *entry = getFirts(); - while (entry != NULL) - { - DB::setByteF(0, MODULE_FILES, "Ftp%d", count, entry->iFtpNum); - DB::setAStringF(0, MODULE_FILES, "Filename%d", count, entry->szFileName); - if (entry->deleteTS != 0) - DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", count, entry->deleteTS); - - count++; + + DBEntry *entry = getFirst(); + while (entry != NULL) { + DB::setByteF(0, MODULE_FILES, "Ftp%d", count, entry->m_iFtpNum); + DB::setAStringF(0, MODULE_FILES, "Filename%d", count, entry->m_szFileName); + if (entry->m_deleteTS != 0) + DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", count, entry->m_deleteTS); + + count++; entry = getNext(entry); } db_set_dw(0, MODULE_FILES, "NextFileID", count); } -DBEntry *DBEntry::get(int fileID) +DBEntry* DBEntry::get(int fileID) { char szValue[256]; DBEntry *entry = new DBEntry(); int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", fileID, -1); - if (ftpNum != -1) - { - if (!DB::getAStringF(0, MODULE_FILES, "Filename%d", fileID, szValue)) - { - entry->fileID = fileID; - entry->iFtpNum = ftpNum; - mir_strcpy(entry->szFileName, szValue); - entry->deleteTS = DB::getDwordF(0, MODULE_FILES, "DeleteTS%d", fileID, 0); + if (ftpNum != -1) { + if (!DB::getAStringF(0, MODULE_FILES, "Filename%d", fileID, szValue)) { + entry->m_fileID = fileID; + entry->m_iFtpNum = ftpNum; + mir_strcpy(entry->m_szFileName, szValue); + entry->m_deleteTS = DB::getDwordF(0, MODULE_FILES, "DeleteTS%d", fileID, 0); return entry; } } @@ -115,10 +110,9 @@ bool DBEntry::entryExists(GenericJob *job) { mir_cslock lock(mutexDB); - DBEntry *entry = getFirts(); - while (entry != NULL) - { - if (entry->iFtpNum == job->iFtpNum && !strcmp(entry->szFileName, job->szSafeFileName)) + DBEntry *entry = getFirst(); + while (entry != NULL) { + if (entry->m_iFtpNum == job->m_iFtpNum && !strcmp(entry->m_szFileName, job->m_szSafeFileName)) return true; entry = getNext(entry); @@ -129,32 +123,30 @@ bool DBEntry::entryExists(GenericJob *job) void DBEntry::add(GenericJob *job) { - if (entryExists(job)) + if (entryExists(job)) return; 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); + DB::setByteF(0, MODULE_FILES, "Ftp%d", id, job->m_iFtpNum); + DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName); - if (job->tab->iOptAutoDelete != -1) - { + if (job->m_tab->m_iOptAutoDelete != -1) { time_t deleteTS = time(NULL); - deleteTS += (job->tab->iOptAutoDelete * 60); + deleteTS += (job->m_tab->m_iOptAutoDelete * 60); DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS); } - + db_set_dw(0, MODULE_FILES, "NextFileID", id + 1); - job->fileID = id; + job->m_fileID = id; } void DBEntry::setDeleteTS(GenericJob *job) { - if (job->tab->iOptAutoDelete != -1) - { + if (job->m_tab->m_iOptAutoDelete != -1) { time_t deleteTS = time(NULL); - deleteTS += (job->tab->iOptAutoDelete * 60); - DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->fileID, deleteTS); + deleteTS += (job->m_tab->m_iOptAutoDelete * 60); + DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS); } - else DB::deleteSettingF(0, MODULE_FILES, "DeleteTS%d", job->fileID); + else DB::deleteSettingF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID); } -- cgit v1.2.3