engine: fix -Wmaybe-uninitialized

This commit is contained in:
Alibek Omarov 2019-12-24 02:47:51 +03:00
parent d0dbd185ad
commit 0fe18ae6dc
11 changed files with 38 additions and 30 deletions

View File

@ -217,6 +217,10 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
case PNG_CT_RGBA:
pixel_size = 4;
break;
default:
pixel_size = 0; // make compiler happy
ASSERT( false );
break;
}
image.type = PF_RGBA_32; // always exctracted to 32-bit buffer

View File

@ -1975,7 +1975,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( mt->offsets[0] > 0 )
{
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
int next_dataofs, remaining;
int next_dataofs = 0, remaining;
// compute next dataofset to determine allocated miptex space
for( j = i + 1; j < loadmodel->numtextures; j++ )

View File

@ -80,7 +80,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
mod->mins[2] = -pinq1->bounds[1] * 0.5f;
mod->maxs[2] = pinq1->bounds[1] * 0.5f;
}
else if( i == SPRITE_VERSION_HL )
else // if( i == SPRITE_VERSION_HL )
{
pinhl = (dsprite_hl_t *)buffer;
size = sizeof( msprite_t ) + ( pinhl->numframes - 1 ) * sizeof( psprite->frames );
@ -104,7 +104,6 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
if( Host_IsDedicated() )
{
// skip frames loading
psprite->numframes = 0;
return;
}

View File

@ -320,8 +320,9 @@ static void Mod_StudioCalcBoneAdj( float *adj, const byte *pcontroller )
if( i == STUDIO_MOUTH )
continue; // ignore mouth
if( i <= MAXSTUDIOCONTROLLERS )
{
if( i >= MAXSTUDIOCONTROLLERS )
continue;
// check for 360% wrapping
if( pbonecontroller[j].type & STUDIO_RLOOP )
{
@ -333,7 +334,6 @@ static void Mod_StudioCalcBoneAdj( float *adj, const byte *pcontroller )
value = bound( 0.0f, value, 1.0f );
value = (1.0f - value) * pbonecontroller[j].start + value * pbonecontroller[j].end;
}
}
switch( pbonecontroller[j].type & STUDIO_TYPES )
{

View File

@ -68,7 +68,7 @@ void Sys_Print( const char *pMsg );
void Sys_PrintLog( const char *pMsg );
void Sys_InitLog( void );
void Sys_CloseLog( void );
void Sys_Quit( void );
void Sys_Quit( void ) NORETURN;
//
// sys_con.c

View File

@ -1296,7 +1296,7 @@ void pfnSetModel( edict_t *e, const char *m )
char name[MAX_QPATH];
qboolean found = false;
model_t *mod;
int i;
int i = 1;
if( !SV_IsValidEdict( e ))
return;
@ -1308,7 +1308,7 @@ void pfnSetModel( edict_t *e, const char *m )
if( COM_CheckString( name ))
{
// check to see if model was properly precached
for( i = 1; i < MAX_MODELS && sv.model_precache[i][0]; i++ )
for( ; i < MAX_MODELS && sv.model_precache[i][0]; i++ )
{
if( !Q_stricmp( sv.model_precache[i], name ))
{

2
mainui

@ -1 +1 @@
Subproject commit 095661b44b5ef3bff4fe887de92bbe8cfc2fc6fd
Subproject commit f197117dacd1938fe3afca34716e4b7b60b6f837

View File

@ -21,8 +21,10 @@ GNU General Public License for more details.
#ifdef __GNUC__
#define _format(x) __attribute__((format(printf, x, x+1)))
#define NORETURN __attribute__((noreturn))
#else
#define _format(x)
#define NORETURN
#endif
// timestamp modes

View File

@ -227,7 +227,7 @@ for the model, which holds for all frames
*/
void BuildTris( void )
{
int len, bestlen, besttype;
int len, bestlen, besttype = 0;
int bestverts[1024];
int besttris[1024];
int type, startv;

View File

@ -514,7 +514,7 @@ GL_SetTextureDimensions
*/
static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, int depth )
{
int maxTextureSize;
int maxTextureSize = 0;
int maxDepthSize = 1;
Assert( tex != NULL );
@ -539,6 +539,8 @@ static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, i
maxDepthSize = glConfig.max_3d_texture_size;
maxTextureSize = glConfig.max_3d_texture_size;
break;
default:
Assert( false );
}
// store original sizes

View File

@ -237,6 +237,7 @@ def configure(conf):
'-Werror=bool-compare',
'-Werror=bool-operation',
'-Werror=uninitialized',
'-Werror=init-self',
'-Werror=implicit-fallthrough=2', # clang incompatible without "=2"
# '-Wdouble-promotion', # disable warning flood
'-Wstrict-aliasing',