MCPcopy Create free account
hub / github.com/JACoders/OpenJK / MSG_ReadString

Function MSG_ReadString

codemp/qcommon/msg.cpp:460–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460char *MSG_ReadString( msg_t *msg ) {
461 static char string[MAX_STRING_CHARS];
462 int c;
463 unsigned int l;
464
465 l = 0;
466 do {
467 c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds
468 if ( c == -1 || c == 0 ) {
469 break;
470 }
471 // translate all fmt spec to avoid crash bugs
472 if ( c == '%' ) {
473 c = '.';
474 }
475// eurofix: remove this so we can chat in european languages... -ste
476//
477// // don't allow higher ascii values
478// if ( c > 127 ) {
479// c = '.';
480// }
481
482 string[l] = c;
483 l++;
484 } while (l <= sizeof(string)-1);
485
486 // some bonus protection, shouldn't occur cause server doesn't write such things
487 if (l <= sizeof(string)-1)
488 {
489 string[l] = 0;
490 }
491 else
492 {
493 string[sizeof(string)-1] = 0;
494 }
495
496 return string;
497}
498
499char *MSG_ReadBigString( msg_t *msg ) {
500 static char string[BIG_INFO_STRING];

Callers 5

CL_ParseDownloadFunction · 0.50
CL_ParseCommandStringFunction · 0.50
CL_ConnectionlessPacketFunction · 0.50
CL_ServerInfoPacketFunction · 0.50
SV_ClientCommandFunction · 0.50

Calls 1

MSG_ReadByteFunction · 0.70

Tested by

no test coverage detected