| 248 | } |
| 249 | |
| 250 | void 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 |
no test coverage detected