media/libpng/pngdebug.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1
michael@0 2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
michael@0 3 *
michael@0 4 * Copyright (c) 1998-2013 Glenn Randers-Pehrson
michael@0 5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
michael@0 6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
michael@0 7 *
michael@0 8 * Last changed in libpng 1.6.8 [December 19, 2013]
michael@0 9 *
michael@0 10 * This code is released under the libpng license.
michael@0 11 * For conditions of distribution and use, see the disclaimer
michael@0 12 * and license in png.h
michael@0 13 */
michael@0 14
michael@0 15 /* Define PNG_DEBUG at compile time for debugging information. Higher
michael@0 16 * numbers for PNG_DEBUG mean more debugging information. This has
michael@0 17 * only been added since version 0.95 so it is not implemented throughout
michael@0 18 * libpng yet, but more support will be added as needed.
michael@0 19 *
michael@0 20 * png_debug[1-2]?(level, message ,arg{0-2})
michael@0 21 * Expands to a statement (either a simple expression or a compound
michael@0 22 * do..while(0) statement) that outputs a message with parameter
michael@0 23 * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
michael@0 24 * is undefined, 0 or 1 every png_debug expands to a simple expression
michael@0 25 * (actually ((void)0)).
michael@0 26 *
michael@0 27 * level: level of detail of message, starting at 0. A level 'n'
michael@0 28 * message is preceded by 'n' 3-space indentations (not implemented
michael@0 29 * on Microsoft compilers unless PNG_DEBUG_FILE is also
michael@0 30 * defined, to allow debug DLL compilation with no standard IO).
michael@0 31 * message: a printf(3) style text string. A trailing '\n' is added
michael@0 32 * to the message.
michael@0 33 * arg: 0 to 2 arguments for printf(3) style substitution in message.
michael@0 34 */
michael@0 35 #ifndef PNGDEBUG_H
michael@0 36 #define PNGDEBUG_H
michael@0 37 /* These settings control the formatting of messages in png.c and pngerror.c */
michael@0 38 /* Moved to pngdebug.h at 1.5.0 */
michael@0 39 # ifndef PNG_LITERAL_SHARP
michael@0 40 # define PNG_LITERAL_SHARP 0x23
michael@0 41 # endif
michael@0 42 # ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
michael@0 43 # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
michael@0 44 # endif
michael@0 45 # ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
michael@0 46 # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
michael@0 47 # endif
michael@0 48 # ifndef PNG_STRING_NEWLINE
michael@0 49 # define PNG_STRING_NEWLINE "\n"
michael@0 50 # endif
michael@0 51
michael@0 52 #ifdef PNG_DEBUG
michael@0 53 # if (PNG_DEBUG > 0)
michael@0 54 # if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
michael@0 55 # include <crtdbg.h>
michael@0 56 # if (PNG_DEBUG > 1)
michael@0 57 # ifndef _DEBUG
michael@0 58 # define _DEBUG
michael@0 59 # endif
michael@0 60 # ifndef png_debug
michael@0 61 # define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
michael@0 62 # endif
michael@0 63 # ifndef png_debug1
michael@0 64 # define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
michael@0 65 # endif
michael@0 66 # ifndef png_debug2
michael@0 67 # define png_debug2(l,m,p1,p2) \
michael@0 68 _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
michael@0 69 # endif
michael@0 70 # endif
michael@0 71 # else /* PNG_DEBUG_FILE || !_MSC_VER */
michael@0 72 # ifndef PNG_STDIO_SUPPORTED
michael@0 73 # include <stdio.h> /* not included yet */
michael@0 74 # endif
michael@0 75 # ifndef PNG_DEBUG_FILE
michael@0 76 # define PNG_DEBUG_FILE stderr
michael@0 77 # endif /* PNG_DEBUG_FILE */
michael@0 78
michael@0 79 # if (PNG_DEBUG > 1)
michael@0 80 # ifdef __STDC__
michael@0 81 # ifndef png_debug
michael@0 82 # define png_debug(l,m) \
michael@0 83 do { \
michael@0 84 int num_tabs=l; \
michael@0 85 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
michael@0 86 (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
michael@0 87 } while (0)
michael@0 88 # endif
michael@0 89 # ifndef png_debug1
michael@0 90 # define png_debug1(l,m,p1) \
michael@0 91 do { \
michael@0 92 int num_tabs=l; \
michael@0 93 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
michael@0 94 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
michael@0 95 } while (0)
michael@0 96 # endif
michael@0 97 # ifndef png_debug2
michael@0 98 # define png_debug2(l,m,p1,p2) \
michael@0 99 do { \
michael@0 100 int num_tabs=l; \
michael@0 101 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
michael@0 102 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
michael@0 103 } while (0)
michael@0 104 # endif
michael@0 105 # else /* __STDC __ */
michael@0 106 # ifndef png_debug
michael@0 107 # define png_debug(l,m) \
michael@0 108 do { \
michael@0 109 int num_tabs=l; \
michael@0 110 char format[256]; \
michael@0 111 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
michael@0 112 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
michael@0 113 m,PNG_STRING_NEWLINE); \
michael@0 114 fprintf(PNG_DEBUG_FILE,format); \
michael@0 115 } while (0)
michael@0 116 # endif
michael@0 117 # ifndef png_debug1
michael@0 118 # define png_debug1(l,m,p1) \
michael@0 119 do { \
michael@0 120 int num_tabs=l; \
michael@0 121 char format[256]; \
michael@0 122 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
michael@0 123 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
michael@0 124 m,PNG_STRING_NEWLINE); \
michael@0 125 fprintf(PNG_DEBUG_FILE,format,p1); \
michael@0 126 } while (0)
michael@0 127 # endif
michael@0 128 # ifndef png_debug2
michael@0 129 # define png_debug2(l,m,p1,p2) \
michael@0 130 do { \
michael@0 131 int num_tabs=l; \
michael@0 132 char format[256]; \
michael@0 133 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
michael@0 134 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
michael@0 135 m,PNG_STRING_NEWLINE); \
michael@0 136 fprintf(PNG_DEBUG_FILE,format,p1,p2); \
michael@0 137 } while (0)
michael@0 138 # endif
michael@0 139 # endif /* __STDC __ */
michael@0 140 # endif /* (PNG_DEBUG > 1) */
michael@0 141
michael@0 142 # endif /* _MSC_VER */
michael@0 143 # endif /* (PNG_DEBUG > 0) */
michael@0 144 #endif /* PNG_DEBUG */
michael@0 145 #ifndef png_debug
michael@0 146 # define png_debug(l, m) ((void)0)
michael@0 147 #endif
michael@0 148 #ifndef png_debug1
michael@0 149 # define png_debug1(l, m, p1) ((void)0)
michael@0 150 #endif
michael@0 151 #ifndef png_debug2
michael@0 152 # define png_debug2(l, m, p1, p2) ((void)0)
michael@0 153 #endif
michael@0 154 #endif /* PNGDEBUG_H */

mercurial