From 4105dfedb98236c9e2029ff14b0694161aabfb05 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 18 Aug 2003 11:29:33 -0500 Subject: [svn-r7379] Purpose: Code cleanup Description: Changed version #'s returned from H5Pget_version from 'int *' to 'unsigned *' since we are never going to be using negative version #'s... :-) Platforms tested: FreeBSD 4.8 (sleipnir) too small to need h5committest --- c++/src/H5FcreatProp.cpp | 2 +- c++/src/H5FcreatProp.h | 2 +- fortran/src/H5Pf.c | 8 ++--- src/H5Pfcpl.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++-- src/H5Ppublic.h | 6 ++++ test/tmisc.c | 7 +++++ 6 files changed, 94 insertions(+), 8 deletions(-) diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index e28a891..6c95905 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -34,7 +34,7 @@ FileCreatPropList::FileCreatPropList() : PropList( H5P_FILE_CREATE ) {} FileCreatPropList::FileCreatPropList( const FileCreatPropList& orig ) : PropList( orig ) {} void FileCreatPropList::getVersion( - int& boot, int& freelist, int& stab, int& shhdr ) const + unsigned& boot, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const { herr_t ret_value = H5Pget_version( id, &boot, &freelist, &stab, &shhdr ); if( ret_value < 0 ) diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 5b73e42..bd6a413 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -32,7 +32,7 @@ class H5_DLLCPP FileCreatPropList : public PropList { FileCreatPropList( const FileCreatPropList& orig ); // Retrieves version information for various parts of a file. - void getVersion( int& boot, int& freelist, int& stab, int& shhdr ) const; + void getVersion( unsigned& boot, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const; // Sets the userblock size field of a file creation property list. void setUserblock( hsize_t size ) const; diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 0e652e3..ea53620 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -456,10 +456,10 @@ nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int ret_value = -1; hid_t c_prp_id; herr_t ret; - int c_boot; - int c_freelist; - int c_stab; - int c_shhdr; + unsigned c_boot; + unsigned c_freelist; + unsigned c_stab; + unsigned c_shhdr; /* * Call H5Pget_version function. diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 35f3e77..4253f73 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -34,6 +34,78 @@ static int interface_initialize_g = 0; /* Static function prototypes */ +#ifdef H5_WANT_H5_V1_6_COMPAT + +/*------------------------------------------------------------------------- + * Function: H5Pget_version + * + * Purpose: Retrieves version information for various parts of a file. + * + * SUPER: The file super block. + * HEAP: The global heap. + * FREELIST: The global free list. + * STAB: The root symbol table entry. + * SHHDR: Shared object headers. + * + * Any (or even all) of the output arguments can be null + * pointers. + * + * Return: Success: Non-negative, version information is returned + * through the arguments. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Wednesday, January 7, 1998 + * + * Modifications: + * + * Raymond Lu, Oct 14, 2001 + * Change to the new generic property list. + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_version(hid_t plist_id, int *_super/*out*/, int *_freelist/*out*/, + int *_stab/*out*/, int *_shhdr/*out*/) +{ + unsigned super,freelist,stab,shhdr; /* Unsigned versions to query into */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_API(H5Pget_version, FAIL); + H5TRACE5("e","ixxxx",plist_id,super,freelist,stab,shhdr); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get values */ + if (_super) { + if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version"); + *_super=(int)super; + } /* end if */ + if (_freelist) { + if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freelist) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version"); + *_freelist=(int)freelist; + } /* end if */ + if (_stab) { + if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &stab) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version"); + *_stab=(int)stab; + } /* end if */ + if (_shhdr) { + if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &shhdr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version"); + *_shhdr=(int)shhdr; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value); +} +#else /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- * Function: H5Pget_version @@ -65,8 +137,8 @@ static int interface_initialize_g = 0; *------------------------------------------------------------------------- */ herr_t -H5Pget_version(hid_t plist_id, int *super/*out*/, int *freelist/*out*/, - int *stab/*out*/, int *shhdr/*out*/) +H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/, + unsigned *stab/*out*/, unsigned *shhdr/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ @@ -95,6 +167,7 @@ H5Pget_version(hid_t plist_id, int *super/*out*/, int *freelist/*out*/, done: FUNC_LEAVE_API(ret_value); } +#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index d91c1f5..40573ea 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -144,9 +144,15 @@ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); H5_DLL herr_t H5Pclose_class(hid_t plist_id); H5_DLL herr_t H5Pclose(hid_t plist_id); H5_DLL hid_t H5Pcopy(hid_t plist_id); +#ifdef H5_WANT_H5_V1_6_COMPAT H5_DLL herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/, int *stab/*out*/, int *shhdr/*out*/); +#else /* H5_WANT_H5_V1_6_COMPAT */ +H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/, + unsigned *freelist/*out*/, unsigned *stab/*out*/, + unsigned *shhdr/*out*/); +#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size); H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size); H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, diff --git a/test/tmisc.c b/test/tmisc.c index c3ede54..8c7ae93 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1712,10 +1712,17 @@ test_misc11(void) unsigned istore_ik; /* Indexed storage B-tree internal 'K' value */ #endif /* H5_WANT_H5_V1_6_COMPAT */ unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */ +#ifdef H5_WANT_H5_V1_6_COMPAT int super; /* Superblock version # */ int freelist; /* Free list version # */ int stab; /* Symbol table entry version # */ int shhdr; /* Shared object header version # */ +#else /* H5_WANT_H5_V1_6_COMPAT */ + unsigned super; /* Superblock version # */ + unsigned freelist; /* Free list version # */ + unsigned stab; /* Symbol table entry version # */ + unsigned shhdr; /* Shared object header version # */ +#endif /* H5_WANT_H5_V1_6_COMPAT */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ -- cgit v0.12