VirtualBox

source: vbox/trunk/src/libs/libpng-1.6.45/pngdebug.h@ 107813

Last change on this file since 107813 was 107813, checked in by vboxsync, 4 weeks ago

libpng-1.6.45: Applied and adjusted our libpng changes to 1.6.45. bugref:8515

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette