oops upstream/downstream typo

This commit is contained in:
John Cupitt 2010-03-10 15:35:55 +00:00
parent 49b6534033
commit c80452f70b
4 changed files with 57 additions and 36 deletions

21
TODO
View File

@ -1,24 +1,3 @@
- add a dependency on the icc-profiles package
the vips load/save ops need to search the icc-profile dir
where is it? is there a pkg-config for it?
no, just dumps profiles into /usr/share/color/icc
configure should test for the dir? what's the equivalent dir on Windows? we
also have nip2's dir
Windows:
C:\Windows\System32\spool\drivers\color
OS X
/Library/ColorSync/Profiles
added VIPS_ICC_DIR to configure.in, need to search this in format operations
- doing im_create_fmask() and friends
- how about im_invalidate_area()? we currently repaint the whole window on

View File

@ -59,6 +59,7 @@ im_demand_type im_char2dhint( const char *str );
void im_printdesc( IMAGE *image );
int im_image_sanity( IMAGE *im );
void im_image_sanity_all( void );
#ifdef __cplusplus
}

View File

@ -446,6 +446,22 @@ im__print_one( int n )
im_printdesc( im );
}
static void *
sanity_upstream( IMAGE *im_up, IMAGE *im_down )
{
if( !g_slist_find( im_up->downstream, im_down ) ||
!g_slist_find( im_down->upstream, im_up ) )
return( im_up );
return( NULL );
}
static void *
sanity_downstream( IMAGE *im_down, IMAGE *im_up )
{
return( sanity_upstream( im_up, im_down ) );
}
/* Test an image for sanity. We could add many more tests here.
*/
static const char *
@ -463,20 +479,34 @@ image_sanity( IMAGE *im )
}
g_mutex_unlock( im__global_lock );
if( im->Xsize <= 0 || im->Ysize <= 0 || im->Bands <= 0 )
return( "bad dimensions" );
if( im->BandFmt < -1 || im->BandFmt > IM_BANDFMT_DPCOMPLEX ||
(im->Coding != -1 &&
im->Coding != IM_CODING_NONE &&
im->Coding != IM_CODING_LABQ &&
im->Coding != IM_CODING_RAD) ||
im->Type > IM_TYPE_GREY16 )
return( "bad enum value" );
if( im->dtype > IM_PARTIAL ||
im->dhint > IM_ANY )
return( "bad enum value" );
if( im->Xres < 0 || im->Xres < 0 )
return( "bad resolution" );
/* All -1 means im has been inited but never used.
*/
if( im->Xsize != -1 ||
im->Ysize != -1 ||
im->Bands != -1 ||
im->BandFmt != -1 ) {
if( im->Xsize <= 0 || im->Ysize <= 0 || im->Bands <= 0 )
return( "bad dimensions" );
if( im->BandFmt < -1 || im->BandFmt > IM_BANDFMT_DPCOMPLEX ||
(im->Coding != -1 &&
im->Coding != IM_CODING_NONE &&
im->Coding != IM_CODING_LABQ &&
im->Coding != IM_CODING_RAD) ||
im->Type > IM_TYPE_GREY16 )
return( "bad enum value" );
if( im->dtype > IM_PARTIAL ||
im->dhint > IM_ANY )
return( "bad enum value" );
if( im->Xres < 0 || im->Xres < 0 )
return( "bad resolution" );
}
if( im_slist_map2( im->upstream,
(VSListMap2Fn) sanity_upstream, im, NULL ) )
return( "upstream broken" );
if( im_slist_map2( im->downstream,
(VSListMap2Fn) sanity_downstream, im, NULL ) )
return( "downstream broken" );
return( NULL );
}
@ -498,3 +528,10 @@ im_image_sanity( IMAGE *im )
return( 0 );
}
void
im_image_sanity_all( void )
{
g_assert( im_slist_map2( im__open_images,
(VSListMap2Fn) im_image_sanity, NULL, NULL ) == 0 );
}

View File

@ -59,6 +59,7 @@
#include <vips/vips.h>
#include <vips/internal.h>
#include <vips/debug.h>
#ifdef WITH_DMALLOC
#include <dmalloc.h>
@ -77,7 +78,7 @@ im__link_make( IMAGE *im_up, IMAGE *im_down )
g_assert( im_down );
im_up->downstream = g_slist_prepend( im_up->downstream, im_down );
im_down->upstream = g_slist_prepend( im_down->downstream, im_up );
im_down->upstream = g_slist_prepend( im_down->upstream, im_up );
/* Propogate the progress indicator.
*/
@ -119,6 +120,9 @@ im__link_break_all( IMAGE *im )
(VSListMap2Fn) im__link_break, im, NULL );
im_slist_map2( im->downstream,
(VSListMap2Fn) im__link_break_rev, im, NULL );
g_assert( !im->upstream );
g_assert( !im->downstream );
}
static void *