Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/3rdparty/libpng/pngerror.c

    r561 r846  
    22/* pngerror.c - stub functions for i/o and memory allocation
    33 *
    4  * Last changed in libpng 1.2.37 [June 4, 2009]
    5  * Copyright (c) 1998-2009 Glenn Randers-Pehrson
     4 * Last changed in libpng 1.4.0 [January 3, 2010]
     5 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
    66 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
    77 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
     
    1717 */
    1818
    19 #define PNG_INTERNAL
     19#define PNG_NO_PEDANTIC_WARNINGS
    2020#include "png.h"
    2121#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
     22#include "pngpriv.h"
    2223
    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 */
     232
     233#ifdef PNG_SETJMP_SUPPORTED
     234/* This API only exists if ANSI-C style error handling is used,
     235 * otherwise it is necessary for png_default_error to be overridden.
     236 */
     237jmp_buf* PNGAPI
     238png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
     239    size_t jmp_buf_size)
     240{
     241   if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
     242      return NULL;
     243
     244   png_ptr->longjmp_fn = longjmp_fn;
     245   return &png_ptr->jmpbuf;
     246}
     247#endif
    210248
    211249/* This is the default error handling function.  Note that replacements for
     
    217255png_default_error(png_structp png_ptr, png_const_charp error_message)
    218256{
    219 #ifndef PNG_NO_CONSOLE_IO
     257#ifdef PNG_CONSOLE_IO_SUPPORTED
    220258#ifdef PNG_ERROR_NUMBERS_SUPPORTED
    221    if (*error_message == '#')
     259   if (*error_message == PNG_LITERAL_SHARP)
    222260   {
    223261     /* Strip "#nnnn " from beginning of error message. */
     
    253291
    254292#ifdef PNG_SETJMP_SUPPORTED
    255    if (png_ptr)
     293   if (png_ptr && png_ptr->longjmp_fn)
    256294   {
    257295#  ifdef USE_FAR_KEYWORD
     
    259297      jmp_buf jmpbuf;
    260298      png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
    261       longjmp(jmpbuf, 1);
     299     png_ptr->longjmp_fn(jmpbuf, 1);
    262300   }
    263301#  else
    264    longjmp(png_ptr->jmpbuf, 1);
     302   png_ptr->longjmp_fn(png_ptr->jmpbuf, 1);
    265303#  endif
    266304   }
    267 #else
     305#endif
     306   /* Here if not setjmp support or if png_ptr is null. */
    268307   PNG_ABORT();
    269 #endif
    270 #ifdef PNG_NO_CONSOLE_IO
     308#ifndef PNG_CONSOLE_IO_SUPPORTED
    271309   error_message = error_message; /* Make compiler happy */
    272310#endif
    273311}
    274312
    275 #ifndef PNG_NO_WARNINGS
     313#ifdef PNG_WARNINGS_SUPPORTED
    276314/* This function is called when there is a warning, but the library thinks
    277315 * it can continue anyway.  Replacement functions don't have to do anything
     
    282320png_default_warning(png_structp png_ptr, png_const_charp warning_message)
    283321{
    284 #ifndef PNG_NO_CONSOLE_IO
     322#ifdef PNG_CONSOLE_IO_SUPPORTED
    285323#  ifdef PNG_ERROR_NUMBERS_SUPPORTED
    286    if (*warning_message == '#')
     324   if (*warning_message == PNG_LITERAL_SHARP)
    287325   {
    288326     int offset;
     
    319357   png_ptr = png_ptr; /* Make compiler happy */
    320358}
    321 #endif /* PNG_NO_WARNINGS */
     359#endif /* PNG_WARNINGS_SUPPORTED */
    322360
    323361/* This function is called when the application wants to use another method
Note: See TracChangeset for help on using the changeset viewer.