From 476e35f50ec42ee085e06459b04af2d7141adf39 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Wed, 9 Feb 2011 01:31:26 +0000 Subject: [PATCH] Make Q_vsnprintf() more standard conform in bg_lib.c, patch by devhc --- code/game/bg_lib.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/code/game/bg_lib.c b/code/game/bg_lib.c index 296459a8..0b4b47b9 100644 --- a/code/game/bg_lib.c +++ b/code/game/bg_lib.c @@ -1740,13 +1740,8 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) break; /* some picky compilers need this */ } } - if (buffer != NULL) - { - if (currlen < maxlen - 1) - buffer[currlen] = '\0'; - else - buffer[maxlen - 1] = '\0'; - } + if (maxlen > 0) + buffer[currlen] = '\0'; return total; } @@ -2069,8 +2064,6 @@ static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) int Q_vsnprintf(char *str, size_t length, const char *fmt, va_list args) { - if (str != NULL) - str[0] = 0; return dopr(str, length, fmt, args); }