int len;
len = snprintf(buf,MSG_SIZ, "%s %s", msg, badArg);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "ExitArgError: buffer truncated. Input: msg=%s badArg=%s\n", msg, badArg);
if(!quit) { printf(_("%s in settings file\n"), buf); return; } // DisplayError does not work yet at this stage...
if(!ok && strchr(name, '.') == NULL)
{ // append default file-name extension '.ini' when needed
len = snprintf(buf,MSG_SIZ, "%s.ini", name);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "ParseSettingsFile: buffer truncated. Input: name=%s \n",name);
ok = MySearchPath(installDir, buf, fullname);
if(p != NULL)
{ // engine command line contains WinBoard options
len = snprintf(buf, MSG_SIZ, p+6, f, f, f, f, f, f, f, f, f, f); // replace %s in them by "first"
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitAppData: buffer truncated.\n");
ParseArgs(StringGet, &q);
if(p != NULL)
{ // engine command line contains WinBoard options
len = snprintf(buf,MSG_SIZ, p+6, s, s, s, s, s, s, s, s, s, s); // replace %s in them by "first"
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitAppData: buffer truncated.\n");
ParseArgs(StringGet, &q);
return TRUE;
case ArgInt:
len = snprintf(name, MSG_SIZ, "%d", *(int*) ad->argLoc);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "GetArgValue: buffer truncated.\n");
return TRUE;
case ArgBoolean:
len = snprintf(name, MSG_SIZ, "%s", *(Boolean*) ad->argLoc ? "true" : "false");
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "GetArgValue: buffer truncated.\n");
return TRUE;
len = snprintf(buf, MSG_SIZ, _("protocol version %d not supported"),
appData.protocolVersion[n]);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitBackEnd1: buffer truncated.\n");
DisplayFatalError(buf, 0, 2);
case VariantKriegspiel: /* need to hide pieces and move details */
/* case VariantFischeRandom: (Fabien: moved below) */
len = snprintf(buf,MSG_SIZ, _("Variant %s supported only in ICS mode"), appData.variant);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitBackEnd1: buffer truncated.\n");
DisplayFatalError(buf, 0, 2);
case Variant36:
default:
len = snprintf(buf, MSG_SIZ, _("Unknown variant name %s"), appData.variant);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitBackEnd1: buffer truncated.\n");
DisplayFatalError(buf, 0, 2);
len = snprintf(buf, MSG_SIZ, _("Could not connect to host %s, port %s"),
appData.icsHost, appData.icsPort);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitBackEnd3: buffer truncated.\n");
DisplayFatalError(buf, err, 1);
initialMode = Training;
} else {
len = snprintf(buf, MSG_SIZ, _("Unknown initialMode %s"), appData.initialMode);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "InitBackEnd3: buffer truncated.\n");
DisplayFatalError(buf, 0, 2);
break;
default:
len = snprintf(buf, MSG_SIZ, _("Unknown wild type %d"), wnum);
- if( (len > MSG_SIZ) && appData.debugMode )
+ if( (len >= MSG_SIZ) && appData.debugMode )
fprintf(debugFP, "StringToVariant: buffer truncated.\n");
DisplayError(buf, 0);