media/libpng/pngconf.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial