/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
#ifndef Z_SOLO
# include "gzguts.h"
#endif
#ifndef NO_DUMMY_DECL
#endif
"need dictionary", /* Z_NEED_DICT 2 */
"stream end", /* Z_STREAM_END 1 */
"", /* Z_OK 0 */
"file error", /* Z_ERRNO (-1) */
"stream error", /* Z_STREAM_ERROR (-2) */
"data error", /* Z_DATA_ERROR (-3) */
"insufficient memory", /* Z_MEM_ERROR (-4) */
"buffer error", /* Z_BUF_ERROR (-5) */
"incompatible version",/* Z_VERSION_ERROR (-6) */
""};
{
return ZLIB_VERSION;
}
{
flags = 0;
switch ((int)(sizeof(uInt))) {
case 2: break;
default: flags += 3;
}
switch ((int)(sizeof(uLong))) {
case 2: break;
}
switch ((int)(sizeof(voidpf))) {
case 2: break;
}
switch ((int)(sizeof(z_off_t))) {
case 2: break;
}
#ifdef DEBUG
#endif
#endif
#ifdef ZLIB_WINAPI
#endif
#ifdef BUILDFIXED
#endif
#ifdef DYNAMIC_CRC_TABLE
#endif
#ifdef NO_GZCOMPRESS
#endif
#ifdef NO_GZIP
#endif
#ifdef PKZIP_BUG_WORKAROUND
#endif
#ifdef FASTEST
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
# ifdef HAS_vsprintf_void
# endif
# else
# ifdef HAS_vsnprintf_void
# endif
# endif
#else
# ifdef NO_snprintf
# ifdef HAS_sprintf_void
# endif
# else
# ifdef HAS_snprintf_void
# endif
# endif
#endif
return flags;
}
#ifdef DEBUG
# ifndef verbose
# define verbose 0
# endif
char *m;
{
exit(1);
}
#endif
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
int err;
{
}
#if defined(_WIN32_WCE)
/* The Microsoft C Run-Time Library for Windows CE doesn't have
* errno. We define it as a global variable to simplify porting.
* Its value is always 0 and should not be used.
*/
int errno = 0;
#endif
#ifndef HAVE_MEMCPY
{
if (len == 0) return;
do {
} while (--len != 0);
}
{
uInt j;
for (j = 0; j < len; j++) {
}
return 0;
}
{
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
} while (--len != 0);
}
#endif
#ifndef Z_SOLO
#ifdef SYS16BIT
#ifdef __TURBOC__
/* Turbo C in 16-bit mode */
# define MY_ZCALLOC
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
* and farmalloc(64K) returns a pointer with an offset of 8, so we
* must fix the pointer. Warning: the pointer must be put back to its
* original form in order to free it, use zcfree().
*/
/* 10*64K = 640K */
typedef struct ptr_table_s {
} ptr_table;
/* This table is used to remember the original form of pointers
* to large buffers (64K). Such pointers are normalized with a zero offset.
* Since MSDOS is not a preemptive multitasking OS, this table is not
* protected from concurrent access. This hack doesn't work anyway on
* a protected system like OS/2. Use Microsoft C instead.
*/
{
/* If we allocate less than 65520 bytes, we assume that farmalloc
* will return a usable pointer which doesn't have to be normalized.
*/
if (bsize < 65520L) {
} else {
}
/* Normalize the pointer to seg:0 */
return buf;
}
{
int n;
return;
}
/* Find the original pointer */
for (n = 0; n < next_ptr; n++) {
while (++n < next_ptr) {
}
next_ptr--;
return;
}
Assert(0, "zcfree: ptr not found");
}
#endif /* __TURBOC__ */
#ifdef M_I86
/* Microsoft C in 16-bit mode */
# define MY_ZCALLOC
#endif
{
}
{
}
#endif /* M_I86 */
#endif /* SYS16BIT */
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC
#endif
unsigned items;
unsigned size;
{
}
{
if (opaque) return; /* make compiler happy */
}
#endif /* MY_ZCALLOC */
#endif /* !Z_SOLO */