1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 21:53:05 +01:00

increase line_info msg buffer size so won't cut off long log lines

This commit is contained in:
Jfreegman 2014-09-22 13:49:09 -04:00
parent dc3b2e04ab
commit c07c0028bb
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 4 additions and 5 deletions

View File

@ -143,7 +143,7 @@ void line_info_add(ToxWindow *self, char *timestr, char *name1, char *name2, uin
if (new_line == NULL)
exit_toxic_err("failed in line_info_add", FATALERR_MEMORY);
char frmt_msg[MAX_STR_SIZE] = {0};
char frmt_msg[MAX_LINE_INFO_MSG_SIZE] = {0};
va_list args;
va_start(args, msg);

View File

@ -29,6 +29,7 @@
#define MAX_HISTORY 100000
#define MIN_HISTORY 40
#define MAX_LINE_INFO_QUEUE 512
#define MAX_LINE_INFO_MSG_SIZE MAX_STR_SIZE + TOXIC_MAX_NAME_LENGTH + 32 /* needs extra room for log loading */
enum {
SYS_MSG,
@ -47,7 +48,7 @@ struct line_info {
char timestr[TIME_STR_SIZE];
char name1[TOXIC_MAX_NAME_LENGTH];
char name2[TOXIC_MAX_NAME_LENGTH];
char msg[TOX_MAX_MESSAGE_LENGTH];
char msg[MAX_LINE_INFO_MSG_SIZE];
uint64_t timestamp;
uint8_t type;
uint8_t bold;

View File

@ -176,7 +176,6 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
++count;
}
char buf[MAX_STR_SIZE];
const char *line = strtok(&hstbuf[start + 1], "\n");
if (line == NULL) {
@ -185,8 +184,7 @@ void load_chat_history(ToxWindow *self, struct chatlog *log)
}
while (line != NULL) {
snprintf(buf, sizeof(buf), "%s", line);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", buf);
line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "%s", line);
line = strtok(NULL, "\n");
}