Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / jpeg-xl / lib / jpegli / error.h
blob4451abd416e8fea7afd180066a226eb6ec7cb353
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
2 //
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_
9 #include <stdarg.h>
10 #include <stdint.h>
12 #include "lib/jpegli/common.h"
14 namespace jpegli {
16 bool FormatString(char* buffer, const char* format, ...);
18 } // namespace jpegli
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), \
35 (level))
37 #endif // LIB_JPEGLI_ERROR_H_