[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
This commit is contained in:
Quincey Koziol 2003-08-18 11:29:33 -05:00
parent d99164a9ed
commit 4105dfedb9
6 changed files with 94 additions and 8 deletions

View File

@ -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 )

View File

@ -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;

View File

@ -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.

View File

@ -34,6 +34,7 @@ static int interface_initialize_g = 0;
/* Static function prototypes */
#ifdef H5_WANT_H5_V1_6_COMPAT
/*-------------------------------------------------------------------------
* Function: H5Pget_version
@ -65,8 +66,79 @@ 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, 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
*
* 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, 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 */
/*-------------------------------------------------------------------------

View File

@ -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,

View File

@ -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 */