summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
committerTim Angus <tim@ngus.net>2016-04-09 17:57:28 +0100
commitf45fbef604e05144057dec8d1dbfc5d4f5a2a822 (patch)
tree152d2a428b078f7a89756ea9e156695fc69f1686 /src/qcommon
parent7f9e97d611b4b267d9dd913144cb9632f96c90c2 (diff)
parent87abdd914988724e164ffb16380ad26be8420b84 (diff)
Merge branch 'master' into gpp
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/cm_patch.c16
-rw-r--r--src/qcommon/cmd.c8
-rw-r--r--src/qcommon/common.c174
-rw-r--r--src/qcommon/cvar.c3
-rw-r--r--src/qcommon/files.c9
-rw-r--r--src/qcommon/json.h353
-rw-r--r--src/qcommon/q_platform.h39
-rw-r--r--src/qcommon/q_shared.c2
-rw-r--r--src/qcommon/qcommon.h11
-rw-r--r--src/qcommon/vm_x86.c20
10 files changed, 586 insertions, 49 deletions
diff --git a/src/qcommon/cm_patch.c b/src/qcommon/cm_patch.c
index 5a66b1b0..5f55e9d4 100644
--- a/src/qcommon/cm_patch.c
+++ b/src/qcommon/cm_patch.c
@@ -419,7 +419,7 @@ static int numPlanes;
static patchPlane_t planes[MAX_PATCH_PLANES];
static int numFacets;
-static facet_t facets[MAX_PATCH_PLANES]; //maybe MAX_FACETS ??
+static facet_t facets[MAX_FACETS];
#define NORMAL_EPSILON 0.0001
#define DIST_EPSILON 0.02
@@ -877,7 +877,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}
if ( i == facet->numBorders ) {
- if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
+ if ( facet->numBorders >= 4 + 6 + 16 ) {
+ Com_Printf( "ERROR: too many bevels\n" );
+ continue;
+ }
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = flipped;
@@ -939,7 +942,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
}
if ( i == facet->numBorders ) {
- if (facet->numBorders > 4 + 6 + 16) Com_Printf("ERROR: too many bevels\n");
+ if ( facet->numBorders >= 4 + 6 + 16 ) {
+ Com_Printf( "ERROR: too many bevels\n" );
+ continue;
+ }
facet->borderPlanes[facet->numBorders] = CM_FindPlane2(plane, &flipped);
for ( k = 0 ; k < facet->numBorders ; k++ ) {
@@ -977,6 +983,10 @@ void CM_AddFacetBevels( facet_t *facet ) {
#ifndef BSPC
//add opposite plane
+ if ( facet->numBorders >= 4 + 6 + 16 ) {
+ Com_Printf( "ERROR: too many bevels\n" );
+ return;
+ }
facet->borderPlanes[facet->numBorders] = facet->surfacePlane;
facet->borderNoAdjust[facet->numBorders] = 0;
facet->borderInward[facet->numBorders] = qtrue;
diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c
index 44a6f0ea..48489eff 100644
--- a/src/qcommon/cmd.c
+++ b/src/qcommon/cmd.c
@@ -706,6 +706,7 @@ void Cmd_SetCommandCompletionFunc( const char *command, completionFunc_t complet
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
if( !Q_stricmp( command, cmd->name ) ) {
cmd->complete = complete;
+ return;
}
}
}
@@ -782,8 +783,11 @@ void Cmd_CompleteArgument( const char *command, char *args, int argNum ) {
cmd_function_t *cmd;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) {
- if( !Q_stricmp( command, cmd->name ) && cmd->complete ) {
- cmd->complete( args, argNum );
+ if( !Q_stricmp( command, cmd->name ) ) {
+ if ( cmd->complete ) {
+ cmd->complete( args, argNum );
+ }
+ return;
}
}
}
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index fef14331..11e723c1 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -3421,3 +3421,177 @@ qboolean Com_IsVoipTarget(uint8_t *voipTargets, int voipTargetsSize, int clientN
return qfalse;
}
+
+/*
+===============
+Field_CompletePlayerName
+===============
+*/
+static qboolean Field_CompletePlayerNameFinal( qboolean whitespace )
+{
+ int completionOffset;
+
+ if( matchCount == 0 )
+ return qtrue;
+
+ completionOffset = strlen( completionField->buffer ) - strlen( completionString );
+
+ Q_strncpyz( &completionField->buffer[ completionOffset ], shortestMatch,
+ sizeof( completionField->buffer ) - completionOffset );
+
+ completionField->cursor = strlen( completionField->buffer );
+
+ if( matchCount == 1 && whitespace )
+ {
+ Q_strcat( completionField->buffer, sizeof( completionField->buffer ), " " );
+ completionField->cursor++;
+ return qtrue;
+ }
+
+ return qfalse;
+}
+
+static void Name_PlayerNameCompletion( const char **names, int nameCount, void(*callback)(const char *s) )
+{
+ int i;
+
+ for( i = 0; i < nameCount; i++ ) {
+ callback( names[ i ] );
+ }
+}
+
+qboolean Com_FieldStringToPlayerName( char *name, int length, const char *rawname )
+{
+ char hex[5];
+ int i;
+ int ch;
+
+ if( name == NULL || rawname == NULL )
+ return qfalse;
+
+ if( length <= 0 )
+ return qtrue;
+
+ for( i = 0; *rawname && i + 1 <= length; rawname++, i++ ) {
+ if( *rawname == '\\' ) {
+ Q_strncpyz( hex, rawname + 1, sizeof(hex) );
+ ch = Com_HexStrToInt( hex );
+ if( ch > -1 ) {
+ name[i] = ch;
+ rawname += 4; //hex string length, 0xXX
+ } else {
+ name[i] = *rawname;
+ }
+ } else {
+ name[i] = *rawname;
+ }
+ }
+ name[i] = '\0';
+
+ return qtrue;
+}
+
+qboolean Com_PlayerNameToFieldString( char *str, int length, const char *name )
+{
+ const char *p;
+ int i;
+ int x1, x2;
+
+ if( str == NULL || name == NULL )
+ return qfalse;
+
+ if( length <= 0 )
+ return qtrue;
+
+ *str = '\0';
+ p = name;
+
+ for( i = 0; *p != '\0'; i++, p++ )
+ {
+ if( i + 1 >= length )
+ break;
+
+ if( *p <= ' ' )
+ {
+ if( i + 5 + 1 >= length )
+ break;
+
+ x1 = *p >> 4;
+ x2 = *p & 15;
+
+ str[i+0] = '\\';
+ str[i+1] = '0';
+ str[i+2] = 'x';
+ str[i+3] = x1 > 9 ? x1 - 10 + 'a' : x1 + '0';
+ str[i+4] = x2 > 9 ? x2 - 10 + 'a' : x2 + '0';
+
+ i += 4;
+ } else {
+ str[i] = *p;
+ }
+ }
+ str[i] = '\0';
+
+ return qtrue;
+}
+
+void Field_CompletePlayerName( char **names, int nameCount )
+{
+ qboolean whitespace;
+
+ matchCount = 0;
+ shortestMatch[ 0 ] = 0;
+
+ if( nameCount <= 0 )
+ return;
+
+ Name_PlayerNameCompletion( names, nameCount, FindMatches );
+
+ if( completionString[0] == '\0' )
+ {
+ Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ 0 ] );
+ }
+
+ //allow to tab player names
+ //if full player name switch to next player name
+ if( completionString[0] != '\0'
+ && Q_stricmp( shortestMatch, completionString ) == 0
+ && nameCount > 1 )
+ {
+ int i;
+
+ for( i = 0; i < nameCount; i++ ) {
+ if( Q_stricmp( names[ i ], completionString ) == 0 )
+ {
+ i++;
+ if( i >= nameCount )
+ {
+ i = 0;
+ }
+
+ Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ i ] );
+ break;
+ }
+ }
+ }
+
+ if( matchCount > 1 )
+ {
+ Com_Printf( "]%s\n", completionField->buffer );
+
+ Name_PlayerNameCompletion( names, nameCount, PrintMatches );
+ }
+
+ whitespace = nameCount == 1? qtrue: qfalse;
+ if( !Field_CompletePlayerNameFinal( whitespace ) )
+ {
+
+ }
+}
+
+int QDECL Com_strCompare( const void *a, const void *b )
+{
+ const char **pa = (const char **)a;
+ const char **pb = (const char **)b;
+ return strcmp( *pa, *pb );
+}
diff --git a/src/qcommon/cvar.c b/src/qcommon/cvar.c
index 336f45b0..d22679e8 100644
--- a/src/qcommon/cvar.c
+++ b/src/qcommon/cvar.c
@@ -1118,6 +1118,9 @@ cvar_t *Cvar_Unset(cvar_t *cv)
{
cvar_t *next = cv->next;
+ // note what types of cvars have been modified (userinfo, archive, serverinfo, systeminfo)
+ cvar_modifiedFlags |= cv->flags;
+
if(cv->name)
Z_Free(cv->name);
if(cv->string)
diff --git a/src/qcommon/files.c b/src/qcommon/files.c
index 0dd8e08a..c4c07242 100644
--- a/src/qcommon/files.c
+++ b/src/qcommon/files.c
@@ -511,7 +511,9 @@ qboolean FS_CreatePath (char *OSPath) {
// Skip creation of the root directory as it will always be there
ofs = strchr( path, PATH_SEP );
- ofs++;
+ if ( ofs != NULL ) {
+ ofs++;
+ }
for (; ofs != NULL && *ofs ; ofs++) {
if (*ofs == PATH_SEP) {
@@ -2453,9 +2455,8 @@ int FS_GetModList( char *listbuf, int bufsize ) {
pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue );
pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue );
- // we searched for mods in the three paths
- // it is likely that we have duplicate names now, which we will cleanup below
pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 );
+
nPotential = Sys_CountFileList(pFiles);
for ( i = 0 ; i < nPotential ; i++ ) {
@@ -2703,7 +2704,7 @@ void FS_Path_f( void ) {
searchpath_t *s;
int i;
- Com_Printf ("Current search path:\n");
+ Com_Printf ("We are looking in the current search path:\n");
for (s = fs_searchpaths; s; s = s->next) {
if (s->pack) {
Com_Printf ("%s (%i files)\n", s->pack->pakFilename, s->pack->numfiles);
diff --git a/src/qcommon/json.h b/src/qcommon/json.h
new file mode 100644
index 00000000..cfc5b3ca
--- /dev/null
+++ b/src/qcommon/json.h
@@ -0,0 +1,353 @@
+/*
+===========================================================================
+Copyright (C) 2016 James Canete
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+===========================================================================
+*/
+
+#ifndef JSON_H
+#define JSON_H
+
+enum
+{
+ JSONTYPE_STRING, // string
+ JSONTYPE_OBJECT, // object
+ JSONTYPE_ARRAY, // array
+ JSONTYPE_VALUE, // number, true, false, or null
+ JSONTYPE_ERROR // out of data
+};
+
+// --------------------------------------------------------------------------
+// Array Functions
+// --------------------------------------------------------------------------
+
+// Get pointer to first value in array
+// When given pointer to an array, returns pointer to the first
+// returns NULL if array is empty or not an array.
+const char *JSON_ArrayGetFirstValue(const char *json, const char *jsonEnd);
+
+// Get pointer to next value in array
+// When given pointer to a value, returns pointer to the next value
+// returns NULL when no next value.
+const char *JSON_ArrayGetNextValue(const char *json, const char *jsonEnd);
+
+// Get pointers to values in an array
+// returns 0 if not an array, array is empty, or out of data
+// returns number of values in the array and copies into index if successful
+unsigned int JSON_ArrayGetIndex(const char *json, const char *jsonEnd, const char **indexes, unsigned int numIndexes);
+
+// Get pointer to indexed value from array
+// returns NULL if not an array, no index, or out of data
+const char *JSON_ArrayGetValue(const char *json, const char *jsonEnd, unsigned int index);
+
+// --------------------------------------------------------------------------
+// Object Functions
+// --------------------------------------------------------------------------
+
+// Get pointer to named value from object
+// returns NULL if not an object, name not found, or out of data
+const char *JSON_ObjectGetNamedValue(const char *json, const char *jsonEnd, const char *name);
+
+// --------------------------------------------------------------------------
+// Value Functions
+// --------------------------------------------------------------------------
+
+// Get type of value
+// returns JSONTYPE_ERROR if out of data
+unsigned int JSON_ValueGetType(const char *json, const char *jsonEnd);
+
+// Get value as string
+// returns 0 if out of data
+// returns length and copies into string if successful, including terminating nul.
+// string values are stripped of enclosing quotes but not escaped
+unsigned int JSON_ValueGetString(const char *json, const char *jsonEnd, char *outString, unsigned int stringLen);
+
+// Get value as appropriate type
+// returns 0 if value is false, value is null, or out of data
+// returns 1 if value is true
+// returns value otherwise
+double JSON_ValueGetDouble(const char *json, const char *jsonEnd);
+float JSON_ValueGetFloat(const char *json, const char *jsonEnd);
+int JSON_ValueGetInt(const char *json, const char *jsonEnd);
+
+#endif
+
+#ifdef JSON_IMPLEMENTATION
+#include <stdio.h>
+
+// --------------------------------------------------------------------------
+// Internal Functions
+// --------------------------------------------------------------------------
+
+static const char *JSON_SkipSeparators(const char *json, const char *jsonEnd);
+static const char *JSON_SkipString(const char *json, const char *jsonEnd);
+static const char *JSON_SkipStruct(const char *json, const char *jsonEnd);
+static const char *JSON_SkipValue(const char *json, const char *jsonEnd);
+static const char *JSON_SkipValueAndSeparators(const char *json, const char *jsonEnd);
+
+#define IS_SEPARATOR(x) ((x) == ' ' || (x) == '\t' || (x) == '\n' || (x) == '\r' || (x) == ',' || (x) == ':')
+#define IS_STRUCT_OPEN(x) ((x) == '{' || (x) == '[')
+#define IS_STRUCT_CLOSE(x) ((x) == '}' || (x) == ']')
+
+static const char *JSON_SkipSeparators(const char *json, const char *jsonEnd)
+{
+ while (json < jsonEnd && IS_SEPARATOR(*json))
+ json++;
+
+ return json;
+}
+
+static const char *JSON_SkipString(const char *json, const char *jsonEnd)
+{
+ for (json++; json < jsonEnd && *json != '"'; json++)
+ if (*json == '\\')
+ json++;
+
+ return (json + 1 > jsonEnd) ? jsonEnd : json + 1;
+}
+
+static const char *JSON_SkipStruct(const char *json, const char *jsonEnd)
+{
+ json = JSON_SkipSeparators(json + 1, jsonEnd);
+ while (json < jsonEnd && !IS_STRUCT_CLOSE(*json))
+ json = JSON_SkipValueAndSeparators(json, jsonEnd);
+
+ return (json + 1 > jsonEnd) ? jsonEnd : json + 1;
+}
+
+static const char *JSON_SkipValue(const char *json, const char *jsonEnd)
+{
+ if (json >= jsonEnd)
+ return jsonEnd;
+ else if (*json == '"')
+ json = JSON_SkipString(json, jsonEnd);
+ else if (IS_STRUCT_OPEN(*json))
+ json = JSON_SkipStruct(json, jsonEnd);
+ else
+ {
+ while (json < jsonEnd && !IS_SEPARATOR(*json) && !IS_STRUCT_CLOSE(*json))
+ json++;
+ }
+
+ return json;
+}
+
+static const char *JSON_SkipValueAndSeparators(const char *json, const char *jsonEnd)
+{
+ json = JSON_SkipValue(json, jsonEnd);
+ return JSON_SkipSeparators(json, jsonEnd);
+}
+
+// returns 0 if value requires more parsing, 1 if no more data/false/null, 2 if true
+static unsigned int JSON_NoParse(const char *json, const char *jsonEnd)
+{
+ if (!json || json >= jsonEnd || *json == 'f' || *json == 'n')
+ return 1;
+
+ if (*json == 't')
+ return 2;
+
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+// Array Functions
+// --------------------------------------------------------------------------
+
+const char *JSON_ArrayGetFirstValue(const char *json, const char *jsonEnd)
+{
+ if (!json || json >= jsonEnd || !IS_STRUCT_OPEN(*json))
+ return NULL;
+
+ json = JSON_SkipSeparators(json + 1, jsonEnd);
+
+ return (json >= jsonEnd || IS_STRUCT_CLOSE(*json)) ? NULL : json;
+}
+
+const char *JSON_ArrayGetNextValue(const char *json, const char *jsonEnd)
+{
+ if (!json || json >= jsonEnd || IS_STRUCT_CLOSE(*json))
+ return NULL;
+
+ json = JSON_SkipValueAndSeparators(json, jsonEnd);
+
+ return (json >= jsonEnd || IS_STRUCT_CLOSE(*json)) ? NULL : json;
+}
+
+unsigned int JSON_ArrayGetIndex(const char *json, const char *jsonEnd, const char **indexes, unsigned int numIndexes)
+{
+ unsigned int length = 0;
+
+ for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json; json = JSON_ArrayGetNextValue(json, jsonEnd))
+ {
+ if (indexes && numIndexes)
+ {
+ *indexes++ = json;
+ numIndexes--;
+ }
+ length++;
+ }
+
+ return length;
+}
+
+const char *JSON_ArrayGetValue(const char *json, const char *jsonEnd, unsigned int index)
+{
+ for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json && index; json = JSON_ArrayGetNextValue(json, jsonEnd))
+ index--;
+
+ return json;
+}
+
+// --------------------------------------------------------------------------
+// Object Functions
+// --------------------------------------------------------------------------
+
+const char *JSON_ObjectGetNamedValue(const char *json, const char *jsonEnd, const char *name)
+{
+ unsigned int nameLen = strlen(name);
+
+ for (json = JSON_ArrayGetFirstValue(json, jsonEnd); json; json = JSON_ArrayGetNextValue(json, jsonEnd))
+ {
+ if (*json == '"')
+ {
+ const char *thisNameStart, *thisNameEnd;
+
+ thisNameStart = json + 1;
+ json = JSON_SkipString(json, jsonEnd);
+ thisNameEnd = json - 1;
+ json = JSON_SkipSeparators(json, jsonEnd);
+
+ if ((unsigned int)(thisNameEnd - thisNameStart) == nameLen)
+ if (strncmp(thisNameStart, name, nameLen) == 0)
+ return json;
+ }
+ }
+
+ return NULL;
+}
+
+// --------------------------------------------------------------------------
+// Value Functions
+// --------------------------------------------------------------------------
+
+unsigned int JSON_ValueGetType(const char *json, const char *jsonEnd)
+{
+ if (!json || json >= jsonEnd)
+ return JSONTYPE_ERROR;
+ else if (*json == '"')
+ return JSONTYPE_STRING;
+ else if (*json == '{')
+ return JSONTYPE_OBJECT;
+ else if (*json == '[')
+ return JSONTYPE_ARRAY;
+
+ return JSONTYPE_VALUE;
+}
+
+unsigned int JSON_ValueGetString(const char *json, const char *jsonEnd, char *outString, unsigned int stringLen)
+{
+ const char *stringEnd, *stringStart;
+
+ if (!json)
+ {
+ *outString = '\0';
+ return 0;
+ }
+
+ stringStart = json;
+ stringEnd = JSON_SkipValue(stringStart, jsonEnd);
+ if (stringEnd >= jsonEnd)
+ {
+ *outString = '\0';
+ return 0;
+ }
+
+ // skip enclosing quotes if they exist
+ if (*stringStart == '"')
+ stringStart++;
+
+ if (*(stringEnd - 1) == '"')
+ stringEnd--;
+
+ stringLen--;
+ if (stringLen > stringEnd - stringStart)
+ stringLen = stringEnd - stringStart;
+
+ json = stringStart;
+ while (stringLen--)
+ *outString++ = *json++;
+ *outString = '\0';
+
+ return stringEnd - stringStart;
+}
+
+double JSON_ValueGetDouble(const char *json, const char *jsonEnd)
+{
+ char cValue[256];
+ double dValue = 0.0;
+ unsigned int np = JSON_NoParse(json, jsonEnd);
+
+ if (np)
+ return (double)(np - 1);
+
+ if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
+ return 0.0;
+
+ sscanf(cValue, "%lf", &dValue);
+
+ return dValue;
+}
+
+float JSON_ValueGetFloat(const char *json, const char *jsonEnd)
+{
+ char cValue[256];
+ float fValue = 0.0f;
+ unsigned int np = JSON_NoParse(json, jsonEnd);
+
+ if (np)
+ return (float)(np - 1);
+
+ if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
+ return 0.0f;
+
+ sscanf(cValue, "%f", &fValue);
+
+ return fValue;
+}
+
+int JSON_ValueGetInt(const char *json, const char *jsonEnd)
+{
+ char cValue[256];
+ int iValue = 0;
+ unsigned int np = JSON_NoParse(json, jsonEnd);
+
+ if (np)
+ return np - 1;
+
+ if (!JSON_ValueGetString(json, jsonEnd, cValue, 256))
+ return 0;
+
+ sscanf(cValue, "%d", &iValue);
+
+ return iValue;
+}
+
+#undef IS_SEPARATOR
+#undef IS_STRUCT_OPEN
+#undef IS_STRUCT_CLOSE
+
+#endif
diff --git a/src/qcommon/q_platform.h b/src/qcommon/q_platform.h
index 39d1672c..34a93626 100644
--- a/src/qcommon/q_platform.h
+++ b/src/qcommon/q_platform.h
@@ -170,50 +170,29 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//================================================================= LINUX ===
-#if defined(__linux__) || defined(__FreeBSD_kernel__)
+#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
#include <endian.h>
#if defined(__linux__)
#define OS_STRING "linux"
-#else
+#elif defined(__FreeBSD_kernel__)
#define OS_STRING "kFreeBSD"
+#else
+#define OS_STRING "GNU"
#endif
#define ID_INLINE inline
#define PATH_SEP '/'
-#if defined __i386__
-#define ARCH_STRING "x86"
-#elif defined __x86_64__
+#if !defined(ARCH_STRING)
+# error ARCH_STRING should be defined by the Makefile
+#endif
+
+#if defined __x86_64__
#undef idx64
#define idx64 1
-#define ARCH_STRING "x86_64"
-#elif defined __powerpc64__
-#define ARCH_STRING "ppc64"
-#elif defined __powerpc__
-#define ARCH_STRING "ppc"
-#elif defined __s390__
-#define ARCH_STRING "s390"
-#elif defined __s390x__
-#define ARCH_STRING "s390x"
-#elif defined __ia64__
-#define ARCH_STRING "ia64"
-#elif defined __alpha__
-#define ARCH_STRING "alpha"
-#elif defined __sparc__
-#define ARCH_STRING "sparc"
-#elif defined __arm__
-#define ARCH_STRING "arm"
-#elif defined __cris__
-#define ARCH_STRING "cris"
-#elif defined __hppa__
-#define ARCH_STRING "hppa"
-#elif defined __mips__
-#define ARCH_STRING "mips"
-#elif defined __sh__
-#define ARCH_STRING "sh"
#endif
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index f226603d..f5888633 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -1276,7 +1276,7 @@ void Info_RemoveKey_Big( char *s, const char *key ) {
if (!strcmp (key, pkey) )
{
- strcpy (start, s); // remove this part
+ memmove(start, s, strlen(s) + 1); // remove this part
return;
}
diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h
index 9dd6df43..ef8fcbd5 100644
--- a/src/qcommon/qcommon.h
+++ b/src/qcommon/qcommon.h
@@ -279,7 +279,8 @@ enum svc_ops_e {
svc_EOF,
// new commands, supported only by ioquake3 protocol but not legacy
- svc_voip, // not wrapped in USE_VOIP, so this value is reserved.
+ svc_voipSpeex, // not wrapped in USE_VOIP, so this value is reserved.
+ svc_voipOpus, //
};
@@ -295,7 +296,8 @@ enum clc_ops_e {
clc_EOF,
// new commands, supported only by ioquake3 protocol but not legacy
- clc_voip, // not wrapped in USE_VOIP, so this value is reserved.
+ clc_voipSpeex, // not wrapped in USE_VOIP, so this value is reserved.
+ clc_voipOpus, //
};
/*
@@ -740,6 +742,7 @@ void Field_CompleteFilename( const char *dir,
const char *ext, qboolean stripExt, qboolean allowNonPureFilesOnDisk );
void Field_CompleteCommand( char *cmd,
qboolean doCommands, qboolean doCvars );
+void Field_CompletePlayerName( char **names, int count );
/*
==============================================================
@@ -815,6 +818,10 @@ void Com_StartupVariable( const char *match );
// if match is NULL, all set commands will be executed, otherwise
// only a set with the exact name. Only used during startup.
+qboolean Com_PlayerNameToFieldString( char *str, int length, const char *name );
+qboolean Com_FieldStringToPlayerName( char *name, int length, const char *rawname );
+int QDECL Com_strCompare( const void *a, const void *b );
+
extern cvar_t *com_developer;
extern cvar_t *com_dedicated;
diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c
index 2056785d..cdf8ad56 100644
--- a/src/qcommon/vm_x86.c
+++ b/src/qcommon/vm_x86.c
@@ -204,19 +204,25 @@ static void EmitRexString(byte rex, const char *string)
#define MASK_REG(modrm, mask) \
- EmitString("81"); \
- EmitString((modrm)); \
- Emit4((mask))
+ do { \
+ EmitString("81"); \
+ EmitString((modrm)); \
+ Emit4((mask)); \
+ } while(0)
// add bl, bytes
#define STACK_PUSH(bytes) \
- EmitString("80 C3"); \
- Emit1(bytes)
+ do { \
+ EmitString("80 C3"); \
+ Emit1(bytes); \
+ } while(0)
// sub bl, bytes
#define STACK_POP(bytes) \
- EmitString("80 EB"); \
- Emit1(bytes)
+ do { \
+ EmitString("80 EB"); \
+ Emit1(bytes); \
+ } while(0)
static void EmitCommand(ELastCommand command)
{