The warning -Wunused-result is on by default, so we'd like to deal
with those before adding routine testing to Jenkins with gcc-4.8.
Change-Id: I905d43e7fa50229b38d2d3d9e642372790f73899
static void ReadAccOpen(const char *infile, FILE *in)
{
char buf[STRLEN];
static void ReadAccOpen(const char *infile, FILE *in)
{
char buf[STRLEN];
- fscanf(in, "%4s", buf);
- if (strcmp(buf, "{") != 0)
+ result = fscanf(in, "%4s", buf);
+ if ((1 != result) || strcmp(buf, "{") != 0)
{
ReadDlgErr(infile, eACCOEXP, buf);
}
{
ReadDlgErr(infile, eACCOEXP, buf);
}
static void ReadAccClose(const char *infile, FILE *in)
{
char buf[STRLEN];
static void ReadAccClose(const char *infile, FILE *in)
{
char buf[STRLEN];
- fscanf(in, "%4s", buf);
- if (strcmp(buf, "}") != 0)
+ result = fscanf(in, "%4s", buf);
+ if ((1 != result) || strcmp(buf, "}") != 0)
{
ReadDlgErr(infile, eACCCEXP, buf);
}
{
ReadDlgErr(infile, eACCCEXP, buf);
}
{
FILE *in;
char buf[STRLEN];
{
FILE *in;
char buf[STRLEN];
t_fgrid *fgrid;
t_fgroup *fgroup;
t_fsimple *fsimple;
int gridx, gridy;
t_fgrid *fgrid;
t_fgroup *fgroup;
t_fsimple *fsimple;
int gridx, gridy;
- in = libopen(infile);
- fscanf(in, "%6s", buf);
- if (strcmp(buf, "grid") != 0)
+ in = libopen(infile);
+ result = fscanf(in, "%6s", buf);
+ if ((1 != result) || strcmp(buf, "grid") != 0)
{
ReadDlgErr(infile, eGRIDEXP, buf);
}
{
ReadDlgErr(infile, eGRIDEXP, buf);
}
fgrid->w = gridx;
fgrid->h = gridy;
ReadAccOpen(infile, in);
fgrid->w = gridx;
fgrid->h = gridy;
ReadAccOpen(infile, in);
- fscanf(in, "%15s", buf);
- while (bNotAccClose(buf))
+ result = fscanf(in, "%15s", buf);
+ while ((1 == result) && bNotAccClose(buf))
{
if (strcmp(buf, "group") == 0)
{
{
if (strcmp(buf, "group") == 0)
{
ReadDlgErr(infile, eTOOHIGH, buf);
}
ReadAccOpen(infile, in);
ReadDlgErr(infile, eTOOHIGH, buf);
}
ReadAccOpen(infile, in);
- fscanf(in, "%15s", buf);
- while (bNotAccClose(buf))
+ result = fscanf(in, "%15s", buf);
+ while ((1 == result) && bNotAccClose(buf))
{
AddFGroupFItem(fgroup, ScanFItem(infile, in, buf));
{
AddFGroupFItem(fgroup, ScanFItem(infile, in, buf));
- fscanf(in, "%15s", buf);
+ result = fscanf(in, "%15s", buf);
}
}
else if (strcmp(buf, "simple") == 0)
}
}
else if (strcmp(buf, "simple") == 0)
ReadDlgErr(infile, eTOOHIGH, "simple");
}
ReadAccOpen(infile, in);
ReadDlgErr(infile, eTOOHIGH, "simple");
}
ReadAccOpen(infile, in);
- fscanf(in, "%15s", buf);
- fsimple->fitem = ScanFItem(infile, in, buf);
- ReadAccClose(infile, in);
+ result = fscanf(in, "%15s", buf);
+ if (1 == result)
+ {
+ fsimple->fitem = ScanFItem(infile, in, buf);
+ ReadAccClose(infile, in);
+ }
+ }
+ if (1 == result)
+ {
+ result = fscanf(in, "%15s", buf);
- fscanf(in, "%15s", buf);
+ /* Since we always read one variable at a time the result from
+ * fscanf should always be 1.
+ */
+ if (1 != result)
+ {
+ ReadDlgErr(infile, eNOVALS, "fgrid");
+ }