From: <mie...@us...> - 2007-10-28 19:42:56
|
Revision: 1118 http://oorexx.svn.sourceforge.net/oorexx/?rev=1118&view=rev Author: miesfeld Date: 2007-10-28 12:42:57 -0700 (Sun, 28 Oct 2007) Log Message: ----------- Pull revision 1117 (problems with characters greater than 0x7f) into my sandbox. Revision Links: -------------- http://oorexx.svn.sourceforge.net/oorexx/?rev=1117&view=rev Modified Paths: -------------- sandbox/mark/os2-types/kernel/classes/StringClass.cpp sandbox/mark/os2-types/kernel/parser/SourceFile.hpp Modified: sandbox/mark/os2-types/kernel/classes/StringClass.cpp =================================================================== --- sandbox/mark/os2-types/kernel/classes/StringClass.cpp 2007-10-28 18:17:02 UTC (rev 1117) +++ sandbox/mark/os2-types/kernel/classes/StringClass.cpp 2007-10-28 19:42:57 UTC (rev 1118) @@ -1160,12 +1160,16 @@ /******************************************************************************/ { RexxString *newCopy; /* new copy of string */ - const char *Current; /* current string location */ + // NOTE: since we're doing value comparisons on single character values here, + // we need to process this as unsigned characters to handle values + // greater than 0x7f. + const unsigned char *Current; /* current string location */ size_t i; /* string length */ BOOL NonDisplay; /* have non-displayables */ i = this->getLength(); /* get the length */ - Current = this->getStringData(); /* point to the start */ + /* point to the start */ + Current = (const unsigned char *)this->getStringData(); NonDisplay = FALSE; /* no non-displayable characters */ for (; i > 0; i--) { /* loop for the entire string */ Modified: sandbox/mark/os2-types/kernel/parser/SourceFile.hpp =================================================================== --- sandbox/mark/os2-types/kernel/parser/SourceFile.hpp 2007-10-28 18:17:02 UTC (rev 1117) +++ sandbox/mark/os2-types/kernel/parser/SourceFile.hpp 2007-10-28 19:42:57 UTC (rev 1118) @@ -284,12 +284,16 @@ static inline bool isSymbolCharacter(char ch) { - return characterTable[(unsigned int)ch] != 0; + // The anding is necessary to keep characters > 0x7F from being + // treated as negative numbers and returning bogus values. + return characterTable[((unsigned int)ch) & 0xff] != 0; } static inline int translateChar(char ch) { - return characterTable[(unsigned int)ch]; + // The anding is necessary to keep characters > 0x7F from being + // treated as negative numbers and returning bogus values. + return characterTable[((unsigned int)ch) & 0xff]; } LONG flags; /* parsing flags */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |