[dovecot-cvs] dovecot/src/lib istream-data.c, 1.10, 1.11 istream-file.c, 1.21, 1.22 istream-limit.c, 1.11, 1.12 istream-mmap.c, 1.14, 1.15 istream.h, 1.14, 1.15

cras at dovecot.org cras at dovecot.org
Mon Mar 28 16:06:46 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv5853/lib

Modified Files:
	istream-data.c istream-file.c istream-limit.c istream-mmap.c 
	istream.h 
Log Message:
Added seekable variable to struct istream.



Index: istream-data.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-data.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- istream-data.c	22 Aug 2004 04:00:06 -0000	1.10
+++ istream-data.c	28 Mar 2005 13:06:43 -0000	1.11
@@ -50,5 +50,6 @@
 	stream->seek = _seek;
 	stream->get_size = _get_size;
 
+	stream->istream.seekable = TRUE;
 	return _i_stream_create(stream, pool, -1, 0);
 }

Index: istream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-file.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- istream-file.c	27 Mar 2005 13:51:54 -0000	1.21
+++ istream-file.c	28 Mar 2005 13:06:43 -0000	1.22
@@ -160,7 +160,7 @@
 {
 	struct file_istream *fstream = (struct file_istream *) stream;
 
-	if (!fstream->file) {
+	if (!stream->istream.seekable) {
 		if (v_offset < stream->istream.v_offset) {
 			stream->istream.stream_errno = ESPIPE;
 			return;
@@ -203,8 +203,10 @@
 	fstream->istream.get_size = _get_size;
 
 	/* get size of fd if it's a file */
-	if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode))
+	if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
 		fstream->file = TRUE;
+		fstream->istream.istream.seekable = TRUE;
+	}
 
 	return _i_stream_create(&fstream->istream, pool, fd, 0);
 }

Index: istream-limit.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-limit.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- istream-limit.c	16 Dec 2004 01:37:20 -0000	1.11
+++ istream-limit.c	28 Mar 2005 13:06:43 -0000	1.12
@@ -122,6 +122,7 @@
 	lstream->istream.seek = _seek;
 	lstream->istream.get_size = _get_size;
 
+	lstream->istream.istream.seekable = input->seekable;
 	return _i_stream_create(&lstream->istream, pool, i_stream_get_fd(input),
 				input->real_stream->abs_start_offset +
 				v_start_offset);

Index: istream-mmap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-mmap.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- istream-mmap.c	22 Aug 2004 06:30:13 -0000	1.14
+++ istream-mmap.c	28 Mar 2005 13:06:43 -0000	1.15
@@ -202,5 +202,6 @@
 
 	istream = _i_stream_create(&mstream->istream, pool, fd, start_offset);
 	istream->mmaped = TRUE;
+	istream->seekable = TRUE;
 	return istream;
 }

Index: istream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- istream.h	20 Oct 2004 17:03:23 -0000	1.14
+++ istream.h	28 Mar 2005 13:06:43 -0000	1.15
@@ -7,6 +7,7 @@
 	int stream_errno;
 	unsigned int mmaped:1; /* be careful when copying data */
 	unsigned int closed:1;
+	unsigned int seekable:1; /* we can seek() backwards */
 	unsigned int eof:1; /* read() has reached to end of file
 	                       (but may still be data available in buffer) */
 



More information about the dovecot-cvs mailing list