mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Specify std::min to work on type size_t for copy operations in struct constructors. (#1782)
This commit is contained in:
parent
7bd7372016
commit
3a946ddfa1
@ -10678,7 +10678,7 @@ std::string VulkanHppGenerator::generateStructConstructorsEnhanced( std::pair<st
|
||||
${copyOp}( ${memberName}, ${memberName}_.data(), ${arraySizeExpression} );)";
|
||||
|
||||
std::string arraySizeExpression = ( mit->lenExpressions[0] == "null-terminated" )
|
||||
? ( "std::min( " + mit->name + "_.size(), " + mit->arraySizes[0] + " )" )
|
||||
? ( "std::min<size_t>( " + mit->name + "_.size(), " + mit->arraySizes[0] + " )" )
|
||||
: ( mit->lenExpressions[0] + " * sizeof( " + argumentType + " )" );
|
||||
copyOps += replaceWithMap( copyOpsTemplate,
|
||||
{ { "arraySize", mit->arraySizes[0] },
|
||||
@ -11325,7 +11325,7 @@ std::string VulkanHppGenerator::generateStructSetter( std::string const & struct
|
||||
${structureName} & set${ArrayName}( std::string const & ${arrayName}_ ) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
VULKAN_HPP_ASSERT( ${arrayName}_.size() < ${arraySize} );
|
||||
strncpy( ${arrayName}, ${arrayName}_.data(), std::min( ${arrayName}_.size(), ${arraySize} );
|
||||
strncpy( ${arrayName}, ${arrayName}_.data(), std::min<size_t>( ${arrayName}_.size(), ${arraySize} );
|
||||
return *this;
|
||||
}
|
||||
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
|
||||
|
Loading…
Reference in New Issue
Block a user