Browse Source

engine: fix -Wmaybe-uninitialized

pull/2/head
Alibek Omarov 5 years ago
parent
commit
0fe18ae6dc
  1. 4
      engine/common/imagelib/img_png.c
  2. 2
      engine/common/mod_bmodel.c
  3. 3
      engine/common/mod_sprite.c
  4. 6
      engine/common/mod_studio.c
  5. 2
      engine/common/system.h
  6. 4
      engine/server/sv_game.c
  7. 2
      mainui
  8. 2
      public/crtlib.h
  9. 2
      ref_gl/gl_alias.c
  10. 4
      ref_gl/gl_image.c
  11. 1
      wscript

4
engine/common/imagelib/img_png.c

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

2
engine/common/mod_bmodel.c

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

3
engine/common/mod_sprite.c

@ -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->mins[2] = -pinq1->bounds[1] * 0.5f;
mod->maxs[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; pinhl = (dsprite_hl_t *)buffer;
size = sizeof( msprite_t ) + ( pinhl->numframes - 1 ) * sizeof( psprite->frames ); 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() ) if( Host_IsDedicated() )
{ {
// skip frames loading // skip frames loading
psprite->numframes = 0; psprite->numframes = 0;
return; return;
} }

6
engine/common/mod_studio.c

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

2
engine/common/system.h

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

4
engine/server/sv_game.c

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

2
mainui

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

2
public/crtlib.h

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

2
ref_gl/gl_alias.c

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

4
ref_gl/gl_image.c

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

1
wscript

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

Loading…
Cancel
Save