# HG changeset patch # User ipse.c99@d525d15b-5824-0410-80a3-6185d19c2cde # Date 1216273642 0 # Node ID febb32e4ac04955c9667d73a95c26d0b75610dcb # Parent eb2525abe43a75034d401e9eacc983028ce5e1b0 Get rid of these compiler warnings when compiling for 32-bit: warning C4311: 'type cast' : pointer truncation from 'void *' to 'uintptr_t' warning C4312: 'type cast' : conversion from 'uintptr_t' to 'const void *' of greater size diff --git a/stdint.h b/stdint.h --- a/stdint.h +++ b/stdint.h @@ -1,7 +1,7 @@ // ISO C9x compliant stdint.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // -// Copyright (c) 2006 Alexander Chemeris +// Copyright (c) 2006-2008 Alexander Chemeris // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: @@ -53,6 +53,16 @@ } #endif +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + // 7.18.1 Integer types // 7.18.1.1 Exact-width integer types @@ -90,8 +100,8 @@ typedef uint64_t uint_fast64_t; typedef __int64 intptr_t; typedef unsigned __int64 uintptr_t; #else // _WIN64 ][ - typedef int intptr_t; - typedef unsigned int uintptr_t; + typedef _W64 int intptr_t; + typedef _W64 unsigned int uintptr_t; #endif // _WIN64 ] // 7.18.1.5 Greatest-width integer types