Show
Ignore:
Timestamp:
02/15/10 11:56:43 (2 years ago)
Author:
Carsten
Message:

Merged latest libpng upgrade in vendor/libpng to cafu/trunk/ExtLibs/libpng.

Note that this implements the "Vendor Branches" strategy described in the Subversion book at
 http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html
 http://svnbook.red-bean.com/nightly/en/svn.advanced.vendorbr.html

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/ExtLibs/libpng/pngerror.c

    r11 r44  
    22/* pngerror.c - stub functions for i/o and memory allocation 
    33 * 
    4  * Last changed in libpng 1.2.37 [June 4, 2009] 
     4 * Last changed in libpng 1.2.41 [December 3, 2009] 
    55 * Copyright (c) 1998-2009 Glenn Randers-Pehrson 
    66 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 
     
    1818 
    1919#define PNG_INTERNAL 
     20#define PNG_NO_PEDANTIC_WARNINGS 
    2021#include "png.h" 
    2122#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) 
     
    2324static void /* PRIVATE */ 
    2425png_default_error PNGARG((png_structp png_ptr, 
    25   png_const_charp error_message)); 
    26 #ifndef PNG_NO_WARNINGS 
     26  png_const_charp error_message)) PNG_NORETURN; 
     27#ifdef PNG_WARNINGS_SUPPORTED 
    2728static void /* PRIVATE */ 
    2829png_default_warning PNGARG((png_structp png_ptr, 
    2930  png_const_charp warning_message)); 
    30 #endif /* PNG_NO_WARNINGS */ 
     31#endif /* PNG_WARNINGS_SUPPORTED */ 
    3132 
    3233/* This function is called whenever there is a fatal error.  This function 
     
    3536 * to replace the error function at run-time. 
    3637 */ 
    37 #ifndef PNG_NO_ERROR_TEXT 
     38#ifdef PNG_ERROR_TEXT_SUPPORTED 
    3839void PNGAPI 
    3940png_error(png_structp png_ptr, png_const_charp error_message) 
     
    4647       (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) 
    4748     { 
    48        if (*error_message == '#') 
     49       if (*error_message == PNG_LITERAL_SHARP) 
    4950       { 
    5051           /* Strip "#nnnn " from beginning of error message. */ 
     
    9495   png_default_error(png_ptr, '\0'); 
    9596} 
    96 #endif /* PNG_NO_ERROR_TEXT */ 
    97  
    98 #ifndef PNG_NO_WARNINGS 
     97#endif /* PNG_ERROR_TEXT_SUPPORTED */ 
     98 
     99#ifdef PNG_WARNINGS_SUPPORTED 
    99100/* This function is called whenever there is a non-fatal error.  This function 
    100101 * should not be changed.  If there is a need to handle warnings differently, 
     
    113114#endif 
    114115     { 
    115        if (*warning_message == '#') 
     116       if (*warning_message == PNG_LITERAL_SHARP) 
    116117       { 
    117118           for (offset = 1; offset < 15; offset++) 
     
    126127      png_default_warning(png_ptr, warning_message + offset); 
    127128} 
    128 #endif /* PNG_NO_WARNINGS */ 
    129  
     129#endif /* PNG_WARNINGS_SUPPORTED */ 
     130 
     131#ifdef PNG_BENIGN_ERRORS_SUPPORTED 
     132void PNGAPI 
     133png_benign_error(png_structp png_ptr, png_const_charp error_message) 
     134{ 
     135  if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) 
     136    png_warning(png_ptr, error_message); 
     137  else 
     138    png_error(png_ptr, error_message); 
     139} 
     140#endif 
    130141 
    131142/* These utilities are used internally to build an error message that relates 
     
    142153 
    143154#define PNG_MAX_ERROR_TEXT 64 
    144  
    145 #if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) 
     155#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED) 
    146156static void /* PRIVATE */ 
    147157png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp 
     
    155165      if (isnonalpha(c)) 
    156166      { 
    157          buffer[iout++] = '['; 
     167         buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET; 
    158168         buffer[iout++] = png_digit[(c & 0xf0) >> 4]; 
    159169         buffer[iout++] = png_digit[c & 0x0f]; 
    160          buffer[iout++] = ']'; 
     170         buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; 
    161171      } 
    162172      else 
     
    191201} 
    192202#endif /* PNG_READ_SUPPORTED */ 
    193 #endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */ 
    194  
    195 #ifndef PNG_NO_WARNINGS 
     203#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */ 
     204 
     205#ifdef PNG_WARNINGS_SUPPORTED 
    196206void PNGAPI 
    197207png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) 
     
    206216   } 
    207217} 
    208 #endif /* PNG_NO_WARNINGS */ 
    209  
     218#endif /* PNG_WARNINGS_SUPPORTED */ 
     219 
     220#ifdef PNG_READ_SUPPORTED 
     221#ifdef PNG_BENIGN_ERRORS_SUPPORTED 
     222void PNGAPI 
     223png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message) 
     224{ 
     225  if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) 
     226    png_chunk_warning(png_ptr, error_message); 
     227  else 
     228    png_chunk_error(png_ptr, error_message); 
     229} 
     230#endif 
     231#endif /* PNG_READ_SUPPORTED */ 
    210232 
    211233/* This is the default error handling function.  Note that replacements for 
     
    217239png_default_error(png_structp png_ptr, png_const_charp error_message) 
    218240{ 
    219 #ifndef PNG_NO_CONSOLE_IO 
     241#ifdef PNG_CONSOLE_IO_SUPPORTED 
    220242#ifdef PNG_ERROR_NUMBERS_SUPPORTED 
    221    if (*error_message == '#') 
     243   if (*error_message == PNG_LITERAL_SHARP) 
    222244   { 
    223245     /* Strip "#nnnn " from beginning of error message. */ 
     
    259281      jmp_buf jmpbuf; 
    260282      png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); 
    261       longjmp(jmpbuf, 1); 
     283     longjmp(jmpbuf,1); 
    262284   } 
    263285#  else 
     
    265287#  endif 
    266288   } 
    267 #else 
     289#endif 
     290   /* Here if not setjmp support or if png_ptr is null. */ 
    268291   PNG_ABORT(); 
    269 #endif 
    270 #ifdef PNG_NO_CONSOLE_IO 
     292#ifndef PNG_CONSOLE_IO_SUPPORTED 
    271293   error_message = error_message; /* Make compiler happy */ 
    272294#endif 
    273295} 
    274296 
    275 #ifndef PNG_NO_WARNINGS 
     297#ifdef PNG_WARNINGS_SUPPORTED 
    276298/* This function is called when there is a warning, but the library thinks 
    277299 * it can continue anyway.  Replacement functions don't have to do anything 
     
    282304png_default_warning(png_structp png_ptr, png_const_charp warning_message) 
    283305{ 
    284 #ifndef PNG_NO_CONSOLE_IO 
     306#ifdef PNG_CONSOLE_IO_SUPPORTED 
    285307#  ifdef PNG_ERROR_NUMBERS_SUPPORTED 
    286    if (*warning_message == '#') 
     308   if (*warning_message == PNG_LITERAL_SHARP) 
    287309   { 
    288310     int offset; 
     
    319341   png_ptr = png_ptr; /* Make compiler happy */ 
    320342} 
    321 #endif /* PNG_NO_WARNINGS */ 
     343#endif /* PNG_WARNINGS_SUPPORTED */ 
    322344 
    323345/* This function is called when the application wants to use another method