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

Function MSG_ReadString

code/qcommon/msg.cpp:333–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333char *MSG_ReadString( msg_t *msg ) {
334 static const int STRING_SIZE = MAX_STRING_CHARS;
335 static char string[STRING_SIZE];
336 int l,c;
337
338 MSG_ReadByteAlign( msg );
339 l = 0;
340 do {
341 c = MSG_ReadByte(msg); // use ReadByte so -1 is out of bounds
342 if ( c == -1 || c == 0 ) {
343 break;
344 }
345 // translate all fmt spec to avoid crash bugs
346 if ( c == '%' ) {
347 c = '.';
348 }
349
350 string[l] = c;
351 l++;
352 } while (l < STRING_SIZE - 1);
353
354 string[l] = 0;
355
356 return string;
357}
358
359char *MSG_ReadStringLine( msg_t *msg ) {
360 static const int STRING_SIZE = MAX_STRING_CHARS;

Callers 4

CL_ParseGamestateFunction · 0.50
CL_ParseCommandStringFunction · 0.50
CL_ConnectionlessPacketFunction · 0.50
SV_ClientCommandFunction · 0.50

Calls 2

MSG_ReadByteAlignFunction · 0.85
MSG_ReadByteFunction · 0.70

Tested by

no test coverage detected