]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added i_stream_get_absolute_offset().
authorTimo Sirainen <tss@iki.fi>
Fri, 1 Oct 2010 17:33:19 +0000 (18:33 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 1 Oct 2010 17:33:19 +0000 (18:33 +0100)
src/lib/istream.c
src/lib/istream.h

index 21865b062e8e869d5daa46867cb0b0b03da79df3..3a227eb689901ed4b4607e52a0ea6edde6273b76 100644 (file)
@@ -292,6 +292,11 @@ bool i_stream_is_eof(struct istream *stream)
        return !i_stream_have_bytes_left(stream);
 }
 
+uoff_t i_stream_get_absolute_offset(struct istream *stream)
+{
+       return stream->real_stream->abs_start_offset + stream->v_offset;
+}
+
 static char *i_stream_next_line_finish(struct istream_private *stream, size_t i)
 {
        char *ret;
index dd66b4716534c84bc012fcca08eb83045576bc0a..319036ae00cc6a3561869edab0f1a767ecf98960 100644 (file)
@@ -107,6 +107,9 @@ int i_stream_get_size(struct istream *stream, bool exact, uoff_t *size_r);
 bool i_stream_have_bytes_left(const struct istream *stream) ATTR_PURE;
 /* Returns TRUE if there are no bytes buffered and read() returns EOF. */
 bool i_stream_is_eof(struct istream *stream);
+/* Returns the absolute offset of the stream. This is the stream's current
+   v_offset + the parent's absolute offset when the stream was created. */
+uoff_t i_stream_get_absolute_offset(struct istream *stream);
 
 /* Gets the next line from stream and returns it, or NULL if more data is
    needed to make a full line. i_stream_set_return_partial_line() specifies