Changeset 44 for cafu/trunk/ExtLibs/libpng/pngerror.c
- Timestamp:
- 02/15/10 11:56:43 (2 years ago)
- Files:
-
- 1 modified
-
cafu/trunk/ExtLibs/libpng/pngerror.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/ExtLibs/libpng/pngerror.c
r11 r44 2 2 /* pngerror.c - stub functions for i/o and memory allocation 3 3 * 4 * Last changed in libpng 1.2. 37 [June 4, 2009]4 * Last changed in libpng 1.2.41 [December 3, 2009] 5 5 * Copyright (c) 1998-2009 Glenn Randers-Pehrson 6 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) … … 18 18 19 19 #define PNG_INTERNAL 20 #define PNG_NO_PEDANTIC_WARNINGS 20 21 #include "png.h" 21 22 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) … … 23 24 static void /* PRIVATE */ 24 25 png_default_error PNGARG((png_structp png_ptr, 25 png_const_charp error_message)) ;26 #if ndef PNG_NO_WARNINGS26 png_const_charp error_message)) PNG_NORETURN; 27 #ifdef PNG_WARNINGS_SUPPORTED 27 28 static void /* PRIVATE */ 28 29 png_default_warning PNGARG((png_structp png_ptr, 29 30 png_const_charp warning_message)); 30 #endif /* PNG_ NO_WARNINGS*/31 #endif /* PNG_WARNINGS_SUPPORTED */ 31 32 32 33 /* This function is called whenever there is a fatal error. This function … … 35 36 * to replace the error function at run-time. 36 37 */ 37 #if ndef PNG_NO_ERROR_TEXT38 #ifdef PNG_ERROR_TEXT_SUPPORTED 38 39 void PNGAPI 39 40 png_error(png_structp png_ptr, png_const_charp error_message) … … 46 47 (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) 47 48 { 48 if (*error_message == '#')49 if (*error_message == PNG_LITERAL_SHARP) 49 50 { 50 51 /* Strip "#nnnn " from beginning of error message. */ … … 94 95 png_default_error(png_ptr, '\0'); 95 96 } 96 #endif /* PNG_ NO_ERROR_TEXT*/97 98 #if ndef PNG_NO_WARNINGS97 #endif /* PNG_ERROR_TEXT_SUPPORTED */ 98 99 #ifdef PNG_WARNINGS_SUPPORTED 99 100 /* This function is called whenever there is a non-fatal error. This function 100 101 * should not be changed. If there is a need to handle warnings differently, … … 113 114 #endif 114 115 { 115 if (*warning_message == '#')116 if (*warning_message == PNG_LITERAL_SHARP) 116 117 { 117 118 for (offset = 1; offset < 15; offset++) … … 126 127 png_default_warning(png_ptr, warning_message + offset); 127 128 } 128 #endif /* PNG_NO_WARNINGS */ 129 129 #endif /* PNG_WARNINGS_SUPPORTED */ 130 131 #ifdef PNG_BENIGN_ERRORS_SUPPORTED 132 void PNGAPI 133 png_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 130 141 131 142 /* These utilities are used internally to build an error message that relates … … 142 153 143 154 #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) 146 156 static void /* PRIVATE */ 147 157 png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp … … 155 165 if (isnonalpha(c)) 156 166 { 157 buffer[iout++] = '[';167 buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET; 158 168 buffer[iout++] = png_digit[(c & 0xf0) >> 4]; 159 169 buffer[iout++] = png_digit[c & 0x0f]; 160 buffer[iout++] = ']';170 buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET; 161 171 } 162 172 else … … 191 201 } 192 202 #endif /* PNG_READ_SUPPORTED */ 193 #endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)*/194 195 #if ndef PNG_NO_WARNINGS203 #endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */ 204 205 #ifdef PNG_WARNINGS_SUPPORTED 196 206 void PNGAPI 197 207 png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) … … 206 216 } 207 217 } 208 #endif /* PNG_NO_WARNINGS */ 209 218 #endif /* PNG_WARNINGS_SUPPORTED */ 219 220 #ifdef PNG_READ_SUPPORTED 221 #ifdef PNG_BENIGN_ERRORS_SUPPORTED 222 void PNGAPI 223 png_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 */ 210 232 211 233 /* This is the default error handling function. Note that replacements for … … 217 239 png_default_error(png_structp png_ptr, png_const_charp error_message) 218 240 { 219 #if ndef PNG_NO_CONSOLE_IO241 #ifdef PNG_CONSOLE_IO_SUPPORTED 220 242 #ifdef PNG_ERROR_NUMBERS_SUPPORTED 221 if (*error_message == '#')243 if (*error_message == PNG_LITERAL_SHARP) 222 244 { 223 245 /* Strip "#nnnn " from beginning of error message. */ … … 259 281 jmp_buf jmpbuf; 260 282 png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); 261 longjmp(jmpbuf,1);283 longjmp(jmpbuf,1); 262 284 } 263 285 # else … … 265 287 # endif 266 288 } 267 #else 289 #endif 290 /* Here if not setjmp support or if png_ptr is null. */ 268 291 PNG_ABORT(); 269 #endif 270 #ifdef PNG_NO_CONSOLE_IO 292 #ifndef PNG_CONSOLE_IO_SUPPORTED 271 293 error_message = error_message; /* Make compiler happy */ 272 294 #endif 273 295 } 274 296 275 #if ndef PNG_NO_WARNINGS297 #ifdef PNG_WARNINGS_SUPPORTED 276 298 /* This function is called when there is a warning, but the library thinks 277 299 * it can continue anyway. Replacement functions don't have to do anything … … 282 304 png_default_warning(png_structp png_ptr, png_const_charp warning_message) 283 305 { 284 #if ndef PNG_NO_CONSOLE_IO306 #ifdef PNG_CONSOLE_IO_SUPPORTED 285 307 # ifdef PNG_ERROR_NUMBERS_SUPPORTED 286 if (*warning_message == '#')308 if (*warning_message == PNG_LITERAL_SHARP) 287 309 { 288 310 int offset; … … 319 341 png_ptr = png_ptr; /* Make compiler happy */ 320 342 } 321 #endif /* PNG_ NO_WARNINGS*/343 #endif /* PNG_WARNINGS_SUPPORTED */ 322 344 323 345 /* This function is called when the application wants to use another method
