Skip to content

Commit

Permalink
[fbsync] Fix size_t issues across JPEG versions and platforms (#4439)
Browse files Browse the repository at this point in the history
Summary:
* Windows use size_t

* Temporarily pin jpeg <=9b

* Temporarily pin jpeg ==9c

* Remove pinning.

Reviewed By: datumbox

Differential Revision: D31268029

fbshipit-source-id: 6d6514abe195e71f05996fee7e4e1be7fad4a137
  • Loading branch information
NicolasHug authored and facebook-github-bot committed Sep 30, 2021
1 parent e47cb49 commit c9bf464
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions torchvision/csrc/io/image/cpu/encode_jpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ torch::Tensor encode_jpeg(const torch::Tensor& data, int64_t quality) {
#else
// For libjpeg version <= 9b, the out_size parameter in jpeg_mem_dest() is
// defined as unsigned long, whereas in later version, it is defined as size_t.
// For windows backward compatibility, we define JpegSizeType as different types
// according to the libjpeg version used, in order to prevent compilation
// errors.
#if defined(_WIN32) || !defined(JPEG_LIB_VERSION_MAJOR) || \
JPEG_LIB_VERSION_MAJOR < 9 || \
#if !defined(JPEG_LIB_VERSION_MAJOR) || JPEG_LIB_VERSION_MAJOR < 9 || \
(JPEG_LIB_VERSION_MAJOR == 9 && JPEG_LIB_VERSION_MINOR <= 2)
using JpegSizeType = unsigned long;
#else
Expand Down

0 comments on commit c9bf464

Please sign in to comment.