X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=926f905222f1d9382c0355f6c07616061e49ea3f;hb=259aca883470b6cd7fc47e417475f05120400d3c;hp=648d45260f76fe8f5c2b55391a9ae77456418ea4;hpb=23aef45a07bfc84a29b7cb9099508324815a458b;p=xboard.git diff --git a/xoptions.c b/xoptions.c index 648d452..926f905 100644 --- a/xoptions.c +++ b/xoptions.c @@ -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); }