godot/thirdparty/zlib/zutil.h

/* zutil.h -- internal interface and configuration of the compression library
 * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
 */

/* @(#) $Id$ */

#ifndef ZUTIL_H
#define ZUTIL_H

#ifdef HAVE_HIDDEN
#define ZLIB_INTERNAL
#else
#define ZLIB_INTERNAL
#endif

#include "zlib.h"

#if defined(STDC) && !defined(Z_SOLO)
#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
#    include <stddef.h>
#  endif
#  include <string.h>
#  include <stdlib.h>
#endif

#ifndef local
#define local
#endif
/* since "static" is used to mean two completely different things in C, we
   define "local" for the non-static meaning of "static", for readability
   (compile with -Dlocal if your debugger can't find static symbols) */

uch;
uchf;
ush;
ushf;
ulg;

#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
#  include <limits.h>
#  if (ULONG_MAX == 0xffffffffffffffff)
#define Z_U8
#  elif (ULLONG_MAX == 0xffffffffffffffff)
#define Z_U8
#  elif (UINT_MAX == 0xffffffffffffffff)
#define Z_U8
#  endif
#endif

extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */

#define ERR_MSG(err)

#define ERR_RETURN(strm,err)
/* To be used only when the state is known to be valid */

        /* common constants */

#ifndef DEF_WBITS
#define DEF_WBITS
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */

#if MAX_MEM_LEVEL >= 8
#define DEF_MEM_LEVEL
#else
#define DEF_MEM_LEVEL
#endif
/* default memLevel */

#define STORED_BLOCK
#define STATIC_TREES
#define DYN_TREES
/* The three kinds of block type */

#define MIN_MATCH
#define MAX_MATCH
/* The minimum and maximum match lengths */

#define PRESET_DICT

        /* target dependencies */

#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
#define OS_CODE
#  ifndef Z_SOLO
#    if defined(__TURBOC__) || defined(__BORLANDC__)
#      if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
         /* Allow compilation with ANSI keywords only enabled */
         void _Cdecl farfree( void *block );
         void *_Cdecl farmalloc( unsigned long nbytes );
#      else
#        include <alloc.h>
#      endif
#    else /* MSC or DJGPP */
#      include <malloc.h>
#    endif
#  endif
#endif

#ifdef AMIGA
#define OS_CODE
#endif

#if defined(VAXC) || defined(VMS)
#define OS_CODE
#define F_OPEN
#endif

#ifdef __370__
#  if __TARGET_LIB__ < 0x20000000
#define OS_CODE
#  elif __TARGET_LIB__ < 0x40000000
#define OS_CODE
#  else
#define OS_CODE
#  endif
#endif

#if defined(ATARI) || defined(atarist)
#define OS_CODE
#endif

#ifdef OS2
#define OS_CODE
#  if defined(M_I86) && !defined(Z_SOLO)
#    include <malloc.h>
#  endif
#endif

#if defined(MACOS)
#define OS_CODE
#endif

#ifdef __acorn
#define OS_CODE
#endif

#if defined(WIN32) && !defined(__CYGWIN__)
#define OS_CODE
#endif

#ifdef _BEOS_
#define OS_CODE
#endif

#ifdef __TOS_OS400__
#define OS_CODE
#endif

#ifdef __APPLE__
#define OS_CODE
#endif

#if defined(__BORLANDC__) && !defined(MSDOS)
  #pragma warn -8004
  #pragma warn -8008
  #pragma warn -8066
#endif

/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
    (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
    ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
    ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
    ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
#endif

        /* common defaults */

#ifndef OS_CODE
#define OS_CODE
#endif

#ifndef F_OPEN
#define F_OPEN(name, mode)
#endif

         /* functions */

#if defined(pyr) || defined(Z_SOLO)
#define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
 /* Use our own functions for small and medium model with MSC <= 5.0.
  * You may have to use the same strategy for Borland C (untested).
  * The __SC__ check is for Symantec.
  */
#define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
#define HAVE_MEMCPY
#endif
#ifdef HAVE_MEMCPY
#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
#define zmemcpy
#define zmemcmp
#define zmemzero
#  else
#define zmemcpy
#define zmemcmp
#define zmemzero(dest, len)
#  endif
#else
   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);
#endif

/* Diagnostic functions */
#ifdef ZLIB_DEBUG
#  include <stdio.h>
   extern int ZLIB_INTERNAL z_verbose;
   extern void ZLIB_INTERNAL z_error(char *m);
#define Assert
#define Trace
#define Tracev
#define Tracevv
#define Tracec
#define Tracecv
#else
#define Assert(cond,msg)
#define Trace(x)
#define Tracev(x)
#define Tracevv(x)
#define Tracec(c,x)
#define Tracecv(c,x)
#endif

#ifndef Z_SOLO
   voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
                                unsigned size);
   void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
#endif

#define ZALLOC(strm, items, size)
#define ZFREE(strm, addr)
#define TRY_FREE(s, p)

/* Reverse the bytes in a 32-bit value */
#define ZSWAP32(q)

#endif /* ZUTIL_H */