On Tue, Jul 09, 2013 at 08:25:24AM +0100, Gianfranco Costamagna wrote:
> >>  -        fscanf(f, "%2x", &n);
> >>  +        fs = fscanf(f, "%2x", &n);
> >>           key->data[i] = n;
> >>  +    if (EOF == fs) return ERR_NULL;
> > 
> > Shouldn't these check that fscanf's result is 1
> > (e.g. change these to 'if (1 != fs)'?)
> 
> I partially agree.
> The most appropriate solution should be 
> if(1 != fs || EOF != fs)

That's equivalent to 'if(true)' because fs can't be both 1 and EOF,
so either (1 != fs) or (EOF != fs) is true.

I think you want an error whenever it is *not* 1, so you just want the
(1 != fs): whether it is 0 (failed match) or EOF (ran out of input),
you want it to error out.

- Alyssa
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to