Fixed a cuple stylistic bugs. Behaviour should be the same but the code is now proper. Also fixed tox_copy_friendlist.

This commit is contained in:
Jman012 2013-11-19 16:45:49 -08:00
parent 478d799ee3
commit ace8c2289e

View File

@ -2129,12 +2129,12 @@ uint32_t copy_friendlist(Messenger *m, int *out_list, uint32_t list_size)
uint32_t ret = 0; uint32_t ret = 0;
for (i = 0; i < m->numfriends; i++) { for (i = 0; i < m->numfriends; i++) {
if (i >= list_size) { if (ret >= list_size) {
break; /* Abandon ship */ break; /* Abandon ship */
} }
if (m->friendlist[i].status > 0) { if (m->friendlist[i].status > 0) {
out_list[i] = i; out_list[ret] = i;
ret++; ret++;
} }
} }
@ -2210,12 +2210,12 @@ uint32_t copy_chatlist(Messenger *m, int *out_list, uint32_t list_size)
uint32_t ret = 0; uint32_t ret = 0;
for (i = 0; i < m->numchats; i++) { for (i = 0; i < m->numchats; i++) {
if (i >= list_size) { if (ret >= list_size) {
break; /* Abandon ship */ break; /* Abandon ship */
} }
if (m->chats[i]) { if (m->chats[i]) {
out_list[i] = i; out_list[ret] = i;
ret++; ret++;
} }
} }