]> granicus.if.org Git - graphviz/commitdiff
Set output file to binary mode when necessary to make sure Windows
authorerg <devnull@localhost>
Thu, 14 Jun 2007 14:39:49 +0000 (14:39 +0000)
committererg <devnull@localhost>
Thu, 14 Jun 2007 14:39:49 +0000 (14:39 +0000)
does not convert \n to \r\n on stdout. (See gd/gvrender_gd.c.)

plugin/pango/gvrender_pango.c

index f89a229b63566502f4d23a2be95e9822ba863663..7c3f19691cedefa7a3cebb9cb9b1de9bc24110e3 100644 (file)
@@ -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