diff options
-rw-r--r-- | gs/base/gxclmem.c | 15 | ||||
-rw-r--r-- | gs/base/gxclread.c | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/gs/base/gxclmem.c b/gs/base/gxclmem.c index 0445b6448..dbc1ba5bb 100644 --- a/gs/base/gxclmem.c +++ b/gs/base/gxclmem.c | |||
@@ -803,19 +803,18 @@ memfile_fwrite_chars(const void *data, uint len, clist_file_ptr cf) | |||
803 | while (count) { | 803 | while (count) { |
804 | uint move_count = f->pdata_end - f->pdata; | 804 | uint move_count = f->pdata_end - f->pdata; |
805 | 805 | ||
806 | if (move_count == 0) { | 806 | if (move_count > count) |
807 | move_count = count; | ||
808 | memmove(f->pdata, str, move_count); | ||
809 | f->pdata += move_count; | ||
810 | str += move_count; | ||
811 | count -= move_count; | ||
812 | if (f->pdata == f->pdata_end) { | ||
807 | if ((ecode = memfile_next_blk(f)) != 0) { | 813 | if ((ecode = memfile_next_blk(f)) != 0) { |
808 | f->error_code = ecode; | 814 | f->error_code = ecode; |
809 | if (ecode < 0) | 815 | if (ecode < 0) |
810 | return 0; | 816 | return 0; |
811 | } | 817 | } |
812 | } else { | ||
813 | if (move_count > count) | ||
814 | move_count = count; | ||
815 | memmove(f->pdata, str, move_count); | ||
816 | f->pdata += move_count; | ||
817 | str += move_count; | ||
818 | count -= move_count; | ||
819 | } | 818 | } |
820 | } | 819 | } |
821 | f->log_curr_pos += len; | 820 | f->log_curr_pos += len; |
diff --git a/gs/base/gxclread.c b/gs/base/gxclread.c index 4d4bc6d46..7b840f66f 100644 --- a/gs/base/gxclread.c +++ b/gs/base/gxclread.c | |||
@@ -350,8 +350,12 @@ clist_close_writer_and_init_reader(gx_device_clist *cldev) | |||
350 | if (code < 0) | 350 | if (code < 0) |
351 | return code; | 351 | return code; |
352 | code = clist_render_init(cldev); | 352 | code = clist_render_init(cldev); |
353 | if (code < 0) | ||
354 | return code; | ||
353 | /* Check for and get ICC profile table */ | 355 | /* Check for and get ICC profile table */ |
354 | code = clist_read_icctable(crdev); | 356 | code = clist_read_icctable(crdev); |
357 | if (code < 0) | ||
358 | return code; | ||
355 | /* Allocate the icc cache for the clist reader */ | 359 | /* Allocate the icc cache for the clist reader */ |
356 | /* Since we may be rendering in multiple threads, make sure the memory */ | 360 | /* Since we may be rendering in multiple threads, make sure the memory */ |
357 | /* is thread safe by using a known thread_safe memory allocator */ | 361 | /* is thread safe by using a known thread_safe memory allocator */ |