From ad7d1753c57cba83a5228a7d86851450e90becd9 Mon Sep 17 00:00:00 2001 From: James Zern Date: Sun, 7 Aug 2022 10:07:12 -0700 Subject: [PATCH] dsp/lossless_enc.c: clear int sanitizer warnings add explicit casts in calls to ColorTransformDelta() clears warnings of the form: implicit conversion from type 'uint8_t' (aka 'unsigned char') of value 254 (8-bit, unsigned) to type 'int8_t' (aka 'signed char') changed the value to -2 (8-bit, signed) Bug: b/229626362 Change-Id: I40618209509508f56d8053f9daa29cf2e6999766 --- src/dsp/lossless_enc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dsp/lossless_enc.c b/src/dsp/lossless_enc.c index 9ac2e443..27a612fc 100644 --- a/src/dsp/lossless_enc.c +++ b/src/dsp/lossless_enc.c @@ -547,10 +547,10 @@ void VP8LTransformColor_C(const VP8LMultipliers* const m, uint32_t* data, const int8_t red = U32ToS8(argb >> 16); int new_red = red & 0xff; int new_blue = argb & 0xff; - new_red -= ColorTransformDelta(m->green_to_red_, green); + new_red -= ColorTransformDelta((int8_t)m->green_to_red_, green); new_red &= 0xff; - new_blue -= ColorTransformDelta(m->green_to_blue_, green); - new_blue -= ColorTransformDelta(m->red_to_blue_, red); + new_blue -= ColorTransformDelta((int8_t)m->green_to_blue_, green); + new_blue -= ColorTransformDelta((int8_t)m->red_to_blue_, red); new_blue &= 0xff; data[i] = (argb & 0xff00ff00u) | (new_red << 16) | (new_blue); } @@ -560,7 +560,7 @@ static WEBP_INLINE uint8_t TransformColorRed(uint8_t green_to_red, uint32_t argb) { const int8_t green = U32ToS8(argb >> 8); int new_red = argb >> 16; - new_red -= ColorTransformDelta(green_to_red, green); + new_red -= ColorTransformDelta((int8_t)green_to_red, green); return (new_red & 0xff); } @@ -570,8 +570,8 @@ static WEBP_INLINE uint8_t TransformColorBlue(uint8_t green_to_blue, const int8_t green = U32ToS8(argb >> 8); const int8_t red = U32ToS8(argb >> 16); uint8_t new_blue = argb & 0xff; - new_blue -= ColorTransformDelta(green_to_blue, green); - new_blue -= ColorTransformDelta(red_to_blue, red); + new_blue -= ColorTransformDelta((int8_t)green_to_blue, green); + new_blue -= ColorTransformDelta((int8_t)red_to_blue, red); return (new_blue & 0xff); }