commit 5e257a13e58c8fcc067722221a4be4402fa1747e Author: devhc Date: Fri May 13 19:32:41 2011 +0200 prep for size_t change from int to unsigned int diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index c5ba9ee..683b62c 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -480,10 +480,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--; } /* @@ -507,18 +506,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++; }