silencing few static analyzers warnings.

This commit is contained in:
David Carlier 2023-01-29 09:26:23 +00:00
parent bc7cec0e14
commit 40af78f13a
2 changed files with 8 additions and 4 deletions

View file

@ -983,11 +983,13 @@ Mod_LoadFile(char *name, void **buffer)
} }
/* Remove the extension */ /* Remove the extension */
size_t tlen = len - (strlen(ext) + 1);
memset(namewe, 0, 256); memset(namewe, 0, 256);
memcpy(namewe, name, len - (strlen(ext) + 1)); memcpy(namewe, name, tlen);
/* Check Heretic2 model */ /* Check Heretic2 model */
snprintf(newname, sizeof(newname), "%s.fm", namewe); Q_strlcpy(newname, namewe, sizeof(newname));
Q_strlcat(newname, ".fm", sizeof(newname));
filesize = ri.FS_LoadFile (newname, buffer); filesize = ri.FS_LoadFile (newname, buffer);
if (filesize > 0) if (filesize > 0)
{ {
@ -995,7 +997,7 @@ Mod_LoadFile(char *name, void **buffer)
} }
/* Check Quake 2 model */ /* Check Quake 2 model */
snprintf(newname, sizeof(newname), "%s.md2", namewe); Q_strlcpy(newname + tlen, ".md2", sizeof(newname));
filesize = ri.FS_LoadFile (newname, buffer); filesize = ri.FS_LoadFile (newname, buffer);
if (filesize > 0) if (filesize > 0)
{ {
@ -1003,7 +1005,7 @@ Mod_LoadFile(char *name, void **buffer)
} }
/* Check Quake model */ /* Check Quake model */
snprintf(newname, sizeof(newname), "%s.mdl", namewe); Q_strlcpy(newname + tlen, ".mdl", sizeof(newname));
filesize = ri.FS_LoadFile (newname, buffer); filesize = ri.FS_LoadFile (newname, buffer);
if (filesize > 0) if (filesize > 0)
{ {

View file

@ -1199,6 +1199,8 @@ Vk_LoadPic(const char *name, byte *pic, int width, int realwidth,
image->upload_width = upload_width; // after power of 2 and scales image->upload_width = upload_width; // after power of 2 and scales
image->upload_height = upload_height; image->upload_height = upload_height;
assert(texBuffer != NULL);
QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer, QVk_CreateTexture(&image->vk_texture, (unsigned char*)texBuffer,
image->upload_width, image->upload_height, image->upload_width, image->upload_height,
nolerp ? S_NEAREST : vk_current_sampler, (type == it_sky)); nolerp ? S_NEAREST : vk_current_sampler, (type == it_sky));