summaryrefslogtreecommitdiffstats
path: root/src/H5Ocont.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-17 20:36:15 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-17 20:36:15 (GMT)
commit3a2bcc84aca2a8fb3913c560b83cbb028c18bab9 (patch)
treef0da2af79e861321438061fc45c8ae90e63df624 /src/H5Ocont.c
parentf7a8a14bfd9d2c103c5d9be8adb578bec4a1b015 (diff)
downloadhdf5-3a2bcc84aca2a8fb3913c560b83cbb028c18bab9.zip
hdf5-3a2bcc84aca2a8fb3913c560b83cbb028c18bab9.tar.gz
hdf5-3a2bcc84aca2a8fb3913c560b83cbb028c18bab9.tar.bz2
[svn-r12771] Description:
More fixes to make the I/O & memory operations more efficient when loading & flushing object header chunks. Add in concept of a chunk having a "gap" at the end - unused space that is not large enough to hold a full null message that describes it. Clean up formatting a bit. Latest version of object header format not enabled yet, still working on a few bugs... Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Ocont.c')
-rw-r--r--src/H5Ocont.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index 4d84b1c..b0966d3 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -94,25 +94,27 @@ H5O_cont_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
H5O_cont_t *cont = NULL;
void *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5O_cont_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_cont_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
- /* decode */
- if (NULL==(cont = H5FL_MALLOC(H5O_cont_t)))
+ /* Allocate space for the message */
+ if(NULL == (cont = H5FL_MALLOC(H5O_cont_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+
+ /* Decode */
H5F_addr_decode(f, &p, &(cont->addr));
H5F_DECODE_LENGTH(f, p, cont->size);
- cont->chunkno=0;
+ cont->chunkno = 0;
/* Set return value */
- ret_value=cont;
+ ret_value = cont;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_cont_decode() */
/*-------------------------------------------------------------------------
@@ -264,7 +266,7 @@ static void *
H5O_cont_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t UNUSED *file_dst,
hid_t UNUSED dxpl_id, H5O_copy_t UNUSED *cpy_info, void *udata)
{
- H5O_cont_t *cont_src = (H5O_cont_t *) mesg_src;
+ H5O_cont_t *cont_src = (H5O_cont_t *)mesg_src;
H5O_chunk_t *chunk = (H5O_chunk_t *)udata;
H5O_cont_t *cont_dst = NULL;
void *ret_value; /* Return value */
@@ -273,13 +275,15 @@ H5O_cont_copy_file(H5F_t UNUSED *file_src, void *mesg_src, H5F_t UNUSED *file_ds
/* check args */
HDassert(cont_src);
- HDassert(file_dst);
/* Allocate space for the destination cont */
if(NULL == (cont_dst = H5FL_MALLOC(H5O_cont_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(cont_dst, cont_src, sizeof(H5O_cont_t));
+ /* Shallow copy all the fields */
+ *cont_dst = *cont_src;
+
+ /* Update the destination address to point to correct address in dest. file */
cont_dst->addr = chunk[cont_src->chunkno].addr;
/* Set return value */