# Check if we can hide zlib internal symbols that are linked between separate source files using hidden
#
check_c_source_compiles(
- "#define ZLIB_INTERNAL __attribute__((visibility (\"hidden\")))
- int ZLIB_INTERNAL foo;
+ "#define Z_INTERNAL __attribute__((visibility (\"hidden\")))
+ int Z_INTERNAL foo;
int main()
{
return 0;
# Check if we can hide zlib internal symbols that are linked between separate source files using internal
#
check_c_source_compiles(
- "#define ZLIB_INTERNAL __attribute__((visibility (\"internal\")))
- int ZLIB_INTERNAL foo;
+ "#define Z_INTERNAL __attribute__((visibility (\"internal\")))
+ int Z_INTERNAL foo;
int main()
{
return 0;
#include "adler32_p.h"
/* ========================================================================= */
-ZLIB_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) {
+Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) {
uint32_t sum2;
unsigned n;
extern int arm_cpu_has_neon;
extern int arm_cpu_has_crc32;
-void ZLIB_INTERNAL arm_check_features(void);
+void Z_INTERNAL arm_check_features(void);
#endif /* ARM_H_ */
}
#endif
-ZLIB_INTERNAL int arm_cpu_has_neon;
-ZLIB_INTERNAL int arm_cpu_has_crc32;
+Z_INTERNAL int arm_cpu_has_neon;
+Z_INTERNAL int arm_cpu_has_crc32;
-void ZLIB_INTERNAL arm_check_features(void) {
+void Z_INTERNAL arm_check_features(void) {
#if defined(__aarch64__) || defined(_M_ARM64)
arm_cpu_has_neon = 1; /* always available */
#else
} while (--n);
}
-ZLIB_INTERNAL void slide_hash_neon(deflate_state *s) {
+Z_INTERNAL void slide_hash_neon(deflate_state *s) {
unsigned int wsize = s->w_size;
slide_hash_chain(s->head, HASH_SIZE, wsize);
#include <sys/auxv.h>
#include "../../zutil.h"
-ZLIB_INTERNAL int power_cpu_has_arch_2_07;
+Z_INTERNAL int power_cpu_has_arch_2_07;
-void ZLIB_INTERNAL power_check_features(void) {
+void Z_INTERNAL power_check_features(void) {
unsigned long hwcap2;
hwcap2 = getauxval(AT_HWCAP2);
extern int power_cpu_has_arch_2_07;
-void ZLIB_INTERNAL power_check_features(void);
+void Z_INTERNAL power_check_features(void);
#endif /* POWER_H_ */
} while (--chunks);
}
-void ZLIB_INTERNAL slide_hash_power8(deflate_state *s) {
+void Z_INTERNAL slide_hash_power8(deflate_state *s) {
unsigned int n;
Pos *p;
return is_bit_set((const char *)facilities, DFLTCC_FACILITY);
}
-void ZLIB_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) {
+void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) {
struct dfltcc_state *dfltcc_state = (struct dfltcc_state *)((char *)strm->state + ALIGN_UP(size, 8));
struct dfltcc_qaf_param *param = (struct dfltcc_qaf_param *)&dfltcc_state->param;
dfltcc_state->param.ribm = DFLTCC_RIBM;
}
-void ZLIB_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) {
+void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) {
return ZALLOC(strm, ALIGN_UP(items * size, 8) + sizeof(struct dfltcc_state), sizeof(unsigned char));
}
-void ZLIB_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) {
+void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) {
memcpy(dst, src, ALIGN_UP(size, 8) + sizeof(struct dfltcc_state));
}
static const int PAGE_ALIGN = 0x1000;
-void ZLIB_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) {
+void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) {
void *p;
void *w;
return w;
}
-void ZLIB_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) {
+void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) {
if (w)
ZFREE(strm, *(void **)((unsigned char *)w - sizeof(void *)));
}
#endif
#include "../../zutil.h"
-void ZLIB_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size);
-void ZLIB_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size);
-void ZLIB_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size);
-void ZLIB_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size);
-void ZLIB_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w);
+void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size);
+void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size);
+void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size);
+void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size);
+void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w);
#define ZALLOC_STATE dfltcc_alloc_state
return 1;
}
-int ZLIB_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) {
+int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) {
deflate_state *state = (deflate_state *)strm->state;
return dfltcc_can_deflate_with_params(strm, state->level, state->w_bits, state->strategy, state->reproducible);
#endif
}
-int ZLIB_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) {
+int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) {
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->param;
return strm->total_in > 0 || param->nt == 0 || param->hl > 0;
}
-int ZLIB_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) {
+int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) {
deflate_state *state = (deflate_state *)strm->state;
int could_deflate = dfltcc_can_deflate(strm);
int can_deflate = dfltcc_can_deflate_with_params(strm, level, state->w_bits, strategy, state->reproducible);
return Z_OK;
}
-int ZLIB_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) {
+int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) {
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->param;
return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf);
}
-int ZLIB_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) {
+int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) {
deflate_state *state = (deflate_state *)strm->state;
return reproducible != state->reproducible && !dfltcc_was_deflate_used(strm);
}
}
-int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm,
+int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm,
const unsigned char *dictionary, uInt dict_length) {
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
return Z_OK;
}
-int ZLIB_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) {
+int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) {
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->param;
#include "dfltcc_common.h"
-int ZLIB_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm);
-int ZLIB_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result);
-int ZLIB_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush);
-int ZLIB_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush);
-int ZLIB_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible);
-int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm,
+int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm);
+int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result);
+int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush);
+int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush);
+int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible);
+int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm,
const unsigned char *dictionary, uInt dict_length);
-int ZLIB_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length);
+int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length);
#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \
do { \
#include "dfltcc_inflate.h"
#include "dfltcc_detail.h"
-int ZLIB_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) {
+int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) {
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
return cc;
}
-dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) {
+dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) {
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->param;
DFLTCC_INFLATE_BREAK : DFLTCC_INFLATE_CONTINUE;
}
-int ZLIB_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) {
+int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) {
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
return !param->nt;
}
-int ZLIB_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) {
+int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) {
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
#include "dfltcc_common.h"
-int ZLIB_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm);
+int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm);
typedef enum {
DFLTCC_INFLATE_CONTINUE,
DFLTCC_INFLATE_BREAK,
DFLTCC_INFLATE_SOFTWARE,
} dfltcc_inflate_action;
-dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret);
-int ZLIB_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm);
-int ZLIB_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm);
+dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret);
+int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm);
+int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm);
#define INFLATE_RESET_KEEP_HOOK(strm) \
dfltcc_reset((strm), sizeof(struct inflate_state))
#ifdef X86_AVX2_ADLER32
-ZLIB_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) {
+Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) {
uint32_t sum2;
/* split Adler-32 into component sums */
#include <immintrin.h>
-ZLIB_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) {
+Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) {
uint32_t sum2;
/* split Adler-32 into component sums */
return compare256_unaligned_avx2_static(src0+2, src1+2) + 2;
}
-ZLIB_INTERNAL int32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) {
return compare258_unaligned_avx2_static(src0, src1);
}
return compare256_unaligned_sse4_static(src0+2, src1+2) + 2;
}
-ZLIB_INTERNAL int32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) {
return compare258_unaligned_sse4_static(src0, src1);
}
#include "crc_folding.h"
-ZLIB_INTERNAL void crc_fold_init(deflate_state *const s) {
+Z_INTERNAL void crc_fold_init(deflate_state *const s) {
/* CRC_SAVE */
_mm_storeu_si128((__m128i *)s->crc0 + 0, _mm_cvtsi32_si128(0x9db42487));
_mm_storeu_si128((__m128i *)s->crc0 + 1, _mm_setzero_si128());
*xmm_crc3 = _mm_castps_si128(ps_res);
}
-ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) {
+Z_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) {
unsigned long algn_diff;
__m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3;
char ALIGNED_(16) partial_buf[16] = { 0 };
0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
};
-uint32_t ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s) {
+uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) {
const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask);
const __m128i xmm_mask2 = _mm_load_si128((__m128i *)crc_mask2);
}
#endif
-
#include "../../deflate.h"
-ZLIB_INTERNAL void crc_fold_init(deflate_state *const);
-ZLIB_INTERNAL uint32_t crc_fold_512to32(deflate_state *const);
-ZLIB_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long);
+Z_INTERNAL void crc_fold_init(deflate_state *const);
+Z_INTERNAL uint32_t crc_fold_512to32(deflate_state *const);
+Z_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long);
#endif
#include <immintrin.h>
-ZLIB_INTERNAL void slide_hash_avx2(deflate_state *s) {
+Z_INTERNAL void slide_hash_avx2(deflate_state *s) {
Pos *p;
unsigned n;
uint16_t wsize = (uint16_t)s->w_size;
#include <immintrin.h>
-ZLIB_INTERNAL void slide_hash_sse2(deflate_state *s) {
+Z_INTERNAL void slide_hash_sse2(deflate_state *s) {
Pos *p;
unsigned n;
uint16_t wsize = (uint16_t)s->w_size;
# include <cpuid.h>
#endif
-ZLIB_INTERNAL int x86_cpu_has_avx2;
-ZLIB_INTERNAL int x86_cpu_has_sse2;
-ZLIB_INTERNAL int x86_cpu_has_ssse3;
-ZLIB_INTERNAL int x86_cpu_has_sse42;
-ZLIB_INTERNAL int x86_cpu_has_pclmulqdq;
-ZLIB_INTERNAL int x86_cpu_has_tzcnt;
+Z_INTERNAL int x86_cpu_has_avx2;
+Z_INTERNAL int x86_cpu_has_sse2;
+Z_INTERNAL int x86_cpu_has_ssse3;
+Z_INTERNAL int x86_cpu_has_sse42;
+Z_INTERNAL int x86_cpu_has_pclmulqdq;
+Z_INTERNAL int x86_cpu_has_tzcnt;
static void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) {
#ifdef _MSC_VER
#endif
}
-void ZLIB_INTERNAL x86_check_features(void) {
+void Z_INTERNAL x86_check_features(void) {
unsigned eax, ebx, ecx, edx;
unsigned maxbasic;
extern int x86_cpu_has_pclmulqdq;
extern int x86_cpu_has_tzcnt;
-void ZLIB_INTERNAL x86_check_features(void);
+void Z_INTERNAL x86_check_features(void);
#endif /* CPU_H_ */
*/
/* Returns the chunk size */
-ZLIB_INTERNAL uint32_t CHUNKSIZE(void) {
+Z_INTERNAL uint32_t CHUNKSIZE(void) {
return sizeof(chunk_t);
}
(chunk_t bytes or fewer) will fall straight through the loop
without iteration, which will hopefully make the branch prediction more
reliable. */
-ZLIB_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
+Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) {
chunk_t chunk;
--len;
loadchunk(from, &chunk);
}
/* Behave like chunkcopy, but avoid writing beyond of legal output. */
-ZLIB_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) {
+Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) {
if ((safe - out) < (ptrdiff_t)sizeof(chunk_t)) {
if (len & 8) {
memcpy(out, from, 8);
This assumption holds because inflate_fast() starts every iteration with at
least 258 bytes of output space available (258 being the maximum length
output from a single token; see inflate_fast()'s assumptions below). */
-ZLIB_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) {
+Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) {
unsigned char const *from = out - *dist;
chunk_t chunk;
while (*dist < *len && *dist < sizeof(chunk_t)) {
/* Copy DIST bytes from OUT - DIST into OUT + DIST * k, for 0 <= k < LEN/DIST.
Return OUT + LEN. */
-ZLIB_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) {
+Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) {
/* Debug performance related issues when len < sizeof(uint64_t):
Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */
Assert(dist > 0, "cannot have a distance 0");
return out;
}
-ZLIB_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) {
+Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) {
if (left < (unsigned)(3 * sizeof(chunk_t))) {
while (len > 0) {
*out = *(out - dist);
return compare256_c_static(src0, src1) + 2;
}
-ZLIB_INTERNAL int32_t compare258_c(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_c(const unsigned char *src0, const unsigned char *src1) {
return compare258_c_static(src0, src1);
}
return compare256_unaligned_16_static(src0+2, src1+2) + 2;
}
-ZLIB_INTERNAL int32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) {
return compare258_unaligned_16_static(src0, src1);
}
return compare256_unaligned_32_static(src0+2, src1+2) + 2;
}
-ZLIB_INTERNAL int32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) {
return compare258_unaligned_32_static(src0, src1);
}
return compare256_unaligned_64_static(src0+2, src1+2) + 2;
}
-ZLIB_INTERNAL int32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) {
return compare258_unaligned_64_static(src0, src1);
}
if test "$gcc" -eq 1; then
echo >> configure.log
cat > $test.c <<EOF
-#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
-int ZLIB_INTERNAL foo;
+#define Z_INTERNAL __attribute__((visibility ("hidden")))
+int Z_INTERNAL foo;
int main() { return 0; }
EOF
if tryboth $CC -c $CFLAGS $test.c; then
if test "$gcc" -eq 1; then
echo >> configure.log
cat > $test.c <<EOF
-#define ZLIB_INTERNAL __attribute__((visibility ("internal")))
-int ZLIB_INTERNAL foo;
+#define Z_INTERNAL __attribute__((visibility ("internal")))
+int Z_INTERNAL foo;
int main() { return 0; }
EOF
if tryboth $CC -c $CFLAGS $test.c; then
#define DO4 DO1; DO1; DO1; DO1
/* ========================================================================= */
-ZLIB_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uint64_t len) {
+Z_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uint64_t len) {
crc = crc ^ 0xffffffff;
#ifdef UNROLL_MORE
#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
/* ========================================================================= */
-ZLIB_INTERNAL uint32_t crc32_little(uint32_t crc, const unsigned char *buf, uint64_t len) {
+Z_INTERNAL uint32_t crc32_little(uint32_t crc, const unsigned char *buf, uint64_t len) {
Z_REGISTER uint32_t c;
Z_REGISTER const uint32_t *buf4;
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
/* ========================================================================= */
-ZLIB_INTERNAL uint32_t crc32_big(uint32_t crc, const unsigned char *buf, uint64_t len) {
+Z_INTERNAL uint32_t crc32_big(uint32_t crc, const unsigned char *buf, uint64_t len) {
Z_REGISTER uint32_t c;
Z_REGISTER const uint32_t *buf4;
#include "arch/x86/x86.h"
#include "arch/x86/crc_folding.h"
-ZLIB_INTERNAL void crc_finalize(deflate_state *const s) {
+Z_INTERNAL void crc_finalize(deflate_state *const s) {
if (x86_cpu_has_pclmulqdq)
s->strm->adler = crc_fold_512to32(s);
}
#endif
-ZLIB_INTERNAL void crc_reset(deflate_state *const s) {
+Z_INTERNAL void crc_reset(deflate_state *const s) {
#ifdef X86_PCLMULQDQ_CRC
x86_check_features();
if (x86_cpu_has_pclmulqdq) {
s->strm->adler = PREFIX(crc32)(0L, NULL, 0);
}
-ZLIB_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) {
+Z_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) {
#ifdef X86_PCLMULQDQ_CRC
if (x86_cpu_has_pclmulqdq) {
crc_fold_copy(strm->state, dst, strm->next_in, size);
static int deflateStateCheck (PREFIX3(stream) *strm);
static block_state deflate_stored (deflate_state *s, int flush);
-ZLIB_INTERNAL block_state deflate_fast (deflate_state *s, int flush);
-ZLIB_INTERNAL block_state deflate_quick (deflate_state *s, int flush);
+Z_INTERNAL block_state deflate_fast (deflate_state *s, int flush);
+Z_INTERNAL block_state deflate_quick (deflate_state *s, int flush);
#ifndef NO_MEDIUM_STRATEGY
-ZLIB_INTERNAL block_state deflate_medium (deflate_state *s, int flush);
+Z_INTERNAL block_state deflate_medium (deflate_state *s, int flush);
#endif
-ZLIB_INTERNAL block_state deflate_slow (deflate_state *s, int flush);
+Z_INTERNAL block_state deflate_slow (deflate_state *s, int flush);
static block_state deflate_rle (deflate_state *s, int flush);
static block_state deflate_huff (deflate_state *s, int flush);
static void lm_init (deflate_state *s);
-ZLIB_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
+Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size);
extern void crc_reset(deflate_state *const s);
#ifdef X86_PCLMULQDQ_CRC
* bit values at the expense of memory usage). We slide even when level == 0 to
* keep the hash table consistent if we switch back to level > 0 later.
*/
-ZLIB_INTERNAL void slide_hash_c(deflate_state *s) {
+Z_INTERNAL void slide_hash_c(deflate_state *s) {
Pos *p;
unsigned n;
unsigned int wsize = s->w_size;
* applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()).
*/
-ZLIB_INTERNAL void flush_pending(PREFIX3(stream) *strm) {
+Z_INTERNAL void flush_pending(PREFIX3(stream) *strm) {
uint32_t len;
deflate_state *s = strm->state;
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-ZLIB_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
+Z_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) {
uint32_t len = strm->avail_in;
if (len > size)
* option -- not supported here).
*/
-void ZLIB_INTERNAL fill_window(deflate_state *s) {
+void Z_INTERNAL fill_window(deflate_state *s) {
unsigned n;
unsigned int more; /* Amount of free space at the end of the window. */
unsigned int wsize = s->w_size;
typedef uint16_t Pos;
/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables.
+ * save space in the various tables.
*/
typedef struct internal_state {
memory checker errors from longest match routines */
-void ZLIB_INTERNAL fill_window(deflate_state *s);
-void ZLIB_INTERNAL slide_hash_c(deflate_state *s);
+void Z_INTERNAL fill_window(deflate_state *s);
+void Z_INTERNAL slide_hash_c(deflate_state *s);
/* in trees.c */
-void ZLIB_INTERNAL zng_tr_init(deflate_state *s);
-void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
-void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s);
-void ZLIB_INTERNAL zng_tr_align(deflate_state *s);
-void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
-unsigned ZLIB_INTERNAL bi_reverse(unsigned code, int len);
-void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm);
-
+void Z_INTERNAL zng_tr_init(deflate_state *s);
+void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
+void Z_INTERNAL zng_tr_flush_bits(deflate_state *s);
+void Z_INTERNAL zng_tr_align(deflate_state *s);
+void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
+unsigned Z_INTERNAL bi_reverse(unsigned code, int len);
+void Z_INTERNAL flush_pending(PREFIX3(streamp) strm);
#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. zng_dist_code[256] and zng_dist_code[257] are never
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
-ZLIB_INTERNAL block_state deflate_fast(deflate_state *s, int flush) {
+Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) {
Pos hash_head; /* head of the hash chain */
int bflush = 0; /* set if current block must be flushed */
uint32_t match_len = 0;
}
}
-ZLIB_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
+Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
/* Align the first struct to start on a new cacheline, this allows us to fit both structs in one cacheline */
ALIGNED_(16) struct match current_match;
struct match next_match;
* the current block must be flushed.
*/
-extern const unsigned char ZLIB_INTERNAL zng_length_code[];
-extern const unsigned char ZLIB_INTERNAL zng_dist_code[];
+extern const unsigned char Z_INTERNAL zng_length_code[];
+extern const unsigned char Z_INTERNAL zng_dist_code[];
static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) {
/* c is the unmatched char */
} \
}
-ZLIB_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
+Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
Pos hash_head;
unsigned dist, match_len, last;
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
-ZLIB_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
+Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
Pos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */
uint32_t match_len;
#endif
/* CRC32 */
-ZLIB_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t);
+Z_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t);
#ifdef ARM_ACLE_CRC_HASH
extern uint32_t crc32_acle(uint32_t, const unsigned char *, uint64_t);
#endif
#endif
-ZLIB_INTERNAL Z_TLS struct functable_s functable;
+Z_INTERNAL Z_TLS struct functable_s functable;
-ZLIB_INTERNAL void cpu_check_features(void)
+Z_INTERNAL void cpu_check_features(void)
{
static int features_checked = 0;
if (features_checked)
}
/* stub functions */
-ZLIB_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) {
+Z_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) {
// Initialize default
functable.insert_string = &insert_string_c;
functable.insert_string(s, str, count);
}
-ZLIB_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) {
+Z_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) {
functable.quick_insert_string = &quick_insert_string_c;
#ifdef X86_SSE42_CRC_HASH
return functable.quick_insert_string(s, str);
}
-ZLIB_INTERNAL void slide_hash_stub(deflate_state *s) {
+Z_INTERNAL void slide_hash_stub(deflate_state *s) {
functable.slide_hash = &slide_hash_c;
cpu_check_features();
functable.slide_hash(s);
}
-ZLIB_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) {
+Z_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) {
// Initialize default
functable.adler32 = &adler32_c;
cpu_check_features();
return functable.adler32(adler, buf, len);
}
-ZLIB_INTERNAL uint32_t chunksize_stub(void) {
+Z_INTERNAL uint32_t chunksize_stub(void) {
// Initialize default
functable.chunksize = &chunksize_c;
return functable.chunksize();
}
-ZLIB_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) {
+Z_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) {
// Initialize default
functable.chunkcopy = &chunkcopy_c;
return functable.chunkcopy(out, from, len);
}
-ZLIB_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) {
+Z_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) {
// Initialize default
functable.chunkcopy_safe = &chunkcopy_safe_c;
return functable.chunkcopy_safe(out, from, len, safe);
}
-ZLIB_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) {
+Z_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) {
// Initialize default
functable.chunkunroll = &chunkunroll_c;
return functable.chunkunroll(out, dist, len);
}
-ZLIB_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) {
+Z_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) {
// Initialize default
functable.chunkmemset = &chunkmemset_c;
return functable.chunkmemset(out, dist, len);
}
-ZLIB_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) {
+Z_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) {
// Initialize default
functable.chunkmemset_safe = &chunkmemset_safe_c;
return functable.chunkmemset_safe(out, dist, len, left);
}
-ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) {
+Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) {
Assert(sizeof(uint64_t) >= sizeof(size_t),
"crc32_z takes size_t but internally we have a uint64_t len");
return functable.crc32(crc, buf, len);
}
-ZLIB_INTERNAL int32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) {
+Z_INTERNAL int32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) {
functable.compare258 = &compare258_c;
return functable.compare258(src0, src1);
}
-ZLIB_INTERNAL int32_t longest_match_stub(deflate_state *const s, Pos cur_match) {
+Z_INTERNAL int32_t longest_match_stub(deflate_state *const s, Pos cur_match) {
functable.longest_match = &longest_match_c;
}
/* functable init */
-ZLIB_INTERNAL Z_TLS struct functable_s functable = {
+Z_INTERNAL Z_TLS struct functable_s functable = {
insert_string_stub,
quick_insert_string_stub,
adler32_stub,
uint8_t* (* chunkmemset_safe) (uint8_t *out, unsigned dist, unsigned len, unsigned left);
};
-ZLIB_INTERNAL extern Z_TLS struct functable_s functable;
+Z_INTERNAL extern Z_TLS struct functable_s functable;
#endif
#endif
#if defined(HAVE_VISIBILITY_INTERNAL)
-# define ZLIB_INTERNAL __attribute__((visibility ("internal")))
+# define Z_INTERNAL __attribute__((visibility ("internal")))
#elif defined(HAVE_VISIBILITY_HIDDEN)
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+# define Z_INTERNAL __attribute__((visibility ("hidden")))
#else
-# define ZLIB_INTERNAL
+# define Z_INTERNAL
#endif
#include <stdio.h>
typedef gz_state *gz_statep;
/* shared functions */
-void ZLIB_INTERNAL gz_error(gz_state *, int, const char *);
+void Z_INTERNAL gz_error(gz_state *, int, const char *);
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
#ifdef INT_MAX
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
#else
-unsigned ZLIB_INTERNAL gz_intmax(void);
+unsigned Z_INTERNAL gz_intmax(void);
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif
memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to
out of memory. */
-void ZLIB_INTERNAL gz_error(gz_state *state, int err, const char *msg) {
+void Z_INTERNAL gz_error(gz_state *state, int err, const char *msg) {
/* free previously allocated message and clear */
if (state->msg != NULL) {
if (state->err != Z_MEM_ERROR)
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZLIB_INTERNAL gz_intmax() {
+unsigned Z_INTERNAL gz_intmax() {
unsigned p, q;
p = 1;
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
+void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
/* start: inflate()'s starting value for strm->avail_out */
struct inflate_state *state;
z_const unsigned char *in; /* local strm->next_in */
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start);
+void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start);
#define INFLATE_FAST_MIN_HAVE 8
#define INFLATE_FAST_MIN_LEFT 258
fixed code decoding. This returns fixed tables from inffixed_tbl.h.
*/
-void ZLIB_INTERNAL fixedtables(struct inflate_state *state) {
+void Z_INTERNAL fixedtables(struct inflate_state *state) {
state->lencode = lenfix;
state->lenbits = 9;
state->distcode = distfix;
state->distbits = 5;
}
-int ZLIB_INTERNAL inflate_ensure_window(struct inflate_state *state) {
+int Z_INTERNAL inflate_ensure_window(struct inflate_state *state) {
/* if it hasn't been done already, allocate space for the window */
if (state->window == NULL) {
unsigned wsize = 1U << state->wbits;
uint32_t chunksize; /* size of memory copying chunk */
};
-int ZLIB_INTERNAL inflate_ensure_window(struct inflate_state *state);
-void ZLIB_INTERNAL fixedtables(struct inflate_state *state);
+int Z_INTERNAL inflate_ensure_window(struct inflate_state *state);
+void Z_INTERNAL fixedtables(struct inflate_state *state);
#endif /* INFLATE_H_ */
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
-int ZLIB_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes,
+int Z_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes,
code * *table, unsigned *bits, uint16_t *work) {
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
DISTS
} codetype;
-int ZLIB_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes,
+int Z_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes,
code * *table, unsigned *bits, uint16_t *work);
#endif /* INFTREES_H_ */
* of the hash chain (the most recent string with same hash key). Return
* the previous length of the hash chain.
*/
-ZLIB_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) {
+Z_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) {
Pos head;
uint8_t *strstart = s->window + str;
uint32_t val, hm, h = 0;
* input characters and the first MIN_MATCH bytes of str are valid
* (except for the last MIN_MATCH-1 bytes of the input file).
*/
-ZLIB_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) {
+Z_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) {
uint8_t *strstart = s->window + str;
uint8_t *strend = strstart + count - 1; /* last position */
* string (strstart) and its distance is <= MAX_DIST, and prev_length >=1
* OUT assertion: the match length is not greater than s->lookahead
*/
-ZLIB_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
+Z_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
unsigned int strstart = s->strstart;
const unsigned wmask = s->w_mask;
unsigned char *window = s->window;
#include "inflate.h"
// Build and return state with length and distance decoding tables and index sizes set to fixed code decoding.
-void ZLIB_INTERNAL buildfixedtables(struct inflate_state *state) {
+void Z_INTERNAL buildfixedtables(struct inflate_state *state) {
static code *lenfix, *distfix;
static code fixed[544];
printf("/* header created automatically with maketrees.c */\n\n");
- printf("ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2] = {\n");
+ printf("Z_INTERNAL const ct_data static_ltree[L_CODES+2] = {\n");
for (i = 0; i < L_CODES+2; i++) {
printf("{{%3u},{%u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
}
- printf("ZLIB_INTERNAL const ct_data static_dtree[D_CODES] = {\n");
+ printf("Z_INTERNAL const ct_data static_dtree[D_CODES] = {\n");
for (i = 0; i < D_CODES; i++) {
printf("{{%2u},{%u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
}
- printf("const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n");
+ printf("const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n");
for (i = 0; i < DIST_CODE_LEN; i++) {
printf("%2u%s", dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20));
}
- printf("const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {\n");
+ printf("const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {\n");
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
printf("%2u%s", length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
}
- printf("ZLIB_INTERNAL const int base_length[LENGTH_CODES] = {\n");
+ printf("Z_INTERNAL const int base_length[LENGTH_CODES] = {\n");
for (i = 0; i < LENGTH_CODES; i++) {
printf("%d%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20));
}
- printf("ZLIB_INTERNAL const int base_dist[D_CODES] = {\n");
+ printf("Z_INTERNAL const int base_dist[D_CODES] = {\n");
for (i = 0; i < D_CODES; i++) {
printf("%5d%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10));
}
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
-void ZLIB_INTERNAL zng_tr_init(deflate_state *s) {
+void Z_INTERNAL zng_tr_init(deflate_state *s) {
s->l_desc.dyn_tree = s->dyn_ltree;
s->l_desc.stat_desc = &static_l_desc;
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
-ZLIB_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) {
+Z_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) {
/* tree: the tree to decorate */
/* max_code: largest code with non zero frequency */
/* bl_count: number of codes at each bit length */
/* ===========================================================================
* Send a stored block
*/
-void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
+void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
/* buf: input block */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
-void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s) {
+void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) {
bi_flush(s);
}
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
-void ZLIB_INTERNAL zng_tr_align(deflate_state *s) {
+void Z_INTERNAL zng_tr_align(deflate_state *s) {
zng_tr_emit_tree(s, STATIC_TREES, 0);
zng_tr_emit_end_block(s, static_ltree, 0);
bi_flush(s);
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
-void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
+void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
/* buf: input block, or NULL if too old */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
-ZLIB_INTERNAL unsigned bi_reverse(unsigned code, int len) {
+Z_INTERNAL unsigned bi_reverse(unsigned code, int len) {
/* code: the value to invert */
/* len: its bit length */
Z_REGISTER unsigned res = 0;
/* trees.h */
-extern ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2];
-extern ZLIB_INTERNAL const ct_data static_dtree[D_CODES];
+extern Z_INTERNAL const ct_data static_ltree[L_CODES+2];
+extern Z_INTERNAL const ct_data static_dtree[D_CODES];
-extern const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN];
-extern const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1];
+extern const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN];
+extern const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1];
-extern ZLIB_INTERNAL const int base_length[LENGTH_CODES];
-extern ZLIB_INTERNAL const int base_dist[D_CODES];
+extern Z_INTERNAL const int base_length[LENGTH_CODES];
+extern Z_INTERNAL const int base_dist[D_CODES];
/* Bit buffer and deflate code stderr tracing */
#ifdef ZLIB_DEBUG
fprintf(stderr, "\ncd %3d ", (c)); \
}
#else
-# define send_bits_trace(s, value, length)
+# define send_bits_trace(s, value, length)
# define send_code_trace(s, c)
#endif
/* ===========================================================================
* Emit match distance/length code
*/
-static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
+static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
uint32_t lc, uint32_t dist) {
uint32_t c, extra;
uint8_t code;
/* ===========================================================================
* Emit match and count bits
*/
-static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
+static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree,
uint32_t lc, uint32_t dist) {
cmpr_bits_add(s, zng_emit_dist(s, ltree, dtree, lc, dist));
}
s->bi_valid = bi_valid;
s->bi_buf = bi_buf;
Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last));
-}
+}
/* ===========================================================================
* Align bit buffer on a byte boundary and count bits
/* header created automatically with maketrees.c */
-ZLIB_INTERNAL const ct_data static_ltree[L_CODES+2] = {
+Z_INTERNAL const ct_data static_ltree[L_CODES+2] = {
{{ 12},{8}}, {{140},{8}}, {{ 76},{8}}, {{204},{8}}, {{ 44},{8}},
{{172},{8}}, {{108},{8}}, {{236},{8}}, {{ 28},{8}}, {{156},{8}},
{{ 92},{8}}, {{220},{8}}, {{ 60},{8}}, {{188},{8}}, {{124},{8}},
{{163},{8}}, {{ 99},{8}}, {{227},{8}}
};
-ZLIB_INTERNAL const ct_data static_dtree[D_CODES] = {
+Z_INTERNAL const ct_data static_dtree[D_CODES] = {
{{ 0},{5}}, {{16},{5}}, {{ 8},{5}}, {{24},{5}}, {{ 4},{5}},
{{20},{5}}, {{12},{5}}, {{28},{5}}, {{ 2},{5}}, {{18},{5}},
{{10},{5}}, {{26},{5}}, {{ 6},{5}}, {{22},{5}}, {{14},{5}},
{{19},{5}}, {{11},{5}}, {{27},{5}}, {{ 7},{5}}, {{23},{5}}
};
-const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = {
+const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = {
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
};
-const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {
+const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
};
-ZLIB_INTERNAL const int base_length[LENGTH_CODES] = {
+Z_INTERNAL const int base_length[LENGTH_CODES] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
64, 80, 96, 112, 128, 160, 192, 224, 0
};
-ZLIB_INTERNAL const int base_dist[D_CODES] = {
+Z_INTERNAL const int base_dist[D_CODES] = {
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-#define ZLIB_INTERNAL
+#define Z_INTERNAL
#include "zbuild.h"
#ifdef ZLIB_COMPAT
# include "zlib.h"
/* Type declarations */
+#ifdef ZLIB_INTERNAL
+# define Z_INTERNAL ZLIB_INTERNAL
+#endif
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
-# ifdef ZLIB_INTERNAL
+# ifdef Z_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# define OF(args) args
#endif
+#ifdef ZLIB_INTERNAL
+# define Z_INTERNAL ZLIB_INTERNAL
+#endif
+
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
-# ifdef ZLIB_INTERNAL
+# ifdef Z_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# ifndef verbose
# define verbose 0
# endif
-int ZLIB_INTERNAL z_verbose = verbose;
+int Z_INTERNAL z_verbose = verbose;
-void ZLIB_INTERNAL z_error(char *m) {
+void Z_INTERNAL z_error(char *m) {
fprintf(stderr, "%s\n", m);
exit(1);
}
# endif
#endif
-void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size)
+void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size)
{
(void)opaque;
#ifndef UNALIGNED_OK
#endif
}
-void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr) {
+void Z_INTERNAL zng_cfree(void *opaque, void *ptr) {
(void)opaque;
#ifndef UNALIGNED_OK
zng_align_free(ptr);
*/
#if defined(HAVE_VISIBILITY_INTERNAL)
-# define ZLIB_INTERNAL __attribute__((visibility ("internal")))
+# define Z_INTERNAL __attribute__((visibility ("internal")))
#elif defined(HAVE_VISIBILITY_HIDDEN)
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+# define Z_INTERNAL __attribute__((visibility ("hidden")))
#else
-# define ZLIB_INTERNAL
+# define Z_INTERNAL
#endif
#ifndef __cplusplus
/* Diagnostic functions */
#ifdef ZLIB_DEBUG
# include <stdio.h>
- extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error(char *m);
+ extern int Z_INTERNAL z_verbose;
+ extern void Z_INTERNAL z_error(char *m);
# define Assert(cond, msg) {if (!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose >= 0) fprintf x;}
# define Tracev(x) {if (z_verbose > 0) fprintf x;}
# define Tracecv(c, x)
#endif
-void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size);
-void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr);
+void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size);
+void Z_INTERNAL zng_cfree(void *opaque, void *ptr);
#define ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr))