zutil.cc File Reference

#include "zutil.h"

Go to the source code of this file.

Data Structures

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

void free OF ( (voidpf ptr)   ) 

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

voidp malloc OF ( (uInt size)   ) 

void exit OF ( (int)   ) 

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

Definition at line 291 of file zutil.cc.

Referenced by deflateInit2_().

00292 {
00293     if (opaque) items += size - size; /* make compiler happy */
00294     return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
00295                               (voidpf)calloc(items, size);
00296 }

void zcfree ( voidpf  opaque,
voidpf  ptr 
)

Definition at line 298 of file zutil.cc.

Referenced by deflateInit2_().

00299 {
00300     free(ptr);
00301     if (opaque) return; /* make compiler happy */
00302 }

const char* ZEXPORT zError ( int  err  ) 

Definition at line 136 of file zutil.cc.

00137 {
00138     return ERR_MSG(err);
00139 }

uLong ZEXPORT zlibCompileFlags (  ) 

Definition at line 36 of file zutil.cc.

00037 {
00038     uLong flags;
00039 
00040     flags = 0;
00041     switch (sizeof(uInt)) {
00042     case 2:     break;
00043     case 4:     flags += 1;     break;
00044     case 8:     flags += 2;     break;
00045     default:    flags += 3;
00046     }
00047     switch (sizeof(uLong)) {
00048     case 2:     break;
00049     case 4:     flags += 1 << 2;        break;
00050     case 8:     flags += 2 << 2;        break;
00051     default:    flags += 3 << 2;
00052     }
00053     switch (sizeof(voidpf)) {
00054     case 2:     break;
00055     case 4:     flags += 1 << 4;        break;
00056     case 8:     flags += 2 << 4;        break;
00057     default:    flags += 3 << 4;
00058     }
00059     switch (sizeof(z_off_t)) {
00060     case 2:     break;
00061     case 4:     flags += 1 << 6;        break;
00062     case 8:     flags += 2 << 6;        break;
00063     default:    flags += 3 << 6;
00064     }
00065 #ifdef DEBUG
00066     flags += 1 << 8;
00067 #endif
00068 #if defined(ASMV) || defined(ASMINF)
00069     flags += 1 << 9;
00070 #endif
00071 #ifdef ZLIB_WINAPI
00072     flags += 1 << 10;
00073 #endif
00074 #ifdef BUILDFIXED
00075     flags += 1 << 12;
00076 #endif
00077 #ifdef DYNAMIC_CRC_TABLE
00078     flags += 1 << 13;
00079 #endif
00080 #ifdef NO_GZCOMPRESS
00081     flags += 1 << 16;
00082 #endif
00083 #ifdef NO_GZIP
00084     flags += 1 << 17;
00085 #endif
00086 #ifdef PKZIP_BUG_WORKAROUND
00087     flags += 1 << 20;
00088 #endif
00089 #ifdef FASTEST
00090     flags += 1 << 21;
00091 #endif
00092 #ifdef STDC
00093 #  ifdef NO_vsnprintf
00094         flags += 1 << 25;
00095 #    ifdef HAS_vsprintf_void
00096         flags += 1 << 26;
00097 #    endif
00098 #  else
00099 #    ifdef HAS_vsnprintf_void
00100         flags += 1 << 26;
00101 #    endif
00102 #  endif
00103 #else
00104         flags += 1 << 24;
00105 #  ifdef NO_snprintf
00106         flags += 1 << 25;
00107 #    ifdef HAS_sprintf_void
00108         flags += 1 << 26;
00109 #    endif
00110 #  else
00111 #    ifdef HAS_snprintf_void
00112         flags += 1 << 26;
00113 #    endif
00114 #  endif
00115 #endif
00116     return flags;
00117 }

const char* ZEXPORT zlibVersion (  ) 

Definition at line 31 of file zutil.cc.

00032 {
00033     return ZLIB_VERSION;
00034 }

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

Definition at line 156 of file zutil.cc.

00157 {
00158     uInt j;
00159 
00160     for (j = 0; j < len; j++) {
00161         if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
00162     }
00163     return 0;
00164 }

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

Definition at line 148 of file zutil.cc.

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

00149 {
00150     if (len == 0) return;
00151     do {
00152         *dest++ = *source++; /* ??? to be unrolled */
00153     } while (--len != 0);
00154 }

void zmemzero ( Bytef *  dest,
uInt  len 
)

Definition at line 166 of file zutil.cc.

00167 {
00168     if (len == 0) return;
00169     do {
00170         *dest++ = 0;  /* ??? to be unrolled */
00171     } while (--len != 0);
00172 }


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


Generated on Mon May 27 17:51:18 2013 for Geant4 by  doxygen 1.4.7