Facilitate swapping clock messages
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 7 Apr 2020 10:11:33 +0000 (12:11 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 7 Apr 2020 11:37:47 +0000 (13:37 +0200)
The routine SetClockMessage() now copies the message of the other clock
when it gets passed an empty string. To erase a message, we must pass
a NULL argument.

dialogs.c
winboard/winboard.c

index 4fa93c3..7c90898 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -3053,7 +3053,7 @@ DisplayBlackClock (long timeRemaining, int highlight)
 void
 SetClockMessage (int n, char *msg)
 {
-    safeStrCpy(clockMsg[n], msg, MSG_SIZ);
+    safeStrCpy(clockMsg[n], !msg ? "" : *msg ? msg : clockMsg[!n], MSG_SIZ);
 }
 
 //---------------------------------------------
index 58508d6..10f66ea 100644 (file)
@@ -9134,7 +9134,7 @@ DisplayBlackClock(long timeRemaining, int highlight)
 void\r
 SetClockMessage (int color, char *msg)\r
 {\r
-  safeStrCpy(clockMsg[n], msg, MSG_SIZ);\r
+  safeStrCpy(clockMsg[n], !msg ? "" : *msg ? msg : clockMsg[!n], MSG_SIZ);\r
 }\r
 \r
 int\r