[dovecot-cvs]
dovecot/src/lib istream.c, 1.25, 1.26 istream.h, 1.13, 1.14
cras at dovecot.org
cras at dovecot.org
Wed Oct 20 20:03:25 EEST 2004
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv4254
Modified Files:
istream.c istream.h
Log Message:
Added i_stream_have_bytes_left().
Index: istream.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- istream.c 14 Sep 2004 23:58:26 -0000 1.25
+++ istream.c 20 Oct 2004 17:03:23 -0000 1.26
@@ -90,6 +90,13 @@
return _stream->get_size(_stream);
}
+int i_stream_have_bytes_left(struct istream *stream)
+{
+ struct _istream *_stream = stream->real_stream;
+
+ return !stream->eof || _stream->skip != _stream->pos;
+}
+
char *i_stream_next_line(struct istream *stream)
{
struct _istream *_stream = stream->real_stream;
Index: istream.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/istream.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- istream.h 14 Sep 2004 23:58:26 -0000 1.13
+++ istream.h 20 Oct 2004 17:03:23 -0000 1.14
@@ -7,7 +7,8 @@
int stream_errno;
unsigned int mmaped:1; /* be careful when copying data */
unsigned int closed:1;
- unsigned int eof:1;
+ unsigned int eof:1; /* read() has reached to end of file
+ (but may still be data available in buffer) */
struct _istream *real_stream;
};
@@ -49,6 +50,9 @@
void i_stream_seek(struct istream *stream, uoff_t v_offset);
/* Returns size of the stream, or (uoff_t)-1 if unknown */
uoff_t i_stream_get_size(struct istream *stream);
+/* Returns TRUE if there are any bytes left to be read or in buffer. */
+int i_stream_have_bytes_left(struct istream *stream);
+
/* Gets the next line from stream and returns it, or NULL if more data is
needed to make a full line. NOTE: modifies the data in buffer for the \0,
so it works only with buffered streams (currently only file). */
@@ -56,6 +60,7 @@
/* Like i_stream_next_line(), but reads for more data if needed. Returns NULL
if more data is needed or error occured. */
char *i_stream_read_next_line(struct istream *stream);
+
/* Returns pointer to beginning of read data, or NULL if there's no data
buffered. */
const unsigned char *i_stream_get_data(struct istream *stream, size_t *size);
More information about the dovecot-cvs
mailing list