[sane-devel] scanimage option handling bug?

m. allan noah kitno455 at gmail.com
Wed Aug 1 15:27:52 UTC 2007


i have found a bug at the end of scanimage's parse_scalar() function,
at line 718:

  *value = v + 0.5;

value is a pointer back to the caller to return the parsed option, and
v is a local double that contains the number we read from the options
string.

what is the 0.5 for? why are we attempting to round up the value
before returning it?

the bug that caused me to look at this line is that negative values
get increased by one. i can change this code to check the sign of the
value and add or subtract .5, but i would rather know why it is there
at all...

any ideas?

allan

-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list