[cairo] [PATCH 0/4] RFC: Stop MSVC and MSYS from complaining

Adrian Johnson ajohnson at redneon.com
Thu Feb 11 02:36:46 UTC 2016


On 11/02/16 07:19, Simon Richter wrote:
>  - It uses a signed type where the original type was unsigned. "uintptr_t"
>    also exists in the standard, but MSVC does not define it.

uintptr_t is listed here:

https://msdn.microsoft.com/en-us/library/323b6b3k%28v=vs.100%29.aspx

If older versions do not define it we can define it ourselves in
cairo-wideint-type-private.h. We should also fix this file to use
stdint.h on the newer versions of MSVC that support it instead of
defining the fixed size types.

Untested patch attached.

-------------- next part --------------
diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h
index 84a3cba..6b19611 100644
--- a/src/cairo-wideint-type-private.h
+++ b/src/cairo-wideint-type-private.h
@@ -50,14 +50,25 @@
 #elif HAVE_SYS_INT_TYPES_H
 # include <sys/int_types.h>
 #elif defined(_MSC_VER)
-  typedef __int8 int8_t;
-  typedef unsigned __int8 uint8_t;
-  typedef __int16 int16_t;
-  typedef unsigned __int16 uint16_t;
-  typedef __int32 int32_t;
-  typedef unsigned __int32 uint32_t;
-  typedef __int64 int64_t;
-  typedef unsigned __int64 uint64_t;
+# if _MSC_VER >= 1600
+#  include <stdint.h>
+# else
+   typedef __int8 int8_t;
+   typedef unsigned __int8 uint8_t;
+   typedef __int16 int16_t;
+   typedef unsigned __int16 uint16_t;
+   typedef __int32 int32_t;
+   typedef unsigned __int32 uint32_t;
+   typedef __int64 int64_t;
+   typedef unsigned __int64 uint64_t;
+#  ifdef _WIN64
+    typedef int64_t intptr_t
+    typedef uint64_t uintptr_t
+#  else
+    typedef int32_t intptr_t
+    typedef uint32_t uintptr_t
+#  endif
+# endif
 # ifndef HAVE_UINT64_T
 #  define HAVE_UINT64_T 1
 # endif


More information about the cairo mailing list