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

Go to the source code of this file.

Classes

struct  internal_state
 

Functions

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

Variables

const char *const z_errmsg [10]
 

Function Documentation

◆ OF() [1/4]

void exit OF ( (int)  )

◆ OF() [2/4]

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

◆ OF() [3/4]

voidp malloc OF ( (uInt size)  )

◆ OF() [4/4]

void free OF ( (voidpf ptr)  )

◆ zcalloc()

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

Definition at line 291 of file zutil.cc.

292{
293 if (opaque) items += size - size; /* make compiler happy */
294 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
295 (voidpf)calloc(items, size);
296}
Byte FAR * voidpf
Definition: zconf.h:277
unsigned int uInt
Definition: zconf.h:257

Referenced by deflateInit2_().

◆ zcfree()

void zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 298 of file zutil.cc.

299{
300 free(ptr);
301 if (opaque) return; /* make compiler happy */
302}

Referenced by deflateInit2_().

◆ zError()

const char *ZEXPORT zError ( int  err)

Definition at line 136 of file zutil.cc.

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

◆ zlibCompileFlags()

uLong ZEXPORT zlibCompileFlags ( )

Definition at line 36 of file zutil.cc.

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

◆ zlibVersion()

const char *ZEXPORT zlibVersion ( )

Definition at line 31 of file zutil.cc.

32{
33 return ZLIB_VERSION;
34}
#define ZLIB_VERSION
Definition: zlib.h:40

◆ zmemcmp()

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

Definition at line 156 of file zutil.cc.

157{
158 uInt j;
159
160 for (j = 0; j < len; j++) {
161 if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
162 }
163 return 0;
164}

◆ zmemcpy()

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

Definition at line 148 of file zutil.cc.

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

Referenced by deflateCopy(), deflateSetDictionary(), fill_window(), flush_pending(), and read_buf().

◆ zmemzero()

void zmemzero ( Bytef dest,
uInt  len 
)

Definition at line 166 of file zutil.cc.

167{
168 if (len == 0) return;
169 do {
170 *dest++ = 0; /* ??? to be unrolled */
171 } while (--len != 0);
172}

Variable Documentation

◆ z_errmsg

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

Definition at line 18 of file zutil.cc.