Patch from John Ehresman <jpe@wingide.com> to aid win32 compilation:

Define snprintf as _snprintf when under the influence of _MSC_VER.
Define int32_t and friends as __int32 and friends when under the influence of _MSC_VER.
Make include of unistd.h conditional on HAVE_UNISTD_H.
This commit is contained in:
Carl Worth 2005-08-05 07:48:18 +00:00
parent fd27af574d
commit 0586daaa29
6 changed files with 54 additions and 2 deletions

View file

@ -1,3 +1,19 @@
2005-08-05 Carl Worth <cworth@cworth.org>
Patch from John Ehresman <jpe@wingide.com> to aid win32
compilation:
* src/cairo-output-stream.c: Define snprintf as _snprintf when
under the influence of _MSC_VER.
* test/read-png.c: (read_png_argb32):
* src/cairo-wideint.h: Define int32_t and friends as __int32 and
friends when under the influence of _MSC_VER.
* test/buffer-diff.c:
* test/cairo-test.c: Make include of unistd.h conditional on
HAVE_UNISTD_H.
2005-08-05 Kristian Høgsberg <krh@redhat.com>
Patch from Adrian Johnson <ajohnson@redneon.com>

View file

@ -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;

View file

@ -1,5 +1,5 @@
/*
* $Id: cairo-wideint.h,v 1.11 2005-07-30 19:57:54 keithp Exp $
* $Id: cairo-wideint.h,v 1.12 2005-08-05 14:48:19 cworth Exp $
*
* Copyright © 2004 Keith Packard
*
@ -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

View file

@ -24,7 +24,9 @@
* Author: Richard D. Worth <richard@theworths.org> */
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <string.h>

View file

@ -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>
#include <fontconfig/fontconfig.h>
@ -38,6 +40,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"

View file

@ -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 *filename,
{
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;