OLD | NEW |
1 | 1 |
2 /* pngpriv.h - private declarations for use inside libpng | 2 /* pngpriv.h - private declarations for use inside libpng |
3 * | 3 * |
4 * For conditions of distribution and use, see copyright notice in png.h | 4 * Last changed in libpng 1.6.18 [July 23, 2015] |
5 * Copyright (c) 1998-2013 Glenn Randers-Pehrson | 5 * Copyright (c) 1998-2015 Glenn Randers-Pehrson |
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
8 * | 8 * |
9 * Last changed in libpng 1.6.3 [July 18, 2013] | |
10 * | |
11 * This code is released under the libpng license. | 9 * This code is released under the libpng license. |
12 * For conditions of distribution and use, see the disclaimer | 10 * For conditions of distribution and use, see the disclaimer |
13 * and license in png.h | 11 * and license in png.h |
14 */ | 12 */ |
15 | 13 |
16 /* The symbols declared in this file (including the functions declared | 14 /* The symbols declared in this file (including the functions declared |
17 * as extern) are PRIVATE. They are not part of the libpng public | 15 * as extern) are PRIVATE. They are not part of the libpng public |
18 * interface, and are not recommended for use by regular applications. | 16 * interface, and are not recommended for use by regular applications. |
19 * Some of them may become public in the future; others may stay private, | 17 * Some of them may become public in the future; others may stay private, |
20 * change in an incompatible way, or even disappear. | 18 * change in an incompatible way, or even disappear. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 * below is one example of this behavior because it is controlled by the | 103 * below is one example of this behavior because it is controlled by the |
106 * presence or not of -mfpu=neon on the GCC command line, it is possible to do | 104 * presence or not of -mfpu=neon on the GCC command line, it is possible to do |
107 * this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely | 105 * this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely |
108 * do this. | 106 * do this. |
109 */ | 107 */ |
110 #ifndef PNG_ARM_NEON_OPT | 108 #ifndef PNG_ARM_NEON_OPT |
111 /* ARM NEON optimizations are being controlled by the compiler settings, | 109 /* ARM NEON optimizations are being controlled by the compiler settings, |
112 * typically the target FPU. If the FPU has been set to NEON (-mfpu=neon | 110 * typically the target FPU. If the FPU has been set to NEON (-mfpu=neon |
113 * with GCC) then the compiler will define __ARM_NEON__ and we can rely | 111 * with GCC) then the compiler will define __ARM_NEON__ and we can rely |
114 * unconditionally on NEON instructions not crashing, otherwise we must | 112 * unconditionally on NEON instructions not crashing, otherwise we must |
115 * disable use of NEON instructions: | 113 * disable use of NEON instructions. |
116 */ | 114 * |
117 # ifdef __ARM_NEON__ | 115 * NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they |
118 # define PNG_ARM_NEON_OPT 2 | 116 * can only be turned on automatically if that is supported too. If |
| 117 * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail |
| 118 * to compile with an appropriate #error if ALIGNED_MEMORY has been turned |
| 119 * off. |
| 120 * |
| 121 * Note that gcc-4.9 defines __ARM_NEON instead of the deprecated |
| 122 * __ARM_NEON__, so we check both variants. |
| 123 * |
| 124 * To disable ARM_NEON optimizations entirely, and skip compiling the |
| 125 * associated assembler code, pass --enable-arm-neon=no to configure |
| 126 * or put -DPNG_ARM_NEON_OPT=0 in CPPFLAGS. |
| 127 */ |
| 128 # if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \ |
| 129 defined(PNG_ALIGNED_MEMORY_SUPPORTED) |
| 130 # define PNG_ARM_NEON_OPT 0 |
119 # else | 131 # else |
120 # define PNG_ARM_NEON_OPT 0 | 132 # define PNG_ARM_NEON_OPT 0 |
121 # endif | 133 # endif |
122 #endif | 134 #endif |
123 | 135 |
124 #if PNG_ARM_NEON_OPT > 0 | 136 #if PNG_ARM_NEON_OPT > 0 |
125 /* NEON optimizations are to be at least considered by libpng, so enable the | 137 /* NEON optimizations are to be at least considered by libpng, so enable the |
126 * callbacks to do this. | 138 * callbacks to do this. |
127 */ | 139 */ |
128 /* | 140 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon |
129 * Disabled by sbc since this copy of libpng doesn't contains the arm | 141 |
130 * specific code (e.g. arm/arm_init.c) | 142 /* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used |
131 */ | 143 * if possible - if __ARM_NEON__ is set and the compiler version is not known |
132 /*# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon*/ | 144 * to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can |
133 #endif | 145 * be: |
| 146 * |
| 147 * 1 The intrinsics code (the default with __ARM_NEON__) |
| 148 * 2 The hand coded assembler (the default without __ARM_NEON__) |
| 149 * |
| 150 * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however |
| 151 * this is *NOT* supported and may cease to work even after a minor revision |
| 152 * to libpng. It *is* valid to do this for testing purposes, e.g. speed |
| 153 * testing or a new compiler, but the results should be communicated to the |
| 154 * libpng implementation list for incorporation in the next minor release. |
| 155 */ |
| 156 # ifndef PNG_ARM_NEON_IMPLEMENTATION |
| 157 # if defined(__ARM_NEON__) || defined(__ARM_NEON) |
| 158 # if defined(__clang__) |
| 159 /* At present it is unknown by the libpng developers which versions |
| 160 * of clang support the intrinsics, however some or perhaps all |
| 161 * versions do not work with the assembler so this may be |
| 162 * irrelevant, so just use the default (do nothing here.) |
| 163 */ |
| 164 # elif defined(__GNUC__) |
| 165 /* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to |
| 166 * work, so if this *is* GCC, or G++, look for a version >4.5 |
| 167 */ |
| 168 # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) |
| 169 # define PNG_ARM_NEON_IMPLEMENTATION 2 |
| 170 # endif /* no GNUC support */ |
| 171 # endif /* __GNUC__ */ |
| 172 # else /* !defined __ARM_NEON__ */ |
| 173 /* The 'intrinsics' code simply won't compile without this -mfpu=neon: |
| 174 */ |
| 175 # define PNG_ARM_NEON_IMPLEMENTATION 2 |
| 176 # endif /* __ARM_NEON__ */ |
| 177 # endif /* !PNG_ARM_NEON_IMPLEMENTATION */ |
| 178 |
| 179 # ifndef PNG_ARM_NEON_IMPLEMENTATION |
| 180 /* Use the intrinsics code by default. */ |
| 181 # define PNG_ARM_NEON_IMPLEMENTATION 1 |
| 182 # endif |
| 183 #endif /* PNG_ARM_NEON_OPT > 0 */ |
134 | 184 |
135 /* Is this a build of a DLL where compilation of the object modules requires | 185 /* Is this a build of a DLL where compilation of the object modules requires |
136 * different preprocessor settings to those required for a simple library? If | 186 * different preprocessor settings to those required for a simple library? If |
137 * so PNG_BUILD_DLL must be set. | 187 * so PNG_BUILD_DLL must be set. |
138 * | 188 * |
139 * If libpng is used inside a DLL but that DLL does not export the libpng APIs | 189 * If libpng is used inside a DLL but that DLL does not export the libpng APIs |
140 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a | 190 * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a |
141 * static library of libpng then link the DLL against that. | 191 * static library of libpng then link the DLL against that. |
142 */ | 192 */ |
143 #ifndef PNG_BUILD_DLL | 193 #ifndef PNG_BUILD_DLL |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 #ifndef PNG_PRIVATE | 245 #ifndef PNG_PRIVATE |
196 # define PNG_PRIVATE | 246 # define PNG_PRIVATE |
197 #endif | 247 #endif |
198 | 248 |
199 /* Symbol preprocessing support. | 249 /* Symbol preprocessing support. |
200 * | 250 * |
201 * To enable listing global, but internal, symbols the following macros should | 251 * To enable listing global, but internal, symbols the following macros should |
202 * always be used to declare an extern data or function object in this file. | 252 * always be used to declare an extern data or function object in this file. |
203 */ | 253 */ |
204 #ifndef PNG_INTERNAL_DATA | 254 #ifndef PNG_INTERNAL_DATA |
205 # define PNG_INTERNAL_DATA(type, name, array) extern type name array | 255 # define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array |
206 #endif | 256 #endif |
207 | 257 |
208 #ifndef PNG_INTERNAL_FUNCTION | 258 #ifndef PNG_INTERNAL_FUNCTION |
209 # define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\ | 259 # define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\ |
210 extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes) | 260 PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes) |
| 261 #endif |
| 262 |
| 263 #ifndef PNG_INTERNAL_CALLBACK |
| 264 # define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\ |
| 265 PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\ |
| 266 PNG_EMPTY attributes) |
211 #endif | 267 #endif |
212 | 268 |
213 /* If floating or fixed point APIs are disabled they may still be compiled | 269 /* If floating or fixed point APIs are disabled they may still be compiled |
214 * internally. To handle this make sure they are declared as the appropriate | 270 * internally. To handle this make sure they are declared as the appropriate |
215 * internal extern function (otherwise the symbol prefixing stuff won't work and | 271 * internal extern function (otherwise the symbol prefixing stuff won't work and |
216 * the functions will be used without definitions.) | 272 * the functions will be used without definitions.) |
217 * | 273 * |
218 * NOTE: although all the API functions are declared here they are not all | 274 * NOTE: although all the API functions are declared here they are not all |
219 * actually built! Because the declarations are still made it is necessary to | 275 * actually built! Because the declarations are still made it is necessary to |
220 * fake out types that they depend on. | 276 * fake out types that they depend on. |
(...skipping 17 matching lines...) Expand all Loading... |
238 # endif | 294 # endif |
239 #endif | 295 #endif |
240 | 296 |
241 #include "png.h" | 297 #include "png.h" |
242 | 298 |
243 /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ | 299 /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ |
244 #ifndef PNG_DLL_EXPORT | 300 #ifndef PNG_DLL_EXPORT |
245 # define PNG_DLL_EXPORT | 301 # define PNG_DLL_EXPORT |
246 #endif | 302 #endif |
247 | 303 |
| 304 /* This is a global switch to set the compilation for an installed system |
| 305 * (a release build). It can be set for testing debug builds to ensure that |
| 306 * they will compile when the build type is switched to RC or STABLE, the |
| 307 * default is just to use PNG_LIBPNG_BUILD_BASE_TYPE. Set this in CPPFLAGS |
| 308 * with either: |
| 309 * |
| 310 * -DPNG_RELEASE_BUILD Turns on the release compile path |
| 311 * -DPNG_RELEASE_BUILD=0 Turns it off |
| 312 * or in your pngusr.h with |
| 313 * #define PNG_RELEASE_BUILD=1 Turns on the release compile path |
| 314 * #define PNG_RELEASE_BUILD=0 Turns it off |
| 315 */ |
| 316 #ifndef PNG_RELEASE_BUILD |
| 317 # define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC) |
| 318 #endif |
| 319 |
248 /* SECURITY and SAFETY: | 320 /* SECURITY and SAFETY: |
249 * | 321 * |
250 * By default libpng is built without any internal limits on image size, | 322 * libpng is built with support for internal limits on image dimensions and |
251 * individual heap (png_malloc) allocations or the total amount of memory used. | 323 * memory usage. These are documented in scripts/pnglibconf.dfa of the |
252 * If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used | 324 * source and recorded in the machine generated header file pnglibconf.h. |
253 * (unless individually overridden). These limits are believed to be fairly | |
254 * safe, but builders of secure systems should verify the values against the | |
255 * real system capabilities. | |
256 */ | |
257 #ifdef PNG_SAFE_LIMITS_SUPPORTED | |
258 /* 'safe' limits */ | |
259 # ifndef PNG_USER_WIDTH_MAX | |
260 # define PNG_USER_WIDTH_MAX 1000000 | |
261 # endif | |
262 # ifndef PNG_USER_HEIGHT_MAX | |
263 # define PNG_USER_HEIGHT_MAX 1000000 | |
264 # endif | |
265 # ifndef PNG_USER_CHUNK_CACHE_MAX | |
266 # define PNG_USER_CHUNK_CACHE_MAX 128 | |
267 # endif | |
268 # ifndef PNG_USER_CHUNK_MALLOC_MAX | |
269 # define PNG_USER_CHUNK_MALLOC_MAX 8000000 | |
270 # endif | |
271 #else | |
272 /* values for no limits */ | |
273 # ifndef PNG_USER_WIDTH_MAX | |
274 # define PNG_USER_WIDTH_MAX 0x7fffffff | |
275 # endif | |
276 # ifndef PNG_USER_HEIGHT_MAX | |
277 # define PNG_USER_HEIGHT_MAX 0x7fffffff | |
278 # endif | |
279 # ifndef PNG_USER_CHUNK_CACHE_MAX | |
280 # define PNG_USER_CHUNK_CACHE_MAX 0 | |
281 # endif | |
282 # ifndef PNG_USER_CHUNK_MALLOC_MAX | |
283 # define PNG_USER_CHUNK_MALLOC_MAX 0 | |
284 # endif | |
285 #endif | |
286 | |
287 /* Moved to pngpriv.h at libpng-1.5.0 */ | |
288 /* NOTE: some of these may have been used in external applications as | |
289 * these definitions were exposed in pngconf.h prior to 1.5. | |
290 */ | 325 */ |
291 | 326 |
292 /* If you are running on a machine where you cannot allocate more | 327 /* If you are running on a machine where you cannot allocate more |
293 * than 64K of memory at once, uncomment this. While libpng will not | 328 * than 64K of memory at once, uncomment this. While libpng will not |
294 * normally need that much memory in a chunk (unless you load up a very | 329 * normally need that much memory in a chunk (unless you load up a very |
295 * large file), zlib needs to know how big of a chunk it can use, and | 330 * large file), zlib needs to know how big of a chunk it can use, and |
296 * libpng thus makes sure to check any memory allocation to verify it | 331 * libpng thus makes sure to check any memory allocation to verify it |
297 * will fit into memory. | 332 * will fit into memory. |
298 * | 333 * |
299 * zlib provides 'MAXSEG_64K' which, if defined, indicates the | 334 * zlib provides 'MAXSEG_64K' which, if defined, indicates the |
(...skipping 22 matching lines...) Expand all Loading... |
322 # define PNG_ZBUF_SIZE 65536L | 357 # define PNG_ZBUF_SIZE 65536L |
323 #endif | 358 #endif |
324 | 359 |
325 /* If warnings or errors are turned off the code is disabled or redirected here. | 360 /* If warnings or errors are turned off the code is disabled or redirected here. |
326 * From 1.5.4 functions have been added to allow very limited formatting of | 361 * From 1.5.4 functions have been added to allow very limited formatting of |
327 * error and warning messages - this code will also be disabled here. | 362 * error and warning messages - this code will also be disabled here. |
328 */ | 363 */ |
329 #ifdef PNG_WARNINGS_SUPPORTED | 364 #ifdef PNG_WARNINGS_SUPPORTED |
330 # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p; | 365 # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p; |
331 #else | 366 #else |
332 # define png_warning(s1,s2) ((void)(s1)) | |
333 # define png_chunk_warning(s1,s2) ((void)(s1)) | |
334 # define png_warning_parameter(p,number,string) ((void)0) | 367 # define png_warning_parameter(p,number,string) ((void)0) |
335 # define png_warning_parameter_unsigned(p,number,format,value) ((void)0) | 368 # define png_warning_parameter_unsigned(p,number,format,value) ((void)0) |
336 # define png_warning_parameter_signed(p,number,format,value) ((void)0) | 369 # define png_warning_parameter_signed(p,number,format,value) ((void)0) |
337 # define png_formatted_warning(pp,p,message) ((void)(pp)) | 370 # define png_formatted_warning(pp,p,message) ((void)(pp)) |
338 # define PNG_WARNING_PARAMETERS(p) | 371 # define PNG_WARNING_PARAMETERS(p) |
339 #endif | 372 #endif |
340 #ifndef PNG_ERROR_TEXT_SUPPORTED | 373 #ifndef PNG_ERROR_TEXT_SUPPORTED |
341 # define png_error(s1,s2) png_err(s1) | |
342 # define png_chunk_error(s1,s2) png_err(s1) | |
343 # define png_fixed_error(s1,s2) png_err(s1) | 374 # define png_fixed_error(s1,s2) png_err(s1) |
344 #endif | 375 #endif |
345 | 376 |
346 /* C allows up-casts from (void*) to any pointer and (const void*) to any | 377 /* C allows up-casts from (void*) to any pointer and (const void*) to any |
347 * pointer to a const object. C++ regards this as a type error and requires an | 378 * pointer to a const object. C++ regards this as a type error and requires an |
348 * explicit, static, cast and provides the static_cast<> rune to ensure that | 379 * explicit, static, cast and provides the static_cast<> rune to ensure that |
349 * const is not cast away. | 380 * const is not cast away. |
350 */ | 381 */ |
351 #ifdef __cplusplus | 382 #ifdef __cplusplus |
352 # define png_voidcast(type, value) static_cast<type>(value) | 383 # define png_voidcast(type, value) static_cast<type>(value) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 #define PNG_FILLER 0x8000 | 557 #define PNG_FILLER 0x8000 |
527 #define PNG_PACKSWAP 0x10000 | 558 #define PNG_PACKSWAP 0x10000 |
528 #define PNG_SWAP_ALPHA 0x20000 | 559 #define PNG_SWAP_ALPHA 0x20000 |
529 #define PNG_STRIP_ALPHA 0x40000 | 560 #define PNG_STRIP_ALPHA 0x40000 |
530 #define PNG_INVERT_ALPHA 0x80000 | 561 #define PNG_INVERT_ALPHA 0x80000 |
531 #define PNG_USER_TRANSFORM 0x100000 | 562 #define PNG_USER_TRANSFORM 0x100000 |
532 #define PNG_RGB_TO_GRAY_ERR 0x200000 | 563 #define PNG_RGB_TO_GRAY_ERR 0x200000 |
533 #define PNG_RGB_TO_GRAY_WARN 0x400000 | 564 #define PNG_RGB_TO_GRAY_WARN 0x400000 |
534 #define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ | 565 #define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ |
535 #define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ | 566 #define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ |
536 #define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ | 567 #define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ |
537 #define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ | 568 #define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ |
538 #define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ | 569 #define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ |
539 /* 0x8000000 unused */ | 570 /* 0x8000000 unused */ |
540 /* 0x10000000 unused */ | 571 /* 0x10000000 unused */ |
541 /* 0x20000000 unused */ | 572 /* 0x20000000 unused */ |
542 /* 0x40000000 unused */ | 573 /* 0x40000000 unused */ |
543 /* Flags for png_create_struct */ | 574 /* Flags for png_create_struct */ |
544 #define PNG_STRUCT_PNG 0x0001 | 575 #define PNG_STRUCT_PNG 0x0001 |
545 #define PNG_STRUCT_INFO 0x0002 | 576 #define PNG_STRUCT_INFO 0x0002 |
546 | 577 |
547 /* Scaling factor for filter heuristic weighting calculations */ | |
548 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) | |
549 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) | |
550 | |
551 /* Flags for the png_ptr->flags rather than declaring a byte for each one */ | 578 /* Flags for the png_ptr->flags rather than declaring a byte for each one */ |
552 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 | 579 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 |
553 #define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */ | 580 #define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */ |
554 /* 0x0004 unused */ | 581 /* 0x0004 unused */ |
555 #define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */ | 582 #define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */ |
556 /* 0x0010 unused */ | 583 /* 0x0010 unused */ |
557 /* 0x0020 unused */ | 584 /* 0x0020 unused */ |
558 #define PNG_FLAG_ROW_INIT 0x0040 | 585 #define PNG_FLAG_ROW_INIT 0x0040 |
559 #define PNG_FLAG_FILLER_AFTER 0x0080 | 586 #define PNG_FLAG_FILLER_AFTER 0x0080 |
560 #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 | 587 #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 * In practice this doesn't matter because png_fixed_point only | 658 * In practice this doesn't matter because png_fixed_point only |
632 * stores numbers with very low precision. The png_ptr and s | 659 * stores numbers with very low precision. The png_ptr and s |
633 * arguments are unused by default but are there in case error | 660 * arguments are unused by default but are there in case error |
634 * checking becomes a requirement. | 661 * checking becomes a requirement. |
635 */ | 662 */ |
636 #define png_float(png_ptr, fixed, s) (.00001 * (fixed)) | 663 #define png_float(png_ptr, fixed, s) (.00001 * (fixed)) |
637 | 664 |
638 /* The fixed point conversion performs range checking and evaluates | 665 /* The fixed point conversion performs range checking and evaluates |
639 * its argument multiple times, so must be used with care. The | 666 * its argument multiple times, so must be used with care. The |
640 * range checking uses the PNG specification values for a signed | 667 * range checking uses the PNG specification values for a signed |
641 * 32 bit fixed point value except that the values are deliberately | 668 * 32-bit fixed point value except that the values are deliberately |
642 * rounded-to-zero to an integral value - 21474 (21474.83 is roughly | 669 * rounded-to-zero to an integral value - 21474 (21474.83 is roughly |
643 * (2^31-1) * 100000). 's' is a string that describes the value being | 670 * (2^31-1) * 100000). 's' is a string that describes the value being |
644 * converted. | 671 * converted. |
645 * | 672 * |
646 * NOTE: this macro will raise a png_error if the range check fails, | 673 * NOTE: this macro will raise a png_error if the range check fails, |
647 * therefore it is normally only appropriate to use this on values | 674 * therefore it is normally only appropriate to use this on values |
648 * that come from API calls or other sources where an out of range | 675 * that come from API calls or other sources where an out of range |
649 * error indicates a programming error, not a data error! | 676 * error indicates a programming error, not a data error! |
650 * | 677 * |
651 * NOTE: by default this is off - the macro is not used - because the | 678 * NOTE: by default this is off - the macro is not used - because the |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 #define png_sTER PNG_U32(115, 84, 69, 82) | 751 #define png_sTER PNG_U32(115, 84, 69, 82) |
725 #define png_tEXt PNG_U32(116, 69, 88, 116) | 752 #define png_tEXt PNG_U32(116, 69, 88, 116) |
726 #define png_tIME PNG_U32(116, 73, 77, 69) | 753 #define png_tIME PNG_U32(116, 73, 77, 69) |
727 #define png_tRNS PNG_U32(116, 82, 78, 83) | 754 #define png_tRNS PNG_U32(116, 82, 78, 83) |
728 #define png_zTXt PNG_U32(122, 84, 88, 116) | 755 #define png_zTXt PNG_U32(122, 84, 88, 116) |
729 | 756 |
730 /* The following will work on (signed char*) strings, whereas the get_uint_32 | 757 /* The following will work on (signed char*) strings, whereas the get_uint_32 |
731 * macro will fail on top-bit-set values because of the sign extension. | 758 * macro will fail on top-bit-set values because of the sign extension. |
732 */ | 759 */ |
733 #define PNG_CHUNK_FROM_STRING(s)\ | 760 #define PNG_CHUNK_FROM_STRING(s)\ |
734 PNG_U32(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3]) | 761 PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3]) |
735 | 762 |
736 /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is | 763 /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is |
737 * signed and the argument is a (char[]) This macro will fail miserably on | 764 * signed and the argument is a (char[]) This macro will fail miserably on |
738 * systems where (char) is more than 8 bits. | 765 * systems where (char) is more than 8 bits. |
739 */ | 766 */ |
740 #define PNG_STRING_FROM_CHUNK(s,c)\ | 767 #define PNG_STRING_FROM_CHUNK(s,c)\ |
741 (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\ | 768 (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \ |
742 ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c))) | 769 ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\ |
| 770 ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \ |
| 771 ((char*)(s))[3]=(char)((c & 0xff))) |
743 | 772 |
744 /* Do the same but terminate with a null character. */ | 773 /* Do the same but terminate with a null character. */ |
745 #define PNG_CSTRING_FROM_CHUNK(s,c)\ | 774 #define PNG_CSTRING_FROM_CHUNK(s,c)\ |
746 (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0) | 775 (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0) |
747 | 776 |
748 /* Test on flag values as defined in the spec (section 5.4): */ | 777 /* Test on flag values as defined in the spec (section 5.4): */ |
749 #define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29)) | 778 #define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29)) |
750 #define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c)) | 779 #define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c)) |
751 #define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21)) | 780 #define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21)) |
752 #define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13)) | 781 #define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13)) |
(...skipping 17 matching lines...) Expand all Loading... |
770 */ | 799 */ |
771 #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM | 800 #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM |
772 # error ZLIB_VERNUM != PNG_ZLIB_VERNUM \ | 801 # error ZLIB_VERNUM != PNG_ZLIB_VERNUM \ |
773 "-I (include path) error: see the notes in pngpriv.h" | 802 "-I (include path) error: see the notes in pngpriv.h" |
774 /* This means that when pnglibconf.h was built the copy of zlib.h that it | 803 /* This means that when pnglibconf.h was built the copy of zlib.h that it |
775 * used is not the same as the one being used here. Because the build of | 804 * used is not the same as the one being used here. Because the build of |
776 * libpng makes decisions to use inflateInit2 and inflateReset2 based on the | 805 * libpng makes decisions to use inflateInit2 and inflateReset2 based on the |
777 * zlib version number and because this affects handling of certain broken | 806 * zlib version number and because this affects handling of certain broken |
778 * PNG files the -I directives must match. | 807 * PNG files the -I directives must match. |
779 * | 808 * |
780 * The most likely explanation is that you passed a -I in CFLAGS, this will | 809 * The most likely explanation is that you passed a -I in CFLAGS. This will |
781 * not work; all the preprocessor directories and in particular all the -I | 810 * not work; all the preprocessor directories and in particular all the -I |
782 * directives must be in CPPFLAGS. | 811 * directives must be in CPPFLAGS. |
783 */ | 812 */ |
784 #endif | 813 #endif |
785 | 814 |
786 /* This is used for 16 bit gamma tables -- only the top level pointers are | 815 /* This is used for 16-bit gamma tables -- only the top level pointers are |
787 * const; this could be changed: | 816 * const; this could be changed: |
788 */ | 817 */ |
789 typedef const png_uint_16p * png_const_uint_16pp; | 818 typedef const png_uint_16p * png_const_uint_16pp; |
790 | 819 |
791 /* Added to libpng-1.5.7: sRGB conversion tables */ | 820 /* Added to libpng-1.5.7: sRGB conversion tables */ |
792 #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\ | 821 #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\ |
793 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) | 822 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) |
794 #ifdef PNG_SIMPLIFIED_READ_SUPPORTED | 823 #ifdef PNG_SIMPLIFIED_READ_SUPPORTED |
795 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]); | 824 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]); |
796 /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value, | 825 /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value, |
797 * 0..65535. This table gives the closest 16-bit answers (no errors). | 826 * 0..65535. This table gives the closest 16-bit answers (no errors). |
798 */ | 827 */ |
799 #endif | 828 #endif |
800 | 829 |
801 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]); | 830 PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]); |
802 PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]); | 831 PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]); |
803 | 832 |
804 #define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\ | 833 #define PNG_sRGB_FROM_LINEAR(linear) \ |
805 ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)) | 834 ((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \ |
| 835 + ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))) |
806 /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB | 836 /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB |
807 * encoded value with maximum error 0.646365. Note that the input is not a | 837 * encoded value with maximum error 0.646365. Note that the input is not a |
808 * 16-bit value; it has been multiplied by 255! */ | 838 * 16-bit value; it has been multiplied by 255! */ |
809 #endif /* PNG_SIMPLIFIED_READ/WRITE */ | 839 #endif /* SIMPLIFIED_READ/WRITE */ |
810 | 840 |
811 | 841 |
812 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ | 842 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ |
813 #ifdef __cplusplus | 843 #ifdef __cplusplus |
814 extern "C" { | 844 extern "C" { |
815 #endif /* __cplusplus */ | 845 #endif /* __cplusplus */ |
816 | 846 |
817 /* Internal functions; these are not exported from a DLL however because they | 847 /* Internal functions; these are not exported from a DLL however because they |
818 * are used within several of the C source files they have to be C extern. | 848 * are used within several of the C source files they have to be C extern. |
819 * | 849 * |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 /* Internal base allocator - no messages, NULL on failure to allocate. This | 884 /* Internal base allocator - no messages, NULL on failure to allocate. This |
855 * does, however, call the application provided allocator and that could call | 885 * does, however, call the application provided allocator and that could call |
856 * png_error (although that would be a bug in the application implementation.) | 886 * png_error (although that would be a bug in the application implementation.) |
857 */ | 887 */ |
858 PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr, | 888 PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr, |
859 png_alloc_size_t size),PNG_ALLOCATED); | 889 png_alloc_size_t size),PNG_ALLOCATED); |
860 | 890 |
861 #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\ | 891 #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\ |
862 defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) | 892 defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) |
863 /* Internal array allocator, outputs no error or warning messages on failure, | 893 /* Internal array allocator, outputs no error or warning messages on failure, |
864 * just returns NULL. | 894 * just returns NULL. |
865 */ | 895 */ |
866 PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr, | 896 PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr, |
867 int nelements, size_t element_size),PNG_ALLOCATED); | 897 int nelements, size_t element_size),PNG_ALLOCATED); |
868 | 898 |
869 /* The same but an existing array is extended by add_elements. This function | 899 /* The same but an existing array is extended by add_elements. This function |
870 * also memsets the new elements to 0 and copies the old elements. The old | 900 * also memsets the new elements to 0 and copies the old elements. The old |
871 * array is not freed or altered. | 901 * array is not freed or altered. |
872 */ | 902 */ |
873 PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr, | 903 PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr, |
874 png_const_voidp array, int old_elements, int add_elements, | 904 png_const_voidp array, int old_elements, int add_elements, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 #endif | 1064 #endif |
1035 | 1065 |
1036 /* Chunks that have keywords */ | 1066 /* Chunks that have keywords */ |
1037 #ifdef PNG_WRITE_tEXt_SUPPORTED | 1067 #ifdef PNG_WRITE_tEXt_SUPPORTED |
1038 PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr, | 1068 PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr, |
1039 png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY); | 1069 png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY); |
1040 #endif | 1070 #endif |
1041 | 1071 |
1042 #ifdef PNG_WRITE_zTXt_SUPPORTED | 1072 #ifdef PNG_WRITE_zTXt_SUPPORTED |
1043 PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp | 1073 PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp |
1044 key, png_const_charp text, png_size_t text_len, int compression),PNG_EMPTY); | 1074 key, png_const_charp text, int compression),PNG_EMPTY); |
1045 #endif | 1075 #endif |
1046 | 1076 |
1047 #ifdef PNG_WRITE_iTXt_SUPPORTED | 1077 #ifdef PNG_WRITE_iTXt_SUPPORTED |
1048 PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr, | 1078 PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr, |
1049 int compression, png_const_charp key, png_const_charp lang, | 1079 int compression, png_const_charp key, png_const_charp lang, |
1050 png_const_charp lang_key, png_const_charp text),PNG_EMPTY); | 1080 png_const_charp lang_key, png_const_charp text),PNG_EMPTY); |
1051 #endif | 1081 #endif |
1052 | 1082 |
1053 #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ | 1083 #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ |
1054 PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr, | 1084 PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 */ | 1203 */ |
1174 PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr), | 1204 PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr), |
1175 PNG_EMPTY); | 1205 PNG_EMPTY); |
1176 /* This cleans up when the IDAT LZ stream does not end when the last image | 1206 /* This cleans up when the IDAT LZ stream does not end when the last image |
1177 * byte is read; there is still some pending input. | 1207 * byte is read; there is still some pending input. |
1178 */ | 1208 */ |
1179 | 1209 |
1180 PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr), | 1210 PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr), |
1181 PNG_EMPTY); | 1211 PNG_EMPTY); |
1182 /* Finish a row while reading, dealing with interlacing passes, etc. */ | 1212 /* Finish a row while reading, dealing with interlacing passes, etc. */ |
1183 #endif | 1213 #endif /* SEQUENTIAL_READ */ |
1184 | 1214 |
1185 /* Initialize the row buffers, etc. */ | 1215 /* Initialize the row buffers, etc. */ |
1186 PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY); | 1216 PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY); |
1187 | 1217 |
| 1218 #if PNG_ZLIB_VERNUM >= 0x1240 |
| 1219 PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush), |
| 1220 PNG_EMPTY); |
| 1221 # define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush) |
| 1222 #else /* Zlib < 1.2.4 */ |
| 1223 # define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush) |
| 1224 #endif /* Zlib < 1.2.4 */ |
| 1225 |
1188 #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 1226 #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
1189 /* Optional call to update the users info structure */ | 1227 /* Optional call to update the users info structure */ |
1190 PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr, | 1228 PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr, |
1191 png_inforp info_ptr),PNG_EMPTY); | 1229 png_inforp info_ptr),PNG_EMPTY); |
1192 #endif | 1230 #endif |
1193 | 1231 |
1194 /* These are the functions that do the transformations */ | 1232 /* Shared transform functions, defined in pngtran.c */ |
1195 #ifdef PNG_READ_FILLER_SUPPORTED | |
1196 PNG_INTERNAL_FUNCTION(void,png_do_read_filler,(png_row_infop row_info, | |
1197 png_bytep row, png_uint_32 filler, png_uint_32 flags),PNG_EMPTY); | |
1198 #endif | |
1199 | |
1200 #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED | |
1201 PNG_INTERNAL_FUNCTION(void,png_do_read_swap_alpha,(png_row_infop row_info, | |
1202 png_bytep row),PNG_EMPTY); | |
1203 #endif | |
1204 | |
1205 #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED | |
1206 PNG_INTERNAL_FUNCTION(void,png_do_write_swap_alpha,(png_row_infop row_info, | |
1207 png_bytep row),PNG_EMPTY); | |
1208 #endif | |
1209 | |
1210 #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED | |
1211 PNG_INTERNAL_FUNCTION(void,png_do_read_invert_alpha,(png_row_infop row_info, | |
1212 png_bytep row),PNG_EMPTY); | |
1213 #endif | |
1214 | |
1215 #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED | |
1216 PNG_INTERNAL_FUNCTION(void,png_do_write_invert_alpha,(png_row_infop row_info, | |
1217 png_bytep row),PNG_EMPTY); | |
1218 #endif | |
1219 | |
1220 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ | 1233 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ |
1221 defined(PNG_READ_STRIP_ALPHA_SUPPORTED) | 1234 defined(PNG_READ_STRIP_ALPHA_SUPPORTED) |
1222 PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info, | 1235 PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info, |
1223 png_bytep row, int at_start),PNG_EMPTY); | 1236 png_bytep row, int at_start),PNG_EMPTY); |
1224 #endif | 1237 #endif |
1225 | 1238 |
1226 #ifdef PNG_16BIT_SUPPORTED | 1239 #ifdef PNG_16BIT_SUPPORTED |
1227 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) | 1240 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
1228 PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info, | 1241 PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info, |
1229 png_bytep row),PNG_EMPTY); | 1242 png_bytep row),PNG_EMPTY); |
1230 #endif | 1243 #endif |
1231 #endif | 1244 #endif |
1232 | 1245 |
1233 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ | 1246 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ |
1234 defined(PNG_WRITE_PACKSWAP_SUPPORTED) | 1247 defined(PNG_WRITE_PACKSWAP_SUPPORTED) |
1235 PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info, | 1248 PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info, |
1236 png_bytep row),PNG_EMPTY); | 1249 png_bytep row),PNG_EMPTY); |
1237 #endif | 1250 #endif |
1238 | 1251 |
1239 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED | |
1240 PNG_INTERNAL_FUNCTION(int,png_do_rgb_to_gray,(png_structrp png_ptr, | |
1241 png_row_infop row_info, png_bytep row),PNG_EMPTY); | |
1242 #endif | |
1243 | |
1244 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED | |
1245 PNG_INTERNAL_FUNCTION(void,png_do_gray_to_rgb,(png_row_infop row_info, | |
1246 png_bytep row),PNG_EMPTY); | |
1247 #endif | |
1248 | |
1249 #ifdef PNG_READ_PACK_SUPPORTED | |
1250 PNG_INTERNAL_FUNCTION(void,png_do_unpack,(png_row_infop row_info, | |
1251 png_bytep row),PNG_EMPTY); | |
1252 #endif | |
1253 | |
1254 #ifdef PNG_READ_SHIFT_SUPPORTED | |
1255 PNG_INTERNAL_FUNCTION(void,png_do_unshift,(png_row_infop row_info, | |
1256 png_bytep row, png_const_color_8p sig_bits),PNG_EMPTY); | |
1257 #endif | |
1258 | |
1259 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) | 1252 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
1260 PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info, | 1253 PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info, |
1261 png_bytep row),PNG_EMPTY); | 1254 png_bytep row),PNG_EMPTY); |
1262 #endif | 1255 #endif |
1263 | 1256 |
1264 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED | |
1265 PNG_INTERNAL_FUNCTION(void,png_do_scale_16_to_8,(png_row_infop row_info, | |
1266 png_bytep row),PNG_EMPTY); | |
1267 #endif | |
1268 | |
1269 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED | |
1270 PNG_INTERNAL_FUNCTION(void,png_do_chop,(png_row_infop row_info, | |
1271 png_bytep row),PNG_EMPTY); | |
1272 #endif | |
1273 | |
1274 #ifdef PNG_READ_QUANTIZE_SUPPORTED | |
1275 PNG_INTERNAL_FUNCTION(void,png_do_quantize,(png_row_infop row_info, | |
1276 png_bytep row, png_const_bytep palette_lookup, | |
1277 png_const_bytep quantize_lookup),PNG_EMPTY); | |
1278 | |
1279 # ifdef PNG_CORRECT_PALETTE_SUPPORTED | |
1280 PNG_INTERNAL_FUNCTION(void,png_correct_palette,(png_structrp png_ptr, | |
1281 png_colorp palette, int num_palette),PNG_EMPTY); | |
1282 # endif | |
1283 #endif | |
1284 | |
1285 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) | 1257 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) |
1286 PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info, | 1258 PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info, |
1287 png_bytep row),PNG_EMPTY); | 1259 png_bytep row),PNG_EMPTY); |
1288 #endif | 1260 #endif |
1289 | 1261 |
1290 #ifdef PNG_WRITE_PACK_SUPPORTED | |
1291 PNG_INTERNAL_FUNCTION(void,png_do_pack,(png_row_infop row_info, | |
1292 png_bytep row, png_uint_32 bit_depth),PNG_EMPTY); | |
1293 #endif | |
1294 | |
1295 #ifdef PNG_WRITE_SHIFT_SUPPORTED | |
1296 PNG_INTERNAL_FUNCTION(void,png_do_shift,(png_row_infop row_info, | |
1297 png_bytep row, png_const_color_8p bit_depth),PNG_EMPTY); | |
1298 #endif | |
1299 | |
1300 #if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\ | |
1301 defined(PNG_READ_ALPHA_MODE_SUPPORTED) | |
1302 PNG_INTERNAL_FUNCTION(void,png_do_compose,(png_row_infop row_info, | |
1303 png_bytep row, png_structrp png_ptr),PNG_EMPTY); | |
1304 #endif | |
1305 | |
1306 #ifdef PNG_READ_GAMMA_SUPPORTED | |
1307 PNG_INTERNAL_FUNCTION(void,png_do_gamma,(png_row_infop row_info, | |
1308 png_bytep row, png_structrp png_ptr),PNG_EMPTY); | |
1309 #endif | |
1310 | |
1311 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED | |
1312 PNG_INTERNAL_FUNCTION(void,png_do_encode_alpha,(png_row_infop row_info, | |
1313 png_bytep row, png_structrp png_ptr),PNG_EMPTY); | |
1314 #endif | |
1315 | |
1316 #ifdef PNG_READ_EXPAND_SUPPORTED | |
1317 PNG_INTERNAL_FUNCTION(void,png_do_expand_palette,(png_row_infop row_info, | |
1318 png_bytep row, png_const_colorp palette, png_const_bytep trans, | |
1319 int num_trans),PNG_EMPTY); | |
1320 PNG_INTERNAL_FUNCTION(void,png_do_expand,(png_row_infop row_info, | |
1321 png_bytep row, png_const_color_16p trans_color),PNG_EMPTY); | |
1322 #endif | |
1323 | |
1324 #ifdef PNG_READ_EXPAND_16_SUPPORTED | |
1325 PNG_INTERNAL_FUNCTION(void,png_do_expand_16,(png_row_infop row_info, | |
1326 png_bytep row),PNG_EMPTY); | |
1327 #endif | |
1328 | |
1329 /* The following decodes the appropriate chunks, and does error correction, | 1262 /* The following decodes the appropriate chunks, and does error correction, |
1330 * then calls the appropriate callback for the chunk if it is valid. | 1263 * then calls the appropriate callback for the chunk if it is valid. |
1331 */ | 1264 */ |
1332 | 1265 |
1333 /* Decode the IHDR chunk */ | 1266 /* Decode the IHDR chunk */ |
1334 PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr, | 1267 PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr, |
1335 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1268 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1336 PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr, | 1269 PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr, |
1337 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1270 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1338 PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr, | 1271 PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr, |
(...skipping 15 matching lines...) Expand all Loading... |
1354 #endif | 1287 #endif |
1355 | 1288 |
1356 #ifdef PNG_READ_hIST_SUPPORTED | 1289 #ifdef PNG_READ_hIST_SUPPORTED |
1357 PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr, | 1290 PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr, |
1358 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1291 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1359 #endif | 1292 #endif |
1360 | 1293 |
1361 #ifdef PNG_READ_iCCP_SUPPORTED | 1294 #ifdef PNG_READ_iCCP_SUPPORTED |
1362 PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr, | 1295 PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr, |
1363 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1296 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1364 #endif /* PNG_READ_iCCP_SUPPORTED */ | 1297 #endif /* READ_iCCP */ |
1365 | 1298 |
1366 #ifdef PNG_READ_iTXt_SUPPORTED | 1299 #ifdef PNG_READ_iTXt_SUPPORTED |
1367 PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr, | 1300 PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr, |
1368 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1301 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1369 #endif | 1302 #endif |
1370 | 1303 |
1371 #ifdef PNG_READ_oFFs_SUPPORTED | 1304 #ifdef PNG_READ_oFFs_SUPPORTED |
1372 PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr, | 1305 PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr, |
1373 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1306 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1374 #endif | 1307 #endif |
(...skipping 14 matching lines...) Expand all Loading... |
1389 #endif | 1322 #endif |
1390 | 1323 |
1391 #ifdef PNG_READ_sCAL_SUPPORTED | 1324 #ifdef PNG_READ_sCAL_SUPPORTED |
1392 PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr, | 1325 PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr, |
1393 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1326 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1394 #endif | 1327 #endif |
1395 | 1328 |
1396 #ifdef PNG_READ_sPLT_SUPPORTED | 1329 #ifdef PNG_READ_sPLT_SUPPORTED |
1397 PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr, | 1330 PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr, |
1398 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1331 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1399 #endif /* PNG_READ_sPLT_SUPPORTED */ | 1332 #endif /* READ_sPLT */ |
1400 | 1333 |
1401 #ifdef PNG_READ_sRGB_SUPPORTED | 1334 #ifdef PNG_READ_sRGB_SUPPORTED |
1402 PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr, | 1335 PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr, |
1403 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1336 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1404 #endif | 1337 #endif |
1405 | 1338 |
1406 #ifdef PNG_READ_tEXt_SUPPORTED | 1339 #ifdef PNG_READ_tEXt_SUPPORTED |
1407 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr, | 1340 PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr, |
1408 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1341 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1409 #endif | 1342 #endif |
1410 | 1343 |
1411 #ifdef PNG_READ_tIME_SUPPORTED | 1344 #ifdef PNG_READ_tIME_SUPPORTED |
1412 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr, | 1345 PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr, |
1413 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1346 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1414 #endif | 1347 #endif |
1415 | 1348 |
1416 #ifdef PNG_READ_tRNS_SUPPORTED | 1349 #ifdef PNG_READ_tRNS_SUPPORTED |
1417 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr, | 1350 PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr, |
1418 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1351 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1419 #endif | 1352 #endif |
1420 | 1353 |
1421 #ifdef PNG_READ_zTXt_SUPPORTED | 1354 #ifdef PNG_READ_zTXt_SUPPORTED |
1422 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, | 1355 PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, |
1423 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1356 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1424 #endif | 1357 #endif |
1425 | 1358 |
1426 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, | 1359 PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, |
1427 png_uint_32 chunk_name),PNG_EMPTY); | 1360 png_uint_32 chunk_name),PNG_EMPTY); |
1428 | 1361 |
1429 #ifdef PNG_READ_SUPPORTED | |
1430 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, | 1362 PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, |
1431 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); | 1363 png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); |
1432 /* This is the function that gets called for unknown chunks. The 'keep' | 1364 /* This is the function that gets called for unknown chunks. The 'keep' |
1433 * argument is either non-zero for a known chunk that has been set to be | 1365 * argument is either non-zero for a known chunk that has been set to be |
1434 * handled as unknown or zero for an unknown chunk. By default the function | 1366 * handled as unknown or zero for an unknown chunk. By default the function |
1435 * just skips the chunk or errors out if it is critical. | 1367 * just skips the chunk or errors out if it is critical. |
1436 */ | 1368 */ |
1437 | 1369 |
1438 #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED | 1370 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\ |
1439 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED | 1371 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) |
1440 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, | 1372 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, |
1441 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY); | 1373 (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY); |
1442 /* Exactly as the API png_handle_as_unknown() except that the argument is a | 1374 /* Exactly as the API png_handle_as_unknown() except that the argument is a |
1443 * 32-bit chunk name, not a string. | 1375 * 32-bit chunk name, not a string. |
1444 */ | 1376 */ |
1445 #endif | 1377 #endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */ |
1446 #endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */ | |
1447 #endif /* PNG_READ_SUPPORTED */ | |
1448 | 1378 |
1449 /* Handle the transformations for reading and writing */ | 1379 /* Handle the transformations for reading and writing */ |
1450 #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 1380 #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
1451 PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr, | 1381 PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr, |
1452 png_row_infop row_info),PNG_EMPTY); | 1382 png_row_infop row_info),PNG_EMPTY); |
1453 #endif | 1383 #endif |
1454 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED | 1384 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED |
1455 PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr, | 1385 PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr, |
1456 png_row_infop row_info),PNG_EMPTY); | 1386 png_row_infop row_info),PNG_EMPTY); |
1457 #endif | 1387 #endif |
1458 | 1388 |
1459 #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 1389 #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
1460 PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr), | 1390 PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr), |
1461 PNG_EMPTY); | 1391 PNG_EMPTY); |
1462 #endif | 1392 #endif |
1463 | 1393 |
1464 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | 1394 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
1465 PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr, | 1395 PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr, |
1466 png_inforp info_ptr),PNG_EMPTY); | 1396 png_inforp info_ptr),PNG_EMPTY); |
1467 PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr, | 1397 PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr, |
1468 png_inforp info_ptr),PNG_EMPTY); | 1398 png_inforp info_ptr),PNG_EMPTY); |
1469 PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY); | 1399 PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY); |
1470 PNG_INTERNAL_FUNCTION(void,png_push_crc_skip,(png_structrp png_ptr, | |
1471 png_uint_32 length),PNG_EMPTY); | |
1472 PNG_INTERNAL_FUNCTION(void,png_push_crc_finish,(png_structrp png_ptr), | |
1473 PNG_EMPTY); | |
1474 PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr), | 1400 PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr), |
1475 PNG_EMPTY); | 1401 PNG_EMPTY); |
1476 PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr, | 1402 PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr, |
1477 png_bytep buffer, png_size_t buffer_length),PNG_EMPTY); | 1403 png_bytep buffer, png_size_t buffer_length),PNG_EMPTY); |
1478 PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY); | 1404 PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY); |
1479 PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr, | 1405 PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr, |
1480 png_bytep buffer, png_size_t buffer_length),PNG_EMPTY); | 1406 png_bytep buffer, png_size_t buffer_length),PNG_EMPTY); |
1481 PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr), | 1407 PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr), |
1482 PNG_EMPTY); | 1408 PNG_EMPTY); |
1483 PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr, | 1409 PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr, |
(...skipping 22 matching lines...) Expand all Loading... |
1506 PNG_INTERNAL_FUNCTION(void,png_push_read_zTXt,(png_structrp png_ptr, | 1432 PNG_INTERNAL_FUNCTION(void,png_push_read_zTXt,(png_structrp png_ptr, |
1507 png_inforp info_ptr),PNG_EMPTY); | 1433 png_inforp info_ptr),PNG_EMPTY); |
1508 # endif | 1434 # endif |
1509 # ifdef PNG_READ_iTXt_SUPPORTED | 1435 # ifdef PNG_READ_iTXt_SUPPORTED |
1510 PNG_INTERNAL_FUNCTION(void,png_push_handle_iTXt,(png_structrp png_ptr, | 1436 PNG_INTERNAL_FUNCTION(void,png_push_handle_iTXt,(png_structrp png_ptr, |
1511 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); | 1437 png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); |
1512 PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr, | 1438 PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr, |
1513 png_inforp info_ptr),PNG_EMPTY); | 1439 png_inforp info_ptr),PNG_EMPTY); |
1514 # endif | 1440 # endif |
1515 | 1441 |
1516 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ | 1442 #endif /* PROGRESSIVE_READ */ |
1517 | |
1518 #ifdef PNG_MNG_FEATURES_SUPPORTED | |
1519 PNG_INTERNAL_FUNCTION(void,png_do_read_intrapixel,(png_row_infop row_info, | |
1520 png_bytep row),PNG_EMPTY); | |
1521 PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info, | |
1522 png_bytep row),PNG_EMPTY); | |
1523 #endif | |
1524 | 1443 |
1525 /* Added at libpng version 1.6.0 */ | 1444 /* Added at libpng version 1.6.0 */ |
1526 #ifdef PNG_GAMMA_SUPPORTED | 1445 #ifdef PNG_GAMMA_SUPPORTED |
1527 PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr, | 1446 PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr, |
1528 png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY); | 1447 png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY); |
1529 /* Set the colorspace gamma with a value provided by the application or by | 1448 /* Set the colorspace gamma with a value provided by the application or by |
1530 * the gAMA chunk on read. The value will override anything set by an ICC | 1449 * the gAMA chunk on read. The value will override anything set by an ICC |
1531 * profile. | 1450 * profile. |
1532 */ | 1451 */ |
1533 | 1452 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 /* This is the same but it checks a complete string and returns true | 1775 /* This is the same but it checks a complete string and returns true |
1857 * only if it just contains a floating point number. As of 1.5.4 this | 1776 * only if it just contains a floating point number. As of 1.5.4 this |
1858 * function also returns the state at the end of parsing the number if | 1777 * function also returns the state at the end of parsing the number if |
1859 * it was valid (otherwise it returns 0.) This can be used for testing | 1778 * it was valid (otherwise it returns 0.) This can be used for testing |
1860 * for negative or zero values using the sticky flag. | 1779 * for negative or zero values using the sticky flag. |
1861 */ | 1780 */ |
1862 PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string, | 1781 PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string, |
1863 png_size_t size),PNG_EMPTY); | 1782 png_size_t size),PNG_EMPTY); |
1864 #endif /* pCAL || sCAL */ | 1783 #endif /* pCAL || sCAL */ |
1865 | 1784 |
1866 #if defined(PNG_READ_GAMMA_SUPPORTED) ||\ | 1785 #if defined(PNG_GAMMA_SUPPORTED) ||\ |
1867 defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED) | 1786 defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED) |
1868 /* Added at libpng version 1.5.0 */ | 1787 /* Added at libpng version 1.5.0 */ |
1869 /* This is a utility to provide a*times/div (rounded) and indicate | 1788 /* This is a utility to provide a*times/div (rounded) and indicate |
1870 * if there is an overflow. The result is a boolean - false (0) | 1789 * if there is an overflow. The result is a boolean - false (0) |
1871 * for overflow, true (1) if no overflow, in which case *res | 1790 * for overflow, true (1) if no overflow, in which case *res |
1872 * holds the result. | 1791 * holds the result. |
1873 */ | 1792 */ |
1874 PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a, | 1793 PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a, |
1875 png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY); | 1794 png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY); |
1876 #endif | 1795 #endif |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 #ifdef __cplusplus | 1866 #ifdef __cplusplus |
1948 # define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0]) | 1867 # define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0]) |
1949 #else | 1868 #else |
1950 # define png_control_jmp_buf(pc) ((pc)->error_buf) | 1869 # define png_control_jmp_buf(pc) ((pc)->error_buf) |
1951 #endif | 1870 #endif |
1952 | 1871 |
1953 /* Utility to safely execute a piece of libpng code catching and logging any | 1872 /* Utility to safely execute a piece of libpng code catching and logging any |
1954 * errors that might occur. Returns true on success, false on failure (either | 1873 * errors that might occur. Returns true on success, false on failure (either |
1955 * of the function or as a result of a png_error.) | 1874 * of the function or as a result of a png_error.) |
1956 */ | 1875 */ |
1957 PNG_INTERNAL_FUNCTION(void,png_safe_error,(png_structp png_ptr, | 1876 PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr, |
1958 png_const_charp error_message),PNG_NORETURN); | 1877 png_const_charp error_message),PNG_NORETURN); |
1959 | 1878 |
1960 #ifdef PNG_WARNINGS_SUPPORTED | 1879 #ifdef PNG_WARNINGS_SUPPORTED |
1961 PNG_INTERNAL_FUNCTION(void,png_safe_warning,(png_structp png_ptr, | 1880 PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr, |
1962 png_const_charp warning_message),PNG_EMPTY); | 1881 png_const_charp warning_message),PNG_EMPTY); |
1963 #else | 1882 #else |
1964 # define png_safe_warning 0/*dummy argument*/ | 1883 # define png_safe_warning 0/*dummy argument*/ |
1965 #endif | 1884 #endif |
1966 | 1885 |
1967 PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image, | 1886 PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image, |
1968 int (*function)(png_voidp), png_voidp arg),PNG_EMPTY); | 1887 int (*function)(png_voidp), png_voidp arg),PNG_EMPTY); |
1969 | 1888 |
1970 /* Utility to log an error; this also cleans up the png_image; the function | 1889 /* Utility to log an error; this also cleans up the png_image; the function |
1971 * always returns 0 (false). | 1890 * always returns 0 (false). |
(...skipping 29 matching lines...) Expand all Loading... |
2001 /* Maintainer: Put new private prototypes here ^ */ | 1920 /* Maintainer: Put new private prototypes here ^ */ |
2002 | 1921 |
2003 #include "pngdebug.h" | 1922 #include "pngdebug.h" |
2004 | 1923 |
2005 #ifdef __cplusplus | 1924 #ifdef __cplusplus |
2006 } | 1925 } |
2007 #endif | 1926 #endif |
2008 | 1927 |
2009 #endif /* PNG_VERSION_INFO_ONLY */ | 1928 #endif /* PNG_VERSION_INFO_ONLY */ |
2010 #endif /* PNGPRIV_H */ | 1929 #endif /* PNGPRIV_H */ |
OLD | NEW |