diff --git a/setup.py b/setup.py index c95222756..292f0f603 100644 --- a/setup.py +++ b/setup.py @@ -783,7 +783,9 @@ class pil_build_ext(build_ext): if _find_include_file(self, "jxl/encode.h") and _find_include_file( self, "jxl/decode.h" ): - if _find_library_file(self, "jxl"): + if _find_library_file(self, "jxl") and _find_library_file( + self, "jxl_threads" + ): feature.set("jpegxl", "jxl") if feature.want("imagequant"): @@ -1012,7 +1014,6 @@ class pil_build_ext(build_ext): jpegxl = feature.get("jpegxl") if isinstance(jpegxl, str): - # jxl and jxl_threads are required libs = [jpegxl, jpegxl + "_threads"] self._update_extension("PIL._jpegxl", libs) else: diff --git a/src/_jpegxl.c b/src/_jpegxl.c index b812061f6..3bb3d7f26 100644 --- a/src/_jpegxl.c +++ b/src/_jpegxl.c @@ -1,6 +1,5 @@ #define PY_SSIZE_T_CLEAN #include -#include #include "libImaging/Imaging.h" #include @@ -295,8 +294,8 @@ decoder_loop_skip_process: decp->status = JxlDecoderGetBoxType(decp->decoder, btype, JXL_TRUE); _JXL_CHECK("JxlDecoderGetBoxType"); - bool is_box_exif = !memcmp(btype, "Exif", 4); - bool is_box_xmp = !memcmp(btype, "xml ", 4); + int is_box_exif = !memcmp(btype, "Exif", 4); + int is_box_xmp = !memcmp(btype, "xml ", 4); if (!is_box_exif && !is_box_xmp) { // not exif/xmp box so continue continue; @@ -472,6 +471,7 @@ end: decp->status ); PyErr_SetString(PyExc_OSError, err_msg); + return NULL; } PyObject * @@ -562,7 +562,6 @@ setup_module(PyObject *m) { return -1; } - // TODO(oloke) ready object types? PyObject *d = PyModule_GetDict(m); PyObject *v = PyUnicode_FromString(JpegXlDecoderVersion_str()); PyDict_SetItemString(d, "libjxl_version", v ? v : Py_None);