[cairo] Patch to compile w/ VC++ 6
John Ehresman
jpe at wingide.com
Fri Jul 8 14:52:23 PDT 2005
Attached are patches to compile libpixman & cairo using VC++ version 6,
which I've used to build a library that pango & gtk can use. I haven't
defined the threading support yet because I'm only working with a single
threaded application.
John
-------------- next part --------------
Index: src/icint.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/icint.h,v
retrieving revision 1.34
diff -u -p -r1.34 icint.h
--- src/icint.h 25 Jun 2005 22:03:17 -0000 1.34
+++ src/icint.h 5 Jul 2005 22:51:24 -0000
@@ -999,7 +999,7 @@ int PictureParseCmapPolicy (const char *
/* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
-#ifdef WIN32
+#if defined(WIN32) || defined(_WIN32)
typedef __int64 xFixed_32_32;
#else
# if defined(__alpha__) || defined(__alpha) || \
Index: src/pixman.h
===================================================================
RCS file: /cvs/cairo/libpixman/src/pixman.h,v
retrieving revision 1.21
diff -u -p -r1.21 pixman.h
--- src/pixman.h 25 Jun 2005 01:21:16 -0000 1.21
+++ src/pixman.h 8 Jul 2005 21:12:52 -0000
@@ -83,12 +83,19 @@ SOFTWARE.
#if defined (__SVR4) && defined (__sun)
# include <sys/int_types.h>
+#elif defined (__OpenBSD__) || defined (_AIX)
+# include <inttypes.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;
#else
-# if defined (__OpenBSD__) || defined (_AIX)
-# include <inttypes.h>
-# else
-# include <stdint.h>
-# endif
+# include <stdint.h>
#endif
-------------- next part --------------
Index: src/cairo-output-stream.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-output-stream.c,v
retrieving revision 1.7
diff -u -p -r1.7 cairo-output-stream.c
--- src/cairo-output-stream.c 1 Jul 2005 19:45:35 -0000 1.7
+++ src/cairo-output-stream.c 8 Jul 2005 20:32:18 -0000
@@ -39,6 +39,10 @@
#include <ctype.h>
#include "cairoint.h"
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif /* _MSC_VER */
+
struct _cairo_output_stream {
cairo_write_func_t write_data;
void *closure;
Index: src/cairo-wideint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-wideint.h,v
retrieving revision 1.10
diff -u -p -r1.10 cairo-wideint.h
--- src/cairo-wideint.h 10 May 2005 19:42:32 -0000 1.10
+++ src/cairo-wideint.h 5 Jul 2005 23:27:02 -0000
@@ -44,6 +44,18 @@
# include <inttypes.h>
#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;
+# ifndef HAVE_UINT64_T
+# define HAVE_UINT64_T 1
+# endif
#else
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
#endif
Index: src/cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.161
diff -u -p -r1.161 cairoint.h
--- src/cairoint.h 8 Jul 2005 17:12:29 -0000 1.161
+++ src/cairoint.h 8 Jul 2005 21:44:33 -0000
@@ -128,7 +128,9 @@
#endif
#ifndef CAIRO_MUTEX_DECLARE
+#ifndef _MSC_VER
#warning "No mutex declarations, assuming single-threaded code"
+#endif
#define CAIRO_MUTEX_DECLARE(name)
#define CAIRO_MUTEX_DECLARE_GLOBAL(name)
#define CAIRO_MUTEX_LOCK(name)
@@ -146,6 +148,10 @@
#define TRUE 1
#endif
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif /* M_PI */
+
#define ASSERT_NOT_REACHED \
do { \
static const int NOT_REACHED = 0; \
Index: test/buffer-diff.c
===================================================================
RCS file: /cvs/cairo/cairo/test/buffer-diff.c,v
retrieving revision 1.5
diff -u -p -r1.5 buffer-diff.c
--- test/buffer-diff.c 11 May 2005 03:25:38 -0000 1.5
+++ test/buffer-diff.c 5 Jul 2005 23:35:46 -0000
@@ -24,7 +24,9 @@
* Author: Richard D. Worth <richard at theworths.org> */
#include <stdio.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include <string.h>
Index: test/cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.38
diff -u -p -r1.38 cairo-test.c
--- test/cairo-test.c 15 Jun 2005 17:58:52 -0000 1.38
+++ test/cairo-test.c 8 Jul 2005 20:49:44 -0000
@@ -26,7 +26,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <errno.h>
#include <string.h>
@@ -37,6 +39,10 @@
#include "write-png.h"
#include "xmalloc.h"
+#ifdef _MSC_VER
+#define vsnprintf _vsnprintf
+#endif
+
#define CAIRO_TEST_LOG_SUFFIX ".log"
#define CAIRO_TEST_PNG_SUFFIX "-out.png"
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
Index: test/cairo-test.h
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.h,v
retrieving revision 1.10
diff -u -p -r1.10 cairo-test.h
--- test/cairo-test.h 14 May 2005 21:01:46 -0000 1.10
+++ test/cairo-test.h 8 Jul 2005 20:55:21 -0000
@@ -61,5 +61,9 @@ cairo_test_log (const char *fmt, ...);
void
xasprintf (char **strp, const char *fmt, ...);
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif /* M_PI */
+
#endif
Index: test/read-png.c
===================================================================
RCS file: /cvs/cairo/cairo/test/read-png.c,v
retrieving revision 1.6
diff -u -p -r1.6 read-png.c
--- test/read-png.c 11 May 2005 03:25:38 -0000 1.6
+++ test/read-png.c 6 Jul 2005 03:56:34 -0000
@@ -35,6 +35,18 @@
# include <inttypes.h>
#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;
+# ifndef HAVE_UINT64_T
+# define HAVE_UINT64_T 1
+# endif
#else
#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
#endif
@@ -79,7 +91,7 @@ read_png_argb32 (const char *fil
{
int i;
FILE *file;
- static const int PNG_SIG_SIZE = 8;
+#define PNG_SIG_SIZE 8
unsigned char png_sig[PNG_SIG_SIZE];
int sig_bytes;
png_struct *png;
More information about the cairo
mailing list