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

Function MSG_GetSpace

code/qcommon/msg.cpp:65–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void *MSG_GetSpace( msg_t *buf, int length ) {
66 void *data;
67
68 // round up to the next byte
69 if ( buf->bit ) {
70 buf->bit = 0;
71 buf->cursize++;
72 }
73
74 if ( buf->cursize + length > buf->maxsize ) {
75 if ( !buf->allowoverflow ) {
76 Com_Error (ERR_FATAL, "MSG_GetSpace: overflow without allowoverflow set");
77 }
78 if ( length > buf->maxsize ) {
79 Com_Error (ERR_FATAL, "MSG_GetSpace: %i is > full buffer size", length);
80 }
81 Com_Printf ("MSG_GetSpace: overflow\n");
82 MSG_Clear (buf);
83 buf->overflowed = qtrue;
84 }
85
86 data = buf->data + buf->cursize;
87 buf->cursize += length;
88
89 return data;
90}
91
92void MSG_WriteData( msg_t *buf, const void *data, int length ) {
93 memcpy (MSG_GetSpace(buf,length),data,length);

Callers 1

MSG_WriteDataFunction · 0.85

Calls 3

Com_ErrorFunction · 0.70
Com_PrintfFunction · 0.70
MSG_ClearFunction · 0.70

Tested by

no test coverage detected