diff --git a/pcbnew/dsn.cpp b/pcbnew/dsn.cpp index 918a114b4a..13feb3db5b 100644 --- a/pcbnew/dsn.cpp +++ b/pcbnew/dsn.cpp @@ -621,6 +621,18 @@ void LEXER::ThrowIOError( wxString aText, int charOffset ) throw (IOError) } +/** + * Function isspace + * strips the upper bits of the int to ensure the value passed to ::isspace() is + * in the range of 0-255 + */ +static inline bool isSpace( int cc ) +{ + // make sure int passed to ::isspace() is 0-255 + return ::isspace( cc & 0xff ); +} + + DSN_T LEXER::NextTok() throw (IOError) { char* cur = next; @@ -643,7 +655,7 @@ L_read: cur = start; // skip leading whitespace - while( curstart && !isspace( cur[-1] ) ) + if( *cur == '-' && cur>start && !isSpace( cur[-1] ) ) { head = cur+1; curText.clear(); @@ -730,7 +742,7 @@ L_read: while( head