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 Jul 19, 2024
1 parent b6ce6ab commit d5053fb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 26 deletions.
21 changes: 13 additions & 8 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ _new(PyObject *self, PyObject *args) {
return NULL;
}

return PyImagingNew(
ImagingNew(mode, (ImagingNewParams){xsize, ysize, depth, bands}));
return PyImagingNew(ImagingNew(mode, (ImagingNewParams){xsize, ysize, depth, bands})
);
}

static PyObject *
Expand Down Expand Up @@ -953,7 +953,8 @@ _color_lut_3d(ImagingObject *self, PyObject *args) {
}

imOut = ImagingNewDirty(
mode, (ImagingNewParams){self->image->xsize, self->image->ysize});
mode, (ImagingNewParams){self->image->xsize, self->image->ysize}
);
if (!imOut) {
free(prepared_table);
return NULL;
Expand Down Expand Up @@ -1765,8 +1766,9 @@ _quantize(ImagingObject *self, PyObject *args) {

if (!self->image->xsize || !self->image->ysize) {
/* no content; return an empty image */
return PyImagingNew(ImagingNew(
"P", (ImagingNewParams){self->image->xsize, self->image->ysize}));
return PyImagingNew(
ImagingNew("P", (ImagingNewParams){self->image->xsize, self->image->ysize})
);
}

return PyImagingNew(ImagingQuantize(self->image, colours, method, kmeans));
Expand Down Expand Up @@ -2159,15 +2161,17 @@ _transpose(ImagingObject *self, PyObject *args) {
case 3: /* rotate 180 */
imOut = ImagingNewDirty(
imIn->mode,
(ImagingNewParams){imIn->xsize, imIn->ysize, imIn->depth, imIn->bands});
(ImagingNewParams){imIn->xsize, imIn->ysize, imIn->depth, imIn->bands}
);
break;
case 2: /* rotate 90 */
case 4: /* rotate 270 */
case 5: /* transpose */
case 6: /* transverse */
imOut = ImagingNewDirty(
imIn->mode,
(ImagingNewParams){imIn->ysize, imIn->xsize, imIn->depth, imIn->bands});
(ImagingNewParams){imIn->ysize, imIn->xsize, imIn->depth, imIn->bands}
);
break;
default:
PyErr_SetString(PyExc_ValueError, "No such transpose operation");
Expand Down Expand Up @@ -2848,7 +2852,8 @@ _font_getmask(ImagingFontObject *self, PyObject *args) {
}

im = ImagingNew(
self->bitmap->mode, (ImagingNewParams){textwidth(self, text), self->ysize});
self->bitmap->mode, (ImagingNewParams){textwidth(self, text), self->ysize}
);
if (!im) {
free(text);
return ImagingError_MemoryError();
Expand Down
3 changes: 2 additions & 1 deletion src/libImaging/Crop.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ ImagingCrop(Imaging imIn, int sx0, int sy0, int sx1, int sy1) {
}

imOut = ImagingNewDirty(
imIn->mode, (ImagingNewParams){xsize, ysize, imIn->depth, imIn->bands});
imIn->mode, (ImagingNewParams){xsize, ysize, imIn->depth, imIn->bands}
);
if (!imOut) {
return NULL;
}
Expand Down
12 changes: 8 additions & 4 deletions src/libImaging/Geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ ImagingRotate90(Imaging imOut, Imaging imIn) {
memcpy(
out + yyy * imIn->pixelsize,
in + xxx * imIn->pixelsize,
imIn->pixelsize);
imIn->pixelsize
);
}
}
}
Expand Down Expand Up @@ -158,7 +159,8 @@ ImagingTranspose(Imaging imOut, Imaging imIn) {
memcpy(
out + yyy * imIn->pixelsize,
in + xxx * imIn->pixelsize,
imIn->pixelsize);
imIn->pixelsize
);
}
}
}
Expand Down Expand Up @@ -210,7 +212,8 @@ ImagingTransverse(Imaging imOut, Imaging imIn) {
memcpy(
out + yr * imIn->pixelsize,
in + xxx * imIn->pixelsize,
imIn->pixelsize);
imIn->pixelsize
);
}
}
}
Expand Down Expand Up @@ -293,7 +296,8 @@ ImagingRotate270(Imaging imOut, Imaging imIn) {
memcpy(
out + yr * imIn->pixelsize,
in + xxx * imIn->pixelsize,
imIn->pixelsize);
imIn->pixelsize
);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/libImaging/Imaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ struct ImagingCodecStateInstance {
int xsize, ysize, xoff, yoff;
ImagingShuffler shuffle;
void (*mb_shuffle)(
UINT8 *dst, const UINT8 *src, Imaging im, ImagingCodecState state);
UINT8 *dst, const UINT8 *src, Imaging im, ImagingCodecState state
);
int bits, bytes;
UINT8 *buffer;
void *context;
Expand Down
3 changes: 2 additions & 1 deletion src/libImaging/RankFilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ MakeRankFunction(UINT8) MakeRankFunction(INT32) MakeRankFunction(FLOAT32)
}

imOut = ImagingNew(
im->mode, (ImagingNewParams){im->xsize - 2 * margin, im->ysize - 2 * margin});
im->mode, (ImagingNewParams){im->xsize - 2 * margin, im->ysize - 2 * margin}
);
if (!imOut) {
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libImaging/Reduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,8 +1462,8 @@ ImagingReduce(Imaging imIn, int xscale, int yscale, int box[4]) {

imOut = ImagingNewDirty(
imIn->mode,
(ImagingNewParams){
(box[2] + xscale - 1) / xscale, (box[3] + yscale - 1) / yscale}
(ImagingNewParams
){(box[2] + xscale - 1) / xscale, (box[3] + yscale - 1) / yscale}
);
if (!imOut) {
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion src/libImaging/Resample.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ ImagingResampleInner(
}

imTemp = ImagingNewDirty(
imIn->mode, (ImagingNewParams){xsize, ybox_last - ybox_first});
imIn->mode, (ImagingNewParams){xsize, ybox_last - ybox_first}
);
if (imTemp) {
ResampleHorizontal(
imTemp, imIn, ybox_first, ksize_horiz, bounds_horiz, kk_horiz
Expand Down
12 changes: 5 additions & 7 deletions src/libImaging/Storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ ImagingNewPrologueSubtype(const char *mode, ImagingNewParams p, int size) {

} else if (strcmp(mode, IMAGING_MODE_MB) == 0) {
if (p.bands <= 0 || p.depth <= 0) {
return (Imaging)ImagingError_ValueError(
"multi-band missing bands and depth");
return (Imaging)ImagingError_ValueError("multi-band missing bands and depth"
);
}
im->bands = p.bands;
im->depth = p.depth;
Expand Down Expand Up @@ -236,9 +236,7 @@ ImagingNewPrologueSubtype(const char *mode, ImagingNewParams p, int size) {

Imaging
ImagingNewPrologue(const char *mode, ImagingNewParams p) {
return ImagingNewPrologueSubtype(
mode, p, sizeof(struct ImagingMemoryInstance)
);
return ImagingNewPrologueSubtype(mode, p, sizeof(struct ImagingMemoryInstance));
}

void
Expand Down Expand Up @@ -570,8 +568,8 @@ ImagingNew2Dirty(const char *mode, Imaging imOut, Imaging imIn) {
} else {
/* create new image */
imOut = ImagingNewDirty(
mode,
(ImagingNewParams){imIn->xsize, imIn->ysize, imIn->depth, imIn->bands});
mode, (ImagingNewParams){imIn->xsize, imIn->ysize, imIn->depth, imIn->bands}
);
if (!imOut) {
return NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion src/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
im = ImagingNewPrologueSubtype(
mode,
(ImagingNewParams){xsize, ysize, depth, bands},
sizeof(ImagingBufferInstance));
sizeof(ImagingBufferInstance)
);
if (!im) {
PyBuffer_Release(&view);
return NULL;
Expand Down

0 comments on commit d5053fb

Please sign in to comment.