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 | |
parent | 66b61f42871089f3962920924f9030cd6dff2ad8 (diff) |
code cleaning: old unions replaced with MAllStrings & MAllStringsArray
25 files changed, 223 insertions, 239 deletions
diff --git a/include/m_protocols.h b/include/m_protocols.h index 537cb5308d..e97e534faf 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -30,7 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct PROTO_INTERFACE;
#include "statusmodes.h"
+
#include <m_core.h>
+#include <m_system_cpp.h>
typedef struct {
MCONTACT hContact;
@@ -81,7 +83,8 @@ typedef struct { #define ACKRESULT_CONNECTPROXY 110 // connecting to file proxy
#define ACKRESULT_SEARCHRESULT 111 // result of extended search
-typedef struct {
+struct ACKDATA
+{
int cbSize;
const char *szModule; // the name of the protocol module which initiated this ack
MCONTACT hContact;
@@ -89,7 +92,7 @@ typedef struct { int result; // an ACKRESULT_ constant
HANDLE hProcess; // a caller-defined process code
LPARAM lParam; // caller-defined extra info
-} ACKDATA;
+};
#define ME_PROTO_ACK "Proto/Ack"
@@ -106,40 +109,22 @@ typedef struct { #define PFTS_UNICODE 2
#define PFTS_UTF 4
-typedef struct tagPROTOFILETRANSFERSTATUS
+struct PROTOFILETRANSFERSTATUS
{
- size_t cbSize;
- MCONTACT hContact;
- DWORD flags; // one of PFTS_* constants
-
- union {
- char **pszFiles;
- wchar_t **ptszFiles;
- wchar_t **pwszFiles;
- };
-
- int totalFiles;
- int currentFileNumber;
- unsigned __int64 totalBytes;
- unsigned __int64 totalProgress;
-
- union {
- char *szWorkingDir;
- wchar_t *tszWorkingDir;
- wchar_t *wszWorkingDir;
- };
-
- union {
- char *szCurrentFile;
- wchar_t *tszCurrentFile;
- wchar_t *wszCurrentFile;
- };
-
- unsigned __int64 currentFileSize;
- unsigned __int64 currentFileProgress;
- unsigned __int64 currentFileTime; // as seconds since 1970
-}
- PROTOFILETRANSFERSTATUS;
+ size_t cbSize;
+ MCONTACT hContact;
+ DWORD flags; // one of PFTS_* constants
+ MAllStringArray pszFiles;
+ int totalFiles;
+ int currentFileNumber;
+ uint64_t totalBytes;
+ uint64_t totalProgress;
+ MAllStrings szWorkingDir;
+ MAllStrings szCurrentFile;
+ uint64_t currentFileSize;
+ uint64_t currentFileProgress;
+ uint64_t currentFileTime; // as seconds since 1970
+};
#define PROTOCOLDESCRIPTOR_V3_SIZE (sizeof(size_t)+sizeof(INT_PTR)+sizeof(char*))
@@ -306,19 +291,19 @@ struct MIR_APP_EXPORT PROTOACCOUNT // wParam = (WPARAM)(int*)piNumAccounts
// lParam = (LPARAM)(PROTOACCOUNT**)paAccounts
-MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs);
+EXTERN_C MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs);
/////////////////////////////////////////////////////////////////////////////////////////
// creates new account
// return value = PROTOACCOUNT* or NULL
-MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const char *pszBaseProto, const wchar_t *ptszAccountName);
+EXTERN_C MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const char *pszBaseProto, const wchar_t *ptszAccountName);
/////////////////////////////////////////////////////////////////////////////////////////
// constructs the appropriate PROTOACCOUNT::ppro member if needed
// returns true if succeeded
-MIR_APP_DLL(bool) Proto_ActivateAccount(PROTOACCOUNT *pAccount);
+EXTERN_C MIR_APP_DLL(bool) Proto_ActivateAccount(PROTOACCOUNT *pAccount);
/////////////////////////////////////////////////////////////////////////////////////////
// retrieves an account's interface by its physical name (database module)
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 11d890bcb3..61a7a8c27b 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 0c9196c201..8388ed560a 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib 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; diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 966804297e..c24d0d9e42 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -1105,8 +1105,8 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) fts.totalBytes = rcTotalSize; fts.totalFiles = rcTotalFiles; fts.totalProgress = 0; - fts.wszWorkingDir = conn->m_szDir; - fts.pwszFiles = conn->m_szFiles; + fts.szWorkingDir.w = conn->m_szDir; + fts.pszFiles.w = conn->m_szFiles; bool err = false; @@ -1118,7 +1118,7 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) } EMLOG("Ok"); - fts.szCurrentFile = fts.pszFiles[fileNo]; + fts.szCurrentFile.a = fts.pszFiles.a[fileNo]; fts.currentFileNumber = fileNo; fts.currentFileProgress = 0; fts.currentFileSize = *((int*)(conn->m_buf + 1)); @@ -1310,8 +1310,8 @@ void CMLan::OnOutTCPConnection(u_long, SOCKET out_socket, LPVOID lpParameter) fts.totalBytes = size; fts.totalFiles = filecount; fts.totalProgress = 0; - fts.wszWorkingDir = conn->m_szDir; - fts.pwszFiles = conn->m_szFiles; + fts.szWorkingDir.w = conn->m_szDir; + fts.pszFiles.w = conn->m_szFiles; EMLOG("Sending file size"); if (conn->Send(buf, len)) { @@ -1371,7 +1371,7 @@ void CMLan::OnOutTCPConnection(u_long, SOCKET out_socket, LPVOID lpParameter) int filepos = *((int*)(conn->m_buf + 1)); SetFilePointer(hFile, filepos, nullptr, FILE_BEGIN); - fts.szCurrentFile = fts.pszFiles[fileNo]; + fts.szCurrentFile.a = fts.pszFiles.a[fileNo]; fts.currentFileTime = get_time(); fts.currentFileNumber = fileNo; fts.currentFileProgress = filepos; diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 4d95ef5828..4d51ee4103 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -282,13 +282,13 @@ void __cdecl GaduProto::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
pfts.totalProgress = local_dcc->offset;
- pfts.szWorkingDir = local_dcc->folder;
- pfts.szCurrentFile = szFilename;
+ pfts.szWorkingDir.a = local_dcc->folder;
+ pfts.szCurrentFile.a = szFilename;
pfts.currentFileSize = local_dcc->file_info.size;
pfts.currentFileProgress = local_dcc->offset;
pfts.currentFileTime = 0;
@@ -312,13 +312,13 @@ void __cdecl GaduProto::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc->contact;
pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND);
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc->file_info.size;
pfts.totalProgress = local_dcc->file_info.size;
- pfts.szWorkingDir = local_dcc->folder;
- pfts.szCurrentFile = szFilename;
+ pfts.szWorkingDir.a = local_dcc->folder;
+ pfts.szCurrentFile.a = szFilename;
pfts.currentFileSize = local_dcc->file_info.size;
pfts.currentFileProgress = local_dcc->file_info.size;
pfts.currentFileTime = 0;
@@ -511,13 +511,13 @@ void __cdecl GaduProto::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
pfts.totalProgress = local_dcc7->offset;
- pfts.szWorkingDir = local_dcc7->folder;
- pfts.szCurrentFile = szFilename;
+ pfts.szWorkingDir.a = local_dcc7->folder;
+ pfts.szCurrentFile.a = szFilename;
pfts.currentFileSize = local_dcc7->size;
pfts.currentFileProgress = local_dcc7->offset;
pfts.currentFileTime = 0;
@@ -541,13 +541,13 @@ void __cdecl GaduProto::dccmainthread(void*) pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (UINT_PTR)local_dcc7->contact;
pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND);
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = local_dcc7->size;
pfts.totalProgress = local_dcc7->size;
- pfts.szWorkingDir = local_dcc7->folder;
- pfts.szCurrentFile = szFilename;
+ pfts.szWorkingDir.a = local_dcc7->folder;
+ pfts.szCurrentFile.a = szFilename;
pfts.currentFileSize = local_dcc7->size;
pfts.currentFileProgress = local_dcc7->size;
pfts.currentFileTime = 0;
diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index a13f961a43..a3917047dc 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -309,13 +309,13 @@ void ICQTransfer::ack(unsigned int result) fts.cbSize = sizeof(fts);
fts.flags = PFTS_UNICODE;
fts.hContact = hContact;
- fts.pwszFiles = files;
+ fts.pszFiles.w = files;
fts.totalFiles = count;
fts.currentFileNumber = current;
fts.totalBytes = totalSize;
fts.totalProgress = totalProgress;
- fts.wszWorkingDir = path;
- fts.wszCurrentFile = fileName;
+ fts.szWorkingDir.w = path;
+ fts.szCurrentFile.w = fileName;
fts.currentFileSize = fileSize;
fts.currentFileProgress = fileProgress;
fts.currentFileTime = TimeZone_ToLocal(fileDate);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 1dea025bbe..956634afb0 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -853,15 +853,15 @@ int CDccSession::SetupConnection() file[0] = (wchar_t*)di->sFileAndPath.c_str(); file[1] = nullptr; - pfts.tszCurrentFile = (wchar_t*)di->sFileAndPath.c_str(); - pfts.tszWorkingDir = (wchar_t*)di->sPath.c_str(); + pfts.szCurrentFile.w = (wchar_t*)di->sFileAndPath.c_str(); + pfts.szWorkingDir.w = (wchar_t*)di->sPath.c_str(); pfts.hContact = di->hContact; pfts.flags = PFTS_UNICODE + ((di->bSender) ? PFTS_SENDING : PFTS_RECEIVING); pfts.totalFiles = 1; pfts.currentFileNumber = 0; pfts.totalBytes = di->dwSize; pfts.currentFileSize = pfts.totalBytes; - pfts.ptszFiles = file; + pfts.pszFiles.w = file; pfts.totalProgress = 0; pfts.currentFileProgress = 0; pfts.currentFileTime = (unsigned long)time(nullptr); @@ -919,8 +919,8 @@ int CDccSession::SetupConnection() di->sFile = di->sFileAndPath.Mid(i + 1); } - pfts.tszCurrentFile = di->sFileAndPath.GetBuffer(); - pfts.tszWorkingDir = di->sPath.GetBuffer(); + pfts.szCurrentFile.w = di->sFileAndPath.GetBuffer(); + pfts.szWorkingDir.w = di->sPath.GetBuffer(); pfts.totalBytes = di->dwSize; pfts.currentFileSize = pfts.totalBytes; diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 1d8caa1241..5e001d8abc 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -32,15 +32,15 @@ static void file_buildProtoFileTransferStatus(filetransfer* ft, PROTOFILETRANSFE pfts->hContact = ft->hContact;
pfts->flags = PFTS_UTF | (ft->sending ? PFTS_SENDING : PFTS_RECEIVING); /* Standard FT is Ansi only */
if (ft->sending)
- pfts->pszFiles = ft->pszFiles;
+ pfts->pszFiles.a = ft->pszFiles;
else
- pfts->pszFiles = nullptr; /* FIXME */
+ pfts->pszFiles.a = nullptr; /* FIXME */
pfts->totalFiles = ft->dwFileCount;
pfts->currentFileNumber = ft->iCurrentFile;
pfts->totalBytes = ft->dwTotalSize;
pfts->totalProgress = ft->dwBytesDone;
- pfts->szWorkingDir = ft->szSavePath;
- pfts->szCurrentFile = ft->szThisFile;
+ pfts->szWorkingDir.a = ft->szSavePath;
+ pfts->szCurrentFile.a = ft->szThisFile;
pfts->currentFileSize = ft->dwThisFileSize;
pfts->currentFileTime = ft->dwThisFileDate;
pfts->currentFileProgress = ft->dwFileBytesDone;
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 6da9246a8e..39bd428744 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1010,15 +1010,15 @@ static void oft_buildProtoFileTransferStatus(oscar_filetransfer* ft, PROTOFILETR pfts->hContact = ft->hContact;
pfts->flags = PFTS_UTF + ((ft->flags & OFTF_SENDING) ? PFTS_SENDING : PFTS_RECEIVING);
if (ft->flags & OFTF_SENDING)
- pfts->pszFiles = ft->files_list;
+ pfts->pszFiles.a = ft->files_list;
else
- pfts->pszFiles = nullptr; /* FIXME */
+ pfts->pszFiles.a = nullptr; /* FIXME */
pfts->totalFiles = ft->wFilesCount;
pfts->currentFileNumber = ft->iCurrentFile;
pfts->totalBytes = ft->qwTotalSize;
pfts->totalProgress = ft->qwBytesDone;
- pfts->szWorkingDir = ft->szThisPath;
- pfts->szCurrentFile = ft->szThisFile;
+ pfts->szWorkingDir.a = ft->szThisPath;
+ pfts->szCurrentFile.a = ft->szThisFile;
pfts->currentFileSize = ft->qwThisFileSize;
pfts->currentFileTime = ft->dwThisFileDate;
pfts->currentFileProgress = ft->qwFileBytesDone;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 929dc061ab..eebf790d5d 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -118,8 +118,8 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) s++;
else
s = ft->httpPath;
- ft->std.tszCurrentFile = mir_wstrdup(s);
- JabberHttpUrlDecode(ft->std.tszCurrentFile);
+ ft->std.szCurrentFile.w = mir_wstrdup(s);
+ JabberHttpUrlDecode(ft->std.szCurrentFile.w);
if (ft->create() == -1) {
ft->state = FT_ERROR;
break;
@@ -274,10 +274,10 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->httpPath = nullptr;
wchar_t *p;
- if ((p = wcschr(ft->std.ptszFiles[i], '\\')) != nullptr)
+ if ((p = wcschr(ft->std.pszFiles.w[i], '\\')) != nullptr)
p++;
else
- p = ft->std.ptszFiles[i];
+ p = ft->std.pszFiles.w[i];
ptrA pFileName(mir_urlEncode(T2Utf(p)));
if (pFileName != nullptr) {
@@ -384,11 +384,11 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i num += 2;
currentFile = ft->std.currentFileNumber;
- wchar_t *t = wcsrchr(ft->std.ptszFiles[currentFile], '\\');
+ wchar_t *t = wcsrchr(ft->std.pszFiles.w[currentFile], '\\');
if (t != nullptr)
t++;
else
- t = ft->std.ptszFiles[currentFile];
+ t = ft->std.pszFiles.w[currentFile];
if (ft->httpPath == nullptr || mir_wstrcmp(ft->httpPath, t)) {
if (ft->httpPath == nullptr)
@@ -398,9 +398,9 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i ft->state = FT_ERROR;
break;
}
- debugLogW(L"Sending [%s]", ft->std.ptszFiles[currentFile]);
- _wstat64(ft->std.ptszFiles[currentFile], &statbuf); // file size in statbuf.st_size
- if ((fileId = _wopen(ft->std.ptszFiles[currentFile], _O_BINARY | _O_RDONLY)) < 0) {
+ debugLogW(L"Sending [%s]", ft->std.pszFiles.w[currentFile]);
+ _wstat64(ft->std.pszFiles.w[currentFile], &statbuf); // file size in statbuf.st_size
+ if ((fileId = _wopen(ft->std.pszFiles.w[currentFile], _O_BINARY | _O_RDONLY)) < 0) {
debugLogA("File cannot be opened");
ft->state = FT_ERROR;
mir_free(ft->httpPath);
@@ -475,13 +475,13 @@ filetransfer::~filetransfer() mir_free(httpPath);
mir_free(szDescription);
- mir_free(std.tszWorkingDir);
- mir_free(std.tszCurrentFile);
+ mir_free(std.szWorkingDir.w);
+ mir_free(std.szCurrentFile.w);
- if (std.ptszFiles) {
+ if (std.pszFiles.w) {
for (int i = 0; i < std.totalFiles; i++)
- mir_free(std.ptszFiles[i]);
- mir_free(std.ptszFiles);
+ mir_free(std.pszFiles.w[i]);
+ mir_free(std.pszFiles.w);
} }
void filetransfer::close()
@@ -505,8 +505,8 @@ int filetransfer::create() return fileId;
wchar_t filefull[MAX_PATH];
- mir_snwprintf(filefull, L"%s\\%s", std.tszWorkingDir, std.tszCurrentFile);
- replaceStrW(std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", std.szWorkingDir.w, std.szCurrentFile.w);
+ replaceStrW(std.szCurrentFile.w, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
CloseHandle(hWaitEvent);
@@ -516,8 +516,8 @@ int filetransfer::create() WaitForSingleObject(hWaitEvent, INFINITE);
if (fileId == -1) {
- ppro->debugLogW(L"Saving to [%s]", std.tszCurrentFile);
- fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
+ ppro->debugLogW(L"Saving to [%s]", std.szCurrentFile.w);
+ fileId = _wopen(std.szCurrentFile.w, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
}
if (fileId == -1)
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 4ef7a7f3d4..b729e79206 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -95,7 +95,7 @@ void CJabberProto::FtInitiate(wchar_t* jid, filetransfer *ft) sid[8] = '\0';
if (ft->sid != nullptr) mir_free(ft->sid);
ft->sid = mir_wstrdup(sid);
- filename = ft->std.ptszFiles[ft->std.currentFileNumber];
+ filename = ft->std.pszFiles.w[ft->std.currentFileNumber];
if ((p = wcsrchr(filename, '\\')) != nullptr)
filename = p + 1;
@@ -187,9 +187,9 @@ BOOL CJabberProto::FtSend(HNETLIBCONN hConn, filetransfer *ft) char* buffer;
int numRead;
- debugLogW(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
- _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
- if ((fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
+ debugLogW(L"Sending [%s]", ft->std.pszFiles.w[ft->std.currentFileNumber]);
+ _wstat64(ft->std.pszFiles.w[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
+ if ((fd = _wopen(ft->std.pszFiles.w[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY)) < 0) {
debugLogW(L"File cannot be opened");
return FALSE;
}
@@ -217,12 +217,12 @@ BOOL CJabberProto::FtSend(HNETLIBCONN hConn, filetransfer *ft) BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
{
- debugLogW(L"Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
+ debugLogW(L"Sending [%s]", ft->std.pszFiles.w[ft->std.currentFileNumber]);
struct _stati64 statbuf;
- _wstat64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
+ _wstat64(ft->std.pszFiles.w[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
- int fd = _wopen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY);
+ int fd = _wopen(ft->std.pszFiles.w[ft->std.currentFileNumber], _O_BINARY | _O_RDONLY);
if (fd < 0) {
debugLogA("File cannot be opened");
return FALSE;
@@ -284,7 +284,7 @@ void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft) else {
if (ft->std.currentFileNumber < ft->std.totalFiles - 1) {
ft->std.currentFileNumber++;
- replaceStrW(ft->std.tszCurrentFile, ft->std.ptszFiles[ft->std.currentFileNumber]);
+ replaceStrW(ft->std.szCurrentFile.w, ft->std.pszFiles.w[ft->std.currentFileNumber]);
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
FtInitiate(ft->jid, ft);
return;
@@ -371,7 +371,7 @@ void CJabberProto::FtHandleSiRequest(HXML iqNode) ft->szId = mir_wstrdup(szId);
ft->type = ftType;
ft->std.totalFiles = 1;
- ft->std.tszCurrentFile = mir_wstrdup(filename);
+ ft->std.szCurrentFile.w = mir_wstrdup(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
PROTORECVFILE pre = { 0 };
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index e40d079ea0..86e77d04bc 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -492,10 +492,10 @@ HANDLE __cdecl CJabberProto::FileAllow(MCONTACT /*hContact*/, HANDLE hTransfer, return nullptr;
filetransfer *ft = (filetransfer*)hTransfer;
- ft->std.tszWorkingDir = mir_wstrdup(szPath);
- size_t len = mir_wstrlen(ft->std.tszWorkingDir)-1;
- if (ft->std.tszWorkingDir[len] == '/' || ft->std.tszWorkingDir[len] == '\\')
- ft->std.tszWorkingDir[len] = 0;
+ ft->std.szWorkingDir.w = mir_wstrdup(szPath);
+ size_t len = mir_wstrlen(ft->std.szWorkingDir.w)-1;
+ if (ft->std.szWorkingDir.w[len] == '/' || ft->std.szWorkingDir.w[len] == '\\')
+ ft->std.szWorkingDir.w[len] = 0;
switch (ft->type) {
case FT_OOB:
@@ -577,7 +577,7 @@ int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const wchar_ return 1;
if (*action == FILERESUME_RENAME)
- replaceStrW(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.szCurrentFile.w, *szFilename);
SetEvent(ft->hWaitEvent);
return 0;
@@ -902,7 +902,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri while (ppszFiles[ft->std.totalFiles] != nullptr)
ft->std.totalFiles++;
- ft->std.ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)* ft->std.totalFiles);
+ ft->std.pszFiles.w = (wchar_t**)mir_calloc(sizeof(wchar_t*)* ft->std.totalFiles);
ft->fileSize = (unsigned __int64*)mir_calloc(sizeof(unsigned __int64)* ft->std.totalFiles);
int i, j;
@@ -910,7 +910,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri if (_wstat64(ppszFiles[i], &statbuf))
debugLogW(L"'%s' is an invalid filename", ppszFiles[i]);
else {
- ft->std.ptszFiles[j] = mir_wstrdup(ppszFiles[i]);
+ ft->std.pszFiles.w[j] = mir_wstrdup(ppszFiles[i]);
ft->fileSize[j] = statbuf.st_size;
j++;
ft->std.totalBytes += statbuf.st_size;
@@ -921,7 +921,7 @@ HANDLE __cdecl CJabberProto::SendFile(MCONTACT hContact, const wchar_t *szDescri return nullptr;
}
- ft->std.tszCurrentFile = mir_wstrdup(ppszFiles[0]);
+ ft->std.szCurrentFile.w = mir_wstrdup(ppszFiles[0]);
ft->szDescription = mir_wstrdup(szDescription);
ft->jid = mir_wstrdup(jid);
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index ee10de4897..996503fee4 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -736,7 +736,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) //pfts.currentFileNumber = 0;
pfts.totalBytes = dat->dwFilesTotalSize;
//pfts.totalProgress = 0;
- pfts.wszWorkingDir = dat->lpwszPath;
+ pfts.szWorkingDir.w = dat->lpwszPath;
//pfts.currentFile;
//pfts.currentFileSize;
//pfts.currentFileProgress;
@@ -766,7 +766,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) bFailed = FALSE;
for (i = 0; i < dat->dwFilesCount; i++) {// receiving files
pfts.currentFileNumber = (int)i;
- pfts.wszCurrentFile = wszFileName;
+ pfts.szCurrentFile.w = wszFileName;
pfts.currentFileSize = dat->pmfqfFiles[i].dwSize;
pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
@@ -987,7 +987,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) pfts.flags = (PFTS_SENDING | PFTS_UNICODE);// pfts.sending = dat->bSending; //true if sending, false if receiving
pfts.totalFiles = dat->dwFilesCount;
pfts.totalBytes = dat->dwFilesTotalSize;
- pfts.wszWorkingDir = dat->lpwszPath;
+ pfts.szWorkingDir.w = dat->lpwszPath;
dwSendBlockSize = getDword("FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE);
if (dwSendBlockSize > _countof(btBuff)) dwSendBlockSize = _countof(btBuff);
@@ -1056,7 +1056,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) bOK = FALSE;
dwUpdateTimeNext = GetTickCount();
pfts.currentFileNumber = (int)i;
- pfts.wszCurrentFile = dat->pmfqfFiles[j].lpwszName;
+ pfts.szCurrentFile.w = dat->pmfqfFiles[j].lpwszName;
pfts.currentFileSize = dat->pmfqfFiles[j].dwSize;
pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index d9c64ed438..639cef5596 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -429,7 +429,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) ft->std.hContact = hContact;
ft->tType = SERVER_HTTP;
ft->p2p_appID = MSN_APPID_FILE;
- mir_free(ft->std.tszCurrentFile);
+ mir_free(ft->std.szCurrentFile.w);
if (!((originalName = ezxml_child(xmli, "OriginalName")) && (pszFile = (char*)ezxml_attr(originalName, "v")))) {
if ((originalName = ezxml_child(xmli, "meta")))
pszFile = (char*)ezxml_attr(originalName, "originalName");
@@ -440,7 +440,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) }
if (!pszFile || !*pszFile) pszFile="file";
}
- ft->std.tszCurrentFile = mir_utf8decodeW(pszFile);
+ ft->std.szCurrentFile.w = mir_utf8decodeW(pszFile);
ft->std.totalBytes = ft->std.currentFileSize = fileSize;
ft->std.totalFiles = 1;
ft->szInvcookie = (char*)mir_calloc(strlen(uri)+16);
@@ -457,7 +457,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) pre.fileCount = 1;
pre.timestamp = time(nullptr);
pre.descr.w = (desc = ezxml_child(xmli, "Description"))?mir_utf8decodeW(desc->txt):tComment;
- pre.files.w = &ft->std.tszCurrentFile;
+ pre.files.w = &ft->std.szCurrentFile.w;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
if (desc) mir_free(pre.descr.w);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 3e2180ac1f..4018af2f67 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -915,7 +915,7 @@ filetransfer::~filetransfer(void) _close(fileId);
if (!bCompleted && p2p_appID == MSN_APPID_FILE) {
- std.ptszFiles = nullptr;
+ std.pszFiles.w = nullptr;
std.totalFiles = 0;
proto->ProtoBroadcastAck(std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, this, 0);
}
@@ -925,12 +925,12 @@ filetransfer::~filetransfer(void) mir_free(p2p_dest);
mir_free(p2p_object);
- mir_free(std.tszCurrentFile);
- mir_free(std.tszWorkingDir);
- if (std.ptszFiles != nullptr) {
- for (int i = 0; std.ptszFiles[i]; i++)
- mir_free(std.ptszFiles[i]);
- mir_free(std.ptszFiles);
+ mir_free(std.szCurrentFile.w);
+ mir_free(std.szWorkingDir.w);
+ if (std.pszFiles.w != nullptr) {
+ for (int i = 0; std.pszFiles.w[i]; i++)
+ mir_free(std.pszFiles.w[i]);
+ mir_free(std.pszFiles.w);
}
mir_free(szInvcookie);
@@ -955,10 +955,10 @@ int filetransfer::create(void) int flags = _O_BINARY | _O_CREAT | _O_WRONLY | _O_APPEND;
if (std.currentFileProgress == 0) flags |= _O_TRUNC;
- fileId = _wopen(std.tszCurrentFile, flags, _S_IREAD | _S_IWRITE);
+ fileId = _wopen(std.szCurrentFile.w, flags, _S_IREAD | _S_IWRITE);
if (fileId == -1)
- proto->MSN_ShowError("Cannot create file '%s' during a file transfer", std.tszCurrentFile);
+ proto->MSN_ShowError("Cannot create file '%s' during a file transfer", std.szCurrentFile.w);
// else if (std.currentFileSize != 0)
// _chsize(fileId, std.currentFileSize);
@@ -973,18 +973,18 @@ int filetransfer::openNext(void) ++cf;
}
- while (std.ptszFiles && std.ptszFiles[cf]) {
+ while (std.pszFiles.w && std.pszFiles.w[cf]) {
struct _stati64 statbuf;
- if (_wstat64(std.ptszFiles[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
+ if (_wstat64(std.pszFiles.w[cf], &statbuf) == 0 && (statbuf.st_mode & _S_IFDIR) == 0)
break;
++cf;
}
- if (std.ptszFiles && std.ptszFiles[cf]) {
+ if (std.pszFiles.w && std.pszFiles.w[cf]) {
bCompleted = false;
- replaceStrW(std.tszCurrentFile, std.ptszFiles[cf]);
- fileId = _wopen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
+ replaceStrW(std.szCurrentFile.w, std.pszFiles.w[cf]);
+ fileId = _wopen(std.szCurrentFile.w, _O_BINARY | _O_RDONLY, _S_IREAD);
if (fileId != -1) {
std.currentFileSize = _filelengthi64(fileId);
std.currentFileProgress = 0;
@@ -998,7 +998,7 @@ int filetransfer::openNext(void) mir_free(p2p_callID); p2p_callID = nullptr;
}
else
- proto->MSN_ShowError("Unable to open file '%s' for the file transfer, error %d", std.tszCurrentFile, errno);
+ proto->MSN_ShowError("Unable to open file '%s' for the file transfer, error %d", std.szCurrentFile.w, errno);
}
return fileId;
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 0a7103ebd3..c5e4678e97 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -452,8 +452,8 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) filetransfer* ft = (filetransfer*)arg;
wchar_t filefull[MAX_PATH];
- mir_snwprintf(filefull, L"%s\\%s", ft->std.tszWorkingDir, ft->std.tszCurrentFile);
- replaceStrW(ft->std.tszCurrentFile, filefull);
+ mir_snwprintf(filefull, L"%s\\%s", ft->std.szWorkingDir.w, ft->std.szCurrentFile.w);
+ replaceStrW(ft->std.szCurrentFile.w, filefull);
ResetEvent(ft->hResumeEvt);
if (ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->std))
@@ -527,15 +527,15 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s {
filetransfer* ft = (filetransfer*)hTransfer;
- if ((ft->std.tszWorkingDir = mir_wstrdup(szPath)) == nullptr) {
+ if ((ft->std.szWorkingDir.w = mir_wstrdup(szPath)) == nullptr) {
wchar_t szCurrDir[MAX_PATH];
GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
- ft->std.tszWorkingDir = mir_wstrdup(szCurrDir);
+ ft->std.szWorkingDir.w = mir_wstrdup(szCurrDir);
}
else {
- size_t len = mir_wstrlen(ft->std.tszWorkingDir) - 1;
- if (ft->std.tszWorkingDir[len] == '\\')
- ft->std.tszWorkingDir[len] = 0;
+ size_t len = mir_wstrlen(ft->std.szWorkingDir.w) - 1;
+ if (ft->std.szWorkingDir.w[len] == '\\')
+ ft->std.szWorkingDir.w[len] = 0;
}
ForkThread(&CMsnProto::MsnFileAckThread, ft);
@@ -575,7 +575,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** ft->bCanceled = true;
break;
case FILERESUME_RENAME:
- replaceStrW(ft->std.tszCurrentFile, *szFilename);
+ replaceStrW(ft->std.szCurrentFile.w, *szFilename);
break;
case FILERESUME_OVERWRITE:
ft->std.currentFileProgress = 0;
@@ -583,7 +583,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const wchar_t** case FILERESUME_RESUME:
{
struct _stati64 statbuf;
- _wstat64(ft->std.tszCurrentFile, &statbuf);
+ _wstat64(ft->std.szCurrentFile.w, &statbuf);
ft->std.currentFileProgress = statbuf.st_size;
}
break;
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index dd85be9e64..f4087265c5 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -89,15 +89,15 @@ void __cdecl SendThread(LPVOID param) { if (ftcd->sending == 1)
pfts.flags |= PFTS_SENDING;
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = ftcd->first->ft_count;
pfts.totalBytes = ftcd->first->totalSize;
while(SendFileChunk(proto, ft, ftcd) && !Miranda_IsTerminated()) {
pfts.currentFileNumber = ftcd->ft_number;
pfts.totalProgress = ftcd->sizeToHere + mwFileTransfer_getSent(ft);
- pfts.szWorkingDir = ftcd->save_path;
- pfts.szCurrentFile = (char*)mwFileTransfer_getFileName(ft);
+ pfts.szWorkingDir.a = ftcd->save_path;
+ pfts.szCurrentFile.a = (char*)mwFileTransfer_getFileName(ft);
pfts.currentFileSize = mwFileTransfer_getFileSize(ft);
pfts.currentFileProgress = mwFileTransfer_getSent(ft);
pfts.currentFileTime = 0; //?
@@ -236,13 +236,13 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) if (ftcd->sending == 1) {
pfts.flags |= PFTS_SENDING;
}
- pfts.pszFiles = nullptr;
+ pfts.pszFiles.a = nullptr;
pfts.totalFiles = 1;
pfts.currentFileNumber = 0;
pfts.totalBytes = mwFileTransfer_getFileSize(ft);
pfts.totalProgress = mwFileTransfer_getSent(ft);
- pfts.szWorkingDir = ftcd->save_path;
- pfts.szCurrentFile = (char*)mwFileTransfer_getFileName(ft);
+ pfts.szWorkingDir.a = ftcd->save_path;
+ pfts.szCurrentFile.a = (char*)mwFileTransfer_getFileName(ft);
pfts.currentFileSize = mwFileTransfer_getFileSize(ft);
pfts.currentFileProgress = mwFileTransfer_getSent(ft);
pfts.currentFileTime = 0; //?
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index ac818546a4..eda669fb7e 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -225,7 +225,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_PNG;
ai.hContact = transfer->pfts.hContact;
- mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
+ mir_wstrcpy(ai.filename, transfer->pfts.szCurrentFile.w);
fclose(transfer->hFile);
transfer->hFile = nullptr;
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index f6dd36df9f..1b5e747b04 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -74,11 +74,11 @@ void CToxProto::OnFriendFile(Tox *tox, uint32_t friendNumber, uint32_t fileNumbe HANDLE CToxProto::OnFileAllow(Tox *tox, MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- transfer->pfts.tszWorkingDir = mir_wstrdup(tszPath);
+ transfer->pfts.szWorkingDir.w = mir_wstrdup(tszPath);
// stupid fix
wchar_t fullPath[MAX_PATH];
- mir_snwprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
+ mir_snwprintf(fullPath, L"%s\\%s", transfer->pfts.szWorkingDir.w, transfer->pfts.szCurrentFile.w);
transfer->ChangeName(fullPath);
if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts)) {
@@ -279,7 +279,7 @@ HANDLE CToxProto::OnSendFile(Tox *tox, MCONTACT hContact, const wchar_t*, wchar_ FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, fileName, fileSize);
transfer->pfts.flags |= PFTS_SENDING;
transfer->pfts.hContact = hContact;
- transfer->pfts.tszWorkingDir = fileDir;
+ transfer->pfts.szWorkingDir.w = fileDir;
transfer->hFile = hFile;
transfers.Add(transfer);
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 8b0a30cb32..4c2feb1e68 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -22,24 +22,23 @@ struct FileTransferParam pfts.flags = PFTS_UNICODE;
pfts.hContact = NULL;
pfts.totalFiles = 1;
- pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1));
- pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_wstrdup(fileName);
- pfts.ptszFiles[pfts.totalFiles] = nullptr;
+ pfts.pszFiles.w = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1));
+ pfts.pszFiles.w[0] = pfts.szCurrentFile.w = mir_wstrdup(fileName);
+ pfts.pszFiles.w[pfts.totalFiles] = nullptr;
pfts.totalBytes = pfts.currentFileSize = fileSize;
pfts.totalProgress = pfts.currentFileProgress = 0;
pfts.currentFileNumber = 0;
pfts.currentFileTime = now();
- pfts.tszWorkingDir = nullptr;
+ pfts.szWorkingDir.w = nullptr;
transferType = TOX_FILE_KIND_DATA;
}
~FileTransferParam()
{
- if (pfts.tszWorkingDir)
- mir_free(pfts.tszWorkingDir);
- mir_free(pfts.pszFiles[0]);
- mir_free(pfts.pszFiles);
+ mir_free(pfts.szWorkingDir.w);
+ mir_free(pfts.pszFiles.w[0]);
+ mir_free(pfts.pszFiles.w);
if (hFile) {
fclose(hFile);
hFile = nullptr;
@@ -50,7 +49,7 @@ struct FileTransferParam {
if (hFile)
return true;
- hFile = _wfopen(pfts.tszCurrentFile, L"wb+");
+ hFile = _wfopen(pfts.szCurrentFile.w, L"wb+");
if (hFile)
_chsize_s(_fileno(hFile), pfts.currentFileSize);
return hFile != nullptr;
@@ -66,7 +65,7 @@ struct FileTransferParam void ChangeName(const wchar_t *fileName)
{
- pfts.ptszFiles[0] = replaceStrW(pfts.tszCurrentFile, fileName);
+ pfts.pszFiles.w[0] = replaceStrW(pfts.szCurrentFile.w, fileName);
}
uint8_t GetDirection() const
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 717ad29457..87fcaf65d1 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -193,24 +193,24 @@ void FreeFilesMatrix(wchar_t ***files) void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts)
{
- mir_free(fts->tszCurrentFile);
- if (fts->ptszFiles) {
- for (int i = 0; i < fts->totalFiles; i++) mir_free(fts->ptszFiles[i]);
- mir_free(fts->ptszFiles);
+ mir_free(fts->szCurrentFile.w);
+ if (fts->pszFiles.w) {
+ for (int i = 0; i < fts->totalFiles; i++) mir_free(fts->pszFiles.w[i]);
+ mir_free(fts->pszFiles.w);
}
- mir_free(fts->tszWorkingDir);
+ mir_free(fts->szWorkingDir.w);
}
void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src)
{
*dest = *src;
- if (src->tszCurrentFile) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
- if (src->ptszFiles) {
- dest->ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*src->totalFiles);
+ if (src->szCurrentFile.w) dest->szCurrentFile.w = PFTS_StringToTchar(src->flags, src->szCurrentFile.w);
+ if (src->pszFiles.w) {
+ dest->pszFiles.w = (wchar_t**)mir_alloc(sizeof(wchar_t*)*src->totalFiles);
for (int i = 0; i < src->totalFiles; i++)
- dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
+ dest->pszFiles.w[i] = PFTS_StringToTchar(src->flags, src->pszFiles.w[i]);
}
- if (src->tszWorkingDir) dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
+ if (src->szWorkingDir.w) dest->szWorkingDir.w = PFTS_StringToTchar(src->flags, src->szWorkingDir.w);
dest->flags &= ~PFTS_UTF;
dest->flags |= PFTS_UNICODE;
}
@@ -220,47 +220,47 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS dest->hContact = src->hContact;
dest->flags = src->flags;
if (dest->totalFiles != src->totalFiles) {
- for (int i = 0; i < dest->totalFiles; i++) mir_free(dest->ptszFiles[i]);
- mir_free(dest->ptszFiles);
- dest->ptszFiles = nullptr;
+ for (int i = 0; i < dest->totalFiles; i++) mir_free(dest->pszFiles.w[i]);
+ mir_free(dest->pszFiles.w);
+ dest->pszFiles.w = nullptr;
dest->totalFiles = src->totalFiles;
}
- if (src->ptszFiles) {
- if (!dest->ptszFiles)
- dest->ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)*src->totalFiles);
+ if (src->pszFiles.w) {
+ if (!dest->pszFiles.w)
+ dest->pszFiles.w = (wchar_t**)mir_calloc(sizeof(wchar_t*)*src->totalFiles);
for (int i = 0; i < src->totalFiles; i++)
- if (!dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) {
- mir_free(dest->ptszFiles[i]);
- if (src->ptszFiles[i])
- dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
+ if (!dest->pszFiles.w[i] || !src->pszFiles.w[i] || PFTS_CompareWithTchar(src, src->pszFiles.w[i], dest->pszFiles.w[i])) {
+ mir_free(dest->pszFiles.w[i]);
+ if (src->pszFiles.w[i])
+ dest->pszFiles.w[i] = PFTS_StringToTchar(src->flags, src->pszFiles.w[i]);
else
- dest->ptszFiles[i] = nullptr;
+ dest->pszFiles.w[i] = nullptr;
}
}
- else if (dest->ptszFiles) {
+ else if (dest->pszFiles.w) {
for (int i = 0; i < dest->totalFiles; i++)
- mir_free(dest->ptszFiles[i]);
- mir_free(dest->ptszFiles);
- dest->ptszFiles = nullptr;
+ mir_free(dest->pszFiles.w[i]);
+ mir_free(dest->pszFiles.w);
+ dest->pszFiles.w = nullptr;
}
dest->currentFileNumber = src->currentFileNumber;
dest->totalBytes = src->totalBytes;
dest->totalProgress = src->totalProgress;
- if (src->tszWorkingDir && (!dest->tszWorkingDir || PFTS_CompareWithTchar(src, src->tszWorkingDir, dest->tszWorkingDir))) {
- mir_free(dest->tszWorkingDir);
- if (src->tszWorkingDir)
- dest->tszWorkingDir = PFTS_StringToTchar(src->flags, src->tszWorkingDir);
+ if (src->szWorkingDir.w && (!dest->szWorkingDir.w || PFTS_CompareWithTchar(src, src->szWorkingDir.w, dest->szWorkingDir.w))) {
+ mir_free(dest->szWorkingDir.w);
+ if (src->szWorkingDir.w)
+ dest->szWorkingDir.w = PFTS_StringToTchar(src->flags, src->szWorkingDir.w);
else
- dest->tszWorkingDir = nullptr;
+ dest->szWorkingDir.w = nullptr;
}
- if (!dest->tszCurrentFile || !src->tszCurrentFile || PFTS_CompareWithTchar(src, src->tszCurrentFile, dest->tszCurrentFile)) {
- mir_free(dest->tszCurrentFile);
- if (src->tszCurrentFile)
- dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
+ if (!dest->szCurrentFile.w || !src->szCurrentFile.w || PFTS_CompareWithTchar(src, src->szCurrentFile.w, dest->szCurrentFile.w)) {
+ mir_free(dest->szCurrentFile.w);
+ if (src->szCurrentFile.w)
+ dest->szCurrentFile.w = PFTS_StringToTchar(src->flags, src->szCurrentFile.w);
else
- dest->tszCurrentFile = nullptr;
+ dest->szCurrentFile.w = nullptr;
}
dest->currentFileSize = src->currentFileSize;
dest->currentFileProgress = src->currentFileProgress;
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index dfc3334850..7a8125d02a 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -118,13 +118,13 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, switch (msg) {
case WM_LBUTTONDBLCLK:
- ShellExecute(hwnd, nullptr, pft->tszCurrentFile, nullptr, nullptr, SW_SHOW);
+ ShellExecute(hwnd, nullptr, pft->szCurrentFile.w, nullptr, nullptr, SW_SHOW);
break;
case WM_RBUTTONUP:
POINT pt;
pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam);
ClientToScreen(hwnd, &pt);
- DoAnnoyingShellCommand(hwnd, pft->tszCurrentFile, C_CONTEXTMENU, &pt);
+ DoAnnoyingShellCommand(hwnd, pft->szCurrentFile.w, C_CONTEXTMENU, &pt);
return 0;
}
return mir_callNextSubclass(hwnd, IconCtrlSubclassProc, msg, wParam, lParam);
@@ -211,7 +211,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM fts = (PROTOFILETRANSFERSTATUS*)mir_alloc(sizeof(PROTOFILETRANSFERSTATUS));
CopyProtoFileTransferStatus(fts, dat->fts);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)fts);
- SetDlgItemText(hwndDlg, IDC_FILENAME, fts->tszCurrentFile);
+ SetDlgItemText(hwndDlg, IDC_FILENAME, fts->szCurrentFile.w);
SetControlToUnixTime(hwndDlg, IDC_NEWDATE, fts->currentFileTime);
GetSensiblyFormattedSize(fts->currentFileSize, szSize, _countof(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_NEWSIZE, szSize);
@@ -219,7 +219,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc);
HWND hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
- if (_wstat64(fts->tszCurrentFile, &statbuf) == 0) {
+ if (_wstat64(fts->szCurrentFile.w, &statbuf) == 0) {
SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime);
GetSensiblyFormattedSize(statbuf.st_size, szSize, _countof(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize);
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM loadiconsstartinfo *lisi = (loadiconsstartinfo*)mir_alloc(sizeof(loadiconsstartinfo));
lisi->hwndDlg = hwndDlg;
- lisi->szFilename = mir_wstrdup(fts->tszCurrentFile);
+ lisi->szFilename = mir_wstrdup(fts->szCurrentFile.w);
//can be a little slow, so why not?
mir_forkthread(LoadIconsAndTypesThread, lisi);
SetFocus(hwndFocus);
@@ -244,13 +244,13 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM PROTOFILERESUME pfr = { 0 };
switch (LOWORD(wParam)) {
case IDC_OPENFILE:
- ShellExecute(hwndDlg, NULL, fts->tszCurrentFile, NULL, NULL, SW_SHOW);
+ ShellExecute(hwndDlg, NULL, fts->szCurrentFile.w, NULL, NULL, SW_SHOW);
return FALSE;
case IDC_OPENFOLDER:
{
wchar_t szFile[MAX_PATH];
- mir_wstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
+ mir_wstrncpy(szFile, fts->szCurrentFile.w, _countof(szFile));
wchar_t *pszLastBackslash = wcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
return FALSE;
case IDC_PROPERTIES:
- DoAnnoyingShellCommand(hwndDlg, fts->tszCurrentFile, C_PROPERTIES, NULL);
+ DoAnnoyingShellCommand(hwndDlg, fts->szCurrentFile.w, C_PROPERTIES, NULL);
return FALSE;
case IDC_RESUME:
pfr.action = FILERESUME_RESUME;
@@ -283,7 +283,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM wchar_t filter[512], *pfilter;
wchar_t str[MAX_PATH];
- mir_wstrncpy(str, fts->tszCurrentFile, _countof(str));
+ mir_wstrncpy(str, fts->szCurrentFile.w, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
@@ -319,7 +319,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
memcpy(pfrCopy, &pfr, sizeof(pfr));
- PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
+ PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->szCurrentFile.w), (LPARAM)pfrCopy);
DestroyWindow(hwndDlg);
}
break;
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 0a82e74343..37ae7a99e7 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -128,8 +128,8 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE wchar_t *fnbuf = nullptr, *fn = nullptr; SHFILEINFO shfi = {}; - if (fts->tszCurrentFile) { - fnbuf = mir_wstrdup(fts->tszCurrentFile); + if (fts->szCurrentFile.w) { + fnbuf = mir_wstrdup(fts->szCurrentFile.w); if ((fn = wcsrchr(fnbuf, '\\')) == nullptr) fn = fnbuf; else fn++; @@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else { //recv CreateDirectoryTreeW(dat->szSavePath); dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath); - dat->transferStatus.tszWorkingDir = mir_wstrdup(dat->szSavePath); + dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath); if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK; else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK); SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); @@ -371,9 +371,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_OPENFOLDER: { - wchar_t *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.szWorkingDir.w; if (!path || !path[0]) { - path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + path = NEWWSTR_ALLOCA(dat->transferStatus.szCurrentFile.w); wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; } @@ -385,7 +385,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR wchar_t **files; if (dat->send) { if (dat->files == nullptr) - files = dat->transferStatus.ptszFiles; + files = dat->transferStatus.pszFiles.w; else files = dat->files; } @@ -437,9 +437,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DestroyMenu(hMenu); if (ret == 1) { - wchar_t *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.szWorkingDir.w; if (!path || !path[0]) { - path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + path = NEWWSTR_ALLOCA(dat->transferStatus.szCurrentFile.w); wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; @@ -539,7 +539,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { PROTOFILETRANSFERSTATUS *fts = &dat->transferStatus; SetFilenameControls(hwndDlg, dat, fts); - if (_waccess(fts->tszCurrentFile, 0)) + if (_waccess(fts->szCurrentFile.w, 0)) break; SetFtStatus(hwndDlg, LPGENW("File already exists"), FTS_TEXT); @@ -553,7 +553,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME)); pfr->action = dat->resumeBehaviour; pfr->szFilename = nullptr; - PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfr); + PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->szCurrentFile.w), (LPARAM)pfr); } } SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1); @@ -572,7 +572,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dat->files == nullptr) dat->files = (wchar_t**)mir_calloc((fts->totalFiles + 1) * sizeof(wchar_t*)); if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == nullptr) - dat->files[fts->currentFileNumber] = PFTS_StringToTchar(fts->flags, fts->tszCurrentFile); + dat->files[fts->currentFileNumber] = PFTS_StringToTchar(fts->flags, fts->szCurrentFile.w); } /* HACK: for 0.3.3, limit updates to around 1.1 ack per second */ @@ -667,7 +667,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]); } else { - vstsi->szFile = mir_wstrdup(dat->transferStatus.tszWorkingDir); + vstsi->szFile = mir_wstrdup(dat->transferStatus.szWorkingDir.w); vstsi->returnCode = -1; } SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT); |