diff options
Diffstat (limited to 'src/H5Fdeprec.c')
-rw-r--r-- | src/H5Fdeprec.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 4a3bce0..d423b21 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -116,7 +116,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) * the top file in a mount hierarchy) */ if(H5I_get_type(obj_id) == H5I_FILE ) { - if(NULL == (f = (H5F_t *)H5I_object(obj_id))) + if(NULL == (f = (H5F_t *)H5VL_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") } /* end if */ else { @@ -145,5 +145,46 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_info1() */ + +/*------------------------------------------------------------------------- + * Function: H5Fis_hdf5 + * + * Purpose: Check the file signature to detect an HDF5 file. + * + * Bugs: This function is not robust: it only uses the default file + * driver when attempting to open the file when in fact it + * should use all known file drivers. + * + * Return: Success: TRUE/FALSE + * + * Failure: Negative + * + * Programmer: Unknown + * + * Modifications: + * Robb Matzke, 1999-08-02 + * Rewritten to use the virtual file layer. + *------------------------------------------------------------------------- + */ +htri_t +H5Fis_hdf5(const char *name) +{ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("t", "*s", name); + + /* Check args and all the boring stuff. */ + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + + /* Call private routine */ + if((ret_value = H5F_is_hdf5(name, H5P_FILE_ACCESS_DEFAULT, H5AC_ind_read_dxpl_id)) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fis_hdf5() */ + #endif /* H5_NO_DEPRECATED_SYMBOLS */ |