From c228fa23f55e716db897ed68fb852ad8e2f11b21 Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 14 Jun 2007 14:39:49 +0000 Subject: [PATCH] Set output file to binary mode when necessary to make sure Windows does not convert \n to \r\n on stdout. (See gd/gvrender_gd.c.) --- plugin/pango/gvrender_pango.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index f89a229b6..7c3f19691 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -215,6 +215,14 @@ static void cairogen_end_page(GVJ_t * job) #ifdef CAIRO_HAS_PNG_FUNCTIONS case FORMAT_PNG: surface = cairo_get_target(cr); +#ifdef HAVE_SETMODE +#ifdef O_BINARY + /* + * Windows will do \n -> \r\n translations on stdout + * unless told otherwise. */ + setmode(fileno(job->output_file), O_BINARY); +#endif +#endif cairo_surface_write_to_png_stream(surface, writer, job->output_file); break; #endif -- 2.40.0