Improve the internal zlib.

* Change stdlib calls to FT internal ones.
* Change config file from `zconf.h' to `ftzconf.h'
This commit is contained in:
Moazin Khatti 2019-08-05 11:51:58 +05:00
parent 545869da73
commit 3081146633
5 changed files with 9 additions and 11 deletions

View File

@ -55,7 +55,7 @@
/* original ZLib. */ /* original ZLib. */
#ifndef USE_ZLIB_ZCALLOC #ifndef USE_ZLIB_ZCALLOC
/* #define MY_ZCALLOC */ /* prevent all zcalloc() & zfree() in zutil.c */ #define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutil.c */
#endif #endif
/* Note that our `zlib.h' includes `ftzconf.h' instead of `zconf.h'; */ /* Note that our `zlib.h' includes `ftzconf.h' instead of `zconf.h'; */
@ -165,7 +165,6 @@
#if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC ) #if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
/*
local voidpf local voidpf
zcalloc ( voidpf opaque, zcalloc ( voidpf opaque,
unsigned items, unsigned items,
@ -181,7 +180,6 @@
ft_gzip_free( (FT_Memory)opaque, ptr ); ft_gzip_free( (FT_Memory)opaque, ptr );
} }
*/
#endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */ #endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */

View File

@ -43,7 +43,7 @@ GZIP_DRV_SRCS := $(GZIP_DIR)/inftrees.c \
$(GZIP_DIR)/gzread.c \ $(GZIP_DIR)/gzread.c \
$(GZIP_DIR)/inftrees.h \ $(GZIP_DIR)/inftrees.h \
$(GZIP_DIR)/deflate.c \ $(GZIP_DIR)/deflate.c \
$(GZIP_DIR)/zconf.h \ $(GZIP_DIR)/ftzconf.h \
$(GZIP_DIR)/trees.c \ $(GZIP_DIR)/trees.c \
$(GZIP_DIR)/inffast.c \ $(GZIP_DIR)/inffast.c \
$(GZIP_DIR)/inflate.c \ $(GZIP_DIR)/inflate.c \

View File

@ -31,7 +31,7 @@
#ifndef ZLIB_H #ifndef ZLIB_H
#define ZLIB_H #define ZLIB_H
#include "zconf.h" #include "ftzconf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -106,7 +106,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#if defined(VAXC) || defined(VMS) #if defined(VAXC) || defined(VMS)
# define OS_CODE 2 # define OS_CODE 2
# define F_OPEN(name, mode) \ # define F_OPEN(name, mode) \
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") ft_fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif #endif
#ifdef __370__ #ifdef __370__
@ -223,9 +223,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemcmp _fmemcmp # define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len) # define zmemzero(dest, len) _fmemset(dest, 0, len)
# else # else
# define zmemcpy memcpy # define zmemcpy ft_memcpy
# define zmemcmp memcmp # define zmemcmp ft_memcmp
# define zmemzero(dest, len) memset(dest, 0, len) # define zmemzero(dest, len) ft_memset(dest, 0, len)
# endif # endif
#else #else
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
@ -254,9 +254,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif #endif
#ifndef Z_SOLO #ifndef Z_SOLO
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, static voidpf zcalloc OF((voidpf opaque, unsigned items,
unsigned size)); unsigned size));
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); static void zcfree OF((voidpf opaque, voidpf ptr));
#endif #endif
#define ZALLOC(strm, items, size) \ #define ZALLOC(strm, items, size) \