From 67d543716e294f4af330c52dcc9597e16267425e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 27 Feb 2008 20:39:53 -0800 Subject: [PATCH] PS: Fix to never break the final ~> that terminates a base85 stream. This was recently broken in commit 40d5082c24819968a5ee5a8f72e3b9cd61cb6105 which uses a base85-stream but without strings for encapsulating image data. The bug was that the protection for ~> was only being applied to the string encodings rather than all base85 streams. We got lucky recently that the 24.8 change just happened to put the ~> sequence on the line-wrap boundary so the test suite tripped up the bug. Otherwise, we could have missed this for quite some time. --- src/cairo-ps-surface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 03fa4f7c7..dde2aeb9d 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1628,16 +1628,16 @@ _string_array_stream_write (cairo_output_stream_t *base, stream->column++; stream->string_size++; break; - /* Have to also be careful to never split the final ~> sequence. */ - case '~': - _cairo_output_stream_write (stream->output, &c, 1); - stream->column++; - stream->string_size++; - length--; - c = *data++; - break; } } + /* Have to be careful to never split the final ~> sequence. */ + if (c == '~') { + _cairo_output_stream_write (stream->output, &c, 1); + stream->column++; + stream->string_size++; + length--; + c = *data++; + } _cairo_output_stream_write (stream->output, &c, 1); stream->column++; stream->string_size++;