Should return 0 for tox_file_dataremaining since it returns unsigned

This commit is contained in:
AZ Huang 2013-11-29 22:26:29 +08:00
parent eec31edb1c
commit 1df2d5880d
3 changed files with 5 additions and 5 deletions

View File

@ -1314,17 +1314,17 @@ int file_data(Messenger *m, int friendnumber, uint8_t filenumber, uint8_t *data,
uint64_t file_dataremaining(Messenger *m, int friendnumber, uint8_t filenumber, uint8_t send_receive)
{
if (friend_not_valid(m, friendnumber))
return -1;
return 0;
if (send_receive == 0) {
if (m->friendlist[friendnumber].file_sending[filenumber].status == FILESTATUS_NONE)
return -1;
return 0;
return m->friendlist[friendnumber].file_sending[filenumber].size -
m->friendlist[friendnumber].file_sending[filenumber].transferred;
} else {
if (m->friendlist[friendnumber].file_receiving[filenumber].status == FILESTATUS_NONE)
return -1;
return 0;
return m->friendlist[friendnumber].file_receiving[filenumber].size -
m->friendlist[friendnumber].file_receiving[filenumber].transferred;

View File

@ -620,7 +620,7 @@ int tox_filedata_size(Tox *tox, int friendnumber)
* send_receive is 0 if we want the sending files, 1 if we want the receiving.
*
* return number of bytes remaining to be sent/received on success
* return -1 on failure
* return 0 on failure
*/
uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive)
{

View File

@ -544,7 +544,7 @@ int tox_filedata_size(Tox *tox, int friendnumber);
* send_receive is 0 if we want the sending files, 1 if we want the receiving.
*
* return number of bytes remaining to be sent/received on success
* return -1 on failure
* return 0 on failure
*/
uint64_t tox_file_dataremaining(Tox *tox, int friendnumber, uint8_t filenumber, uint8_t send_receive);