The SWORD Project  1.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zutil.c File Reference
#include "zutil.h"
#include "gzguts.h"
+ Include dependency graph for zutil.c:

Go to the source code of this file.

Classes

struct  internal_state
 

Functions

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)
 
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

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

308 {
309  if (opaque) items += size - size; /* make compiler happy */
310  return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
311  (voidpf)calloc(items, size);
312 }
Byte FAR * voidpf
Definition: zconf.h:390
char * malloc()
int size
Definition: regex.c:5043
unsigned int uInt
Definition: zconf.h:370
void ZLIB_INTERNAL zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 314 of file zutil.c.

317 {
318  free(ptr);
319  if (opaque) return; /* make compiler happy */
320 }
free(preg->fastmap)
const char* ZEXPORT zError ( int  err)

Definition at line 136 of file zutil.c.

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

Definition at line 35 of file zutil.c.

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 }
#define z_off_t
Definition: zconf.h:481
Byte FAR * voidpf
Definition: zconf.h:390
unsigned long uLong
Definition: zconf.h:371
unsigned int uInt
Definition: zconf.h:370
const char* ZEXPORT zlibVersion ( )

Definition at line 30 of file zutil.c.

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

Definition at line 163 of file zutil.c.

167 {
168  uInt j;
169 
170  for (j = 0; j < len; j++) {
171  if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
172  }
173  return 0;
174 }
unsigned int uInt
Definition: zconf.h:370
void ZLIB_INTERNAL zmemcpy ( Bytef dest,
const Bytef source,
uInt  len 
)

Definition at line 152 of file zutil.c.

156 {
157  if (len == 0) return;
158  do {
159  *dest++ = *source++; /* ??? to be unrolled */
160  } while (--len != 0);
161 }
void ZLIB_INTERNAL zmemzero ( Bytef dest,
uInt  len 
)

Definition at line 176 of file zutil.c.

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

Variable Documentation

z_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.c.