Index: trunk/src/image/miniz.cc
===================================================================
--- trunk/src/image/miniz.cc	(revision 520)
+++ trunk/src/image/miniz.cc	(revision 533)
@@ -3,10 +3,4 @@
 
 using namespace nv;
-
-#define MINIZ_NO_TIME
-#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
-
-#define MINIZ_HAS_64BIT_REGISTERS 0
-#define TINFL_USE_64BIT_BITBUF 0
 
 #if NV_COMPILER == NV_CLANG
@@ -17,21 +11,6 @@
 
 #if defined( _M_IX86 ) || defined( _M_X64 ) || defined( __i386__ ) || defined( __i386 ) || defined( __i486__ ) || defined( __i486 ) || defined( i386 ) || defined( __ia64__ ) || defined( __x86_64__ )
-// MINIZ_X86_OR_X64_CPU is only used to help set the below macros.
-#define MINIZ_X86_OR_X64_CPU 1
-#endif
-
-#if (__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__) || MINIZ_X86_OR_X64_CPU
-// Set MINIZ_LITTLE_ENDIAN to 1 if the processor is little endian.
-#define MINIZ_LITTLE_ENDIAN 1
-#endif
-
-#if MINIZ_X86_OR_X64_CPU
 // Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient integer loads and stores from unaligned addresses.
 #define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1
-#endif
-
-#if defined(_M_X64) || defined(_WIN64) || defined(__MINGW64__) || defined(_LP64) || defined(__LP64__) || defined(__ia64__) || defined(__x86_64__)
-// Set MINIZ_HAS_64BIT_REGISTERS to 1 if operations on 64-bit integers are reasonably fast (and don't involve compiler generated calls to helper functions).
-#define MINIZ_HAS_64BIT_REGISTERS 1
 #endif
 
@@ -204,78 +183,4 @@
 	const char *mz_error( int err );
 
-	// Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports.
-	// Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project.
-#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
-	typedef unsigned char Byte;
-	typedef unsigned int uInt;
-	typedef mz_ulong uLong;
-	typedef Byte Bytef;
-	typedef uInt uIntf;
-	typedef char charf;
-	typedef int intf;
-	typedef void *voidpf;
-	typedef uLong uLongf;
-	typedef void *voidp;
-	typedef void *const voidpc;
-#define Z_NULL                0
-#define Z_NO_FLUSH            MZ_NO_FLUSH
-#define Z_PARTIAL_FLUSH       MZ_PARTIAL_FLUSH
-#define Z_SYNC_FLUSH          MZ_SYNC_FLUSH
-#define Z_FULL_FLUSH          MZ_FULL_FLUSH
-#define Z_FINISH              MZ_FINISH
-#define Z_BLOCK               MZ_BLOCK
-#define Z_OK                  MZ_OK
-#define Z_STREAM_END          MZ_STREAM_END
-#define Z_NEED_DICT           MZ_NEED_DICT
-#define Z_ERRNO               MZ_ERRNO
-#define Z_STREAM_ERROR        MZ_STREAM_ERROR
-#define Z_DATA_ERROR          MZ_DATA_ERROR
-#define Z_MEM_ERROR           MZ_MEM_ERROR
-#define Z_BUF_ERROR           MZ_BUF_ERROR
-#define Z_VERSION_ERROR       MZ_VERSION_ERROR
-#define Z_PARAM_ERROR         MZ_PARAM_ERROR
-#define Z_NO_COMPRESSION      MZ_NO_COMPRESSION
-#define Z_BEST_SPEED          MZ_BEST_SPEED
-#define Z_BEST_COMPRESSION    MZ_BEST_COMPRESSION
-#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
-#define Z_DEFAULT_STRATEGY    MZ_DEFAULT_STRATEGY
-#define Z_FILTERED            MZ_FILTERED
-#define Z_HUFFMAN_ONLY        MZ_HUFFMAN_ONLY
-#define Z_RLE                 MZ_RLE
-#define Z_FIXED               MZ_FIXED
-#define Z_DEFLATED            MZ_DEFLATED
-#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
-#define alloc_func            mz_alloc_func
-#define free_func             mz_free_func
-#define internal_state        mz_internal_state
-#define z_stream              mz_stream
-#define deflateInit           mz_deflateInit
-#define deflateInit2          mz_deflateInit2
-#define deflateReset          mz_deflateReset
-#define deflate               mz_deflate
-#define deflateEnd            mz_deflateEnd
-#define deflateBound          mz_deflateBound
-#define compress              mz_compress
-#define compress2             mz_compress2
-#define compressBound         mz_compressBound
-#define inflateInit           mz_inflateInit
-#define inflateInit2          mz_inflateInit2
-#define inflate               mz_inflate
-#define inflateEnd            mz_inflateEnd
-#define uncompress            mz_uncompress
-#define crc32                 mz_crc32
-#define adler32               mz_adler32
-#define MAX_WBITS             15
-#define MAX_MEM_LEVEL         9
-#define zError                mz_error
-#define ZLIB_VERSION          MZ_VERSION
-#define ZLIB_VERNUM           MZ_VERNUM
-#define ZLIB_VER_MAJOR        MZ_VER_MAJOR
-#define ZLIB_VER_MINOR        MZ_VER_MINOR
-#define ZLIB_VER_REVISION     MZ_VER_REVISION
-#define ZLIB_VER_SUBREVISION  MZ_VER_SUBREVISION
-#define zlibVersion           mz_version
-#define zlib_version          mz_version()
-#endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
 
 #endif // MINIZ_NO_ZLIB_APIS
@@ -321,7 +226,6 @@
 		mz_uint16 m_bit_flag;
 		mz_uint16 m_method;
-#ifndef MINIZ_NO_TIME
-		time_t m_time;
-#endif
+//		time_t m_time;
+
 		mz_uint32 m_crc32;
 		mz_uint64 m_comp_size;
@@ -567,9 +471,5 @@
 	} tinfl_huff_table;
 
-#if MINIZ_HAS_64BIT_REGISTERS
-#define TINFL_USE_64BIT_BITBUF 1
-#endif
-
-#if TINFL_USE_64BIT_BITBUF
+#if NV_ARCHITECTURE == NV_64BIT
 	typedef mz_uint64 tinfl_bit_buf_t;
 #define TINFL_BITBUF_SIZE (64)
@@ -766,5 +666,5 @@
 #define MZ_CLEAR_OBJ(obj) nvmemset(&(obj), 0, sizeof(obj))
 
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
+#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
 #define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
 #define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
@@ -1382,5 +1282,5 @@
 						{
 							int sym2; mz_uint code_len;
-#if TINFL_USE_64BIT_BITBUF
+#if NV_ARCHITECTURE == NV_64BIT
 							if ( num_bits < 30 ) { bit_buf |= ( ( (tinfl_bit_buf_t)MZ_READ_LE32( pIn_buf_cur ) ) << num_bits ); pIn_buf_cur += 4; num_bits += 32; }
 #else
@@ -1397,5 +1297,5 @@
 								break;
 
-#if !TINFL_USE_64BIT_BITBUF
+#if NV_ARCHITECTURE == NV_32BIT
 							if ( num_bits < 15 ) { bit_buf |= ( ( (tinfl_bit_buf_t)MZ_READ_LE16( pIn_buf_cur ) ) << num_bits ); pIn_buf_cur += 2; num_bits += 16; }
 #endif
@@ -1835,5 +1735,6 @@
 	static const mz_uint mz_bitmasks[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
 
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
+#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN && NV_ARCHITECTURE == NV_64BIT
+
 	static mz_bool tdefl_compress_lz_codes( tdefl_compressor *d )
 	{
@@ -1968,5 +1869,6 @@
 		return ( d->m_pOutput_buf < d->m_pOutput_buf_end );
 	}
-#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN && MINIZ_HAS_64BIT_REGISTERS
+#endif // MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN && NV_ARCHITECTURE == NV_64BIT
+
 
 	static mz_bool tdefl_compress_block( tdefl_compressor *d, mz_bool static_block )
@@ -2145,5 +2047,5 @@
 #endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES
 
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
+#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
 	static mz_bool tdefl_compress_fast( tdefl_compressor *d )
 	{
@@ -2480,5 +2382,5 @@
 			return ( d->m_prev_return_status = tdefl_flush_output_buffer( d ) );
 
-#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
+#if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
 		if ( ( ( d->m_flags & TDEFL_MAX_PROBES_MASK ) == 1 ) &&
 			( ( d->m_flags & TDEFL_GREEDY_PARSING_FLAG ) != 0 ) &&
@@ -2489,5 +2391,5 @@
 		}
 		else
-#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
+#endif // #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && NV_ENDIANESS == NV_LITTLEENDIAN
 		{
 			if ( !tdefl_compress_normal( d ) )
