[dovecot-cvs] dovecot/src/lib-index mail-index-update-cache.c,1.11,1.12 mail-index-update.c,1.36,1.37 mail-index-util.c,1.15,1.16 mail-index.h,1.56,1.57

cras at procontrol.fi cras at procontrol.fi
Fri Dec 6 03:09:25 EET 2002


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv6082/lib-index

Modified Files:
	mail-index-update-cache.c mail-index-update.c 
	mail-index-util.c mail-index.h 
Log Message:
Renamed IBuffer and OBuffer to IStream and OStream which describes their
functionality better. I tried to keep the variable names and comments also
sensible.



Index: mail-index-update-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-update-cache.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- mail-index-update-cache.c	1 Dec 2002 14:19:06 -0000	1.11
+++ mail-index-update-cache.c	6 Dec 2002 01:09:22 -0000	1.12
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "mail-index.h"
 
 #include <unistd.h>
@@ -10,12 +10,12 @@
 			MailDataField cache_fields)
 {
 	MailIndexUpdate *update;
-	IBuffer *inbuf;
+	IStream *input;
 	time_t internal_date;
 	int failed, deleted;
 
-	inbuf = index->open_mail(index, rec, &internal_date, &deleted);
-	if (inbuf == NULL)
+	input = index->open_mail(index, rec, &internal_date, &deleted);
+	if (input == NULL)
 		return deleted;
 
 	cache_fields &= ~rec->data_fields;
@@ -23,10 +23,10 @@
 	update = index->update_begin(index, rec);
 	index->update_field_raw(update, DATA_HDR_INTERNAL_DATE,
 				&internal_date, sizeof(internal_date));
-	mail_index_update_headers(update, inbuf, cache_fields, NULL, NULL);
+	mail_index_update_headers(update, input, cache_fields, NULL, NULL);
 	failed = !index->update_end(update);
 
-	i_buffer_unref(inbuf);
+	i_stream_unref(input);
 	return !failed;
 }
 

Index: mail-index-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-update.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mail-index-update.c	1 Dec 2002 14:19:06 -0000	1.36
+++ mail-index-update.c	6 Dec 2002 01:09:22 -0000	1.37
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "ioloop.h"
 #include "rfc822-date.h"
 #include "rfc822-tokenize.h"
@@ -410,7 +410,7 @@
 	}
 }
 
-void mail_index_update_headers(MailIndexUpdate *update, IBuffer *inbuf,
+void mail_index_update_headers(MailIndexUpdate *update, IStream *input,
                                MailDataField cache_fields,
 			       MessageHeaderFunc header_func, void *context)
 {
@@ -452,16 +452,16 @@
 			}
 		}
 
-		start_offset = inbuf->v_offset;
+		start_offset = input->v_offset;
 
 		if (part == NULL) {
-			part = message_parse(pool, inbuf,
+			part = message_parse(pool, input,
 					     update_header_func, &ctx);
 		} else {
 			/* cached, construct the bodystructure using it.
 			   also we need to parse the header.. */
-			i_buffer_seek(inbuf, start_offset);
-			message_parse_header(NULL, inbuf, NULL,
+			i_stream_seek(input, start_offset);
+			message_parse_header(NULL, input, NULL,
 					     update_header_func, &ctx);
 		}
 
@@ -476,9 +476,9 @@
 		    ((update->rec->data_fields | cache_fields) &
 		     DATA_FIELD_BODYSTRUCTURE) == 0) {
 			t_push();
-			i_buffer_seek(inbuf, start_offset);
+			i_stream_seek(input, start_offset);
 			value = imap_part_get_bodystructure(pool, &part,
-							    inbuf, FALSE);
+							    input, FALSE);
 			update->index->update_field(update, DATA_FIELD_BODY,
 						    value, 0);
 			t_pop();
@@ -486,9 +486,9 @@
 
 		if (cache_fields & DATA_FIELD_BODYSTRUCTURE) {
 			t_push();
-			i_buffer_seek(inbuf, start_offset);
+			i_stream_seek(input, start_offset);
 			value = imap_part_get_bodystructure(pool, &part,
-							    inbuf, TRUE);
+							    input, TRUE);
 			update->index->update_field(update,
 						    DATA_FIELD_BODYSTRUCTURE,
 						    value, 0);
@@ -506,10 +506,10 @@
 
 		pool_unref(pool);
 	} else {
-		message_parse_header(NULL, inbuf, &hdr_size,
+		message_parse_header(NULL, input, &hdr_size,
 				     update_header_func, &ctx);
 
-		body_size.physical_size = inbuf->v_limit - inbuf->v_offset;
+		body_size.physical_size = input->v_limit - input->v_offset;
 		if (body_size.physical_size == 0)
                         body_size.virtual_size = 0;
 		else if (update->data_hdr.virtual_size == 0)

Index: mail-index-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-util.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mail-index-util.c	25 Nov 2002 19:02:49 -0000	1.15
+++ mail-index-util.c	6 Dec 2002 01:09:22 -0000	1.16
@@ -1,7 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
-#include "ibuffer.h"
+#include "istream.h"
 #include "hostpid.h"
 #include "file-lock.h"
 #include "message-size.h"

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- mail-index.h	26 Nov 2002 18:47:43 -0000	1.56
+++ mail-index.h	6 Dec 2002 01:09:23 -0000	1.57
@@ -280,11 +280,11 @@
 	   index is opened. */
 	void (*cache_fields_later)(MailIndex *index, MailDataField field);
 
-	/* Open mail file and return it as mmap()ed IBuffer. If we fail,
+	/* Open mail file and return it as mmap()ed IStream. If we fail,
 	   we return NULL and set deleted = TRUE if failure was because the
 	   mail was just deleted (ie. not an error). internal_date is set
 	   if it's non-NULL. */
-	IBuffer *(*open_mail)(MailIndex *index, MailIndexRecord *rec,
+	IStream *(*open_mail)(MailIndex *index, MailIndexRecord *rec,
 			      time_t *internal_date, int *deleted);
 
 	/* Returns internal date of message, or (time_t)-1 if error occured. */
@@ -361,7 +361,7 @@
 
 	char *mbox_path; /* mbox-specific path to the actual mbox file */
 	int mbox_fd;
-	IBuffer *mbox_inbuf;
+	IStream *mbox_stream;
 	MailLockType mbox_lock_type;
 	dev_t mbox_dotlock_dev;
 	ino_t mbox_dotlock_ino;
@@ -470,7 +470,7 @@
 int mail_index_verify_hole_range(MailIndex *index);
 void mail_index_mark_flag_changes(MailIndex *index, MailIndexRecord *rec,
 				  MailFlags old_flags, MailFlags new_flags);
-void mail_index_update_headers(MailIndexUpdate *update, IBuffer *inbuf,
+void mail_index_update_headers(MailIndexUpdate *update, IStream *input,
                                MailDataField cache_fields,
 			       MessageHeaderFunc header_func, void *context);
 int mail_index_update_cache(MailIndex *index);




More information about the dovecot-cvs mailing list