From d226ab354bc5c4b18fd8b1dc36b41371a8329f12 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 12 Oct 2024 23:33:25 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_imaging.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/_imaging.c b/src/_imaging.c index f123e1a0a78..ab038b5a997 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -3804,10 +3804,8 @@ _compare_pixels( // Fortunately, all of the modes that have extra bytes in their pixels // use four bytes for their pixels. UINT32 mask = 0xffffffff; - if ( - !strcmp(mode, "RGB") || !strcmp(mode, "YCbCr") || - !strcmp(mode, "HSV") || !strcmp(mode, "LAB") - ) { + if (!strcmp(mode, "RGB") || !strcmp(mode, "YCbCr") || !strcmp(mode, "HSV") || + !strcmp(mode, "LAB")) { // These modes have three channels in four bytes, // so we have to ignore the last byte. #ifdef WORDS_BIGENDIAN @@ -3861,11 +3859,8 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op const Imaging img_a = self->image; const Imaging img_b = ((ImagingObject *)other)->image; - if ( - strcmp(img_a->mode, img_b->mode) - || img_a->xsize != img_b->xsize - || img_a->ysize != img_b->ysize - ) { + if (strcmp(img_a->mode, img_b->mode) || img_a->xsize != img_b->xsize || + img_a->ysize != img_b->ysize) { if (op == Py_EQ) { Py_RETURN_FALSE; } else { @@ -3880,18 +3875,15 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op const UINT8 *palette_b_data = palette_b->palette; const UINT8 **palette_a_data_ptr = &palette_a_data; const UINT8 **palette_b_data_ptr = &palette_b_data; - if ( - !palette_a || !palette_b - || palette_a->size != palette_b->size - || strcmp(palette_a->mode, palette_b->mode) - || _compare_pixels( + if (!palette_a || !palette_b || palette_a->size != palette_b->size || + strcmp(palette_a->mode, palette_b->mode) || + _compare_pixels( palette_a->mode, 1, palette_a->size * 4, palette_a_data_ptr, palette_b_data_ptr - ) - ) { + )) { if (op == Py_EQ) { Py_RETURN_FALSE; } else { @@ -3906,8 +3898,7 @@ image_richcompare(const ImagingObject *self, const PyObject *other, const int op img_a->linesize, (const UINT8 **)img_a->image, (const UINT8 **)img_b->image - ) - ) { + )) { if (op == Py_EQ) { Py_RETURN_FALSE; } else {