View | Details | Raw Unified | Return to bug 1046197
Collapse All | Expand All

(-)a/configure.ac (-7 / +4 lines)
Lines 794-819 else Link Here
794
    AC_MSG_RESULT(no)
794
    AC_MSG_RESULT(no)
795
fi
795
fi
796
796
797
# We default to using our zlib unless --with-included-zlib=no is given.
797
# Always compile with system zlib but if --with-included-zlib=yes is given
798
# or not specified at all compile in the support too.
798
if test x"$with_included_zlib" != x"no"; then
799
if test x"$with_included_zlib" != x"no"; then
799
    with_included_zlib=yes
800
    with_included_zlib=yes
800
elif test x"$ac_cv_header_zlib_h" != x"yes"; then
801
elif test x"$ac_cv_header_zlib_h" != x"yes"; then
801
    with_included_zlib=yes
802
    with_included_zlib=yes
802
fi
803
fi
803
if test x"$with_included_zlib" != x"yes"; then
804
    AC_CHECK_LIB(z, deflateParams, , [with_included_zlib=yes])
805
fi
806
804
807
AC_MSG_CHECKING([whether to use included zlib])
805
AC_MSG_CHECKING([whether to use included zlib])
808
if test x"$with_included_zlib" = x"yes"; then
806
if test x"$with_included_zlib" = x"yes"; then
809
    AC_MSG_RESULT($srcdir/zlib)
807
    AC_MSG_RESULT($srcdir/zlib)
810
    BUILD_ZLIB='$(zlib_OBJS)'
808
    BUILD_ZLIB='$(zlib_OBJS)'
811
    CFLAGS="-I$srcdir/zlib $CFLAGS"
809
    CFLAGS="-I$srcdir/zlib $CFLAGS"
812
else
813
    AC_DEFINE(EXTERNAL_ZLIB, 1, [Define to 1 if using external zlib])
814
    AC_MSG_RESULT(no)
815
fi
810
fi
816
811
812
AC_CHECK_LIB(z, deflateParams, , [AC_MSG_ERROR([zlib with deflateParams not found])])
813
817
AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
814
AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
818
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
815
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
819
if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
816
if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
(-)a/options.c (-10 lines)
Lines 1866-1881 int parse_arguments(int *argc_p, const char ***argv_p) Link Here
1866
			create_refuse_error(refused_compress);
1866
			create_refuse_error(refused_compress);
1867
			return 0;
1867
			return 0;
1868
		}
1868
		}
1869
#ifdef EXTERNAL_ZLIB
1870
		if (do_compression == 1) {
1871
			snprintf(err_buf, sizeof err_buf,
1872
				"This rsync lacks old-style --compress due to its external zlib.  Try -zz.\n");
1873
			if (am_server)
1874
				return 0;
1875
			fprintf(stderr, "%s" "Continuing without compression.\n\n", err_buf);
1876
			do_compression = 0;
1877
		}
1878
#endif
1879
	}
1869
	}
1880
1870
1881
#ifdef HAVE_SETVBUF
1871
#ifdef HAVE_SETVBUF
(-)a/token.c (-13 / +1 lines)
Lines 405-411 send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset, Link Here
405
	} else if (token != -2 && do_compression == 1) {
405
	} else if (token != -2 && do_compression == 1) {
406
		/* Add the data in the current block to the compressor's
406
		/* Add the data in the current block to the compressor's
407
		 * history and hash table. */
407
		 * history and hash table. */
408
#ifndef EXTERNAL_ZLIB
409
		do {
408
		do {
410
			/* Break up long sections in the same way that
409
			/* Break up long sections in the same way that
411
			 * see_deflate_token() does. */
410
			 * see_deflate_token() does. */
Lines 417-434 send_deflated_token(int f, int32 token, struct map_struct *buf, OFF_T offset, Link Here
417
				offset += n1;
416
				offset += n1;
418
			tx_strm.next_out = (Bytef *) obuf;
417
			tx_strm.next_out = (Bytef *) obuf;
419
			tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
418
			tx_strm.avail_out = AVAIL_OUT_SIZE(CHUNK_SIZE);
420
			r = deflate(&tx_strm, Z_INSERT_ONLY);
419
			r = deflate_int(&tx_strm, Z_INSERT_ONLY);
421
			if (r != Z_OK || tx_strm.avail_in != 0) {
420
			if (r != Z_OK || tx_strm.avail_in != 0) {
422
				rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
421
				rprintf(FERROR, "deflate on token returned %d (%d bytes left)\n",
423
					r, tx_strm.avail_in);
422
					r, tx_strm.avail_in);
424
				exit_cleanup(RERR_STREAMIO);
423
				exit_cleanup(RERR_STREAMIO);
425
			}
424
			}
426
		} while (toklen > 0);
425
		} while (toklen > 0);
427
#else
428
		toklen++;
429
		rprintf(FERROR, "Impossible error in external-zlib code (1).\n");
430
		exit_cleanup(RERR_STREAMIO);
431
#endif
432
	}
426
	}
433
}
427
}
434
428
Lines 579-585 static int32 recv_deflated_token(int f, char **data) Link Here
579
 */
573
 */
580
static void see_deflate_token(char *buf, int32 len)
574
static void see_deflate_token(char *buf, int32 len)
581
{
575
{
582
#ifndef EXTERNAL_ZLIB
583
	int r;
576
	int r;
584
	int32 blklen;
577
	int32 blklen;
585
	unsigned char hdr[5];
578
	unsigned char hdr[5];
Lines 617-627 static void see_deflate_token(char *buf, int32 len) Link Here
617
			exit_cleanup(RERR_STREAMIO);
610
			exit_cleanup(RERR_STREAMIO);
618
		}
611
		}
619
	} while (len || rx_strm.avail_out == 0);
612
	} while (len || rx_strm.avail_out == 0);
620
#else
621
	buf++; len++;
622
	rprintf(FERROR, "Impossible error in external-zlib code (2).\n");
623
	exit_cleanup(RERR_STREAMIO);
624
#endif
625
}
613
}
626
614
627
/**
615
/**
(-)a/zlib/deflate.c (-1 / +1 lines)
Lines 664-670 local void flush_pending(strm) Link Here
664
}
664
}
665
665
666
/* ========================================================================= */
666
/* ========================================================================= */
667
int ZEXPORT deflate (strm, flush)
667
int ZEXPORT deflate_int (strm, flush)
668
    z_streamp strm;
668
    z_streamp strm;
669
    int flush;
669
    int flush;
670
{
670
{
(-)a/zlib/zlib.h (-1 / +1 lines)
Lines 244-250 ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Link Here
244
*/
244
*/
245
245
246
246
247
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
247
ZEXTERN int ZEXPORT deflate_int OF((z_streamp strm, int flush));
248
/*
248
/*
249
    deflate compresses as much data as possible, and stops when the input
249
    deflate compresses as much data as possible, and stops when the input
250
  buffer becomes empty or the output buffer becomes full.  It may introduce
250
  buffer becomes empty or the output buffer becomes full.  It may introduce

Return to bug 1046197