annotate lib/zlib/zutil.h @ 2438:c10c639f8365

* Fixed releasing movie for movie-less transitions.
author a.parshin
date Thu, 24 Jul 2014 00:31:49 +0300
parents f4af3b203f65
children
rev   line source
0
Ritor1
parents:
diff changeset
1 /* zutil.h -- internal interface and configuration of the compression library
Ritor1
parents:
diff changeset
2 * Copyright (C) 1995-1998 Jean-loup Gailly.
Ritor1
parents:
diff changeset
3 * For conditions of distribution and use, see copyright notice in zlib.h
Ritor1
parents:
diff changeset
4 */
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6 /* WARNING: this file should *not* be used by applications. It is
Ritor1
parents:
diff changeset
7 part of the implementation of the compression library and is
Ritor1
parents:
diff changeset
8 subject to change. Applications should only use zlib.h.
Ritor1
parents:
diff changeset
9 */
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11 /* @(#) $Id$ */
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 0
diff changeset
12 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 0
diff changeset
13 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 0
diff changeset
14 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 0
diff changeset
15
0
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17 #ifndef _Z_UTIL_H
Ritor1
parents:
diff changeset
18 #define _Z_UTIL_H
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20 #include "zlib.h"
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22 #ifdef STDC
Ritor1
parents:
diff changeset
23 # include <stddef.h>
Ritor1
parents:
diff changeset
24 # include <string.h>
Ritor1
parents:
diff changeset
25 # include <stdlib.h>
Ritor1
parents:
diff changeset
26 #endif
Ritor1
parents:
diff changeset
27 #ifdef NO_ERRNO_H
Ritor1
parents:
diff changeset
28 extern int errno;
Ritor1
parents:
diff changeset
29 #else
Ritor1
parents:
diff changeset
30 # include <errno.h>
Ritor1
parents:
diff changeset
31 #endif
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 #ifndef local
Ritor1
parents:
diff changeset
34 # define local static
Ritor1
parents:
diff changeset
35 #endif
Ritor1
parents:
diff changeset
36 /* compile with -Dlocal if your debugger can't find static symbols */
Ritor1
parents:
diff changeset
37
Ritor1
parents:
diff changeset
38 typedef unsigned char uch;
Ritor1
parents:
diff changeset
39 typedef uch FAR uchf;
Ritor1
parents:
diff changeset
40 typedef unsigned short ush;
Ritor1
parents:
diff changeset
41 typedef ush FAR ushf;
Ritor1
parents:
diff changeset
42 typedef unsigned long ulg;
Ritor1
parents:
diff changeset
43
Ritor1
parents:
diff changeset
44 extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
Ritor1
parents:
diff changeset
45 /* (size given to avoid silly warnings with Visual C++) */
Ritor1
parents:
diff changeset
46
Ritor1
parents:
diff changeset
47 #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 #define ERR_RETURN(strm,err) \
Ritor1
parents:
diff changeset
50 return (strm->msg = (char*)ERR_MSG(err), (err))
Ritor1
parents:
diff changeset
51 /* To be used only when the state is known to be valid */
Ritor1
parents:
diff changeset
52
Ritor1
parents:
diff changeset
53 /* common constants */
Ritor1
parents:
diff changeset
54
Ritor1
parents:
diff changeset
55 #ifndef DEF_WBITS
Ritor1
parents:
diff changeset
56 # define DEF_WBITS MAX_WBITS
Ritor1
parents:
diff changeset
57 #endif
Ritor1
parents:
diff changeset
58 /* default windowBits for decompression. MAX_WBITS is for compression only */
Ritor1
parents:
diff changeset
59
Ritor1
parents:
diff changeset
60 #if MAX_MEM_LEVEL >= 8
Ritor1
parents:
diff changeset
61 # define DEF_MEM_LEVEL 8
Ritor1
parents:
diff changeset
62 #else
Ritor1
parents:
diff changeset
63 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
Ritor1
parents:
diff changeset
64 #endif
Ritor1
parents:
diff changeset
65 /* default memLevel */
Ritor1
parents:
diff changeset
66
Ritor1
parents:
diff changeset
67 #define STORED_BLOCK 0
Ritor1
parents:
diff changeset
68 #define STATIC_TREES 1
Ritor1
parents:
diff changeset
69 #define DYN_TREES 2
Ritor1
parents:
diff changeset
70 /* The three kinds of block type */
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72 #define MIN_MATCH 3
Ritor1
parents:
diff changeset
73 #define MAX_MATCH 258
Ritor1
parents:
diff changeset
74 /* The minimum and maximum match lengths */
Ritor1
parents:
diff changeset
75
Ritor1
parents:
diff changeset
76 #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
Ritor1
parents:
diff changeset
77
Ritor1
parents:
diff changeset
78 /* target dependencies */
Ritor1
parents:
diff changeset
79
Ritor1
parents:
diff changeset
80 #ifdef MSDOS
Ritor1
parents:
diff changeset
81 # define OS_CODE 0x00
Ritor1
parents:
diff changeset
82 # if defined(__TURBOC__) || defined(__BORLANDC__)
Ritor1
parents:
diff changeset
83 # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
Ritor1
parents:
diff changeset
84 /* Allow compilation with ANSI keywords only enabled */
Ritor1
parents:
diff changeset
85 void _Cdecl farfree( void *block );
Ritor1
parents:
diff changeset
86 void *_Cdecl farmalloc( unsigned long nbytes );
Ritor1
parents:
diff changeset
87 # else
Ritor1
parents:
diff changeset
88 # include <alloc.h>
Ritor1
parents:
diff changeset
89 # endif
Ritor1
parents:
diff changeset
90 # else /* MSC or DJGPP */
Ritor1
parents:
diff changeset
91 # include <malloc.h>
Ritor1
parents:
diff changeset
92 # endif
Ritor1
parents:
diff changeset
93 #endif
Ritor1
parents:
diff changeset
94
Ritor1
parents:
diff changeset
95 #ifdef OS2
Ritor1
parents:
diff changeset
96 # define OS_CODE 0x06
Ritor1
parents:
diff changeset
97 #endif
Ritor1
parents:
diff changeset
98
Ritor1
parents:
diff changeset
99 #ifdef WIN32 /* Window 95 & Windows NT */
Ritor1
parents:
diff changeset
100 # define OS_CODE 0x0b
Ritor1
parents:
diff changeset
101 #endif
Ritor1
parents:
diff changeset
102
Ritor1
parents:
diff changeset
103 #if defined(VAXC) || defined(VMS)
Ritor1
parents:
diff changeset
104 # define OS_CODE 0x02
Ritor1
parents:
diff changeset
105 # define F_OPEN(name, mode) \
Ritor1
parents:
diff changeset
106 fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
Ritor1
parents:
diff changeset
107 #endif
Ritor1
parents:
diff changeset
108
Ritor1
parents:
diff changeset
109 #ifdef AMIGA
Ritor1
parents:
diff changeset
110 # define OS_CODE 0x01
Ritor1
parents:
diff changeset
111 #endif
Ritor1
parents:
diff changeset
112
Ritor1
parents:
diff changeset
113 #if defined(ATARI) || defined(atarist)
Ritor1
parents:
diff changeset
114 # define OS_CODE 0x05
Ritor1
parents:
diff changeset
115 #endif
Ritor1
parents:
diff changeset
116
Ritor1
parents:
diff changeset
117 #if defined(MACOS) || defined(TARGET_OS_MAC)
Ritor1
parents:
diff changeset
118 # define OS_CODE 0x07
Ritor1
parents:
diff changeset
119 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
Ritor1
parents:
diff changeset
120 # include <unix.h> /* for fdopen */
Ritor1
parents:
diff changeset
121 # else
Ritor1
parents:
diff changeset
122 # ifndef fdopen
Ritor1
parents:
diff changeset
123 # define fdopen(fd,mode) NULL /* No fdopen() */
Ritor1
parents:
diff changeset
124 # endif
Ritor1
parents:
diff changeset
125 # endif
Ritor1
parents:
diff changeset
126 #endif
Ritor1
parents:
diff changeset
127
Ritor1
parents:
diff changeset
128 #ifdef __50SERIES /* Prime/PRIMOS */
Ritor1
parents:
diff changeset
129 # define OS_CODE 0x0F
Ritor1
parents:
diff changeset
130 #endif
Ritor1
parents:
diff changeset
131
Ritor1
parents:
diff changeset
132 #ifdef TOPS20
Ritor1
parents:
diff changeset
133 # define OS_CODE 0x0a
Ritor1
parents:
diff changeset
134 #endif
Ritor1
parents:
diff changeset
135
Ritor1
parents:
diff changeset
136 #if defined(_BEOS_) || defined(RISCOS)
Ritor1
parents:
diff changeset
137 # define fdopen(fd,mode) NULL /* No fdopen() */
Ritor1
parents:
diff changeset
138 #endif
Ritor1
parents:
diff changeset
139
Ritor1
parents:
diff changeset
140 #if (defined(_MSC_VER) && (_MSC_VER > 600))
Ritor1
parents:
diff changeset
141 # define fdopen(fd,type) _fdopen(fd,type)
Ritor1
parents:
diff changeset
142 #endif
Ritor1
parents:
diff changeset
143
Ritor1
parents:
diff changeset
144
Ritor1
parents:
diff changeset
145 /* Common defaults */
Ritor1
parents:
diff changeset
146
Ritor1
parents:
diff changeset
147 #ifndef OS_CODE
Ritor1
parents:
diff changeset
148 # define OS_CODE 0x03 /* assume Unix */
Ritor1
parents:
diff changeset
149 #endif
Ritor1
parents:
diff changeset
150
Ritor1
parents:
diff changeset
151 #ifndef F_OPEN
Ritor1
parents:
diff changeset
152 # define F_OPEN(name, mode) fopen((name), (mode))
Ritor1
parents:
diff changeset
153 #endif
Ritor1
parents:
diff changeset
154
Ritor1
parents:
diff changeset
155 /* functions */
Ritor1
parents:
diff changeset
156
Ritor1
parents:
diff changeset
157 #ifdef HAVE_STRERROR
Ritor1
parents:
diff changeset
158 extern char *strerror OF((int));
Ritor1
parents:
diff changeset
159 # define zstrerror(errnum) strerror(errnum)
Ritor1
parents:
diff changeset
160 #else
Ritor1
parents:
diff changeset
161 # define zstrerror(errnum) ""
Ritor1
parents:
diff changeset
162 #endif
Ritor1
parents:
diff changeset
163
Ritor1
parents:
diff changeset
164 #if defined(pyr)
Ritor1
parents:
diff changeset
165 # define NO_MEMCPY
Ritor1
parents:
diff changeset
166 #endif
Ritor1
parents:
diff changeset
167 #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
Ritor1
parents:
diff changeset
168 /* Use our own functions for small and medium model with MSC <= 5.0.
Ritor1
parents:
diff changeset
169 * You may have to use the same strategy for Borland C (untested).
Ritor1
parents:
diff changeset
170 * The __SC__ check is for Symantec.
Ritor1
parents:
diff changeset
171 */
Ritor1
parents:
diff changeset
172 # define NO_MEMCPY
Ritor1
parents:
diff changeset
173 #endif
Ritor1
parents:
diff changeset
174 #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
Ritor1
parents:
diff changeset
175 # define HAVE_MEMCPY
Ritor1
parents:
diff changeset
176 #endif
Ritor1
parents:
diff changeset
177 #ifdef HAVE_MEMCPY
Ritor1
parents:
diff changeset
178 # ifdef SMALL_MEDIUM /* MSDOS small or medium model */
Ritor1
parents:
diff changeset
179 # define zmemcpy _fmemcpy
Ritor1
parents:
diff changeset
180 # define zmemcmp _fmemcmp
Ritor1
parents:
diff changeset
181 # define zmemzero(dest, len) _fmemset(dest, 0, len)
Ritor1
parents:
diff changeset
182 # else
Ritor1
parents:
diff changeset
183 # define zmemcpy memcpy
Ritor1
parents:
diff changeset
184 # define zmemcmp memcmp
Ritor1
parents:
diff changeset
185 # define zmemzero(dest, len) memset(dest, 0, len)
Ritor1
parents:
diff changeset
186 # endif
Ritor1
parents:
diff changeset
187 #else
Ritor1
parents:
diff changeset
188 extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
Ritor1
parents:
diff changeset
189 extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
Ritor1
parents:
diff changeset
190 extern void zmemzero OF((Bytef* dest, uInt len));
Ritor1
parents:
diff changeset
191 #endif
Ritor1
parents:
diff changeset
192
Ritor1
parents:
diff changeset
193 /* Diagnostic functions */
Ritor1
parents:
diff changeset
194 #ifdef DEBUG
Ritor1
parents:
diff changeset
195 # include <stdio.h>
Ritor1
parents:
diff changeset
196 extern int z_verbose;
Ritor1
parents:
diff changeset
197 extern void z_error OF((char *m));
Ritor1
parents:
diff changeset
198 # define Assert(cond,msg) {if(!(cond)) z_error(msg);}
Ritor1
parents:
diff changeset
199 # define Trace(x) {if (z_verbose>=0) fprintf x ;}
Ritor1
parents:
diff changeset
200 # define Tracev(x) {if (z_verbose>0) fprintf x ;}
Ritor1
parents:
diff changeset
201 # define Tracevv(x) {if (z_verbose>1) fprintf x ;}
Ritor1
parents:
diff changeset
202 # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
Ritor1
parents:
diff changeset
203 # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
Ritor1
parents:
diff changeset
204 #else
Ritor1
parents:
diff changeset
205 # define Assert(cond,msg)
Ritor1
parents:
diff changeset
206 # define Trace(x)
Ritor1
parents:
diff changeset
207 # define Tracev(x)
Ritor1
parents:
diff changeset
208 # define Tracevv(x)
Ritor1
parents:
diff changeset
209 # define Tracec(c,x)
Ritor1
parents:
diff changeset
210 # define Tracecv(c,x)
Ritor1
parents:
diff changeset
211 #endif
Ritor1
parents:
diff changeset
212
Ritor1
parents:
diff changeset
213
Ritor1
parents:
diff changeset
214 typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
Ritor1
parents:
diff changeset
215 uInt len));
Ritor1
parents:
diff changeset
216 voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
Ritor1
parents:
diff changeset
217 void zcfree OF((voidpf opaque, voidpf ptr));
Ritor1
parents:
diff changeset
218
Ritor1
parents:
diff changeset
219 #define ZALLOC(strm, items, size) \
Ritor1
parents:
diff changeset
220 (*((strm)->zalloc))((strm)->opaque, (items), (size))
Ritor1
parents:
diff changeset
221 #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
Ritor1
parents:
diff changeset
222 #define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
Ritor1
parents:
diff changeset
223
Ritor1
parents:
diff changeset
224 #endif /* _Z_UTIL_H */