cast to unsigned int did not remove <0

previously cast to uint did nothing (since the positive range of uint is
greater than int), now it changes <0 values to 0
This commit is contained in:
John Cupitt 2012-04-10 14:26:41 +01:00
parent 57cf9011e7
commit 7af1fb34d7
3 changed files with 12 additions and 1 deletions

View File

@ -3,6 +3,7 @@
- fix warning for unused vips7 gvalue argument
- fix openslide read: always return png-style rgba, im_argb2rgba() becomes a
NOP
- cast to unsigned int now removes <0 values
13/3/12 started 7.28.2
- xres/yres tiffsave args were broken

View File

@ -45,6 +45,8 @@
* - gtk-doc
* 27/10/11
* - redone as a class
* 10/4/12
* - cast to uint now removes <0 values
*/
/*
@ -288,7 +290,7 @@ vips_cast_start( VipsImage *out, void *a, void *b )
break; \
\
case VIPS_FORMAT_UINT: \
INT( ITYPE, unsigned int, VIPS_CLIP_NONE ); \
INT( ITYPE, unsigned int, VIPS_CLIP_UINT ); \
break; \
\
case VIPS_FORMAT_INT: \

View File

@ -146,6 +146,14 @@ G_STMT_START { \
} \
} G_STMT_END
#define VIPS_CLIP_UINT( V, SEQ ) \
G_STMT_START { \
if( (V) < 0 ) { \
(SEQ)->underflow++; \
(V) = 0; \
} \
} G_STMT_END
#define VIPS_CLIP_NONE( V, SEQ ) {}
const char *vips_enum_string( GType enm, int value );