diff --git a/code/cgame/cg_archive.cpp b/code/cgame/cg_archive.cpp index 3a1b260e..29fa32c7 100644 --- a/code/cgame/cg_archive.cpp +++ b/code/cgame/cg_archive.cpp @@ -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) { diff --git a/code/cgame/cg_drawtools.cpp b/code/cgame/cg_drawtools.cpp index da1fb632..a416eede 100644 --- a/code/cgame/cg_drawtools.cpp +++ b/code/cgame/cg_drawtools.cpp @@ -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; diff --git a/code/client/cl_inv.cpp b/code/client/cl_inv.cpp index a4c50dd4..850d766d 100644 --- a/code/client/cl_inv.cpp +++ b/code/client/cl_inv.cpp @@ -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[] = { diff --git a/code/fgame/actor.cpp b/code/fgame/actor.cpp index 997e7798..f74215c2 100644 --- a/code/fgame/actor.cpp +++ b/code/fgame/actor.cpp @@ -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 { diff --git a/code/fgame/actor_balcony.cpp b/code/fgame/actor_balcony.cpp index 538e6563..ab181089 100644 --- a/code/fgame/actor_balcony.cpp +++ b/code/fgame/actor_balcony.cpp @@ -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); diff --git a/code/fgame/actor_curious.cpp b/code/fgame/actor_curious.cpp index fdaab297..19e51e5d 100644 --- a/code/fgame/actor_curious.cpp +++ b/code/fgame/actor_curious.cpp @@ -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); diff --git a/code/fgame/bg_voteoptions.cpp b/code/fgame/bg_voteoptions.cpp index 99f38629..7a7ed594 100644 --- a/code/fgame/bg_voteoptions.cpp +++ b/code/fgame/bg_voteoptions.cpp @@ -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, diff --git a/code/fgame/g_local.h b/code/fgame/g_local.h index fcf18650..73c8ad5a 100644 --- a/code/fgame/g_local.h +++ b/code/fgame/g_local.h @@ -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 */ diff --git a/code/fgame/scriptthread.cpp b/code/fgame/scriptthread.cpp index 4f141b12..62e48659 100644 --- a/code/fgame/scriptthread.cpp +++ b/code/fgame/scriptthread.cpp @@ -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) diff --git a/code/gamespy/sv_gqueryreporting.c b/code/gamespy/sv_gqueryreporting.c index 2e464d4b..4828db27 100644 --- a/code/gamespy/sv_gqueryreporting.c +++ b/code/gamespy/sv_gqueryreporting.c @@ -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) { diff --git a/code/qcommon/msg.cpp b/code/qcommon/msg.cpp index 77f4c338..1555aba6 100644 --- a/code/qcommon/msg.cpp +++ b/code/qcommon/msg.cpp @@ -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); } diff --git a/code/renderer/tr_image.c b/code/renderer/tr_image.c index 350e6835..50013d6c 100644 --- a/code/renderer/tr_image.c +++ b/code/renderer/tr_image.c @@ -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); diff --git a/code/renderer/tr_init.c b/code/renderer/tr_init.c index 963b302f..3ab56925 100644 --- a/code/renderer/tr_init.c +++ b/code/renderer/tr_init.c @@ -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 ) ); diff --git a/code/renderer/tr_main.c b/code/renderer/tr_main.c index a836d705..800ff499 100644 --- a/code/renderer/tr_main.c +++ b/code/renderer/tr_main.c @@ -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, diff --git a/code/renderer/tr_marks.c b/code/renderer/tr_marks.c index 0ce4db24..8c15f000 100644 --- a/code/renderer/tr_marks.c +++ b/code/renderer/tr_marks.c @@ -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 diff --git a/code/renderer/tr_noise.c b/code/renderer/tr_noise.c index 7e172fbe..9789433c 100644 --- a/code/renderer/tr_noise.c +++ b/code/renderer/tr_noise.c @@ -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 ); diff --git a/code/renderer/tr_sphere_shade.cpp b/code/renderer/tr_sphere_shade.cpp index 001b94b2..0a039ef2 100644 --- a/code/renderer/tr_sphere_shade.cpp +++ b/code/renderer/tr_sphere_shade.cpp @@ -250,6 +250,8 @@ static void RB_OptimizeLights() VectorNormalize2(pLight->vOrigin, pLight->vDirection); } break; + default: + break; } } } diff --git a/code/renderer/tr_terrain.c b/code/renderer/tr_terrain.c index 2e921216..b22be9dc 100644 --- a/code/renderer/tr_terrain.c +++ b/code/renderer/tr_terrain.c @@ -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, diff --git a/code/server/sv_client.c b/code/server/sv_client.c index 81006431..e262ca9c 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -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); } } } diff --git a/code/uilib/uifield.cpp b/code/uilib/uifield.cpp index a2a19b3f..952e3f7f 100644 --- a/code/uilib/uifield.cpp +++ b/code/uilib/uifield.cpp @@ -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()) { diff --git a/code/uilib/uihorizscroll.cpp b/code/uilib/uihorizscroll.cpp index 54f14b83..14730727 100644 --- a/code/uilib/uihorizscroll.cpp +++ b/code/uilib/uihorizscroll.cpp @@ -161,6 +161,8 @@ void UIHorizScroll::DrawThumb(void) m_local_alpha ); break; + default: + break; } }