Changeset 6285 in orxonox.OLD for branches/network/src/lib/network/converter.cc
- Timestamp:
- Dec 25, 2005, 4:24:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/network/converter.cc
r6275 r6285 453 453 return n+length; 454 454 } 455 456 /** 457 * reads a string out of a byte array and allocates memory for string 458 * @param a: byte array 459 * @param s: string 460 * @param maxLength: max bytes to copy 461 * @return: the number of read bytes in byte array 462 */ 463 int Converter::byteArrayToStringM( const byte * a, char * & s ) 464 { 465 int length; 466 467 int n = Converter::byteArrayToInt( a, &length ); 468 469 s = new char[n+1]; 470 471 if ( !s ) 472 { 473 PRINTF(1)("Could not allocate memory!\n" ); 474 return -1; 475 } 476 477 memcpy( s, a+n, length ); 478 s[length] = '\0'; 479 480 return n+length; 481 } 482
Note: See TracChangeset
for help on using the changeset viewer.