/usr/include/ebml/Debug.h is in libebml-dev 1.3.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /****************************************************************************
** libebml : parse EBML files, see http://embl.sourceforge.net/
**
** <file/class description>
**
** Copyright (C) 2002-2004 Steve Lhomme. All rights reserved.
**
** This file is part of libebml.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**
** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.
**
** Contact license@matroska.org if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*!
\file
\version \$Id: Debug.h 639 2004-07-09 20:59:14Z mosu $
\author Steve Lhomme <robux4 @ users.sf.net>
\author Moritz Bunkus <moritz @ bunkus.org>
*/
#ifndef LIBEBML_DEBUG_H
#define LIBEBML_DEBUG_H
#include <stdarg.h> // va_list
#include <string.h>
#ifdef WIN32
#include <windows.h>
#else
#include <stdio.h>
#endif // WIN32
#include "EbmlConfig.h"
START_LIBEBML_NAMESPACE
static const int MAX_PREFIX_LENGTH = 128;
#if defined(LIBEBML_DEBUG)
// define the working debugging class
class EBML_DLL_API ADbg
{
public:
ADbg(int level = 0);
virtual ~ADbg();
/// \todo make an inline function to test the level first and the process
int OutPut(int level, const char * format,...) const;
int OutPut(const char * format,...) const;
inline int setLevel(const int level) {
return my_level = level;
}
inline bool setIncludeTime(const bool included = true) {
return my_time_included = included;
}
bool setDebugFile(const char * NewFilename);
bool unsetDebugFile();
inline bool setUseFile(const bool usefile = true) {
return my_use_file = usefile;
}
inline const char * setPrefix(const char * string) {
return strncpy(prefix, string, MAX_PREFIX_LENGTH);
}
private:
int my_level;
bool my_time_included;
bool my_use_file;
bool my_debug_output;
int _OutPut(const char * format,va_list params) const;
char prefix[MAX_PREFIX_LENGTH];
#ifdef WIN32
HANDLE hFile;
#else
FILE *hFile;
#endif // WIN32
};
#else // defined(LIBEBML_DEBUG)
// define a class that does nothing (no output)
class EBML_DLL_API ADbg
{
public:
ADbg(int /* level */ = 0){}
virtual ~ADbg() {}
inline int OutPut(int /* level */, const char * /* format */,...) const {
return 0;
}
inline int OutPut(const char * /* format */,...) const {
return 0;
}
inline int setLevel(const int level) {
return level;
}
inline bool setIncludeTime(const bool /* included */ = true) {
return true;
}
inline bool setDebugFile(const char * /* NewFilename */) {
return true;
}
inline bool unsetDebugFile() {
return true;
}
inline bool setUseFile(const bool /* usefile */ = true) {
return true;
}
inline const char * setPrefix(const char * string) {
return string;
}
};
#endif // defined(LIBEBML_DEBUG)
extern class EBML_DLL_API ADbg globalDebug;
#ifdef LIBEBML_DEBUG
#define EBML_TRACE globalDebug.OutPut
#else
#define EBML_TRACE
#endif
// Unfortunately the Visual C++ new operator doesn't throw a std::bad_alloc. One solution is to
// define out own new operator. But we can't do this globally, since we allow static linking.
// The other is to check every new allocation with an MATROSKA_ASSERT_NEW.
#ifdef _MSC_VER
#define EBML_ASSERT_NEW(p) if(p==0)throw std::bad_alloc()
#else
#define EBML_ASSERT_NEW(p) assert(p!=0)
#endif
END_LIBEBML_NAMESPACE
#endif
|