From c802385878a7a1b094336e4517cc9f7071e44135 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Jun 2010 16:47:37 +0200 Subject: Fix bailout path when reading pixel flags --- src/hdf5-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/hdf5-file.c') diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 4272cbe6..aa341e50 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -341,6 +341,7 @@ int hdf5_read(struct hdfile *f, struct image *image) mask_dh = H5Dopen(f->fh, "/processing/hitfinder/masks", H5P_DEFAULT); if ( mask_dh <= 0 ) { ERROR("Couldn't open flags\n"); + image->flags = NULL; } else { flags = malloc(sizeof(uint16_t)*f->nx*f->ny); r = H5Dread(mask_dh, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, @@ -351,8 +352,8 @@ int hdf5_read(struct hdfile *f, struct image *image) } else { image->flags = flags; } + H5Dclose(mask_dh); } - H5Dclose(mask_dh); /* Read wavelength from file */ image->lambda = get_wavelength(f); -- cgit v1.2.3 From 8aceac72c01e5233cca21f505355e2acd8cfa4c9 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Jun 2010 16:58:54 +0200 Subject: Disable HDF5 stack traces --- src/hdf5-file.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/hdf5-file.c') diff --git a/src/hdf5-file.c b/src/hdf5-file.c index aa341e50..622fc409 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -45,6 +45,9 @@ struct hdfile *hdfile_open(const char *filename) f = malloc(sizeof(struct hdfile)); if ( f == NULL ) return NULL; + /* Please stop spamming my terminal */ + H5Eset_auto(H5E_DEFAULT, NULL, NULL); + f->fh = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); if ( f->fh < 0 ) { ERROR("Couldn't open file: %s\n", filename); -- cgit v1.2.3 From 31aa8ae2709740dab5ab6ec7a8e28dcd8709b72e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Jun 2010 16:59:08 +0200 Subject: Check saturation table condition earlier --- src/hdf5-file.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/hdf5-file.c') diff --git a/src/hdf5-file.c b/src/hdf5-file.c index 622fc409..a5fc7d26 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -242,6 +242,11 @@ static void debodge_saturation(struct hdfile *f, struct image *image) dh = H5Dopen(f->fh, "/processing/hitfinder/peakinfo_saturated", H5P_DEFAULT); + if ( dh < 0 ) { + ERROR("Couldn't open saturation table.\n"); + return; + } + sh = H5Dget_space(dh); if ( sh < 0 ) { H5Dclose(dh); -- cgit v1.2.3