From 21f5bd8e1cab938d4925e8426095aa6c62b268ca Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 30 Sep 2024 23:26:58 +0200 Subject: [PATCH] Fix wrong usage of dpsnprintf --- cl_screen.c | 1 - console.c | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index 4bdb5631..7c2ab0dc 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -684,7 +684,6 @@ static int SCR_InfobarHeight(void) return offset; } - /* ============== SCR_InfoBar_f diff --git a/console.c b/console.c index e1f15d2f..c6929ac2 100644 --- a/console.c +++ b/console.c @@ -1620,11 +1620,12 @@ void Hash_Completion_Reset(void) char chat_nicksbarstring[MAX_INPUTLINE]; void Chat_NicksBar_Build(void) { + int len = 0; int initial = hash_completion_player; int next = initial; int next_players_count = 3; - dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "#%d %s", hash_completion_player + 1, cl.scores[hash_completion_player].name); + len += dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "#%d %s", hash_completion_player + 1, cl.scores[hash_completion_player].name); while(next_players_count >= 0) { next = (next + 1) % cl.maxclients; @@ -1633,9 +1634,9 @@ void Chat_NicksBar_Build(void) if (cl.scores[next].name[0]) { if (next_players_count == 0) - dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "%s^8, ...", chat_nicksbarstring); + len += dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "%s^8, ...", chat_nicksbarstring); else - dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "%s^8, #%d ^7%s", chat_nicksbarstring, next + 1, cl.scores[next].name); + len += dpsnprintf(chat_nicksbarstring, sizeof(chat_nicksbarstring), "%s^8, #%d ^7%s", chat_nicksbarstring, next + 1, cl.scores[next].name); --next_players_count; } } @@ -2691,7 +2692,8 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon static void Cmd_CompleteNicksPrint(int count) { - for(int i = 0; i < count; ++i) + int i; + for(i = 0; i < count; ++i) Con_Printf("%s\n", Nicks_list[i]); } -- 2.39.2