Changeset 4491 in orxonox.OLD for orxonox/trunk/src/lib/tinyxml/tinyxmlparser.cc
- Timestamp:
- Jun 3, 2005, 1:40:28 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/tinyxml/tinyxmlparser.cc
r4261 r4491 25 25 #include "tinyxml.h" 26 26 #include <ctype.h> 27 #include <stddef.h> 27 28 28 29 //#define DEBUG_PARSER … … 50 51 // ef bf bf 51 52 52 const char TIXML_UTF_LEAD_0 = (const char)0xef;53 const char TIXML_UTF_LEAD_1 = (const char)0xbb;54 const char TIXML_UTF_LEAD_2 = (const char)0xbf;53 const unsigned char TIXML_UTF_LEAD_0 = 0xefU; 54 const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; 55 const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; 55 56 56 57 const int TiXmlBase::utf8ByteTable[256] = … … 117 118 118 119 119 /*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding )120 /*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) 120 121 { 121 122 // This will only work for low-ascii, everything else is assumed to be a valid … … 138 139 139 140 140 /*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding )141 /*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) 141 142 { 142 143 // This will only work for low-ascii, everything else is assumed to be a valid … … 202 203 while ( p < now ) 203 204 { 205 // Treat p as unsigned, so we have a happy compiler. 206 const unsigned char* pU = (const unsigned char*)p; 207 204 208 // Code contributed by Fletcher Dunn: (modified by lee) 205 switch (*p ) {209 switch (*pU) { 206 210 case 0: 207 211 // We *should* never get here, but in case we do, don't … … 253 257 // In these cases, don't advance the column. These are 254 258 // 0-width spaces. 255 if ( *(p +1)==TIXML_UTF_LEAD_1 && *(p+2)==TIXML_UTF_LEAD_2 )259 if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) 256 260 p += 3; 257 else if ( *(p +1)==(char)(0xbf) && *(p+2)==(char)(0xbe))261 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) 258 262 p += 3; 259 else if ( *(p +1)==(char)(0xbf) && *(p+2)==(char)(0xbf))263 else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) 260 264 p += 3; 261 265 else … … 309 313 while ( *p ) 310 314 { 315 const unsigned char* pU = (const unsigned char*)p; 316 311 317 // Skip the stupid Microsoft UTF-8 Byte order marks 312 if ( *(p +0)==TIXML_UTF_LEAD_0313 && *(p +1)==TIXML_UTF_LEAD_1314 && *(p +2)==TIXML_UTF_LEAD_2 )318 if ( *(pU+0)==TIXML_UTF_LEAD_0 319 && *(pU+1)==TIXML_UTF_LEAD_1 320 && *(pU+2)==TIXML_UTF_LEAD_2 ) 315 321 { 316 322 p += 3; 317 323 continue; 318 324 } 319 else if(*(p +0)==TIXML_UTF_LEAD_0320 && *(p +1)==(const char) 0xbf321 && *(p +2)==(const char) 0xbe)325 else if(*(pU+0)==TIXML_UTF_LEAD_0 326 && *(pU+1)==0xbfU 327 && *(pU+2)==0xbeU ) 322 328 { 323 329 p += 3; 324 330 continue; 325 331 } 326 else if(*(p +0)==TIXML_UTF_LEAD_0327 && *(p +1)==(const char) 0xbf328 && *(p +2)==(const char) 0xbf)332 else if(*(pU+0)==TIXML_UTF_LEAD_0 333 && *(pU+1)==0xbfU 334 && *(pU+2)==0xbfU ) 329 335 { 330 336 p += 3; … … 421 427 { 422 428 unsigned long ucs = 0; 423 //*ME: warning C4244: convert '__w64 int' to 'unsigned' 424 //*ME: Use size_t instead of unsigned (pointer-arithmetic) 425 size_t delta = 0; 429 ptrdiff_t delta = 0; 426 430 unsigned mult = 1; 427 431 … … 708 712 { 709 713 // Check for the Microsoft UTF-8 lead bytes. 710 if ( *(p+0) && *(p+0) == TIXML_UTF_LEAD_0 711 && *(p+1) && *(p+1) == TIXML_UTF_LEAD_1 712 && *(p+2) && *(p+2) == TIXML_UTF_LEAD_2 ) 714 const unsigned char* pU = (const unsigned char*)p; 715 if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 716 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 717 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) 713 718 { 714 719 encoding = TIXML_ENCODING_UTF8;
Note: See TracChangeset
for help on using the changeset viewer.