31 if (valuesize < 1 || !
value)
33 Con_Printf(
"InfoString_GetValue: no room in value\n");
37 if (strchr(key,
'\\'))
39 Con_Printf(
"InfoString_GetValue: key name \"%s\" contains \\ which is not possible in an infostring\n", key);
42 if (strchr(key,
'\"'))
44 Con_Printf(
"InfoString_SetValue: key name \"%s\" contains \" which is not allowed in an infostring\n", key);
49 Con_Printf(
"InfoString_GetValue: can not look up a key with no name\n");
52 while (
buffer[pos] ==
'\\')
54 if (!memcmp(
buffer + pos+1, key, keylength) &&
55 (
buffer[pos+1 + keylength] == 0 ||
56 buffer[pos+1 + keylength] ==
'\\'))
59 if (
buffer[pos] ==
'\\') pos++;
60 for (j = 0;
buffer[pos+j] &&
buffer[pos+j] !=
'\\' && j < valuesize - 1;j++)
65 if (
buffer[pos] ==
'\\') pos++;
67 if (
buffer[pos] ==
'\\') pos++;
83 if (strchr(key,
'\\') || strchr(
value,
'\\'))
85 Con_Printf(
"InfoString_SetValue: \"%s\" \"%s\" contains \\ which is not possible to store in an infostring\n", key,
value);
88 if (strchr(key,
'\"') || strchr(
value,
'\"'))
90 Con_Printf(
"InfoString_SetValue: \"%s\" \"%s\" contains \" which is not allowed in an infostring\n", key,
value);
95 Con_Printf(
"InfoString_SetValue: can not set a key with no name\n");
98 while (
buffer[pos] ==
'\\')
100 if (!memcmp(
buffer + pos+1, key, keylength) &&
101 (
buffer[pos+1 + keylength] == 0 ||
102 buffer[pos+1 + keylength] ==
'\\'))
104 if (
buffer[pos] ==
'\\') pos++;
106 if (
buffer[pos] ==
'\\') pos++;
113 pos2 += 1 + (
int)keylength;
114 if (
buffer[pos2] ==
'\\') pos2++;
119 Con_Printf(
"InfoString_SetValue: no room for \"%s\" \"%s\" in infostring\n", key,
value);
145 Con_Printf(
"InfoString_Print: corrupt string\n");
149 if (
i < (
int)
sizeof(key)-1)
154 Con_Printf(
"InfoString_Print: corrupt string\n");
158 if (
i < (
int)
sizeof(
value)-1)
void InfoString_SetValue(char *buffer, size_t bufferlength, const char *key, const char *value)
size_t InfoString_GetValue(const char *buffer, const char *key, char *value, size_t valuesize)
Returns the number of bytes written to *value excluding the \0 terminator.
void InfoString_Print(char *buffer)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcpy(dst, src, dsize)
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
static int(ZEXPORT *qz_inflate)(z_stream *strm
GLsizei const GLfloat * value
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers