Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
zutil.c File Reference
#include "zutil.h"
#include "gzguts.h"

Go to the source code of this file.

Functions

const char *ZEXPORT zlibVersion ()
 
uLong ZEXPORT zlibCompileFlags ()
 
const char *ZEXPORT zError (int err)
 
void ZLIB_INTERNAL zmemcpy (Bytef *dest, const Bytef *source, uInt len)
 
int ZLIB_INTERNAL zmemcmp (Bytef *s1, const Bytef *s2, uInt len) const
 
void ZLIB_INTERNAL zmemzero (Bytef *dest, uInt len)
 
voidp malloc OF ((uInt size))
 
voidp calloc OF ((uInt items, 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)
 

Variables

z_const char *const z_errmsg [10]
 

Function Documentation

◆ OF() [1/3]

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

◆ OF() [2/3]

voidp malloc OF ( (uInt size) )
extern

◆ OF() [3/3]

void free OF ( (voidpf ptr) )
extern

◆ zcalloc()

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

Definition at line 307 of file zutil.c.

311{
312 (void)opaque;
313 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
314 (voidpf)calloc(items, size);
315}

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

◆ zcfree()

void ZLIB_INTERNAL zcfree ( voidpf opaque,
voidpf ptr )

Definition at line 317 of file zutil.c.

320{
321 (void)opaque;
322 free(ptr);
323}

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

◆ zError()

const char *ZEXPORT zError ( int err)

Definition at line 135 of file zutil.c.

137{
138 return ERR_MSG(err);
139}
#define ERR_MSG(err)
Definition zutil.h:59

◆ zlibCompileFlags()

uLong ZEXPORT zlibCompileFlags ( )

Definition at line 32 of file zutil.c.

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

◆ zlibVersion()

const char *ZEXPORT zlibVersion ( )

Definition at line 27 of file zutil.c.

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

◆ zmemcmp()

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

Definition at line 162 of file zutil.c.

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

◆ zmemcpy()

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

Definition at line 151 of file zutil.c.

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

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 175 of file zutil.c.

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

Referenced by deflateInit2_(), and 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 13 of file zutil.c.

13 {
14 (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */
15 (z_const char *)"stream end", /* Z_STREAM_END 1 */
16 (z_const char *)"", /* Z_OK 0 */
17 (z_const char *)"file error", /* Z_ERRNO (-1) */
18 (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */
19 (z_const char *)"data error", /* Z_DATA_ERROR (-3) */
20 (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */
21 (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */
22 (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */
23 (z_const char *)""
24};