From 4757bd34c6146184f11ba04ed086c672de4febc0 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 29 Jan 2019 19:41:31 +0000 Subject: [PATCH] Misc compile fixes (mostly warnings) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5395 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- CMakeLists.txt | 2 +- engine/client/cl_parse.c | 13 +++++++++---- engine/client/cl_screen.c | 2 +- engine/client/renderer.c | 2 +- engine/common/common.c | 39 ++++++++++++++++++++------------------- engine/common/pr_bgcmd.c | 2 ++ engine/http/iwebiface.c | 3 ++- engine/qclib/decomp.c | 2 +- engine/qclib/packager.c | 10 +++++----- engine/server/pr_cmds.c | 2 ++ engine/server/sv_master.c | 23 ++++++++++++++++------- plugins/irc/ircclient.c | 2 +- 12 files changed, 61 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4472a61fd..dc0a3d436 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU") #might as well do this, public builds use the regular Makefile. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") IF(CMAKE_BUILD_TYPE MATCHES "Debug") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-pointer-sign -Wno-unknown-pragmas -Wno-format-zero-length -Wno-strict-aliasing") ELSE() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") ENDIF() diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index edbb4088c..93610a750 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -8320,15 +8320,20 @@ void CL_ShowTrafficUsage(float x, float y) size_t svccount, i, j=0; size_t total; struct sortedsvcs_s sorted[256]; - if (cls.protocol == CP_NETQUAKE) + switch(cls.protocol) { +#ifdef NQPROT + case CP_NETQUAKE: svcnames = svc_nqstrings; svccount = countof(svc_nqstrings); - } - else - { + break; +#endif + case CP_QUAKEWORLD: svcnames = svc_qwstrings; svccount = countof(svc_qwstrings); + break; + default: + return; //panic! } total = 0; for (i = 0; i < 256; i++) diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index fca868530..020a38a4d 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -689,7 +689,7 @@ int SCR_DrawCenterString (vrect_t *rect, cprint_t *p, struct font_s *font) } if (rect->width < 32) - return; + return 0; rect->x += 16; rect->width -= 32; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index b014b8a3a..b7420d1aa 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -175,7 +175,7 @@ cvar_t r_hdr_irisadaptation_fade_up = CVAR ("r_hdr_irisadaptation_fade_up", "0 cvar_t r_loadlits = CVARF ("r_loadlit", "1", CVAR_ARCHIVE); cvar_t r_menutint = CVARF ("r_menutint", "0.68 0.4 0.13", CVAR_RENDERERCALLBACK); -cvar_t r_netgraph = CVAR ("r_netgraph", "0"); +cvar_t r_netgraph = CVARD ("r_netgraph", "0", "Displays a graph of packet latency. A value of 2 will give additional info about what sort of data is being received from the server."); extern cvar_t r_lerpmuzzlehack; cvar_t r_nolerp = CVARF ("r_nolerp", "0", CVAR_ARCHIVE); cvar_t r_noframegrouplerp = CVARF ("r_noframegrouplerp", "0", CVAR_ARCHIVE); diff --git a/engine/common/common.c b/engine/common/common.c index 8277d5542..9a34ef4c8 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -1134,7 +1134,21 @@ int COM_EncodeSize(vec3_t mins, vec3_t maxs) return solid; } -static unsigned int MSG_ReadEntity(void) +#if defined(HAVE_CLIENT) || defined(HAVE_SERVER) +void MSG_WriteEntity(sizebuf_t *sb, unsigned int entnum) +{ + if (entnum > MAX_EDICTS) + Host_EndGame("index %#x is not a valid entity\n", entnum); + + if (entnum >= 0x8000) + { + MSG_WriteShort(sb, (entnum>>8) | 0x8000); + MSG_WriteByte(sb, entnum & 0xff); + } + else + MSG_WriteShort(sb, entnum); +} +static unsigned int MSG_ReadBigEntity(void) { unsigned int num; num = MSG_ReadShort(); @@ -1145,15 +1159,17 @@ static unsigned int MSG_ReadEntity(void) } return num; } +#endif + //we use the high bit of the entity number to state that this is a large entity. #ifdef HAVE_SERVER unsigned int MSGSV_ReadEntity(client_t *fromclient) { unsigned int num; if (fromclient->fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) - num = MSG_ReadEntity(); + num = MSG_ReadBigEntity(); else - num = (unsigned short)(short)MSG_ReadEntity(); + num = (unsigned short)(short)MSG_ReadShort(); if (num >= sv.world.max_edicts) { Con_Printf("client %s sent invalid entity\n", fromclient->name); @@ -1168,27 +1184,12 @@ unsigned int MSGCL_ReadEntity(void) { unsigned int num; if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) - num = MSG_ReadEntity(); + num = MSG_ReadBigEntity(); else num = (unsigned short)(short)MSG_ReadShort(); return num; } #endif -#if defined(HAVE_CLIENT) || defined(HAVE_SERVER) -void MSG_WriteEntity(sizebuf_t *sb, unsigned int entnum) -{ - if (entnum > MAX_EDICTS) - Host_EndGame("index %#x is not a valid entity\n", entnum); - - if (entnum >= 0x8000) - { - MSG_WriteShort(sb, (entnum>>8) | 0x8000); - MSG_WriteByte(sb, entnum & 0xff); - } - else - MSG_WriteShort(sb, entnum); -} -#endif void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) { diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index 133ce4190..994af8a9a 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -184,6 +184,8 @@ static int debuggerstacky; #if defined(_WIN32) && !defined(FTE_SDL) && !defined(_XBOX) #include void INS_UpdateGrabs(int fullscreen, int activeapp); +#else + #include #endif int QCLibEditor(pubprogfuncs_t *prinst, const char *filename, int *line, int *statement, int firststatement, char *error, pbool fatal); diff --git a/engine/http/iwebiface.c b/engine/http/iwebiface.c index 722940d4b..64dc3a336 100644 --- a/engine/http/iwebiface.c +++ b/engine/http/iwebiface.c @@ -658,9 +658,10 @@ qboolean Sys_rmdir (const char *path) } #else #include +#include void FS_CreatePath(const char *pname, enum fs_relative relativeto) { - mkdir(pname); + mkdir(pname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); } qboolean Sys_rmdir (const char *path) { diff --git a/engine/qclib/decomp.c b/engine/qclib/decomp.c index 35e6f65a2..f56738e52 100644 --- a/engine/qclib/decomp.c +++ b/engine/qclib/decomp.c @@ -2450,7 +2450,7 @@ char *DecompileValueString(etype_t type, void *val) char *DecompilePrintParameter(QCC_ddef_t * def) { - static char line[128]; + static char line[256]; static char debug[128]; line[0] = '0'; diff --git a/engine/qclib/packager.c b/engine/qclib/packager.c index e710a09f5..f8bf9a9aa 100644 --- a/engine/qclib/packager.c +++ b/engine/qclib/packager.c @@ -427,7 +427,7 @@ static void PKG_ParseOutput(struct pkgctx_s *ctx, pbool diff) } } -static void PKG_AddOldPack(struct pkgctx_s *ctx, const char *fname) +/*static void PKG_AddOldPack(struct pkgctx_s *ctx, const char *fname) { struct oldpack_s *pack; @@ -437,17 +437,17 @@ static void PKG_AddOldPack(struct pkgctx_s *ctx, const char *fname) pack->file = NULL; pack->next = ctx->oldpacks; ctx->oldpacks = pack; -} +}*/ static void PKG_ParseOldPack(struct pkgctx_s *ctx) { char token[MAX_OSPATH]; - char oldpack[MAX_OSPATH]; if (!PKG_GetStringToken(ctx, token, sizeof(token))) return; #ifdef _WIN32 { + char oldpack[MAX_OSPATH]; WIN32_FIND_DATA fd; HANDLE h; QCC_Canonicalize(oldpack, sizeof(oldpack), token, ctx->gamepath); @@ -594,7 +594,7 @@ static void PKG_ParseRule(struct pkgctx_s *ctx) r->next = ctx->rules; ctx->rules = r; } -static void PKG_AddClassFile(struct pkgctx_s *ctx, struct class_s *c, const char *fname, time_t mtime) +/*static void PKG_AddClassFile(struct pkgctx_s *ctx, struct class_s *c, const char *fname, time_t mtime) { struct file_s *f; struct tm *t; @@ -614,7 +614,7 @@ static void PKG_AddClassFile(struct pkgctx_s *ctx, struct class_s *c, const char f->write.dosdate = (t->tm_mday<<0)|(t->tm_mon<<5)|((t->tm_year+1900-1980)<<9); f->next = c->files; c->files = f; -} +}*/ static void PKG_AddClassFiles(struct pkgctx_s *ctx, struct class_s *c, const char *fname) { #ifdef _WIN32 diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 16623be38..16ee294c4 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -870,7 +870,9 @@ void PR_LoadGlabalStruct(qboolean muted) static float writeonly; static int writeonly_int; static int endcontentsi, surfaceflagsi; +#ifndef NOLEGACY static float endcontentsf, surfaceflagsf; +#endif static float dimension_send_default; static float dimension_default = 255; static float zero_default; diff --git a/engine/server/sv_master.c b/engine/server/sv_master.c index 549716143..c5506c2a9 100644 --- a/engine/server/sv_master.c +++ b/engine/server/sv_master.c @@ -208,7 +208,7 @@ static void SVM_RemoveOldServers(void) } } -int SVM_AddIPAddresses(sizebuf_t *sb, int first, const char *gamename, int v4, int v6, qboolean prefixes) +int SVM_AddIPAddresses(sizebuf_t *sb, int first, const char *gamename, int v4, int v6, qboolean prefixes, int gametype) { int number = 0; svm_server_t *server; @@ -227,6 +227,9 @@ int SVM_AddIPAddresses(sizebuf_t *sb, int first, const char *gamename, int v4, i for (; server; server = server->next) { +//FIXME +// if (gametype != -1 && server->gametype != gametype) +// continue; switch(server->adr.type) { case NA_IP: @@ -246,7 +249,7 @@ int SVM_AddIPAddresses(sizebuf_t *sb, int first, const char *gamename, int v4, i } if (prefixes) - MSG_WriteByte(sb, prefixes); + MSG_WriteByte(sb, prefix); SZ_Write(sb, server->adr.address.ip, len); MSG_WriteShort(sb, server->adr.port); @@ -308,7 +311,7 @@ vfsfile_t *SVM_GenerateIndex(const char *fname) f = VFSPIPE_Open(1, false); VFS_PRINTF(f, "%s", thecss); - VFS_PRINTF(f, "

Single Server Info

\n", tmpbuf); + VFS_PRINTF(f, "

Single Server Info

\n"); VFS_PRINTF(f, "\n"); VFS_PRINTF(f, "\n"); @@ -476,6 +479,11 @@ void SVM_Think(int port) gametype = GT_CTF; else if (!strncmp(com_token, "gametype=", 9)) gametype = atoi(com_token+9); + else + { + char buf[256]; + Con_DPrintf("Unknown request filter: %s\n", COM_QuotedString(com_token, buf, sizeof(buf), false)); + } } svm.total.queries++; memset(&sb, 0, sizeof(sb)); @@ -485,15 +493,16 @@ void SVM_Think(int port) if (!ipv4 && !ipv6) ipv4 = ipv6 = true; //neither specified? use both + (void)ver, (void)full, (void)empty; if (ext) { //ipv6 and ipv4 addresses MSG_WriteString(&sb, "getserversExtResponse"); - SVM_AddIPAddresses(&sb, 0, game, ipv4, ipv6, true); + SVM_AddIPAddresses(&sb, 0, game, ipv4, ipv6, true, gametype); } else { //ipv4 only MSG_WriteString(&sb, "getserversResponse"); - SVM_AddIPAddresses(&sb, 0, game, ipv4, ipv6, true); + SVM_AddIPAddresses(&sb, 0, game, ipv4, ipv6, true, gametype); } sb.maxsize+=2; MSG_WriteByte(&sb, '\\'); //otherwise the last may be considered invalid and ignored. @@ -557,7 +566,7 @@ void SVM_Think(int port) MSG_WriteLong(&sb, -1); MSG_WriteString(&sb, "servers\n"); sb.cursize--; - SVM_AddIPAddresses(&sb, 0, "Quake2", true, false, false); + SVM_AddIPAddresses(&sb, 0, "Quake2", true, false, false, -1); NET_SendPacket(svm_sockets, sb.cursize, sb.data, &net_from); } else if (*com_token == S2M_HEARTBEAT) //sequence, players @@ -580,7 +589,7 @@ void SVM_Think(int port) MSG_WriteLong(&sb, -1); MSG_WriteByte(&sb, M2C_MASTER_REPLY); MSG_WriteByte(&sb, '\n'); - SVM_AddIPAddresses(&sb, 0, "QuakeWorld", true, false, false); + SVM_AddIPAddresses(&sb, 0, "QuakeWorld", true, false, false, -1); NET_SendPacket(svm_sockets, sb.cursize, sb.data, &net_from); } else if (*com_token == A2A_PING) diff --git a/plugins/irc/ircclient.c b/plugins/irc/ircclient.c index b3aa51bab..0076ed430 100644 --- a/plugins/irc/ircclient.c +++ b/plugins/irc/ircclient.c @@ -1100,7 +1100,7 @@ static void numbered_command(int comm, char *msg, ircclient_t *irc) // move vars } case 323: /* RPL_LISTEND*/ { - char *endoflist = casevar[3]+1; + //char *endoflist = casevar[3]+1; // IRC_Printf(irc, "list", "%s\n",endoflist);
GameAddressHostnameMod dirMapnamePlayers