summaryrefslogtreecommitdiffstats
path: root/src/H5B.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-04-23 12:31:21 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-04-23 12:31:21 (GMT)
commitd534a4dd0d1e646c531a31a5eb04842dfde5f470 (patch)
tree47b946b229d929139cf0fcad389e790d6a382e70 /src/H5B.c
parent94dd2f5b3d93c2e14ef2491e70a09a836affdf4c (diff)
downloadhdf5-d534a4dd0d1e646c531a31a5eb04842dfde5f470.zip
hdf5-d534a4dd0d1e646c531a31a5eb04842dfde5f470.tar.gz
hdf5-d534a4dd0d1e646c531a31a5eb04842dfde5f470.tar.bz2
[svn-r1204] Changes since 19990415
---------------------- ./config/depend.in Fixed automatic dependencies. We were storing dependencies for *.o files instead of *.lo files after shared libraries were added. ./config/gnu-flags ./config/linux-gnulibc1 Moved `-march=pentiumpro -mcpu=pentiumpro -malign-double' from the linux file to this file and caused it to depend on the CPU name. This fixes one of Elena's bugs. ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5Dprivate.h ./src/H5Dpublic.h ./src/H5F.c ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5Gnode.c ./src/H5P.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Tpublic.h ./test/istore.c Added an H5Dget_storage_size() function that reports the amount of storage allocated for raw data in a dataset. Changed H5D_xfer_* to H5F_xfer_* because these properties are more general than datasets. This also allows some of the lower-level I/O functions to get this information easier. ./src/H5S.c ./src/H5Sall.c Added two new functions H5S_all_read() and H5S_all_write() which are optimizations that copy data directly between file and memory without having to go through the scatter gather step. This knocks quite a bit of time off the I/O and reading/writing entire datasets is a fairly common operation. ./tools/h5ls.c Reports the logical size of data, the allocated size of data, and the percent utilization. ./MANIFEST Removed old pablo files, added new files. Snapshots should now start to work again. ./src/H5D.c ./src/H5Fmpio.c Removed two warnings signed vs. unsigned comparisons and check for overflow.
Diffstat (limited to 'src/H5B.c')
-rw-r--r--src/H5B.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 09bb967..ffc829e 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -1482,6 +1482,8 @@ H5B_insert_helper(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
* Jun 23 1997
*
* Modifications:
+ * Robb Matzke, 1999-04-21
+ * The key values are passed to the function which is called.
*
*-------------------------------------------------------------------------
*/
@@ -1493,6 +1495,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
haddr_t next_addr;
const haddr_t *cur_addr = NULL;
haddr_t *child = NULL;
+ uint8_t *key = NULL;
intn i, nchildren;
herr_t ret_value = FAIL;
@@ -1507,7 +1510,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
assert(addr && H5F_addr_defined(addr));
assert(udata);
- if (NULL == (bt = H5AC_find(f, H5AC_BT, addr, type, udata))) {
+ if (NULL == (bt=H5AC_find(f, H5AC_BT, addr, type, udata))) {
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL,
"unable to load B-tree node");
}
@@ -1524,7 +1527,8 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
* We've reached the left-most leaf. Now follow the right-sibling
* pointer from leaf to leaf until we've processed all leaves.
*/
- if (NULL==(child = H5MM_malloc (2*H5B_K(f,type)*sizeof(haddr_t)))) {
+ if (NULL==(child=H5MM_malloc(2*H5B_K(f,type)*sizeof(haddr_t))) ||
+ NULL==(key=H5MM_malloc((2*H5B_K(f, type)+1)*type->sizeof_nkey))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@@ -1533,8 +1537,9 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
cur_addr=&next_addr) {
/*
- * Save all the child addresses since we can't leave the B-tree
- * node protected during an application callback.
+ * Save all the child addresses and native keys since we can't
+ * leave the B-tree node protected during an application
+ * callback.
*/
if (NULL==(bt=H5AC_find (f, H5AC_BT, cur_addr, type, udata))) {
HGOTO_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL, "B-tree node");
@@ -1542,6 +1547,11 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
for (i=0; i<bt->nchildren; i++) {
child[i] = bt->child[i];
}
+ for (i=0; i<bt->nchildren+1; i++) {
+ H5B_decode_key(f, bt, i);
+ memcpy(key+i*type->sizeof_nkey, bt->key[i].nkey,
+ type->sizeof_nkey);
+ }
next_addr = bt->right;
nchildren = bt->nchildren;
bt = NULL;
@@ -1551,10 +1561,13 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, const haddr_t *addr,
* application callback.
*/
for (i=0, ret_value=0; i<nchildren && !ret_value; i++) {
- ret_value = (type->list)(f, child+i, udata);
+ ret_value = (type->list)(f, key+i*type->sizeof_nkey,
+ child+i, key+(i+1)*type->sizeof_nkey,
+ udata);
}
}
- H5MM_xfree (child);
+ H5MM_xfree(child);
+ H5MM_xfree(key);
}
done: