From 84e4a825fffe3d78e95dec3406a86da6a23144c2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 15 Oct 2008 22:15:17 +0100 Subject: [PATCH] [output-stream] Accept a NULL filename Principally to support creating a dummy vector surface (i.e. cairo_ps_surface_create (NULL, 1, 1)) that can be used to determine font extents (or target font options) before opening an output file, but also because we currently fail to do any sanity checking at the entry point. --- src/cairo-output-stream.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c index 7062007e4..d02b277f2 100644 --- a/src/cairo-output-stream.c +++ b/src/cairo-output-stream.c @@ -583,6 +583,9 @@ _cairo_output_stream_create_for_filename (const char *filename) stdio_stream_t *stream; FILE *file; + if (filename == NULL) + return _cairo_null_stream_create (); + file = fopen (filename, "wb"); if (file == NULL) { switch (errno) {