@@ -3040,6 +3040,8 @@ static chd_error metadata_find_entry(chd_file *chd, uint32_t metatag, uint32_t m
30403040
30413041static chd_error zlib_codec_init (void * codec , uint32_t hunkbytes )
30423042{
3043+ #ifdef C_LIBZ
3044+
30433045 int zerr ;
30443046 chd_error err ;
30453047 zlib_codec_data * data = (zlib_codec_data * )codec ;
@@ -3064,6 +3066,10 @@ static chd_error zlib_codec_init(void *codec, uint32_t hunkbytes)
30643066 err = CHDERR_NONE ;
30653067
30663068 return err ;
3069+
3070+ #endif
3071+
3072+ return CHDERR_COMPRESSION_ERROR ;
30673073}
30683074
30693075/*-------------------------------------------------
@@ -3073,6 +3079,8 @@ static chd_error zlib_codec_init(void *codec, uint32_t hunkbytes)
30733079
30743080static void zlib_codec_free (void * codec )
30753081{
3082+ #ifdef C_LIBZ
3083+
30763084 zlib_codec_data * data = (zlib_codec_data * )codec ;
30773085
30783086 /* deinit the streams */
@@ -3083,6 +3091,8 @@ static void zlib_codec_free(void *codec)
30833091 /* free our fast memory */
30843092 zlib_allocator_free (& data -> allocator );
30853093 }
3094+
3095+ #endif
30863096}
30873097
30883098/*-------------------------------------------------
@@ -3092,6 +3102,9 @@ static void zlib_codec_free(void *codec)
30923102
30933103static chd_error zlib_codec_decompress (void * codec , const uint8_t * src , uint32_t complen , uint8_t * dest , uint32_t destlen )
30943104{
3105+
3106+ #ifdef C_LIBZ
3107+
30953108 zlib_codec_data * data = (zlib_codec_data * )codec ;
30963109 int zerr ;
30973110
@@ -3112,6 +3125,10 @@ static chd_error zlib_codec_decompress(void *codec, const uint8_t *src, uint32_t
31123125 return CHDERR_DECOMPRESSION_ERROR ;
31133126
31143127 return CHDERR_NONE ;
3128+
3129+ #endif
3130+
3131+ return CHDERR_COMPRESSION_ERROR ;
31153132}
31163133
31173134/*-------------------------------------------------
@@ -3125,6 +3142,8 @@ static chd_error zlib_codec_decompress(void *codec, const uint8_t *src, uint32_t
31253142
31263143static voidpf zlib_fast_alloc (voidpf opaque , uInt items , uInt size )
31273144{
3145+ #ifdef C_LIBZ
3146+
31283147 zlib_allocator * alloc = (zlib_allocator * )opaque ;
31293148 uintptr_t paddr = 0 ;
31303149 uint32_t * ptr ;
@@ -3167,6 +3186,10 @@ static voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size)
31673186
31683187 /* return aligned block address */
31693188 return (voidpf )paddr ;
3189+
3190+ #endif
3191+
3192+ return nullptr ;
31703193}
31713194
31723195/*-------------------------------------------------
@@ -3176,6 +3199,8 @@ static voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size)
31763199
31773200static void zlib_fast_free (voidpf opaque , voidpf address )
31783201{
3202+ #ifdef C_LIBZ
3203+
31793204 zlib_allocator * alloc = (zlib_allocator * )opaque ;
31803205 uint32_t * ptr = (uint32_t * )address ;
31813206 int i ;
@@ -3188,19 +3213,25 @@ static void zlib_fast_free(voidpf opaque, voidpf address)
31883213 * (alloc -> allocptr [i ]) &= ~1 ;
31893214 return ;
31903215 }
3216+
3217+ #endif
31913218}
31923219
31933220/*-------------------------------------------------
31943221 zlib_allocator_free
31953222-------------------------------------------------*/
31963223static void zlib_allocator_free (voidpf opaque )
31973224{
3225+ #ifdef C_LIBZ
3226+
31983227 zlib_allocator * alloc = (zlib_allocator * )opaque ;
31993228 int i ;
32003229
32013230 for (i = 0 ; i < MAX_ZLIB_ALLOCS ; i ++ )
32023231 if (alloc -> allocptr [i ])
32033232 free (alloc -> allocptr [i ]);
3233+
3234+ #endif
32043235}
32053236
32063237/*-------------------------------------------------
0 commit comments