Skip to content

Commit 52912c3

Browse files
committed
Check for presence of jxl_threads
1 parent 0b70b34 commit 52912c3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,9 @@ def build_extensions(self) -> None:
783783
if _find_include_file(self, "jxl/encode.h") and _find_include_file(
784784
self, "jxl/decode.h"
785785
):
786-
if _find_library_file(self, "jxl"):
786+
if _find_library_file(self, "jxl") and _find_library_file(
787+
self, "jxl_threads"
788+
):
787789
feature.set("jpegxl", "jxl")
788790

789791
if feature.want("imagequant"):
@@ -1012,7 +1014,6 @@ def build_extensions(self) -> None:
10121014

10131015
jpegxl = feature.get("jpegxl")
10141016
if isinstance(jpegxl, str):
1015-
# jxl and jxl_threads are required
10161017
libs = [jpegxl, jpegxl + "_threads"]
10171018
self._update_extension("PIL._jpegxl", libs)
10181019
else:

src/_jpegxl.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#define PY_SSIZE_T_CLEAN
22
#include <Python.h>
3-
#include <stdbool.h>
43
#include "libImaging/Imaging.h"
54

65
#include <jxl/codestream_header.h>
@@ -295,8 +294,8 @@ _jxl_decoder_new(PyObject *self, PyObject *args) {
295294
decp->status = JxlDecoderGetBoxType(decp->decoder, btype, JXL_TRUE);
296295
_JXL_CHECK("JxlDecoderGetBoxType");
297296

298-
bool is_box_exif = !memcmp(btype, "Exif", 4);
299-
bool is_box_xmp = !memcmp(btype, "xml ", 4);
297+
int is_box_exif = !memcmp(btype, "Exif", 4);
298+
int is_box_xmp = !memcmp(btype, "xml ", 4);
300299
if (!is_box_exif && !is_box_xmp) {
301300
// not exif/xmp box so continue
302301
continue;
@@ -472,6 +471,7 @@ _jxl_decoder_get_next(PyObject *self) {
472471
decp->status
473472
);
474473
PyErr_SetString(PyExc_OSError, err_msg);
474+
return NULL;
475475
}
476476

477477
PyObject *
@@ -562,7 +562,6 @@ setup_module(PyObject *m) {
562562
return -1;
563563
}
564564

565-
// TODO(oloke) ready object types?
566565
PyObject *d = PyModule_GetDict(m);
567566
PyObject *v = PyUnicode_FromString(JpegXlDecoderVersion_str());
568567
PyDict_SetItemString(d, "libjxl_version", v ? v : Py_None);

0 commit comments

Comments
 (0)