Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 1, 2024
1 parent d8012b3 commit acc281c
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -3851,10 +3851,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
Expand Down Expand Up @@ -3908,11 +3906,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;

Check warning on line 3912 in src/_imaging.c

View check run for this annotation

Codecov / codecov/patch

src/_imaging.c#L3912

Added line #L3912 was not covered by tests
} else {
Expand All @@ -3927,18 +3922,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;

Check warning on line 3935 in src/_imaging.c

View check run for this annotation

Codecov / codecov/patch

src/_imaging.c#L3935

Added line #L3935 was not covered by tests
} else {
Expand All @@ -3953,8 +3945,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 {
Expand Down

0 comments on commit acc281c

Please sign in to comment.