diff options
-rw-r--r-- | c++/src/H5File.cpp | 12 | ||||
-rw-r--r-- | c++/src/H5File.h | 6 | ||||
-rw-r--r-- | fortran/src/H5Ff.c | 26 | ||||
-rw-r--r-- | fortran/src/H5Fff.f90 | 30 | ||||
-rw-r--r-- | fortran/src/H5f90proto.h | 4 | ||||
-rw-r--r-- | fortran/test/tH5F.f90 | 2 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 3 | ||||
-rw-r--r-- | src/H5F.c | 100 | ||||
-rw-r--r-- | src/H5Fprivate.h | 4 | ||||
-rw-r--r-- | src/H5Fpublic.h | 4 | ||||
-rw-r--r-- | test/mount.c | 2 | ||||
-rw-r--r-- | test/tfile.c | 8 |
12 files changed, 129 insertions, 72 deletions
diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index 0e71543..a0cabcc 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -378,9 +378,9 @@ hssize_t H5File::getFreeSpace() const /// Multiple object types can be combined with the logical OR operator (|). // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -int H5File::getObjCount(unsigned types) const +ssize_t H5File::getObjCount(unsigned types) const { - int num_objs = H5Fget_obj_count(id, types); + ssize_t num_objs = H5Fget_obj_count(id, types); if( num_objs < 0 ) { throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed"); @@ -397,9 +397,9 @@ int H5File::getObjCount(unsigned types) const ///\exception H5::FileIException // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -int H5File::getObjCount() const +ssize_t H5File::getObjCount() const { - int num_objs = H5Fget_obj_count(id, H5F_OBJ_ALL); + ssize_t num_objs = H5Fget_obj_count(id, H5F_OBJ_ALL); if( num_objs < 0 ) { throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed"); @@ -432,9 +432,9 @@ int H5File::getObjCount() const // Notes: will do the overload for this one after hearing from Quincey??? // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -void H5File::getObjIDs(unsigned types, int max_objs, hid_t *oid_list) const +void H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const { - herr_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list); + ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list); if( ret_value < 0 ) { throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed"); diff --git a/c++/src/H5File.h b/c++/src/H5File.h index b49118e..b69c963 100644 --- a/c++/src/H5File.h +++ b/c++/src/H5File.h @@ -60,12 +60,12 @@ class H5_DLLCPP H5File : public IdComponent, public CommonFG { // Returns the number of opened object IDs (files, datasets, groups // and datatypes) in the same file. - int getObjCount(unsigned types) const; - int getObjCount() const; + ssize_t getObjCount(unsigned types) const; + ssize_t getObjCount() const; // Retrieves a list of opened object IDs (files, datasets, groups // and datatypes) in the same file. - void getObjIDs(unsigned types, int max_objs, hid_t *oid_list) const; + void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; #ifndef H5_NO_DEPRECATED_SYMBOLS // Retrieves the type of object that an object reference points to. diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 2190d05..674d702 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -411,21 +411,23 @@ nh5fclose_c ( hid_t_f *file_id ) * Programmer: Elena Pourmal * Monday, September 30, 2002 * Modifications: + * Changed type of obj_count to size_t_f + * Thursday, September 25, 2008 *---------------------------------------------------------------------------*/ int_f -nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count) +nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, size_t_f * obj_count) { int ret_value = 0; hid_t c_file_id; unsigned c_obj_type; - int c_obj_count; + ssize_t c_obj_count; c_file_id = (hid_t)*file_id; c_obj_type = (unsigned) *obj_type; if ( (c_obj_count=H5Fget_obj_count(c_file_id, c_obj_type)) < 0 ) ret_value = -1; - *obj_count = (int_f)c_obj_count; + *obj_count = (size_t_f)c_obj_count; return ret_value; } /*---------------------------------------------------------------------------- @@ -438,24 +440,34 @@ nh5fget_obj_count_c ( hid_t_f *file_id , int_f *obj_type, int_f * obj_count) * Programmer: Elena Pourmal * Monday, September 30, 2002 * Modifications: + * Changed type of max_obj to size_t_f; added parameter for the + * number of open objects + * Thursday, September 25, 2008 EIP *---------------------------------------------------------------------------*/ int_f -nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, int_f *max_objs, hid_t_f *obj_ids) +nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs) { int ret_value = 0; hid_t c_file_id; unsigned c_obj_type; - int c_max_objs, i; + int i; + size_t c_max_objs; + ssize_t c_num_objs; hid_t *c_obj_ids; c_file_id = (hid_t)*file_id; c_obj_type = (unsigned) *obj_type; - c_max_objs = (int)*max_objs; + c_max_objs = (size_t)*max_objs; c_obj_ids = (hid_t *)HDmalloc(sizeof(hid_t)*c_max_objs); - if ( H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, c_obj_ids) < 0 ) ret_value = -1; + + c_num_objs = H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, c_obj_ids); + if ( c_num_objs < 0 ) ret_value = -1; for (i=0; i< c_max_objs; i++) obj_ids[i] = (hid_t_f)c_obj_ids[i]; + HDfree(c_obj_ids); + *num_objs = (size_t_f)c_num_objs; + return ret_value; } /*---------------------------------------------------------------------------- diff --git a/fortran/src/H5Fff.f90 b/fortran/src/H5Fff.f90 index 9da5f4a..14a4ac1 100644 --- a/fortran/src/H5Fff.f90 +++ b/fortran/src/H5Fff.f90 @@ -668,7 +668,8 @@ ! September 30, 2002 ! ! Modifications: -! +! Changed the type of obj_count to INTEGER(SIZE_T) +! September 25, 2008 EIP ! Comment: !---------------------------------------------------------------------- @@ -679,7 +680,8 @@ IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(OUT) :: obj_count ! Number of open objects + INTEGER(SIZE_T), INTENT(OUT) :: obj_count + ! Number of open objects INTEGER, INTENT(OUT) :: hdferr ! Error code INTERFACE @@ -690,7 +692,8 @@ !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: file_id INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(OUT) :: obj_count ! Number of open objects + INTEGER(SIZE_T), INTENT(OUT) :: obj_count + ! Number of open objects END FUNCTION h5fget_obj_count_c END INTERFACE @@ -723,36 +726,45 @@ ! September 30, 2002 ! ! Modifications: +! Added optional parameter num_objs for number of open objects +! of the specified type and changed type of max_obj to +! INTEGER(SIZE_T) +! September 25, 2008 EIP ! ! Comment: !---------------------------------------------------------------------- - SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr) + SUBROUTINE h5fget_obj_ids_f(file_id, obj_type, max_objs, obj_ids, hdferr, num_objs) ! !This definition is needed for Windows DLLs IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: file_id ! File identifier INTEGER, INTENT(IN) :: obj_type ! Object type - INTEGER, INTENT(IN) :: max_objs ! Maximum # of objects to retrieve + INTEGER(SIZE_T), INTENT(IN) :: max_objs ! Maximum # of objects to retrieve INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids ! Array of open objects iidentifiers - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(SIZE_T), INTENT(OUT), OPTIONAL :: num_objs + INTEGER(SIZE_T) :: c_num_objs + ! Number of open objects of the specified type INTERFACE - INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids) + INTEGER FUNCTION h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids, c_num_objs) USE H5GLOBAL !DEC$ IF DEFINED(HDF5F90_WINDOWS) !DEC$ ATTRIBUTES C,reference,decorate,alias:'H5FGET_OBJ_IDS_C':: h5fget_obj_ids_c !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: file_id INTEGER, INTENT(IN) :: obj_type - INTEGER, INTENT(IN) :: max_objs + INTEGER(SIZE_T), INTENT(IN) :: max_objs INTEGER(HID_T), DIMENSION(*), INTENT(INOUT) :: obj_ids + INTEGER(SIZE_T), INTENT(OUT) :: c_num_objs END FUNCTION h5fget_obj_ids_c END INTERFACE - hdferr = h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids) + hdferr = h5fget_obj_ids_c(file_id, obj_type, max_objs, obj_ids, c_num_objs) + if (present(num_objs)) num_objs= c_num_objs END SUBROUTINE h5fget_obj_ids_f diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index f812b29..b29af89 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -54,8 +54,8 @@ H5_FCDLL int_f nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen); H5_FCDLL int_f nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2); H5_FCDLL int_f nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id); H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); -H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_count); -H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, hid_t_f *obj_ids); +H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, size_t_f *obj_count); +H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, size_t_f *max_objs, hid_t_f *obj_ids, size_t_f *num_objs); H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space); H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope); H5_FCDLL int_f nh5fget_name_c(hid_t_f *obj_id, size_t_f *size, _fcd buf, size_t_f *buflen); diff --git a/fortran/test/tH5F.f90 b/fortran/test/tH5F.f90 index 859d66e..e39d0ee 100644 --- a/fortran/test/tH5F.f90 +++ b/fortran/test/tH5F.f90 @@ -578,7 +578,7 @@ INTEGER(HID_T) :: fapl, fapl1, fapl2, fapl3 ! File access identifiers INTEGER(HID_T) :: fid_d_fapl, fid1_fapl ! File access identifiers LOGICAL :: flag - INTEGER :: obj_count, obj_countf + INTEGER(SIZE_T) :: obj_count, obj_countf INTEGER(HID_T), ALLOCATABLE, DIMENSION(:) :: obj_ids INTEGER :: i diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b578744..ec9609b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -106,6 +106,9 @@ Bug Fixes since HDF5-1.8.1 Library ------- + - Changed the return value of H5Fget_obj_count from INT to SSIZE_T. Also + changed the return value of H5Fget_obj_ids from HERR_T to SSIZE_T and + the type of the parameter MAX_OBJS from INT to SIZE_T. (SLU - 2008/09/26) - Fixed an issue that could cause data to be improperly overwritten during compound type conversion. (NAF - 2008/09/19) - Fixed pointer alignment violations that could occur during vlen @@ -51,7 +51,7 @@ typedef struct H5F_olist_t { H5I_type_t obj_type; /* Type of object to look for */ hid_t *obj_id_list; /* Pointer to the list of open IDs to return */ - unsigned *obj_id_count; /* Number of open IDs */ + size_t *obj_id_count; /* Number of open IDs */ struct { hbool_t local; /* Set flag for "local" file searches */ union { @@ -59,12 +59,12 @@ typedef struct H5F_olist_t { const H5F_t *file; /* Pointer to file to look inside */ } ptr; } file_info; - unsigned list_index; /* Current index in open ID array */ - int max_index; /* Maximum # of IDs to put into array */ + size_t list_index; /* Current index in open ID array */ + size_t max_index; /* Maximum # of IDs to put into array */ } H5F_olist_t; /* PRIVATE PROTOTYPES */ -static unsigned H5F_get_objects(const H5F_t *f, unsigned types, int max_objs, hid_t *obj_id_list); +static size_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_objs, hid_t *obj_id_list); static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void** file_handle); static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, @@ -370,14 +370,19 @@ done: * * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 + * Modification: + * Raymond Lu + * 24 September 2008 + * Changed the return value to ssize_t to accommadate + * potential large number of objects. * *------------------------------------------------------------------------- */ -int +ssize_t H5Fget_obj_count(hid_t file_id, unsigned types) { H5F_t *f = NULL; /* File to query */ - int ret_value; /* Return value */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_obj_count, FAIL) H5TRACE2("Is", "iIu", file_id, types); @@ -387,8 +392,8 @@ H5Fget_obj_count(hid_t file_id, unsigned types) if(0 == (types & H5F_OBJ_ALL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") - if((ret_value = H5F_get_obj_count(f, types)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOUNT, FAIL, "can't get object count") + /* H5F_get_obj_count doesn't fail */ + ret_value = H5F_get_obj_count(f, types); done: FUNC_LEAVE_API(ret_value) @@ -401,23 +406,28 @@ done: * Purpose: Private function return the number of opened object IDs * (files, datasets, groups, datatypes) in the same file. * - * Return: Non-negative on success; negative on failure. + * Return: Non-negative on success; can't fail. * * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 * * Modification: + * Raymond Lu + * 24 September 2008 + * Changed the return value to size_t to accommadate + * potential large number of objects. * *------------------------------------------------------------------------- */ -unsigned +size_t H5F_get_obj_count(const H5F_t *f, unsigned types) { - unsigned ret_value; /* Return value */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_obj_count) - ret_value=H5F_get_objects(f, types, -1, NULL); + /* H5F_get_objects doesn't fail */ + ret_value=H5F_get_objects(f, types, 0, NULL); FUNC_LEAVE_NOAPI(ret_value) } @@ -434,14 +444,18 @@ H5F_get_obj_count(const H5F_t *f, unsigned types) * Wednesday, Dec 5, 2001 * * Modification: + * Raymond Lu + * 24 September 2008 + * Changed the return value to ssize_t and MAX_OBJTS to size_t to + * accommadate potential large number of objects. * *------------------------------------------------------------------------- */ -herr_t -H5Fget_obj_ids(hid_t file_id, unsigned types, int max_objs, hid_t *oid_list) +ssize_t +H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) { H5F_t *f = NULL; /* File to query */ - herr_t ret_value; /* Return value */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_obj_ids, FAIL) H5TRACE4("e", "iIuIs*i", file_id, types, max_objs, oid_list); @@ -451,7 +465,8 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, int max_objs, hid_t *oid_list) if(0 == (types & H5F_OBJ_ALL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an object type") HDassert(oid_list); - + + /* H5F_get_objects doesn't fail */ ret_value = H5F_get_obj_ids(f, types, max_objs, oid_list); done: @@ -464,22 +479,27 @@ done: * * Purpose: Private function to return a list of opened object IDs. * - * Return: Non-negative on success; negative on failure. + * Return: Non-negative on success; can't fail. * * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 * * Modification: + * Raymond Lu + * 24 September 2008 + * Changed the return value and MAX_OBJTS to size_t to accommadate + * potential large number of objects. * *------------------------------------------------------------------------- */ -unsigned -H5F_get_obj_ids(const H5F_t *f, unsigned types, int max_objs, hid_t *oid_list) +size_t +H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list) { - unsigned ret_value; /* Return value */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_obj_ids) + /* H5F_get_objects doesn't fail */ ret_value = H5F_get_objects(f, types, max_objs, oid_list); FUNC_LEAVE_NOAPI(ret_value) @@ -492,7 +512,7 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, int max_objs, hid_t *oid_list) * Purpose: This function is called by H5F_get_obj_count or * H5F_get_obj_ids to get number of object IDs and/or a * list of opened object IDs (in return value). - * Return: Non-negative on success; negative on failure. + * Return: Non-negative on success; Can't fail. * * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 @@ -501,12 +521,12 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, int max_objs, hid_t *oid_list) * *--------------------------------------------------------------------------- */ -static unsigned -H5F_get_objects(const H5F_t *f, unsigned types, int max_index, hid_t *obj_id_list) +static size_t +H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list) { - unsigned obj_id_count=0; /* Number of open IDs */ + size_t obj_id_count=0; /* Number of open IDs */ H5F_olist_t olist; /* Structure to hold search results */ - unsigned ret_value; /* Return value */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_objects) @@ -517,7 +537,7 @@ H5F_get_objects(const H5F_t *f, unsigned types, int max_index, hid_t *obj_id_lis olist.max_index = max_index; /* Determine if we are searching for local or global objects */ - if(types&H5F_OBJ_LOCAL) { + if(types & H5F_OBJ_LOCAL) { olist.file_info.local = TRUE; olist.file_info.ptr.file = f; } /* end if */ @@ -527,7 +547,8 @@ H5F_get_objects(const H5F_t *f, unsigned types, int max_index, hid_t *obj_id_lis } /* end else */ /* Search through file IDs to count the number, and put their - * IDs on the object list */ + * IDs on the object list. H5I_search returns NULL if no object + * is found, so don't return failure in this function. */ if(types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; (void)H5I_search(H5I_FILE, H5F_get_objects_cb, &olist); @@ -535,28 +556,28 @@ H5F_get_objects(const H5F_t *f, unsigned types, int max_index, hid_t *obj_id_lis /* Search through dataset IDs to count number of datasets, and put their * IDs on the object list */ - if( (max_index < 0 || (int)olist.list_index < max_index) && (types & H5F_OBJ_DATASET) ) { + if(types & H5F_OBJ_DATASET) { olist.obj_type = H5I_DATASET; (void)H5I_search(H5I_DATASET, H5F_get_objects_cb, &olist); } /* Search through group IDs to count number of groups, and put their * IDs on the object list */ - if( (max_index < 0 || (int)olist.list_index < max_index) && (types & H5F_OBJ_GROUP) ) { + if(types & H5F_OBJ_GROUP) { olist.obj_type = H5I_GROUP; (void)H5I_search(H5I_GROUP, H5F_get_objects_cb, &olist); } /* Search through datatype IDs to count number of named datatypes, and put their * IDs on the object list */ - if( (max_index < 0 || (int)olist.list_index < max_index) && (types & H5F_OBJ_DATATYPE) ) { + if(types & H5F_OBJ_DATATYPE) { olist.obj_type = H5I_DATATYPE; (void)H5I_search(H5I_DATATYPE, H5F_get_objects_cb, &olist); } /* Search through attribute IDs to count number of attributes, and put their * IDs on the object list */ - if( (max_index < 0 || (int)olist.list_index < max_index) && (types & H5F_OBJ_ATTR) ) { + if(types & H5F_OBJ_ATTR) { olist.obj_type = H5I_ATTR; (void)H5I_search(H5I_ATTR, H5F_get_objects_cb, &olist); } @@ -575,6 +596,9 @@ H5F_get_objects(const H5F_t *f, unsigned types, int max_index, hid_t *obj_id_lis * object is in the file, and either count it or put its ID * on the list. * + * Return: TRUE if the array of object IDs is filled up. + * FALSE otherwise. + * * Programmer: Raymond Lu * Wednesday, Dec 5, 2001 * @@ -609,8 +633,11 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_count) (*olist->obj_id_count)++; - /* Check if we've filled up the array */ - if(olist->max_index>=0 && (int)olist->list_index>=olist->max_index) + /* Check if we've filled up the array. Return TRUE only if + * we have filled up the array. Otherwise return FALSE(RET_VALUE is + * preset to FALSE) because H5I_search needs the return value of FALSE + * to continue searching. */ + if(olist->max_index>0 && olist->list_index>=olist->max_index) HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ } } /* end if */ @@ -659,8 +686,11 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) if(olist->obj_id_count) (*olist->obj_id_count)++; - /* Check if we've filled up the array */ - if(olist->max_index>=0 && (int)olist->list_index>=olist->max_index) + /* Check if we've filled up the array. Return TRUE only if + * we have filled up the array. Otherwise return FALSE(RET_VALUE is + * preset to FALSE) because H5I_search needs the return value of FALSE + * to continue searching. */ + if(olist->max_index>0 && olist->list_index>=olist->max_index) HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */ } /* end if */ } /* end else */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index b228b9d..6e902fe 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -470,8 +470,8 @@ H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL char *H5F_get_extpath(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); -H5_DLL unsigned H5F_get_obj_count(const H5F_t *f, unsigned types); -H5_DLL unsigned H5F_get_obj_ids(const H5F_t *f, unsigned types, int max_objs, hid_t *obj_id_list); +H5_DLL size_t H5F_get_obj_count(const H5F_t *f, unsigned types); +H5_DLL size_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *obj_id_list); H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index a055d46..312d92e 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -129,8 +129,8 @@ H5_DLL herr_t H5Fclose(hid_t file_id); H5_DLL hid_t H5Fget_create_plist(hid_t file_id); H5_DLL hid_t H5Fget_access_plist(hid_t file_id); H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent); -H5_DLL int H5Fget_obj_count(hid_t file_id, unsigned types); -H5_DLL int H5Fget_obj_ids(hid_t file_id, unsigned types, int max_objs, hid_t *obj_id_list); +H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); +H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); H5_DLL herr_t H5Funmount(hid_t loc, const char *name); diff --git a/test/mount.c b/test/mount.c index 4a9592f..9f07123 100644 --- a/test/mount.c +++ b/test/mount.c @@ -3392,7 +3392,7 @@ test_cut_graph(hid_t fapl) hid_t gidQ = -1; /* Group IDs in file #7 */ char name[NAME_BUF_SIZE]; /* Buffer for filename retrieved */ ssize_t name_len; /* Filename length */ - int obj_count; /* Number of objects open */ + ssize_t obj_count; /* Number of objects open */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], diff --git a/test/tfile.c b/test/tfile.c index e839630..ff8aa2b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -765,7 +765,7 @@ static void create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, hid_t *ret_gid2, hid_t *ret_gid3) { - int oid_count; + ssize_t oid_count; herr_t ret; /* Check reference counts of file IDs and opened object IDs. @@ -1033,7 +1033,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, hid_t gid2, hid_t gid3) { hid_t fid3, fid4; - int oid_count; + ssize_t oid_count, ret_count; herr_t ret; /* Create two new files */ @@ -1079,8 +1079,8 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, oid_list = (hid_t*)calloc((size_t)oid_count, sizeof(hid_t)); if(oid_list != NULL) { - ret = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, oid_count, oid_list); - CHECK(ret, FAIL, "H5Fget_obj_ids"); + ret_count = H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_ALL, (size_t)oid_count, oid_list); + CHECK(ret_count, FAIL, "H5Fget_obj_ids"); } for(i=0; i<oid_count; i++) { |