From 23bd5bd54c59c0c76deb77560a0d53b2e2e32275 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 10 May 2020 13:11:39 +0200 Subject: [PATCH] Fix regression introduced in #1619 --- libvips/conversion/cast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index 1fa86341..9c29d335 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -129,7 +129,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION ); * CAST_UINT() for an INT source, and vice versa. */ #define CAST_UINT( X ) VIPS_MAX( 0, (X) ) -#define CAST_INT( X ) VIPS_MIN( (X), INT_MAX ) +#define CAST_INT( X ) (X) /* Rightshift an integer type, ie. sizeof(ITYPE) > sizeof(OTYPE). */ @@ -222,7 +222,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION ); OTYPE * restrict q = (OTYPE *) out; \ \ for( x = 0; x < sz; x++ ) \ - q[x] = p[x]; \ + q[x] = CAST( p[x] ); \ } /* Cast complex types to an int type. Just take the real part. @@ -232,7 +232,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION ); OTYPE * restrict q = (OTYPE *) out; \ \ for( x = 0; x < sz; x++ ) { \ - q[x] = p[0]; \ + q[x] = CAST( p[0] ); \ p += 2; \ } \ }