changeset 900:981a359257bb HEAD

Replaced MailDataField from being enum to being unsigned int with values defined with macros. Not that pretty, but enums are signed integers and we want to use the highest bit without ugly kludges.
author Timo Sirainen <tss@iki.fi>
date Sat, 04 Jan 2003 19:45:09 +0200
parents d3075affded9
children a225abf5f479
files src/lib-index/mail-index.c src/lib-index/mail-index.h
diffstat 2 files changed, 19 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index.c	Sat Jan 04 19:34:02 2003 +0200
+++ b/src/lib-index/mail-index.c	Sat Jan 04 19:45:09 2003 +0200
@@ -296,7 +296,8 @@
 	if (old_lock_type == MAIL_LOCK_SHARED) {
 		/* releasing shared lock. we may need to update some
 		   flags in header. */
-		unsigned int old_flags, old_cache;
+		unsigned int old_flags;
+		MailDataField old_cache;
 
 		old_flags = index->header->flags;
 		old_cache = index->header->cache_fields;
--- a/src/lib-index/mail-index.h	Sat Jan 04 19:34:02 2003 +0200
+++ b/src/lib-index/mail-index.h	Sat Jan 04 19:45:09 2003 +0200
@@ -26,23 +26,24 @@
 	MAIL_INDEX_FLAG_DIRTY_CUSTOMFLAGS	= 0x80
 };
 
-typedef enum {
-	DATA_FIELD_LOCATION		= 0x00000001,
-	DATA_FIELD_ENVELOPE		= 0x00000002,
-	DATA_FIELD_BODY			= 0x00000004,
-	DATA_FIELD_BODYSTRUCTURE	= 0x00000008,
-	DATA_FIELD_MD5			= 0x00000010,
-	DATA_FIELD_MESSAGEPART		= 0x00000020,
+/* Use macros instead of enum so highest bit can be used without kludging */
+#define DATA_FIELD_LOCATION		0x00000001
+#define DATA_FIELD_ENVELOPE		0x00000002
+#define DATA_FIELD_BODY			0x00000004
+#define DATA_FIELD_BODYSTRUCTURE	0x00000008
+#define DATA_FIELD_MD5			0x00000010
+#define DATA_FIELD_MESSAGEPART		0x00000020
 
-	DATA_FIELD_LAST			= 0x00000040,
-	DATA_FIELD_MAX_BITS		= 6,
+#define DATA_FIELD_LAST			0x00000040
+#define DATA_FIELD_MAX_BITS		6
 
-	/* separate from above, but in same bitmask */
-	DATA_HDR_INTERNAL_DATE		= 0x80000000,
-	DATA_HDR_VIRTUAL_SIZE		= 0x40000000,
-	DATA_HDR_HEADER_SIZE		= 0x20000000,
-	DATA_HDR_BODY_SIZE		= 0x10000000
-} MailDataField;
+/* separate from above, but in same bitmask */
+#define DATA_HDR_INTERNAL_DATE		0x80000000
+#define DATA_HDR_VIRTUAL_SIZE		0x40000000
+#define DATA_HDR_HEADER_SIZE		0x20000000
+#define DATA_HDR_BODY_SIZE		0x10000000
+
+typedef unsigned int MailDataField;
 
 #define IS_BODYSTRUCTURE_FIELD(field) \
 	(((field) & (DATA_FIELD_BODY | DATA_FIELD_BODYSTRUCTURE | \
@@ -395,7 +396,7 @@
 	/* these fields are OR'ed to the fields in index header once we
 	   get around grabbing exclusive lock */
 	unsigned int set_flags;
-	unsigned int set_cache_fields;
+	MailDataField set_cache_fields;
 
 	unsigned int anon_mmap:1;
 	unsigned int opened:1;