mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Fix formatting in buffer type.
This commit is contained in:
parent
5a57bf2fbf
commit
39473a68f4
@ -285,13 +285,13 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Make sure that the specified element is withing buffer range
|
// Make sure that the specified element is withing buffer range
|
||||||
else if (n > (m_Cap - sizeof(T)))
|
else if (n > (m_Cap - sizeof(T)))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) at index ({}) is out of buffer capacity ({})"),
|
||||||
sizeof(T), n, m_Cap);
|
sizeof(T), n, m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -306,13 +306,13 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Make sure that the specified element is withing buffer range
|
// Make sure that the specified element is withing buffer range
|
||||||
else if (n > (m_Cap - sizeof(T)))
|
else if (n > (m_Cap - sizeof(T)))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) at index ({}) is out of buffer capacity ({})"),
|
||||||
sizeof(T), n, m_Cap);
|
sizeof(T), n, m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -359,7 +359,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -374,7 +374,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -389,7 +389,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least two elements of this type
|
// Make sure that the buffer can host at least two elements of this type
|
||||||
if (m_Cap < (sizeof(T) * 2))
|
if (m_Cap < (sizeof(T) * 2))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -404,7 +404,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least two elements of this type
|
// Make sure that the buffer can host at least two elements of this type
|
||||||
if (m_Cap < (sizeof(T) * 2))
|
if (m_Cap < (sizeof(T) * 2))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -419,7 +419,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -434,7 +434,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -449,7 +449,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least two elements of this type
|
// Make sure that the buffer can host at least two elements of this type
|
||||||
if (m_Cap < (sizeof(T) * 2))
|
if (m_Cap < (sizeof(T) * 2))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -464,7 +464,7 @@ public:
|
|||||||
// Make sure that the buffer can host at least two elements of this type
|
// Make sure that the buffer can host at least two elements of this type
|
||||||
if (m_Cap < (sizeof(T) * 2))
|
if (m_Cap < (sizeof(T) * 2))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -540,7 +540,7 @@ public:
|
|||||||
// Make sure that at least one element of this type exists after the cursor
|
// Make sure that at least one element of this type exists after the cursor
|
||||||
if ((m_Cur + sizeof(T)) > m_Cap)
|
if ((m_Cur + sizeof(T)) > m_Cap)
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||||
sizeof(T), m_Cur, m_Cap);
|
sizeof(T), m_Cur, m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -555,7 +555,7 @@ public:
|
|||||||
// Make sure that at least one element of this type exists after the cursor
|
// Make sure that at least one element of this type exists after the cursor
|
||||||
if ((m_Cur + sizeof(T)) > m_Cap)
|
if ((m_Cur + sizeof(T)) > m_Cap)
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||||
sizeof(T), m_Cur, m_Cap);
|
sizeof(T), m_Cur, m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -570,7 +570,7 @@ public:
|
|||||||
// The cursor must have at least one element of this type behind
|
// The cursor must have at least one element of this type behind
|
||||||
if (m_Cur < sizeof(T))
|
if (m_Cur < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"),
|
ThrowMemExcept(fmt::runtime("Cannot read an element of size ({}) before the cursor at ({})"),
|
||||||
sizeof(T), m_Cur);
|
sizeof(T), m_Cur);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -585,7 +585,7 @@ public:
|
|||||||
// The cursor must have at least one element of this type behind
|
// The cursor must have at least one element of this type behind
|
||||||
if (m_Cur < sizeof(T))
|
if (m_Cur < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"),
|
ThrowMemExcept(fmt::runtime("Cannot read an element of size ({}) before the cursor at ({})"),
|
||||||
sizeof(T), m_Cur);
|
sizeof(T), m_Cur);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -600,13 +600,13 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// There must be buffer left for at least two elements of this type after the cursor
|
// There must be buffer left for at least two elements of this type after the cursor
|
||||||
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||||
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -621,13 +621,13 @@ public:
|
|||||||
// Make sure that the buffer can host at least one element of this type
|
// Make sure that the buffer can host at least one element of this type
|
||||||
if (m_Cap < sizeof(T))
|
if (m_Cap < sizeof(T))
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||||
m_Cap, sizeof(T));
|
m_Cap, sizeof(T));
|
||||||
}
|
}
|
||||||
// There must be buffer left for at least two elements of this type after the cursor
|
// There must be buffer left for at least two elements of this type after the cursor
|
||||||
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||||
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
||||||
}
|
}
|
||||||
// Return the requested element
|
// Return the requested element
|
||||||
@ -708,7 +708,7 @@ public:
|
|||||||
// See if the requested capacity doesn't exceed the limit
|
// See if the requested capacity doesn't exceed the limit
|
||||||
if (n > Max< T >())
|
if (n > Max< T >())
|
||||||
{
|
{
|
||||||
ThrowMemExcept(fmt::runtime("Requested buffer of (%u) elements exceeds the (%u) limit"), n, Max< T >());
|
ThrowMemExcept(fmt::runtime("Requested buffer of ({}) elements exceeds the ({}) limit"), n, Max< T >());
|
||||||
}
|
}
|
||||||
// Is there an existing buffer?
|
// Is there an existing buffer?
|
||||||
else if (n && !m_Cap)
|
else if (n && !m_Cap)
|
||||||
|
Loading…
Reference in New Issue
Block a user