diff src/lib-storage/index/dbox-multi/mdbox-storage.c @ 13287:957060ca5b69

Moved GUID code to liblib. Use guid_128_t type consistently everywhere.
author Timo Sirainen <tss@iki.fi>
date Thu, 25 Aug 2011 01:16:11 +0300
parents 189c9baf840a
children b7e58d26393f
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Thu Aug 25 00:27:41 2011 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Thu Aug 25 01:16:11 2011 +0300
@@ -127,7 +127,7 @@
 					sizeof(struct mdbox_index_header), 0, 0);
 	mbox->guid_ext_id =
 		mail_index_ext_register(mbox->box.index, "guid",
-					0, MAIL_GUID_128_SIZE, 1);
+					0, GUID_128_SIZE, 1);
 	return 0;
 }
 
@@ -173,11 +173,11 @@
 
 	new_hdr = hdr;
 
-	if (update != NULL && !mail_guid_128_is_empty(update->mailbox_guid)) {
+	if (update != NULL && !guid_128_is_empty(update->mailbox_guid)) {
 		memcpy(new_hdr.mailbox_guid, update->mailbox_guid,
 		       sizeof(new_hdr.mailbox_guid));
-	} else if (mail_guid_128_is_empty(new_hdr.mailbox_guid)) {
-		mail_generate_guid_128(new_hdr.mailbox_guid);
+	} else if (guid_128_is_empty(new_hdr.mailbox_guid)) {
+		guid_128_generate(new_hdr.mailbox_guid);
 	}
 
 	new_hdr.map_uid_validity =
@@ -306,21 +306,20 @@
 }
 
 static int
-mdbox_mailbox_get_guid(struct mdbox_mailbox *mbox,
-		       uint8_t guid[MAIL_GUID_128_SIZE])
+mdbox_mailbox_get_guid(struct mdbox_mailbox *mbox, guid_128_t guid_r)
 {
 	struct mdbox_index_header hdr;
 
 	if (mdbox_read_header(mbox, &hdr) < 0)
 		memset(&hdr, 0, sizeof(hdr));
 
-	if (mail_guid_128_is_empty(hdr.mailbox_guid)) {
+	if (guid_128_is_empty(hdr.mailbox_guid)) {
 		/* regenerate it */
 		if (mdbox_write_index_header(&mbox->box, NULL, NULL) < 0 ||
 		    mdbox_read_header(mbox, &hdr) < 0)
 			return -1;
 	}
-	memcpy(guid, hdr.mailbox_guid, MAIL_GUID_128_SIZE);
+	memcpy(guid_r, hdr.mailbox_guid, GUID_128_SIZE);
 	return 0;
 }