diff options
Diffstat (limited to 'gfx/cairo/cairo/src/cairo-output-stream.c')
-rw-r--r-- | gfx/cairo/cairo/src/cairo-output-stream.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/gfx/cairo/cairo/src/cairo-output-stream.c b/gfx/cairo/cairo/src/cairo-output-stream.c index 935fa44c33..7305b52ca2 100644 --- a/gfx/cairo/cairo/src/cairo-output-stream.c +++ b/gfx/cairo/cairo/src/cairo-output-stream.c @@ -1,3 +1,4 @@ +/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */ /* cairo-output-stream.c: Output stream abstraction * * Copyright © 2005 Red Hat, Inc @@ -258,11 +259,13 @@ void _cairo_output_stream_write (cairo_output_stream_t *stream, const void *data, size_t length) { - if (length == 0) + if (length == 0 || stream->status) return; - if (stream->status) + if (stream->closed) { + stream->status = CAIRO_STATUS_WRITE_ERROR; return; + } stream->status = stream->write_func (stream, data, length); stream->position += length; @@ -277,9 +280,6 @@ _cairo_output_stream_write_hex_string (cairo_output_stream_t *stream, char buffer[2]; unsigned int i, column; - if (stream->status) - return; - for (i = 0, column = 0; i < length; i++, column++) { if (column == 38) { _cairo_output_stream_write (stream, "\n", 1); @@ -382,7 +382,8 @@ _cairo_dtostr (char *buffer, size_t size, double d, cairo_bool_t limited_precisi } enum { - LENGTH_MODIFIER_LONG = 0x100 + LENGTH_MODIFIER_LONG = 0x100, + LENGTH_MODIFIER_LONG_LONG = 0x200 }; /* Here's a limited reimplementation of printf. The reason for doing @@ -405,9 +406,6 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream, int length_modifier, width; cairo_bool_t var_width; - if (stream->status) - return; - f = fmt; p = buffer; while (*f != '\0') { @@ -440,6 +438,10 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream, if (*f == 'l') { length_modifier = LENGTH_MODIFIER_LONG; f++; + if (*f == 'l') { + length_modifier = LENGTH_MODIFIER_LONG_LONG; + f++; + } } /* The only format strings exist in the cairo implementation @@ -490,6 +492,20 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream, single_fmt, va_arg (ap, long int)); } break; + case 'd' | LENGTH_MODIFIER_LONG_LONG: + case 'u' | LENGTH_MODIFIER_LONG_LONG: + case 'o' | LENGTH_MODIFIER_LONG_LONG: + case 'x' | LENGTH_MODIFIER_LONG_LONG: + case 'X' | LENGTH_MODIFIER_LONG_LONG: + if (var_width) { + width = va_arg (ap, int); + snprintf (buffer, sizeof buffer, + single_fmt, width, va_arg (ap, long long int)); + } else { + snprintf (buffer, sizeof buffer, + single_fmt, va_arg (ap, long long int)); + } + break; case 's': { /* Write out strings as they may be larger than the buffer. */ const char *s = va_arg (ap, const char *); @@ -570,7 +586,7 @@ _cairo_output_stream_print_matrix (cairo_output_stream_t *stream, m.xx, m.yx, m.xy, m.yy, m.x0, m.y0); } -long +long long _cairo_output_stream_get_position (cairo_output_stream_t *stream) { return stream->position; @@ -766,9 +782,6 @@ _cairo_memory_stream_copy (cairo_output_stream_t *base, { memory_stream_t *stream = (memory_stream_t *) base; - if (dest->status) - return; - if (base->status) { dest->status = base->status; return; |