From b7a1b2a410469078ee6bc46e959a427258a6f356 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 22 Mar 2018 14:25:21 +0300 Subject: IcqCorp: outgoing file transfers go with wrong utf-8 filenames --- protocols/ICQCorp/src/protocol.cpp | 6 +++--- protocols/ICQCorp/src/transfer.cpp | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 067baf4ddf..6f79c47cd6 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -1547,13 +1547,13 @@ ICQTransfer *ICQ::sendFile(ICQUser *u, char *description, char *filename, unsign if (!u->socket.connected() && !openConnection(u->socket)) return nullptr; - unsigned int i; - ICQTransfer *transfer = new ICQTransfer(u, tcpSequenceVal); + int i; for (i = 0; files[i]; i++); transfer->files = new wchar_t*[i + 1]; - for (i = 0; files[i]; i++) transfer->files[i] = _wcsdup(files[i]); + for (i = 0; files[i]; i++) + transfer->files[i] = _wcsdup(files[i]); transfer->files[i] = nullptr; transfer->description = _strdup(description); diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index f8b42e5b87..a13f961a43 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -228,8 +228,8 @@ void ICQTransfer::sendPacket0x02() Packet packet; packet << (unsigned char)0x02 << directory - << ptrA(mir_utf8encodeW(wcsrchr(fileName, '\\') + 1)).get() - << ptrA(mir_utf8encodeW(directoryName + mir_wstrlen(path) + 1)).get() + << _T2A(wcsrchr(fileName, '\\') + 1) + << _T2A(directoryName + mir_wstrlen(path) + 1) << fileSize << fileDate << speed; @@ -327,8 +327,7 @@ void ICQTransfer::ack(unsigned int result) ProtoBroadcastAck(protoName, hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, this, 0); socket.closeConnection(); - unsigned int i; - for (i = 0; i < icqTransfers.size(); i++) { + for (size_t i = 0; i < icqTransfers.size(); i++) { if (icqTransfers[i] == this) { delete icqTransfers[i]; icqTransfers[i] = icqTransfers[icqTransfers.size() - 1]; -- cgit v1.2.3