[gs-cvs] rev 7503 - trunk/gs/src
lpd at ghostscript.com
lpd at ghostscript.com
Wed Dec 13 13:18:20 PST 2006
Author: lpd
Date: 2006-12-13 13:18:20 -0800 (Wed, 13 Dec 2006)
New Revision: 7503
Modified:
trunk/gs/src/stream.c
Log:
Fixes bug: if the source of a ReusableStreamDecode filter was a string, the
filter did not appear to be closed after executing closefile. (PS3 CET
23-12W-6)
Modified: trunk/gs/src/stream.c
===================================================================
--- trunk/gs/src/stream.c 2006-12-13 07:31:41 UTC (rev 7502)
+++ trunk/gs/src/stream.c 2006-12-13 21:18:20 UTC (rev 7503)
@@ -21,6 +21,7 @@
#include "strimpl.h"
/* Forward declarations */
+int s_close_disable(stream *);
private int sreadbuf(stream *, stream_cursor_write *);
private int swritebuf(stream *, stream_cursor_read *, bool);
private void stream_compact(stream *, bool);
@@ -1020,9 +1021,13 @@
void
sread_string_reusable(stream *s, const byte *ptr, uint len)
{
+ /*
+ * Note that s->procs.close is s_close_disable, to parallel
+ * file_close_disable.
+ */
static const stream_procs p = {
s_string_available, s_string_read_seek, s_string_reusable_reset,
- s_string_reusable_flush, s_std_null, s_string_read_process
+ s_string_reusable_flush, s_close_disable, s_string_read_process
};
sread_string(s, ptr, len);
@@ -1238,18 +1243,24 @@
* close procedure for %lineedit and %statementedit. (This is WRONG: these
* streams should allocate a new buffer each time they are opened, but that
* would overstress the allocator right now.) This is exported for ziodev.c.
- * This also replaces the close procedure for the string-reading stream
- * created for gs_run_string.
+ * This also replaces the close procedure for the string-reading streams
+ * created for gs_run_string and for reusable streams.
*/
int
+s_close_disable(stream *s)
+{
+ /* Increment the IDs to prevent further access. */
+ s->read_id = s->write_id = (s->read_id | s->write_id) + 1;
+ return 0;
+}
+int
file_close_disable(stream * s)
{
int code = (*s->save_close)(s);
if (code)
return code;
- /* Increment the IDs to prevent further access. */
- s->read_id = s->write_id = (s->read_id | s->write_id) + 1;
+ s_close_disable(s);
return file_close_finish(s);
}
More information about the gs-cvs
mailing list