dovecot-2.2: Fixed compiling without zlib.

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 4 14:59:25 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/65705d9d94f1
changeset: 15990:65705d9d94f1
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 04 14:59:13 2013 +0200
description:
Fixed compiling without zlib.

diffstat:

 src/doveadm/doveadm-zlib.c        |  64 ++++++++++++++++++++++----------------
 src/lib-compression/compression.c |   2 +
 2 files changed, 39 insertions(+), 27 deletions(-)

diffs (101 lines):

diff -r 976bf9e69367 -r 65705d9d94f1 src/doveadm/doveadm-zlib.c
--- a/src/doveadm/doveadm-zlib.c	Wed Feb 27 18:00:29 2013 +0200
+++ b/src/doveadm/doveadm-zlib.c	Mon Mar 04 14:59:13 2013 +0200
@@ -14,8 +14,33 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-const char *doveadm_zlib_plugin_version = DOVECOT_ABI_VERSION;
+static bool test_dump_imapzlib(const char *path)
+{
+	const char *p;
+	char buf[4096];
+	int fd, ret;
+	bool match = FALSE;
 
+	p = strrchr(path, '.');
+	if (p == NULL || (strcmp(p, ".in") != 0 && strcmp(p, ".out") != 0))
+		return FALSE;
+
+	fd = open(path, O_RDONLY);
+	if (fd == -1)
+		return FALSE;
+
+	ret = read(fd, buf, sizeof(buf)-1);
+	if (ret > 0) {
+		buf[ret] = '\0';
+		(void)str_lcase(buf);
+		match = strstr(buf, " ok begin compression.") != NULL ||
+			strstr(buf, " compress deflate") != NULL;
+	}
+	i_close_fd(&fd);
+	return match;
+}
+
+#ifdef HAVE_ZLIB
 static void cmd_dump_imapzlib(int argc ATTR_UNUSED, char *argv[])
 {
 	struct istream *input, *input2;
@@ -52,32 +77,6 @@
 	fflush(stdout);
 }
 
-static bool test_dump_imapzlib(const char *path)
-{
-	const char *p;
-	char buf[4096];
-	int fd, ret;
-	bool match = FALSE;
-
-	p = strrchr(path, '.');
-	if (p == NULL || (strcmp(p, ".in") != 0 && strcmp(p, ".out") != 0))
-		return FALSE;
-
-	fd = open(path, O_RDONLY);
-	if (fd == -1)
-		return FALSE;
-
-	ret = read(fd, buf, sizeof(buf)-1);
-	if (ret > 0) {
-		buf[ret] = '\0';
-		(void)str_lcase(buf);
-		match = strstr(buf, " ok begin compression.") != NULL ||
-			strstr(buf, " compress deflate") != NULL;
-	}
-	i_close_fd(&fd);
-	return match;
-}
-
 struct client {
 	int fd;
 	struct io *io_client, *io_server;
@@ -176,6 +175,17 @@
 	if (close(fd) < 0)
 		i_fatal("close() failed: %m");
 }
+#else
+static void cmd_dump_imapzlib(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
+{
+	i_fatal("Dovecot compiled without zlib support");
+}
+
+static void cmd_zlibconnect(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
+{
+	i_fatal("Dovecot compiled without zlib support");
+}
+#endif
 
 struct doveadm_cmd_dump doveadm_cmd_dump_zlib = {
 	"imapzlib",
diff -r 976bf9e69367 -r 65705d9d94f1 src/lib-compression/compression.c
--- a/src/lib-compression/compression.c	Wed Feb 27 18:00:29 2013 +0200
+++ b/src/lib-compression/compression.c	Mon Mar 04 14:59:13 2013 +0200
@@ -9,6 +9,8 @@
 #ifndef HAVE_ZLIB
 #  define i_stream_create_gz NULL
 #  define o_stream_create_gz NULL
+#  define i_stream_create_deflate NULL
+#  define o_stream_create_deflate NULL
 #endif
 #ifndef HAVE_BZLIB
 #  define i_stream_create_bz2 NULL


More information about the dovecot-cvs mailing list