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

Function MSG_ReadStringLine

code/qcommon/msg.cpp:359–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359char *MSG_ReadStringLine( msg_t *msg ) {
360 static const int STRING_SIZE = MAX_STRING_CHARS;
361 static char string[STRING_SIZE];
362 int l,c;
363
364 MSG_ReadByteAlign( msg );
365 l = 0;
366 do {
367 c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds
368 if (c == -1 || c == 0 || c == '\n') {
369 break;
370 }
371 // translate all fmt spec to avoid crash bugs
372 if ( c == '%' ) {
373 c = '.';
374 }
375 string[l] = c;
376 l++;
377 } while (l < STRING_SIZE - 1);
378
379 string[l] = 0;
380
381 return string;
382}
383
384
385void MSG_ReadData( msg_t *msg, void *data, int len ) {

Callers 2

CL_ConnectionlessPacketFunction · 0.50
SV_ConnectionlessPacketFunction · 0.50

Calls 2

MSG_ReadByteAlignFunction · 0.85
MSG_ReadByteFunction · 0.70

Tested by

no test coverage detected