Add -afterTourney option
[xboard.git] / xoptions.c
index 648d452..926f905 100644 (file)
@@ -155,7 +155,7 @@ void SpinCallback(w, client_data, call_data)
     String name, val;
     Arg args[16];
     char buf[MSG_SIZ], *p;
-    int j;
+    int j = 0; // Initialiasation is necessary because the text value may be non-numeric causing the scanf conversion to fail
     int data = (intptr_t) client_data;
 
     XtSetArg(args[0], XtNlabel, &name);
@@ -638,7 +638,7 @@ char *soundNames[] = {
 char *soundFiles[] = { // sound files corresponding to above names
        "",
        "$",
-       "*", // kludge alert: as first thing in the dialog readout this is replaced with the user-given .WAV filename
+       NULL, // kludge alert: as first thing in the dialog readout this is replaced with the user-given .WAV filename
        "honkhonk.wav",
        "cymbal.wav",
        "ding1.wav",
@@ -838,6 +838,7 @@ int GenericReadout(int selected)
                case Fractional:
                    XtSetArg(args[0], XtNstring, &val);
                    XtGetValues(currentOption[i].handle, args, 1);
+                   x = 0.0; // Initialise because sscanf() will fail if non-numeric text is entered
                    sscanf(val, "%f", &x);
                    if(x > currentOption[i].max) x = currentOption[i].max;
                    if(x < currentOption[i].min) x = currentOption[i].min;
@@ -1289,7 +1290,8 @@ void SoundOptionsProc(w, event, prms, nprms)
      String *prms;
      Cardinal *nprms;
 {
-   soundFiles[2] = "*";
+   free(soundFiles[2]);
+   soundFiles[2] = strdup("*");
    GenericPopUp(soundOptions, _("Sound Options"), 0);
 }