Skip to content

Commit 1140ecf

Browse files
authored
Fix size_t issues across JPEG versions and platforms (#4439)
* Windows use size_t * Temporarily pin jpeg <=9b * Temporarily pin jpeg ==9c * Remove pinning.
1 parent a2b4c65 commit 1140ecf

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

torchvision/csrc/io/image/cpu/encode_jpeg.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ torch::Tensor encode_jpeg(const torch::Tensor& data, int64_t quality) {
1515
#else
1616
// For libjpeg version <= 9b, the out_size parameter in jpeg_mem_dest() is
1717
// defined as unsigned long, whereas in later version, it is defined as size_t.
18-
// For windows backward compatibility, we define JpegSizeType as different types
19-
// according to the libjpeg version used, in order to prevent compilation
20-
// errors.
21-
#if defined(_WIN32) || !defined(JPEG_LIB_VERSION_MAJOR) || \
22-
JPEG_LIB_VERSION_MAJOR < 9 || \
18+
#if !defined(JPEG_LIB_VERSION_MAJOR) || JPEG_LIB_VERSION_MAJOR < 9 || \
2319
(JPEG_LIB_VERSION_MAJOR == 9 && JPEG_LIB_VERSION_MINOR <= 2)
2420
using JpegSizeType = unsigned long;
2521
#else

0 commit comments

Comments
 (0)