diff options
Diffstat (limited to 'src/H5O.c')
-rw-r--r-- | src/H5O.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -91,7 +91,7 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); static herr_t H5O_dest(H5F_t *f, H5O_t *oh); static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy); -static herr_t H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr); +static herr_t H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr); /* H5O inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_OHDR[1] = {{ @@ -833,7 +833,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image); } - oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk); + if(oh->chunk) + oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk); /* destroy messages */ for (i = 0; i < oh->nmesgs; i++) { @@ -845,7 +846,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) else H5O_free_real(oh->mesg[i].type, oh->mesg[i].native); } - oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg); + if(oh->mesg) + oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg); /* destroy object header */ H5FL_FREE(H5O_t,oh); @@ -923,7 +925,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) +H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr) { unsigned u; size_t size; @@ -938,9 +940,7 @@ H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) size = H5O_SIZEOF_HDR(f); for (u = 0; u < oh->nchunks; u++) - { size += oh->chunk[u].size; - } HDassert(size >= H5O_SIZEOF_HDR(f)); @@ -3130,7 +3130,7 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg) +H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg) { const H5O_class_t *type; /* Actual H5O class type for the ID */ size_t ret_value; /* Return value */ @@ -3487,7 +3487,7 @@ done: *------------------------------------------------------------------------- */ void* -H5O_decode(H5F_t *f, unsigned char *buf, unsigned type_id) +H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id) { const H5O_class_t *type; /* Actual H5O class type for the ID */ void *ret_value=NULL; /* Return value */ |