changeset 1027:29f09c05945d HEAD

More type safety to i/o streams
author Timo Sirainen <tss@iki.fi>
date Thu, 23 Jan 2003 21:08:53 +0200
parents e147dcbb2ba6
children b26b83f30f65
files src/lib/istream.c src/lib/istream.h src/lib/ostream.c src/lib/ostream.h
diffstat 4 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream.c	Thu Jan 23 21:02:10 2003 +0200
+++ b/src/lib/istream.c	Thu Jan 23 21:08:53 2003 +0200
@@ -28,12 +28,12 @@
 
 void i_stream_ref(struct istream *stream)
 {
-	_io_stream_ref(stream->real_stream);
+	_io_stream_ref(&stream->real_stream->iostream);
 }
 
 void i_stream_unref(struct istream *stream)
 {
-	_io_stream_unref(stream->real_stream);
+	_io_stream_unref(&stream->real_stream->iostream);
 }
 
 int i_stream_get_fd(struct istream *stream)
@@ -45,19 +45,20 @@
 
 void i_stream_close(struct istream *stream)
 {
-	_io_stream_close(stream->real_stream);
+	_io_stream_close(&stream->real_stream->iostream);
 	stream->closed = TRUE;
 }
 
 void i_stream_set_max_buffer_size(struct istream *stream, size_t max_size)
 {
-	_io_stream_set_max_buffer_size(stream->real_stream, max_size);
+	_io_stream_set_max_buffer_size(&stream->real_stream->iostream,
+				       max_size);
 }
 
 void i_stream_set_blocking(struct istream *stream, int timeout_msecs,
 			   void (*timeout_cb)(void *), void *context)
 {
-	_io_stream_set_blocking(stream->real_stream, timeout_msecs,
+	_io_stream_set_blocking(&stream->real_stream->iostream, timeout_msecs,
 				timeout_cb, context);
 }
 
--- a/src/lib/istream.h	Thu Jan 23 21:02:10 2003 +0200
+++ b/src/lib/istream.h	Thu Jan 23 21:08:53 2003 +0200
@@ -8,7 +8,7 @@
 	int stream_errno;
 	unsigned int closed:1;
 
-	void *real_stream;
+	struct _istream *real_stream;
 };
 
 struct istream *i_stream_create_file(int fd, pool_t pool,
--- a/src/lib/ostream.c	Thu Jan 23 21:02:10 2003 +0200
+++ b/src/lib/ostream.c	Thu Jan 23 21:08:53 2003 +0200
@@ -29,29 +29,30 @@
 
 void o_stream_ref(struct ostream *stream)
 {
-	_io_stream_ref(stream->real_stream);
+	_io_stream_ref(&stream->real_stream->iostream);
 }
 
 void o_stream_unref(struct ostream *stream)
 {
-	_io_stream_unref(stream->real_stream);
+	_io_stream_unref(&stream->real_stream->iostream);
 }
 
 void o_stream_close(struct ostream *stream)
 {
-	_io_stream_close(stream->real_stream);
+	_io_stream_close(&stream->real_stream->iostream);
 	stream->closed = TRUE;
 }
 
 void o_stream_set_max_buffer_size(struct ostream *stream, size_t max_size)
 {
-	_io_stream_set_max_buffer_size(stream->real_stream, max_size);
+	_io_stream_set_max_buffer_size(&stream->real_stream->iostream,
+				       max_size);
 }
 
 void o_stream_set_blocking(struct ostream *stream, int timeout_msecs,
 			   void (*timeout_cb)(void *), void *context)
 {
-	_io_stream_set_blocking(stream->real_stream, timeout_msecs,
+	_io_stream_set_blocking(&stream->real_stream->iostream, timeout_msecs,
 				timeout_cb, context);
 }
 
--- a/src/lib/ostream.h	Thu Jan 23 21:02:10 2003 +0200
+++ b/src/lib/ostream.h	Thu Jan 23 21:08:53 2003 +0200
@@ -7,7 +7,7 @@
 	int stream_errno;
 	unsigned int closed:1;
 
-	void *real_stream;
+	struct _ostream *real_stream;
 };
 
 struct ostream *