Fix an issue (only found using gcc under mingw) in dsnlexer.cpp, using ::isspace( ) function that accepts only a 7 bit ASCII value under gcc/ mingw.

This commit is contained in:
jean-pierre charras 2012-06-20 22:33:05 +02:00
parent 025d550955
commit 3a8bf14c9f
1 changed files with 7 additions and 2 deletions

View File

@ -374,8 +374,13 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation ) throw( IO_ERROR )
*/
static inline bool isSpace( int cc )
{
// make sure int passed to ::isspace() is 0-255
return ::isspace( cc & 0xff );
// Warning: we are using UTF8 char, so values are coded from 0x01 to 0xFF
// isspace( int value ) works fine under Linux,
// but seems use only a 7 bits value under mingw, in comparisons.
// (for instance 0xA0 is seen as 0x20)
// So we need to test if the value is ASCII ( <= 127) and a space ( ' ', \t, \n ... )
// and not just a space:
return ( (unsigned) cc <= 127 ) && ::isspace( cc );
}