diff --git a/gfx/cairo/README b/gfx/cairo/README index d7d9717ecd9..2439117f32b 100644 --- a/gfx/cairo/README +++ b/gfx/cairo/README @@ -164,6 +164,8 @@ pattern_get_surface-no-error.patch: Don't put a pattern into error if cairo_patt missing-cairo-clip-init.diff: Missing cairo_clip_init call in cairo_gstate_show_text_glyphs lead to crash +fix-cairo-win32-print-gdi-error.diff: Don't use fwprintf with char* format. Flush stderr so that all error messages appears before exit. + ==== pixman patches ==== pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv. diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c index 180e10c095d..0bb1904d84f 100644 --- a/gfx/cairo/cairo/src/cairo-win32-surface.c +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c @@ -100,10 +100,11 @@ _cairo_win32_print_gdi_error (const char *context) 0, NULL)) { fprintf (stderr, "%s: Unknown GDI error", context); } else { - fwprintf (stderr, "%S: %s", context, (char *)lpMsgBuf); + fprintf (stderr, "%s: %S", context, (char *)lpMsgBuf); LocalFree (lpMsgBuf); } + fflush(stderr); /* We should switch off of last_status, but we'd either return * CAIRO_STATUS_NO_MEMORY or CAIRO_STATUS_UNKNOWN_ERROR and there diff --git a/gfx/cairo/fix-cairo-win32-print-gdi-error.diff b/gfx/cairo/fix-cairo-win32-print-gdi-error.diff new file mode 100644 index 00000000000..9387a87af26 --- /dev/null +++ b/gfx/cairo/fix-cairo-win32-print-gdi-error.diff @@ -0,0 +1,26 @@ +diff --git a/gfx/cairo/cairo/src/cairo-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c +--- a/gfx/cairo/cairo/src/cairo-win32-surface.c ++++ b/gfx/cairo/cairo/src/cairo-win32-surface.c +@@ -95,20 +95,21 @@ _cairo_win32_print_gdi_error (const char + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + last_error, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR) &lpMsgBuf, + 0, NULL)) { + fprintf (stderr, "%s: Unknown GDI error", context); + } else { +- fwprintf (stderr, "%S: %s", context, (char *)lpMsgBuf); ++ fprintf (stderr, "%s: %S", context, (char *)lpMsgBuf); + + LocalFree (lpMsgBuf); + } ++ fflush(stderr); + + /* We should switch off of last_status, but we'd either return + * CAIRO_STATUS_NO_MEMORY or CAIRO_STATUS_UNKNOWN_ERROR and there + * is no CAIRO_STATUS_UNKNOWN_ERROR. + */ + + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + }