Skip to content

Commit

Permalink
Merge pull request NVIDIA#58 from mjunix/pvs-bugfixes
Browse files Browse the repository at this point in the history
Fix some bugs found by PVS-Studio
  • Loading branch information
apanteleev authored Dec 28, 2019
2 parents cd19b22 + e5e9ff4 commit 3293986
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ static size_t CL_DemoPos_m(char *buffer, size_t size)
sec = framenum / 10; framenum %= 10;
min = sec / 60; sec %= 60;

return Q_scnprintf(buffer, sizeof(buffer),
return Q_scnprintf(buffer, size,
"%d:%02d.%d", min, sec, framenum);
}

Expand Down
2 changes: 1 addition & 1 deletion src/refresh/vkpt/bsp_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (*

if (!bsp->pvs_patched)
{
if (MAT_IsKind(material_id, MATERIAL_KIND_SLIME) || MAT_IsKind(material_id, MATERIAL_KIND_WATER) || MAT_IsKind(material_id, MATERIAL_KIND_GLASS || MAT_IsKind(material_id, MATERIAL_KIND_TRANSPARENT)))
if (MAT_IsKind(material_id, MATERIAL_KIND_SLIME) || MAT_IsKind(material_id, MATERIAL_KIND_WATER) || MAT_IsKind(material_id, MATERIAL_KIND_GLASS) || MAT_IsKind(material_id, MATERIAL_KIND_TRANSPARENT))
{
int anti_cluster = BSP_PointLeaf(bsp->nodes, anti_center)->cluster;

Expand Down
6 changes: 5 additions & 1 deletion src/refresh/vkpt/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,11 @@ vkpt_reload_shader()
while(fgets(buf, sizeof buf, f)) {
Com_Printf("%s", buf);
}
fclose(f);
#ifdef _WIN32
_pclose(f);
#else
pclose(f);
#endif
}

vkpt_destroy_shader_modules();
Expand Down
2 changes: 1 addition & 1 deletion src/refresh/vkpt/vk_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ buffer_create(
.deviceMask = (1 << qvk.device_count) - 1
};

if (qvk.device_count > 1 && (!mem_properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
if (qvk.device_count > 1 && !(mem_properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) {
mem_alloc_info.pNext = &mem_alloc_flags;
}
#endif
Expand Down

0 comments on commit 3293986

Please sign in to comment.