1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
6 #ifndef LIB_JPEGLI_ERROR_H_
7 #define LIB_JPEGLI_ERROR_H_
12 #include "lib/jpegli/common.h"
16 bool FormatString(char* buffer
, const char* format
, ...);
20 #define JPEGLI_ERROR(format, ...) \
21 jpegli::FormatString(cinfo->err->msg_parm.s, ("%s:%d: " format), __FILE__, \
22 __LINE__, ##__VA_ARGS__), \
23 (*cinfo->err->error_exit)(reinterpret_cast<j_common_ptr>(cinfo))
25 #define JPEGLI_WARN(format, ...) \
26 jpegli::FormatString(cinfo->err->msg_parm.s, ("%s:%d: " format), __FILE__, \
27 __LINE__, ##__VA_ARGS__), \
28 (*cinfo->err->emit_message)(reinterpret_cast<j_common_ptr>(cinfo), -1)
30 #define JPEGLI_TRACE(level, format, ...) \
31 if (cinfo->err->trace_level >= (level)) \
32 jpegli::FormatString(cinfo->err->msg_parm.s, ("%s:%d: " format), __FILE__, \
33 __LINE__, ##__VA_ARGS__), \
34 (*cinfo->err->emit_message)(reinterpret_cast<j_common_ptr>(cinfo), \
37 #endif // LIB_JPEGLI_ERROR_H_