[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha5-449-g3f4eb09

Stefan Metzmacher metze at samba.org
Sat Sep 6 15:18:03 GMT 2008


The branch, v4-0-test has been updated
       via  3f4eb091f0dcc53acbfdc63a8d82a5a0f28954a6 (commit)
       via  ac43081b93966b545928230f7af8654b942432da (commit)
       via  426d129dfff1e2d3750884abb68089ff1850e640 (commit)
       via  83446e22dd1eda958ef62bbe998da0a47b9ff8ef (commit)
       via  dcc57512b030995d9b186c7a6cb3b304d5680867 (commit)
       via  d68e36b485239cbaf99a6dce3f3bf52b4abcd06d (commit)
      from  840369b5534eee21818b9d3677404b0fc60a0219 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 3f4eb091f0dcc53acbfdc63a8d82a5a0f28954a6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Sep 6 12:04:00 2008 +0200

    zlib: we require zlib-1.2.3 or higher
    
    metze

commit ac43081b93966b545928230f7af8654b942432da
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Sep 6 10:58:53 2008 +0200

    Revert "zlib: add inflateReset2()..."
    
    This reverts commit 2a4fb661d7e3d601a5eb9ccecb4d4f2b07073097.
    
    (we don't need inflateReset2 anymore)
    
    metze

commit 426d129dfff1e2d3750884abb68089ff1850e640
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Sep 6 10:57:33 2008 +0200

    Revert "zlib: we don't need the inflateReset2 prototype twice"
    
    This reverts commit 0dbbc287f65a51330c5309df5a96b3acd4d044d5.
    
    (we don't need inflateReset2 anymore)
    
    metze

commit 83446e22dd1eda958ef62bbe998da0a47b9ff8ef
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Sep 6 10:55:04 2008 +0200

    ndr_compression: change debug levels
    
    metze

commit dcc57512b030995d9b186c7a6cb3b304d5680867
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Sep 6 16:16:00 2008 +0200

    ndr_compression: use deflateReset() together with defalteSetDictionary()
    
    metze

commit d68e36b485239cbaf99a6dce3f3bf52b4abcd06d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Sep 5 20:18:07 2008 +0200

    ndr_compression: use inflateReset() and inflateSetDictionary() instead of inflateReset2()
    
    Now we can use an unmodified system zlib-1.2.3
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source/lib/zlib.m4                  |   21 +++++++++++--
 source/lib/zlib/inflate.c           |   15 ++--------
 source/lib/zlib/zconf.h             |    1 -
 source/lib/zlib/zlib.h              |   13 --------
 source/librpc/ndr/ndr_compression.c |   54 ++++++++++++++++++++++------------
 5 files changed, 56 insertions(+), 48 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/zlib.m4 b/source/lib/zlib.m4
index 7b967fc..9ee7b8e 100644
--- a/source/lib/zlib.m4
+++ b/source/lib/zlib.m4
@@ -1,11 +1,26 @@
 
 AC_CHECK_HEADERS(zlib.h)
 
-# we require this new function...
-AC_CHECK_LIB_EXT(z, ZLIB_LIBS, inflateReset2)
+AC_CHECK_LIB_EXT(z, ZLIB_LIBS, zlibVersion)
+
+AC_CACHE_CHECK([for zlib >= 1.2.3], samba_cv_zlib_1_2_3, [
+	AC_TRY_COMPILE([
+		#include <zlib.h>
+		],[
+		#if (ZLIB_VERNUM >= 0x1230)
+		#else
+		#error "ZLIB_VERNUM < 0x1230"
+		#endif
+		],[
+		samba_cv_zlib_1_2_3=yes
+		],[
+		samba_cv_zlib_1_2_3=no
+		])
+])
 
 if test x"$ac_cv_header_zlib_h" = x"yes" -a \
-	x"$ac_cv_lib_ext_z_inflateReset2" = x"yes"; then
+	x"$ac_cv_lib_ext_z_zlibVersion" = x"yes" -a \
+	x"$samba_cv_zlib_1_2_3" = x"yes"; then
 	SMB_EXT_LIB(ZLIB, [${ZLIB_LIBS}])
 else
 	SMB_INCLUDE_MK(lib/zlib.mk)
diff --git a/source/lib/zlib/inflate.c b/source/lib/zlib/inflate.c
index fbecefd..ccbfac8 100644
--- a/source/lib/zlib/inflate.c
+++ b/source/lib/zlib/inflate.c
@@ -100,9 +100,8 @@ local int updatewindow OF((z_streamp strm, unsigned out));
 local unsigned syncsearch OF((unsigned FAR *have, unsigned const char FAR *buf,
                               unsigned len));
 
-int ZEXPORT inflateReset2(strm, flags)
+int ZEXPORT inflateReset(strm)
 z_streamp strm;
-unsigned flags;
 {
     struct inflate_state FAR *state;
 
@@ -116,10 +115,8 @@ unsigned flags;
     state->havedict = 0;
     state->dmax = 32768U;
     state->head = Z_NULL;
-    if (!(flags & Z_RESET_KEEP_WINDOW)) {
-        state->wsize = 0;
-        state->whave = 0;
-    }
+    state->wsize = 0;
+    state->whave = 0;
     state->write = 0;
     state->hold = 0;
     state->bits = 0;
@@ -128,12 +125,6 @@ unsigned flags;
     return Z_OK;
 }
 
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
-    return inflateReset2(strm, 0);
-}
-
 int ZEXPORT inflatePrime(strm, bits, value)
 z_streamp strm;
 int bits;
diff --git a/source/lib/zlib/zconf.h b/source/lib/zlib/zconf.h
index 214603c..3742ad4 100644
--- a/source/lib/zlib/zconf.h
+++ b/source/lib/zlib/zconf.h
@@ -35,7 +35,6 @@
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateCopy           z_inflateCopy
 #  define inflateReset          z_inflateReset
-#  define inflateReset2         z_inflateReset2
 #  define inflateBack           z_inflateBack
 #  define inflateBackEnd        z_inflateBackEnd
 #  define compress              z_compress
diff --git a/source/lib/zlib/zlib.h b/source/lib/zlib/zlib.h
index edf09d2..a660031 100644
--- a/source/lib/zlib/zlib.h
+++ b/source/lib/zlib/zlib.h
@@ -210,9 +210,6 @@ typedef gz_header FAR *gz_headerp;
 
 #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
 
-#define Z_RESET_KEEP_WINDOW 0x0001
-/* This flag can be passed to inflateReset2 and deflateReset2 */
-
 #define zlib_version zlibVersion()
 /* for compatibility with versions < 1.0.2 */
 
@@ -815,16 +812,6 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
    stream state was inconsistent (such as zalloc or state being NULL).
 */
 
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, unsigned flags));
-/*
-     This function is like inflateReset, but you can pass some flags
-   to have further control over the behavior. If you pass Z_RESET_KEEP_WINDOW
-   the window will be untouched and will be reused in the next runs of inflate()
-
-      inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
-   stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
                                      int bits,
                                      int value));
diff --git a/source/librpc/ndr/ndr_compression.c b/source/librpc/ndr/ndr_compression.c
index 37f95bb..5939c38 100644
--- a/source/librpc/ndr/ndr_compression.c
+++ b/source/librpc/ndr/ndr_compression.c
@@ -57,8 +57,8 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
 
 	NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
 
-	DEBUG(10,("MSZIP plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
-		  plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
+	DEBUG(9,("MSZIP plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+		 plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
 
 	comp_chunk_offset = ndrpull->offset;
 	NDR_CHECK(ndr_pull_advance(ndrpull, comp_chunk_size));
@@ -104,13 +104,6 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
 					      zError(z_ret), z_ret);
 
 		}
-	} else {
-		z_ret = inflateReset2(z, Z_RESET_KEEP_WINDOW);
-		if (z_ret != Z_OK) {
-			return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
-					      "Bad inflateReset2 error %s(%d) (PULL)",
-					      zError(z_ret), z_ret);
-		}
 	}
 
 	/* call inflate untill we get Z_STREAM_END or an error */
@@ -142,6 +135,20 @@ static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpu
 		*last = true;
 	}
 
+	z_ret = inflateReset(z);
+	if (z_ret != Z_OK) {
+		return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+				      "Bad inflateReset error %s(%d) (PULL)",
+				      zError(z_ret), z_ret);
+	}
+
+	z_ret = inflateSetDictionary(z, plain_chunk.data, plain_chunk.length);
+	if (z_ret != Z_OK) {
+		return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+				      "Bad inflateSetDictionary error %s(%d) (PULL)",
+				      zError(z_ret), z_ret);
+	}
+
 	return NDR_ERR_SUCCESS;
 }
 
@@ -212,14 +219,6 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu
 					      zError(z_ret), z_ret);
 
 		}
-	} else {
-		/* TODO: keep the window */
-		z_ret = deflateReset(z);
-		if (z_ret != Z_OK) {
-			return ndr_push_error(ndrpush, NDR_ERR_COMPRESSION,
-					      "Bad delateReset2 error %s(%d) (PUSH)",
-					      zError(z_ret), z_ret);
-		}
 	}
 
 	/* call deflate untill we get Z_STREAM_END or an error */
@@ -241,11 +240,28 @@ static enum ndr_err_code ndr_push_compression_mszip_chunk(struct ndr_push *ndrpu
 
 	comp_chunk_size = 2 + z->total_out;
 
+	z_ret = deflateReset(z);
+	if (z_ret != Z_OK) {
+		return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+				      "Bad deflateReset error %s(%d) (PULL)",
+				      zError(z_ret), z_ret);
+	}
+
+	z_ret = deflateSetDictionary(z, plain_chunk.data, plain_chunk.length);
+	if (z_ret != Z_OK) {
+		return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
+				      "Bad deflateSetDictionary error %s(%d) (PULL)",
+				      zError(z_ret), z_ret);
+	}
+
 	tmp_offset = ndrpush->offset;
 	ndrpush->offset = comp_chunk_size_offset;
 	NDR_CHECK(ndr_push_uint32(ndrpush, NDR_SCALARS, comp_chunk_size));
 	ndrpush->offset = tmp_offset;
 
+	DEBUG(9,("MSZIP comp plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+		 plain_chunk.length, plain_chunk.length, comp_chunk_size, comp_chunk_size));
+
 	ndrpush->offset += comp_chunk_size;
 	return NDR_ERR_SUCCESS;
 }
@@ -279,8 +295,8 @@ static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrp
 	plain_chunk.length = plain_chunk_size;
 	plain_chunk.data = ndrpush->data + plain_chunk_offset;
 
-	DEBUG(10,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
-		  plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
+	DEBUG(9,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
+		 plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
 
 	/* Uncompressing the buffer using LZ Xpress algorithm */
 	lzxpress_decompress(&comp_chunk, &plain_chunk);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list