summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-11 12:51:29 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-13 22:22:09 +0000
commit52dd5575ab40c9d1bc5f1c3921a1168d281f4660 (patch)
treef9cc00f8fc2ccaa04ccc6effd4b628bf0a625e50 /toxcore/tox.c
parent2d84681529161fd6add331286483ec58c034ba45 (diff)
Avoid implicit conversion of negative value to uint32_t.
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index b2ea1969..cd1b71f0 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -1000,15 +1000,17 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8
1000 return 0; 1000 return 0;
1001 } 1001 }
1002 1002
1003 const Messenger *m = tox->m; 1003 const Messenger *const m = tox->m;
1004 // TODO(irungentoo): size parameter? 1004 const int size = m_get_statusmessage_size(m, friend_number);
1005 int ret = m_copy_statusmessage(m, friend_number, status_message, m_get_statusmessage_size(m, friend_number));
1006 1005
1007 if (ret == -1) { 1006 if (size == -1) {
1008 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND); 1007 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
1009 return 0; 1008 return 0;
1010 } 1009 }
1011 1010
1011 const int ret = m_copy_statusmessage(m, friend_number, status_message, size);
1012 assert(ret == size && "concurrency problem: friend status message changed");
1013
1012 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK); 1014 SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
1013 return 1; 1015 return 1;
1014} 1016}