fix G_STMT oopses
This commit is contained in:
parent
9f76b45389
commit
5684349d56
@ -46,6 +46,7 @@
|
|||||||
- im_profile() works for any image format, any number of bands
|
- im_profile() works for any image format, any number of bands
|
||||||
- im_rank_image() works for mix of formats, bands
|
- im_rank_image() works for mix of formats, bands
|
||||||
- morph gtk-doc done
|
- morph gtk-doc done
|
||||||
|
- oops, missing braces in debug.h and util.h, thanks Laurence
|
||||||
|
|
||||||
12/5/10 started 7.22.2
|
12/5/10 started 7.22.2
|
||||||
- the conditional image of ifthenelse can be any format, a (!=0) is added if
|
- the conditional image of ifthenelse can be any format, a (!=0) is added if
|
||||||
|
@ -36,34 +36,34 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef VIPS_DEBUG
|
#ifdef VIPS_DEBUG
|
||||||
#define VIPS_DEBUG_MSG( ... ) \
|
#define VIPS_DEBUG_MSG( ... ) \
|
||||||
G_STMT_START printf( __VA_ARGS__ ); G_STMT_END
|
G_STMT_START { printf( __VA_ARGS__ ); } G_STMT_END
|
||||||
#else
|
#else
|
||||||
#define VIPS_DEBUG_MSG( ... ) \
|
#define VIPS_DEBUG_MSG( ... ) \
|
||||||
G_STMT_START ; G_STMT_END
|
G_STMT_START { ; } G_STMT_END
|
||||||
#endif /*VIPS_DEBUG*/
|
#endif /*VIPS_DEBUG*/
|
||||||
|
|
||||||
#ifdef VIPS_DEBUG_RED
|
#ifdef VIPS_DEBUG_RED
|
||||||
#define VIPS_DEBUG_MSG_RED( ... ) \
|
#define VIPS_DEBUG_MSG_RED( ... ) \
|
||||||
G_STMT_START printf( "red: " __VA_ARGS__ ); G_STMT_END
|
G_STMT_START { printf( "red: " __VA_ARGS__ ); } G_STMT_END
|
||||||
#else
|
#else
|
||||||
#define VIPS_DEBUG_MSG_RED( ... ) \
|
#define VIPS_DEBUG_MSG_RED( ... ) \
|
||||||
G_STMT_START ; G_STMT_END
|
G_STMT_START { ; } G_STMT_END
|
||||||
#endif /*VIPS_DEBUG_RED*/
|
#endif /*VIPS_DEBUG_RED*/
|
||||||
|
|
||||||
#ifdef VIPS_DEBUG_AMBER
|
#ifdef VIPS_DEBUG_AMBER
|
||||||
#define VIPS_DEBUG_MSG_AMBER( ... ) \
|
#define VIPS_DEBUG_MSG_AMBER( ... ) \
|
||||||
G_STMT_START printf( "amber: " __VA_ARGS__ ); G_STMT_END
|
G_STMT_START { printf( "amber: " __VA_ARGS__ ); } G_STMT_END
|
||||||
#else
|
#else
|
||||||
#define VIPS_DEBUG_MSG_AMBER( ... ) \
|
#define VIPS_DEBUG_MSG_AMBER( ... ) \
|
||||||
G_STMT_START ; G_STMT_END
|
G_STMT_START { ; } G_STMT_END
|
||||||
#endif /*VIPS_DEBUG_AMBER*/
|
#endif /*VIPS_DEBUG_AMBER*/
|
||||||
|
|
||||||
#ifdef VIPS_DEBUG_GREEN
|
#ifdef VIPS_DEBUG_GREEN
|
||||||
#define VIPS_DEBUG_MSG_GREEN( ... ) \
|
#define VIPS_DEBUG_MSG_GREEN( ... ) \
|
||||||
G_STMT_START printf( "green: " __VA_ARGS__ ); G_STMT_END
|
G_STMT_START { printf( "green: " __VA_ARGS__ ); } G_STMT_END
|
||||||
#else
|
#else
|
||||||
#define VIPS_DEBUG_MSG_GREEN( ... ) \
|
#define VIPS_DEBUG_MSG_GREEN( ... ) \
|
||||||
G_STMT_START ; G_STMT_END
|
G_STMT_START { ; } G_STMT_END
|
||||||
#endif /*VIPS_DEBUG_GREEN*/
|
#endif /*VIPS_DEBUG_GREEN*/
|
||||||
|
|
||||||
/* All open image descriptors ... see im_init() and im_close().
|
/* All open image descriptors ... see im_init() and im_close().
|
||||||
|
@ -46,40 +46,41 @@ extern "C" {
|
|||||||
|
|
||||||
/* Convert degrees->rads and vice-versa.
|
/* Convert degrees->rads and vice-versa.
|
||||||
*/
|
*/
|
||||||
#define IM_RAD( r ) (((r) / 360.0) * 2.0 * IM_PI)
|
#define IM_RAD( R ) (((R) / 360.0) * 2.0 * IM_PI)
|
||||||
#define IM_DEG( a ) (((a) / (2.0 * IM_PI)) * 360.0)
|
#define IM_DEG( A ) (((A) / (2.0 * IM_PI)) * 360.0)
|
||||||
|
|
||||||
#define IM_MAX(A,B) ((A)>(B)?(A):(B))
|
#define IM_MAX( A, B ) ((A) > (B) ? (A) : (B))
|
||||||
#define IM_MIN(A,B) ((A)<(B)?(A):(B))
|
#define IM_MIN( A, B ) ((A) < (B) ? (A) : (B))
|
||||||
#define IM_ABS(x) (((x) >= 0) ? (x) : -(x))
|
#define IM_ABS( X ) (((X) >= 0) ? (X) : -(X))
|
||||||
|
|
||||||
#define IM_CLIP(A,V,B) IM_MAX( (A), IM_MIN( (B), (V) ) )
|
#define IM_CLIP( A, V, B ) IM_MAX( (A), IM_MIN( (B), (V) ) )
|
||||||
#define IM_NUMBER(R) ((int)(sizeof(R)/sizeof(R[0])))
|
#define IM_NUMBER( R ) ((int) (sizeof(R) / sizeof(R[0])))
|
||||||
|
|
||||||
#define IM_SWAP( TYPE, A, B ) { \
|
#define IM_SWAP( TYPE, A, B ) \
|
||||||
|
G_STMT_START { \
|
||||||
TYPE t = (A); \
|
TYPE t = (A); \
|
||||||
(A) = (B); \
|
(A) = (B); \
|
||||||
(B) = t; \
|
(B) = t; \
|
||||||
}
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_FREEF( F, S ) \
|
#define IM_FREEF( F, S ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( S ) { \
|
if( S ) { \
|
||||||
(void) F( (S) ); \
|
(void) F( (S) ); \
|
||||||
(S) = 0; \
|
(S) = 0; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
/* Can't just use IM_FREEF(), we want the extra cast to void on the argument
|
/* Can't just use IM_FREEF(), we want the extra cast to void on the argument
|
||||||
* to im_free() to make sure we can work for "const char *" variables.
|
* to im_free() to make sure we can work for "const char *" variables.
|
||||||
*/
|
*/
|
||||||
#define IM_FREE( S ) \
|
#define IM_FREE( S ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( S ) { \
|
if( S ) { \
|
||||||
(void) im_free( (void *) (S) ); \
|
(void) im_free( (void *) (S) ); \
|
||||||
(S) = 0; \
|
(S) = 0; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_SETSTR( S, V ) \
|
#define IM_SETSTR( S, V ) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
@ -97,7 +98,7 @@ G_STMT_START { \
|
|||||||
/* Duff's device. Do OPERation N times in a 16-way unrolled loop.
|
/* Duff's device. Do OPERation N times in a 16-way unrolled loop.
|
||||||
*/
|
*/
|
||||||
#define IM_UNROLL( N, OPER ) \
|
#define IM_UNROLL( N, OPER ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( (N) ) { \
|
if( (N) ) { \
|
||||||
int duff_count = ((N) + 15) / 16; \
|
int duff_count = ((N) + 15) / 16; \
|
||||||
\
|
\
|
||||||
@ -121,16 +122,16 @@ G_STMT_START \
|
|||||||
} while( --duff_count > 0 ); \
|
} while( --duff_count > 0 ); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
/* Round a float to the nearest integer. Much faster than rint().
|
/* Round a float to the nearest integer. Much faster than rint().
|
||||||
*/
|
*/
|
||||||
#define IM_RINT( R ) ((int)((R)>0?((R)+0.5):((R)-0.5)))
|
#define IM_RINT( R ) ((int) ((R) > 0 ? ((R) + 0.5) : ((R) - 0.5)))
|
||||||
|
|
||||||
/* Various integer range clips. Record over/under flows.
|
/* Various integer range clips. Record over/under flows.
|
||||||
*/
|
*/
|
||||||
#define IM_CLIP_UCHAR( V, SEQ ) \
|
#define IM_CLIP_UCHAR( V, SEQ ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( (V) < 0 ) { \
|
if( (V) < 0 ) { \
|
||||||
(SEQ)->underflow++; \
|
(SEQ)->underflow++; \
|
||||||
(V) = 0; \
|
(V) = 0; \
|
||||||
@ -139,10 +140,10 @@ G_STMT_START \
|
|||||||
(SEQ)->overflow++; \
|
(SEQ)->overflow++; \
|
||||||
(V) = UCHAR_MAX; \
|
(V) = UCHAR_MAX; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_CLIP_USHORT( V, SEQ ) \
|
#define IM_CLIP_USHORT( V, SEQ ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( (V) < 0 ) { \
|
if( (V) < 0 ) { \
|
||||||
(SEQ)->underflow++; \
|
(SEQ)->underflow++; \
|
||||||
(V) = 0; \
|
(V) = 0; \
|
||||||
@ -151,10 +152,10 @@ G_STMT_START \
|
|||||||
(SEQ)->overflow++; \
|
(SEQ)->overflow++; \
|
||||||
(V) = USHRT_MAX; \
|
(V) = USHRT_MAX; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_CLIP_CHAR( V, SEQ ) \
|
#define IM_CLIP_CHAR( V, SEQ ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( (V) < SCHAR_MIN ) { \
|
if( (V) < SCHAR_MIN ) { \
|
||||||
(SEQ)->underflow++; \
|
(SEQ)->underflow++; \
|
||||||
(V) = SCHAR_MIN; \
|
(V) = SCHAR_MIN; \
|
||||||
@ -163,10 +164,10 @@ G_STMT_START \
|
|||||||
(SEQ)->overflow++; \
|
(SEQ)->overflow++; \
|
||||||
(V) = SCHAR_MAX; \
|
(V) = SCHAR_MAX; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_CLIP_SHORT( V, SEQ ) \
|
#define IM_CLIP_SHORT( V, SEQ ) \
|
||||||
G_STMT_START \
|
G_STMT_START { \
|
||||||
if( (V) < SHRT_MIN ) { \
|
if( (V) < SHRT_MIN ) { \
|
||||||
(SEQ)->underflow++; \
|
(SEQ)->underflow++; \
|
||||||
(V) = SHRT_MIN; \
|
(V) = SHRT_MIN; \
|
||||||
@ -175,7 +176,7 @@ G_STMT_START \
|
|||||||
(SEQ)->overflow++; \
|
(SEQ)->overflow++; \
|
||||||
(V) = SHRT_MAX; \
|
(V) = SHRT_MAX; \
|
||||||
} \
|
} \
|
||||||
G_STMT_END
|
} G_STMT_END
|
||||||
|
|
||||||
#define IM_CLIP_NONE( V, SEQ ) {}
|
#define IM_CLIP_NONE( V, SEQ ) {}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ rank_start( IMAGE *out, void *a, void *b )
|
|||||||
sort[lower + 1], sort[upper] );\
|
sort[lower + 1], sort[upper] );\
|
||||||
if( sort[lower] > sort[lower + 1] ) \
|
if( sort[lower] > sort[lower + 1] ) \
|
||||||
IM_SWAP( TYPE, \
|
IM_SWAP( TYPE, \
|
||||||
sort[lower], sort[lower + 1] ) \
|
sort[lower], sort[lower + 1] );\
|
||||||
\
|
\
|
||||||
i = lower + 1; \
|
i = lower + 1; \
|
||||||
j = upper; \
|
j = upper; \
|
||||||
|
Loading…
Reference in New Issue
Block a user