From 17e791e528c5950e59e5203c3f6cec72ab8d2608 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 25 Oct 2015 22:39:06 +0100 Subject: [PATCH] shut up GCC warning about memset with 0bytes in Con_CenteredPrint() yeah, if l<0 memset would have be called with length 0, which does not really matter but was easily to prevent by only doing it if l>0. --- src/client/cl_console.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/cl_console.c b/src/client/cl_console.c index c5dbe51d..ba73d140 100644 --- a/src/client/cl_console.c +++ b/src/client/cl_console.c @@ -452,12 +452,15 @@ Con_CenteredPrint(char *text) l = strlen(text); l = (con.linewidth - l) / 2; - if (l < 0) + if (l <= 0) { l = 0; } + else + { + memset(buffer, ' ', l); + } - memset(buffer, ' ', l); strcpy(buffer + l, text); strcat(buffer, "\n"); Con_Print(buffer);