[MOAB-dev] r3306 - MOAB/trunk/mhdf/src
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Mon Nov 9 09:27:29 CST 2009
Author: kraftche
Date: 2009-11-09 09:27:29 -0600 (Mon, 09 Nov 2009)
New Revision: 3306
Modified:
MOAB/trunk/mhdf/src/file.c
Log:
fix error reporting for invalid HDF5 files
Modified: MOAB/trunk/mhdf/src/file.c
===================================================================
--- MOAB/trunk/mhdf/src/file.c 2009-11-07 16:51:10 UTC (rev 3305)
+++ MOAB/trunk/mhdf/src/file.c 2009-11-09 15:27:29 UTC (rev 3306)
@@ -289,12 +289,17 @@
API_BEGIN;
/* Check if file is HDF5 */
- if (H5Fis_hdf5( filename ) <= 0)
+ if (H5Fis_hdf5( filename ) <= 0) {
+ mhdf_setFail( status, "%s: File is not HDF5", filename );
return NULL;
+ }
/* Create struct to hold working data */
file_ptr = mhdf_alloc_FileHandle( 0, status );
- if (!file_ptr) return NULL;
+ if (!file_ptr) {
+ mhdf_setFail( status, "Memory allocation failed" );
+ return NULL;
+ }
/* Create the file */
flags = writable ? H5F_ACC_RDWR : H5F_ACC_RDONLY;
@@ -325,6 +330,7 @@
if (!scan_for_max_id( file_ptr, status ))
{
H5Fclose( file_ptr->hdf_handle );
+ mhdf_setFail( status, "Internal error reading file" );
free( file_ptr );
return NULL;
}
More information about the moab-dev
mailing list