diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-13 18:57:22 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:12 +0100 |
commit | a63c1534cc8d8eb5d343a80a2805a2e9e6cd5358 (patch) | |
tree | dec15350987241201c6081892025750984b750d3 | |
parent | c034a5216e1c9a583ea9f633c9d5b0a801f1cd1b (diff) |
prep for size_t change from int to unsigned int
-rw-r--r-- | src/cgame/cg_main.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 4b7b1758..6699fa1f 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -599,10 +599,9 @@ void CG_RemoveNotifyLine( void ) cg.consoleText[ i ] = cg.consoleText[ i + offset ]; //pop up the first consoleLine + cg.numConsoleLines--; for( i = 0; i < cg.numConsoleLines; i++ ) cg.consoleLines[ i ] = cg.consoleLines[ i + 1 ]; - - cg.numConsoleLines--; } /* @@ -626,18 +625,22 @@ void CG_AddNotifyText( void ) bufferLen = strlen( buffer ); textLen = strlen( cg.consoleText ); - + // Ignore console messages that were just printed if( cg_noPrintDuplicate.integer && textLen >= bufferLen && !strcmp( cg.consoleText + textLen - bufferLen, buffer ) ) return; - + if( cg.numConsoleLines == MAX_CONSOLE_LINES ) + { CG_RemoveNotifyLine( ); + textLen = strlen( cg.consoleText ); + } - Q_strcat( cg.consoleText, MAX_CONSOLE_TEXT, buffer ); + Q_strncpyz( cg.consoleText + textLen, buffer, MAX_CONSOLE_TEXT - textLen ); cg.consoleLines[ cg.numConsoleLines ].time = cg.time; - cg.consoleLines[ cg.numConsoleLines ].length = bufferLen; + cg.consoleLines[ cg.numConsoleLines ].length = + MIN( bufferLen, MAX_CONSOLE_TEXT - textLen - 1 ); cg.numConsoleLines++; } |