1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 20:23:25 +01:00

use correct types

This commit is contained in:
Jfreegman 2014-04-01 03:53:12 -04:00
parent f3a8ba6ab3
commit e419299487
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
4 changed files with 12 additions and 19 deletions

View File

@ -124,7 +124,7 @@ static void chat_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *msg, u
ChatContext *ctx = self->chatwin;
uint8_t nick[TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, num, nick);
int n_len = tox_get_name(m, num, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
nick[n_len] = '\0';
@ -173,7 +173,7 @@ static void chat_onAction(ToxWindow *self, Tox *m, int32_t num, uint8_t *action,
ChatContext *ctx = self->chatwin;
uint8_t nick[TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, num, nick);
int n_len = tox_get_name(m, num, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);;
nick[n_len] = '\0';
@ -350,10 +350,7 @@ static void chat_onGroupInvite(ToxWindow *self, Tox *m, int32_t friendnumber, ui
uint8_t name[TOX_MAX_NAME_LENGTH];
uint8_t msg[MAX_STR_SIZE + TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, friendnumber, name);
if (n_len == -1)
return;
int n_len = tox_get_name(m, friendnumber, name);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
name[n_len] = '\0';
@ -917,7 +914,7 @@ ToxWindow new_chat(Tox *m, int32_t friendnum)
#endif /* _SUPPORT_AUDIO */
uint8_t name[TOX_MAX_NAME_LENGTH] = {'\0'};
uint16_t len = tox_get_name(m, friendnum, name);
int len = tox_get_name(m, friendnum, name);
len = MIN(len, TOXIC_MAX_NAME_LENGTH);

View File

@ -105,7 +105,7 @@ static void friendlist_onMessage(ToxWindow *self, Tox *m, int32_t num, uint8_t *
str[len] = '\0';
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
uint16_t n_len = tox_get_name(m, num, nick);
int n_len = tox_get_name(m, num, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
nick[n_len] = '\0';
@ -215,7 +215,7 @@ static void friendlist_onFileSendRequest(ToxWindow *self, Tox *m, int32_t num, u
tox_file_send_control(m, num, 1, filenum, TOX_FILECONTROL_KILL, 0, 0);
uint8_t nick[TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, num, nick);
int n_len = tox_get_name(m, num, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
nick[n_len] = '\0';
@ -238,7 +238,7 @@ static void friendlist_onGroupInvite(ToxWindow *self, Tox *m, int32_t num, uint8
friends[num].chatwin = add_window(m, new_chat(m, friends[num].num));
} else {
uint8_t nick[TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, num, nick);
int n_len = tox_get_name(m, num, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
nick[n_len] = '\0';
@ -545,7 +545,7 @@ static void friendlist_onAv(ToxWindow *self, ToxAv *av)
friends[id].chatwin = add_window(m, new_chat(m, friends[id].num));
} else {
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
uint16_t n_len = tox_get_name(m, id, nick);
int n_len = tox_get_name(m, id, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
nick[n_len] = '\0';

View File

@ -162,7 +162,7 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
ChatContext *ctx = self->chatwin;
uint8_t nick[TOX_MAX_NAME_LENGTH] = {'\0'};
uint16_t n_len = tox_group_peername(m, groupnum, peernum, nick);
int n_len = tox_group_peername(m, groupnum, peernum, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH); /* enforce client max name length */
nick[n_len] = '\0';
@ -172,8 +172,8 @@ static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int
bool beep = false;
uint8_t selfnick[TOX_MAX_NAME_LENGTH];
n_len = tox_get_self_name(m, selfnick);
selfnick[n_len] = '\0';
uint16_t sn_len = tox_get_self_name(m, selfnick);
selfnick[sn_len] = '\0';
int nick_clr = strcmp(nick, selfnick) == 0 ? GREEN : CYAN;

View File

@ -370,11 +370,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
ChatContext *ctx = self->chatwin;
uint8_t nick[TOX_MAX_NAME_LENGTH];
uint16_t n_len = tox_get_name(m, friendnum, nick);
if (n_len == -1)
return;
int n_len = tox_get_name(m, friendnum, nick);
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH);
if (!nick[0]) {