Reduced compilation warnings

This commit is contained in:
smallmodel 2024-06-07 20:34:13 +02:00
parent 50264c4968
commit 74ccb03e54
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
21 changed files with 37 additions and 36 deletions

View file

@ -113,7 +113,7 @@ void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle)
if (tmp.length()) {
*handle = cgi.R_RegisterModel(tmp.c_str());
} else {
*handle = NULL;
*handle = (qhandle_t)0;
}
} else {
if (*handle) {
@ -135,7 +135,7 @@ void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle)
if (tmp.length()) {
*handle = cgi.R_RegisterShader(tmp.c_str());
} else {
*handle = NULL;
*handle = (qhandle_t)0;
}
} else {
if (*handle) {

View file

@ -1180,7 +1180,7 @@ void CG_DrawCrosshair()
float x, y;
float width, height;
shader = NULL;
shader = (qhandle_t)0;
if (!cg_hud->integer || !ui_crosshair->integer) {
return;

View file

@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cl_ui.h"
typedef struct {
char *string;
int value;
const char *string;
int value;
} equipment_event_table_t;
static equipment_event_table_t s_equipTable[] = {

View file

@ -5355,7 +5355,7 @@ void Actor::MovePath(float fMoveSpeed)
VectorCopy(m_groundPlaneNormal, mm.groundPlaneNormal);
VectorCopy2D(mm.obstacle_normal, m_PrevObstacleNormal);
if (m_WallDir == -1) {
if (m_WallDir == (char)-1) {
mm.desired_dir[0] = -mm.obstacle_normal[1];
mm.desired_dir[1] = mm.obstacle_normal[0];
} else {

View file

@ -264,7 +264,7 @@ bool Actor::CalcFallPath(void)
loop = currentPos;
mm.desired_speed = 0;
mm.groundPlane = NULL;
mm.groundPlane = qfalse;
mm.walking = false;
VectorSet(mm.velocity, 0, 0, -171);

View file

@ -246,8 +246,8 @@ void Actor::LookAtCuriosity(void)
iSeed = 0x19660D * (m_iCuriousTime - 0x2EB71B09 * ((level.inttime - m_iCuriousTime) & 0xFFFFFF00)) + 0x3C6EF35F;
vAngles[0] = m_DesiredLookAngles[0] + (float)iSeed / 0x4444444 * fLookScale;
vAngles[1] = m_DesiredLookAngles[1] + (float)iSeed / 0x2222222 * fLookScale;
vAngles[0] = m_DesiredLookAngles[0] + (float)iSeed / (float)0x4444444 * fLookScale;
vAngles[1] = m_DesiredLookAngles[1] + (float)iSeed / (float)0x2222222 * fLookScale;
vAngles[2] = m_DesiredLookAngles[2];
// clamp
vAngles[0] = Q_clamp_float(vAngles[0], -90, 90);

View file

@ -114,7 +114,7 @@ void VoteOptions::SetupVoteOptions(const char *configFileName, int length, const
if (length >= MAX_VOTEOPTIONS_BUFFER_LENGTH) {
Com_Error(
ERR_DROP,
"VoteOptions: Options file '%s' is too big. Max size is %u bytes\n",
"VoteOptions: Options file '%s' is too big. Max size is %lu bytes\n",
configFileName,
MAX_VOTEOPTIONS_BUFFER_LENGTH
);
@ -564,7 +564,7 @@ void CG_PushCallVoteSubClient_f(void)
if (!strlen(cg.clientinfo[i].name)) {
continue;
}
VO_ExecuteCommand(
va("globalwidgetcommand voteclientlist additem \"%i: %s\" \"callvote %i %i;popmenu 0\"\n",
i,

View file

@ -22,8 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// g_local.h -- local definitions for game module
#ifndef __G_LOCAL_H__
#define __G_LOCAL_H__
#pragma once
#include "q_shared.h"
#include "bg_public.h"
@ -417,8 +416,8 @@ void G_RunThink(gentity_t *ent);
void QDECL G_LogPrintf(const char *fmt, ...);
void SendScoreboardMessageToAllClients(void);
void QDECL G_Printf(const char *fmt, ...);
void QDECL G_Error(const char *fmt, ...);
void QDECL G_Error(errorParm_t type, const char *fmt, ...);
void QDECL G_Error(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
void QDECL G_Error(errorParm_t type, const char *fmt, ...) __attribute__((noreturn, format(printf, 2, 3)));
//
// g_client.c
@ -530,5 +529,3 @@ extern gentity_t *g_entities;
#define FOFS(x) ((size_t) & (((gentity_t *)0)->x))
#include "g_utils.h"
#endif /* g_local.h */

View file

@ -4632,7 +4632,7 @@ void ScriptThread::RestoreSound(Event *ev)
time = delaytime * 1000.0f;
gi.SendServerCommand(player != NULL ? player->edict - g_entities : NULL, "restoresound %0.2f %f", time, max_vol);
gi.SendServerCommand(player != NULL ? player->edict - g_entities : 0, "restoresound %0.2f %f", time, max_vol);
}
void ScriptThread::EventHudDraw3d(Event *ev)

View file

@ -295,8 +295,8 @@ static void send_echo(qr_t qrec, struct sockaddr *sender, char *outbuf, const ch
static void send_final(qr_t qrec, struct sockaddr *sender, char *outbuf, char *validation)
{
char keyvalue[256];
char encrypted_val[128];
char encoded_val[200];
uchar encrypted_val[128];
uchar encoded_val[200];
int keylen;
if (*validation) {

View file

@ -2756,7 +2756,7 @@ void MSG_ReadDeltaEntity( msg_t *msg, entityState_t *from, entityState_t *to,
// su44: trying to find the cause of "unrecognized entity field type" error.
// Number of changed fields (lc) should never be larger than total field count....
if(numFields < lc) {
Com_Error( ERR_DROP, "MSG_ReadDeltaEntity: number of changed fields (%i) is higher than total field count (%i)\n",
Com_Error( ERR_DROP, "MSG_ReadDeltaEntity: number of changed fields (%i) is higher than total field count (%zu)\n",
lc, numFields);
}

View file

@ -947,7 +947,7 @@ image_t* R_CreateImage(
if (glCompressMode) {
UploadCompressed(
(unsigned*)pic,
(byte*)pic,
image->width,
image->height,
image->numMipmaps,
@ -962,7 +962,7 @@ image_t* R_CreateImage(
}
else {
Upload32(
(unsigned*)pic,
(unsigned int*)pic,
image->width,
image->height,
image->numMipmaps,
@ -1089,7 +1089,7 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height )
}
if ( bmpHeader.fileSize != length )
{
ri.Error( ERR_DROP, "LoadBMP: header size does not match file size (%d vs. %d) (%s)\n", bmpHeader.fileSize, length, name );
ri.Error( ERR_DROP, "LoadBMP: header size does not match file size (%lu vs. %d) (%s)\n", bmpHeader.fileSize, length, name );
}
if ( bmpHeader.compression != 0 )
{
@ -1213,7 +1213,7 @@ static void LoadPCX ( const char *filename, byte **pic, byte **palette, int *wid
// parse the PCX file
//
pcx = (pcx_t *)raw;
raw = &pcx->data;
raw = (byte*)pcx->data;
xmax = LittleShort(pcx->xmax);
ymax = LittleShort(pcx->ymax);

View file

@ -1275,7 +1275,7 @@ void R_Init( void ) {
// Swap_Init();
if ( (int)tess.xyz & 15 ) {
if ( (size_t)tess.xyz & 15 ) {
Com_Printf( "WARNING: tess.xyz not 16 byte aligned\n" );
}
Com_Memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) );

View file

@ -1229,8 +1229,8 @@ recurse:
that a median-of-three algorithm does not, in general, increase
performance. */
mid = lo + (size / 2) * width; /* find middle element */
SwapDrawSurf(mid, lo); /* swap it to beginning of array */
mid = lo + (size / 2) * width; /* find middle element */
SwapDrawSurf((drawSurf_t*)mid, (drawSurf_t*)lo); /* swap it to beginning of array */
/* We now wish to partition the array into three pieces, one
consisiting of elements <= partition element, one of elements
@ -1271,7 +1271,7 @@ recurse:
A[loguy] > A[lo], A[higuy] < A[lo],
loguy < hi, highy > lo */
SwapDrawSurf(loguy, higuy);
SwapDrawSurf((drawSurf_t*)loguy, (drawSurf_t*)higuy);
/* A[loguy] < A[lo], A[higuy] > A[lo]; so condition at top
of loop is re-established */
@ -1285,7 +1285,7 @@ recurse:
A[i] <= A[lo] for lo <= i <= higuy,
A[i] = A[lo] for higuy < i < loguy */
SwapDrawSurf(lo, higuy); /* put partition element in place */
SwapDrawSurf((drawSurf_t*)lo, (drawSurf_t*)higuy); /* put partition element in place */
/* OK, now we have the following:
A[i] >= A[higuy] for loguy <= i <= hi,

View file

@ -833,6 +833,8 @@ void R_BoxSurfacesForBModel_r(bmodel_t* pBmodel, const vec3_t mins, const vec3_t
case SF_GRID:
surf->viewCount = tr.viewCount;
break;
default:
break;
}
}
else

View file

@ -31,8 +31,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static float s_noise_table[NOISE_SIZE];
static int s_noise_perm[NOISE_SIZE];
#define LERP( a, b, w ) ( a * ( 1.0f - w ) + b * w )
static float GetNoiseValue( int x, int y, int z, int t )
{
int index = INDEX( ( int ) x, ( int ) y, ( int ) z, ( int ) t );

View file

@ -250,6 +250,8 @@ static void RB_OptimizeLights()
VectorNormalize2(pLight->vOrigin, pLight->vDirection);
}
break;
default:
break;
}
}
}

View file

@ -1185,7 +1185,7 @@ void R_AddTerrainSurfaces()
if (ter_count->integer && (g_nSplit || g_nMerge)) {
if (ter_count->integer == 1 || g_nSplit * 2 != g_nMerge) {
Com_DPrintf(
"%5d tris / %5d verts / %4d splits / %4d merges\n",
"%5zu tris / %5zu verts / %4d splits / %4d merges\n",
g_nTris - g_tri.nFree,
g_nVerts - g_vert.nFree,
g_nSplit,

View file

@ -1519,7 +1519,7 @@ void SV_ExecuteClientCommand( client_t *cl, const char *s, qboolean clientOK ) {
// Since 2.0, displays chat messages
// NOTE: this should be handled by fgame, not server
//
Com_Printf("%s (%d): %s", cl->name, cl - svs.clients, s);
Com_Printf("%s (%ld): %s", cl->name, cl - svs.clients, s);
}
if (clientOK) {
@ -1530,7 +1530,7 @@ void SV_ExecuteClientCommand( client_t *cl, const char *s, qboolean clientOK ) {
if (ge->errorMessage)
{
// if an error has occured while processing the command, halt the server
Com_Error(ERR_DROP, ge->errorMessage);
Com_Error(ERR_DROP, "%s", ge->errorMessage);
}
}
}

View file

@ -287,7 +287,7 @@ void UIField::CharEvent(int ch)
// if the character was inserted at the end of the string,
// make sure it remains NULL-terminated
if (m_edit.m_cursor == len) {
m_edit.m_buffer[m_edit.m_cursor] = NULL;
m_edit.m_buffer[m_edit.m_cursor] = 0;
}
if (m_cvarname.length()) {

View file

@ -161,6 +161,8 @@ void UIHorizScroll::DrawThumb(void)
m_local_alpha
);
break;
default:
break;
}
}