summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/EmLanProto/src/mlan.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp24
-rw-r--r--protocols/ICQCorp/src/transfer.cpp6
-rw-r--r--protocols/IRCG/src/irclib.cpp10
-rw-r--r--protocols/IcqOscarJ/src/icq_filetransfer.cpp8
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp8
-rw-r--r--protocols/JabberG/src/jabber_file.cpp36
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp18
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp16
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp8
-rw-r--r--protocols/MSN/src/msn_commands.cpp6
-rw-r--r--protocols/MSN/src/msn_misc.cpp30
-rw-r--r--protocols/MSN/src/msn_proto.cpp18
-rw-r--r--protocols/Sametime/src/files.cpp12
-rw-r--r--protocols/Tox/src/tox_avatars.cpp2
-rw-r--r--protocols/Tox/src/tox_transfer.cpp6
-rw-r--r--protocols/Tox/src/tox_transfer.h19
17 files changed, 119 insertions, 120 deletions
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