>________________________________ > 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) > >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
You are absolutely right (sorry I didn't read carefully the mail, my fault) I changed the debian patch based on your suggestions and committed http://anonscm.debian.org/gitweb/?p=pkg-boinc/boinc.git;a=commitdiff;h=2b58a04fa4290ef57ea8b06cfc3c353182ad1f26 http://anonscm.debian.org/gitweb/?p=pkg-boinc/boinc.git;a=blob;f=debian/patches/more_clang_warnings.patch;h=a1f0045b5e26a767af59ab450d76409b3a09b3dd;hb=2b58a04fa4290ef57ea8b06cfc3c353182ad1f26 is everything ok now? (write should return -1 in case of failure AFAICS) bests G. > > > _______________________________________________ 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.