summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-03 14:05:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-03 14:05:33 +0300
commit2f880bda3aa2d8817ce43481df9d99b12ed82a58 (patch)
treed92de519c6bc13e0ce3d8e42ba64deeb46d474dc /protocols/Tox
parent66b61f42871089f3962920924f9030cd6dff2ad8 (diff)
code cleaning: old unions replaced with MAllStrings & MAllStringsArray
Diffstat (limited to 'protocols/Tox')
-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
3 files changed, 13 insertions, 14 deletions
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