zutil.c revision ada1678a4262b208a7b87391f520a7767d25287c
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#include "zutil.h"
#ifndef STDC
#endif
const char *z_errmsg[10] = {
"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) */
""};
const char * ZEXPORT zlibVersion()
{
return ZLIB_VERSION;
}
#ifdef DEBUG
# ifndef verbose
# define verbose 0
# endif
void z_error (m)
char *m;
{
exit(1);
}
#endif
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
int err;
{
}
#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
#ifdef __TURBOC__
/* Small and medium model in Turbo C are for now limited to near allocation
* with reduced MAX_WBITS and MAX_MEM_LEVEL
*/
# 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().
*/
#define MAX_PTR 10
/* 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
#endif /* __TURBOC__ */
/* Microsoft C in 16-bit mode */
# define MY_ZCALLOC
#endif
{
}
{
}
#endif /* MSC */
#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 */