Changeset 4491 in orxonox.OLD for orxonox/trunk/src/lib/tinyxml/tinystr.cc
- Timestamp:
- Jun 3, 2005, 1:40:28 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/tinyxml/tinystr.cc
r4261 r4491 37 37 TiXmlString::TiXmlString (const char* instring) 38 38 { 39 unsignednewlen;39 size_t newlen; 40 40 char * newstring; 41 41 … … 47 47 return; 48 48 } 49 //*ME: warning C4267: convert 'size_t' to 'unsigned int' 50 //*ME: Use Cast: (unsigned) 51 newlen = (unsigned)strlen (instring) + 1; 49 newlen = strlen (instring) + 1; 52 50 newstring = new char [newlen]; 53 51 memcpy (newstring, instring, newlen); … … 61 59 TiXmlString::TiXmlString (const TiXmlString& copy) 62 60 { 63 unsignednewlen;61 size_t newlen; 64 62 char * newstring; 65 63 … … 87 85 void TiXmlString ::operator = (const char * content) 88 86 { 89 unsignednewlen;87 size_t newlen; 90 88 char * newstring; 91 89 … … 95 93 return; 96 94 } 97 newlen = (unsigned)strlen (content) + 1;95 newlen = strlen (content) + 1; 98 96 newstring = new char [newlen]; 99 97 // strcpy (newstring, content); … … 108 106 void TiXmlString ::operator = (const TiXmlString & copy) 109 107 { 110 unsignednewlen;108 size_t newlen; 111 109 char * newstring; 112 110 … … 128 126 129 127 // append a const char * to an existing TiXmlString 130 void TiXmlString::append( const char* str, int len )128 void TiXmlString::append( const char* str, size_t len ) 131 129 { 132 130 char * new_string; 133 unsignednew_alloc, new_size, size_suffix;131 size_t new_alloc, new_size, size_suffix; 134 132 135 133 // don't use strlen - it can overrun the len passed in! … … 192 190 { 193 191 char * new_string; 194 unsignednew_alloc, new_size;192 size_t new_alloc, new_size; 195 193 196 194 new_size = length () + strlen (suffix) + 1; … … 252 250 unsigned TiXmlString::find (char tofind, unsigned offset) const 253 251 { 254 //*ME: warning C4244: convert '__w64 int' to 'unsigned' 255 //*ME: Use Array-Arithmetic instead of Pointer 256 // char * lookup; 252 char * lookup; 257 253 258 254 if (offset >= length ()) 259 255 return (unsigned) notfound; 260 // for (lookup = cstring + offset; * lookup; lookup++) 261 // if (* lookup == tofind) 262 // return lookup - cstring; 263 for( unsigned n=offset ; cstring[n] != '\0' ; n++ ) 264 if( cstring[n] == tofind ) 265 return n ; 256 for (lookup = cstring + offset; * lookup; lookup++) 257 if (* lookup == tofind) 258 return (unsigned)(lookup - cstring); 266 259 return (unsigned) notfound; 267 260 } … … 276 269 return ( strcmp( cstring, compare.cstring ) == 0 ); 277 270 } 271 else if ( length() == 0 && compare.length() == 0 ) 272 { 273 return true; 274 } 278 275 return false; 276 } 277 278 279 bool TiXmlString::operator == (const char* compare) const 280 { 281 if ( allocated && compare && *compare ) 282 { 283 assert( cstring ); 284 return ( strcmp( cstring, compare ) == 0 ); 285 } 286 else if ( length() == 0 && (!compare || !*compare ) ) // this is a little dubious, but try to duplicate behavior in other operator== 287 { 288 return true; 289 } 290 return false; 279 291 } 280 292
Note: See TracChangeset
for help on using the changeset viewer.