Skip to content

Commit

Permalink
Fix jpg.cc for MinGW-w64 (libjxl#3821)
Browse files Browse the repository at this point in the history
* Fix jpg.cc for MinGW-w64

Fix the following error when building with MinGW-w64:

```raw
lib/extras/enc/jpg.cc:277:34: error: cannot convert 'long unsigned int*' to 'size_t*' {aka 'long long
unsigned int*'}
  277 |   jpeg_mem_dest(&cinfo, &buffer, &size);
      |                                  ^~~~~
      |                                  |
      |                                  long unsigned int*
```

* Update jpg.cc

Use LIBJPEG_TURBO_VERSION to detect if libjpeg-turbo is used

* format

---------

Co-authored-by: Moritz Firsching <firsching@google.com>
(cherry picked from commit 0266f4d)
  • Loading branch information
brechtsanders authored and mo271 committed Nov 26, 2024
1 parent 22f3e7c commit 143d0f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/extras/enc/jpg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ Status EncodeWithLibJpeg(const PackedImage& image, const JxlBasicInfo& info,
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
unsigned char* buffer = nullptr;
#ifdef LIBJPEG_TURBO_VERSION
unsigned long size = 0; // NOLINT
#else
size_t size = 0; // NOLINT
#endif
jpeg_mem_dest(&cinfo, &buffer, &size);
cinfo.image_width = image.xsize;
cinfo.image_height = image.ysize;
Expand Down

0 comments on commit 143d0f2

Please sign in to comment.