libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

error.h (1502B)


      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.
      5 
      6 #ifndef LIB_JPEGLI_ERROR_H_
      7 #define LIB_JPEGLI_ERROR_H_
      8 
      9 #include <stdarg.h>
     10 #include <stdint.h>
     11 
     12 #include "lib/jpegli/common.h"
     13 
     14 namespace jpegli {
     15 
     16 bool FormatString(char* buffer, const char* format, ...);
     17 
     18 }  // namespace jpegli
     19 
     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))
     24 
     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)
     29 
     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))
     36 
     37 #endif  // LIB_JPEGLI_ERROR_H_