summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-30 11:50:54 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-30 11:50:54 +0000
commitbddc03714090e3710936a08a06e3e3a195b2d434 (patch)
tree27231df369124e12ae24f1961420630e2a10b7cd
parentce49c84f3a26f016f9232d2bffdc830d7fd6169f (diff)
Tox: fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@10341 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Tox/src/tox_proto.cpp3
-rw-r--r--protocols/Tox/src/tox_transfer.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 7d9a5150a4..e5bb613c8f 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -170,7 +170,7 @@ int __cdecl CToxProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
std::vector<uint8_t> clientId = HexStringToData(toxId);
uint32_t number = tox_get_friend_number(tox, clientId.data());
- uint8_t fileNumber = (uint8_t)hTransfer;
+ int fileNumber = (int)hTransfer;
transfers.erase(fileNumber);
@@ -322,6 +322,7 @@ HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescrip
if (fileNumber < 0)
{
debugLogA("CToxProto::SendFilesAsync: cannot send file");
+ return NULL;
}
FileTransferParam *transfer = new FileTransferParam(fileNumber, fileName, fileSize);
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index d91d18ca7c..5a7162fb39 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -40,6 +40,7 @@ void CToxProto::SendFileAsync(void* arg)
else
{
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer->number, 0);
+ transfers.erase(transfer->number);
}
}
@@ -122,6 +123,7 @@ void CToxProto::OnFileRequest(Tox *tox, int32_t number, uint8_t isSend, uint8_t
case TOX_FILECONTROL_FINISHED:
tox_file_send_control(proto->tox, number, 1, fileNumber, TOX_FILECONTROL_FINISHED, NULL, 0);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)fileNumber, 0);
+ proto->transfers.erase(fileNumber);
break;
}
}