summaryrefslogtreecommitdiff
path: root/src/cairo-output-stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-output-stream.c')
-rw-r--r--src/cairo-output-stream.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 826c9cf8e..7305b52ca 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -259,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;
@@ -278,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);
@@ -407,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') {
@@ -786,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;