Merge pull request #234 from qw-ctf/warnings-etc

Warnings etc
This commit is contained in:
Shpoike 2024-01-27 06:33:05 +00:00 committed by GitHub
commit 118dab975e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 145 additions and 46 deletions

98
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,98 @@
name: main
on: [ push, pull_request, workflow_dispatch ]
jobs:
cmake:
strategy:
matrix:
os: [ ubuntu-latest ]
profile: [ "Debug", "Release" ]
runs-on: ${{ matrix.os }}
steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- uses: actions/checkout@v4
- name: "Install Dependencies"
run: |
sudo apt-get -qq update
sudo apt-get -qq install --no-install-recommends \
gettext \
libasound2-dev \
libbullet-dev \
libgnutls28-dev \
libopenxr-dev \
libqscintilla2-qt5-dev \
libsdl2-dev \
libvorbis-dev \
libvulkan-dev \
libwayland-dev \
libxcursor-dev \
libxkbcommon-dev \
libxrandr-dev \
qtbase5-dev
# Disabled due to warnings that break the debug build with -Werror
# libode-dev
# libavcodec-dev libavformat-dev libavutil-dev libswscale-dev
- name: "Configure: ${{ matrix.profile }}"
run: |
cmake -B build_${{ matrix.profile }} -DCMAKE_BUILD_TYPE=${{ matrix.profile }}
- name: "Build: ${{ matrix.profile }}"
run: |
cmake --build build_${{ matrix.profile }} --parallel ${{ steps.cpu-cores.outputs.count }}
wasm:
strategy:
# Concurrent builds currently broken:
# https://github.com/mymindstorm/setup-emsdk/issues/20
matrix:
emsdk: [ "2.0.12" ] #, "3.1.8", "3.1.51" ]
profile: [ "rel" ] #, "dbg" ]
runs-on: ubuntu-latest
steps:
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- uses: actions/checkout@v4
- uses: mymindstorm/setup-emsdk@v13
with:
version: ${{ matrix.emsdk }}
actions-cache-folder: "emsdk-cache-${{ matrix.emsdk }}"
- name: Verify emscripten
run: emcc -v
- name: Build dependencies
working-directory: engine
run: |
make -j ${{ steps.cpu-cores.outputs.count }} makelibs FTE_TARGET=web
- name: Build wasm
working-directory: engine
run: |
# Currently fails to build
sed -r -i '/define Q3(CLIENT|SERVER)/d' common/config_fteqw.h
make -j ${{ steps.cpu-cores.outputs.count }} FTE_TARGET=web web-${{ matrix.profile }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: fteqw-web-${{ matrix.profile }}-em${{ matrix.emsdk }}
path: |
engine/*/ftewebgl.js
engine/*/ftewebgl.html
engine/*/ftewebgl.wasm
compression-level: 9

View file

@ -244,7 +244,7 @@ float Master_ReadKeyFloat(serverinfo_t *server, unsigned int keynum);
char *Master_ReadKeyString(serverinfo_t *server, unsigned int keynum);
int Master_SortServers(void);
void Master_SetSortField(hostcachekey_t field, qboolean descending);
void Master_SetSortField(hostcachekey_t field, unsigned int sortflags);
hostcachekey_t Master_GetSortField(void);
qboolean Master_GetSortDescending(void);

View file

@ -105,7 +105,7 @@ static unsigned int IN_GetKeyDest(void)
qboolean QDECL Plug_Input_IsKeyDown(int key)
{
extern qboolean keydown[K_MAX];
extern unsigned int keydown[K_MAX];
if (key >= 0 && key < K_MAX)
return !!keydown[key];
return false;

View file

@ -2553,7 +2553,6 @@ void Key_Unbindall_f (void)
int i;
for (i=0 ; i<K_MAX ; i++)
if (keybindings[i])
Key_SetBinding (i, ~0, NULL, Cmd_ExecLevel);
}

View file

@ -6759,7 +6759,7 @@ static void QCBUILTIN PF_resourcestatus(pubprogfuncs_t *prinst, struct globalvar
return;
case RESTYPE_SOUND:
sfx = NULL;
for (idx=1 ; idx<MAX_PRECACHE_SOUNDS && cl.sound_name[idx] ; idx++)
for (idx=1 ; idx<MAX_PRECACHE_SOUNDS; idx++)
{
if (!strcmp(cl.sound_name[idx], resname))
{

View file

@ -582,7 +582,7 @@ void Mod_SubmodelLoaded(struct model_s *mod, int state);
#ifdef RUNTIMELIGHTING
struct relight_ctx_s;
struct llightinfo_s;
void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[4], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything.
void LightPlane (struct relight_ctx_s *ctx, struct llightinfo_s *threadctx, lightstyleindex_t surf_styles[MAXCPULIGHTMAPS], unsigned int *surf_expsamples, qbyte *surf_rgbsamples, qbyte *surf_deluxesamples, vec4_t surf_plane, vec4_t surf_texplanes[2], vec2_t exactmins, vec2_t exactmaxs, int texmins[2], int texsize[2], float lmscale); //special version that doesn't know what a face is or anything.
struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, struct model_s *model, qboolean shadows, qboolean skiplit);
void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles);
void LightShutdown(struct relight_ctx_s *ctx);

View file

@ -3052,7 +3052,7 @@ void Sbar_Draw (playerview_t *pv)
R2D_ImageColours(1, 1, 1, 1);
if (*cl.q2statusbar)
Sbar_ExecuteLayoutString(cl.q2statusbar, seat);
if (*cl.q2layout && (cl.q2frame.playerstate[seat].stats[Q2STAT_LAYOUTS] & 1))
if (cl.q2frame.playerstate[seat].stats[Q2STAT_LAYOUTS] & 1)
Sbar_ExecuteLayoutString(cl.q2layout[seat], seat);
if (cl.q2frame.playerstate[seat].stats[Q2STAT_LAYOUTS] & 2)
Sbar_Q2DrawInventory(seat);

View file

@ -2423,7 +2423,7 @@ float MSG_ReadCoordFloat (void)
return MSG_FromCoord(c, COORDTYPE_FLOAT_32);
}
void MSG_ReadPos (vec3_t pos)
void MSG_ReadPos (float pos[3])
{
pos[0] = MSG_ReadCoord();
pos[1] = MSG_ReadCoord();
@ -2452,7 +2452,7 @@ void MSG_ReadDir (vec3_t dir)
}
#endif
#if 1//def Q2SERVER
void MSG_WriteDir (sizebuf_t *sb, vec3_t dir)
void MSG_WriteDir (sizebuf_t *sb, float dir[3])
{
int i, best;
float d, bestd;

View file

@ -340,7 +340,7 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f);
void MSGFTE_WriteDeltaUsercmd (sizebuf_t *buf, const short baseanges[3], const struct usercmd_s *from, const struct usercmd_s *cmd);
void MSGQW_WriteDeltaUsercmd (sizebuf_t *sb, const struct usercmd_s *from, const struct usercmd_s *cmd);
void MSGCL_WriteDeltaUsercmd (sizebuf_t *sb, const struct usercmd_s *from, const struct usercmd_s *cmd);
void MSG_WriteDir (sizebuf_t *sb, float *dir);
void MSG_WriteDir (sizebuf_t *sb, float dir[3]);
extern qboolean msg_badread; // set if a read goes beyond end of message
extern struct netprim_s msg_nullnetprim;
@ -371,7 +371,7 @@ char *MSG_ReadStringLine (void);
float MSG_ReadCoord (void);
float MSG_ReadCoordFloat (void);
void MSG_ReadPos (float *pos);
void MSG_ReadPos (float pos[3]);
float MSG_ReadAngle (void);
float MSG_ReadAngle16 (void);
void MSGQW_ReadDeltaUsercmd (const struct usercmd_s *from, struct usercmd_s *cmd, int qwprotocolver);

View file

@ -60,7 +60,7 @@ extern void BuildLightMapGammaTable (float g, float c);
#if defined(Q2BSPS) || defined(Q3BSPS)
static qboolean CM_NativeTrace(model_t *model, int forcehullnum, const framestate_t *framestate, const vec3_t axis[3], const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, qboolean capsule, unsigned int contents, trace_t *trace);
static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t p, const vec3_t mins, const vec3_t maxs);
static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t point, const vec3_t mins, const vec3_t maxs);
static unsigned int Q2BSP_PointContents(model_t *mod, const vec3_t axis[3], const vec3_t p);
static int CM_PointCluster (model_t *mod, const vec3_t p, int *area);
static void CM_InfoForPoint (struct model_s *mod, vec3_t pos, int *area, int *cluster, unsigned int *contentbits);
@ -5504,12 +5504,12 @@ static int CM_PointContents (model_t *mod, const vec3_t p)
return contents;
}
static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t p, const vec3_t mins, const vec3_t maxs)
static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, const framestate_t *framestate, const vec3_t axis[3], const vec3_t point, const vec3_t mins, const vec3_t maxs)
{
cminfo_t *prv = (cminfo_t*)model->meshinfo;
int contents;
if (!DotProduct(mins, mins) && !DotProduct(maxs, maxs))
return CM_PointContents(model, p);
return CM_PointContents(model, point);
if (!model) // map not loaded
return 0;
@ -5520,11 +5520,10 @@ static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, c
mleaf_t *leaf;
q2cbrush_t *brush;
q2cbrushside_t *brushside;
vec3_t absmin, absmax;
int leaflist[64];
k = CM_BoxLeafnums (model, absmin, absmax, leaflist, 64, NULL);
k = CM_BoxLeafnums (model, point, point, leaflist, 64, NULL);
contents = 0;
for (k--; k >= 0; k--)
@ -5544,7 +5543,7 @@ static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, c
brushside = brush->brushside;
for ( j = 0; j < brush->numsides; j++, brushside++ )
{
if ( PlaneDiff (p, brushside->plane) > 0 )
if (PlaneDiff (point, brushside->plane) > 0 )
break;
}

View file

@ -896,8 +896,16 @@ static qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred)
const char *errstr;
gnutls_pk_algorithm_t privalgo = GNUTLS_PK_RSA;
if (privf)VFS_CLOSE(privf);privf=NULL;
if (pubf)VFS_CLOSE(pubf);pubf=NULL;
if (privf)
{
VFS_CLOSE(privf);
privf = NULL;
}
if (pubf)
{
VFS_CLOSE(pubf);
pubf = NULL;
}
Con_Printf("Generating new GNUTLS key+cert...\n");

View file

@ -2289,7 +2289,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, vec4_t *src, vec4_t *ds
}
#endif
static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m);
static void BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m);
static void DeformGen_Text(int stringid, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh)
{
#define maxlen 32
@ -2361,8 +2361,8 @@ static void DeformGen_Text(int stringid, int cnt, vecV_t *src, vecV_t *dst, cons
textmesh.numindexes = i*6;
textmesh.numvertexes = i*4;
if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, &textmesh))
return;
BE_GenTempMeshVBO(&shaderstate.sourcevbo, &textmesh);
shaderstate.meshcount = 1;
shaderstate.meshes = &meshptr;
#undef maxlen
@ -4908,7 +4908,7 @@ static void DrawMeshes(void)
}
}
static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m)
static void BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m)
{
*vbo = &shaderstate.dummyvbo;
@ -5093,10 +5093,6 @@ static qboolean BE_GenTempMeshVBO(vbo_t **vbo, mesh_t *m)
}
shaderstate.dummyvbo.bones = m->bones;
shaderstate.dummyvbo.numbones = m->numbones;
shaderstate.meshcount = 1;
shaderstate.meshes = &m;
return true;
}
void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_t *vbo, texnums_t *texnums, unsigned int beflags)
@ -5123,8 +5119,7 @@ void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_
{
m = *meshlist++;
if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, m))
continue;
BE_GenTempMeshVBO(&shaderstate.sourcevbo, m);
shaderstate.meshcount = 1;
shaderstate.meshes = &m;
@ -5172,8 +5167,7 @@ void GLBE_SubmitBatch(batch_t *batch)
else
{
//we're only allowed one mesh per batch if there's no vbo info.
if (!BE_GenTempMeshVBO(&shaderstate.sourcevbo, batch->mesh[0]))
return;
BE_GenTempMeshVBO(&shaderstate.sourcevbo, batch->mesh[0]);
}
sh = batch->shader;

View file

@ -5738,7 +5738,7 @@ void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e)
{
if (br->faces[j].relight && dorelight)
{
lightstyleindex_t styles[4] = {0,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE,INVALID_LIGHTSTYLE};
lightstyleindex_t styles[max(2,MAXCPULIGHTMAPS)] = {0,INVALID_LIGHTSTYLE};
int texsize[2] = {br->faces[j].lmextents[0]-1, br->faces[j].lmextents[1]-1};
vec2_t exactmins, exactmaxs;
int m, k;

View file

@ -2700,7 +2700,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
char typea[256], typeb[256];
QCC_statement_t *statement;
QCC_sref_t var_c=nullsref;
pbool nan_eq_cond, sym_cmp;
if (var_a.sym)
{
@ -3618,7 +3618,8 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
// self-comparison that is impacted when NaN
// e.g. NaN == NaN, NaN != NaN, [NaN, 0, 0] == [NaN, 0, 0], etc.
pbool nan_eq_cond = false;
nan_eq_cond = false;
switch (op - pr_opcodes)
{
case OP_STATE:
@ -3840,7 +3841,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
QCC_PR_ParseWarning(WARN_STRICTTYPEMISMATCH, "'%s' type mismatch: %s with %s", op->name, typea, typeb);
}
pbool sym_cmp = !nan_eq_cond && var_a.sym == var_b.sym && var_a.ofs == var_b.ofs;
sym_cmp = !nan_eq_cond && var_a.sym == var_b.sym && var_a.ofs == var_b.ofs;
if ((var_a.sym->constant && var_b.sym->constant && !var_a.sym->temp && !var_b.sym->temp) || sym_cmp)
{

View file

@ -83,7 +83,7 @@ void SV_FindProxies(SOCKET sock, cluster_t *cluster, sv_t *defaultqtv)
if (cluster->maxproxies >= 0 && cluster->numproxies >= cluster->maxproxies)
{
const char buffer[] = {dem_all, 1, 'P','r','o','x','y',' ','i','s',' ','f','u','l','l','.'};
send(sock, buffer, strlen(buffer), 0);
send(sock, buffer, sizeof(buffer), 0);
closesocket(sock);
return;
}

View file

@ -112,7 +112,7 @@ void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid)
Sys_Printf(cluster, "opened udp port %i\n", port);
}
SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina)
SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t ina)
{
#ifdef AF_INET6
if (((struct sockaddr *)ina.sockaddr)->sa_family == AF_INET6)
@ -120,7 +120,7 @@ SOCKET NET_ChooseSocket(SOCKET sock[2], netadr_t *toadr, netadr_t ina)
*toadr = ina;
return sock[SG_IPV6];
}
if (sock[0] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET)
if (sock[SG_IPV4] == INVALID_SOCKET && sock[SG_IPV6] != INVALID_SOCKET)
{
struct sockaddr_in6 *out = (struct sockaddr_in6*)toadr->sockaddr;
struct sockaddr_in *in = (struct sockaddr_in*)ina.sockaddr;

View file

@ -947,7 +947,7 @@ void Netchan_OutOfBandPrint (cluster_t *cluster, netadr_t adr, char *format, ...
//int Netchan_IsLocal (netadr_t adr);
void NET_InitUDPSocket(cluster_t *cluster, int port, int socketid);
void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, void *data, netadr_t adr);
SOCKET NET_ChooseSocket(SOCKET sock[], netadr_t *toadr, netadr_t in);
SOCKET NET_ChooseSocket(SOCKET sock[SOCKETGROUPS], netadr_t *toadr, netadr_t in);
qboolean Net_CompareAddress(netadr_t *s1, netadr_t *s2, int qp1, int qp2);
qboolean Netchan_Process (netchan_t *chan, netmsg_t *msg);
qboolean NQNetchan_Process(cluster_t *cluster, netchan_t *chan, netmsg_t *msg);

View file

@ -2728,7 +2728,7 @@ I've removed the following from this function as it covered the menu (~Moodles):
else if (!strcmp(command, "guidemos"))
{
int maxshowndemos;
char sizestr[7];
char sizestr[11];
int start;
int i;
@ -2776,13 +2776,13 @@ I've removed the following from this function as it covered the menu (~Moodles):
if (i >= cluster->availdemoscount)
break;
if (cluster->availdemos[i].size < 1024)
sprintf(sizestr, "%4ib", cluster->availdemos[i].size);
snprintf(sizestr, sizeof(sizestr), "%4ib", cluster->availdemos[i].size);
else if (cluster->availdemos[i].size < 1024*1024)
sprintf(sizestr, "%4ikb", cluster->availdemos[i].size/1024);
snprintf(sizestr, sizeof(sizestr), "%4ikb", cluster->availdemos[i].size/1024);
else if (cluster->availdemos[i].size < 1024*1024*1024)
sprintf(sizestr, "%4imb", cluster->availdemos[i].size/(1024*1024));
snprintf(sizestr, sizeof(sizestr), "%4imb", cluster->availdemos[i].size/(1024*1024));
else// if (cluster->availdemos[i].size < 1024*1024*1024*1024)
sprintf(sizestr, "%4igb", cluster->availdemos[i].size/(1024*1024*1024));
snprintf(sizestr, sizeof(sizestr), "%4igb", cluster->availdemos[i].size/(1024*1024*1024));
// else
// *sizestr = 0;
QW_StuffcmdToViewer(v, "menutext 32 %i \"%6s %-30s\" \"demo %s\"\n", (i-start)*8 + 52+16, sizestr, cluster->availdemos[i].name, cluster->availdemos[i].name);