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 /protocols/MSN/src | |
parent | 66b61f42871089f3962920924f9030cd6dff2ad8 (diff) |
code cleaning: old unions replaced with MAllStrings & MAllStringsArray
Diffstat (limited to 'protocols/MSN/src')
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 6 | ||||
-rw-r--r-- | protocols/MSN/src/msn_misc.cpp | 30 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 18 |
3 files changed, 27 insertions, 27 deletions
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;
|