mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
- fix buffer size reallocation
- fix history crash
This commit is contained in:
parent
0977b555f3
commit
388c102a57
2 changed files with 3 additions and 1 deletions
|
@ -121,6 +121,8 @@ Con_ProcessInputLine (inputline_t *il, int ch)
|
||||||
case K_UP:
|
case K_UP:
|
||||||
do {
|
do {
|
||||||
il->history_line = (il->history_line - 1) % il->num_lines;
|
il->history_line = (il->history_line - 1) % il->num_lines;
|
||||||
|
if (il->history_line < 0)
|
||||||
|
il->history_line = il->num_lines - 1;
|
||||||
} while (il->history_line != il->edit_line
|
} while (il->history_line != il->edit_line
|
||||||
&& !il->lines[il->history_line][1]);
|
&& !il->lines[il->history_line][1]);
|
||||||
if (il->history_line == il->edit_line)
|
if (il->history_line == il->edit_line)
|
||||||
|
|
|
@ -184,7 +184,7 @@ C_Print (const char *fmt, va_list args)
|
||||||
|
|
||||||
size = vsnprintf (buffer, buffer_size, fmt, args);
|
size = vsnprintf (buffer, buffer_size, fmt, args);
|
||||||
if (size + 1 > buffer_size) {
|
if (size + 1 > buffer_size) {
|
||||||
buffer_size = (size + 1 + 1024) % 1024; // 1k multiples
|
buffer_size = ((size + 1 + 1024) / 1024) * 1024; // 1k multiples
|
||||||
buffer = realloc (buffer, buffer_size);
|
buffer = realloc (buffer, buffer_size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
Sys_Error ("console: could not allocate %d bytes\n",
|
Sys_Error ("console: could not allocate %d bytes\n",
|
||||||
|
|
Loading…
Reference in a new issue