7889
|
1 |
|
|
2 |
/* pngconf.h - machine configurable file for libpng
|
|
3 |
*
|
|
4 |
* libpng version 1.5.13 - September 27, 2012
|
|
5 |
*
|
|
6 |
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
|
7 |
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
8 |
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
|
9 |
*
|
|
10 |
* This code is released under the libpng license.
|
|
11 |
* For conditions of distribution and use, see the disclaimer
|
|
12 |
* and license in png.h
|
|
13 |
*
|
|
14 |
*/
|
|
15 |
|
|
16 |
/* Any machine specific code is near the front of this file, so if you
|
|
17 |
* are configuring libpng for a machine, you may want to read the section
|
|
18 |
* starting here down to where it starts to typedef png_color, png_text,
|
|
19 |
* and png_info.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef PNGCONF_H
|
|
23 |
#define PNGCONF_H
|
|
24 |
|
|
25 |
#ifndef PNG_BUILDING_SYMBOL_TABLE
|
|
26 |
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
|
|
27 |
* definition file for machine specific limits, this may impact the
|
|
28 |
* correctness of the definitions below (see uses of INT_MAX).
|
|
29 |
*/
|
|
30 |
# ifndef PNG_NO_LIMITS_H
|
|
31 |
# include <limits.h>
|
|
32 |
# endif
|
|
33 |
|
|
34 |
/* For the memory copy APIs (i.e. the standard definitions of these),
|
|
35 |
* because this file defines png_memcpy and so on the base APIs must
|
|
36 |
* be defined here.
|
|
37 |
*/
|
|
38 |
# ifdef BSD
|
|
39 |
# include <strings.h>
|
|
40 |
# else
|
|
41 |
# include <string.h>
|
|
42 |
# endif
|
|
43 |
|
|
44 |
/* For png_FILE_p - this provides the standard definition of a
|
|
45 |
* FILE
|
|
46 |
*/
|
|
47 |
# ifdef PNG_STDIO_SUPPORTED
|
|
48 |
# include <stdio.h>
|
|
49 |
# endif
|
|
50 |
#endif
|
|
51 |
|
|
52 |
/* This controls optimization of the reading of 16 and 32 bit values
|
|
53 |
* from PNG files. It can be set on a per-app-file basis - it
|
|
54 |
* just changes whether a macro is used when the function is called.
|
|
55 |
* The library builder sets the default; if read functions are not
|
|
56 |
* built into the library the macro implementation is forced on.
|
|
57 |
*/
|
|
58 |
#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
|
59 |
# define PNG_USE_READ_MACROS
|
|
60 |
#endif
|
|
61 |
#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
|
|
62 |
# if PNG_DEFAULT_READ_MACROS
|
|
63 |
# define PNG_USE_READ_MACROS
|
|
64 |
# endif
|
|
65 |
#endif
|
|
66 |
|
|
67 |
/* COMPILER SPECIFIC OPTIONS.
|
|
68 |
*
|
|
69 |
* These options are provided so that a variety of difficult compilers
|
|
70 |
* can be used. Some are fixed at build time (e.g. PNG_API_RULE
|
|
71 |
* below) but still have compiler specific implementations, others
|
|
72 |
* may be changed on a per-file basis when compiling against libpng.
|
|
73 |
*/
|
|
74 |
|
|
75 |
/* The PNGARG macro protects us against machines that don't have function
|
|
76 |
* prototypes (ie K&R style headers). If your compiler does not handle
|
|
77 |
* function prototypes, define this macro and use the included ansi2knr.
|
|
78 |
* I've always been able to use _NO_PROTO as the indicator, but you may
|
|
79 |
* need to drag the empty declaration out in front of here, or change the
|
|
80 |
* ifdef to suit your own needs.
|
|
81 |
*/
|
|
82 |
#ifndef PNGARG
|
|
83 |
|
|
84 |
# ifdef OF /* zlib prototype munger */
|
|
85 |
# define PNGARG(arglist) OF(arglist)
|
|
86 |
# else
|
|
87 |
|
|
88 |
# ifdef _NO_PROTO
|
|
89 |
# define PNGARG(arglist) ()
|
|
90 |
# else
|
|
91 |
# define PNGARG(arglist) arglist
|
|
92 |
# endif /* _NO_PROTO */
|
|
93 |
|
|
94 |
# endif /* OF */
|
|
95 |
|
|
96 |
#endif /* PNGARG */
|
|
97 |
|
|
98 |
/* Function calling conventions.
|
|
99 |
* =============================
|
|
100 |
* Normally it is not necessary to specify to the compiler how to call
|
|
101 |
* a function - it just does it - however on x86 systems derived from
|
|
102 |
* Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
|
|
103 |
* and some others) there are multiple ways to call a function and the
|
|
104 |
* default can be changed on the compiler command line. For this reason
|
|
105 |
* libpng specifies the calling convention of every exported function and
|
|
106 |
* every function called via a user supplied function pointer. This is
|
|
107 |
* done in this file by defining the following macros:
|
|
108 |
*
|
|
109 |
* PNGAPI Calling convention for exported functions.
|
|
110 |
* PNGCBAPI Calling convention for user provided (callback) functions.
|
|
111 |
* PNGCAPI Calling convention used by the ANSI-C library (required
|
|
112 |
* for longjmp callbacks and sometimes used internally to
|
|
113 |
* specify the calling convention for zlib).
|
|
114 |
*
|
|
115 |
* These macros should never be overridden. If it is necessary to
|
|
116 |
* change calling convention in a private build this can be done
|
|
117 |
* by setting PNG_API_RULE (which defaults to 0) to one of the values
|
|
118 |
* below to select the correct 'API' variants.
|
|
119 |
*
|
|
120 |
* PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
|
|
121 |
* This is correct in every known environment.
|
|
122 |
* PNG_API_RULE=1 Use the operating system convention for PNGAPI and
|
|
123 |
* the 'C' calling convention (from PNGCAPI) for
|
|
124 |
* callbacks (PNGCBAPI). This is no longer required
|
|
125 |
* in any known environment - if it has to be used
|
|
126 |
* please post an explanation of the problem to the
|
|
127 |
* libpng mailing list.
|
|
128 |
*
|
|
129 |
* These cases only differ if the operating system does not use the C
|
|
130 |
* calling convention, at present this just means the above cases
|
|
131 |
* (x86 DOS/Windows sytems) and, even then, this does not apply to
|
|
132 |
* Cygwin running on those systems.
|
|
133 |
*
|
|
134 |
* Note that the value must be defined in pnglibconf.h so that what
|
|
135 |
* the application uses to call the library matches the conventions
|
|
136 |
* set when building the library.
|
|
137 |
*/
|
|
138 |
|
|
139 |
/* Symbol export
|
|
140 |
* =============
|
|
141 |
* When building a shared library it is almost always necessary to tell
|
|
142 |
* the compiler which symbols to export. The png.h macro 'PNG_EXPORT'
|
|
143 |
* is used to mark the symbols. On some systems these symbols can be
|
|
144 |
* extracted at link time and need no special processing by the compiler,
|
|
145 |
* on other systems the symbols are flagged by the compiler and just
|
|
146 |
* the declaration requires a special tag applied (unfortunately) in a
|
|
147 |
* compiler dependent way. Some systems can do either.
|
|
148 |
*
|
|
149 |
* A small number of older systems also require a symbol from a DLL to
|
|
150 |
* be flagged to the program that calls it. This is a problem because
|
|
151 |
* we do not know in the header file included by application code that
|
|
152 |
* the symbol will come from a shared library, as opposed to a statically
|
|
153 |
* linked one. For this reason the application must tell us by setting
|
|
154 |
* the magic flag PNG_USE_DLL to turn on the special processing before
|
|
155 |
* it includes png.h.
|
|
156 |
*
|
|
157 |
* Four additional macros are used to make this happen:
|
|
158 |
*
|
|
159 |
* PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
|
|
160 |
* the build or imported if PNG_USE_DLL is set - compiler
|
|
161 |
* and system specific.
|
|
162 |
*
|
|
163 |
* PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
|
|
164 |
* 'type', compiler specific.
|
|
165 |
*
|
|
166 |
* PNG_DLL_EXPORT Set to the magic to use during a libpng build to
|
|
167 |
* make a symbol exported from the DLL. Not used in the
|
|
168 |
* public header files; see pngpriv.h for how it is used
|
|
169 |
* in the libpng build.
|
|
170 |
*
|
|
171 |
* PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
|
|
172 |
* from a DLL - used to define PNG_IMPEXP when
|
|
173 |
* PNG_USE_DLL is set.
|
|
174 |
*/
|
|
175 |
|
|
176 |
/* System specific discovery.
|
|
177 |
* ==========================
|
|
178 |
* This code is used at build time to find PNG_IMPEXP, the API settings
|
|
179 |
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
|
|
180 |
* import processing is possible. On Windows/x86 systems it also sets
|
|
181 |
* compiler-specific macros to the values required to change the calling
|
|
182 |
* conventions of the various functions.
|
|
183 |
*/
|
|
184 |
#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
|
185 |
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
|
|
186 |
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
|
|
187 |
defined(_M_X64) || defined(_M_IA64) )
|
|
188 |
/* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
|
|
189 |
* builds under Cygwin or MinGW. Also includes Watcom builds but these need
|
|
190 |
* special treatment because they are not compatible with GCC or Visual C
|
|
191 |
* because of different calling conventions.
|
|
192 |
*/
|
|
193 |
# if PNG_API_RULE == 2
|
|
194 |
/* If this line results in an error, either because __watcall is not
|
|
195 |
* understood or because of a redefine just below you cannot use *this*
|
|
196 |
* build of the library with the compiler you are using. *This* build was
|
|
197 |
* build using Watcom and applications must also be built using Watcom!
|
|
198 |
*/
|
|
199 |
# define PNGCAPI __watcall
|
|
200 |
# endif
|
|
201 |
|
|
202 |
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
|
|
203 |
# define PNGCAPI __cdecl
|
|
204 |
# if PNG_API_RULE == 1
|
|
205 |
# define PNGAPI __stdcall
|
|
206 |
# endif
|
|
207 |
# else
|
|
208 |
/* An older compiler, or one not detected (erroneously) above,
|
|
209 |
* if necessary override on the command line to get the correct
|
|
210 |
* variants for the compiler.
|
|
211 |
*/
|
|
212 |
# ifndef PNGCAPI
|
|
213 |
# define PNGCAPI _cdecl
|
|
214 |
# endif
|
|
215 |
# if PNG_API_RULE == 1 && !defined(PNGAPI)
|
|
216 |
# define PNGAPI _stdcall
|
|
217 |
# endif
|
|
218 |
# endif /* compiler/api */
|
|
219 |
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
|
220 |
|
|
221 |
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
|
222 |
ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
|
|
223 |
# endif
|
|
224 |
|
|
225 |
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
|
|
226 |
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
|
|
227 |
/* older Borland and MSC
|
|
228 |
* compilers used '__export' and required this to be after
|
|
229 |
* the type.
|
|
230 |
*/
|
|
231 |
# ifndef PNG_EXPORT_TYPE
|
|
232 |
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
|
|
233 |
# endif
|
|
234 |
# define PNG_DLL_EXPORT __export
|
|
235 |
# else /* newer compiler */
|
|
236 |
# define PNG_DLL_EXPORT __declspec(dllexport)
|
|
237 |
# ifndef PNG_DLL_IMPORT
|
|
238 |
# define PNG_DLL_IMPORT __declspec(dllimport)
|
|
239 |
# endif
|
|
240 |
# endif /* compiler */
|
|
241 |
|
|
242 |
#else /* !Windows/x86 */
|
|
243 |
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
|
244 |
# define PNGAPI _System
|
|
245 |
# else /* !Windows/x86 && !OS/2 */
|
|
246 |
/* Use the defaults, or define PNG*API on the command line (but
|
|
247 |
* this will have to be done for every compile!)
|
|
248 |
*/
|
|
249 |
# endif /* other system, !OS/2 */
|
|
250 |
#endif /* !Windows/x86 */
|
|
251 |
|
|
252 |
/* Now do all the defaulting . */
|
|
253 |
#ifndef PNGCAPI
|
|
254 |
# define PNGCAPI
|
|
255 |
#endif
|
|
256 |
#ifndef PNGCBAPI
|
|
257 |
# define PNGCBAPI PNGCAPI
|
|
258 |
#endif
|
|
259 |
#ifndef PNGAPI
|
|
260 |
# define PNGAPI PNGCAPI
|
|
261 |
#endif
|
|
262 |
|
|
263 |
/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
|
|
264 |
* then in an internal header file when building the library, otherwise (when
|
|
265 |
* using the library) it is set here.
|
|
266 |
*/
|
|
267 |
#ifndef PNG_IMPEXP
|
|
268 |
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
|
|
269 |
/* This forces use of a DLL, disallowing static linking */
|
|
270 |
# define PNG_IMPEXP PNG_DLL_IMPORT
|
|
271 |
# endif
|
|
272 |
|
|
273 |
# ifndef PNG_IMPEXP
|
|
274 |
# define PNG_IMPEXP
|
|
275 |
# endif
|
|
276 |
#endif
|
|
277 |
|
|
278 |
/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
|
|
279 |
* 'attributes' as a storage class - the attributes go at the start of the
|
|
280 |
* function definition, and attributes are always appended regardless of the
|
|
281 |
* compiler. This considerably simplifies these macros but may cause problems
|
|
282 |
* if any compilers both need function attributes and fail to handle them as
|
|
283 |
* a storage class (this is unlikely.)
|
|
284 |
*/
|
|
285 |
#ifndef PNG_FUNCTION
|
|
286 |
# define PNG_FUNCTION(type, name, args, attributes) attributes type name args
|
|
287 |
#endif
|
|
288 |
|
|
289 |
#ifndef PNG_EXPORT_TYPE
|
|
290 |
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
|
|
291 |
#endif
|
|
292 |
|
|
293 |
/* The ordinal value is only relevant when preprocessing png.h for symbol
|
|
294 |
* table entries, so we discard it here. See the .dfn files in the
|
|
295 |
* scripts directory.
|
|
296 |
*/
|
|
297 |
#ifndef PNG_EXPORTA
|
|
298 |
|
|
299 |
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
|
300 |
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
|
|
301 |
extern attributes)
|
|
302 |
#endif
|
|
303 |
|
|
304 |
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
|
|
305 |
* so make something non-empty to satisfy the requirement:
|
|
306 |
*/
|
|
307 |
#define PNG_EMPTY /*empty list*/
|
|
308 |
|
|
309 |
#define PNG_EXPORT(ordinal, type, name, args)\
|
|
310 |
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
|
|
311 |
|
|
312 |
/* Use PNG_REMOVED to comment out a removed interface. */
|
|
313 |
#ifndef PNG_REMOVED
|
|
314 |
# define PNG_REMOVED(ordinal, type, name, args, attributes)
|
|
315 |
#endif
|
|
316 |
|
|
317 |
#ifndef PNG_CALLBACK
|
|
318 |
# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
|
|
319 |
#endif
|
|
320 |
|
|
321 |
/* Support for compiler specific function attributes. These are used
|
|
322 |
* so that where compiler support is available incorrect use of API
|
|
323 |
* functions in png.h will generate compiler warnings.
|
|
324 |
*
|
|
325 |
* Added at libpng-1.2.41.
|
|
326 |
*/
|
|
327 |
|
|
328 |
#ifndef PNG_NO_PEDANTIC_WARNINGS
|
|
329 |
# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
|
|
330 |
# define PNG_PEDANTIC_WARNINGS_SUPPORTED
|
|
331 |
# endif
|
|
332 |
#endif
|
|
333 |
|
|
334 |
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
|
|
335 |
/* Support for compiler specific function attributes. These are used
|
|
336 |
* so that where compiler support is available incorrect use of API
|
|
337 |
* functions in png.h will generate compiler warnings. Added at libpng
|
|
338 |
* version 1.2.41.
|
|
339 |
*/
|
|
340 |
# if defined(__GNUC__)
|
|
341 |
# ifndef PNG_USE_RESULT
|
|
342 |
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
|
343 |
# endif
|
|
344 |
# ifndef PNG_NORETURN
|
|
345 |
# define PNG_NORETURN __attribute__((__noreturn__))
|
|
346 |
# endif
|
|
347 |
# if __GNUC__ >= 3
|
|
348 |
# ifndef PNG_ALLOCATED
|
|
349 |
# define PNG_ALLOCATED __attribute__((__malloc__))
|
|
350 |
# endif
|
|
351 |
# ifndef PNG_DEPRECATED
|
|
352 |
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
|
353 |
# endif
|
|
354 |
# ifndef PNG_PRIVATE
|
|
355 |
# if 0 /* Doesn't work so we use deprecated instead*/
|
|
356 |
# define PNG_PRIVATE \
|
|
357 |
__attribute__((warning("This function is not exported by libpng.")))
|
|
358 |
# else
|
|
359 |
# define PNG_PRIVATE \
|
|
360 |
__attribute__((__deprecated__))
|
|
361 |
# endif
|
|
362 |
# endif
|
|
363 |
# endif /* __GNUC__ >= 3 */
|
|
364 |
# endif /* __GNUC__ */
|
|
365 |
|
|
366 |
# if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
|
367 |
# ifndef PNG_USE_RESULT
|
|
368 |
# define PNG_USE_RESULT /* not supported */
|
|
369 |
# endif
|
|
370 |
# ifndef PNG_NORETURN
|
|
371 |
# define PNG_NORETURN __declspec(noreturn)
|
|
372 |
# endif
|
|
373 |
# ifndef PNG_ALLOCATED
|
|
374 |
# if (_MSC_VER >= 1400)
|
|
375 |
# define PNG_ALLOCATED __declspec(restrict)
|
|
376 |
# endif
|
|
377 |
# endif
|
|
378 |
# ifndef PNG_DEPRECATED
|
|
379 |
# define PNG_DEPRECATED __declspec(deprecated)
|
|
380 |
# endif
|
|
381 |
# ifndef PNG_PRIVATE
|
|
382 |
# define PNG_PRIVATE __declspec(deprecated)
|
|
383 |
# endif
|
|
384 |
# endif /* _MSC_VER */
|
|
385 |
#endif /* PNG_PEDANTIC_WARNINGS */
|
|
386 |
|
|
387 |
#ifndef PNG_DEPRECATED
|
|
388 |
# define PNG_DEPRECATED /* Use of this function is deprecated */
|
|
389 |
#endif
|
|
390 |
#ifndef PNG_USE_RESULT
|
|
391 |
# define PNG_USE_RESULT /* The result of this function must be checked */
|
|
392 |
#endif
|
|
393 |
#ifndef PNG_NORETURN
|
|
394 |
# define PNG_NORETURN /* This function does not return */
|
|
395 |
#endif
|
|
396 |
#ifndef PNG_ALLOCATED
|
|
397 |
# define PNG_ALLOCATED /* The result of the function is new memory */
|
|
398 |
#endif
|
|
399 |
#ifndef PNG_PRIVATE
|
|
400 |
# define PNG_PRIVATE /* This is a private libpng function */
|
|
401 |
#endif
|
|
402 |
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
|
403 |
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
404 |
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
|
405 |
PNG_EXPORT(ordinal, type, name, args);
|
|
406 |
# else /* No floating point APIs */
|
|
407 |
# define PNG_FP_EXPORT(ordinal, type, name, args)
|
|
408 |
# endif
|
|
409 |
#endif
|
|
410 |
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
|
|
411 |
# ifdef PNG_FIXED_POINT_SUPPORTED
|
|
412 |
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
|
|
413 |
PNG_EXPORT(ordinal, type, name, args);
|
|
414 |
# else /* No fixed point APIs */
|
|
415 |
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
|
|
416 |
# endif
|
|
417 |
#endif
|
|
418 |
|
|
419 |
/* The following uses const char * instead of char * for error
|
|
420 |
* and warning message functions, so some compilers won't complain.
|
|
421 |
* If you do not want to use const, define PNG_NO_CONST here.
|
|
422 |
*
|
|
423 |
* This should not change how the APIs are called, so it can be done
|
|
424 |
* on a per-file basis in the application.
|
|
425 |
*/
|
|
426 |
#ifndef PNG_CONST
|
|
427 |
# ifndef PNG_NO_CONST
|
|
428 |
# define PNG_CONST const
|
|
429 |
# else
|
|
430 |
# define PNG_CONST
|
|
431 |
# endif
|
|
432 |
#endif
|
|
433 |
|
|
434 |
/* Some typedefs to get us started. These should be safe on most of the
|
|
435 |
* common platforms. The typedefs should be at least as large as the
|
|
436 |
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
|
|
437 |
* don't have to be exactly that size. Some compilers dislike passing
|
|
438 |
* unsigned shorts as function parameters, so you may be better off using
|
|
439 |
* unsigned int for png_uint_16.
|
|
440 |
*/
|
|
441 |
|
|
442 |
#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
|
|
443 |
typedef unsigned int png_uint_32;
|
|
444 |
typedef int png_int_32;
|
|
445 |
#else
|
|
446 |
typedef unsigned long png_uint_32;
|
|
447 |
typedef long png_int_32;
|
|
448 |
#endif
|
|
449 |
typedef unsigned short png_uint_16;
|
|
450 |
typedef short png_int_16;
|
|
451 |
typedef unsigned char png_byte;
|
|
452 |
|
|
453 |
#ifdef PNG_NO_SIZE_T
|
|
454 |
typedef unsigned int png_size_t;
|
|
455 |
#else
|
|
456 |
typedef size_t png_size_t;
|
|
457 |
#endif
|
|
458 |
#define png_sizeof(x) (sizeof (x))
|
|
459 |
|
|
460 |
/* The following is needed for medium model support. It cannot be in the
|
|
461 |
* pngpriv.h header. Needs modification for other compilers besides
|
|
462 |
* MSC. Model independent support declares all arrays and pointers to be
|
|
463 |
* large using the far keyword. The zlib version used must also support
|
|
464 |
* model independent data. As of version zlib 1.0.4, the necessary changes
|
|
465 |
* have been made in zlib. The USE_FAR_KEYWORD define triggers other
|
|
466 |
* changes that are needed. (Tim Wegner)
|
|
467 |
*/
|
|
468 |
|
|
469 |
/* Separate compiler dependencies (problem here is that zlib.h always
|
|
470 |
* defines FAR. (SJT)
|
|
471 |
*/
|
|
472 |
#ifdef __BORLANDC__
|
|
473 |
# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
|
|
474 |
# define LDATA 1
|
|
475 |
# else
|
|
476 |
# define LDATA 0
|
|
477 |
# endif
|
|
478 |
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
|
|
479 |
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
|
|
480 |
# define PNG_MAX_MALLOC_64K /* only used in build */
|
|
481 |
# if (LDATA != 1)
|
|
482 |
# ifndef FAR
|
|
483 |
# define FAR __far
|
|
484 |
# endif
|
|
485 |
# define USE_FAR_KEYWORD
|
|
486 |
# endif /* LDATA != 1 */
|
|
487 |
/* Possibly useful for moving data out of default segment.
|
|
488 |
* Uncomment it if you want. Could also define FARDATA as
|
|
489 |
* const if your compiler supports it. (SJT)
|
|
490 |
# define FARDATA FAR
|
|
491 |
*/
|
|
492 |
# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
|
|
493 |
#endif /* __BORLANDC__ */
|
|
494 |
|
|
495 |
|
|
496 |
/* Suggest testing for specific compiler first before testing for
|
|
497 |
* FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
|
|
498 |
* making reliance oncertain keywords suspect. (SJT)
|
|
499 |
*/
|
|
500 |
|
|
501 |
/* MSC Medium model */
|
|
502 |
#ifdef FAR
|
|
503 |
# ifdef M_I86MM
|
|
504 |
# define USE_FAR_KEYWORD
|
|
505 |
# define FARDATA FAR
|
|
506 |
# include <dos.h>
|
|
507 |
# endif
|
|
508 |
#endif
|
|
509 |
|
|
510 |
/* SJT: default case */
|
|
511 |
#ifndef FAR
|
|
512 |
# define FAR
|
|
513 |
#endif
|
|
514 |
|
|
515 |
/* At this point FAR is always defined */
|
|
516 |
#ifndef FARDATA
|
|
517 |
# define FARDATA
|
|
518 |
#endif
|
|
519 |
|
|
520 |
/* Typedef for floating-point numbers that are converted
|
|
521 |
* to fixed-point with a multiple of 100,000, e.g., gamma
|
|
522 |
*/
|
|
523 |
typedef png_int_32 png_fixed_point;
|
|
524 |
|
|
525 |
/* Add typedefs for pointers */
|
|
526 |
typedef void FAR * png_voidp;
|
|
527 |
typedef PNG_CONST void FAR * png_const_voidp;
|
|
528 |
typedef png_byte FAR * png_bytep;
|
|
529 |
typedef PNG_CONST png_byte FAR * png_const_bytep;
|
|
530 |
typedef png_uint_32 FAR * png_uint_32p;
|
|
531 |
typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
|
|
532 |
typedef png_int_32 FAR * png_int_32p;
|
|
533 |
typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
|
|
534 |
typedef png_uint_16 FAR * png_uint_16p;
|
|
535 |
typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
|
|
536 |
typedef png_int_16 FAR * png_int_16p;
|
|
537 |
typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
|
|
538 |
typedef char FAR * png_charp;
|
|
539 |
typedef PNG_CONST char FAR * png_const_charp;
|
|
540 |
typedef png_fixed_point FAR * png_fixed_point_p;
|
|
541 |
typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
|
|
542 |
typedef png_size_t FAR * png_size_tp;
|
|
543 |
typedef PNG_CONST png_size_t FAR * png_const_size_tp;
|
|
544 |
|
|
545 |
#ifdef PNG_STDIO_SUPPORTED
|
|
546 |
typedef FILE * png_FILE_p;
|
|
547 |
#endif
|
|
548 |
|
|
549 |
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
550 |
typedef double FAR * png_doublep;
|
|
551 |
typedef PNG_CONST double FAR * png_const_doublep;
|
|
552 |
#endif
|
|
553 |
|
|
554 |
/* Pointers to pointers; i.e. arrays */
|
|
555 |
typedef png_byte FAR * FAR * png_bytepp;
|
|
556 |
typedef png_uint_32 FAR * FAR * png_uint_32pp;
|
|
557 |
typedef png_int_32 FAR * FAR * png_int_32pp;
|
|
558 |
typedef png_uint_16 FAR * FAR * png_uint_16pp;
|
|
559 |
typedef png_int_16 FAR * FAR * png_int_16pp;
|
|
560 |
typedef PNG_CONST char FAR * FAR * png_const_charpp;
|
|
561 |
typedef char FAR * FAR * png_charpp;
|
|
562 |
typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
|
|
563 |
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
564 |
typedef double FAR * FAR * png_doublepp;
|
|
565 |
#endif
|
|
566 |
|
|
567 |
/* Pointers to pointers to pointers; i.e., pointer to array */
|
|
568 |
typedef char FAR * FAR * FAR * png_charppp;
|
|
569 |
|
|
570 |
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
|
|
571 |
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
|
|
572 |
* to png_alloc_size_t are not necessary; in fact, it is recommended
|
|
573 |
* not to use them at all so that the compiler can complain when something
|
|
574 |
* turns out to be problematic.
|
|
575 |
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
|
576 |
* png_uint_32) should be explicitly applied; however, we do not expect
|
|
577 |
* to encounter practical situations that require such conversions.
|
|
578 |
*/
|
|
579 |
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
580 |
typedef unsigned long png_alloc_size_t;
|
|
581 |
#else
|
|
582 |
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
583 |
typedef unsigned long png_alloc_size_t;
|
|
584 |
# else
|
|
585 |
/* This is an attempt to detect an old Windows system where (int) is
|
|
586 |
* actually 16 bits, in that case png_malloc must have an argument with a
|
|
587 |
* bigger size to accomodate the requirements of the library.
|
|
588 |
*/
|
|
589 |
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
|
|
590 |
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
|
|
591 |
typedef DWORD png_alloc_size_t;
|
|
592 |
# else
|
|
593 |
typedef png_size_t png_alloc_size_t;
|
|
594 |
# endif
|
|
595 |
# endif
|
|
596 |
#endif
|
|
597 |
|
|
598 |
#endif /* PNGCONF_H */
|