diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 14:05:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 14:05:33 +0300 |
commit | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (patch) | |
tree | d92de519c6bc13e0ce3d8e42ba64deeb46d474dc /plugins | |
parent | 66b61f42871089f3962920924f9030cd6dff2ad8 (diff) |
code cleaning: old unions replaced with MAllStrings & MAllStringsArray
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CloudFile/src/file_transfer.h | 38 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 10 |
2 files changed, 24 insertions, 24 deletions
diff --git a/plugins/CloudFile/src/file_transfer.h b/plugins/CloudFile/src/file_transfer.h index bf055d737f..d568e60327 100644 --- a/plugins/CloudFile/src/file_transfer.h +++ b/plugins/CloudFile/src/file_transfer.h @@ -42,10 +42,10 @@ public: pfts.totalBytes = 0; pfts.totalFiles = 0; pfts.totalProgress = 0; - pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*) * (pfts.totalFiles + 1)); - pfts.ptszFiles[pfts.totalFiles] = NULL; - pfts.tszWorkingDir = NULL; - pfts.tszCurrentFile = NULL; + pfts.pszFiles.w = (wchar_t**)mir_alloc(sizeof(wchar_t*) * (pfts.totalFiles + 1)); + pfts.pszFiles.w[pfts.totalFiles] = NULL; + pfts.szWorkingDir.w = NULL; + pfts.szCurrentFile.w = NULL; ProtoBroadcastAck(MODULE, pfts.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)id, 0); } @@ -54,13 +54,13 @@ public: { CloseCurrentFile(); - if (pfts.tszWorkingDir) - mir_free(pfts.tszWorkingDir); + if (pfts.szWorkingDir.w) + mir_free(pfts.szWorkingDir.w); - if (pfts.pszFiles) { - for (int i = 0; pfts.pszFiles[i]; i++) - if (pfts.pszFiles[i]) mir_free(pfts.pszFiles[i]); - mir_free(pfts.pszFiles); + if (pfts.pszFiles.a) { + for (int i = 0; pfts.pszFiles.a[i]; i++) + mir_free(pfts.pszFiles.a[i]); + mir_free(pfts.pszFiles.a); } for (auto &link : m_links) @@ -115,8 +115,8 @@ public: void SetWorkingDirectory(const wchar_t *path) { relativePathStart = wcsrchr(path, '\\') - path + 1; - pfts.tszWorkingDir = (wchar_t*)mir_calloc(sizeof(wchar_t) * relativePathStart); - mir_wstrncpy(pfts.tszWorkingDir, path, relativePathStart); + pfts.szWorkingDir.w = (wchar_t*)mir_calloc(sizeof(wchar_t) * relativePathStart); + mir_wstrncpy(pfts.szWorkingDir.w, path, relativePathStart); if (PathIsDirectory(path)) folderName = wcsrchr(path, '\\') + 1; } @@ -133,9 +133,9 @@ public: void AddFile(const wchar_t *path) { - pfts.ptszFiles = (wchar_t**)mir_realloc(pfts.ptszFiles, sizeof(wchar_t*) * (pfts.totalFiles + 2)); - pfts.ptszFiles[pfts.totalFiles++] = mir_wstrdup(path); - pfts.ptszFiles[pfts.totalFiles] = NULL; + pfts.pszFiles.w = (wchar_t**)mir_realloc(pfts.pszFiles.w, sizeof(wchar_t*) * (pfts.totalFiles + 2)); + pfts.pszFiles.w[pfts.totalFiles++] = mir_wstrdup(path); + pfts.pszFiles.w[pfts.totalFiles] = NULL; FILE *file = _wfopen(path, L"rb"); if (file != NULL) { @@ -152,7 +152,7 @@ public: const wchar_t* GetCurrentFilePath() const { - return pfts.ptszFiles[pfts.currentFileNumber]; + return pfts.pszFiles.w[pfts.currentFileNumber]; } const wchar_t* GetCurrentRelativeFilePath() const @@ -162,7 +162,7 @@ public: const wchar_t* GetCurrentFileName() const { - return wcsrchr(pfts.ptszFiles[pfts.currentFileNumber], '\\') + 1; + return wcsrchr(pfts.pszFiles.w[pfts.currentFileNumber], '\\') + 1; } void OpenCurrentFile() @@ -227,7 +227,7 @@ public: pfts.currentFileNumber = 0; pfts.currentFileProgress = 0; - pfts.tszCurrentFile = wcsrchr(pfts.ptszFiles[pfts.currentFileNumber], '\\') + 1; + pfts.szCurrentFile.w = wcsrchr(pfts.pszFiles.w[pfts.currentFileNumber], '\\') + 1; if (pfts.hContact) ProtoBroadcastAck(MODULE, pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)id, (LPARAM)&pfts); @@ -243,7 +243,7 @@ public: return false; pfts.currentFileProgress = 0; - pfts.tszCurrentFile = wcsrchr(pfts.ptszFiles[pfts.currentFileNumber], '\\') + 1; + pfts.szCurrentFile.w = wcsrchr(pfts.pszFiles.w[pfts.currentFileNumber], '\\') + 1; if (pfts.hContact) ProtoBroadcastAck(MODULE, pfts.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)id, 0); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 27eef26991..a38429091d 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -273,14 +273,14 @@ int onProtoAck(WPARAM, LPARAM l) if ((f->flags & PFTS_SENDING) != PFTS_SENDING) { wchar_t *filename = nullptr; if (f->flags & PFTS_UNICODE) { - if (f->tszCurrentFile && f->tszCurrentFile[0]) - filename = mir_wstrdup(f->tszCurrentFile); + if (f->szCurrentFile.w && f->szCurrentFile.w[0]) + filename = mir_wstrdup(f->szCurrentFile.w); if (!filename) return 0; } else { - if (f->szCurrentFile && f->szCurrentFile[0]) - filename = mir_utf8decodeW(f->szCurrentFile); + if (f->szCurrentFile.a && f->szCurrentFile.a[0]) + filename = mir_utf8decodeW(f->szCurrentFile.a); if (!filename) return 0; } @@ -295,7 +295,7 @@ int onProtoAck(WPARAM, LPARAM l) if (!globals.bDecryptFiles) return 0; HistoryLog(ack->hContact, db_event("Received encrypted file, trying to decrypt", 0, 0, 0)); - if (!boost::filesystem::exists(f->tszCurrentFile)) + if (!boost::filesystem::exists(f->szCurrentFile.w)) return 0; string out; DWORD code; |