- This topic has 1 reply, 2 voices, and was last updated 7 years, 8 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
Forums › TWAIN Classic › Bug in twain.h definitions of TWCY_… codes
When writing yet another piece of interface code to TWAIN, I stumbled across a (long standing?) bug in twain.h
The country code for Andorra is defined as
#define TWCY_ANDORRA 033
and later the country code for South Africa is defined as
#define TWCY_SOUTHAFRICA 27
Now you should be aware of the fact that 033 is octal notation because of the leading zero and thus there is a value clash between Andorra and South Africa. This may not yet have caused issues, because probably few TWAIN drivers come with country codes of Andorra and South Africa. It is, however, an issue for applications that wish to translate codes into names and vice-versa.
To correct the issue the line for Andorra should become
#define TWCY_ANDORRA 33
which makes it equal to the country code for France, which probably is what was intended.
There are a few more numbers with leading zeroes which don’t cause issues just for the fact that they are below 010 and thus the notation is the same in both base 10 and base 8. They should all be stripped of leading zeroes.
Regards,
Jürgen
Thanks for the catch! We’ll be getting that into the Spec…