diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 8 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/filetransfer.cpp | 9 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 23 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 7 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 15 | ||||
-rwxr-xr-x | protocols/JabberG/src/stdafx.h | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 16 | ||||
-rw-r--r-- | protocols/Sametime/src/files.cpp | 22 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.cpp | 4 |
10 files changed, 43 insertions, 65 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index a65719ad25..9176da06e7 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1038,18 +1038,16 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
- wchar_t* filenameT = mir_a2u((char*)dcc7->filename);
+ const char *fileName = (const char*)dcc7->filename;
PROTORECVFILE pre = { 0 };
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.descr.w = filenameT;
- pre.files.w = &filenameT;
+ pre.descr.a = fileName;
+ pre.files.a = &fileName;
pre.lParam = (LPARAM)dcc7;
ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre);
- mir_free(filenameT);
e->event.dcc7_new = nullptr;
}
break;
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index c3f3363dd0..14be05e395 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -392,21 +392,18 @@ void __cdecl GaduProto::dccmainthread(void*) {
// Make new ggtransfer struct
local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, nullptr);
- wchar_t* filenameT = mir_utf8decodeW((char*)m_dcc->file_info.filename);
+ const char *pszFileName = (const char *)m_dcc->file_info.filename;
PROTORECVFILE pre = { 0 };
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.descr.w = filenameT;
- pre.files.w = &filenameT;
+ pre.descr.a = pszFileName;
+ pre.files.a = &pszFileName;
pre.lParam = (LPARAM)local_dcc;
gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1);
ProtoChainRecvFile((UINT_PTR)local_dcc->contact, &pre);
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
-
- mir_free(filenameT);
}
break;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index d1b42d6434..67a6092e90 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1159,7 +1159,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg) setWString(hContact, "User", pmsg->prefix.sUser);
setWString(hContact, "Host", pmsg->prefix.sHost);
- wchar_t* tszTemp = sFile.GetBuffer();
+ const wchar_t* tszTemp = sFile;
PROTORECVFILE pre = { 0 };
pre.dwFlags = PRFF_UNICODE;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index fa0e5c98ac..69dc1778df 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -113,12 +113,12 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) }
else { // FT_INITIALIZING
if (str[0] == '\0') {
- wchar_t *s;
- if ((s = wcsrchr(ft->httpPath, '/')) != nullptr)
+ char *s;
+ if ((s = strrchr(ft->httpPath, '/')) != nullptr)
s++;
else
s = ft->httpPath;
- ft->std.szCurrentFile.w = mir_wstrdup(s);
+ ft->std.szCurrentFile.w = mir_utf8decodeW(s);
JabberHttpUrlDecode(ft->std.szCurrentFile.w);
if (ft->create() == -1) {
ft->state = FT_ERROR;
@@ -270,8 +270,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) for (int i = 0; i < ft->std.totalFiles && ft->state != FT_ERROR && ft->state != FT_DENIED; i++) {
ft->std.currentFileNumber = i;
ft->state = FT_CONNECTING;
- if (ft->httpPath) mir_free(ft->httpPath);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
wchar_t *p;
if ((p = wcschr(ft->std.pszFiles.w[i], '\\')) != nullptr)
@@ -366,8 +365,8 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i for (t = str + 4; *t != '\0' && *t != ' '; t++);
*t = '\0';
for (t = str + 4; *t != '\0' && *t == '/'; t++);
- ft->httpPath = mir_a2u(t);
- JabberHttpUrlDecode(ft->httpPath);
+ ft->httpPath = mir_strdup(t);
+ mir_urlDecode(ft->httpPath);
ft->state = FT_INITIALIZING;
debugLogA("Change to FT_INITIALIZING");
}
@@ -386,11 +385,11 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i else
t = ft->std.pszFiles.w[currentFile];
- if (ft->httpPath == nullptr || mir_wstrcmp(ft->httpPath, t)) {
+ if (ft->httpPath == nullptr || mir_strcmp(ft->httpPath, T2Utf(t))) {
if (ft->httpPath == nullptr)
debugLogA("Requested file name does not matched (httpPath == nullptr)");
else
- debugLogW(L"Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t);
+ debugLogA("Requested file name does not match ('%s' vs. '%S')", ft->httpPath, t);
ft->state = FT_ERROR;
break;
}
@@ -399,8 +398,7 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i 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);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
break;
}
@@ -425,8 +423,7 @@ int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, i if (ft->state != FT_ERROR)
ft->state = FT_DONE;
debugLogA("Finishing this file...");
- mir_free(ft->httpPath);
- ft->httpPath = nullptr;
+ replaceStr(ft->httpPath, nullptr);
break;
} }
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 515219b8fb..4ebbcf9088 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -351,15 +351,12 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode) ft->std.szCurrentFile.w = mir_utf8decodeW(filename);
ft->std.totalBytes = ft->std.currentFileSize = filesize;
- Utf2T wszDescr(XmlGetChildText(fileNode, "desc"));
-
PROTORECVFILE pre = { 0 };
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.files.w = (wchar_t**)&filename;
+ pre.files.a = &filename;
pre.lParam = (LPARAM)ft;
- pre.descr.w = wszDescr;
+ pre.descr.a = XmlGetChildText(fileNode, "desc");
ProtoChainRecvFile(ft->std.hContact, &pre);
return;
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index e1c3bd9e49..d87b795700 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -343,6 +343,8 @@ BOOL CJabberProto::OnIqRequestOOB(const TiXmlElement*, CJabberIqInfo *pInfo) }
ft->httpHostName = mir_strdup(text);
}
+ ft->httpPath = mir_strdup(q);
+ mir_urlDecode(ft->httpPath);
}
}
@@ -355,24 +357,19 @@ BOOL CJabberProto::OnIqRequestOOB(const TiXmlElement*, CJabberIqInfo *pInfo) const char *desc = XmlGetChildText(pInfo->GetChildNode(), "desc");
debugLogA("description = %s", desc);
- wchar_t *str2;
- if ((str2 = wcsrchr(ft->httpPath, '/')) != nullptr)
+ const char *str2;
+ if ((str2 = strrchr(ft->httpPath, '/')) != nullptr)
str2++;
else
str2 = ft->httpPath;
- str2 = mir_wstrdup(str2);
- JabberHttpUrlDecode(str2);
- Utf2T wszDescr(desc);
PROTORECVFILE pre;
- pre.dwFlags = PRFF_UNICODE;
pre.timestamp = time(0);
- pre.descr.w = wszDescr;
- pre.files.w = &str2;
+ pre.descr.a = desc;
+ pre.files.a = &str2;
pre.fileCount = 1;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- mir_free(str2);
}
else { // reject
XmlNodeIq iq("error", pInfo);
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 1700c5f231..40b4963de4 100755 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -462,7 +462,7 @@ struct filetransfer // Used by file receiving only
char* httpHostName;
WORD httpPort;
- wchar_t *httpPath;
+ char* httpPath;
unsigned __int64 dwExpectedRecvFileSize;
// Used by file sending only
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index dd96ff43b7..0a4fa74562 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -423,7 +423,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) if (fileSize) {
filetransfer* ft = new filetransfer(this);
- char *pszFile = "", *pszType;
+ const char *pszFile = "", *pszType;
ezxml_t originalName, desc;
ft->std.hContact = hContact;
@@ -431,7 +431,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) 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");
+ pszFile = ezxml_attr(originalName, "originalName");
if (!pszFile || !*pszFile) {
if ((originalName = ezxml_child(xmli, "meta")) && (pszFile = (char*)ezxml_attr(originalName, "type")))
@@ -442,7 +442,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) pszFile = "file";
}
- char *p;
+ const char *p;
if ((p = strrchr(pszFile, '\\')) || (p = strrchr(pszFile, '/')))
pszFile = p + 1;
@@ -455,18 +455,16 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) else
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
- wchar_t tComment[40];
- mir_snwprintf(tComment, TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ char tComment[40];
+ mir_snprintf(tComment, TranslateU("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILE pre = { 0 };
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.descr.w = (desc = ezxml_child(xmli, "Description")) ? mir_utf8decodeW(desc->txt) : tComment;
- pre.files.w = &ft->std.szCurrentFile.w;
+ pre.descr.a = (desc = ezxml_child(xmli, "Description")) ? desc->txt : tComment;
+ pre.files.a = &pszFile;
pre.lParam = (LPARAM)ft;
ProtoChainRecvFile(ft->std.hContact, &pre);
- if (desc) mir_free(pre.descr.w);
}
else uri = nullptr;
}
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 080e23fcc4..a0b3d3dd74 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -28,27 +28,21 @@ void mwFileTransfer_offered(mwFileTransfer* ft) proto->ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)ft, 0);
- wchar_t* filenameT = mir_utf8decodeW(mwFileTransfer_getFileName(ft));
+ const char *filename = mwFileTransfer_getFileName(ft);
const char* message = mwFileTransfer_getMessage(ft);
- wchar_t descriptionT[512];
- if (message) {
- wchar_t* messageT = mir_utf8decodeW(message);
- mir_snwprintf(descriptionT, L"%s - %s", filenameT, messageT);
- mir_free(messageT);
- } else
- wcsncpy_s(descriptionT, filenameT, _TRUNCATE);
+ char description[512];
+ if (message)
+ mir_snprintf(description, "%s - %s", filename, message);
+ else
+ strncpy_s(description, filename, _TRUNCATE);
PROTORECVFILE pre = {0};
- pre.dwFlags = PRFF_UNICODE;
pre.fileCount = 1;
pre.timestamp = time(0);
- pre.descr.w = descriptionT;
- pre.files.w = &filenameT;
+ pre.descr.a = description;
+ pre.files.a = &filename;
pre.lParam = (LPARAM)ft;
-
ProtoChainRecvFile(hContact, &pre);
-
- mir_free(filenameT);
}
//returns 0 if finished with current file
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 9558633893..d3d26ddf72 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -44,8 +44,8 @@ void CToxProto::OnFriendFile(Tox *tox, uint32_t friendNumber, uint32_t fileNumbe {
proto->debugLogA(__FUNCTION__": incoming file (%d) from %s (%d)", fileNumber, (const char*)pubKey, friendNumber);
- CMStringA rawName((char*)fileName, fileNameLength);
- wchar_t *name = mir_utf8decodeW(rawName);
+ CMStringA rawName((char*)fileName, (int)fileNameLength);
+ const wchar_t *name = mir_utf8decodeW(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
|