File cyrus-imapd-db6.diff of Package cyrus-imapd.3194

From: Jan Engelhardt <jengelh@inai.de>
Date: 2013-06-14 02:52:48.129456384 +0200

src: make compilation with libdb-6.0 succeed

db-6.0 has hit the scene.

The DB_VERSION_MAJOR version number juggling has been replaced in
cyrus-imapd-2.4.7 so that they are no longer necessary.

The changes for ->set_bt_compare (mbox_compar) are not yet present
in cyrus-imapd-2.4.17.

---
 lib/cyrusdb_berkeley.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Index: cyrus-imapd-2.3.18/lib/cyrusdb_berkeley.c
===================================================================
--- cyrus-imapd-2.3.18.orig/lib/cyrusdb_berkeley.c
+++ cyrus-imapd-2.3.18/lib/cyrusdb_berkeley.c
@@ -108,7 +108,7 @@ static void db_panic(DB_ENV *dbenv __att
     exit(EC_TEMPFAIL);
 }
 
-#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR >= 3)
+#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
 static void db_err(const DB_ENV *dbenv __attribute__((unused)),
 		   const char *db_prfx, const char *buffer)
 #else
@@ -164,7 +164,7 @@ static int init(const char *dbdir, int m
 #endif
     }
 
-#if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR >= 3)
+#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
     dbenv->set_msgcall(dbenv, db_msg);
 #endif
     dbenv->set_errcall(dbenv, db_err);
@@ -282,7 +282,7 @@ static int mysync(void)
 
     assert(dbinit);
 
-#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
+#if !(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1))
     do {
 #endif
 #if (DB_VERSION_MAJOR > 3) || ((DB_VERSION_MAJOR == 3) && (DB_VERSION_MINOR > 0))
@@ -290,7 +290,7 @@ static int mysync(void)
 #else
 	r = txn_checkpoint(dbenv, 0, 0);
 #endif
-#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
+#if !(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1))
     } while (r == DB_INCOMPLETE);  /* Never returned by BDB 4.1 */
 #endif
     if (r) {
@@ -388,8 +388,13 @@ static int myarchive(const char **fnames
     return 0;
 }
 
+#if DB_VERSION_MAJOR >= 6
+static int mbox_compar(DB *db __attribute__((unused)),
+		       const DBT *a, const DBT *b, size_t *locp)
+#else
 static int mbox_compar(DB *db __attribute__((unused)),
 		       const DBT *a, const DBT *b)
+#endif
 {
     return bsearch_ncompare((const char *) a->data, a->size,
 			    (const char *) b->data, b->size);
@@ -413,7 +418,7 @@ static int myopen(const char *fname, DBT
     /* xxx set comparator! */
     if (flags & CYRUSDB_MBOXSORT) db->set_bt_compare(db, mbox_compar);
 
-#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
+#if DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
     r = (db->open)(db, NULL, fname, NULL, type, dbflags | DB_AUTO_COMMIT, 0664);
 #else
     r = (db->open)(db, fname, NULL, type, dbflags, 0664);
openSUSE Build Service is sponsored by