summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2013-09-27 20:15:52 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2013-09-27 20:15:52 (GMT)
commit421e7549a51278be725053146d76d3e631917f44 (patch)
treef1f19f1a5913a90f1bdb5ac6ed35769da30ef52f /src/H5F.c
parentebc0b44fe18a40b7f31bdde45ec9f16edd4f658a (diff)
downloadhdf5-421e7549a51278be725053146d76d3e631917f44.zip
hdf5-421e7549a51278be725053146d76d3e631917f44.tar.gz
hdf5-421e7549a51278be725053146d76d3e631917f44.tar.bz2
[svn-r24210] Jira issue 8528: H5Fget_obj_ids overfilled the list of object IDs by one. I moved the safeguard in H5F_get_objects_cb
to the beginning of the function to prevent overfill the list. I added a new test case for this problem and fix in tfile.c. Tested with h5committest.
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 676daef..04e627b 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -667,6 +667,13 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
HDassert(obj_ptr);
HDassert(olist);
+ /* 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_iterate needs the return value of
+ * FALSE to continue the iteration. */
+ if(olist->max_index>0 && olist->list_index>=olist->max_index)
+ HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */
+
/* Count file IDs */
if(olist->obj_type == H5I_FILE) {
if((olist->file_info.local &&
@@ -682,13 +689,6 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Increment the number of open objects */
if(olist->obj_id_count)
(*olist->obj_id_count)++;
-
- /* 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_iterate needs the return value of
- * FALSE to continue the iteration. */
- if(olist->max_index>0 && olist->list_index>=olist->max_index)
- HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */
}
} /* end if */
else { /* either count opened object IDs or put the IDs on the list */
@@ -747,13 +747,6 @@ H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key)
/* Increment the number of open objects */
if(olist->obj_id_count)
(*olist->obj_id_count)++;
-
- /* 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_iterate needs the return value of
- * FALSE to continue iterating. */
- if(olist->max_index>0 && olist->list_index>=olist->max_index)
- HGOTO_DONE(TRUE) /* Indicate that the iterator should stop */
} /* end if */
} /* end else */