summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-23 20:40:14 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-23 20:40:14 (GMT)
commite40557304fcfc662bb1a445abca516ee4b246d94 (patch)
treec9f1692443a62e0c481c7c0278e39d7b83d1b419 /src/H5O.c
parent1062b4f9d7080a3e439df7d3d527aee43f96d085 (diff)
downloadhdf5-e40557304fcfc662bb1a445abca516ee4b246d94.zip
hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.gz
hdf5-e40557304fcfc662bb1a445abca516ee4b246d94.tar.bz2
[svn-r12803] Description:
Finish new version of the I/O pipeline message, which is much smaller than the previous version. This version is used with the "use the latest version of the format" flag. Closed several memory leaks/overruns (found with valgrind). Also, lots of compiler & formatting cleanups. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/H5O.c b/src/H5O.c
index d0422c1..c2528f9 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -2836,7 +2836,7 @@ H5O_move_msgs_forward(H5O_t *oh)
/* (We'll merge them together later, in another routine) */
if(H5O_NULL_ID != nonnull_msg->type->id) {
/* Copy raw data for non-null message to new location */
- HDmemcpy(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
+ HDmemmove(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh),
nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), nonnull_msg->raw_size + H5O_SIZEOF_MSGHDR_OH(oh));
/* Adjust non-null message's offset in chunk */
@@ -2929,10 +2929,14 @@ H5O_move_msgs_forward(H5O_t *oh)
null_msg->dirty = TRUE;
/* Create new null message for previous location of non-null message */
- if(oh->nmesgs >= oh->alloc_nmesgs)
+ if(oh->nmesgs >= oh->alloc_nmesgs) {
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages")
+ /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */
+ curr_msg = &oh->mesg[u];
+ } /* end if */
+
/* Get message # for new null message */
new_null_msg = oh->nmesgs++;
} /* end else */
@@ -3837,10 +3841,9 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx,
H5O_mesg_t *null_msg; /* Pointer to new null message */
/* Check if we need to extend message table to hold the new null message */
- if(oh->nmesgs >= oh->alloc_nmesgs) {
+ if(oh->nmesgs >= oh->alloc_nmesgs)
if(H5O_alloc_msgs(oh, (size_t)1) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages")
- } /* end if */
/* Increment new gap size */
oh->chunk[chunkno].gap += new_gap_size;