[dovecot-cvs]
dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.19,
1.20 istream-raw-mbox.h, 1.7, 1.8 mbox-sync.c, 1.67, 1.68
cras at dovecot.org
cras at dovecot.org
Sun Aug 22 15:20:33 EEST 2004
Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv6690/lib-storage/index/mbox
Modified Files:
istream-raw-mbox.c istream-raw-mbox.h mbox-sync.c
Log Message:
istream-raw-mbox now sets stream->eof when it's at the end of message to fix
some issues elsewhere.
Index: istream-raw-mbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- istream-raw-mbox.c 22 Aug 2004 11:08:58 -0000 1.19
+++ istream-raw-mbox.c 22 Aug 2004 12:20:31 -0000 1.20
@@ -17,7 +17,7 @@
uoff_t input_peak_offset;
unsigned int corrupted:1;
- unsigned int eom:1;
+ unsigned int eof:1;
};
static void _close(struct _iostream *stream __attr_unused__)
@@ -122,7 +122,7 @@
i_assert(stream->istream.v_offset >= rstream->from_offset);
- if (rstream->eom) {
+ if (stream->istream.eof) {
if (rstream->body_offset == (uoff_t)-1) {
/* missing \n from headers */
rstream->body_offset =
@@ -167,7 +167,7 @@
stream->buffer = buf;
stream->pos = pos;
- rstream->eom = TRUE;
+ rstream->eof = TRUE;
stream->istream.eof = TRUE;
handle_end_of_mail(rstream, pos);
return ret < 0 ? _read(stream) : ret;
@@ -178,7 +178,7 @@
/* beginning of message, we haven't yet read our From-line */
if (mbox_read_from_line(rstream) < 0) {
stream->pos = 0;
- stream->istream.eof = TRUE;
+ rstream->eof = TRUE;
rstream->corrupted = TRUE;
return -1;
}
@@ -222,7 +222,7 @@
received_time;
i_free(rstream->next_sender);
rstream->next_sender = sender;
- rstream->eom = TRUE;
+ stream->istream.eof = TRUE;
handle_end_of_mail(rstream,
from_start_pos);
@@ -269,7 +269,7 @@
stream->buffer = NULL;
rstream->input_peak_offset = 0;
- rstream->eom = FALSE;
+ rstream->eof = FALSE;
}
struct istream *i_stream_create_raw_mbox(pool_t pool, struct istream *input)
@@ -449,8 +449,8 @@
i_stream_seek(stream, rstream->from_offset);
i_stream_seek(rstream->input, rstream->from_offset);
- rstream->eom = FALSE;
- stream->eof = FALSE;
+ rstream->eof = FALSE;
+ rstream->istream.istream.eof = TRUE;
}
int istream_raw_mbox_seek(struct istream *stream, uoff_t offset)
@@ -460,8 +460,8 @@
int check;
rstream->corrupted = FALSE;
- rstream->eom = FALSE;
- stream->eof = FALSE;
+ rstream->eof = FALSE;
+ rstream->istream.istream.eof = TRUE;
if (rstream->mail_size != (uoff_t)-1 &&
rstream->hdr_offset + rstream->mail_size == offset) {
@@ -509,3 +509,11 @@
rstream->istream.skip = 0;
rstream->istream.pos = 0;
}
+
+int istream_raw_mbox_is_eof(struct istream *stream)
+{
+ struct raw_mbox_istream *rstream =
+ (struct raw_mbox_istream *)stream->real_stream;
+
+ return rstream->eof;
+}
Index: istream-raw-mbox.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- istream-raw-mbox.h 22 Aug 2004 04:00:07 -0000 1.7
+++ istream-raw-mbox.h 22 Aug 2004 12:20:31 -0000 1.8
@@ -36,4 +36,7 @@
/* Flush all buffering. Call if you modify the mbox. */
void istream_raw_mbox_flush(struct istream *stream);
+/* Returns TRUE if we've read the whole mbox. */
+int istream_raw_mbox_is_eof(struct istream *stream);
+
#endif
Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- mbox-sync.c 22 Aug 2004 04:00:07 -0000 1.67
+++ mbox-sync.c 22 Aug 2004 12:20:31 -0000 1.68
@@ -111,7 +111,7 @@
{
/* get EOF */
(void)istream_raw_mbox_get_header_offset(sync_ctx->input);
- if (sync_ctx->input->eof)
+ if (istream_raw_mbox_is_eof(sync_ctx->input))
return 0;
memset(mail_ctx, 0, sizeof(*mail_ctx));
@@ -826,7 +826,7 @@
}
}
- if (sync_ctx->input->eof) {
+ if (istream_raw_mbox_is_eof(sync_ctx->input)) {
/* rest of the messages in index don't exist -> expunge them */
while (sync_ctx->idx_seq <= messages_count)
mail_index_expunge(sync_ctx->t, sync_ctx->idx_seq++);
@@ -841,7 +841,7 @@
uoff_t offset, padding, trailer_size;
int need_rewrite;
- if (!sync_ctx->input->eof) {
+ if (!istream_raw_mbox_is_eof(sync_ctx->input)) {
i_assert(sync_ctx->need_space_seq == 0);
i_assert(sync_ctx->expunged_space == 0);
return 0;
@@ -938,7 +938,7 @@
sizeof(sync_ctx->base_uid_validity));
}
- if (sync_ctx->input->eof &&
+ if (istream_raw_mbox_is_eof(sync_ctx->input) &&
sync_ctx->next_uid != sync_ctx->hdr->next_uid) {
i_assert(sync_ctx->next_uid != 0);
mail_index_update_header(sync_ctx->t,
More information about the dovecot-cvs
mailing list