mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2026-02-04 11:40:31 +01:00
Fix issues found by static analysis
Change-Id: I222ec3b352aa220b6c08df3a71de48178b67f06d Signed-off-by: Ben Davis <ben.davis@arm.com>
This commit is contained in:
parent
bed55ba330
commit
e00a2d8e40
3 changed files with 20 additions and 4 deletions
|
|
@ -316,7 +316,7 @@ public:
|
|||
base::push_back(std::forward<arg_types>(args)...);
|
||||
return true;
|
||||
}
|
||||
catch (const std::bad_alloc &e)
|
||||
catch (const std::bad_alloc &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -348,11 +348,11 @@ public:
|
|||
base::resize(std::forward<arg_types>(args)...);
|
||||
return true;
|
||||
}
|
||||
catch (const std::bad_alloc &e)
|
||||
catch (const std::bad_alloc &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace util */
|
||||
} /* namespace util */
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ VkResult extension_list::add(const char *const *extensions, uint32_t count)
|
|||
{
|
||||
auto &dst = m_ext_props[initial_size + i];
|
||||
strncpy(dst.extensionName, extensions[i], sizeof(dst.extensionName));
|
||||
|
||||
if (strlen(extensions[i]) >= sizeof(dst.extensionName))
|
||||
{
|
||||
dst.extensionName[sizeof(dst.extensionName) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,11 @@ VkResult add_extensions_required_by_layer(VkPhysicalDevice phys_dev, const util:
|
|||
|
||||
util::extension_list extensions_required_by_layer{allocator};
|
||||
surface_properties *props = get_surface_properties(wsi_ext.platform);
|
||||
if (props == nullptr)
|
||||
{
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
|
||||
res = props->get_required_device_extensions(extensions_required_by_layer);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
|
|
@ -197,7 +202,13 @@ PFN_vkVoidFunction get_proc_addr(const char *name)
|
|||
*/
|
||||
for (const auto &wsi_ext : supported_wsi_extensions)
|
||||
{
|
||||
PFN_vkVoidFunction func = get_surface_properties(wsi_ext.platform)->get_proc_addr(name);
|
||||
surface_properties *props = get_surface_properties(wsi_ext.platform);
|
||||
if (props == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PFN_vkVoidFunction func = props->get_proc_addr(name);
|
||||
if (func)
|
||||
{
|
||||
return func;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue