Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Functions | Variables
zutil.cc File Reference
#include "zutil.h"
#include "gzguts.h"

Go to the source code of this file.

Data Structures

struct  internal_state
 

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 (const Bytef *s1, const Bytef *s2, uInt len)
 
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

const char *const z_errmsg [10]
 

Function Documentation

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 
)

Definition at line 294 of file zutil.cc.

References calloc(), and malloc().

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

295 {
296  if (opaque) items += size - size; /* make compiler happy */
297  return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
298  (voidpf)calloc(items, size);
299 }
void * calloc(size_t __nmemb, size_t __size)
Definition: hjmalloc.cc:67
void * malloc(size_t __size)
Definition: hjmalloc.cc:30
void ZLIB_INTERNAL zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 301 of file zutil.cc.

References free().

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

302 {
303  free(ptr);
304  if (opaque) return; /* make compiler happy */
305 }
void free(void *__ptr)
Definition: hjmalloc.cc:140
const char* ZEXPORT zError ( int  err)

Definition at line 135 of file zutil.cc.

References ERR_MSG.

136 {
137  return ERR_MSG(err);
138 }
#define ERR_MSG(err)
Definition: zutil.h:50
uLong ZEXPORT zlibCompileFlags ( )

Definition at line 35 of file zutil.cc.

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

Definition at line 30 of file zutil.cc.

References ZLIB_VERSION.

31 {
32  return ZLIB_VERSION;
33 }
#define ZLIB_VERSION
Definition: zlib.h:40
int ZLIB_INTERNAL zmemcmp ( const Bytef *  s1,
const Bytef *  s2,
uInt  len 
)

Definition at line 158 of file zutil.cc.

159 {
160  uInt j;
161 
162  for (j = 0; j < len; j++) {
163  if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
164  }
165  return 0;
166 }
const XML_Char int len
void ZLIB_INTERNAL zmemcpy ( Bytef *  dest,
const Bytef *  source,
uInt  len 
)

Definition at line 150 of file zutil.cc.

Referenced by deflateCopy(), fill_window(), flush_pending(), inflate(), inflateBack(), inflateCopy(), read_buf(), and updatewindow().

151 {
152  if (len == 0) return;
153  do {
154  *dest++ = *source++; /* ??? to be unrolled */
155  } while (--len != 0);
156 }
const XML_Char int len
void ZLIB_INTERNAL zmemzero ( Bytef *  dest,
uInt  len 
)

Definition at line 168 of file zutil.cc.

Referenced by fill_window().

169 {
170  if (len == 0) return;
171  do {
172  *dest++ = 0; /* ??? to be unrolled */
173  } while (--len != 0);
174 }
const XML_Char int len

Variable Documentation

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 17 of file zutil.cc.