@@ -3060,21 +3060,29 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
3060
3060
{
3061
3061
uint32_t * pDst = (uint32_t *)((char *)pData + offset);
3062
3062
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof (uint32_t );
3063
- for (size_t i = 0 ; i < numberCount; ++i, ++pDst)
3063
+ // This condition is to silence clang compiler error: "comparison of unsigned expression < 0 is always false"
3064
+ if (numberCount > 0 )
3064
3065
{
3065
- *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
3066
+ for (size_t i = 0 ; i < numberCount; ++i, ++pDst)
3067
+ {
3068
+ *pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
3069
+ }
3066
3070
}
3067
3071
}
3068
3072
3069
3073
static bool VmaValidateMagicValue (const void * pData, VkDeviceSize offset)
3070
3074
{
3071
3075
const uint32_t * pSrc = (const uint32_t *)((const char *)pData + offset);
3072
3076
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof (uint32_t );
3073
- for (size_t i = 0 ; i < numberCount; ++i, ++pSrc)
3077
+ // This condition is to silence clang compiler error: "comparison of unsigned expression < 0 is always false"
3078
+ if (numberCount > 0 )
3074
3079
{
3075
- if (*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE )
3080
+ for ( size_t i = 0 ; i < numberCount; ++i, ++pSrc )
3076
3081
{
3077
- return false ;
3082
+ if (*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
3083
+ {
3084
+ return false ;
3085
+ }
3078
3086
}
3079
3087
}
3080
3088
return true ;
@@ -3513,10 +3521,10 @@ template<typename CmpLess, typename IterT, typename KeyT>
3513
3521
IterT VmaVectorFindSorted (const IterT& beg, const IterT& end, const KeyT& value)
3514
3522
{
3515
3523
CmpLess comparator;
3516
- typename IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(
3524
+ IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(
3517
3525
beg, end, value, comparator);
3518
3526
if (it == end ||
3519
- !comparator (*it, value) && !comparator (value, *it))
3527
+ ( !comparator (*it, value) && !comparator (value, *it) ))
3520
3528
{
3521
3529
return it;
3522
3530
}
@@ -8634,8 +8642,8 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
8634
8642
}
8635
8643
8636
8644
// There is enough free space at the end after alignment.
8637
- if (index1st == suballocations1st.size () && resultOffset + allocSize + VMA_DEBUG_MARGIN < size ||
8638
- index1st < suballocations1st.size () && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset )
8645
+ if (( index1st == suballocations1st.size () && resultOffset + allocSize + VMA_DEBUG_MARGIN < size) ||
8646
+ ( index1st < suballocations1st.size () && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset ) )
8639
8647
{
8640
8648
// Check next suballocations for BufferImageGranularity conflicts.
8641
8649
// If conflict exists, allocation cannot be made here.
0 commit comments