| OLD | NEW |
| 1 | 1 |
| 2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c | 2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c |
| 3 * | 3 * |
| 4 * Copyright (c) 1998-2011 Glenn Randers-Pehrson | 4 * Copyright (c) 1998-2011 Glenn Randers-Pehrson |
| 5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
| 6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
| 7 * | 7 * |
| 8 * Last changed in libpng 1.5.0 [January 6, 2011] | 8 * Last changed in libpng 1.5.0 [January 6, 2011] |
| 9 * | 9 * |
| 10 * This code is released under the libpng license. | 10 * This code is released under the libpng license. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * on Microsoft compilers unless PNG_DEBUG_FILE is also | 29 * on Microsoft compilers unless PNG_DEBUG_FILE is also |
| 30 * defined, to allow debug DLL compilation with no standard IO). | 30 * defined, to allow debug DLL compilation with no standard IO). |
| 31 * message: a printf(3) style text string. A trailing '\n' is added | 31 * message: a printf(3) style text string. A trailing '\n' is added |
| 32 * to the message. | 32 * to the message. |
| 33 * arg: 0 to 2 arguments for printf(3) style substitution in message. | 33 * arg: 0 to 2 arguments for printf(3) style substitution in message. |
| 34 */ | 34 */ |
| 35 #ifndef PNGDEBUG_H | 35 #ifndef PNGDEBUG_H |
| 36 #define PNGDEBUG_H | 36 #define PNGDEBUG_H |
| 37 /* These settings control the formatting of messages in png.c and pngerror.c */ | 37 /* These settings control the formatting of messages in png.c and pngerror.c */ |
| 38 /* Moved to pngdebug.h at 1.5.0 */ | 38 /* Moved to pngdebug.h at 1.5.0 */ |
| 39 # ifndef PNG_LITERAL_SHARP | 39 #ifndef PNG_LITERAL_SHARP |
| 40 # define PNG_LITERAL_SHARP 0x23 | 40 #define PNG_LITERAL_SHARP 0x23 |
| 41 # endif | 41 #endif |
| 42 # ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET | 42 #ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET |
| 43 # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b | 43 #define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b |
| 44 # endif | 44 #endif |
| 45 # ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET | 45 #ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET |
| 46 # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d | 46 #define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d |
| 47 # endif | 47 #endif |
| 48 # ifndef PNG_STRING_NEWLINE | 48 #ifndef PNG_STRING_NEWLINE |
| 49 # define PNG_STRING_NEWLINE "\n" | 49 #define PNG_STRING_NEWLINE "\n" |
| 50 # endif | 50 #endif |
| 51 | 51 |
| 52 #ifdef PNG_DEBUG | 52 #ifdef PNG_DEBUG |
| 53 # if (PNG_DEBUG > 0) | 53 #if (PNG_DEBUG > 0) |
| 54 # if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) | 54 #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) |
| 55 # include <crtdbg.h> | 55 #include <crtdbg.h> |
| 56 # if (PNG_DEBUG > 1) | 56 #if (PNG_DEBUG > 1) |
| 57 # ifndef _DEBUG | 57 #ifndef _DEBUG |
| 58 # define _DEBUG | 58 #define _DEBUG |
| 59 # endif | 59 #endif |
| 60 # ifndef png_debug | 60 #ifndef png_debug |
| 61 # define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE) | 61 #define png_debug(l, m) _RPT0(_CRT_WARN, m PNG_STRING_NEWLINE) |
| 62 # endif | 62 #endif |
| 63 # ifndef png_debug1 | 63 #ifndef png_debug1 |
| 64 # define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1) | 64 #define png_debug1(l, m, p1) _RPT1(_CRT_WARN, m PNG_STRING_NEWLINE, p1) |
| 65 # endif | 65 #endif |
| 66 # ifndef png_debug2 | 66 #ifndef png_debug2 |
| 67 # define png_debug2(l,m,p1,p2) \ | 67 #define png_debug2(l, m, p1, p2) _RPT2(_CRT_WARN, m PNG_STRING_NEWLINE, p1, p2) |
| 68 _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2) | 68 #endif |
| 69 # endif | 69 #endif |
| 70 # endif | 70 #else /* PNG_DEBUG_FILE || !_MSC_VER */ |
| 71 # else /* PNG_DEBUG_FILE || !_MSC_VER */ | 71 #ifndef PNG_STDIO_SUPPORTED |
| 72 # ifndef PNG_STDIO_SUPPORTED | 72 #include <stdio.h> /* not included yet */ |
| 73 # include <stdio.h> /* not included yet */ | 73 #endif |
| 74 # endif | 74 #ifndef PNG_DEBUG_FILE |
| 75 # ifndef PNG_DEBUG_FILE | 75 #define PNG_DEBUG_FILE stderr |
| 76 # define PNG_DEBUG_FILE stderr | 76 #endif /* PNG_DEBUG_FILE */ |
| 77 # endif /* PNG_DEBUG_FILE */ | |
| 78 | 77 |
| 79 # if (PNG_DEBUG > 1) | 78 #if (PNG_DEBUG > 1) |
| 80 /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on | 79 /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on |
| 81 * non-ISO compilers | 80 * non-ISO compilers |
| 82 */ | 81 */ |
| 83 # ifdef __STDC__ | 82 #ifdef __STDC__ |
| 84 # ifndef png_debug | 83 #ifndef png_debug |
| 85 # define png_debug(l,m) \ | 84 #define png_debug(l, m) \ |
| 86 do { \ | 85 do { \ |
| 87 int num_tabs=l; \ | 86 int num_tabs = l; \ |
| 88 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 87 fprintf(PNG_DEBUG_FILE, "%s" m PNG_STRING_NEWLINE, \ |
| 89 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ | 88 (num_tabs == 1 ? "\t" : (num_tabs == 2 \ |
| 90 } while (0) | 89 ? "\t\t" \ |
| 91 # endif | 90 : (num_tabs > 2 ? "\t\t\t" : "")))); \ |
| 92 # ifndef png_debug1 | 91 } while (0) |
| 93 # define png_debug1(l,m,p1) \ | 92 #endif |
| 94 do { \ | 93 #ifndef png_debug1 |
| 95 int num_tabs=l; \ | 94 #define png_debug1(l, m, p1) \ |
| 96 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 95 do { \ |
| 97 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ | 96 int num_tabs = l; \ |
| 98 } while (0) | 97 fprintf(PNG_DEBUG_FILE, "%s" m PNG_STRING_NEWLINE, \ |
| 99 # endif | 98 (num_tabs == 1 \ |
| 100 # ifndef png_debug2 | 99 ? "\t" \ |
| 101 # define png_debug2(l,m,p1,p2) \ | 100 : (num_tabs == 2 ? "\t\t" : (num_tabs > 2 ? "\t\t\t" : ""))), \ |
| 102 do { \ | 101 p1); \ |
| 103 int num_tabs=l; \ | 102 } while (0) |
| 104 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 103 #endif |
| 105 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ | 104 #ifndef png_debug2 |
| 106 } while (0) | 105 #define png_debug2(l, m, p1, p2) \ |
| 107 # endif | 106 do { \ |
| 108 # else /* __STDC __ */ | 107 int num_tabs = l; \ |
| 109 # ifndef png_debug | 108 fprintf(PNG_DEBUG_FILE, "%s" m PNG_STRING_NEWLINE, \ |
| 110 # define png_debug(l,m) \ | 109 (num_tabs == 1 \ |
| 111 do { \ | 110 ? "\t" \ |
| 112 int num_tabs=l; \ | 111 : (num_tabs == 2 ? "\t\t" : (num_tabs > 2 ? "\t\t\t" : ""))), \ |
| 113 char format[256]; \ | 112 p1, p2); \ |
| 114 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ | 113 } while (0) |
| 115 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ | 114 #endif |
| 116 m,PNG_STRING_NEWLINE); \ | 115 #else /* __STDC __ */ |
| 117 fprintf(PNG_DEBUG_FILE,format); \ | 116 #ifndef png_debug |
| 118 } while (0) | 117 #define png_debug(l, m) \ |
| 119 # endif | 118 do { \ |
| 120 # ifndef png_debug1 | 119 int num_tabs = l; \ |
| 121 # define png_debug1(l,m,p1) \ | 120 char format[256]; \ |
| 122 do { \ | 121 snprintf(format, 256, "%s%s%s", \ |
| 123 int num_tabs=l; \ | 122 (num_tabs == 1 ? "\t" : (num_tabs == 2 \ |
| 124 char format[256]; \ | 123 ? "\t\t" \ |
| 125 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ | 124 : (num_tabs > 2 ? "\t\t\t" : ""))), \ |
| 126 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ | 125 m, PNG_STRING_NEWLINE); \ |
| 127 m,PNG_STRING_NEWLINE); \ | 126 fprintf(PNG_DEBUG_FILE, format); \ |
| 128 fprintf(PNG_DEBUG_FILE,format,p1); \ | 127 } while (0) |
| 129 } while (0) | 128 #endif |
| 130 # endif | 129 #ifndef png_debug1 |
| 131 # ifndef png_debug2 | 130 #define png_debug1(l, m, p1) \ |
| 132 # define png_debug2(l,m,p1,p2) \ | 131 do { \ |
| 133 do { \ | 132 int num_tabs = l; \ |
| 134 int num_tabs=l; \ | 133 char format[256]; \ |
| 135 char format[256]; \ | 134 snprintf(format, 256, "%s%s%s", \ |
| 136 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ | 135 (num_tabs == 1 ? "\t" : (num_tabs == 2 \ |
| 137 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ | 136 ? "\t\t" \ |
| 138 m,PNG_STRING_NEWLINE); \ | 137 : (num_tabs > 2 ? "\t\t\t" : ""))), \ |
| 139 fprintf(PNG_DEBUG_FILE,format,p1,p2); \ | 138 m, PNG_STRING_NEWLINE); \ |
| 140 } while (0) | 139 fprintf(PNG_DEBUG_FILE, format, p1); \ |
| 141 # endif | 140 } while (0) |
| 142 # endif /* __STDC __ */ | 141 #endif |
| 143 # endif /* (PNG_DEBUG > 1) */ | 142 #ifndef png_debug2 |
| 143 #define png_debug2(l, m, p1, p2) \ |
| 144 do { \ |
| 145 int num_tabs = l; \ |
| 146 char format[256]; \ |
| 147 snprintf(format, 256, "%s%s%s", \ |
| 148 (num_tabs == 1 ? "\t" : (num_tabs == 2 \ |
| 149 ? "\t\t" \ |
| 150 : (num_tabs > 2 ? "\t\t\t" : ""))), \ |
| 151 m, PNG_STRING_NEWLINE); \ |
| 152 fprintf(PNG_DEBUG_FILE, format, p1, p2); \ |
| 153 } while (0) |
| 154 #endif |
| 155 #endif /* __STDC __ */ |
| 156 #endif /* (PNG_DEBUG > 1) */ |
| 144 | 157 |
| 145 # endif /* _MSC_VER */ | 158 #endif /* _MSC_VER */ |
| 146 # endif /* (PNG_DEBUG > 0) */ | 159 #endif /* (PNG_DEBUG > 0) */ |
| 147 #endif /* PNG_DEBUG */ | 160 #endif /* PNG_DEBUG */ |
| 148 #ifndef png_debug | 161 #ifndef png_debug |
| 149 # define png_debug(l, m) ((void)0) | 162 #define png_debug(l, m) ((void)0) |
| 150 #endif | 163 #endif |
| 151 #ifndef png_debug1 | 164 #ifndef png_debug1 |
| 152 # define png_debug1(l, m, p1) ((void)0) | 165 #define png_debug1(l, m, p1) ((void)0) |
| 153 #endif | 166 #endif |
| 154 #ifndef png_debug2 | 167 #ifndef png_debug2 |
| 155 # define png_debug2(l, m, p1, p2) ((void)0) | 168 #define png_debug2(l, m, p1, p2) ((void)0) |
| 156 #endif | 169 #endif |
| 157 #endif /* PNGDEBUG_H */ | 170 #endif /* PNGDEBUG_H */ |
| OLD | NEW |