1 2 /* pngconf.h - machine configurable file for libpng 3 * 4 * libpng version 1.4.4 - September 23, 2010 5 * For conditions of distribution and use, see copyright notice in png.h 6 * Copyright (c) 1998-2010 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_NO_LIMITS_H 26 # include <limits.h> 27 #endif 28 29 /* Added at libpng-1.2.9 */ 30 31 /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" 32 * script. 33 */ 34 #ifdef PNG_CONFIGURE_LIBPNG 35 # ifdef HAVE_CONFIG_H 36 # include "config.h" 37 # endif 38 #endif 39 40 /* 41 * Added at libpng-1.2.8 42 * 43 * PNG_USER_CONFIG has to be defined on the compiler command line. This 44 * includes the resource compiler for Windows DLL configurations. 45 */ 46 #ifdef PNG_USER_CONFIG 47 # include "pngusr.h" 48 # ifndef PNG_USER_PRIVATEBUILD 49 # define PNG_USER_PRIVATEBUILD 50 # endif 51 #endif 52 53 /* 54 * If you create a private DLL you should define in "pngusr.h" the following: 55 * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of 56 * the DLL was built> 57 * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." 58 * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to 59 * distinguish your DLL from those of the official release. These 60 * correspond to the trailing letters that come after the version 61 * number and must match your private DLL name> 62 * e.g. // private DLL "libpng14gx.dll" 63 * #define PNG_USER_DLLFNAME_POSTFIX "gx" 64 * 65 * The following macros are also at your disposal if you want to complete the 66 * DLL VERSIONINFO structure. 67 * - PNG_USER_VERSIONINFO_COMMENTS 68 * - PNG_USER_VERSIONINFO_COMPANYNAME 69 * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS 70 */ 71 72 #ifdef __STDC__ 73 # ifdef SPECIALBUILD 74 # pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ 75 are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") 76 # endif 77 78 # ifdef PRIVATEBUILD 79 # pragma message("PRIVATEBUILD is deprecated.\ 80 Use PNG_USER_PRIVATEBUILD instead.") 81 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD 82 # endif 83 #endif /* __STDC__ */ 84 85 /* End of material added to libpng-1.2.8 */ 86 87 #ifndef PNG_VERSION_INFO_ONLY 88 89 /* This is the size of the compression buffer, and thus the size of 90 * an IDAT chunk. Make this whatever size you feel is best for your 91 * machine. One of these will be allocated per png_struct. When this 92 * is full, it writes the data to the disk, and does some other 93 * calculations. Making this an extremely small size will slow 94 * the library down, but you may want to experiment to determine 95 * where it becomes significant, if you are concerned with memory 96 * usage. Note that zlib allocates at least 32Kb also. For readers, 97 * this describes the size of the buffer available to read the data in. 98 * Unless this gets smaller than the size of a row (compressed), 99 * it should not make much difference how big this is. 100 */ 101 102 #ifndef PNG_ZBUF_SIZE 103 # define PNG_ZBUF_SIZE 8192 104 #endif 105 106 /* Enable if you want a write-only libpng */ 107 108 #ifndef PNG_NO_READ_SUPPORTED 109 # define PNG_READ_SUPPORTED 110 #endif 111 112 /* Enable if you want a read-only libpng */ 113 114 #ifndef PNG_NO_WRITE_SUPPORTED 115 # define PNG_WRITE_SUPPORTED 116 #endif 117 118 /* Enabled in 1.4.0. */ 119 #ifdef PNG_ALLOW_BENIGN_ERRORS 120 # define png_benign_error png_warning 121 # define png_chunk_benign_error png_chunk_warning 122 #else 123 # ifndef PNG_BENIGN_ERRORS_SUPPORTED 124 # define png_benign_error png_error 125 # define png_chunk_benign_error png_chunk_error 126 # endif 127 #endif 128 129 /* Added at libpng version 1.4.0 */ 130 #if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED) 131 # define PNG_WARNINGS_SUPPORTED 132 #endif 133 134 /* Added at libpng version 1.4.0 */ 135 #if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED) 136 # define PNG_ERROR_TEXT_SUPPORTED 137 #endif 138 139 /* Added at libpng version 1.4.0 */ 140 #if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED) 141 # define PNG_CHECK_cHRM_SUPPORTED 142 #endif 143 144 /* Added at libpng version 1.4.0 */ 145 #if !defined(PNG_NO_ALIGNED_MEMORY) && !defined(PNG_ALIGNED_MEMORY_SUPPORTED) 146 # define PNG_ALIGNED_MEMORY_SUPPORTED 147 #endif 148 149 /* Enabled by default in 1.2.0. You can disable this if you don't need to 150 support PNGs that are embedded in MNG datastreams */ 151 #ifndef PNG_NO_MNG_FEATURES 152 # ifndef PNG_MNG_FEATURES_SUPPORTED 153 # define PNG_MNG_FEATURES_SUPPORTED 154 # endif 155 #endif 156 157 /* Added at libpng version 1.4.0 */ 158 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED 159 # ifndef PNG_FLOATING_POINT_SUPPORTED 160 # define PNG_FLOATING_POINT_SUPPORTED 161 # endif 162 #endif 163 164 /* Added at libpng-1.4.0beta49 for testing (this test is no longer used 165 in libpng and png_calloc() is always present) 166 */ 167 #define PNG_CALLOC_SUPPORTED 168 169 /* If you are running on a machine where you cannot allocate more 170 * than 64K of memory at once, uncomment this. While libpng will not 171 * normally need that much memory in a chunk (unless you load up a very 172 * large file), zlib needs to know how big of a chunk it can use, and 173 * libpng thus makes sure to check any memory allocation to verify it 174 * will fit into memory. 175 #define PNG_MAX_MALLOC_64K 176 */ 177 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) 178 # define PNG_MAX_MALLOC_64K 179 #endif 180 181 /* Special munging to support doing things the 'cygwin' way: 182 * 'Normal' png-on-win32 defines/defaults: 183 * PNG_BUILD_DLL -- building dll 184 * PNG_USE_DLL -- building an application, linking to dll 185 * (no define) -- building static library, or building an 186 * application and linking to the static lib 187 * 'Cygwin' defines/defaults: 188 * PNG_BUILD_DLL -- (ignored) building the dll 189 * (no define) -- (ignored) building an application, linking to the dll 190 * PNG_STATIC -- (ignored) building the static lib, or building an 191 * application that links to the static lib. 192 * ALL_STATIC -- (ignored) building various static libs, or building an 193 * application that links to the static libs. 194 * Thus, 195 * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and 196 * this bit of #ifdefs will define the 'correct' config variables based on 197 * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but 198 * unnecessary. 199 * 200 * Also, the precedence order is: 201 * ALL_STATIC (since we can't #undef something outside our namespace) 202 * PNG_BUILD_DLL 203 * PNG_STATIC 204 * (nothing) == PNG_USE_DLL 205 * 206 * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent 207 * of auto-import in binutils, we no longer need to worry about 208 * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, 209 * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes 210 * to __declspec() stuff. However, we DO need to worry about 211 * PNG_BUILD_DLL and PNG_STATIC because those change some defaults 212 * such as CONSOLE_IO. 213 */ 214 #ifdef __CYGWIN__ 215 # ifdef ALL_STATIC 216 # ifdef PNG_BUILD_DLL 217 # undef PNG_BUILD_DLL 218 # endif 219 # ifdef PNG_USE_DLL 220 # undef PNG_USE_DLL 221 # endif 222 # ifdef PNG_DLL 223 # undef PNG_DLL 224 # endif 225 # ifndef PNG_STATIC 226 # define PNG_STATIC 227 # endif 228 # else 229 # ifdef PNG_BUILD_DLL 230 # ifdef PNG_STATIC 231 # undef PNG_STATIC 232 # endif 233 # ifdef PNG_USE_DLL 234 # undef PNG_USE_DLL 235 # endif 236 # ifndef PNG_DLL 237 # define PNG_DLL 238 # endif 239 # else 240 # ifdef PNG_STATIC 241 # ifdef PNG_USE_DLL 242 # undef PNG_USE_DLL 243 # endif 244 # ifdef PNG_DLL 245 # undef PNG_DLL 246 # endif 247 # else 248 # ifndef PNG_USE_DLL 249 # define PNG_USE_DLL 250 # endif 251 # ifndef PNG_DLL 252 # define PNG_DLL 253 # endif 254 # endif 255 # endif 256 # endif 257 #endif 258 259 /* This protects us against compilers that run on a windowing system 260 * and thus don't have or would rather us not use the stdio types: 261 * stdin, stdout, and stderr. The only one currently used is stderr 262 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will 263 * prevent these from being compiled and used. #defining PNG_NO_STDIO 264 * will also prevent these, plus will prevent the entire set of stdio 265 * macros and functions (FILE *, printf, etc.) from being compiled and used, 266 * unless (PNG_DEBUG > 0) has been #defined. 267 * 268 * #define PNG_NO_CONSOLE_IO 269 * #define PNG_NO_STDIO 270 */ 271 272 #ifdef _WIN32_WCE 273 # define PNG_NO_CONSOLE_IO 274 # define PNG_NO_STDIO 275 # define PNG_NO_TIME_RFC1123 276 # ifdef PNG_DEBUG 277 # undef PNG_DEBUG 278 # endif 279 #endif 280 281 #if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED) 282 # define PNG_STDIO_SUPPORTED 283 #endif 284 285 #ifdef PNG_BUILD_DLL 286 # if !defined(PNG_CONSOLE_IO_SUPPORTED) && !defined(PNG_NO_CONSOLE_IO) 287 # define PNG_NO_CONSOLE_IO 288 # endif 289 #endif 290 291 # ifdef PNG_NO_STDIO 292 # ifndef PNG_NO_CONSOLE_IO 293 # define PNG_NO_CONSOLE_IO 294 # endif 295 # ifdef PNG_DEBUG 296 # if (PNG_DEBUG > 0) 297 # include <stdio.h> 298 # endif 299 # endif 300 # else 301 # include <stdio.h> 302 # endif 303 304 #if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED) 305 # define PNG_CONSOLE_IO_SUPPORTED 306 #endif 307 308 /* This macro protects us against machines that don't have function 309 * prototypes (ie K&R style headers). If your compiler does not handle 310 * function prototypes, define this macro and use the included ansi2knr. 311 * I've always been able to use _NO_PROTO as the indicator, but you may 312 * need to drag the empty declaration out in front of here, or change the 313 * ifdef to suit your own needs. 314 */ 315 #ifndef PNGARG 316 317 #ifdef OF /* zlib prototype munger */ 318 # define PNGARG(arglist) OF(arglist) 319 #else 320 321 #ifdef _NO_PROTO 322 # define PNGARG(arglist) () 323 #else 324 # define PNGARG(arglist) arglist 325 #endif /* _NO_PROTO */ 326 327 #endif /* OF */ 328 329 #endif /* PNGARG */ 330 331 /* Try to determine if we are compiling on a Mac. Note that testing for 332 * just __MWERKS__ is not good enough, because the Codewarrior is now used 333 * on non-Mac platforms. 334 */ 335 #ifndef MACOS 336 # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ 337 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) 338 # define MACOS 339 # endif 340 #endif 341 342 /* Enough people need this for various reasons to include it here */ 343 #if !defined(MACOS) && !defined(RISCOS) 344 # include <sys/types.h> 345 #endif 346 347 /* PNG_SETJMP_NOT_SUPPORTED and PNG_NO_SETJMP_SUPPORTED are deprecated. */ 348 #if !defined(PNG_NO_SETJMP) && \ 349 !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) 350 # define PNG_SETJMP_SUPPORTED 351 #endif 352 353 #ifdef PNG_SETJMP_SUPPORTED 354 /* This is an attempt to force a single setjmp behaviour on Linux. If 355 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. 356 * 357 * You can bypass this test if you know that your application uses exactly 358 * the same setjmp.h that was included when libpng was built. Only define 359 * PNG_SKIP_SETJMP_CHECK while building your application, prior to the 360 * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK 361 * while building a separate libpng library for general use. 362 */ 363 364 # ifndef PNG_SKIP_SETJMP_CHECK 365 # ifdef __linux__ 366 # ifdef _BSD_SOURCE 367 # define PNG_SAVE_BSD_SOURCE 368 # undef _BSD_SOURCE 369 # endif 370 # ifdef _SETJMP_H 371 /* If you encounter a compiler error here, see the explanation 372 * near the end of INSTALL. 373 */ 374 __pngconf.h__ in libpng already includes setjmp.h; 375 __dont__ include it again.; 376 # endif 377 # endif /* __linux__ */ 378 # endif /* PNG_SKIP_SETJMP_CHECK */ 379 380 /* Include setjmp.h for error handling */ 381 # include <setjmp.h> 382 383 # ifdef __linux__ 384 # ifdef PNG_SAVE_BSD_SOURCE 385 # ifdef _BSD_SOURCE 386 # undef _BSD_SOURCE 387 # endif 388 # define _BSD_SOURCE 389 # undef PNG_SAVE_BSD_SOURCE 390 # endif 391 # endif /* __linux__ */ 392 #endif /* PNG_SETJMP_SUPPORTED */ 393 394 #ifdef BSD 395 # include <strings.h> 396 #else 397 # include <string.h> 398 #endif 399 400 /* Other defines for things like memory and the like can go here. */ 401 402 /* This controls how fine the quantizing gets. As this allocates 403 * a largish chunk of memory (32K), those who are not as concerned 404 * with quantizing quality can decrease some or all of these. 405 */ 406 407 /* Prior to libpng-1.4.2, these were PNG_DITHER_*_BITS 408 * These migration aids will be removed from libpng-1.5.0. 409 */ 410 #ifdef PNG_DITHER_RED_BITS 411 # define PNG_QUANTIZE_RED_BITS PNG_DITHER_RED_BITS 412 #endif 413 #ifdef PNG_DITHER_GREEN_BITS 414 # define PNG_QUANTIZE_GREEN_BITS PNG_DITHER_GREEN_BITS 415 #endif 416 #ifdef PNG_DITHER_BLUE_BITS 417 # define PNG_QUANTIZE_BLUE_BITS PNG_DITHER_BLUE_BITS 418 #endif 419 420 #ifndef PNG_QUANTIZE_RED_BITS 421 # define PNG_QUANTIZE_RED_BITS 5 422 #endif 423 #ifndef PNG_QUANTIZE_GREEN_BITS 424 # define PNG_QUANTIZE_GREEN_BITS 5 425 #endif 426 #ifndef PNG_QUANTIZE_BLUE_BITS 427 # define PNG_QUANTIZE_BLUE_BITS 5 428 #endif 429 430 /* This controls how fine the gamma correction becomes when you 431 * are only interested in 8 bits anyway. Increasing this value 432 * results in more memory being used, and more pow() functions 433 * being called to fill in the gamma tables. Don't set this value 434 * less then 8, and even that may not work (I haven't tested it). 435 */ 436 437 #ifndef PNG_MAX_GAMMA_8 438 # define PNG_MAX_GAMMA_8 11 439 #endif 440 441 /* This controls how much a difference in gamma we can tolerate before 442 * we actually start doing gamma conversion. 443 */ 444 #ifndef PNG_GAMMA_THRESHOLD 445 # define PNG_GAMMA_THRESHOLD 0.05 446 #endif 447 448 /* The following uses const char * instead of char * for error 449 * and warning message functions, so some compilers won't complain. 450 * If you do not want to use const, define PNG_NO_CONST. 451 */ 452 453 #ifndef PNG_CONST 454 # ifndef PNG_NO_CONST 455 # define PNG_CONST const 456 # else 457 # define PNG_CONST 458 # endif 459 #endif 460 461 /* The following defines give you the ability to remove code from the 462 * library that you will not be using. I wish I could figure out how to 463 * automate this, but I can't do that without making it seriously hard 464 * on the users. So if you are not using an ability, change the #define 465 * to an #undef, or pass in PNG_NO_feature and that part of the library 466 * will not be compiled. 467 468 * If your linker can't find a function, you may want to make sure the 469 * ability is defined here. Some of these depend upon some others being 470 * defined. I haven't figured out all the interactions here, so you may 471 * have to experiment awhile to get everything to compile. If you are 472 * creating or using a shared library, you probably shouldn't touch this, 473 * as it will affect the size of the structures, and this will cause bad 474 * things to happen if the library and/or application ever change. 475 */ 476 477 /* Any features you will not be using can be undef'ed here */ 478 479 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user 480 * to turn it off with PNG_NO_READ|WRITE_TRANSFORMS on the compile line, 481 * then pick and choose which ones to define without having to edit this 482 * file. It is safe to use the PNG_NO_READ|WRITE_TRANSFORMS 483 * if you only want to have a png-compliant reader/writer but don't need 484 * any of the extra transformations. This saves about 80 kbytes in a 485 * typical installation of the library. (PNG_NO_* form added in version 486 * 1.0.1c, for consistency; PNG_*_TRANSFORMS_NOT_SUPPORTED deprecated in 487 * 1.4.0) 488 */ 489 490 /* Ignore attempt to turn off both floating and fixed point support */ 491 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ 492 !defined(PNG_NO_FIXED_POINT_SUPPORTED) 493 # define PNG_FIXED_POINT_SUPPORTED 494 #endif 495 496 #ifdef PNG_READ_SUPPORTED 497 498 /* PNG_READ_TRANSFORMS_NOT_SUPPORTED is deprecated. */ 499 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ 500 !defined(PNG_NO_READ_TRANSFORMS) 501 # define PNG_READ_TRANSFORMS_SUPPORTED 502 #endif 503 504 #ifdef PNG_READ_TRANSFORMS_SUPPORTED 505 # ifndef PNG_NO_READ_EXPAND 506 # define PNG_READ_EXPAND_SUPPORTED 507 # endif 508 # ifndef PNG_NO_READ_SHIFT 509 # define PNG_READ_SHIFT_SUPPORTED 510 # endif 511 # ifndef PNG_NO_READ_PACK 512 # define PNG_READ_PACK_SUPPORTED 513 # endif 514 # ifndef PNG_NO_READ_BGR 515 # define PNG_READ_BGR_SUPPORTED 516 # endif 517 # ifndef PNG_NO_READ_SWAP 518 # define PNG_READ_SWAP_SUPPORTED 519 # endif 520 # ifndef PNG_NO_READ_PACKSWAP 521 # define PNG_READ_PACKSWAP_SUPPORTED 522 # endif 523 # ifndef PNG_NO_READ_INVERT 524 # define PNG_READ_INVERT_SUPPORTED 525 # endif 526 # ifndef PNG_NO_READ_QUANTIZE 527 /* Prior to libpng-1.4.0 this was PNG_READ_DITHER_SUPPORTED */ 528 # ifndef PNG_NO_READ_DITHER /* This migration aid will be removed */ 529 # define PNG_READ_QUANTIZE_SUPPORTED 530 # endif 531 # endif 532 # ifndef PNG_NO_READ_BACKGROUND 533 # define PNG_READ_BACKGROUND_SUPPORTED 534 # endif 535 # ifndef PNG_NO_READ_16_TO_8 536 # define PNG_READ_16_TO_8_SUPPORTED 537 # endif 538 # ifndef PNG_NO_READ_FILLER 539 # define PNG_READ_FILLER_SUPPORTED 540 # endif 541 # ifndef PNG_NO_READ_GAMMA 542 # define PNG_READ_GAMMA_SUPPORTED 543 # endif 544 # ifndef PNG_NO_READ_GRAY_TO_RGB 545 # define PNG_READ_GRAY_TO_RGB_SUPPORTED 546 # endif 547 # ifndef PNG_NO_READ_SWAP_ALPHA 548 # define PNG_READ_SWAP_ALPHA_SUPPORTED 549 # endif 550 # ifndef PNG_NO_READ_INVERT_ALPHA 551 # define PNG_READ_INVERT_ALPHA_SUPPORTED 552 # endif 553 # ifndef PNG_NO_READ_STRIP_ALPHA 554 # define PNG_READ_STRIP_ALPHA_SUPPORTED 555 # endif 556 # ifndef PNG_NO_READ_USER_TRANSFORM 557 # define PNG_READ_USER_TRANSFORM_SUPPORTED 558 # endif 559 # ifndef PNG_NO_READ_RGB_TO_GRAY 560 # define PNG_READ_RGB_TO_GRAY_SUPPORTED 561 # endif 562 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */ 563 564 /* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */ 565 #if !defined(PNG_NO_PROGRESSIVE_READ) && \ 566 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ 567 # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ 568 #endif /* about interlacing capability! You'll */ 569 /* still have interlacing unless you change the following define: */ 570 571 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ 572 573 /* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */ 574 #if !defined(PNG_NO_SEQUENTIAL_READ) && \ 575 !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \ 576 !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED) 577 # define PNG_SEQUENTIAL_READ_SUPPORTED 578 #endif 579 580 #ifndef PNG_NO_READ_COMPOSITE_NODIV 581 # ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ 582 # define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ 583 # endif 584 #endif 585 586 #if !defined(PNG_NO_GET_INT_32) || defined(PNG_READ_oFFS_SUPPORTED) || \ 587 defined(PNG_READ_pCAL_SUPPORTED) 588 # ifndef PNG_GET_INT_32_SUPPORTED 589 # define PNG_GET_INT_32_SUPPORTED 590 # endif 591 #endif 592 593 #endif /* PNG_READ_SUPPORTED */ 594 595 #ifdef PNG_WRITE_SUPPORTED 596 597 /* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */ 598 #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ 599 !defined(PNG_NO_WRITE_TRANSFORMS) 600 # define PNG_WRITE_TRANSFORMS_SUPPORTED 601 #endif 602 603 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED 604 # ifndef PNG_NO_WRITE_SHIFT 605 # define PNG_WRITE_SHIFT_SUPPORTED 606 # endif 607 # ifndef PNG_NO_WRITE_PACK 608 # define PNG_WRITE_PACK_SUPPORTED 609 # endif 610 # ifndef PNG_NO_WRITE_BGR 611 # define PNG_WRITE_BGR_SUPPORTED 612 # endif 613 # ifndef PNG_NO_WRITE_SWAP 614 # define PNG_WRITE_SWAP_SUPPORTED 615 # endif 616 # ifndef PNG_NO_WRITE_PACKSWAP 617 # define PNG_WRITE_PACKSWAP_SUPPORTED 618 # endif 619 # ifndef PNG_NO_WRITE_INVERT 620 # define PNG_WRITE_INVERT_SUPPORTED 621 # endif 622 # ifndef PNG_NO_WRITE_FILLER 623 # define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ 624 # endif 625 # ifndef PNG_NO_WRITE_SWAP_ALPHA 626 # define PNG_WRITE_SWAP_ALPHA_SUPPORTED 627 # endif 628 # ifndef PNG_NO_WRITE_INVERT_ALPHA 629 # define PNG_WRITE_INVERT_ALPHA_SUPPORTED 630 # endif 631 # ifndef PNG_NO_WRITE_USER_TRANSFORM 632 # define PNG_WRITE_USER_TRANSFORM_SUPPORTED 633 # endif 634 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ 635 636 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ 637 !defined(PNG_WRITE_INTERLACING_SUPPORTED) 638 /* This is not required for PNG-compliant encoders, but can cause 639 * trouble if left undefined 640 */ 641 # define PNG_WRITE_INTERLACING_SUPPORTED 642 #endif 643 644 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ 645 !defined(PNG_WRITE_WEIGHTED_FILTER) && \ 646 defined(PNG_FLOATING_POINT_SUPPORTED) 647 # define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED 648 #endif 649 650 #ifndef PNG_NO_WRITE_FLUSH 651 # define PNG_WRITE_FLUSH_SUPPORTED 652 #endif 653 654 #if !defined(PNG_NO_SAVE_INT_32) || defined(PNG_WRITE_oFFS_SUPPORTED) || \ 655 defined(PNG_WRITE_pCAL_SUPPORTED) 656 # ifndef PNG_SAVE_INT_32_SUPPORTED 657 # define PNG_SAVE_INT_32_SUPPORTED 658 # endif 659 #endif 660 661 #endif /* PNG_WRITE_SUPPORTED */ 662 663 #define PNG_NO_ERROR_NUMBERS 664 665 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ 666 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) 667 # ifndef PNG_NO_USER_TRANSFORM_PTR 668 # define PNG_USER_TRANSFORM_PTR_SUPPORTED 669 # endif 670 #endif 671 672 #if defined(PNG_STDIO_SUPPORTED) && !defined(PNG_TIME_RFC1123_SUPPORTED) 673 # define PNG_TIME_RFC1123_SUPPORTED 674 #endif 675 676 /* This adds extra functions in pngget.c for accessing data from the 677 * info pointer (added in version 0.99) 678 * png_get_image_width() 679 * png_get_image_height() 680 * png_get_bit_depth() 681 * png_get_color_type() 682 * png_get_compression_type() 683 * png_get_filter_type() 684 * png_get_interlace_type() 685 * png_get_pixel_aspect_ratio() 686 * png_get_pixels_per_meter() 687 * png_get_x_offset_pixels() 688 * png_get_y_offset_pixels() 689 * png_get_x_offset_microns() 690 * png_get_y_offset_microns() 691 */ 692 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) 693 # define PNG_EASY_ACCESS_SUPPORTED 694 #endif 695 696 /* Added at libpng-1.2.0 */ 697 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) 698 # define PNG_USER_MEM_SUPPORTED 699 #endif 700 701 /* Added at libpng-1.2.6 */ 702 #ifndef PNG_NO_SET_USER_LIMITS 703 # ifndef PNG_SET_USER_LIMITS_SUPPORTED 704 # define PNG_SET_USER_LIMITS_SUPPORTED 705 # endif 706 /* Feature added at libpng-1.4.0, this flag added at 1.4.1 */ 707 # ifndef PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED 708 # define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED 709 # endif 710 /* Feature added at libpng-1.4.1, this flag added at 1.4.1 */ 711 # ifndef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED 712 # define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED 713 # endif 714 #endif 715 716 /* Added at libpng-1.2.43 */ 717 #ifndef PNG_USER_LIMITS_SUPPORTED 718 # ifndef PNG_NO_USER_LIMITS 719 # define PNG_USER_LIMITS_SUPPORTED 720 # endif 721 #endif 722 723 /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter 724 * how large, set these two limits to 0x7fffffffL 725 */ 726 #ifndef PNG_USER_WIDTH_MAX 727 # define PNG_USER_WIDTH_MAX 1000000L 728 #endif 729 #ifndef PNG_USER_HEIGHT_MAX 730 # define PNG_USER_HEIGHT_MAX 1000000L 731 #endif 732 733 /* Added at libpng-1.2.43. To accept all valid PNGs no matter 734 * how large, set these two limits to 0. 735 */ 736 #ifndef PNG_USER_CHUNK_CACHE_MAX 737 # define PNG_USER_CHUNK_CACHE_MAX 0 738 #endif 739 740 /* Added at libpng-1.2.43 */ 741 #ifndef PNG_USER_CHUNK_MALLOC_MAX 742 # define PNG_USER_CHUNK_MALLOC_MAX 0 743 #endif 744 745 /* Added at libpng-1.4.0 */ 746 #if !defined(PNG_NO_IO_STATE) && !defined(PNG_IO_STATE_SUPPORTED) 747 # define PNG_IO_STATE_SUPPORTED 748 #endif 749 750 #ifndef PNG_LITERAL_SHARP 751 # define PNG_LITERAL_SHARP 0x23 752 #endif 753 #ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET 754 # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b 755 #endif 756 #ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET 757 # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d 758 #endif 759 #ifndef PNG_STRING_NEWLINE 760 #define PNG_STRING_NEWLINE "\n" 761 #endif 762 763 /* These are currently experimental features, define them if you want */ 764 765 /* Very little testing */ 766 /* 767 #ifdef PNG_READ_SUPPORTED 768 # ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED 769 # define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED 770 # endif 771 #endif 772 */ 773 774 /* This is only for PowerPC big-endian and 680x0 systems */ 775 /* some testing */ 776 /* 777 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED 778 # define PNG_READ_BIG_ENDIAN_SUPPORTED 779 #endif 780 */ 781 782 #if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS) 783 # define PNG_USE_READ_MACROS 784 #endif 785 786 /* Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING */ 787 788 #if !defined(PNG_NO_POINTER_INDEXING) && \ 789 !defined(PNG_POINTER_INDEXING_SUPPORTED) 790 # define PNG_POINTER_INDEXING_SUPPORTED 791 #endif 792 793 794 /* Any chunks you are not interested in, you can undef here. The 795 * ones that allocate memory may be expecially important (hIST, 796 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info 797 * a bit smaller. 798 */ 799 800 /* The size of the png_text structure changed in libpng-1.0.6 when 801 * iTXt support was added. iTXt support was turned off by default through 802 * libpng-1.2.x, to support old apps that malloc the png_text structure 803 * instead of calling png_set_text() and letting libpng malloc it. It 804 * was turned on by default in libpng-1.4.0. 805 */ 806 807 /* PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ 808 #if defined(PNG_READ_SUPPORTED) && \ 809 !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ 810 !defined(PNG_NO_READ_ANCILLARY_CHUNKS) 811 # define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED 812 #endif 813 814 /* PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated. */ 815 #if defined(PNG_WRITE_SUPPORTED) && \ 816 !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ 817 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) 818 # define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED 819 #endif 820 821 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED 822 823 #ifdef PNG_NO_READ_TEXT 824 # define PNG_NO_READ_iTXt 825 # define PNG_NO_READ_tEXt 826 # define PNG_NO_READ_zTXt 827 #endif 828 829 #ifndef PNG_NO_READ_bKGD 830 # define PNG_READ_bKGD_SUPPORTED 831 # define PNG_bKGD_SUPPORTED 832 #endif 833 #ifndef PNG_NO_READ_cHRM 834 # define PNG_READ_cHRM_SUPPORTED 835 # define PNG_cHRM_SUPPORTED 836 #endif 837 #ifndef PNG_NO_READ_gAMA 838 # define PNG_READ_gAMA_SUPPORTED 839 # define PNG_gAMA_SUPPORTED 840 #endif 841 #ifndef PNG_NO_READ_hIST 842 # define PNG_READ_hIST_SUPPORTED 843 # define PNG_hIST_SUPPORTED 844 #endif 845 #ifndef PNG_NO_READ_iCCP 846 # define PNG_READ_iCCP_SUPPORTED 847 # define PNG_iCCP_SUPPORTED 848 #endif 849 #ifndef PNG_NO_READ_iTXt 850 # ifndef PNG_READ_iTXt_SUPPORTED 851 # define PNG_READ_iTXt_SUPPORTED 852 # endif 853 # ifndef PNG_iTXt_SUPPORTED 854 # define PNG_iTXt_SUPPORTED 855 # endif 856 #endif 857 #ifndef PNG_NO_READ_oFFs 858 # define PNG_READ_oFFs_SUPPORTED 859 # define PNG_oFFs_SUPPORTED 860 #endif 861 #ifndef PNG_NO_READ_pCAL 862 # define PNG_READ_pCAL_SUPPORTED 863 # define PNG_pCAL_SUPPORTED 864 #endif 865 #ifndef PNG_NO_READ_sCAL 866 # define PNG_READ_sCAL_SUPPORTED 867 # define PNG_sCAL_SUPPORTED 868 #endif 869 #ifndef PNG_NO_READ_pHYs 870 # define PNG_READ_pHYs_SUPPORTED 871 # define PNG_pHYs_SUPPORTED 872 #endif 873 #ifndef PNG_NO_READ_sBIT 874 # define PNG_READ_sBIT_SUPPORTED 875 # define PNG_sBIT_SUPPORTED 876 #endif 877 #ifndef PNG_NO_READ_sPLT 878 # define PNG_READ_sPLT_SUPPORTED 879 # define PNG_sPLT_SUPPORTED 880 #endif 881 #ifndef PNG_NO_READ_sRGB 882 # define PNG_READ_sRGB_SUPPORTED 883 # define PNG_sRGB_SUPPORTED 884 #endif 885 #ifndef PNG_NO_READ_tEXt 886 # define PNG_READ_tEXt_SUPPORTED 887 # define PNG_tEXt_SUPPORTED 888 #endif 889 #ifndef PNG_NO_READ_tIME 890 # define PNG_READ_tIME_SUPPORTED 891 # define PNG_tIME_SUPPORTED 892 #endif 893 #ifndef PNG_NO_READ_tRNS 894 # define PNG_READ_tRNS_SUPPORTED 895 # define PNG_tRNS_SUPPORTED 896 #endif 897 #ifndef PNG_NO_READ_zTXt 898 # define PNG_READ_zTXt_SUPPORTED 899 # define PNG_zTXt_SUPPORTED 900 #endif 901 #ifndef PNG_NO_READ_OPT_PLTE 902 # define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ 903 #endif /* optional PLTE chunk in RGB and RGBA images */ 904 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ 905 defined(PNG_READ_zTXt_SUPPORTED) 906 # define PNG_READ_TEXT_SUPPORTED 907 # define PNG_TEXT_SUPPORTED 908 #endif 909 910 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ 911 912 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS 913 # ifndef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED 914 # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED 915 # endif 916 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED 917 # define PNG_UNKNOWN_CHUNKS_SUPPORTED 918 # endif 919 # ifndef PNG_READ_USER_CHUNKS_SUPPORTED 920 # define PNG_READ_USER_CHUNKS_SUPPORTED 921 # endif 922 #endif 923 #ifndef PNG_NO_READ_USER_CHUNKS 924 # ifndef PNG_READ_USER_CHUNKS_SUPPORTED 925 # define PNG_READ_USER_CHUNKS_SUPPORTED 926 # endif 927 # ifndef PNG_USER_CHUNKS_SUPPORTED 928 # define PNG_USER_CHUNKS_SUPPORTED 929 # endif 930 #endif 931 #ifndef PNG_NO_HANDLE_AS_UNKNOWN 932 # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 933 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED 934 # endif 935 #endif 936 937 #ifdef PNG_WRITE_SUPPORTED 938 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED 939 940 #ifdef PNG_NO_WRITE_TEXT 941 # define PNG_NO_WRITE_iTXt 942 # define PNG_NO_WRITE_tEXt 943 # define PNG_NO_WRITE_zTXt 944 #endif 945 #ifndef PNG_NO_WRITE_bKGD 946 # define PNG_WRITE_bKGD_SUPPORTED 947 # ifndef PNG_bKGD_SUPPORTED 948 # define PNG_bKGD_SUPPORTED 949 # endif 950 #endif 951 #ifndef PNG_NO_WRITE_cHRM 952 # define PNG_WRITE_cHRM_SUPPORTED 953 # ifndef PNG_cHRM_SUPPORTED 954 # define PNG_cHRM_SUPPORTED 955 # endif 956 #endif 957 #ifndef PNG_NO_WRITE_gAMA 958 # define PNG_WRITE_gAMA_SUPPORTED 959 # ifndef PNG_gAMA_SUPPORTED 960 # define PNG_gAMA_SUPPORTED 961 # endif 962 #endif 963 #ifndef PNG_NO_WRITE_hIST 964 # define PNG_WRITE_hIST_SUPPORTED 965 # ifndef PNG_hIST_SUPPORTED 966 # define PNG_hIST_SUPPORTED 967 # endif 968 #endif 969 #ifndef PNG_NO_WRITE_iCCP 970 # define PNG_WRITE_iCCP_SUPPORTED 971 # ifndef PNG_iCCP_SUPPORTED 972 # define PNG_iCCP_SUPPORTED 973 # endif 974 #endif 975 #ifndef PNG_NO_WRITE_iTXt 976 # ifndef PNG_WRITE_iTXt_SUPPORTED 977 # define PNG_WRITE_iTXt_SUPPORTED 978 # endif 979 # ifndef PNG_iTXt_SUPPORTED 980 # define PNG_iTXt_SUPPORTED 981 # endif 982 #endif 983 #ifndef PNG_NO_WRITE_oFFs 984 # define PNG_WRITE_oFFs_SUPPORTED 985 # ifndef PNG_oFFs_SUPPORTED 986 # define PNG_oFFs_SUPPORTED 987 # endif 988 #endif 989 #ifndef PNG_NO_WRITE_pCAL 990 # define PNG_WRITE_pCAL_SUPPORTED 991 # ifndef PNG_pCAL_SUPPORTED 992 # define PNG_pCAL_SUPPORTED 993 # endif 994 #endif 995 #ifndef PNG_NO_WRITE_sCAL 996 # define PNG_WRITE_sCAL_SUPPORTED 997 # ifndef PNG_sCAL_SUPPORTED 998 # define PNG_sCAL_SUPPORTED 999 # endif 1000 #endif 1001 #ifndef PNG_NO_WRITE_pHYs 1002 # define PNG_WRITE_pHYs_SUPPORTED 1003 # ifndef PNG_pHYs_SUPPORTED 1004 # define PNG_pHYs_SUPPORTED 1005 # endif 1006 #endif 1007 #ifndef PNG_NO_WRITE_sBIT 1008 # define PNG_WRITE_sBIT_SUPPORTED 1009 # ifndef PNG_sBIT_SUPPORTED 1010 # define PNG_sBIT_SUPPORTED 1011 # endif 1012 #endif 1013 #ifndef PNG_NO_WRITE_sPLT 1014 # define PNG_WRITE_sPLT_SUPPORTED 1015 # ifndef PNG_sPLT_SUPPORTED 1016 # define PNG_sPLT_SUPPORTED 1017 # endif 1018 #endif 1019 #ifndef PNG_NO_WRITE_sRGB 1020 # define PNG_WRITE_sRGB_SUPPORTED 1021 # ifndef PNG_sRGB_SUPPORTED 1022 # define PNG_sRGB_SUPPORTED 1023 # endif 1024 #endif 1025 #ifndef PNG_NO_WRITE_tEXt 1026 # define PNG_WRITE_tEXt_SUPPORTED 1027 # ifndef PNG_tEXt_SUPPORTED 1028 # define PNG_tEXt_SUPPORTED 1029 # endif 1030 #endif 1031 #ifndef PNG_NO_WRITE_tIME 1032 # define PNG_WRITE_tIME_SUPPORTED 1033 # ifndef PNG_tIME_SUPPORTED 1034 # define PNG_tIME_SUPPORTED 1035 # endif 1036 #endif 1037 #ifndef PNG_NO_WRITE_tRNS 1038 # define PNG_WRITE_tRNS_SUPPORTED 1039 # ifndef PNG_tRNS_SUPPORTED 1040 # define PNG_tRNS_SUPPORTED 1041 # endif 1042 #endif 1043 #ifndef PNG_NO_WRITE_zTXt 1044 # define PNG_WRITE_zTXt_SUPPORTED 1045 # ifndef PNG_zTXt_SUPPORTED 1046 # define PNG_zTXt_SUPPORTED 1047 # endif 1048 #endif 1049 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ 1050 defined(PNG_WRITE_zTXt_SUPPORTED) 1051 # define PNG_WRITE_TEXT_SUPPORTED 1052 # ifndef PNG_TEXT_SUPPORTED 1053 # define PNG_TEXT_SUPPORTED 1054 # endif 1055 #endif 1056 1057 #ifdef PNG_WRITE_tIME_SUPPORTED 1058 # ifndef PNG_NO_CONVERT_tIME 1059 # ifndef _WIN32_WCE 1060 /* The "tm" structure is not supported on WindowsCE */ 1061 # ifndef PNG_CONVERT_tIME_SUPPORTED 1062 # define PNG_CONVERT_tIME_SUPPORTED 1063 # endif 1064 # endif 1065 # endif 1066 #endif 1067 1068 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ 1069 1070 #ifndef PNG_NO_WRITE_FILTER 1071 # ifndef PNG_WRITE_FILTER_SUPPORTED 1072 # define PNG_WRITE_FILTER_SUPPORTED 1073 # endif 1074 #endif 1075 1076 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS 1077 # define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED 1078 # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED 1079 # define PNG_UNKNOWN_CHUNKS_SUPPORTED 1080 # endif 1081 #endif 1082 #ifndef PNG_NO_HANDLE_AS_UNKNOWN 1083 # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED 1084 # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED 1085 # endif 1086 #endif 1087 #endif /* PNG_WRITE_SUPPORTED */ 1088 1089 /* Turn this off to disable png_read_png() and 1090 * png_write_png() and leave the row_pointers member 1091 * out of the info structure. 1092 */ 1093 #ifndef PNG_NO_INFO_IMAGE 1094 # define PNG_INFO_IMAGE_SUPPORTED 1095 #endif 1096 1097 /* Need the time information for converting tIME chunks */ 1098 #ifdef PNG_CONVERT_tIME_SUPPORTED 1099 /* "time.h" functions are not supported on WindowsCE */ 1100 # include <time.h> 1101 #endif 1102 1103 /* Some typedefs to get us started. These should be safe on most of the 1104 * common platforms. The typedefs should be at least as large as the 1105 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they 1106 * don't have to be exactly that size. Some compilers dislike passing 1107 * unsigned shorts as function parameters, so you may be better off using 1108 * unsigned int for png_uint_16. 1109 */ 1110 1111 #if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL) 1112 typedef unsigned int png_uint_32; 1113 typedef int png_int_32; 1114 #else 1115 typedef unsigned long png_uint_32; 1116 typedef long png_int_32; 1117 #endif 1118 typedef unsigned short png_uint_16; 1119 typedef short png_int_16; 1120 typedef unsigned char png_byte; 1121 1122 #ifdef PNG_NO_SIZE_T 1123 typedef unsigned int png_size_t; 1124 #else 1125 typedef size_t png_size_t; 1126 #endif 1127 #define png_sizeof(x) (sizeof (x)) 1128 1129 /* The following is needed for medium model support. It cannot be in the 1130 * pngpriv.h header. Needs modification for other compilers besides 1131 * MSC. Model independent support declares all arrays and pointers to be 1132 * large using the far keyword. The zlib version used must also support 1133 * model independent data. As of version zlib 1.0.4, the necessary changes 1134 * have been made in zlib. The USE_FAR_KEYWORD define triggers other 1135 * changes that are needed. (Tim Wegner) 1136 */ 1137 1138 /* Separate compiler dependencies (problem here is that zlib.h always 1139 * defines FAR. (SJT) 1140 */ 1141 #ifdef __BORLANDC__ 1142 # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) 1143 # define LDATA 1 1144 # else 1145 # define LDATA 0 1146 # endif 1147 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ 1148 # if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) 1149 # define PNG_MAX_MALLOC_64K 1150 # if (LDATA != 1) 1151 # ifndef FAR 1152 # define FAR __far 1153 # endif 1154 # define USE_FAR_KEYWORD 1155 # endif /* LDATA != 1 */ 1156 /* Possibly useful for moving data out of default segment. 1157 * Uncomment it if you want. Could also define FARDATA as 1158 * const if your compiler supports it. (SJT) 1159 # define FARDATA FAR 1160 */ 1161 # endif /* __WIN32__, __FLAT__, __CYGWIN__ */ 1162 #endif /* __BORLANDC__ */ 1163 1164 1165 /* Suggest testing for specific compiler first before testing for 1166 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, 1167 * making reliance oncertain keywords suspect. (SJT) 1168 */ 1169 1170 /* MSC Medium model */ 1171 #ifdef FAR 1172 # ifdef M_I86MM 1173 # define USE_FAR_KEYWORD 1174 # define FARDATA FAR 1175 # include <dos.h> 1176 # endif 1177 #endif 1178 1179 /* SJT: default case */ 1180 #ifndef FAR 1181 # define FAR 1182 #endif 1183 1184 /* At this point FAR is always defined */ 1185 #ifndef FARDATA 1186 # define FARDATA 1187 #endif 1188 1189 /* Typedef for floating-point numbers that are converted 1190 to fixed-point with a multiple of 100,000, e.g., int_gamma */ 1191 typedef png_int_32 png_fixed_point; 1192 1193 /* Add typedefs for pointers */ 1194 typedef void FAR * png_voidp; 1195 typedef png_byte FAR * png_bytep; 1196 typedef png_uint_32 FAR * png_uint_32p; 1197 typedef png_int_32 FAR * png_int_32p; 1198 typedef png_uint_16 FAR * png_uint_16p; 1199 typedef png_int_16 FAR * png_int_16p; 1200 typedef PNG_CONST char FAR * png_const_charp; 1201 typedef char FAR * png_charp; 1202 typedef png_fixed_point FAR * png_fixed_point_p; 1203 1204 #ifndef PNG_NO_STDIO 1205 typedef FILE * png_FILE_p; 1206 #endif 1207 1208 #ifdef PNG_FLOATING_POINT_SUPPORTED 1209 typedef double FAR * png_doublep; 1210 #endif 1211 1212 /* Pointers to pointers; i.e. arrays */ 1213 typedef png_byte FAR * FAR * png_bytepp; 1214 typedef png_uint_32 FAR * FAR * png_uint_32pp; 1215 typedef png_int_32 FAR * FAR * png_int_32pp; 1216 typedef png_uint_16 FAR * FAR * png_uint_16pp; 1217 typedef png_int_16 FAR * FAR * png_int_16pp; 1218 typedef PNG_CONST char FAR * FAR * png_const_charpp; 1219 typedef char FAR * FAR * png_charpp; 1220 typedef png_fixed_point FAR * FAR * png_fixed_point_pp; 1221 #ifdef PNG_FLOATING_POINT_SUPPORTED 1222 typedef double FAR * FAR * png_doublepp; 1223 #endif 1224 1225 /* Pointers to pointers to pointers; i.e., pointer to array */ 1226 typedef char FAR * FAR * FAR * png_charppp; 1227 1228 /* Define PNG_BUILD_DLL if the module being built is a Windows 1229 * LIBPNG DLL. 1230 * 1231 * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. 1232 * It is equivalent to Microsoft predefined macro _DLL that is 1233 * automatically defined when you compile using the share 1234 * version of the CRT (C Run-Time library) 1235 * 1236 * The cygwin mods make this behavior a little different: 1237 * Define PNG_BUILD_DLL if you are building a dll for use with cygwin 1238 * Define PNG_STATIC if you are building a static library for use with cygwin, 1239 * -or- if you are building an application that you want to link to the 1240 * static library. 1241 * PNG_USE_DLL is defined by default (no user action needed) unless one of 1242 * the other flags is defined. 1243 */ 1244 1245 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) 1246 # define PNG_DLL 1247 #endif 1248 1249 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", 1250 * you may get warnings regarding the linkage of png_zalloc and png_zfree. 1251 * Don't ignore those warnings; you must also reset the default calling 1252 * convention in your compiler to match your PNGAPI, and you must build 1253 * zlib and your applications the same way you build libpng. 1254 */ 1255 1256 #ifdef __CYGWIN__ 1257 # undef PNGAPI 1258 # define PNGAPI __cdecl 1259 # undef PNG_IMPEXP 1260 # define PNG_IMPEXP 1261 #endif 1262 1263 #ifdef __WATCOMC__ 1264 # ifndef PNGAPI 1265 # define PNGAPI 1266 # endif 1267 #endif 1268 1269 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF) 1270 # ifndef PNG_NO_MODULEDEF 1271 # define PNG_NO_MODULEDEF 1272 # endif 1273 #endif 1274 1275 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) 1276 # define PNG_IMPEXP 1277 #endif 1278 1279 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ 1280 (( defined(_Windows) || defined(_WINDOWS) || \ 1281 defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) 1282 1283 # ifndef PNGAPI 1284 # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) 1285 # define PNGAPI __cdecl 1286 # else 1287 # define PNGAPI _cdecl 1288 # endif 1289 # endif 1290 1291 # if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ 1292 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) 1293 # define PNG_IMPEXP 1294 # endif 1295 1296 # ifndef PNG_IMPEXP 1297 1298 # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol 1299 # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol 1300 1301 /* Borland/Microsoft */ 1302 # if defined(_MSC_VER) || defined(__BORLANDC__) 1303 # if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) 1304 # define PNG_EXPORT PNG_EXPORT_TYPE1 1305 # else 1306 # define PNG_EXPORT PNG_EXPORT_TYPE2 1307 # ifdef PNG_BUILD_DLL 1308 # define PNG_IMPEXP __export 1309 # else 1310 # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */ 1311 # endif /* Exists in Borland C++ for 1312 C++ classes (== huge) */ 1313 # endif 1314 # endif 1315 1316 # ifndef PNG_IMPEXP 1317 # ifdef PNG_BUILD_DLL 1318 # define PNG_IMPEXP __declspec(dllexport) 1319 # else 1320 # define PNG_IMPEXP __declspec(dllimport) 1321 # endif 1322 # endif 1323 # endif /* PNG_IMPEXP */ 1324 #else /* !(DLL || non-cygwin WINDOWS) */ 1325 # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) 1326 # ifndef PNGAPI 1327 # define PNGAPI _System 1328 # endif 1329 # else 1330 # if 0 /* ... other platforms, with other meanings */ 1331 # endif 1332 # endif 1333 #endif 1334 1335 #ifndef PNGAPI 1336 # define PNGAPI 1337 #endif 1338 #ifndef PNG_IMPEXP 1339 # define PNG_IMPEXP 1340 #endif 1341 1342 #ifdef PNG_BUILDSYMS 1343 # ifndef PNG_EXPORT 1344 # define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END 1345 # endif 1346 #endif 1347 1348 #ifndef PNG_EXPORT 1349 # define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol 1350 #endif 1351 1352 #define PNG_USE_LOCAL_ARRAYS /* Not used in libpng, defined for legacy apps */ 1353 1354 /* Support for compiler specific function attributes. These are used 1355 * so that where compiler support is available incorrect use of API 1356 * functions in png.h will generate compiler warnings. 1357 * 1358 * Added at libpng-1.2.41. 1359 */ 1360 1361 #ifndef PNG_NO_PEDANTIC_WARNINGS 1362 # ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED 1363 # define PNG_PEDANTIC_WARNINGS_SUPPORTED 1364 # endif 1365 #endif 1366 1367 #ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED 1368 /* Support for compiler specific function attributes. These are used 1369 * so that where compiler support is available incorrect use of API 1370 * functions in png.h will generate compiler warnings. Added at libpng 1371 * version 1.2.41. 1372 */ 1373 # ifdef __GNUC__ 1374 # ifndef PNG_USE_RESULT 1375 # define PNG_USE_RESULT __attribute__((__warn_unused_result__)) 1376 # endif 1377 # ifndef PNG_NORETURN 1378 # define PNG_NORETURN __attribute__((__noreturn__)) 1379 # endif 1380 # ifndef PNG_ALLOCATED 1381 # define PNG_ALLOCATED __attribute__((__malloc__)) 1382 # endif 1383 1384 /* This specifically protects structure members that should only be 1385 * accessed from within the library, therefore should be empty during 1386 * a library build. 1387 */ 1388 # ifndef PNG_DEPRECATED 1389 # define PNG_DEPRECATED __attribute__((__deprecated__)) 1390 # endif 1391 # ifndef PNG_DEPSTRUCT 1392 # define PNG_DEPSTRUCT __attribute__((__deprecated__)) 1393 # endif 1394 # ifndef PNG_PRIVATE 1395 # if 0 /* Doesn't work so we use deprecated instead*/ 1396 # define PNG_PRIVATE \ 1397 __attribute__((warning("This function is not exported by libpng."))) 1398 # else 1399 # define PNG_PRIVATE \ 1400 __attribute__((__deprecated__)) 1401 # endif 1402 # endif /* PNG_PRIVATE */ 1403 # endif /* __GNUC__ */ 1404 #endif /* PNG_PEDANTIC_WARNINGS */ 1405 1406 #ifndef PNG_DEPRECATED 1407 # define PNG_DEPRECATED /* Use of this function is deprecated */ 1408 #endif 1409 #ifndef PNG_USE_RESULT 1410 # define PNG_USE_RESULT /* The result of this function must be checked */ 1411 #endif 1412 #ifndef PNG_NORETURN 1413 # define PNG_NORETURN /* This function does not return */ 1414 #endif 1415 #ifndef PNG_ALLOCATED 1416 # define PNG_ALLOCATED /* The result of the function is new memory */ 1417 #endif 1418 #ifndef PNG_DEPSTRUCT 1419 # define PNG_DEPSTRUCT /* Access to this struct member is deprecated */ 1420 #endif 1421 #ifndef PNG_PRIVATE 1422 # define PNG_PRIVATE /* This is a private libpng function */ 1423 #endif 1424 1425 /* Users may want to use these so they are not private. Any library 1426 * functions that are passed far data must be model-independent. 1427 */ 1428 1429 /* memory model/platform independent fns */ 1430 #ifndef PNG_ABORT 1431 # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) 1432 # define PNG_ABORT() ExitProcess(0) 1433 # else 1434 # define PNG_ABORT() abort() 1435 # endif 1436 #endif 1437 1438 #ifdef USE_FAR_KEYWORD 1439 /* Use this to make far-to-near assignments */ 1440 # define CHECK 1 1441 # define NOCHECK 0 1442 # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) 1443 # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) 1444 # define png_strcpy _fstrcpy 1445 # define png_strncpy _fstrncpy /* Added to v 1.2.6 */ 1446 # define png_strlen _fstrlen 1447 # define png_memcmp _fmemcmp /* SJT: added */ 1448 # define png_memcpy _fmemcpy 1449 # define png_memset _fmemset 1450 # define png_sprintf sprintf 1451 #else 1452 # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) 1453 # /* Favor Windows over C runtime fns */ 1454 # define CVT_PTR(ptr) (ptr) 1455 # define CVT_PTR_NOCHECK(ptr) (ptr) 1456 # define png_strcpy lstrcpyA 1457 # define png_strncpy lstrcpynA 1458 # define png_strlen lstrlenA 1459 # define png_memcmp memcmp 1460 # define png_memcpy CopyMemory 1461 # define png_memset memset 1462 # define png_sprintf wsprintfA 1463 # else 1464 # define CVT_PTR(ptr) (ptr) 1465 # define CVT_PTR_NOCHECK(ptr) (ptr) 1466 # define png_strcpy strcpy 1467 # define png_strncpy strncpy /* Added to v 1.2.6 */ 1468 # define png_strlen strlen 1469 # define png_memcmp memcmp /* SJT: added */ 1470 # define png_memcpy memcpy 1471 # define png_memset memset 1472 # define png_sprintf sprintf 1473 # endif 1474 #endif 1475 1476 #ifndef PNG_NO_SNPRINTF 1477 # ifdef _MSC_VER 1478 # define png_snprintf _snprintf /* Added to v 1.2.19 */ 1479 # define png_snprintf2 _snprintf 1480 # define png_snprintf6 _snprintf 1481 # else 1482 # define png_snprintf snprintf /* Added to v 1.2.19 */ 1483 # define png_snprintf2 snprintf 1484 # define png_snprintf6 snprintf 1485 # endif 1486 #else 1487 /* You don't have or don't want to use snprintf(). Caution: Using 1488 * sprintf instead of snprintf exposes your application to accidental 1489 * or malevolent buffer overflows. If you don't have snprintf() 1490 * as a general rule you should provide one (you can get one from 1491 * Portable OpenSSH). 1492 */ 1493 # define png_snprintf(s1,n,fmt,x1) png_sprintf(s1,fmt,x1) 1494 # define png_snprintf2(s1,n,fmt,x1,x2) png_sprintf(s1,fmt,x1,x2) 1495 # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ 1496 png_sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) 1497 #endif 1498 1499 /* png_alloc_size_t is guaranteed to be no smaller than png_size_t, 1500 * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 1501 * to png_alloc_size_t are not necessary; in fact, it is recommended 1502 * not to use them at all so that the compiler can complain when something 1503 * turns out to be problematic. 1504 * Casts in the other direction (from png_alloc_size_t to png_size_t or 1505 * png_uint_32) should be explicitly applied; however, we do not expect 1506 * to encounter practical situations that require such conversions. 1507 */ 1508 #if defined(__TURBOC__) && !defined(__FLAT__) 1509 typedef unsigned long png_alloc_size_t; 1510 #else 1511 # if defined(_MSC_VER) && defined(MAXSEG_64K) 1512 typedef unsigned long png_alloc_size_t; 1513 # else 1514 /* This is an attempt to detect an old Windows system where (int) is 1515 * actually 16 bits, in that case png_malloc must have an argument with a 1516 * bigger size to accomodate the requirements of the library. 1517 */ 1518 # if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \ 1519 (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL) 1520 typedef DWORD png_alloc_size_t; 1521 # else 1522 typedef png_size_t png_alloc_size_t; 1523 # endif 1524 # endif 1525 #endif 1526 /* End of memory model/platform independent support */ 1527 1528 /* Just a little check that someone hasn't tried to define something 1529 * contradictory. 1530 */ 1531 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) 1532 # undef PNG_ZBUF_SIZE 1533 # define PNG_ZBUF_SIZE 65536L 1534 #endif 1535 1536 1537 /* Added at libpng-1.2.8 */ 1538 #endif /* PNG_VERSION_INFO_ONLY */ 1539 1540 #endif /* PNGCONF_H */ 1541