summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-14 12:18:34 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-14 12:18:34 (GMT)
commitf29e3e10975ee2164ca1ad1c0964108f3dc117d0 (patch)
treeaf4af98e9ba8f166f29429a5eeb9aaa0c8283ac3 /src
parent374ad0ef30754b2a4a78c5ab3a16acd8e5c4c6fc (diff)
downloadhdf5-f29e3e10975ee2164ca1ad1c0964108f3dc117d0.zip
hdf5-f29e3e10975ee2164ca1ad1c0964108f3dc117d0.tar.gz
hdf5-f29e3e10975ee2164ca1ad1c0964108f3dc117d0.tar.bz2
[svn-r7362] Purpose:
Bug fix Description: Allow a user block to be "inserted" in front of a file (probably by writing a validly-sized userblock to a new file and then appending another HDF5 file to the new file). Platforms tested: FreeBSD 4.8 (sleipnir) h5committested
Diffstat (limited to 'src')
-rw-r--r--src/H5Distore.c2
-rw-r--r--src/H5F.c15
-rw-r--r--src/H5Fistore.c2
3 files changed, 16 insertions, 3 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c
index fa969f0..929a3e0 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -2666,7 +2666,7 @@ H5F_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, H5B_INS_ERROR, "unable to clear sieve buffer");
/* Remove raw data chunk from file */
- H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes);
+ H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes);
/* Mark keys as unchanged */
*lt_key_changed = FALSE;
diff --git a/src/H5F.c b/src/H5F.c
index 6600196..097093d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2124,6 +2124,19 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
if (H5G_ent_decode(file, &p, &root_ent/*out*/)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root symbol entry");
+ /* Check if superblock address is different from base address and
+ * adjust base address and "end of address" address if so.
+ */
+ if(!H5F_addr_eq(shared->super_addr,shared->base_addr)) {
+ /* Check if the superblock moved earlier in the file */
+ if(H5F_addr_lt(shared->super_addr,shared->base_addr))
+ stored_eoa -= (shared->base_addr-shared->super_addr);
+ /* The superblock moved later in the file */
+ else
+ stored_eoa += (shared->super_addr-shared->base_addr);
+ shared->base_addr = shared->super_addr;
+ } /* end if */
+
/* Compute super block checksum */
assert(sizeof(chksum)==sizeof(shared->super_chksum));
for(q=(uint8_t *)&chksum, chksum=0, i=0; i<(fixed_size+variable_size); i++)
@@ -2196,7 +2209,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
/*
* Tell the file driver how much address space has already been
- * allocated so that it knows how to allocated additional memory.
+ * allocated so that it knows how to allocate additional memory.
*/
if (H5FD_set_eoa(lf, stored_eoa)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to set end-of-address marker for file");
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index fa969f0..929a3e0 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -2666,7 +2666,7 @@ H5F_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, H5B_INS_ERROR, "unable to clear sieve buffer");
/* Remove raw data chunk from file */
- H5FD_free(f->shared->lf, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes);
+ H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes);
/* Mark keys as unchanged */
*lt_key_changed = FALSE;