[dovecot-cvs] dovecot/src/lib istream-seekable.c,1.9,1.10
tss at dovecot.org
tss at dovecot.org
Fri Jan 26 00:43:04 UTC 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv31890
Modified Files:
istream-seekable.c
Log Message:
cleanup
Index: istream-seekable.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream-seekable.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- istream-seekable.c 9 May 2006 09:36:58 -0000 1.9
+++ istream-seekable.c 26 Jan 2007 00:42:29 -0000 1.10
@@ -269,6 +269,8 @@
ssize_t ret;
if (sstream->buffer != NULL) {
+ /* we want to know the full size of the file, so read until
+ we're finished */
old_offset = stream->istream.v_offset;
do {
i_stream_skip(&stream->istream, stream->skip);
@@ -281,11 +283,16 @@
i_stream_seek(&stream->istream, old_offset);
}
- if (sstream->fd_input != NULL)
+ if (sstream->fd_input != NULL) {
+ /* using a file backed buffer, we can use real fstat() */
return i_stream_stat(sstream->fd_input, exact);
+ } else {
+ /* buffer is completely in memory */
+ i_assert(sstream->buffer != NULL);
- stream->statbuf.st_size = sstream->buffer->used;
- return &stream->statbuf;
+ stream->statbuf.st_size = sstream->buffer->used;
+ return &stream->statbuf;
+ }
}
struct istream *
More information about the dovecot-cvs
mailing list