diff options
author | Mataes <mataes2007@gmail.com> | 2018-03-17 22:36:40 +0300 |
---|---|---|
committer | Mataes <mataes2007@gmail.com> | 2018-03-17 22:36:40 +0300 |
commit | 81781c336c74447c4d64b367b958b2c7835f7271 (patch) | |
tree | efd90830d6e430e456cc3fd954b85bf21ac2d1e5 /plugins/FTPFileYM/src | |
parent | 3ad5334f17119c9ae010d5059f5cfb1831c9ddbd (diff) |
FTPFile: more correct version
Diffstat (limited to 'plugins/FTPFileYM/src')
-rw-r--r-- | plugins/FTPFileYM/src/dbentry.cpp | 11 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/ftpfile.cpp | 5 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/serverlist.cpp | 22 |
3 files changed, 13 insertions, 25 deletions
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index 492666db45..f5c5684327 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -43,13 +43,12 @@ DBEntry *DBEntry::getNext(DBEntry *entry) {
char szValue[256];
int count = db_get_dw(0, MODULE_FILES, "NextFileID", 0);
-
+
+ CMStringA frmt;
for (; entryID < count; entryID++) {
int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", entryID, -1);
if (ftpNum != -1) {
- CMStringA frmt;
- frmt.Format("Filename%d", entryID);
- ptrA Value(db_get_sa(NULL, MODULE, frmt));
+ ptrA Value(db_get_sa(NULL, MODULE, frmt.Format("Filename%d", entryID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = entryID;
@@ -91,9 +90,7 @@ DBEntry* DBEntry::get(int fileID) int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", fileID, -1);
if (ftpNum != -1) {
- CMStringA frmt;
- frmt.Format("Filename%d", fileID);
- ptrA Value(db_get_sa(NULL, MODULE, frmt));
+ ptrA Value(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Filename%d", fileID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = fileID;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 8d97382f11..ea90b234a8 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -108,10 +108,9 @@ void InitMenuItems() mi2.flags = CMIF_UNICODE | CMIF_SYSTEM;
mi2.pszService = MS_FTPFILE_CONTACTMENU;
+ CMStringA frmt;
for (int i = 0; i < ServerList::FTP_COUNT; i++) {
- CMStringA frmt;
- frmt.Format("Name%d", i);
- ptrA Name(db_get_sa(NULL, MODULE, frmt));
+ ptrA Name(db_get_sa(NULL, MODULE, frmt.Format("Name%d", i)));
if (Name)
mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1);
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index a2b865bcee..6169b1f86b 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -63,33 +63,25 @@ void ServerList::saveToDb() const ServerList::FTP::FTP(int index)
{
- CMStringA frmt;
- frmt.Format("Name%d", index);
- ptrA Name(db_get_sa(NULL, MODULE, frmt));
+ ptrA Name(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Name%d", index)));
if (Name)
mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1);
- frmt.Format("Password%d", index);
- ptrA Pass(db_get_sa(NULL, MODULE, frmt));
+ ptrA Pass(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Password%d", index)));
if (Pass)
strncpy_s(m_szPass, Pass, _TRUNCATE);
- frmt.Format("Server%d", index);
- ptrA Server(db_get_sa(NULL, MODULE, frmt));
+ ptrA Server(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Server%d", index)));
if (Server)
strncpy_s(m_szServer, Server, _TRUNCATE);
- frmt.Format("User%d", index);
- ptrA User(db_get_sa(NULL, MODULE, frmt));
+ ptrA User(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "User%d", index)));
if (User)
strncpy_s(m_szUser, User, _TRUNCATE);
- frmt.Format("Url%d", index);
- ptrA Url(db_get_sa(NULL, MODULE, frmt));
+ ptrA Url(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Url%d", index)));
if (Url)
strncpy_s(m_szUrl, Url, _TRUNCATE);
- frmt.Format("Dir%d", index);
- ptrA Dir(db_get_sa(NULL, MODULE, frmt));
+ ptrA Dir(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Dir%d", index)));
if (Dir)
strncpy_s(m_szDir, Dir, _TRUNCATE);
- frmt.Format("Chmod%d", index);
- ptrA Chmod(db_get_sa(NULL, MODULE, frmt));
+ ptrA Chmod(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Chmod%d", index)));
if (Chmod)
strncpy_s(m_szChmod, Chmod, _TRUNCATE);
m_ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULE, "FtpProto%d", index, FTP::FT_STANDARD);
|