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/JabberG | |
parent | 66b61f42871089f3962920924f9030cd6dff2ad8 (diff) |
code cleaning: old unions replaced with MAllStrings & MAllStringsArray
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 36 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 18 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 16 |
3 files changed, 35 insertions, 35 deletions
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);
|