[dovecot-cvs] dovecot/src/lib-index/mbox mbox-append.c,1.36,1.37 mbox-from.c,1.9,1.10 mbox-index.c,1.58,1.59 mbox-index.h,1.22,1.23 mbox-lock.c,1.21,1.22 mbox-lock.h,1.4,1.5 mbox-open.c,1.19,1.20 mbox-rebuild.c,1.21,1.22 mbox-rewrite.c,1.49,1.50 Message-Id: <20030105130956.46D5023994@danu.procontrol.fi>

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 15:09:56 EET 2003


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

Modified Files:
	mbox-append.c mbox-from.c mbox-index.c mbox-index.h 
	mbox-lock.c mbox-lock.h mbox-open.c mbox-rebuild.c 
	mbox-rewrite.c mbox-sync-full.c mbox-sync.c 
Log Message:
Naming style changes, finally got tired of most of the typedefs. Also the
previous enum -> macro change reverted so that we don't use the highest bit
anymore, that's incompatible with old indexes so they will be rebuilt.



Index: mbox-append.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-append.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mbox-append.c	4 Jan 2003 17:26:30 -0000	1.36
+++ mbox-append.c	5 Jan 2003 13:09:52 -0000	1.37
@@ -8,11 +8,12 @@
 #include "mbox-index.h"
 #include "mail-index-util.h"
 
-static int mbox_index_append_next(MailIndex *index, IStream *input)
+static int mbox_index_append_next(struct mail_index *index,
+				  struct istream *input)
 {
-	MailIndexRecord *rec;
-	MailIndexUpdate *update;
-        MboxHeaderContext ctx;
+	struct mail_index_record *rec;
+	struct mail_index_update *update;
+        struct mbox_header_context ctx;
 	time_t internal_date;
 	uoff_t abs_start_offset, eoh_offset;
 	const unsigned char *data;
@@ -110,7 +111,7 @@
 	return !failed;
 }
 
-int mbox_index_append(MailIndex *index, IStream *input)
+int mbox_index_append(struct mail_index *index, struct istream *input)
 {
 	int ret;
 

Index: mbox-from.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-from.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mbox-from.c	4 Jan 2003 17:26:30 -0000	1.9
+++ mbox-from.c	5 Jan 2003 13:09:52 -0000	1.10
@@ -94,7 +94,7 @@
 
 const char *mbox_from_create(const char *sender, time_t time)
 {
-	String *str;
+	string_t *str;
 	struct tm *tm;
 	int year;
 

Index: mbox-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-index.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- mbox-index.c	4 Jan 2003 17:26:30 -0000	1.58
+++ mbox-index.c	5 Jan 2003 13:09:52 -0000	1.59
@@ -16,9 +16,9 @@
 /* Don't try reading more custom flags than this. */
 #define MAX_CUSTOM_FLAGS 1024
 
-extern MailIndex mbox_index;
+extern struct mail_index mbox_index;
 
-int mbox_set_syscall_error(MailIndex *index, const char *function)
+int mbox_set_syscall_error(struct mail_index *index, const char *function)
 {
 	i_assert(function != NULL);
 
@@ -27,7 +27,7 @@
 	return FALSE;
 }
 
-int mbox_file_open(MailIndex *index)
+int mbox_file_open(struct mail_index *index)
 {
 	struct stat st;
 	int fd;
@@ -52,8 +52,8 @@
 	return TRUE;
 }
 
-IStream *mbox_get_stream(MailIndex *index, uoff_t offset,
-			 MailLockType lock_type)
+struct istream *mbox_get_stream(struct mail_index *index, uoff_t offset,
+				enum mail_lock_type lock_type)
 {
 	i_assert(offset < OFF_T_MAX);
 
@@ -104,7 +104,7 @@
 	return index->mbox_stream;
 }
 
-void mbox_file_close_stream(MailIndex *index)
+void mbox_file_close_stream(struct mail_index *index)
 {
 	if (index->mbox_stream != NULL) {
 		i_stream_close(index->mbox_stream);
@@ -113,7 +113,7 @@
 	}
 }
 
-void mbox_file_close_fd(MailIndex *index)
+void mbox_file_close_fd(struct mail_index *index)
 {
 	mbox_file_close_stream(index);
 
@@ -124,10 +124,11 @@
 	}
 }
 
-void mbox_header_init_context(MboxHeaderContext *ctx, MailIndex *index,
-			      IStream *input)
+void mbox_header_init_context(struct mbox_header_context *ctx,
+			      struct mail_index *index,
+			      struct istream *input)
 {
-	memset(ctx, 0, sizeof(MboxHeaderContext));
+	memset(ctx, 0, sizeof(struct mbox_header_context));
 	md5_init(&ctx->md5);
 
 	ctx->index = index;
@@ -135,13 +136,14 @@
 	ctx->custom_flags = mail_custom_flags_list_get(index->custom_flags);
 }
 
-void mbox_header_free_context(MboxHeaderContext *ctx __attr_unused__)
+void mbox_header_free_context(struct mbox_header_context *ctx __attr_unused__)
 {
 }
 
-static MailFlags mbox_get_status_flags(const unsigned char *value, size_t len)
+static enum mail_flags
+mbox_get_status_flags(const unsigned char *value, size_t len)
 {
-	MailFlags flags;
+	enum mail_flags flags;
 	size_t i;
 
 	flags = 0;
@@ -172,17 +174,17 @@
 				     size_t len __attr_unused__,
 				     int index, void *context)
 {
-	MailFlags *flags = context;
+	enum mail_flags *flags = context;
 
 	if (index >= 0)
 		*flags |= 1 << (index + MAIL_CUSTOM_FLAG_1_BIT);
 }
 
-static MailFlags
+static enum mail_flags
 mbox_get_keyword_flags(const unsigned char *value, size_t len,
 		       const char *custom_flags[MAIL_CUSTOM_FLAGS_COUNT])
 {
-	MailFlags flags;
+	enum mail_flags flags;
 
 	flags = 0;
 	mbox_keywords_parse(value, len, custom_flags,
@@ -191,12 +193,12 @@
 }
 
 static int mbox_parse_imapbase(const unsigned char *value, size_t len,
-			       MboxHeaderContext *ctx)
+			       struct mbox_header_context *ctx)
 {
 	const char **flag;
-	Buffer *buf;
+	buffer_t *buf;
 	size_t pos, start;
-	MailFlags flags;
+	enum mail_flags flags;
 	unsigned int count;
 	int ret, spaces;
 
@@ -246,12 +248,12 @@
 	return ret > 0;
 }
 
-void mbox_header_func(MessagePart *part __attr_unused__,
+void mbox_header_func(struct message_part *part __attr_unused__,
 		      const unsigned char *name, size_t name_len,
 		      const unsigned char *value, size_t value_len,
 		      void *context)
 {
-	MboxHeaderContext *ctx = context;
+	struct mbox_header_context *ctx = context;
 	uoff_t start_offset, end_offset;
 	size_t i;
 	int fixed = FALSE;
@@ -425,7 +427,7 @@
 	}
 }
 
-int mbox_skip_crlf(IStream *input)
+int mbox_skip_crlf(struct istream *input)
 {
 	const unsigned char *data;
 	size_t size, pos;
@@ -456,7 +458,7 @@
 	return TRUE;
 }
 
-void mbox_skip_empty_lines(IStream *input)
+void mbox_skip_empty_lines(struct istream *input)
 {
 	const unsigned char *data;
 	size_t i, size;
@@ -475,7 +477,7 @@
 	}
 }
 
-static int mbox_is_valid_from(IStream *input, size_t startpos)
+static int mbox_is_valid_from(struct istream *input, size_t startpos)
 {
 	const unsigned char *msg;
 	size_t i, size;
@@ -495,7 +497,7 @@
 	return FALSE;
 }
 
-static void mbox_skip_forward(IStream *input, int header)
+static void mbox_skip_forward(struct istream *input, int header)
 {
 	const unsigned char *msg;
 	size_t i, size, startpos, eoh;
@@ -614,17 +616,17 @@
 	i_stream_skip(input, startpos);
 }
 
-void mbox_skip_header(IStream *input)
+void mbox_skip_header(struct istream *input)
 {
 	mbox_skip_forward(input, TRUE);
 }
 
-void mbox_skip_message(IStream *input)
+void mbox_skip_message(struct istream *input)
 {
 	mbox_skip_forward(input, FALSE);
 }
 
-int mbox_verify_end_of_body(IStream *input, uoff_t end_offset)
+int mbox_verify_end_of_body(struct istream *input, uoff_t end_offset)
 {
 	const unsigned char *data;
 	size_t size;
@@ -662,10 +664,11 @@
 		(size >= 5 && strncmp((const char *) data, "From ", 5) == 0);
 }
 
-int mbox_mail_get_location(MailIndex *index, MailIndexRecord *rec,
+int mbox_mail_get_location(struct mail_index *index,
+			   struct mail_index_record *rec,
 			   uoff_t *offset, uoff_t *hdr_size, uoff_t *body_size)
 {
-	MailIndexDataRecordHeader *data_hdr;
+	struct mail_index_data_record_header *data_hdr;
 	const uoff_t *location;
 	size_t size;
 
@@ -716,14 +719,14 @@
 	return TRUE;
 }
 
-MailIndex *mbox_index_alloc(const char *dir, const char *mbox_path)
+struct mail_index *mbox_index_alloc(const char *dir, const char *mbox_path)
 {
-	MailIndex *index;
+	struct mail_index *index;
 
 	i_assert(dir != NULL);
 
-	index = i_new(MailIndex, 1);
-	memcpy(index, &mbox_index, sizeof(MailIndex));
+	index = i_new(struct mail_index, 1);
+	memcpy(index, &mbox_index, sizeof(struct mail_index));
 
 	index->mbox_fd = -1;
 	index->mbox_sync_counter = (unsigned int)-1;
@@ -733,7 +736,7 @@
 	return index;
 }
 
-static void mbox_index_free(MailIndex *index)
+static void mbox_index_free(struct mail_index *index)
 {
         mbox_file_close_fd(index);
 	mail_index_close(index);
@@ -742,21 +745,24 @@
 	i_free(index);
 }
 
-static int mbox_index_set_lock(MailIndex *index, MailLockType lock_type)
+static int mbox_index_set_lock(struct mail_index *index,
+			       enum mail_lock_type lock_type)
 {
 	if (lock_type == MAIL_LOCK_UNLOCK)
 		(void)mbox_unlock(index);
 	return mail_index_set_lock(index, lock_type);
 }
 
-static int mbox_index_try_lock(MailIndex *index, MailLockType lock_type)
+static int mbox_index_try_lock(struct mail_index *index,
+			       enum mail_lock_type lock_type)
 {
 	if (lock_type == MAIL_LOCK_UNLOCK)
 		(void)mbox_unlock(index);
 	return mail_index_try_lock(index, lock_type);
 }
 
-static int mbox_index_expunge(MailIndex *index, MailIndexRecord *rec,
+static int mbox_index_expunge(struct mail_index *index,
+			      struct mail_index_record *rec,
 			      unsigned int seq, int external_change)
 {
 	if (!mail_index_expunge(index, rec, seq, external_change))
@@ -771,8 +777,9 @@
 	return TRUE;
 }
 
-static int mbox_index_update_flags(MailIndex *index, MailIndexRecord *rec,
-				   unsigned int seq, MailFlags flags,
+static int mbox_index_update_flags(struct mail_index *index,
+				   struct mail_index_record *rec,
+				   unsigned int seq, enum mail_flags flags,
 				   int external_change)
 {
 	if (!mail_index_update_flags(index, rec, seq, flags, external_change))
@@ -785,7 +792,7 @@
 	return TRUE;
 }
 
-MailIndex mbox_index = {
+struct mail_index mbox_index = {
 	mail_index_open,
 	mail_index_open_or_create,
 	mbox_index_free,

Index: mbox-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-index.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mbox-index.h	4 Jan 2003 17:26:30 -0000	1.22
+++ mbox-index.h	5 Jan 2003 13:09:52 -0000	1.23
@@ -4,33 +4,34 @@
 #include "md5.h"
 #include "mail-index.h"
 
-typedef struct {
-	MailIndex *index;
-	MailFlags flags;
+struct mbox_header_context {
+	struct mail_index *index;
+	enum mail_flags flags;
 	const char **custom_flags;
-	MD5Context md5;
+	struct md5_context md5;
 	int received;
 
-	IStream *input;
+	struct istream *input;
 	uoff_t content_length;
 	int set_read_limit;
-} MboxHeaderContext;
+};
 
-int mbox_set_syscall_error(MailIndex *index, const char *function);
+int mbox_set_syscall_error(struct mail_index *index, const char *function);
 
 /* Make sure the mbox is opened. If reopen is TRUE, the file is closed first,
    which is useful when you want to be sure you're not accessing a deleted
    mbox file. */
-int mbox_file_open(MailIndex *index);
-IStream *mbox_get_stream(MailIndex *index, uoff_t offset,
-			 MailLockType lock_type);
-void mbox_file_close_stream(MailIndex *index);
-void mbox_file_close_fd(MailIndex *index);
+int mbox_file_open(struct mail_index *index);
+struct istream *mbox_get_stream(struct mail_index *index, uoff_t offset,
+				enum mail_lock_type lock_type);
+void mbox_file_close_stream(struct mail_index *index);
+void mbox_file_close_fd(struct mail_index *index);
 
-void mbox_header_init_context(MboxHeaderContext *ctx, MailIndex *index,
-			      IStream *input);
-void mbox_header_free_context(MboxHeaderContext *ctx);
-void mbox_header_func(MessagePart *part __attr_unused__,
+void mbox_header_init_context(struct mbox_header_context *ctx,
+			      struct mail_index *index,
+			      struct istream *input);
+void mbox_header_free_context(struct mbox_header_context *ctx);
+void mbox_header_func(struct message_part *part __attr_unused__,
 		      const unsigned char *name, size_t name_len,
 		      const unsigned char *value, size_t value_len,
 		      void *context);
@@ -39,26 +40,29 @@
 			 void (*func)(const unsigned char *, size_t,
 				      int, void *),
 			 void *context);
-int mbox_skip_crlf(IStream *input);
-void mbox_skip_empty_lines(IStream *input);
-void mbox_skip_header(IStream *input);
-void mbox_skip_message(IStream *input);
-int mbox_verify_end_of_body(IStream *input, uoff_t end_offset);
-int mbox_mail_get_location(MailIndex *index, MailIndexRecord *rec,
+int mbox_skip_crlf(struct istream *input);
+void mbox_skip_empty_lines(struct istream *input);
+void mbox_skip_header(struct istream *input);
+void mbox_skip_message(struct istream *input);
+int mbox_verify_end_of_body(struct istream *input, uoff_t end_offset);
+int mbox_mail_get_location(struct mail_index *index,
+			   struct mail_index_record *rec,
 			   uoff_t *offset, uoff_t *hdr_size, uoff_t *body_size);
 
-MailIndex *mbox_index_alloc(const char *dir, const char *mbox_path);
-int mbox_index_rebuild(MailIndex *index);
-int mbox_index_sync(MailIndex *index, MailLockType lock_type, int *changes);
-int mbox_sync_full(MailIndex *index);
-IStream *mbox_open_mail(MailIndex *index, MailIndexRecord *rec,
-			time_t *internal_date, int *deleted);
+struct mail_index *mbox_index_alloc(const char *dir, const char *mbox_path);
+int mbox_index_rebuild(struct mail_index *index);
+int mbox_index_sync(struct mail_index *index,
+		    enum mail_lock_type lock_type, int *changes);
+int mbox_sync_full(struct mail_index *index);
+struct istream *mbox_open_mail(struct mail_index *index,
+			       struct mail_index_record *rec,
+			       time_t *internal_date, int *deleted);
 
-int mbox_index_append(MailIndex *index, IStream *input);
+int mbox_index_append(struct mail_index *index, struct istream *input);
 
 time_t mbox_from_parse_date(const unsigned char *msg, size_t size);
 const char *mbox_from_create(const char *sender, time_t time);
 
-int mbox_index_rewrite(MailIndex *index);
+int mbox_index_rewrite(struct mail_index *index);
 
 #endif

Index: mbox-lock.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-lock.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mbox-lock.c	22 Dec 2002 08:18:29 -0000	1.21
+++ mbox-lock.c	5 Jan 2003 13:09:52 -0000	1.22
@@ -63,8 +63,8 @@
 }
 
 #ifdef HAVE_FLOCK
-static int mbox_lock_flock(MailIndex *index, MailLockType lock_type,
-			   time_t max_wait_time)
+static int mbox_lock_flock(struct mail_index *index,
+			   enum mail_lock_type lock_type, time_t max_wait_time)
 {
 	time_t now, last_notify;
 
@@ -105,8 +105,8 @@
 }
 #endif
 
-static int mbox_lock_fcntl(MailIndex *index, MailLockType lock_type,
-			   time_t max_wait_time)
+static int mbox_lock_fcntl(struct mail_index *index,
+			   enum mail_lock_type lock_type, time_t max_wait_time)
 {
 	struct flock fl;
 	time_t now;
@@ -141,7 +141,7 @@
 	return TRUE;
 }
 
-static int mbox_lock_dotlock(MailIndex *index, const char *path,
+static int mbox_lock_dotlock(struct mail_index *index, const char *path,
 			     time_t max_wait_time, int checkonly)
 {
 	struct stat st;
@@ -250,7 +250,7 @@
 	return FALSE;
 }
 
-static int mbox_unlock_dotlock(MailIndex *index, const char *path)
+static int mbox_unlock_dotlock(struct mail_index *index, const char *path)
 {
 	struct stat st;
 	dev_t old_dev;
@@ -286,7 +286,7 @@
 	return TRUE;
 }
 
-static int mbox_file_locks(MailIndex *index, time_t max_wait_time)
+static int mbox_file_locks(struct mail_index *index, time_t max_wait_time)
 {
 	if (use_fcntl_lock && fcntl_before_flock) {
 		if (!mbox_lock_fcntl(index, index->mbox_lock_type,
@@ -308,7 +308,7 @@
 	return TRUE;
 }
 
-int mbox_lock(MailIndex *index, MailLockType lock_type)
+int mbox_lock(struct mail_index *index, enum mail_lock_type lock_type)
 {
 	struct stat st;
 	time_t max_wait_time;
@@ -362,7 +362,7 @@
 	return TRUE;
 }
 
-int mbox_unlock(MailIndex *index)
+int mbox_unlock(struct mail_index *index)
 {
 	int failed;
 

Index: mbox-lock.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-lock.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mbox-lock.h	26 Oct 2002 19:38:37 -0000	1.4
+++ mbox-lock.h	5 Jan 2003 13:09:52 -0000	1.5
@@ -3,7 +3,7 @@
 
 /* NOTE: if mbox file is not open, it's opened. if it is open but file has
    been overwritten (ie. inode has changed), it's reopened. */
-int mbox_lock(MailIndex *index, MailLockType lock_type);
-int mbox_unlock(MailIndex *index);
+int mbox_lock(struct mail_index *index, enum mail_lock_type lock_type);
+int mbox_unlock(struct mail_index *index);
 
 #endif

Index: mbox-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-open.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mbox-open.c	6 Dec 2002 01:09:23 -0000	1.19
+++ mbox-open.c	5 Jan 2003 13:09:52 -0000	1.20
@@ -10,10 +10,11 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-IStream *mbox_open_mail(MailIndex *index, MailIndexRecord *rec,
-			time_t *internal_date, int *deleted)
+struct istream *mbox_open_mail(struct mail_index *index,
+			       struct mail_index_record *rec,
+			       time_t *internal_date, int *deleted)
 {
-	IStream *input;
+	struct istream *input;
 	uoff_t offset, hdr_size, body_size;
 
 	i_assert(index->lock_type != MAIL_LOCK_UNLOCK);

Index: mbox-rebuild.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rebuild.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mbox-rebuild.c	20 Dec 2002 07:53:52 -0000	1.21
+++ mbox-rebuild.c	5 Jan 2003 13:09:52 -0000	1.22
@@ -12,9 +12,9 @@
 #include <sys/stat.h>
 #include <sys/mman.h>
 
-int mbox_index_rebuild(MailIndex *index)
+int mbox_index_rebuild(struct mail_index *index)
 {
-	IStream *input;
+	struct istream *input;
 	struct stat st;
 	int failed;
 
@@ -36,7 +36,8 @@
 	index->indexid = index->header->indexid;
 	index->inconsistent = TRUE;
 
-	if (msync(index->mmap_base, sizeof(MailIndexHeader), MS_SYNC) < 0)
+	if (msync(index->mmap_base,
+		  sizeof(struct mail_index_header), MS_SYNC) < 0)
 		return index_set_syscall_error(index, "msync()");
 
 	/* reset data file */

Index: mbox-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rewrite.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- mbox-rewrite.c	4 Jan 2003 17:26:30 -0000	1.49
+++ mbox-rewrite.c	5 Jan 2003 13:09:52 -0000	1.50
@@ -16,8 +16,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-typedef struct {
-	OStream *output;
+struct mbox_rewrite_context {
+	struct ostream *output;
 	int failed;
 
 	uoff_t content_length;
@@ -33,12 +33,12 @@
 	unsigned int status_found:1;
 	unsigned int xstatus_found:1;
 	unsigned int content_length_found:1;
-} MboxRewriteContext;
+};
 
 /* Remove dirty flag from all messages */
-static void reset_dirty_flags(MailIndex *index)
+static void reset_dirty_flags(struct mail_index *index)
 {
-	MailIndexRecord *rec;
+	struct mail_index_record *rec;
 
 	rec = index->lookup(index, 1);
 	while (rec != NULL) {
@@ -50,8 +50,8 @@
 				  MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS);
 }
 
-static int mbox_write(MailIndex *index, IStream *input, OStream *output,
-		      uoff_t end_offset)
+static int mbox_write(struct mail_index *index, struct istream *input,
+		      struct ostream *output, uoff_t end_offset)
 {
 	uoff_t old_limit;
 	int failed;
@@ -78,7 +78,7 @@
 	return !failed;
 }
 
-static int mbox_write_ximapbase(MboxRewriteContext *ctx)
+static int mbox_write_ximapbase(struct mbox_rewrite_context *ctx)
 {
 	const char *str;
 	int i;
@@ -105,7 +105,8 @@
 	return TRUE;
 }
 
-static int mbox_write_xkeywords(MboxRewriteContext *ctx, const char *x_keywords)
+static int mbox_write_xkeywords(struct mbox_rewrite_context *ctx,
+				const char *x_keywords)
 {
 	unsigned int field;
 	int i;
@@ -144,7 +145,8 @@
 	return TRUE;
 }
 
-static int mbox_write_status(MboxRewriteContext *ctx, const char *status)
+static int mbox_write_status(struct mbox_rewrite_context *ctx,
+			     const char *status)
 {
 	const char *str;
 
@@ -160,7 +162,8 @@
 	return TRUE;
 }
 
-static int mbox_write_xstatus(MboxRewriteContext *ctx, const char *x_status)
+static int mbox_write_xstatus(struct mbox_rewrite_context *ctx,
+			      const char *x_status)
 {
 	const char *str;
 
@@ -184,7 +187,7 @@
 	return TRUE;
 }
 
-static int mbox_write_content_length(MboxRewriteContext *ctx)
+static int mbox_write_content_length(struct mbox_rewrite_context *ctx)
 {
 	char str[MAX_INT_STRLEN+30];
 
@@ -219,7 +222,7 @@
 static void update_stripped_custom_flags(const unsigned char *value, size_t len,
 					 int index, void *context)
 {
-	String *str = context;
+	string_t *str = context;
 
 	if (index < 0) {
 		/* not found, keep it */
@@ -230,9 +233,9 @@
 }
 
 static const char *strip_custom_flags(const unsigned char *value, size_t len,
-				      MboxRewriteContext *ctx)
+				      struct mbox_rewrite_context *ctx)
 {
-	String *str;
+	string_t *str;
 
 	str = t_str_new(len+1);
 	mbox_keywords_parse(value, len, ctx->custom_flags,
@@ -240,12 +243,12 @@
 	return str_len(str) == 0 ? NULL : str_c(str);
 }
 
-static void header_func(MessagePart *part __attr_unused__,
+static void header_func(struct message_part *part __attr_unused__,
 			const unsigned char *name, size_t name_len,
 			const unsigned char *value, size_t value_len,
 			void *context)
 {
-	MboxRewriteContext *ctx = context;
+	struct mbox_rewrite_context *ctx = context;
 	const char *str;
 	char *end;
 
@@ -296,9 +299,10 @@
 		ctx->failed = TRUE;
 }
 
-static int mbox_write_header(MailIndex *index,
-			     MailIndexRecord *rec, unsigned int seq,
-			     IStream *input, OStream *output, uoff_t end_offset,
+static int mbox_write_header(struct mail_index *index,
+			     struct mail_index_record *rec, unsigned int seq,
+			     struct istream *input, struct ostream *output,
+			     uoff_t end_offset,
 			     uoff_t hdr_size, uoff_t body_size)
 {
 	/* We need to update fields that define message flags. Standard fields
@@ -312,8 +316,8 @@
 	   validity is always kept different from our internal UID validity.
 	   Last used UID is also not updated, and set to 0 initially.
 	*/
-	MboxRewriteContext ctx;
-	MessageSize hdr_parsed_size;
+	struct mbox_rewrite_context ctx;
+	struct message_size hdr_parsed_size;
 
 	if (input->v_offset >= end_offset) {
 		/* fsck should have noticed it.. */
@@ -364,8 +368,8 @@
 
 static int fd_copy(int in_fd, int out_fd, uoff_t out_offset)
 {
-	IStream *input;
-	OStream *output;
+	struct istream *input;
+	struct ostream *output;
 	int ret;
 
 	i_assert(out_offset <= OFF_T_MAX);
@@ -399,15 +403,15 @@
 #define INDEX_DIRTY_FLAGS \
         (MAIL_INDEX_FLAG_DIRTY_MESSAGES | MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS)
 
-int mbox_index_rewrite(MailIndex *index)
+int mbox_index_rewrite(struct mail_index *index)
 {
 	/* Write messages beginning from the first dirty one to temp file,
 	   then copy it over the mbox file. This may create data loss if
 	   interrupted (see below). This rewriting relies quite a lot on
 	   valid header/body sizes which fsck() should have ensured. */
-	MailIndexRecord *rec;
-	IStream *input;
-	OStream *output;
+	struct mail_index_record *rec;
+	struct istream *input;
+	struct ostream *output;
 	uoff_t offset, hdr_size, body_size, dirty_offset;
 	const char *path;
 	unsigned int seq;

Index: mbox-sync-full.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-sync-full.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mbox-sync-full.c	20 Dec 2002 07:53:52 -0000	1.8
+++ mbox-sync-full.c	5 Jan 2003 13:09:52 -0000	1.9
@@ -12,7 +12,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-static void skip_line(IStream *input)
+static void skip_line(struct istream *input)
 {
 	const unsigned char *msg;
 	size_t i, size;
@@ -29,7 +29,8 @@
 	}
 }
 
-static int verify_header_md5sum(MailIndex *index, MailIndexRecord *rec,
+static int verify_header_md5sum(struct mail_index *index,
+				struct mail_index_record *rec,
 				unsigned char current_digest[16])
 {
 	const unsigned char *old_digest;
@@ -41,9 +42,10 @@
                 memcmp(old_digest, current_digest, 16) == 0;
 }
 
-static int mail_update_header_size(MailIndex *index, MailIndexRecord *rec,
-				   MailIndexUpdate *update,
-				   MessageSize *hdr_size)
+static int mail_update_header_size(struct mail_index *index,
+				   struct mail_index_record *rec,
+				   struct mail_index_update *update,
+				   struct message_size *hdr_size)
 {
 	const void *part_data;
 	void *part_data_copy;
@@ -89,13 +91,14 @@
 	return TRUE;
 }
 
-static int match_next_record(MailIndex *index, MailIndexRecord *rec,
-			     unsigned int seq, IStream *input,
-			     MailIndexRecord **next_rec, int *dirty)
+static int match_next_record(struct mail_index *index,
+			     struct mail_index_record *rec,
+			     unsigned int seq, struct istream *input,
+			     struct mail_index_record **next_rec, int *dirty)
 {
-        MailIndexUpdate *update;
-	MessageSize hdr_parsed_size;
-	MboxHeaderContext ctx;
+        struct mail_index_update *update;
+	struct message_size hdr_parsed_size;
+	struct mbox_header_context ctx;
 	uoff_t header_offset, body_offset, offset;
 	uoff_t hdr_size, body_size;
 	unsigned char current_digest[16];
@@ -189,9 +192,10 @@
 	return TRUE;
 }
 
-static int mbox_sync_from_stream(MailIndex *index, IStream *input)
+static int mbox_sync_from_stream(struct mail_index *index,
+				 struct istream *input)
 {
-	MailIndexRecord *rec;
+	struct mail_index_record *rec;
 	uoff_t from_offset;
 	const unsigned char *data;
 	size_t size;
@@ -271,9 +275,9 @@
 		return mbox_index_append(index, input);
 }
 
-int mbox_sync_full(MailIndex *index)
+int mbox_sync_full(struct mail_index *index)
 {
-	IStream *input;
+	struct istream *input;
 	int failed;
 
 	i_assert(index->lock_type == MAIL_LOCK_EXCLUSIVE);

Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-sync.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mbox-sync.c	20 Dec 2002 07:53:52 -0000	1.27
+++ mbox-sync.c	5 Jan 2003 13:09:52 -0000	1.28
@@ -10,9 +10,9 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
-static uoff_t get_indexed_mbox_size(MailIndex *index)
+static uoff_t get_indexed_mbox_size(struct mail_index *index)
 {
-	MailIndexRecord *rec;
+	struct mail_index_record *rec;
 	uoff_t offset, hdr_size, body_size;
 
 	if (index->lock_type == MAIL_LOCK_UNLOCK) {
@@ -41,10 +41,10 @@
 	return offset + 1; /* +1 for trailing \n */
 }
 
-static int mbox_lock_and_sync_full(MailIndex *index,
-				   MailLockType data_lock_type)
+static int mbox_lock_and_sync_full(struct mail_index *index,
+				   enum mail_lock_type data_lock_type)
 {
-        MailLockType lock_type;
+        enum mail_lock_type lock_type;
 
 	/* syncing needs exclusive index lock and shared
 	   mbox lock, but if we'd want exclusive mbox lock
@@ -65,8 +65,8 @@
 	return mbox_sync_full(index);
 }
 
-int mbox_index_sync(MailIndex *index, MailLockType data_lock_type,
-		    int *changes)
+int mbox_index_sync(struct mail_index *index,
+		    enum mail_lock_type data_lock_type, int *changes)
 {
 	struct stat st;
 	time_t index_mtime;




More information about the dovecot-cvs mailing list