瀏覽代碼

Enabled C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch

Branimir Karadžić 11 年之前
父節點
當前提交
c756b5f273
共有 3 個文件被更改,包括 7 次插入6 次删除
  1. 3 3
      include/bx/float4_ni.h
  2. 2 1
      include/bx/platform.h
  3. 2 2
      include/bx/string.h

+ 3 - 3
include/bx/float4_ni.h

@@ -67,7 +67,7 @@ namespace bx
 		const float4_t tmp0   = float4_or(_a, zwxy);
 		const float4_t tmp0   = float4_or(_a, zwxy);
 		const float4_t tmp1   = float4_swiz_yyyy(_a);
 		const float4_t tmp1   = float4_swiz_yyyy(_a);
 		const float4_t tmp2   = float4_or(tmp0, tmp1);
 		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);
 		const float4_t result = float4_and(tmp2, mf000);
 
 
 		return result;
 		return result;
@@ -76,7 +76,7 @@ namespace bx
 	BX_FLOAT4_INLINE float4_t float4_orc_ni(float4_t _a, float4_t _b)
 	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 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);
 		const float4_t result = float4_xor(aorb, mffff);
 
 
 		return result;
 		return result;
@@ -109,7 +109,7 @@ namespace bx
 
 
 	BX_FLOAT4_INLINE float4_t float4_not_ni(float4_t _a)
 	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);
 		const float4_t result = float4_xor(_a, mffff);
 
 
 		return result;
 		return result;

+ 2 - 1
include/bx/platform.h

@@ -188,7 +188,8 @@
 //#	pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant
 //#	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: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: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: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: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
 #	pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int

+ 2 - 2
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)
 	inline int32_t vsnprintf(char* _str, size_t _count, const char* _format, va_list _argList)
 	{
 	{
 #if BX_COMPILER_MSVC
 #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;
 		return -1 == len ? ::_vscprintf(_format, _argList) : len;
 #else
 #else
 		return ::vsnprintf(_str, _count, _format, _argList);
 		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)
 	inline int32_t vsnwprintf(wchar_t* _str, size_t _count, const wchar_t* _format, va_list _argList)
 	{
 	{
 #if BX_COMPILER_MSVC
 #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;
 		return -1 == len ? ::_vscwprintf(_format, _argList) : len;
 #elif defined(__MINGW32__)
 #elif defined(__MINGW32__)
 		return ::vsnwprintf(_str, _count, _format, _argList);
 		return ::vsnwprintf(_str, _count, _format, _argList);