Unverified Commit 6f758832 authored by Edgar Andrés Margffoy Tuay's avatar Edgar Andrés Margffoy Tuay Committed by GitHub
Browse files

Check JPEG_FOUND macro in jpeg common definitions (#2725)

parent 6afb3496
#include "jpegcommon.h" #include "jpegcommon.h"
#include <string> #include <string>
#if JPEG_FOUND
void torch_jpeg_error_exit(j_common_ptr cinfo) { void torch_jpeg_error_exit(j_common_ptr cinfo) {
/* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce /* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce
* pointer */ * pointer */
...@@ -15,3 +16,4 @@ void torch_jpeg_error_exit(j_common_ptr cinfo) { ...@@ -15,3 +16,4 @@ void torch_jpeg_error_exit(j_common_ptr cinfo) {
/* Return control to the setjmp point */ /* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer, 1); longjmp(myerr->setjmp_buffer, 1);
} }
#endif
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <cstdio> #include <cstdio>
#include <cstddef> #include <cstddef>
// clang-format on // clang-format on
#if JPEG_FOUND
#include <jpeglib.h> #include <jpeglib.h>
#include <setjmp.h> #include <setjmp.h>
#include <string> #include <string>
...@@ -17,3 +19,5 @@ struct torch_jpeg_error_mgr { ...@@ -17,3 +19,5 @@ struct torch_jpeg_error_mgr {
typedef struct torch_jpeg_error_mgr* torch_jpeg_error_ptr; typedef struct torch_jpeg_error_mgr* torch_jpeg_error_ptr;
void torch_jpeg_error_exit(j_common_ptr cinfo); void torch_jpeg_error_exit(j_common_ptr cinfo);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment