SHA256
1
0
forked from pool/rsync
rsync/rsync-both-compressions.patch
2017-07-24 11:00:40 +00:00

144 lines
4.6 KiB
Diff

diff --git a/configure.ac b/configure.ac
index e01e124b..5a0b9bca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -794,26 +794,23 @@ else
AC_MSG_RESULT(no)
fi
-# We default to using our zlib unless --with-included-zlib=no is given.
+# Always compile with system zlib but if --with-included-zlib=yes is given
+# or not specified at all compile in the support too.
if test x"$with_included_zlib" != x"no"; then
with_included_zlib=yes
elif test x"$ac_cv_header_zlib_h" != x"yes"; then
with_included_zlib=yes
fi
-if test x"$with_included_zlib" != x"yes"; then
- AC_CHECK_LIB(z, deflateParams, , [with_included_zlib=yes])
-fi
AC_MSG_CHECKING([whether to use included zlib])
if test x"$with_included_zlib" = x"yes"; then
AC_MSG_RESULT($srcdir/zlib)
BUILD_ZLIB='$(zlib_OBJS)'
CFLAGS="-I$srcdir/zlib $CFLAGS"
-else
- AC_DEFINE(EXTERNAL_ZLIB, 1, [Define to 1 if using external zlib])
- AC_MSG_RESULT(no)
fi
+AC_CHECK_LIB(z, deflateParams, , [AC_MSG_ERROR([zlib with deflateParams not found])])
+
AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
diff --git a/options.c b/options.c
index 64ec8b84..522875c5 100644
--- a/options.c
+++ b/options.c
@@ -1866,16 +1866,6 @@ int parse_arguments(int *argc_p, const char ***argv_p)
create_refuse_error(refused_compress);
return 0;
}
-#ifdef EXTERNAL_ZLIB
- if (do_compression == 1) {
- snprintf(err_buf, sizeof err_buf,
- "This rsync lacks old-style --compress due to its external zlib. Try -zz.\n");
- if (am_server)
- return 0;
- fprintf(stderr, "%s" "Continuing without compression.\n\n", err_buf);
- do_compression = 0;
- }
-#endif
}
#ifdef HAVE_SETVBUF
diff --git a/token.c b/token.c
index ad9b9bcd..a1ceb975 100644
--- a/token.c
+++ b/token.c
@@ -374,7 +374,7 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
}
if (nb == 0 && token != -2)
flush = Z_SYNC_FLUSH;
- r = deflate(&tx_strm, flush);
+ r = deflate_int(&tx_strm, flush);
if (r != Z_OK) {
rprintf(FERROR, "deflate returned %d\n", r);
exit_cleanup(RERR_STREAMIO);
@@ -405,7 +405,6 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
} else if (token != -2 && do_compression == 1) {
/* Add the data in the current block to the compressor's
* history and hash table. */
-#ifndef EXTERNAL_ZLIB
do {
/* Break up long sections in the same way that
* see_deflate_token() does. */
@@ -417,18 +416,13 @@ send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset,
offset += n1;
tx_strm.next_out = (Bytef *) obuf;
tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
- r = deflate(&tx_strm, Z_INSERT_ONLY);
+ r = deflate_int(&tx_strm, Z_INSERT_ONLY);
if (r != Z_OK || tx_strm.avail_in != 0) {
rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
r, tx_strm.avail_in);
exit_cleanup(RERR_STREAMIO);
}
} while (toklen > 0);
-#else
- toklen++;
- rprintf(FERROR, "Impossible error in external-zlib code (1).\n");
- exit_cleanup(RERR_STREAMIO);
-#endif
}
}
@@ -579,7 +573,6 @@ static int32 recv_deflated_token(int f, char **data)
*/
static void see_deflate_token(char *buf, int32 len)
{
-#ifndef EXTERNAL_ZLIB
int r;
int32 blklen;
unsigned char hdr[5];
@@ -617,11 +610,6 @@ static void see_deflate_token(char *buf, int32 len)
exit_cleanup(RERR_STREAMIO);
}
} while (len || rx_strm.avail_out == 0);
-#else
- buf++; len++;
- rprintf(FERROR, "Impossible error in external-zlib code (2).\n");
- exit_cleanup(RERR_STREAMIO);
-#endif
}
/**
diff --git a/zlib/deflate.c b/zlib/deflate.c
index 529c5e8d..ba711897 100644
--- a/zlib/deflate.c
+++ b/zlib/deflate.c
@@ -664,7 +664,7 @@ local void flush_pending(strm)
}
/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
+int ZEXPORT deflate_int (strm, flush)
z_streamp strm;
int flush;
{
diff --git a/zlib/zlib.h b/zlib/zlib.h
index c4536ca7..ee98c332 100644
--- a/zlib/zlib.h
+++ b/zlib/zlib.h
@@ -244,7 +244,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT deflate_int OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce