diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-18 13:52:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-11-18 13:52:32 (GMT) |
commit | 7972dfc940fa8d7a5e55f8cf6776cbb781b16af4 (patch) | |
tree | 94bef7d997f16bad3bc56aacfcca3e37ccca82db /src | |
parent | 92a2d15859ed3be404f39fb72a21d0d3e82732da (diff) | |
download | hdf5-7972dfc940fa8d7a5e55f8cf6776cbb781b16af4.zip hdf5-7972dfc940fa8d7a5e55f8cf6776cbb781b16af4.tar.gz hdf5-7972dfc940fa8d7a5e55f8cf6776cbb781b16af4.tar.bz2 |
[svn-r12942] Description:
Fix H5Rget_name() routine with dataset region references and merge tests
into getname test.
Tested on:
FreeBSD/32 4.11 (sleipnir)
Linux/32 2.4 (heping)
Linux/64 2.4 (mir)
AIX/32 5.? (copper)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5R.c | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -211,11 +211,11 @@ H5R_create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type, H5 if(NULL == (buf = H5MM_malloc((size_t)buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - /* Serialize information for dataset OID */ + /* Serialize information for dataset OID into heap buffer */ p = (uint8_t *)buf; H5F_addr_encode(loc->oloc->file, &p, obj_loc.oloc->addr); - /* Serialize the selection */ + /* Serialize the selection into heap buffer */ if(H5S_SELECT_SERIALIZE(space, p) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") @@ -829,15 +829,26 @@ H5R_get_name(H5F_t *f, hid_t dxpl_id, hid_t id, H5R_type_t ref_type, case H5R_DATASET_REGION: { - const uint8_t *p; /* Pointer to reference to decode */ + const hdset_reg_ref_t *ref = (const hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */ + H5HG_t hobjid; /* Heap object ID */ + uint8_t *buf; /* Buffer to store serialized selection in */ + const uint8_t *p; /* Pointer to OID to store */ - /* Skip over the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - p += H5F_SIZEOF_ADDR(f); - p += 4; + /* Get the heap ID for the dataset region */ + p = (const uint8_t *)ref; + H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); + INT32DECODE(p, hobjid.idx); + + /* Get the dataset region from the heap (allocate inside routine) */ + if((buf = H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") /* Get the object oid for the dataset */ - H5F_addr_decode(oloc.file, &p, &oloc.addr); + p = buf; + H5F_addr_decode(oloc.file, &p, &(oloc.addr)); + + /* Free the buffer allocated in H5HG_read() */ + H5MM_xfree(buf); } /* end case */ break; |