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

Function MSG_WriteString

code/qcommon/msg.cpp:250–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void MSG_WriteString( msg_t *sb, const char *s ) {
251 if ( !s ) {
252 MSG_WriteData (sb, "", 1);
253 } else {
254 int l, i;
255 char string[MAX_STRING_CHARS];
256
257 l = strlen( s );
258 if ( l >= MAX_STRING_CHARS ) {
259 Com_Printf( "MSG_WriteString: MAX_STRING_CHARS" );
260 MSG_WriteData (sb, "", 1);
261 return;
262 }
263 Q_strncpyz( string, s, sizeof( string ) );
264
265 // get rid of 0xff chars, because old clients don't like them
266 for ( i = 0 ; i < l ; i++ ) {
267 if ( ((byte *)string)[i] > 127 ) {
268 string[i] = '.';
269 }
270 }
271
272 MSG_WriteData (sb, string, l+1);
273 }
274}
275
276
277

Callers 3

CL_WritePacketFunction · 0.50
SV_SendClientGameStateFunction · 0.50

Calls 3

Q_strncpyzFunction · 0.85
MSG_WriteDataFunction · 0.70
Com_PrintfFunction · 0.70

Tested by

no test coverage detected