X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Ferror.h;h=e584c7b9cd23e885e96d71289fe66c535898e9e6;hb=f1c07e953597e3f6a809d35d7d5160af1ff67ed3;hp=7e0a7cedbe025ec106a7a84cec6297940012ae90;hpb=f3ab01445d6184f7c5ffd0251667de7ef7437f9a;p=wimlib diff --git a/include/wimlib/error.h b/include/wimlib/error.h index 7e0a7ced..e584c7b9 100644 --- a/include/wimlib/error.h +++ b/include/wimlib/error.h @@ -1,26 +1,14 @@ #ifndef _WIMLIB_ERROR_H #define _WIMLIB_ERROR_H +#include + #include "wimlib.h" /* Get error code definitions */ #include "wimlib/compiler.h" #include "wimlib/types.h" -#include - -#ifdef __WIN32__ -# define wimlib_fprintf fwprintf -# define wimlib_printf wprintf -#else /* __WIN32__ */ -extern int -wimlib_fprintf(FILE *fp, const tchar *format, ...) _format_attribute(printf, 2, 3); - -extern int -wimlib_printf(const tchar *format, ...) _format_attribute(printf, 1, 2); -#endif /* !__WIN32__ */ - - -static inline int -dummy_tprintf(const tchar *format, ...) _format_attribute(printf, 1, 2) +static inline int _format_attribute(printf, 1, 2) +dummy_tprintf(const tchar *format, ...) { return 0; } @@ -42,10 +30,14 @@ extern void wimlib_warning_with_errno(const tchar *format, ...) _format_attribute(printf, 1, 2) _cold_attribute; # define ERROR(format, ...) wimlib_error(T(format), ## __VA_ARGS__) -# define ERROR_WITH_ERRNO(format, ...) wimlib_error_with_errno(T(format), ## __VA_ARGS__) +# define ERROR_WITH_ERRNO(format, ...) wimlib_error_with_errno(T(format), ## __VA_ARGS__) # define WARNING(format, ...) wimlib_warning(T(format), ## __VA_ARGS__) # define WARNING_WITH_ERRNO(format, ...) wimlib_warning_with_errno(T(format), ## __VA_ARGS__) +extern bool wimlib_print_errors; +extern FILE *wimlib_error_file; #else /* ENABLE_ERROR_MESSAGES */ +# define wimlib_print_errors 0 +# define wimlib_error_file NULL # define ERROR(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) # define ERROR_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) # define WARNING(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) @@ -60,21 +52,19 @@ wimlib_warning_with_errno(const tchar *format, ...) # define ENABLE_ASSERTIONS 1 #endif + #ifdef ENABLE_DEBUG extern void wimlib_debug(const tchar *file, int line, const char *func, const tchar *format, ...); # define DEBUG(format, ...) \ - wimlib_debug(T(__FILE__), __LINE__, __func__, T(format), ## __VA_ARGS__) + wimlib_debug(T(__FILE__), __LINE__, __func__, T(format), ## __VA_ARGS__) #else # define DEBUG(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) #endif /* !ENABLE_DEBUG */ -#ifdef ENABLE_MORE_DEBUG -# define DEBUG2(format, ...) DEBUG(format, ## __VA_ARGS__) -#else -# define DEBUG2(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) -#endif /* !ENABLE_MORE_DEBUG */ +extern void +print_byte_field(const u8 *field, size_t len, FILE *out); #endif /* _WIMLIB_ERROR_H */