shithub: qk1

Download patch

ref: bcd7bbc429073a5683d89abcec6613bc1d6f6f1d
parent: 968ea5f2c3b96b5bd413534ed11789ef9026c47e
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Oct 13 23:27:50 EDT 2024

Sbar_itoa → snprint

--- a/sbar.c
+++ b/sbar.c
@@ -50,8 +50,6 @@
 static void
 Sbar_ShowScores(void)
 {
-	if (sb_showscores)
-		return;
 	sb_showscores = true;
 }
 
@@ -277,43 +275,6 @@
 
 /*
 =============
-Sbar_itoa
-=============
-*/
-static int
-Sbar_itoa(int num, char *buf)
-{
-	char	*str;
-	int		pow10;
-	int		dig;
-
-	str = buf;
-
-	if (num < 0)
-	{
-		*str++ = '-';
-		num = -num;
-	}
-
-	for (pow10 = 10 ; num >= pow10 ; pow10 *= 10)
-	;
-
-	do
-	{
-		pow10 /= 10;
-		dig = num/pow10;
-		*str++ = '0'+dig;
-		num -= dig*pow10;
-	} while (pow10 != 1);
-
-	*str = 0;
-
-	return str-buf;
-}
-
-
-/*
-=============
 Sbar_DrawNum
 =============
 */
@@ -324,7 +285,7 @@
 	char			*ptr;
 	int				l, frame;
 
-	l = Sbar_itoa (num, str);
+	l = snprint(str, sizeof(str), "%d", num);
 	ptr = str;
 	if (l > digits)
 		ptr += (l-digits);
@@ -930,7 +891,7 @@
 	char			*ptr;
 	int				l, frame;
 
-	l = Sbar_itoa (num, str);
+	l = snprint(str, sizeof(str), "%d", num);
 	ptr = str;
 	if (l > digits)
 		ptr += (l-digits);