----- Messaggio originale ----- > Da: Alyssa Milburn <amilb...@math.leidenuniv.nl> > A: Gianfranco Costamagna <costamagnagianfra...@yahoo.it> > Cc: "steffen_moel...@gmx.de" <steffen_moel...@gmx.de>; > "boinc_dev@ssl.berkeley.edu" <boinc_dev@ssl.berkeley.edu> > 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 G. > 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 boinc_dev@ssl.berkeley.edu http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev To unsubscribe, visit the above URL and (near bottom of page) enter your email address.