fix -Wsign-conversion warnings

This commit is contained in:
Juraj
2022-06-07 07:27:27 +02:00
parent e45d9d16d4
commit 0691cf72b4

View File

@@ -305,9 +305,9 @@ private:
if ( cap > _allocated ) {
TIXMLASSERT( cap <= INT_MAX / 2 );
const int newAllocated = cap * 2;
T* newMem = new T[newAllocated];
T* newMem = new T[static_cast<size_t>(newAllocated)];
TIXMLASSERT( newAllocated >= _size );
memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs
memcpy( newMem, _mem, sizeof(T)*static_cast<size_t>(_size) ); // warning: not using constructors, only works for PODs
if ( _mem != _pool ) {
delete [] _mem;
}
@@ -603,7 +603,7 @@ public:
TIXMLASSERT( p );
TIXMLASSERT( q );
TIXMLASSERT( nChar >= 0 );
return strncmp( p, q, nChar ) == 0;
return strncmp( p, q, static_cast<size_t>(nChar) ) == 0;
}
inline static bool IsUTF8Continuation( const char p ) {