shithub: choc

Download patch

ref: 5a63dede9be5a1a126debc57be3075e565bc1248
parent: 10547d4138a678caed15c546877679b65bf2e1db
author: Simon Howard <fraggle@gmail.com>
date: Wed Feb 14 14:11:03 EST 2007

Expand buffer length to fix bug on Windows with cycling character on the
quicksave screen.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 835

--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1804,42 +1804,42 @@
     static short	y;
     unsigned int	i;
     unsigned int	max;
-    char		string[40];
+    char		string[80];
     char               *name;
     int			start;
 
     inhelpscreens = false;
-
     
     // Horiz. & Vertically center string and print it.
     if (messageToPrint)
     {
 	start = 0;
-	y = 100 - M_StringHeight(messageString)/2;
-	while(*(messageString+start))
+	y = 100 - M_StringHeight(messageString) / 2;
+	while (messageString[start] != '\0')
 	{
 	    int foundnewline = 0;
 
-	    for (i = 0;i < strlen(messageString+start);i++)
-		if (*(messageString+start+i) == '\n')
+	    for (i = 0; i < strlen(messageString + start); i++)
+		if (messageString[start + i] == '\n')
 		{
-		    memset(string,0,40);
-		    strncpy(string,messageString+start,i);
+		    memset(string, 0, 40);
+		    strncpy(string, messageString + start, i);
 		    foundnewline = 1;
-		    start += i+1;
+		    start += i + 1;
 		    break;
 		}
 				
 	    if (!foundnewline)
 	    {
-		strcpy(string,messageString+start);
+		strcpy(string, messageString + start);
 		start += strlen(string);
 	    }
 
-	    x = 160 - M_StringWidth(string)/2;
-	    M_WriteText(x,y,string);
+	    x = 160 - M_StringWidth(string) / 2;
+	    M_WriteText(x, y, string);
 	    y += SHORT(hu_font[0]->height);
 	}
+
 	return;
     }