[sane-devel] Fixing sequencing issues (was Re: Proposed Upgrade (pu) branches on GitLab)

Johannes Meixner jsmeix at suse.de
Mon Sep 28 11:04:13 UTC 2015


Hello,

On Sep 28 18:59 Olaf Meeuwissen wrote (excerpt):
> With the sequencing issues, we can only speculate at what
> the intended behaviour is, so we can't really fix things.
> That notwithstanding, I think we can make a decent, educated
> guess at a fix for both cases and make the warning go away :-|

I don't know if the following sequencing bug was already found:

In sane-backends-git20150928 in backend/microtek2.c
there is line 7456:

         ms->buf.current_src = ++ms->buf.current_src % 2;

My "decent educated guess" is that

         ++ms->buf.current_src;
         ms->buf.current_src = ms->buf.current_src % 2;

is meant.

For sequencing issues I would assume the original author was not
actually a sufficient C expert who fully understood those issues
(otherwise he would not have made ambiguous code) so that
to fix those issues one could assume that any kind of

   foo = something where ++foo is used;

was meant as

   foo++; /* or "++foo;" or "foo = foo + 1;" as one likes */
   foo = something where foo is used;

and any kind of

   foo = something where foo++ is used;

was meant as

   foo = something where foo is used;
   foo++; /* or "++foo;" or "foo = foo + 1;" as one likes */

and same reasoning for "--foo" and "foo--".


Kind Regards
Johannes Meixner
-- 
SUSE LINUX GmbH - GF: Felix Imendoerffer, Jane Smithard,
Graham Norton - HRB 21284 (AG Nuernberg)




More information about the sane-devel mailing list