summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Tox/src/tox_address.h5
-rw-r--r--protocols/Tox/src/tox_transfer.cpp8
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)
{