[cairo-commit] cairo/test cairo_test.c,1.7,1.8
Owen Taylor
commit at pdx.freedesktop.org
Tue Feb 1 21:45:54 PST 2005
- Previous message: [cairo-commit] cairo ChangeLog,1.351,1.352 configure.in,1.79,1.80
- Next message: [cairo-commit] cairo/src Makefile.am, 1.37,
1.38 cairo-win32-private.h, NONE, 1.1 cairo-win32.h, 1.2,
1.3 cairo_win32_font.c, 1.2, 1.3 cairo_win32_surface.c, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: otaylor
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv5813/test
Modified Files:
cairo_test.c
Log Message:
2005-02-02 Owen Taylor <otaylor at redhat.com>
* src/cairo_win32_font.c: Mostly-functioning Win32 font backend;
no glyph paths yet.
* configure.in: 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()
* configure.in: Check for vasnprintf.
* test/cairo_test.c (xasprintf): Add a simple fixed-buffer size
snprintf fallback in the absence of vasnprintf.
Index: cairo_test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo_test.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cairo_test.c 26 Jan 2005 21:41:55 -0000 1.7
+++ cairo_test.c 2 Feb 2005 05:45:52 -0000 1.8
@@ -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 @@
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
- Previous message: [cairo-commit] cairo ChangeLog,1.351,1.352 configure.in,1.79,1.80
- Next message: [cairo-commit] cairo/src Makefile.am, 1.37,
1.38 cairo-win32-private.h, NONE, 1.1 cairo-win32.h, 1.2,
1.3 cairo_win32_font.c, 1.2, 1.3 cairo_win32_surface.c, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list