[Bf-blender-cvs] [db9b1f7] soc-2014-nurbs: Adapted opennurbs to use the system zlib and removed its custom zlib library.

Jonathan deWerd noreply at git.blender.org
Tue Jun 3 18:37:43 CEST 2014


Commit: db9b1f7d8724e089e96864caf84543bc5c6a11c0
Author: Jonathan deWerd
Date:   Mon Jun 2 10:16:43 2014 -0400
https://developer.blender.org/rBdb9b1f7d8724e089e96864caf84543bc5c6a11c0

Adapted opennurbs to use the system zlib and removed its custom zlib library.

===================================================================

M	extern/opennurbs/CMakeLists.txt
M	extern/opennurbs/opennurbs_compress.cpp
M	extern/opennurbs/opennurbs_zlib.cpp
M	extern/opennurbs/opennurbs_zlib.h
D	extern/opennurbs/zlib/CMakeLists.txt
D	extern/opennurbs/zlib/adler32.c
D	extern/opennurbs/zlib/compress.c
D	extern/opennurbs/zlib/crc32.c
D	extern/opennurbs/zlib/crc32.h
D	extern/opennurbs/zlib/deflate.c
D	extern/opennurbs/zlib/deflate.h
D	extern/opennurbs/zlib/infback.c
D	extern/opennurbs/zlib/inffast.c
D	extern/opennurbs/zlib/inffast.h
D	extern/opennurbs/zlib/inffixed.h
D	extern/opennurbs/zlib/inflate.c
D	extern/opennurbs/zlib/inflate.h
D	extern/opennurbs/zlib/inftrees.c
D	extern/opennurbs/zlib/inftrees.h
D	extern/opennurbs/zlib/opennurbs_zlib_readme.txt
D	extern/opennurbs/zlib/trees.c
D	extern/opennurbs/zlib/trees.h
D	extern/opennurbs/zlib/uncompr.c
D	extern/opennurbs/zlib/zconf.h
D	extern/opennurbs/zlib/zlib.h
D	extern/opennurbs/zlib/zutil.c
D	extern/opennurbs/zlib/zutil.h
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/extern/opennurbs/CMakeLists.txt b/extern/opennurbs/CMakeLists.txt
index 5bfdcb3..bfc523e 100644
--- a/extern/opennurbs/CMakeLists.txt
+++ b/extern/opennurbs/CMakeLists.txt
@@ -22,15 +22,15 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-# NOTE: This file is automatically generated by bundle.sh script
-#       If you're doing changes in this file, please update template
-#       in that script too
+# NOTE FOR THOSE UPDATING OPENNURBS:
+# Change #include "./zlib/zlib.h" in opennurbs_zlib.h to #include "zlib.h"
 
 set(INC
 	.
 )
 
 set(INC_SYS
+	${ZLIB_INCLUDE_DIR}
 )
 
 set(SRC
@@ -254,5 +254,3 @@ set(SRC
 )
 
 blender_add_lib(extern_opennurbs "${SRC}" "${INC}" "${INC_SYS}")
-
-add_subdirectory(zlib)
diff --git a/extern/opennurbs/opennurbs_compress.cpp b/extern/opennurbs/opennurbs_compress.cpp
index b94ce37..e963c60 100755
--- a/extern/opennurbs/opennurbs_compress.cpp
+++ b/extern/opennurbs/opennurbs_compress.cpp
@@ -121,7 +121,7 @@ bool ON_CompressStream::In( ON__UINT64 size, const void* uncompressed_buffer )
     // compressed output in m_zlib.strm.next_out[], or do both.
 
     // provide storage for compressed stream output
-    strm.next_out  = (z_Bytef*)out_buffer;
+    strm.next_out  = (Bytef*)out_buffer;
     strm.avail_out = sizeof_out_buffer;
 
     if ( strm.avail_in <= 0 )
@@ -135,7 +135,7 @@ bool ON_CompressStream::In( ON__UINT64 size, const void* uncompressed_buffer )
       ON__UINT64 sz = (size > max_sz) ? max_sz : size;
       m_in_size += sz;
       m_in_crc = ON_CRC32(m_in_crc,(size_t)sz,uncompressed_buffer); // (size_t) cast is safe because sz <= max_sz = 0x7FFFFFF0
-      strm.next_in = (z_Bytef*)uncompressed_buffer;
+      strm.next_in = (Bytef*)uncompressed_buffer;
       strm.avail_in = (ON__UINT32)sz;
       uncompressed_buffer = ((const unsigned char*)uncompressed_buffer) + sz;
       size -= sz;
@@ -145,7 +145,7 @@ bool ON_CompressStream::In( ON__UINT64 size, const void* uncompressed_buffer )
     // calculate compression
     ON__UINT32 avail_in0 = strm.avail_in;
     ON__UINT32 avail_out0 = strm.avail_out;
-    zrc = z_deflate( &strm, Z_NO_FLUSH ); 
+    zrc = deflate( &strm, Z_NO_FLUSH );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -228,11 +228,11 @@ bool ON_CompressStream::End()
     // provide storage for compressed stream output
     strm.avail_in = 0;
     strm.next_in = 0;
-    strm.next_out  = (z_Bytef*)out_buffer;
+    strm.next_out  = (Bytef*)out_buffer;
     strm.avail_out = sizeof_out_buffer;
 
     // finish compression calculation
-    zrc = z_deflate( &strm, Z_FINISH ); 
+    zrc = deflate( &strm, Z_FINISH ); 
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -439,7 +439,7 @@ bool ON_UncompressStream::In( ON__UINT64 size, const void* compressed_buffer )
     // uncompressed output in strm.next_out[], or do both.
 
     // provide storage for uncompressed stream output
-    strm.next_out  = (z_Bytef*)out_buffer;
+    strm.next_out  = (Bytef*)out_buffer;
     strm.avail_out = sizeof_out_buffer;
 
     if ( strm.avail_in <= 0 )
@@ -453,7 +453,7 @@ bool ON_UncompressStream::In( ON__UINT64 size, const void* compressed_buffer )
       ON__UINT64 sz = (size > max_sz) ? max_sz : size;
       m_in_size += sz;
       m_in_crc = ON_CRC32(m_in_crc,(size_t)sz,compressed_buffer); // (size_t) cast is safe because sz <= max_sz = 0x7FFFFFF0
-      strm.next_in = (z_Bytef*)compressed_buffer;
+      strm.next_in = (Bytef*)compressed_buffer;
       strm.avail_in = (ON__UINT32)sz;
       compressed_buffer = ((const unsigned char*)compressed_buffer) + sz;
       size -= sz;
@@ -463,7 +463,7 @@ bool ON_UncompressStream::In( ON__UINT64 size, const void* compressed_buffer )
     // calculate compression
     ON__UINT32 avail_in0 = strm.avail_in;
     ON__UINT32 avail_out0 = strm.avail_out;
-    zrc = z_inflate( &strm, Z_NO_FLUSH ); 
+    zrc = inflate( &strm, Z_NO_FLUSH );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -546,11 +546,11 @@ bool ON_UncompressStream::End()
     // provide storage for compressed stream output
     strm.avail_in = 0;
     strm.next_in = 0;
-    strm.next_out  = (z_Bytef*)out_buffer;
+    strm.next_out  = (Bytef*)out_buffer;
     strm.avail_out = sizeof_out_buffer;
 
     // finish compression calculation
-    zrc = z_inflate( &strm, Z_FINISH ); 
+    zrc = inflate( &strm, Z_FINISH ); 
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
diff --git a/extern/opennurbs/opennurbs_zlib.cpp b/extern/opennurbs/opennurbs_zlib.cpp
index 473be21..0acbe47 100755
--- a/extern/opennurbs/opennurbs_zlib.cpp
+++ b/extern/opennurbs/opennurbs_zlib.cpp
@@ -293,7 +293,7 @@ size_t ON_BinaryArchive::WriteDeflate( // returns number of bytes written
       // no uncompressed input is left - switch to finish mode
       flush = Z_FINISH;
     }
-    zrc = z_deflate( &m_zlib.strm, flush ); 
+    zrc = deflate( &m_zlib.strm, flush );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -491,7 +491,7 @@ bool ON_BinaryArchive::ReadInflate(
       // no compressed input is left - switch to finish mode
       flush = Z_FINISH;
     }
-    zrc = z_inflate( &m_zlib.strm, flush );
+    zrc = inflate( &m_zlib.strm, flush );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -1151,7 +1151,7 @@ size_t ON_CompressedBuffer::DeflateHelper( // returns number of bytes written
       // no uncompressed input is left - switch to finish mode
       flush = Z_FINISH;
     }
-    zrc = z_deflate( &m_zlib.strm, flush ); 
+    zrc = deflate( &m_zlib.strm, flush );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
@@ -1284,7 +1284,7 @@ bool ON_CompressedBuffer::InflateHelper(
       // no compressed input is left - switch to finish mode
       flush = Z_FINISH;
     }
-    zrc = z_inflate( &m_zlib.strm, flush );
+    zrc = inflate( &m_zlib.strm, flush );
     if ( zrc < 0 ) 
     {
       // Something went haywire - bail out.
diff --git a/extern/opennurbs/opennurbs_zlib.h b/extern/opennurbs/opennurbs_zlib.h
index 20fcd19..9919049 100755
--- a/extern/opennurbs/opennurbs_zlib.h
+++ b/extern/opennurbs/opennurbs_zlib.h
@@ -29,17 +29,18 @@
 // header files are included by opennurbs.h.
 
 
-#if !defined(Z_PREFIX)
+// Remove z_ prefix, we're using the system zlib.
+//#if !defined(Z_PREFIX)
 /* decorates zlib functions with a "z_" prefix to prevent symbol collision. */
-#define Z_PREFIX
-#endif
+//#define Z_PREFIX
+//#endif
 
 #if !defined(MY_ZCALLOC)
 /* have zlib use oncalloc() and onfree() for memory managment*/
 #define MY_ZCALLOC
 #endif
 
-#include "./zlib/zlib.h"
+#include <zlib.h>
 
 ON_BEGIN_EXTERNC
 voidpf zcalloc (voidpf, unsigned, unsigned);
diff --git a/extern/opennurbs/zlib/CMakeLists.txt b/extern/opennurbs/zlib/CMakeLists.txt
deleted file mode 100644
index 24a80be..0000000
--- a/extern/opennurbs/zlib/CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2011, Blender Foundation
-# All rights reserved.
-#
-# Contributor(s): Blender Foundation,
-#                 Sergey Sharybin
-#
-# ***** END GPL LICENSE BLOCK *****
-
-# NOTE: This file is automatically generated by bundle.sh script
-#       If you're doing changes in this file, please update template
-#       in that script too
-
-set(INC
-	.
-)
-
-set(INC_SYS
-)
-
-set(SRC
-	 adler32.c
-	 compress.c
-	 crc32.c
-	 deflate.c
-	 infback.c
-	 inffast.c
-	 inflate.c
-	 inftrees.c
-	 trees.c
-	 uncompr.c
-	 zutil.c
-
-	 crc32.h
-	 deflate.h
-	 inffast.h
-	 inffixed.h
-	 inflate.h
-	 inftrees.h
-	 trees.h
-	 zconf.h
-	 zlib.h
-	 zutil.h
-)
-
-blender_add_lib(extern_ON_zlib "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/opennurbs/zlib/adler32.c b/extern/opennurbs/zlib/adler32.c
deleted file mode 100755
index b9795e4..0000000
--- a/extern/opennurbs/zlib/adler32.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2004 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-#define BASE 65521UL    /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
-#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf)   DO8(buf,0); DO8(buf,8);
-
-/* use NO_DIVIDE if your processor does not do division in hardware */
-#ifdef NO_DIVIDE
-#  define MOD(a) \
-    do { \
-        if (a >= (BASE << 16)) a -= (BASE << 16); \
-        if (a >= (BASE << 15)) a -= (BASE << 15); \
-        if (a >= (BASE << 14)) a -= (BASE << 14); \
-        if (a >= (BASE << 13)) a -= (BASE << 13); \
-        if (a >= (BASE << 12)) a -= (BASE << 12); \
-        if (a >= (BASE << 11)) a -= (BASE << 11); \
-        if (a >= (BASE << 10)) a -= (BASE << 10); \
-        if (a >= (BASE << 9)) a -= (BASE << 9); \
-        if (a >= (BASE << 8)) a -= (BASE << 8); \
-        if (a >= (BASE << 7)) a -= (BASE << 7); \
-        if (a >= (BASE << 6)) a -= (BASE << 6); \
-        if (a >= (BASE << 5)) a -= (BASE << 5); \
-        if (a >= (BASE << 4)) a -= (BASE << 4); \
-        if (a >= (BASE << 3)) a -= (BASE << 3); \
-        if (a >= (BASE << 2)) a -= (BASE << 2); \
-        if 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list