summaryrefslogtreecommitdiff
path: root/test/cairo_test.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-02-01 21:45:51 +0000
committerOwen Taylor <otaylor@redhat.com>2005-02-01 21:45:51 +0000
commit199c41dafee1559570c250d22a97dc1667d657f3 (patch)
treeb4bd2c52ea1d267d326efbd3b807d5037e559187 /test/cairo_test.c
parent211d115f1835e1f724709a2b8b55ab203326fa9a (diff)
Mostly-functioning Win32 font backend; no glyph paths yet.
Turn on building of the Win32 font backend. src/cairo-win32-private.h src/Makefile.am: Private header for the Win32 backend. src/cairo-win32-private.h src/cairo_win32_surface.c: Internally export _cairo_win32_print_gdi_error() for use in the font code. src/cairo-win32-private.h src/cairo_win32_surface.c: Add _cairo_win32_surface_create_dib to create a DIB surface. src/cairo-win32-private.h src/cairo_win32_surface.c: Add _cairo_surface_is_win32() Check for vasnprintf. Add a simple fixed-buffer size snprintf fallback in the absence of vasnprintf.
Diffstat (limited to 'test/cairo_test.c')
-rw-r--r--test/cairo_test.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/cairo_test.c b/test/cairo_test.c
index 978404d18..c1800ed43 100644
--- a/test/cairo_test.c
+++ b/test/cairo_test.c
@@ -44,9 +44,10 @@
static void
xasprintf (char **strp, const char *fmt, ...)
{
+#ifdef HAVE_VASPRINTF
va_list va;
int ret;
-
+
va_start (va, fmt);
ret = vasprintf (strp, fmt, va);
va_end (va);
@@ -55,6 +56,32 @@ xasprintf (char **strp, const char *fmt, ...)
fprintf (stderr, "Out of memory\n");
exit (1);
}
+#else /* !HAVE_VASNPRINTF */
+#define BUF_SIZE 1024
+ va_list va;
+ char buffer[BUF_SIZE];
+ int ret;
+
+ va_start (va, fmt);
+ ret = vsnprintf (buffer, sizeof(buffer), fmt, va);
+ va_end (va);
+
+ if (ret < 0) {
+ fprintf (stderr, "Failure in vsnprintf\n");
+ exit (1);
+ }
+
+ if (strlen (buffer) == sizeof(buffer) - 1) {
+ fprintf (stderr, "Overflowed fixed buffer\n");
+ exit (1);
+ }
+
+ *strp = strdup (buffer);
+ if (!*strp) {
+ fprintf (stderr, "Out of memory\n");
+ exit (1);
+ }
+#endif /* !HAVE_VASNPRINTF */
}
cairo_test_status_t