abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zutil.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc/util/abc_global.h"
#include "zutil.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 300 of file zutil.c.

301 {
302  if (opaque) items += size - size; /* make compiler happy */
303  return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
304  (voidpf)calloc(items, size);
305 }
char * malloc()
Byte FAR * voidpf
Definition: zconf.h:355
static int size
Definition: cuddSign.c:86
char * calloc()
unsigned int uInt
Definition: zconf.h:335
void ZLIB_INTERNAL zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 307 of file zutil.c.

308 {
309  free(ptr);
310  if (opaque) return; /* make compiler happy */
311 }
VOID_HACK free()
const char* ZEXPORT zError ( int  err)

Definition at line 142 of file zutil.c.

143 {
144  return ERR_MSG(err);
145 }
#define ERR_MSG(err)
Definition: zutil.h:48
uLong ZEXPORT zlibCompileFlags ( )

Definition at line 41 of file zutil.c.

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

Definition at line 36 of file zutil.c.

37 {
38  return ZLIB_VERSION;
39 }
#define ZLIB_VERSION
Definition: zlib.h:48
int ZLIB_INTERNAL zmemcmp ( const Bytef s1,
const Bytef s2,
uInt  len 
)

Definition at line 165 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 }
static char s1[largest_string]
Definition: set.c:514
unsigned int uInt
Definition: zconf.h:335
void ZLIB_INTERNAL zmemcpy ( Bytef dest,
const Bytef source,
uInt  len 
)

Definition at line 157 of file zutil.c.

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

Definition at line 175 of file zutil.c.

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

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