summaryrefslogtreecommitdiffstats
path: root/src/H5HG.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-12-07 18:40:54 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-12-07 18:40:54 (GMT)
commitb58e9a6253c5b0a5beff9bd444f68cf64c2533e9 (patch)
tree7664696bd7a7925901bbccef4f4a8078ac3cb1a3 /src/H5HG.c
parentbdc304d6128607b6ee00e822be850416959d0732 (diff)
downloadhdf5-b58e9a6253c5b0a5beff9bd444f68cf64c2533e9.zip
hdf5-b58e9a6253c5b0a5beff9bd444f68cf64c2533e9.tar.gz
hdf5-b58e9a6253c5b0a5beff9bd444f68cf64c2533e9.tar.bz2
[svn-r959] Changes since 19981125
---------------------- ./src/H5HG.c Fixed a bug in the alignment calculation for the heap free space. The reference test passes now.
Diffstat (limited to 'src/H5HG.c')
-rw-r--r--src/H5HG.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/H5HG.c b/src/H5HG.c
index 1149783..e046fe6 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -202,7 +202,7 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
H5HG_heap_t *ret_value = NULL;
uint8_t *p = NULL;
intn i;
- size_t nalloc;
+ size_t nalloc, need;
FUNC_ENTER (H5HG_load, NULL);
@@ -294,7 +294,18 @@ H5HG_load (H5F_t *f, const haddr_t *addr, const void __unused__ *udata1,
p += 4; /*reserved*/
H5F_decode_length (f, p, heap->obj[idx].size);
heap->obj[idx].begin = begin;
- p = begin + H5HG_ALIGN(heap->obj[idx].size);
+ /*
+ * The total storage size includes the size of the object header
+ * and is zero padded so the next object header is properly
+ * aligned. The last bit of space is the free space object whose
+ * size is never padded and already includes the object header.
+ */
+ if (idx>0) {
+ need = H5HG_ALIGN(H5HG_SIZEOF_OBJHDR(f) + heap->obj[idx].size);
+ } else {
+ need = heap->obj[idx].size;
+ }
+ p = begin + need;
}
}
assert(p==heap->chunk+heap->size);