From 94c4ac1f347c59a6d88d2337ef3e17252e01ee0f Mon Sep 17 00:00:00 2001 From: Yay295 Date: Thu, 25 Aug 2022 09:29:46 -0500 Subject: [PATCH] make input pointers const --- src/libImaging/Filter.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/libImaging/Filter.c b/src/libImaging/Filter.c index fab3b4948..e05c267c3 100644 --- a/src/libImaging/Filter.c +++ b/src/libImaging/Filter.c @@ -106,9 +106,9 @@ ImagingFilter3x3(Imaging imOut, Imaging im, const float *kernel, float offset) { // Add one time for rounding offset += 0.5; for (y = 1; y < im->ysize - 1; y++) { - UINT8 *in_1 = (UINT8 *)im->image[y - 1]; - UINT8 *in0 = (UINT8 *)im->image[y]; - UINT8 *in1 = (UINT8 *)im->image[y + 1]; + const UINT8 *in_1 = (UINT8 *)im->image[y - 1]; + const UINT8 *in0 = (UINT8 *)im->image[y]; + const UINT8 *in1 = (UINT8 *)im->image[y + 1]; UINT8 *out = (UINT8 *)imOut->image[y]; out[0] = in0[0]; @@ -125,9 +125,9 @@ ImagingFilter3x3(Imaging imOut, Imaging im, const float *kernel, float offset) { // Add one time for rounding offset += 0.5; for (y = 1; y < im->ysize - 1; y++) { - UINT8 *in_1 = (UINT8 *)im->image[y - 1]; - UINT8 *in0 = (UINT8 *)im->image[y]; - UINT8 *in1 = (UINT8 *)im->image[y + 1]; + const UINT8 *in_1 = (UINT8 *)im->image[y - 1]; + const UINT8 *in0 = (UINT8 *)im->image[y]; + const UINT8 *in1 = (UINT8 *)im->image[y + 1]; UINT8 *out = (UINT8 *)imOut->image[y]; memcpy(out, in0, sizeof(UINT32)); @@ -208,11 +208,11 @@ ImagingFilter5x5(Imaging imOut, Imaging im, const float *kernel, float offset) { // Add one time for rounding offset += 0.5; for (y = 2; y < im->ysize - 2; y++) { - UINT8 *in_2 = (UINT8 *)im->image[y - 2]; - UINT8 *in_1 = (UINT8 *)im->image[y - 1]; - UINT8 *in0 = (UINT8 *)im->image[y]; - UINT8 *in1 = (UINT8 *)im->image[y + 1]; - UINT8 *in2 = (UINT8 *)im->image[y + 2]; + const UINT8 *in_2 = (UINT8 *)im->image[y - 2]; + const UINT8 *in_1 = (UINT8 *)im->image[y - 1]; + const UINT8 *in0 = (UINT8 *)im->image[y]; + const UINT8 *in1 = (UINT8 *)im->image[y + 1]; + const UINT8 *in2 = (UINT8 *)im->image[y + 2]; UINT8 *out = (UINT8 *)imOut->image[y]; out[0] = in0[0]; @@ -233,11 +233,11 @@ ImagingFilter5x5(Imaging imOut, Imaging im, const float *kernel, float offset) { // Add one time for rounding offset += 0.5; for (y = 2; y < im->ysize - 2; y++) { - UINT8 *in_2 = (UINT8 *)im->image[y - 2]; - UINT8 *in_1 = (UINT8 *)im->image[y - 1]; - UINT8 *in0 = (UINT8 *)im->image[y]; - UINT8 *in1 = (UINT8 *)im->image[y + 1]; - UINT8 *in2 = (UINT8 *)im->image[y + 2]; + const UINT8 *in_2 = (UINT8 *)im->image[y - 2]; + const UINT8 *in_1 = (UINT8 *)im->image[y - 1]; + const UINT8 *in0 = (UINT8 *)im->image[y]; + const UINT8 *in1 = (UINT8 *)im->image[y + 1]; + const UINT8 *in2 = (UINT8 *)im->image[y + 2]; UINT8 *out = (UINT8 *)imOut->image[y]; memcpy(out, in0, sizeof(UINT32) * 2);