From c756b5f273afa708517829d654b204fe9f671def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sat, 14 Jun 2014 18:11:26 -0700 Subject: [PATCH] Enabled C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch --- include/bx/float4_ni.h | 6 +++--- include/bx/platform.h | 3 ++- include/bx/string.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/bx/float4_ni.h b/include/bx/float4_ni.h index ad3026e..10ec73d 100644 --- a/include/bx/float4_ni.h +++ b/include/bx/float4_ni.h @@ -67,7 +67,7 @@ namespace bx const float4_t tmp0 = float4_or(_a, zwxy); const float4_t tmp1 = float4_swiz_yyyy(_a); const float4_t tmp2 = float4_or(tmp0, tmp1); - const float4_t mf000 = float4_ild(-1, 0, 0, 0); + const float4_t mf000 = float4_ild(UINT32_MAX, 0, 0, 0); const float4_t result = float4_and(tmp2, mf000); return result; @@ -76,7 +76,7 @@ namespace bx BX_FLOAT4_INLINE float4_t float4_orc_ni(float4_t _a, float4_t _b) { const float4_t aorb = float4_or(_a, _b); - const float4_t mffff = float4_isplat(-1); + const float4_t mffff = float4_isplat(UINT32_MAX); const float4_t result = float4_xor(aorb, mffff); return result; @@ -109,7 +109,7 @@ namespace bx BX_FLOAT4_INLINE float4_t float4_not_ni(float4_t _a) { - const float4_t mffff = float4_isplat(-1); + const float4_t mffff = float4_isplat(UINT32_MAX); const float4_t result = float4_xor(_a, mffff); return result; diff --git a/include/bx/platform.h b/include/bx/platform.h index 1c72db4..81833f4 100644 --- a/include/bx/platform.h +++ b/include/bx/platform.h @@ -188,7 +188,8 @@ //# pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant # pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant # pragma warning(error:4239) // ENABLE warning C4239: nonstandard extension used : 'argument' : conversion from '*' to '* &' A non-const reference may only be bound to an lvalue -//# pragma warning(error:4244) // ENABLE warning C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data +//# pragma warning(error:4244) // ENABLE warning C4244: 'argument' : conversion from 'type1' to 'type2', possible loss of data +# pragma warning(error:4245) // ENABLE warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch # pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function # pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual # pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int diff --git a/include/bx/string.h b/include/bx/string.h index 1129091..044cd99 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -225,7 +225,7 @@ namespace bx inline int32_t vsnprintf(char* _str, size_t _count, const char* _format, va_list _argList) { #if BX_COMPILER_MSVC - int32_t len = ::vsnprintf_s(_str, _count, -1, _format, _argList); + int32_t len = ::vsnprintf_s(_str, _count, size_t(-1), _format, _argList); return -1 == len ? ::_vscprintf(_format, _argList) : len; #else return ::vsnprintf(_str, _count, _format, _argList); @@ -238,7 +238,7 @@ namespace bx inline int32_t vsnwprintf(wchar_t* _str, size_t _count, const wchar_t* _format, va_list _argList) { #if BX_COMPILER_MSVC - int32_t len = ::_vsnwprintf_s(_str, _count, -1, _format, _argList); + int32_t len = ::_vsnwprintf_s(_str, _count, size_t(-1), _format, _argList); return -1 == len ? ::_vscwprintf(_format, _argList) : len; #elif defined(__MINGW32__) return ::vsnwprintf(_str, _count, _format, _argList);