> Gesendet: Dienstag, 09. Juli 2013 um 11:47 Uhr > Von: "Gianfranco Costamagna" <[email protected]> > An: "Alyssa Milburn" <[email protected]> > Cc: "[email protected]" <[email protected]>, > "[email protected]" <[email protected]> > Betreff: Re: [boinc_dev] addressing some clang warnings > > ----- Messaggio originale ----- > > > Da: Alyssa Milburn <[email protected]> > > A: Gianfranco Costamagna <[email protected]> > > Cc: "[email protected]" <[email protected]>; > > "[email protected]" <[email protected]> > > Inviato: Martedì 9 Luglio 2013 11:43 > > Oggetto: Re: [boinc_dev] addressing some clang warnings > > > > 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) > > > You are right, > I mean > if(1 == fs || EOF == fs) > > sorry, I shouldn't send mail in the morning :p
And we should bail out before n is assigned to data[i], and if so, data[i] should get (or already have) some "not assigned, yet" value. Many thanks for the extra eyeballs. Steffen _______________________________________________ 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.
