Skip to content

Commit

Permalink
Check JPEG_FOUND macro in jpeg common definitions (#2725)
Browse files Browse the repository at this point in the history
  • Loading branch information
andfoy committed Sep 29, 2020
1 parent 6afb349 commit 6f75883
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torchvision/csrc/cpu/image/jpegcommon.cpp
@@ -1,6 +1,7 @@
#include "jpegcommon.h"
#include <string>

#if JPEG_FOUND
void torch_jpeg_error_exit(j_common_ptr cinfo) {
/* cinfo->err really points to a torch_jpeg_error_mgr struct, so coerce
* pointer */
Expand All @@ -15,3 +16,4 @@ void torch_jpeg_error_exit(j_common_ptr cinfo) {
/* Return control to the setjmp point */
longjmp(myerr->setjmp_buffer, 1);
}
#endif
4 changes: 4 additions & 0 deletions torchvision/csrc/cpu/image/jpegcommon.h
Expand Up @@ -4,6 +4,8 @@
#include <cstdio>
#include <cstddef>
// clang-format on

#if JPEG_FOUND
#include <jpeglib.h>
#include <setjmp.h>
#include <string>
Expand All @@ -17,3 +19,5 @@ struct torch_jpeg_error_mgr {

typedef struct torch_jpeg_error_mgr* torch_jpeg_error_ptr;
void torch_jpeg_error_exit(j_common_ptr cinfo);

#endif

0 comments on commit 6f75883

Please sign in to comment.