From eb0e79041efda1bb2f1b65d704b922d7688af230 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 21 Aug 2005 14:33:38 +0000 Subject: [PATCH] add stream_setOnCloseProc --- common/memstream.c | 8 ++++++++ common/xwstream.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/common/memstream.c b/common/memstream.c index e3f7aaf04..babc8c203 100644 --- a/common/memstream.c +++ b/common/memstream.c @@ -341,6 +341,12 @@ mem_stream_getVersion( XWStreamCtxt* p_sctx ) return stream->version; } /* mem_stream_getVersion */ +static void +mem_stream_setOnCloseProc( XWStreamCtxt* p_sctx, MemStreamCloseCallback proc ) +{ + MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx; + stream->onClose = proc; +} static XWStreamPos mem_stream_getPos( XWStreamCtxt* p_sctx, PosWhich which ) @@ -427,6 +433,8 @@ make_vtable( MemStreamCtxt* stream ) SET_VTABLE_ENTRY( vtable, stream_setVersion, mem ); SET_VTABLE_ENTRY( vtable, stream_getVersion, mem ); + SET_VTABLE_ENTRY( vtable, stream_setOnCloseProc, mem ); + return vtable; } /* make_vtable */ diff --git a/common/xwstream.h b/common/xwstream.h index 1652c2c6c..2d9c220c9 100644 --- a/common/xwstream.h +++ b/common/xwstream.h @@ -21,6 +21,7 @@ #define _XWSTREAM_H_ #include "comtypes.h" +#include "memstream.h" /* #include "xptypes.h" */ #define START_OF_STREAM 0 @@ -67,6 +68,9 @@ typedef struct StreamCtxVTable { void (*m_stream_setVersion)( XWStreamCtxt* dctx, XP_U16 vers ); XP_U16 (*m_stream_getVersion)( XWStreamCtxt* dctx ); + + void (*m_stream_setOnCloseProc)( XWStreamCtxt* dctx, + MemStreamCloseCallback proc ); } StreamCtxVTable; @@ -141,4 +145,7 @@ struct XWStreamCtxt { #define stream_getVersion(sc) \ (sc)->vtable->m_stream_getVersion((sc)) +#define stream_setOnCloseProc(sc, p) \ + (sc)->vtable->m_stream_setOnCloseProc((sc), (p)) + #endif /* _XWSTREAM_H_ */