[dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.38, 1.39 mail-cache-lookup.c, 1.32, 1.33 mail-cache-transaction.c, 1.47, 1.48 mail-cache.c, 1.75, 1.76 mail-cache.h, 1.24, 1.25 mail-index-fsck.c, 1.29, 1.30 mail-index-lock.c, 1.50, 1.51 mail-index-private.h, 1.61, 1.62 mail-index-sync-ext.c, 1.15, 1.16 mail-index-sync-private.h, 1.27, 1.28 mail-index-sync-update.c, 1.89, 1.90 mail-index-sync.c, 1.65, 1.66 mail-index-transaction-private.h, 1.26, 1.27 mail-index-transaction.c, 1.70, 1.71 mail-index-view-private.h, 1.20, 1.21 mail-index-view-sync.c, 1.47, 1.48 mail-index-view.c, 1.40, 1.41 mail-index.c, 1.217, 1.218 mail-index.h, 1.155, 1.156 mail-transaction-log-append.c, 1.16, 1.17 mail-transaction-log-private.h, 1.12, 1.13 mail-transaction-log-view.c, 1.43, 1.44 mail-transaction-log.c, 1.104, 1.105 mail-transaction-log.h, 1.29, 1.30

cras at dovecot.org cras at dovecot.org
Fri Jan 13 22:26:20 EET 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv27808/src/lib-index

Modified Files:
	mail-cache-compress.c mail-cache-lookup.c 
	mail-cache-transaction.c mail-cache.c mail-cache.h 
	mail-index-fsck.c mail-index-lock.c mail-index-private.h 
	mail-index-sync-ext.c mail-index-sync-private.h 
	mail-index-sync-update.c mail-index-sync.c 
	mail-index-transaction-private.h mail-index-transaction.c 
	mail-index-view-private.h mail-index-view-sync.c 
	mail-index-view.c mail-index.c mail-index.h 
	mail-transaction-log-append.c mail-transaction-log-private.h 
	mail-transaction-log-view.c mail-transaction-log.c 
	mail-transaction-log.h 
Log Message:
Added "bool" type and changed all ints that were used as booleans to bool.



Index: mail-cache-compress.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-compress.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mail-cache-compress.c	6 Jan 2006 14:21:21 -0000	1.38
+++ mail-cache-compress.c	13 Jan 2006 20:26:13 -0000	1.39
@@ -11,7 +11,7 @@
 #include <sys/stat.h>
 
 struct mail_cache_copy_context {
-	int new_msg;
+	bool new_msg;
 	buffer_t *buffer, *field_seen;
 	uint8_t field_seen_value;
 };
@@ -327,7 +327,7 @@
 	}
 }
 
-int mail_cache_need_compress(struct mail_cache *cache)
+bool mail_cache_need_compress(struct mail_cache *cache)
 {
 	return cache->need_compress;
 }

Index: mail-cache-lookup.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-lookup.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- mail-cache-lookup.c	27 Aug 2005 10:20:39 -0000	1.32
+++ mail-cache-lookup.c	13 Jan 2006 20:26:13 -0000	1.33
@@ -166,7 +166,7 @@
 	return 1;
 }
 
-static int find_offset(struct mail_cache_view *view, uint32_t offset)
+static bool find_offset(struct mail_cache_view *view, uint32_t offset)
 {
 	const uint32_t *offsets;
 	unsigned int i, count;
@@ -294,7 +294,7 @@
 struct mail_cache_lookup_context {
 	buffer_t *dest_buf;
 	uint32_t field;
-	int found;
+	bool found;
 };
 
 static int

Index: mail-cache-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-transaction.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mail-cache-transaction.c	2 Jan 2006 13:07:57 -0000	1.47
+++ mail-cache-transaction.c	13 Jan 2006 20:26:13 -0000	1.48
@@ -136,8 +136,8 @@
 	return 0;
 }
 
-static int mail_cache_unlink_hole(struct mail_cache *cache, size_t size,
-				  struct mail_cache_hole_header *hole_r)
+static bool mail_cache_unlink_hole(struct mail_cache *cache, size_t size,
+				   struct mail_cache_hole_header *hole_r)
 {
 	struct mail_cache_header *hdr = &cache->hdr_copy;
 	struct mail_cache_hole_header hole;
@@ -195,7 +195,7 @@
 
 static int
 mail_cache_transaction_reserve_more(struct mail_cache_transaction_ctx *ctx,
-				    size_t block_size, int commit)
+				    size_t block_size, bool commit)
 {
 	struct mail_cache *cache = ctx->cache;
 	struct mail_cache_header *hdr = &cache->hdr_copy;
@@ -297,7 +297,7 @@
 static int
 mail_cache_transaction_free_space(struct mail_cache_transaction_ctx *ctx)
 {
-	int locked = ctx->cache->locked;
+	bool locked = ctx->cache->locked;
 
 	if (ctx->reserved_space == 0)
 		return 0;
@@ -327,9 +327,9 @@
 mail_cache_transaction_get_space(struct mail_cache_transaction_ctx *ctx,
 				 size_t min_size, size_t max_size,
 				 uint32_t *offset_r, size_t *available_space_r,
-				 int commit)
+				 bool commit)
 {
-	int locked = ctx->cache->locked;
+	bool locked = ctx->cache->locked;
 	uint32_t cache_file_seq;
 	size_t size;
 	int ret;
@@ -442,7 +442,8 @@
 	uint32_t write_offset, write_size, rec_pos, seq_idx, seq_limit;
 	size_t size, max_size;
 	unsigned int seq_count;
-	int ret, commit;
+	int ret;
+	bool commit;
 
 	if (MAIL_CACHE_IS_UNUSABLE(cache))
 		return -1;
@@ -772,7 +773,7 @@
 	return 0;
 }
 
-static int find_offset(array_t *array, uint32_t offset)
+static bool find_offset(array_t *array, uint32_t offset)
 {
 	ARRAY_SET_TYPE(array, uint32_t);
 	const uint32_t *offsets;

Index: mail-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- mail-cache.c	6 Jan 2006 23:48:57 -0000	1.75
+++ mail-cache.c	13 Jan 2006 20:26:13 -0000	1.76
@@ -112,7 +112,7 @@
 	return 1;
 }
 
-static int mail_cache_verify_header(struct mail_cache *cache)
+static bool mail_cache_verify_header(struct mail_cache *cache)
 {
 	const struct mail_cache_header *hdr = cache->data;
 

Index: mail-cache.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mail-cache.h	3 Jul 2005 15:09:16 -0000	1.24
+++ mail-cache.h	13 Jan 2006 20:26:13 -0000	1.25
@@ -55,7 +55,7 @@
 			     unsigned int *count_r);
 
 /* Returns TRUE if cache should be compressed. */
-int mail_cache_need_compress(struct mail_cache *cache);
+bool mail_cache_need_compress(struct mail_cache *cache);
 /* Compress cache file. */
 int mail_cache_compress(struct mail_cache *cache, struct mail_index_view *view);
 

Index: mail-index-fsck.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-fsck.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mail-index-fsck.c	6 Jan 2006 22:31:40 -0000	1.29
+++ mail-index-fsck.c	13 Jan 2006 20:26:13 -0000	1.30
@@ -135,7 +135,8 @@
 	unsigned int lock_id;
 	uint32_t file_seq;
 	uoff_t file_offset;
-	int ret, lock_log;
+	int ret;
+	bool lock_log;
 
 	if (index->sync_update) {
 		/* we're modifying index, don't do anything */

Index: mail-index-lock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-lock.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- mail-index-lock.c	7 Jan 2006 00:20:56 -0000	1.50
+++ mail-index-lock.c	13 Jan 2006 20:26:13 -0000	1.51
@@ -223,7 +223,7 @@
 	return 1;
 }
 
-int mail_index_lock_shared(struct mail_index *index, int update_index,
+int mail_index_lock_shared(struct mail_index *index, bool update_index,
 			   unsigned int *lock_id_r)
 {
 	int ret;
@@ -488,7 +488,7 @@
 	}
 }
 
-int mail_index_is_locked(struct mail_index *index, unsigned int lock_id)
+bool mail_index_is_locked(struct mail_index *index, unsigned int lock_id)
 {
 	if ((index->lock_id ^ lock_id) <= 1) {
 		i_assert(index->lock_type != F_UNLCK);

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- mail-index-private.h	6 Jan 2006 23:48:57 -0000	1.61
+++ mail-index-private.h	13 Jan 2006 20:26:13 -0000	1.62
@@ -203,14 +203,14 @@
 /* Returns 0 = ok, -1 = error. If update_index is TRUE, reopens the index
    file if needed to get later version of it (not necessarily latest due to
    races, unless transaction log is exclusively locked). */
-int mail_index_lock_shared(struct mail_index *index, int update_index,
+int mail_index_lock_shared(struct mail_index *index, bool update_index,
 			   unsigned int *lock_id_r);
 /* Returns 0 = ok, -1 = error. */
 int mail_index_lock_exclusive(struct mail_index *index,
 			      unsigned int *lock_id_r);
 void mail_index_unlock(struct mail_index *index, unsigned int lock_id);
-/* Returns 1 if given lock_id is valid, 0 if not. */
-int mail_index_is_locked(struct mail_index *index, unsigned int lock_id);
+/* Returns TRUE if given lock_id is valid. */
+bool mail_index_is_locked(struct mail_index *index, unsigned int lock_id);
 
 int mail_index_lock_fd(struct mail_index *index, const char *path, int fd,
 		       int lock_type, unsigned int timeout_secs);
@@ -221,7 +221,7 @@
 /* Map index file to memory, replacing the previous mapping for index.
    Returns 1 = ok, 0 = corrupted, -1 = error. If index needs fscking, it
    returns 1 but sets index->fsck = TRUE. */
-int mail_index_map(struct mail_index *index, int force);
+int mail_index_map(struct mail_index *index, bool force);
 /* Read the latest available header. Normally this is pretty much the same as
    calling mail_index_map(), but with mmap_disable the header can be generated
    by reading just log files, so eg. log_file_*_offset values can be wrong.

Index: mail-index-sync-ext.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-ext.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- mail-index-sync-ext.c	6 Jan 2006 12:57:06 -0000	1.15
+++ mail-index-sync-ext.c	13 Jan 2006 20:26:13 -0000	1.16
@@ -278,7 +278,7 @@
 	struct mail_index_ext *ext;
 	struct mail_index_ext_header *ext_hdr;
 	uint32_t old_size, new_size, old_record_size;
-	int modified = FALSE;
+	bool modified = FALSE;
 
 	ext = array_idx_modifyable(&map->extensions, ext_id);
 

Index: mail-index-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-private.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mail-index-sync-private.h	6 Jan 2006 17:37:30 -0000	1.27
+++ mail-index-sync-private.h	13 Jan 2006 20:26:13 -0000	1.28
@@ -61,7 +61,7 @@
 			      enum mail_index_sync_handler_type type);
 void mail_index_sync_map_deinit(struct mail_index_sync_map_ctx *sync_map_ctx);
 int mail_index_sync_update_index(struct mail_index_sync_ctx *sync_ctx,
-				 int sync_only_external);
+				 bool sync_only_external);
 
 int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
 			   const struct mail_transaction_header *hdr,

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- mail-index-sync-update.c	2 Jan 2006 12:23:50 -0000	1.89
+++ mail-index-sync-update.c	13 Jan 2006 20:26:13 -0000	1.90
@@ -587,7 +587,7 @@
 }
 
 int mail_index_sync_update_index(struct mail_index_sync_ctx *sync_ctx,
-				 int sync_only_external)
+				 bool sync_only_external)
 {
 	struct mail_index *index = sync_ctx->index;
 	struct mail_index_view *view = sync_ctx->view;
@@ -598,7 +598,8 @@
 	unsigned int count, old_lock_id;
 	uint32_t seq, i, first_append_uid;
 	uoff_t offset;
-	int ret, had_dirty, skipped, check_ext_offsets;
+	int ret;
+	bool had_dirty, skipped, check_ext_offsets;
 
 	mail_index_sync_map_init(&sync_map_ctx, view,
 				 MAIL_INDEX_SYNC_HANDLER_INDEX);

Index: mail-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- mail-index-sync.c	6 Jan 2006 22:31:40 -0000	1.65
+++ mail-index-sync.c	13 Jan 2006 20:26:13 -0000	1.66
@@ -159,7 +159,7 @@
 {
 	const struct mail_index_record *rec;
 	uint32_t seq, messages_count;
-	int seen_recent = FALSE;
+	bool seen_recent = FALSE;
 
 	messages_count = mail_index_view_get_messages_count(ctx->view);
 	for (seq = 1; seq <= messages_count; seq++) {
@@ -184,7 +184,7 @@
 
 static int
 mail_index_sync_read_and_sort(struct mail_index_sync_ctx *ctx,
-			      int *seen_external_r)
+			      bool *seen_external_r)
 {
 	struct mail_index_sync_list *synclist;
         const struct mail_index_transaction_keyword_update *keyword_updates;
@@ -257,7 +257,7 @@
 	return ret;
 }
 
-static int mail_index_need_lock(struct mail_index *index, int sync_recent,
+static int mail_index_need_lock(struct mail_index *index, bool sync_recent,
 				uint32_t log_file_seq, uoff_t log_file_offset)
 {
 	if (sync_recent && index->hdr->recent_messages_count > 0)
@@ -339,14 +339,14 @@
                           struct mail_index_sync_ctx **ctx_r,
 			  struct mail_index_view **view_r,
 			  uint32_t log_file_seq, uoff_t log_file_offset,
-			  int sync_recent, int sync_dirty)
+			  bool sync_recent, bool sync_dirty)
 {
 	struct mail_index_sync_ctx *ctx;
 	struct mail_index_view *dummy_view;
 	uint32_t seq;
 	uoff_t offset;
 	unsigned int lock_id = 0;
-	int seen_external;
+	bool seen_external;
 
 	if (mail_transaction_log_sync_lock(index->log, &seq, &offset) < 0)
 		return -1;
@@ -500,8 +500,8 @@
 	rec->uid2 = range->uid2;
 }
 
-static int mail_index_sync_rec_check(struct mail_index_view *view,
-				     struct mail_index_sync_rec *rec)
+static bool mail_index_sync_rec_check(struct mail_index_view *view,
+				      struct mail_index_sync_rec *rec)
 {
 	switch (rec->type) {
 	case MAIL_INDEX_SYNC_TYPE_EXPUNGE:
@@ -589,7 +589,7 @@
 	return 1;
 }
 
-int mail_index_sync_have_more(struct mail_index_sync_ctx *ctx)
+bool mail_index_sync_have_more(struct mail_index_sync_ctx *ctx)
 {
 	const struct mail_index_sync_list *sync_list;
 	unsigned int i, count;
@@ -692,8 +692,8 @@
 	*flags = (*flags & ~sync_rec->remove_flags) | sync_rec->add_flags;
 }
 
-int mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
-				   array_t *keywords)
+bool mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
+				    array_t *keywords)
 {
 	ARRAY_SET_TYPE(keywords, unsigned int);
 	const unsigned int *keyword_indexes;

Index: mail-index-transaction-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction-private.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mail-index-transaction-private.h	21 Dec 2005 18:41:50 -0000	1.26
+++ mail-index-transaction-private.h	13 Jan 2006 20:26:13 -0000	1.27
@@ -49,7 +49,7 @@
 void mail_index_transaction_ref(struct mail_index_transaction *t);
 void mail_index_transaction_unref(struct mail_index_transaction *t);
 
-int mail_index_seq_array_lookup(const array_t *buffer, uint32_t seq,
-				unsigned int *idx_r);
+bool mail_index_seq_array_lookup(const array_t *buffer, uint32_t seq,
+				 unsigned int *idx_r);
 
 #endif

Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- mail-index-transaction.c	6 Jan 2006 12:48:55 -0000	1.70
+++ mail-index-transaction.c	13 Jan 2006 20:26:13 -0000	1.71
@@ -17,7 +17,7 @@
 
 struct mail_index_transaction *
 mail_index_transaction_begin(struct mail_index_view *view,
-			     int hide, int external)
+			     bool hide, bool external)
 {
 	struct mail_index_transaction *t;
 
@@ -101,23 +101,23 @@
 
 static void
 mail_index_buffer_convert_to_uids(struct mail_index_transaction *t,
-				  array_t *array, int range)
+				  array_t *array, bool range)
 {
         ARRAY_SET_TYPE(array, uint32_t);
         struct mail_index_view *view = t->view;
 	const struct mail_index_record *rec;
 	uint32_t *seq;
-	unsigned int i, count;
-	int j;
+	unsigned int i, j, count, range_count;
 
 	if (!array_is_created(array))
 		return;
 
 	count = array_count(array);
+	range_count = range ? 1 : 0;
 	for (i = 0; i < count; i++) {
 		seq = array_idx_modifyable(array, i);
 
-		for (j = 0; j <= range; j++, seq++) {
+		for (j = 0; j <= range_count; j++, seq++) {
 			if (*seq >= t->first_new_seq) {
 				rec = mail_index_transaction_lookup(t, *seq);
 				*seq = rec->uid;
@@ -132,7 +132,7 @@
 }
 
 static void arrays_convert_to_uids(struct mail_index_transaction *t,
-				   array_t *array, int range)
+				   array_t *array, bool range)
 {
 	ARRAY_SET_TYPE(array, array_t);
 	array_t *updates;
@@ -529,8 +529,8 @@
 	mail_index_update_flags_range(t, seq, seq, modify_type, flags);
 }
 
-int mail_index_seq_array_lookup(const array_t *array, uint32_t seq,
-				unsigned int *idx_r)
+bool mail_index_seq_array_lookup(const array_t *array, uint32_t seq,
+				 unsigned int *idx_r)
 {
         ARRAY_SET_TYPE(array, uint32_t);
 	unsigned int idx, left_idx, right_idx, count;
@@ -567,9 +567,9 @@
 	return FALSE;
 }
 
-static int mail_index_seq_array_add(array_t *array, uint32_t seq,
-				    const void *record, size_t record_size,
-				    void *old_record)
+static bool mail_index_seq_array_add(array_t *array, uint32_t seq,
+				     const void *record, size_t record_size,
+				     void *old_record)
 {
         ARRAY_SET_TYPE(array, void *);
 	void *p;
@@ -602,7 +602,7 @@
 
 void mail_index_update_header(struct mail_index_transaction *t,
 			      size_t offset, const void *data, size_t size,
-			      int prepend)
+			      bool prepend)
 {
 	i_assert(offset < sizeof(t->pre_hdr_change));
 	i_assert(size <= sizeof(t->pre_hdr_change) - offset);

Index: mail-index-view-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-private.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mail-index-view-private.h	6 Jan 2006 17:30:26 -0000	1.20
+++ mail-index-view-private.h	13 Jan 2006 20:26:13 -0000	1.21
@@ -60,7 +60,7 @@
 			   const struct mail_index_view *src);
 void mail_index_view_ref(struct mail_index_view *view);
 int mail_index_view_lock(struct mail_index_view *view);
-int mail_index_view_lock_head(struct mail_index_view *view, int update_index);
+int mail_index_view_lock_head(struct mail_index_view *view, bool update_index);
 void mail_index_view_unref_maps(struct mail_index_view *view);
 void mail_index_view_add_synced_transaction(struct mail_index_view *view,
 					    uint32_t log_file_seq,

Index: mail-index-view-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view-sync.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mail-index-view-sync.c	6 Jan 2006 22:31:40 -0000	1.47
+++ mail-index-view-sync.c	13 Jan 2006 20:26:13 -0000	1.48
@@ -285,8 +285,8 @@
 	return 0;
 }
 
-static int view_is_transaction_synced(struct mail_index_view *view,
-				      uint32_t seq, uoff_t offset)
+static bool view_is_transaction_synced(struct mail_index_view *view,
+				       uint32_t seq, uoff_t offset)
 {
 	const struct mail_index_view_log_sync_pos *pos;
 	unsigned int i, count;
@@ -311,7 +311,8 @@
 	struct mail_index_view *view = ctx->view;
 	uint32_t seq;
 	uoff_t offset;
-	int ret, skipped;
+	int ret;
+	bool skipped;
 
 	for (;;) {
 		/* Get the next transaction from log. */

Index: mail-index-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-view.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- mail-index-view.c	6 Jan 2006 18:57:05 -0000	1.40
+++ mail-index-view.c	13 Jan 2006 20:26:13 -0000	1.41
@@ -46,7 +46,7 @@
 	i_free(view);
 }
 
-int mail_index_view_lock_head(struct mail_index_view *view, int update_index)
+int mail_index_view_lock_head(struct mail_index_view *view, bool update_index)
 {
 	unsigned int lock_id;
 
@@ -102,7 +102,7 @@
 	}
 }
 
-int mail_index_view_is_inconsistent(struct mail_index_view *view)
+bool mail_index_view_is_inconsistent(struct mail_index_view *view)
 {
 	if (view->index->indexid != view->indexid)
 		view->inconsistent = TRUE;

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -d -r1.217 -r1.218
--- mail-index.c	6 Jan 2006 23:48:57 -0000	1.217
+++ mail-index.c	13 Jan 2006 20:26:13 -0000	1.218
@@ -249,7 +249,7 @@
 	return idx;
 }
 
-static int size_check(size_t *size_left, size_t size)
+static bool size_check(size_t *size_left, size_t size)
 {
 	if (size > *size_left)
 		return FALSE;
@@ -346,9 +346,9 @@
 	return 1;
 }
 
-int mail_index_keyword_lookup(struct mail_index *index,
-			      const char *keyword, int autocreate,
-			      unsigned int *idx_r)
+bool mail_index_keyword_lookup(struct mail_index *index,
+			       const char *keyword, bool autocreate,
+			       unsigned int *idx_r)
 {
 	char *keyword_dup;
 	void *value;
@@ -675,7 +675,7 @@
 }
 
 static int mail_index_read_map(struct mail_index *index,
-			       struct mail_index_map *map, int *retry_r)
+			       struct mail_index_map *map, bool *retry_r)
 {
 	struct mail_index_header hdr;
 	void *data = NULL;
@@ -760,7 +760,7 @@
 
 static int mail_index_sync_from_transactions(struct mail_index *index,
 					     struct mail_index_map **map,
-					     int sync_to_index)
+					     bool sync_to_index)
 {
 	const struct mail_index_header *map_hdr = &(*map)->hdr;
 	struct mail_index_view *view;
@@ -772,7 +772,8 @@
 	uint32_t prev_seq, max_seq;
 	uoff_t prev_offset, max_offset;
 	size_t pos;
-	int ret, skipped;
+	int ret;
+	bool skipped;
 
 	if (sync_to_index) {
 		/* read the real log position where we are supposed to be
@@ -866,11 +867,12 @@
 
 static int mail_index_read_map_with_retry(struct mail_index *index,
 					  struct mail_index_map **map,
-					  int sync_to_index)
+					  bool sync_to_index)
 {
 	mail_index_sync_lost_handler_t *const *handlers;
 	unsigned int i, count;
-	int ret, retry;
+	int ret;
+	bool retry;
 
 	if (index->log_locked) {
 		/* we're most likely syncing the index and we really don't
@@ -945,7 +947,7 @@
 	return 0;
 }
 
-int mail_index_map(struct mail_index *index, int force)
+int mail_index_map(struct mail_index *index, bool force)
 {
 	struct mail_index_map *map;
 	int ret;
@@ -1377,7 +1379,8 @@
 {
 	struct mail_index_header hdr;
 	unsigned int lock_id = 0;
-	int ret, created = FALSE;
+	int ret;
+	bool created = FALSE;
 
 	ret = mail_index_try_open(index, &lock_id);
 	if (ret > 0)

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- mail-index.h	6 Jan 2006 18:57:05 -0000	1.155
+++ mail-index.h	13 Jan 2006 20:26:13 -0000	1.156
@@ -179,7 +179,7 @@
 /* Returns number of mails in view. */
 uint32_t mail_index_view_get_messages_count(struct mail_index_view *view);
 /* Returns TRUE if we lost track of changes for some reason. */
-int mail_index_view_is_inconsistent(struct mail_index_view *view);
+bool mail_index_view_is_inconsistent(struct mail_index_view *view);
 
 /* Transaction has to be opened to be able to modify index. You can have
    multiple transactions open simultaneously. Note that committed transactions
@@ -192,7 +192,7 @@
    happened. */
 struct mail_index_transaction *
 mail_index_transaction_begin(struct mail_index_view *view,
-			     int hide, int external);
+			     bool hide, bool external);
 int mail_index_transaction_commit(struct mail_index_transaction *t,
 				  uint32_t *log_file_seq_r,
 				  uoff_t *log_file_offset_r);
@@ -231,12 +231,12 @@
 			  struct mail_index_sync_ctx **ctx_r,
 			  struct mail_index_view **view_r,
 			  uint32_t log_file_seq, uoff_t log_file_offset,
-			  int sync_recent, int sync_dirty);
+			  bool sync_recent, bool sync_dirty);
 /* Returns -1 if error, 0 if sync is finished, 1 if record was filled. */
 int mail_index_sync_next(struct mail_index_sync_ctx *ctx,
 			 struct mail_index_sync_rec *sync_rec);
-/* Returns 1 if there's more to sync, 0 if not. */
-int mail_index_sync_have_more(struct mail_index_sync_ctx *ctx);
+/* Returns TRUE if there's more to sync. */
+bool mail_index_sync_have_more(struct mail_index_sync_ctx *ctx);
 /* Reset syncing to initial state after mail_index_sync_begin(), so you can
    go through all the sync records again with mail_index_sync_next(). */
 void mail_index_sync_reset(struct mail_index_sync_ctx *ctx);
@@ -316,9 +316,9 @@
 
 /* Lookup a keyword, returns TRUE if found, FALSE if not. If autocreate is
    TRUE, the keyword is automatically created and TRUE is always returned. */
-int mail_index_keyword_lookup(struct mail_index *index,
-			      const char *keyword, int autocreate,
-			      unsigned int *idx_r);
+bool mail_index_keyword_lookup(struct mail_index *index,
+			       const char *keyword, bool autocreate,
+			       unsigned int *idx_r);
 /* Return a pointer to array of NULL-terminated list of keywords. Note that
    the array contents (and thus pointers inside it) may change after calling
    mail_index_keywords_create() or mail_index_sync_begin(). */
@@ -343,7 +343,7 @@
    before message syncing begins. */
 void mail_index_update_header(struct mail_index_transaction *t,
 			      size_t offset, const void *data, size_t size,
-			      int prepend);
+			      bool prepend);
 
 /* Returns the last error code. */
 enum mail_index_error mail_index_get_last_error(struct mail_index *index);
@@ -359,8 +359,8 @@
 				 uint8_t *flags);
 /* Apply changes in MAIL_INDEX_SYNC_TYPE_KEYWORD_* typed sync records to given
    keywords array. Returns TRUE If something was changed. */
-int mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
-				   array_t *keywords);
+bool mail_index_sync_keywords_apply(const struct mail_index_sync_rec *sync_rec,
+				    array_t *keywords);
 
 /* register index extension. name is a unique identifier for the extension.
    returns unique identifier for the name. */

Index: mail-transaction-log-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-append.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- mail-transaction-log-append.c	6 Jan 2006 23:48:57 -0000	1.16
+++ mail-transaction-log-append.c	13 Jan 2006 20:26:13 -0000	1.17
@@ -100,7 +100,7 @@
 }
 
 static const buffer_t *
-log_get_hdr_update_buffer(struct mail_index_transaction *t, int prepend)
+log_get_hdr_update_buffer(struct mail_index_transaction *t, bool prepend)
 {
 	buffer_t *buf;
 	const unsigned char *data, *mask;

Index: mail-transaction-log-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-private.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- mail-transaction-log-private.h	26 Apr 2005 16:32:02 -0000	1.12
+++ mail-transaction-log-private.h	13 Jan 2006 20:26:13 -0000	1.13
@@ -59,7 +59,7 @@
 
 void mail_transaction_logs_clean(struct mail_transaction_log *log);
 
-int mail_transaction_log_rotate(struct mail_transaction_log *log, int lock);
+int mail_transaction_log_rotate(struct mail_transaction_log *log, bool lock);
 int mail_transaction_log_lock_head(struct mail_transaction_log *log);
 void mail_transaction_log_file_unlock(struct mail_transaction_log_file *file);
 

Index: mail-transaction-log-view.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log-view.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- mail-transaction-log-view.c	6 Jan 2006 22:31:40 -0000	1.43
+++ mail-transaction-log-view.c	13 Jan 2006 20:26:13 -0000	1.44
@@ -240,7 +240,7 @@
 	va_end(va);
 }
 
-int
+bool
 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view)
 {
 	return view->broken;
@@ -388,7 +388,7 @@
 
 int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
 				   const struct mail_transaction_header **hdr_r,
-				   const void **data_r, int *skipped_r)
+				   const void **data_r, bool *skipped_r)
 {
 	const struct mail_transaction_header *hdr;
 	const void *data;

Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- mail-transaction-log.c	6 Jan 2006 23:48:57 -0000	1.104
+++ mail-transaction-log.c	13 Jan 2006 20:26:13 -0000	1.105
@@ -486,7 +486,8 @@
 	struct mail_transaction_log_header hdr;
 	struct stat st;
 	const char *path2;
-	int fd2, ret, found;
+	int fd2, ret;
+	bool found;
 
 	/* log creation is locked now - see if someone already created it */
 	fd2 = open(path, O_RDWR);
@@ -628,7 +629,7 @@
 static int
 mail_transaction_log_file_fd_open(struct mail_transaction_log *log,
                                   struct mail_transaction_log_file **file_r,
-				  const char *path, int fd, int head)
+				  const char *path, int fd, bool head)
 {
         struct mail_transaction_log_file *file;
 	struct stat st;
@@ -802,7 +803,7 @@
 	}
 }
 
-int mail_transaction_log_rotate(struct mail_transaction_log *log, int lock)
+int mail_transaction_log_rotate(struct mail_transaction_log *log, bool lock)
 {
 	struct mail_transaction_log_file *file;
 	const char *path = log->head->filepath;
@@ -852,7 +853,7 @@
 }
 
 static int mail_transaction_log_refresh(struct mail_transaction_log *log,
-					int create_if_needed)
+					bool create_if_needed)
 {
         struct mail_transaction_log_file *file;
 	struct stat st;
@@ -1295,8 +1296,8 @@
 	*file_offset_r = log->head->sync_offset;
 }
 
-int mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
-				      uint32_t file_seq, uoff_t file_offset)
+bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
+				       uint32_t file_seq, uoff_t file_offset)
 {
 	return log->head->hdr.prev_file_seq == file_seq &&
 		log->head->hdr.prev_file_offset == file_offset;

Index: mail-transaction-log.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- mail-transaction-log.h	6 Jan 2006 23:48:57 -0000	1.29
+++ mail-transaction-log.h	13 Jan 2006 20:26:13 -0000	1.30
@@ -126,7 +126,7 @@
    Returns -1 if error, 0 if we're at end of the view, 1 if ok. */
 int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
 				   const struct mail_transaction_header **hdr_r,
-				   const void **data_r, int *skipped_r);
+				   const void **data_r, bool *skipped_r);
 
 /* Returns the position of the record returned previously with
    mail_transaction_log_view_next() */
@@ -140,7 +140,7 @@
 mail_transaction_log_view_set_corrupted(struct mail_transaction_log_view *view,
 					const char *fmt, ...)
 	__attr_format__(2, 3);
-int
+bool
 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view);
 
 void mail_transaction_log_views_close(struct mail_transaction_log *log);
@@ -162,7 +162,7 @@
 void mail_transaction_log_get_head(struct mail_transaction_log *log,
 				   uint32_t *file_seq_r, uoff_t *file_offset_r);
 /* Returns TRUE if given seq/offset is current head log's rotate point. */
-int mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
-				      uint32_t file_seq, uoff_t file_offset);
+bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
+				       uint32_t file_seq, uoff_t file_offset);
 
 #endif



More information about the dovecot-cvs mailing list