DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
common.h
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3Copyright (C) 2000-2020 DarkPlaces contributors
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14See the GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20*/
21
22#ifndef COMMON_H
23#define COMMON_H
24
25#include <stdarg.h>
26#include <assert.h>
27#include "qtypes.h"
28#include "qdefs.h"
29
31#ifdef WIN32
32# define strcasecmp _stricmp
33# define strncasecmp _strnicmp
34#else
35#include "strings.h"
36#endif
37
38// Create our own define for Mac OS X
39#if defined(__APPLE__) && defined(__MACH__)
40# define MACOSX
41#endif
42
43
44//============================================================================
45
46#define ContainerOf(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
47
48typedef struct sizebuf_s
49{
52 unsigned char *data;
56 qbool badread; // set if a read goes beyond end of message
57} sizebuf_t;
58
59void SZ_Clear (sizebuf_t *buf);
60unsigned char *SZ_GetSpace (sizebuf_t *buf, int length);
61void SZ_Write (sizebuf_t *buf, const unsigned char *data, int length);
63
64void Com_HexDumpToConsole(const unsigned char *data, int size);
65
66unsigned short CRC_Block(const unsigned char *data, size_t size);
67unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size); // for hash lookup functions that use strcasecmp for comparison
68
69unsigned char COM_BlockSequenceCRCByteQW(unsigned char *base, int length, int sequence);
70
71// these are actually md4sum (mdfour.c)
72unsigned Com_BlockChecksum (void *buffer, int length);
73void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
74
75void COM_Init_Commands(void);
76
77
78//============================================================================
79// Endianess handling
80//============================================================================
81
82// check mem_bigendian if you need to know the system byte order
83
88// unaligned memory access crashes on some platform, so always read bytes...
89#define BigShort(l) BuffBigShort((unsigned char *)&(l))
90#define LittleShort(l) BuffLittleShort((unsigned char *)&(l))
91#define BigLong(l) BuffBigLong((unsigned char *)&(l))
92#define LittleLong(l) BuffLittleLong((unsigned char *)&(l))
93#define BigFloat(l) BuffBigFloat((unsigned char *)&(l))
94#define LittleFloat(l) BuffLittleFloat((unsigned char *)&(l))
95
97float BuffBigFloat (const unsigned char *buffer);
98
100int BuffBigLong (const unsigned char *buffer);
101
103short BuffBigShort (const unsigned char *buffer);
104
106float BuffLittleFloat (const unsigned char *buffer);
107
109int BuffLittleLong (const unsigned char *buffer);
110
112short BuffLittleShort (const unsigned char *buffer);
113
115void StoreBigLong (unsigned char *buffer, unsigned int i);
116
118void StoreBigShort (unsigned char *buffer, unsigned short i);
119
121void StoreLittleLong (unsigned char *buffer, unsigned int i);
122
124void StoreLittleShort (unsigned char *buffer, unsigned short i);
126
127//============================================================================
128
129// these versions are purely for internal use, never sent in network protocol
130// (use Protocol_EnumForNumber and Protocol_NumberToEnum to convert)
151
157void MSG_InitReadBuffer (sizebuf_t *buf, unsigned char *data, int size);
158void MSG_WriteChar (sizebuf_t *sb, int c);
159void MSG_WriteByte (sizebuf_t *sb, int c);
160void MSG_WriteShort (sizebuf_t *sb, int c);
161void MSG_WriteLong (sizebuf_t *sb, int c);
162void MSG_WriteFloat (sizebuf_t *sb, vec_t f);
163void MSG_WriteString (sizebuf_t *sb, const char *s);
164void MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s);
171void MSG_WriteCoord (sizebuf_t *sb, vec_t f, protocolversion_t protocol);
172void MSG_WriteVector (sizebuf_t *sb, const vec3_t v, protocolversion_t protocol);
173void MSG_WriteAngle (sizebuf_t *sb, vec_t f, protocolversion_t protocol);
174
175void MSG_BeginReading (sizebuf_t *sb);
179int MSG_ReadBigLong (sizebuf_t *sb);
181float MSG_ReadBigFloat (sizebuf_t *sb);
182char *MSG_ReadString (sizebuf_t *sb, char *string, size_t maxstring);
184size_t MSG_ReadString_len (sizebuf_t *sb, char *string, size_t maxstring);
185size_t MSG_ReadBytes (sizebuf_t *sb, size_t numbytes, unsigned char *out);
186
187#define MSG_ReadChar(sb) ((sb)->readcount >= (sb)->cursize ? ((sb)->badread = true, -1) : (signed char)(sb)->data[(sb)->readcount++])
188#define MSG_ReadByte(sb) ((sb)->readcount >= (sb)->cursize ? ((sb)->badread = true, -1) : (unsigned char)(sb)->data[(sb)->readcount++])
190#define MSG_ReadByte_opt(sb) ((sb)->readcount >= (sb)->cursize ? ((sb)->badread = true, '\0') : (unsigned char)(sb)->data[(sb)->readcount++])
191#define MSG_ReadShort MSG_ReadLittleShort
192#define MSG_ReadLong MSG_ReadLittleLong
193#define MSG_ReadFloat MSG_ReadLittleFloat
194
195float MSG_ReadAngle8i (sizebuf_t *sb);
196float MSG_ReadAngle16i (sizebuf_t *sb);
197float MSG_ReadAngle32f (sizebuf_t *sb);
198float MSG_ReadCoord13i (sizebuf_t *sb);
199float MSG_ReadCoord16i (sizebuf_t *sb);
200float MSG_ReadCoord32f (sizebuf_t *sb);
201float MSG_ReadCoord (sizebuf_t *sb, protocolversion_t protocol);
203float MSG_ReadAngle (sizebuf_t *sb, protocolversion_t protocol);
205//============================================================================
206
207typedef float (*COM_WordWidthFunc_t) (void *passthrough, const char *w, size_t *length, float maxWidth); // length is updated to the longest fitting string into maxWidth; if maxWidth < 0, all characters are used and length is used as is
208typedef int (*COM_LineProcessorFunc) (void *passthrough, const char *line, size_t length, float width, qbool isContination);
209int COM_Wordwrap(const char *string, size_t length, float continuationSize, float maxWidth, COM_WordWidthFunc_t wordWidth, void *passthroughCW, COM_LineProcessorFunc processLine, void *passthroughPL);
210
211extern char com_token[MAX_INPUTLINE];
212extern unsigned com_token_len;
213qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments);
214qbool COM_ParseToken_QuakeC(const char **datapointer, qbool returnnewline);
215qbool COM_ParseToken_VM_Tokenize(const char **datapointer, qbool returnnewline);
216qbool COM_ParseToken_Console(const char **datapointer);
217
218void COM_Init (void);
219void COM_Shutdown (void);
220
221char *va(char *buf, size_t buflen, const char *format, ...) DP_FUNC_PRINTF(3);
222// does a varargs printf into provided buffer, returns buffer (so it can be called in-line unlike dpsnprintf)
223
224/* Some versions of GCC with -Wc++-compat will complain if static_assert
225 * is used even though the macro is valid C11, so make it happy anyway
226 * because having build logs without any purple text is pretty satisfying.
227 * TODO: Disable the flag by default in makefile, with an optional variable
228 * to reenable it.
229 */
230#ifndef __cplusplus
231#define DP_STATIC_ASSERT(expr, str) _Static_assert(expr, str)
232#else
233#define DP_STATIC_ASSERT(expr, str) static_assert(expr, str)
234#endif
235
236// snprintf and vsnprintf are NOT portable. Use their DP counterparts instead
237#undef snprintf
238#define snprintf DP_STATIC_ASSERT(0, "snprintf is forbidden for portability reasons. Use dpsnprintf instead.")
239#undef vsnprintf
240#define vsnprintf DP_STATIC_ASSERT(0, "vsnprintf is forbidden for portability reasons. Use dpvsnprintf instead.")
241
242// documentation duplicated deliberately for the benefit of IDEs that support https://www.doxygen.nl/manual/docblocks.html
246extern int dpsnprintf (char *buffer, size_t buffersize, const char *format, ...) DP_FUNC_PRINTF(3);
250extern int dpvsnprintf (char *buffer, size_t buffersize, const char *format, va_list args);
251
252// A bunch of functions are forbidden for security reasons (and also to please MSVS 2005, for some of them)
253// LadyHavoc: added #undef lines here to avoid warnings in Linux
254#undef strcat
255#define strcat DP_STATIC_ASSERT(0, "strcat is forbidden for security reasons. Use dp_strlcat or memcpy instead.")
256#undef strncat
257#define strncat DP_STATIC_ASSERT(0, "strncat is forbidden for security reasons. Use dp_strlcat or memcpy instead.")
258#undef strcpy
259#define strcpy DP_STATIC_ASSERT(0, "strcpy is forbidden for security reasons. Use dp_strlcpy or memcpy instead.")
260#undef strncpy
261#define strncpy DP_STATIC_ASSERT(0, "strncpy is forbidden for security reasons. Use dp_strlcpy or memcpy instead.")
262#undef stpcpy
263#define stpcpy DP_STATIC_ASSERT(0, "stpcpy is forbidden for security reasons. Use dp_stpecpy or memcpy instead.")
264#undef ustpcpy
265#define ustpcpy DP_STATIC_ASSERT(0, "ustpcpy is forbidden for security reasons. Use dp_ustr2stp or memcpy instead.")
266#undef ustr2stp
267#define ustr2stp DP_STATIC_ASSERT(0, "ustr2stp is forbidden for security reasons. Use dp_ustr2stp or memcpy instead.")
268#undef sprintf
269#define sprintf DP_STATIC_ASSERT(0, "sprintf is forbidden for security reasons. Use dpsnprintf instead.")
270
271#undef strlcpy
272#define strlcpy DP_STATIC_ASSERT(0, "strlcpy is forbidden for stability and correctness. See common.h and common.c comments.")
273#undef strlcat
274#define strlcat DP_STATIC_ASSERT(0, "strlcat is forbidden for stability and correctness. See common.h and common.c comments.")
275
276
277//============================================================================
278
279extern struct cvar_s registered;
280extern struct cvar_s cmdline;
281
282typedef enum userdirmode_e
283{
284 USERDIRMODE_NOHOME, // basedir only
285 USERDIRMODE_HOME, // Windows basedir, general POSIX (~/.)
286 USERDIRMODE_MYGAMES, // pre-Vista (My Documents/My Games/), general POSIX (~/.)
287 USERDIRMODE_SAVEDGAMES, // Vista (%USERPROFILE%/Saved Games/), OSX (~/Library/Application Support/), Linux (~/.config)
291
293size_t COM_ToLowerString(const char *in, char *out, size_t size_out);
295size_t COM_ToUpperString(const char *in, char *out, size_t size_out);
296int COM_StringBeginsWith(const char *s, const char *match);
297int COM_ReadAndTokenizeLine(const char **text, char **argv, int maxargc, char *tokenbuf, int tokenbufsize, const char *commentprefix);
298size_t COM_StringLengthNoColors(const char *s, size_t size_s, qbool *valid);
299size_t COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out, qbool escape_carets);
300
301
302
303#define dp_strlcpy(dst, src, dsize) dp__strlcpy(dst, src, dsize, __func__, __LINE__)
304#define dp_strlcat(dst, src, dsize) dp__strlcat(dst, src, dsize, __func__, __LINE__)
305size_t dp__strlcpy(char *dst, const char *src, size_t dsize, const char *func, unsigned line);
306size_t dp__strlcat(char *dst, const char *src, size_t dsize, const char *func, unsigned line);
307char *dp_stpecpy(char *dst, char *end, const char *src);
308char *dp_ustr2stp(char *dst, size_t dsize, const char *src, size_t slen);
309
310
311void FindFraction(double val, int *num, int *denom, int denomMax);
312
313// decodes XPM file to XPM array (as if #include'd)
314char **XPM_DecodeString(const char *in);
315
316size_t base64_encode(unsigned char *buf, size_t buflen, size_t outbuflen);
317
318#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
319
320float Com_CalcRoll (const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval);
321
322#endif
323
void MSG_BeginReading(sizebuf_t *sb)
Definition com_msg.c:257
int MSG_ReadBigShort(sizebuf_t *sb)
Definition com_msg.c:274
char * MSG_ReadString(sizebuf_t *sb, char *string, size_t maxstring)
Definition com_msg.c:341
void SZ_Clear(sizebuf_t *buf)
Definition common.c:44
void StoreBigShort(unsigned char *buffer, unsigned short i)
Encode a big endian 16bit int to the given buffer.
Definition com_msg.c:89
char * va(char *buf, size_t buflen, const char *format,...) DP_FUNC_PRINTF(3)
Definition common.c:972
void MSG_WriteCoord(sizebuf_t *sb, vec_t f, protocolversion_t protocol)
Definition com_msg.c:202
int dpvsnprintf(char *buffer, size_t buffersize, const char *format, va_list args)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:1010
unsigned com_token_len
Definition common.c:40
float BuffLittleFloat(const unsigned char *buffer)
Extract a little endian 32bit float from the given buffer.
Definition com_msg.c:59
float MSG_ReadAngle(sizebuf_t *sb, protocolversion_t protocol)
Definition com_msg.c:424
void MSG_WriteShort(sizebuf_t *sb, int c)
Definition com_msg.c:138
char * dp_ustr2stp(char *dst, size_t dsize, const char *src, size_t slen)
Copies a measured byte sequence (unterminated string) to a null-terminated string.
Definition common.c:1388
void MSG_ReadVector(sizebuf_t *sb, vec3_t v, protocolversion_t protocol)
Definition com_msg.c:401
void MSG_WriteFloat(sizebuf_t *sb, vec_t f)
Definition com_msg.c:158
size_t dp__strlcpy(char *dst, const char *src, size_t dsize, const char *func, unsigned line)
Copies a string, like strlcpy() but with a better return: the number of bytes copied excluding the \0...
Definition common.c:1406
int COM_StringBeginsWith(const char *s, const char *match)
Definition common.c:1123
void Com_BlockFullChecksum(void *buffer, int len, unsigned char *outbuf)
Definition mdfour.c:210
unsigned char * SZ_GetSpace(sizebuf_t *buf, int length)
Definition common.c:49
unsigned Com_BlockChecksum(void *buffer, int length)
Definition mdfour.c:198
float MSG_ReadAngle32f(sizebuf_t *sb)
Definition com_msg.c:419
struct cvar_s cmdline
Definition common.c:33
protocolversion_t
Definition common.h:132
@ PROTOCOL_DARKPLACES2
various changes
Definition common.h:140
@ PROTOCOL_DARKPLACES4
various changes
Definition common.h:138
@ PROTOCOL_NEHAHRABJP2
same as NEHAHRABJP but with 16bit soundindex
Definition common.h:147
@ PROTOCOL_DARKPLACES3
uses EntityFrame4 entity snapshot encoder/decoder which is broken, this attempted to do partial snaps...
Definition common.h:139
@ PROTOCOL_NEHAHRABJP
same as QUAKEDP but with 16bit modelindex
Definition common.h:146
@ PROTOCOL_DARKPLACES5
uses EntityFrame5 entity snapshot encoder/decoder which is based on a Tribes networking article at ht...
Definition common.h:137
@ PROTOCOL_DARKPLACES7
added QuakeWorld-style movement protocol to allow more consistent prediction
Definition common.h:135
@ PROTOCOL_QUAKEDP
darkplaces extended quake protocol (used by TomazQuake and others), backwards compatible as long as n...
Definition common.h:142
@ PROTOCOL_UNKNOWN
Definition common.h:133
@ PROTOCOL_DARKPLACES6
various changes
Definition common.h:136
@ PROTOCOL_QUAKE
quake (aka netquake/normalquake/nq) protocol
Definition common.h:144
@ PROTOCOL_DARKPLACES8
added parting messages. WIP
Definition common.h:134
@ PROTOCOL_NEHAHRABJP3
same as NEHAHRABJP2 but with some changes
Definition common.h:148
@ PROTOCOL_NEHAHRAMOVIE
Nehahra movie protocol, a big nasty hack dating back to early days of the Quake Standards Group (but ...
Definition common.h:143
@ PROTOCOL_QUAKEWORLD
quakeworld protocol
Definition common.h:145
@ PROTOCOL_DARKPLACES1
uses EntityFrame entity snapshot encoder/decoder which is a QuakeWorld-like entity snapshot delta com...
Definition common.h:141
void MSG_WriteString(sizebuf_t *sb, const char *s)
Definition com_msg.c:173
char com_token[MAX_INPUTLINE]
Definition common.c:39
float MSG_ReadCoord32f(sizebuf_t *sb)
Definition com_msg.c:384
void StoreLittleShort(unsigned char *buffer, unsigned short i)
Encode a little endian 16bit int to the given buffer.
Definition com_msg.c:103
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...) DP_FUNC_PRINTF(3)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
Definition common.c:997
float MSG_ReadLittleFloat(sizebuf_t *sb)
Definition com_msg.c:307
size_t MSG_ReadBytes(sizebuf_t *sb, size_t numbytes, unsigned char *out)
Definition com_msg.c:364
qbool COM_ParseToken_QuakeC(const char **datapointer, qbool returnnewline)
Definition common.c:581
short BuffLittleShort(const unsigned char *buffer)
Extract a little endian 16bit short from the given buffer.
Definition com_msg.c:76
void MSG_WriteLong(sizebuf_t *sb, int c)
Definition com_msg.c:147
struct cvar_s registered
Definition common.c:32
char * dp_stpecpy(char *dst, char *end, const char *src)
Chain-copies a string with truncation and efficiency (compared to strlcat()).
Definition common.c:1373
userdirmode_t
Definition common.h:283
@ USERDIRMODE_SAVEDGAMES
Definition common.h:287
@ USERDIRMODE_NOHOME
Definition common.h:284
@ USERDIRMODE_COUNT
Definition common.h:288
@ USERDIRMODE_MYGAMES
Definition common.h:286
@ USERDIRMODE_HOME
Definition common.h:285
int MSG_ReadBigLong(sizebuf_t *sb)
Definition com_msg.c:296
void MSG_InitReadBuffer(sizebuf_t *buf, unsigned char *data, int size)
Definition com_msg.c:249
int(* COM_LineProcessorFunc)(void *passthrough, const char *line, size_t length, float width, qbool isContination)
Definition common.h:208
float(* COM_WordWidthFunc_t)(void *passthrough, const char *w, size_t *length, float maxWidth)
Definition common.h:207
char ** XPM_DecodeString(const char *in)
Definition common.c:1459
float MSG_ReadCoord13i(sizebuf_t *sb)
Definition com_msg.c:374
float MSG_ReadAngle8i(sizebuf_t *sb)
Definition com_msg.c:409
size_t COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out, qbool escape_carets)
Definition common.c:1286
float MSG_ReadAngle16i(sizebuf_t *sb)
Definition com_msg.c:414
void COM_Init(void)
void MSG_WriteAngle8i(sizebuf_t *sb, vec_t f)
Definition com_msg.c:222
qbool COM_ParseToken_VM_Tokenize(const char **datapointer, qbool returnnewline)
Definition common.c:700
qbool COM_ParseToken_Console(const char **datapointer)
Definition common.c:819
void MSG_WriteByte(sizebuf_t *sb, int c)
Definition com_msg.c:130
void MSG_WriteAngle32f(sizebuf_t *sb, vec_t f)
Definition com_msg.c:232
void MSG_WriteVector(sizebuf_t *sb, const vec3_t v, protocolversion_t protocol)
Definition com_msg.c:214
void MSG_WriteCoord32f(sizebuf_t *sb, vec_t f)
Definition com_msg.c:197
float Com_CalcRoll(const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval)
Definition common.c:890
size_t COM_ToUpperString(const char *in, char *out, size_t size_out)
Returns the number of bytes written to *out excluding the \0 terminator.
Definition common.c:1087
float BuffBigFloat(const unsigned char *buffer)
Extract a big endian 32bit float from the given buffer.
Definition com_msg.c:37
float MSG_ReadBigFloat(sizebuf_t *sb)
Definition com_msg.c:324
int BuffLittleLong(const unsigned char *buffer)
Extract a little endian 32bit int from the given buffer.
Definition com_msg.c:71
float MSG_ReadCoord(sizebuf_t *sb, protocolversion_t protocol)
Definition com_msg.c:389
void MSG_WriteUnterminatedString(sizebuf_t *sb, const char *s)
Definition com_msg.c:181
void Com_HexDumpToConsole(const unsigned char *data, int size)
Definition common.c:82
int MSG_ReadLittleLong(sizebuf_t *sb)
Definition com_msg.c:285
void SZ_HexDumpToConsole(const sizebuf_t *buf)
Definition common.c:148
void MSG_WriteCoord16i(sizebuf_t *sb, vec_t f)
Definition com_msg.c:192
int COM_Wordwrap(const char *string, size_t length, float continuationSize, float maxWidth, COM_WordWidthFunc_t wordWidth, void *passthroughCW, COM_LineProcessorFunc processLine, void *passthroughPL)
Definition common.c:174
void FindFraction(double val, int *num, int *denom, int denomMax)
Definition common.c:1436
float MSG_ReadCoord16i(sizebuf_t *sb)
Definition com_msg.c:379
int MSG_ReadLittleShort(sizebuf_t *sb)
Definition com_msg.c:263
void MSG_WriteAngle(sizebuf_t *sb, vec_t f, protocolversion_t protocol)
Definition com_msg.c:237
short BuffBigShort(const unsigned char *buffer)
Extract a big endian 16bit short from the given buffer.
Definition com_msg.c:54
void MSG_WriteCoord13i(sizebuf_t *sb, vec_t f)
Definition com_msg.c:187
unsigned short CRC_Block(const unsigned char *data, size_t size)
Definition com_crc16.c:75
size_t MSG_ReadString_len(sizebuf_t *sb, char *string, size_t maxstring)
Same as MSG_ReadString except it returns the number of bytes written to *string excluding the \0 term...
Definition com_msg.c:352
unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size)
Definition com_crc16.c:83
void StoreLittleLong(unsigned char *buffer, unsigned int i)
Encode a little endian 32bit int to the given buffer.
Definition com_msg.c:95
void MSG_WriteChar(sizebuf_t *sb, int c)
Definition com_msg.c:122
size_t COM_StringLengthNoColors(const char *s, size_t size_s, qbool *valid)
Definition common.c:1212
void StoreBigLong(unsigned char *buffer, unsigned int i)
Encode a big endian 32bit int to the given buffer.
Definition com_msg.c:81
qbool COM_ParseToken_Simple(const char **datapointer, qbool returnnewline, qbool parsebackslash, qbool parsecomments)
Definition common.c:463
int BuffBigLong(const unsigned char *buffer)
Extract a big endian 32bit int from the given buffer.
Definition com_msg.c:49
unsigned char COM_BlockSequenceCRCByteQW(unsigned char *base, int length, int sequence)
Definition com_crc16.c:132
void COM_Init_Commands(void)
Definition common.c:917
int COM_ReadAndTokenizeLine(const char **text, char **argv, int maxargc, char *tokenbuf, int tokenbufsize, const char *commentprefix)
Definition common.c:1131
void SZ_Write(sizebuf_t *buf, const unsigned char *data, int length)
Definition common.c:72
void COM_Shutdown(void)
void MSG_WriteAngle16i(sizebuf_t *sb, vec_t f)
Definition com_msg.c:227
size_t base64_encode(unsigned char *buf, size_t buflen, size_t outbuflen)
Definition common.c:1502
size_t COM_ToLowerString(const char *in, char *out, size_t size_out)
Returns the number of bytes written to *out excluding the \0 terminator.
Definition common.c:1051
size_t dp__strlcat(char *dst, const char *src, size_t dsize, const char *func, unsigned line)
Catenates a string, like strlcat() but with a better return: the number of bytes copied excluding the...
Definition common.c:1423
vector size
vector velocity
vector angles
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLenum GLsizei width
Definition glquake.h:622
GLubyte GLubyte GLubyte GLubyte w
Definition glquake.h:782
GLuint buffer
Definition glquake.h:630
GLenum GLuint GLenum GLsizei length
Definition glquake.h:657
const GLdouble * v
Definition glquake.h:762
GLint GLint GLint GLsizei GLsizei GLenum format
Definition glquake.h:649
GLsizeiptr const GLvoid * data
Definition glquake.h:639
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition glquake.h:657
string argv(float n)
prvm_eval_t * src
int i
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
Definition qdefs.h:94
#define DP_FUNC_PRINTF(n)
Definition qdefs.h:14
float vec_t
Definition qtypes.h:68
vec_t vec3_t[3]
Definition qtypes.h:71
bool qbool
Definition qtypes.h:9
precision highp float
Definition shader_glsl.h:53
float f
unsigned char * data
Definition common.h:52
int cursize
Definition common.h:54
qbool overflowed
set to true if the buffer size failed
Definition common.h:51
qbool badread
Definition common.h:56
qbool allowoverflow
if false, do a Sys_Error
Definition common.h:50
int readcount
Definition common.h:55
int maxsize
Definition common.h:53