diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-15 15:39:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-15 15:39:46 +0000 |
commit | e6fd14cf522fe0309a21aea84bfe2c9b9ee0eedb (patch) | |
tree | 264dd8618f96ca246aeaa7080e0f6d8720b8a7fd /protocols/Tox/src | |
parent | 4982a2b85b8022d75914970dd04f8ef32b5200f1 (diff) |
crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@12127 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r-- | protocols/Tox/src/tox_address.h | 5 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.cpp | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/protocols/Tox/src/tox_address.h b/protocols/Tox/src/tox_address.h index a4b152427d..d205eb731e 100644 --- a/protocols/Tox/src/tox_address.h +++ b/protocols/Tox/src/tox_address.h @@ -53,6 +53,11 @@ public: }
ToxBinAddress(const char *hex)
{
+ if (hex == NULL) {
+ binData.resize(32);
+ return;
+ }
+
char *endptr;
const char *pos = hex;
int size = mir_strlen(hex) / 2;
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 16e6694b5f..e85babb1de 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -180,7 +180,7 @@ HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR*, PROTOCHA rewind(hFile);
char *name = mir_utf8encodeW(fileName);
- int fileNumber = tox_new_file_sender(tox, friendNumber, fileSize, (uint8_t*)name, mir_strlen(name));
+ int fileNumber = tox_new_file_sender(tox, friendNumber, fileSize, (uint8_t*)name, (uint16_t)mir_strlen(name));
if (fileNumber < 0)
{
debugLogA("CToxProto::SendFilesAsync: cannot send file");
@@ -203,7 +203,7 @@ void CToxProto::SendFileAsync(void *arg) FileTransferParam *transfer = (FileTransferParam*)arg;
transfer->status = STARTED;
- int dataSize = 0;
+ size_t dataSize = 0;
uint64_t fileProgress = transfer->pfts.currentFileProgress;
uint64_t fileSize = transfer->pfts.currentFileSize;
int chunkSize = min(tox_file_data_size(tox, transfer->friendNumber), fileSize);
@@ -214,7 +214,7 @@ void CToxProto::SendFileAsync(void *arg) if (dataSize == 0)
{
dataSize = min(chunkSize, fileSize - fileProgress);
- int read = fread(data, sizeof(uint8_t), dataSize, transfer->hFile);
+ size_t read = fread(data, sizeof(uint8_t), dataSize, transfer->hFile);
if (read != dataSize)
{
debugLogA("CToxProto::SendFileAsync: failed to read from file (%d)", transfer->fileNumber);
@@ -230,7 +230,7 @@ void CToxProto::SendFileAsync(void *arg) int sendResult = TOX_ERROR;
{
mir_cslock lock(toxLock);
- sendResult = tox_file_send_data(tox, transfer->friendNumber, transfer->fileNumber, data, dataSize);
+ sendResult = tox_file_send_data(tox, transfer->friendNumber, transfer->fileNumber, data, (uint16_t)dataSize);
}
if (sendResult == TOX_ERROR)
{
|