Geant4-11
Functions | Variables
zutil.c File Reference
#include "zutil.h"
#include "gzguts.h"

Go to the source code of this file.

Functions

voidp calloc OF ((uInt items, uInt size))
 
voidp malloc OF ((uInt size))
 
void free OF ((voidpf ptr))
 
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
 
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 
const char *ZEXPORT zError (int err)
 
uLong ZEXPORT zlibCompileFlags ()
 
const char *ZEXPORT zlibVersion ()
 
int ZLIB_INTERNAL zmemcmp (Bytef *s1, const Bytef *s2, uInt len) const
 
void ZLIB_INTERNAL zmemcpy (Bytef *dest, const Bytef *source, uInt len)
 
void ZLIB_INTERNAL zmemzero (Bytef *dest, uInt len)
 

Variables

z_const char *const z_errmsg [10]
 

Function Documentation

◆ OF() [1/3]

voidp calloc OF ( (uInt items, uInt size)  )

◆ OF() [2/3]

voidp malloc OF ( (uInt size)  )

◆ OF() [3/3]

void free OF ( (voidpf ptr)  )

References free.

◆ zcalloc()

voidpf ZLIB_INTERNAL zcalloc ( voidpf  opaque,
unsigned  items,
unsigned  size 
)

Definition at line 304 of file zutil.c.

308{
309 (void)opaque;
310 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
311 (voidpf)calloc(items, size);
312}

Referenced by deflateInit2_(), inflateBackInit_(), and inflateInit2_().

◆ zcfree()

void ZLIB_INTERNAL zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 314 of file zutil.c.

317{
318 (void)opaque;
319 free(ptr);
320}

References free.

Referenced by deflateInit2_(), inflateBackInit_(), and inflateInit2_().

◆ zError()

const char *ZEXPORT zError ( int  err)

Definition at line 132 of file zutil.c.

134{
135 return ERR_MSG(err);
136}
#define ERR_MSG(err)
Definition: zutil.h:51

References ERR_MSG.

◆ zlibCompileFlags()

uLong ZEXPORT zlibCompileFlags ( )

Definition at line 31 of file zutil.c.

32{
33 uLong flags;
34
35 flags = 0;
36 switch ((int)(sizeof(uInt))) {
37 case 2: break;
38 case 4: flags += 1; break;
39 case 8: flags += 2; break;
40 default: flags += 3;
41 }
42 switch ((int)(sizeof(uLong))) {
43 case 2: break;
44 case 4: flags += 1 << 2; break;
45 case 8: flags += 2 << 2; break;
46 default: flags += 3 << 2;
47 }
48 switch ((int)(sizeof(voidpf))) {
49 case 2: break;
50 case 4: flags += 1 << 4; break;
51 case 8: flags += 2 << 4; break;
52 default: flags += 3 << 4;
53 }
54 switch ((int)(sizeof(z_off_t))) {
55 case 2: break;
56 case 4: flags += 1 << 6; break;
57 case 8: flags += 2 << 6; break;
58 default: flags += 3 << 6;
59 }
60#ifdef ZLIB_DEBUG
61 flags += 1 << 8;
62#endif
63#if defined(ASMV) || defined(ASMINF)
64 flags += 1 << 9;
65#endif
66#ifdef ZLIB_WINAPI
67 flags += 1 << 10;
68#endif
69#ifdef BUILDFIXED
70 flags += 1 << 12;
71#endif
72#ifdef DYNAMIC_CRC_TABLE
73 flags += 1 << 13;
74#endif
75#ifdef NO_GZCOMPRESS
76 flags += 1L << 16;
77#endif
78#ifdef NO_GZIP
79 flags += 1L << 17;
80#endif
81#ifdef PKZIP_BUG_WORKAROUND
82 flags += 1L << 20;
83#endif
84#ifdef FASTEST
85 flags += 1L << 21;
86#endif
87#if defined(STDC) || defined(Z_HAVE_STDARG_H)
88# ifdef NO_vsnprintf
89 flags += 1L << 25;
90# ifdef HAS_vsprintf_void
91 flags += 1L << 26;
92# endif
93# else
94# ifdef HAS_vsnprintf_void
95 flags += 1L << 26;
96# endif
97# endif
98#else
99 flags += 1L << 24;
100# ifdef NO_snprintf
101 flags += 1L << 25;
102# ifdef HAS_sprintf_void
103 flags += 1L << 26;
104# endif
105# else
106# ifdef HAS_snprintf_void
107 flags += 1L << 26;
108# endif
109# endif
110#endif
111 return flags;
112}

◆ zlibVersion()

const char *ZEXPORT zlibVersion ( )

Definition at line 26 of file zutil.c.

27{
28 return ZLIB_VERSION;
29}
#define ZLIB_VERSION
Definition: zlib.h:40

References ZLIB_VERSION.

◆ zmemcmp()

int ZLIB_INTERNAL zmemcmp ( Bytef*  s1,
const Bytef*  s2,
uInt  len 
) const

Definition at line 159 of file zutil.c.

163{
164 uInt j;
165
166 for (j = 0; j < len; j++) {
167 if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
168 }
169 return 0;
170}

◆ zmemcpy()

void ZLIB_INTERNAL zmemcpy ( Bytef*  dest,
const Bytef*  source,
uInt  len 
)

Definition at line 148 of file zutil.c.

152{
153 if (len == 0) return;
154 do {
155 *dest++ = *source++; /* ??? to be unrolled */
156 } while (--len != 0);
157}

Referenced by _tr_stored_block(), deflate(), deflate_stored(), deflateCopy(), deflateGetDictionary(), fill_window(), flush_pending(), inflate(), inflateBack(), inflateCopy(), inflateGetDictionary(), read_buf(), and updatewindow().

◆ zmemzero()

void ZLIB_INTERNAL zmemzero ( Bytef*  dest,
uInt  len 
)

Definition at line 172 of file zutil.c.

175{
176 if (len == 0) return;
177 do {
178 *dest++ = 0; /* ??? to be unrolled */
179 } while (--len != 0);
180}

Referenced by fill_window().

Variable Documentation

◆ z_errmsg

z_const char* const z_errmsg[10]
Initial value:
= {
(z_const char *)"need dictionary",
(z_const char *)"stream end",
(z_const char *)"",
(z_const char *)"file error",
(z_const char *)"stream error",
(z_const char *)"data error",
(z_const char *)"insufficient memory",
(z_const char *)"buffer error",
(z_const char *)"incompatible version",
(z_const char *)""
}

Definition at line 12 of file zutil.c.