mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 16:23:26 +01:00
some code cleanup
This commit is contained in:
parent
00e6546f0c
commit
74b84c4252
@ -171,8 +171,8 @@ void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
|
|||||||
}
|
}
|
||||||
|
|
||||||
++path;
|
++path;
|
||||||
path[strlen(path) - 1] = L'\0';
|
int path_len = strlen(path) - 1;
|
||||||
int path_len = strlen(path);
|
path[path_len] = '\0';
|
||||||
|
|
||||||
if (path_len > MAX_STR_SIZE) {
|
if (path_len > MAX_STR_SIZE) {
|
||||||
errmsg = "File path exceeds character limit.";
|
errmsg = "File path exceeds character limit.";
|
||||||
|
@ -156,7 +156,7 @@ void cmd_add(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
|||||||
}
|
}
|
||||||
|
|
||||||
++temp;
|
++temp;
|
||||||
temp[strlen(temp) - 1] = L'\0';
|
temp[strlen(temp) - 1] = '\0';
|
||||||
snprintf(msg, sizeof(msg), "%s", temp);
|
snprintf(msg, sizeof(msg), "%s", temp);
|
||||||
} else {
|
} else {
|
||||||
char selfname[TOX_MAX_NAME_LENGTH];
|
char selfname[TOX_MAX_NAME_LENGTH];
|
||||||
@ -377,8 +377,8 @@ void cmd_note(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
|||||||
}
|
}
|
||||||
|
|
||||||
++msg;
|
++msg;
|
||||||
msg[strlen(msg) - 1] = '\0';
|
int len = strlen(msg) - 1;
|
||||||
int len = strlen(msg);
|
msg[len] = '\0';
|
||||||
tox_set_status_message(m, (uint8_t *) msg, (uint16_t) len);
|
tox_set_status_message(m, (uint8_t *) msg, (uint16_t) len);
|
||||||
prompt_update_statusmessage(prompt, msg);
|
prompt_update_statusmessage(prompt, msg);
|
||||||
}
|
}
|
||||||
@ -434,8 +434,8 @@ void cmd_status(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
|
|||||||
|
|
||||||
if (msg != NULL) {
|
if (msg != NULL) {
|
||||||
++msg;
|
++msg;
|
||||||
msg[strlen(msg) - 1] = L'\0'; /* remove opening and closing quotes */
|
int len = strlen(msg) - 1;
|
||||||
int len = strlen(msg);
|
msg[len] = '\0'; /* remove opening and closing quotes */
|
||||||
tox_set_status_message(m, (uint8_t *) msg, (uint16_t) len);
|
tox_set_status_message(m, (uint8_t *) msg, (uint16_t) len);
|
||||||
prompt_update_statusmessage(prompt, msg);
|
prompt_update_statusmessage(prompt, msg);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ static void prompt_onConnectionChange(ToxWindow *self, Tox *m, int32_t friendnum
|
|||||||
|
|
||||||
ChatContext *ctx = self->chatwin;
|
ChatContext *ctx = self->chatwin;
|
||||||
|
|
||||||
char nick[TOX_MAX_NAME_LENGTH];
|
char nick[TOX_MAX_NAME_LENGTH] = {0};
|
||||||
int n_len = tox_get_name(m, friendnum, (uint8_t *) nick);
|
int n_len = tox_get_name(m, friendnum, (uint8_t *) nick);
|
||||||
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH - 1);
|
n_len = MIN(n_len, TOXIC_MAX_NAME_LENGTH - 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user