refresh/files: cppcheck warning clean up

This commit is contained in:
Denis Pauk 2024-03-08 00:24:58 +02:00
parent f888840ec8
commit 3b579eb0d6
3 changed files with 18 additions and 17 deletions

View file

@ -1005,17 +1005,17 @@ static void *
Mod_LoadModel_MD2Anox(const char *mod_name, const void *buffer, int modfilelen,
struct image_s ***skins, int *numskins, modtype_t *type)
{
vec3_t translate = {0, 0, 0};
dmdla_t pinmodel;
dmdx_t *pheader;
dtriangle_t *pintri;
dstvert_t *pinst;
dmdxmesh_t *mesh_nodes;
int *pincmd;
void *extradata;
int i;
int framesize, ofs_meshes, ofs_skins, ofs_st, ofs_tris, ofs_glcmds,
ofs_frames, ofs_end;
vec3_t translate = {0, 0, 0};
const dtriangle_t *pintri;
const dstvert_t *pinst;
dmdxmesh_t *mesh_nodes;
const int *pincmd;
dmdla_t pinmodel;
void *extradata;
dmdx_t *pheader;
int i;
if (modfilelen < sizeof(pinmodel))
{

View file

@ -334,10 +334,10 @@ AllocateFrames(md5_model_t *anim)
static void
FreeModelMd5Frames(md5_model_t *mdl)
{
int i;
if (mdl->skelFrames)
{
int i;
for (i = 0; i < mdl->num_frames; ++i)
{
if (mdl->skelFrames[i].vertexArray)
@ -398,11 +398,12 @@ ParseFloatBlock(char **curr_buff, int count, float *v)
static void
ReadMD5Anim(md5_model_t *anim, const char *buffer, size_t size)
{
char *curr_buff, *end_buff, *safe_buffer;
md5_joint_info_t *jointInfos = NULL;
md5_baseframe_joint_t *baseFrame = NULL;
float *animFrameData = NULL;
md5_joint_info_t *jointInfos = NULL;
int numAnimatedComponents = 0;
char *curr_buff,*safe_buffer;
float *animFrameData = NULL;
const char *end_buff;
/* buffer has not always had final zero */
safe_buffer = malloc(size + 1);
@ -668,8 +669,6 @@ ReadMD5Anim(md5_model_t *anim, const char *buffer, size_t size)
static void
FreeModelMd5(md5_model_t *mdl)
{
int i;
FreeModelMd5Frames(mdl);
if (mdl->vertexIndices)
@ -698,6 +697,8 @@ FreeModelMd5(md5_model_t *mdl)
if (mdl->meshes)
{
int i;
/* Free mesh data */
for (i = 0; i < mdl->num_meshes; ++i)
{

View file

@ -57,7 +57,7 @@ R_TextureAnimation(const entity_t *currententity, const mtexinfo_t *tex)
c--;
}
return tex->image;
return tex ? tex->image : NULL;
}
qboolean