Fix WinBoard clock messages
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 9 Apr 2020 12:12:16 +0000 (14:12 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 9 Apr 2020 12:12:16 +0000 (14:12 +0200)
Using the message argument without copying it first permanently
stripped off the second line in logo mode, so that it would not
be displayed after changing side to move. A compile error had
crept in too.

winboard/winboard.c

index 10f66ea..cdfca8e 100644 (file)
@@ -2071,6 +2071,7 @@ static int TranslatePieceToFontPiece( int piece )
 \r
 \r
 \r
+\r
         return PM_WL;\r
     case WhiteFalcon:\r
         return PM_WV;\r
@@ -7770,7 +7771,7 @@ DisplayAClock(HDC hdc, int timeRemaining, int highlight,
               RECT *rect, char *color, char *flagFell)\r
 {\r
   char buf[100];\r
-  char *str, *p;\r
+  char *str = buf, *p;\r
   COLORREF oldFg, oldBg;\r
   HFONT oldFont;\r
 \r
@@ -7783,7 +7784,7 @@ DisplayAClock(HDC hdc, int timeRemaining, int highlight,
     str = buf;\r
   } else {\r
     highlight &= 1;\r
-    str = color;\r
+    snprintf(buf, 100, "%s", color);\r
   }\r
   p = strchr(str, '_');\r
   if(p) *p = (logoHeight > 0 ? 0 : ' ');\r
@@ -9084,7 +9085,7 @@ void
 DisplayWhiteClock(long timeRemaining, int highlight)\r
 {\r
   HDC hdc;\r
-  char *msg, *flag = whiteFlag && gameMode == TwoMachinesPlay ? "(!)" : "";\r
+  char *flag = whiteFlag && gameMode == TwoMachinesPlay ? "(!)" : "";\r
 \r
   if(appData.noGUI) return;\r
   hdc = GetDC(hwndMain);\r
@@ -9134,7 +9135,7 @@ DisplayBlackClock(long timeRemaining, int highlight)
 void\r
 SetClockMessage (int color, char *msg)\r
 {\r
-  safeStrCpy(clockMsg[n], !msg ? "" : *msg ? msg : clockMsg[!n], MSG_SIZ);\r
+  safeStrCpy(clockMsg[color], !msg ? "" : *msg ? msg : clockMsg[!color], MSG_SIZ);\r
 }\r
 \r
 int\r