From 0691cf72b440148f58b2dcc76ba0ea59ce6ddebf Mon Sep 17 00:00:00 2001 From: Juraj <37395233+JurajX@users.noreply.github.com> Date: Tue, 7 Jun 2022 07:27:27 +0200 Subject: [PATCH] fix -Wsign-conversion warnings --- tinyxml2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tinyxml2.h b/tinyxml2.h index cfb1053..d508727 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -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(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) ); // 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(nChar) ) == 0; } inline static bool IsUTF8Continuation( const char p ) {