From c0c8efc4d74df59791521076d905127b37f9efda Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 6 May 2021 22:16:51 -0700 Subject: Normalization of object header code --- src/H5Oainfo.c | 52 +++++++-------- src/H5Oattr.c | 152 ++++++++++++++++++++++--------------------- src/H5Obogus.c | 32 ++++----- src/H5Obtreek.c | 60 ++++++++--------- src/H5Ocache_image.c | 36 +---------- src/H5Odrvinfo.c | 59 ++++++++--------- src/H5Odtype.c | 180 ++++++++++++++++++++++++++------------------------- src/H5Oefl.c | 54 ++++++++-------- src/H5Ofill.c | 169 ++++++++++++++++++++++++----------------------- src/H5Ofsinfo.c | 78 +++++++++++----------- src/H5Oginfo.c | 56 ++++++++-------- src/H5Olayout.c | 19 ++++-- src/H5Olinfo.c | 38 +++++------ src/H5Olink.c | 52 +++++++-------- src/H5Omtime.c | 70 ++++++++++---------- src/H5Oname.c | 37 +++++------ src/H5Opline.c | 110 +++++++++++++++---------------- src/H5Orefcount.c | 92 +++++++++++++------------- src/H5Osdspace.c | 111 ++++++++++++++++--------------- src/H5Oshmesg.c | 36 +++++------ src/H5Ostab.c | 2 +- 21 files changed, 747 insertions(+), 748 deletions(-) diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 00d279d..10c9ede 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -34,13 +34,13 @@ /* PRIVATE PROTOTYPES */ static void * H5O__ainfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_ainfo_copy(const void *_mesg, void *_dest); -static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__ainfo_copy(const void *_mesg, void *_dest); +static size_t H5O__ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__ainfo_free(void *_mesg); static herr_t H5O__ainfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); -static herr_t H5O_ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *udata); +static herr_t H5O__ainfo_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *udata); static void * H5O__ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); static herr_t H5O__ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, @@ -54,16 +54,16 @@ const H5O_msg_class_t H5O_MSG_AINFO[1] = {{ sizeof(H5O_ainfo_t), /*native message size */ 0, /* messages are sharable? */ H5O__ainfo_decode, /*decode message */ - H5O_ainfo_encode, /*encode message */ - H5O_ainfo_copy, /*copy the native value */ - H5O_ainfo_size, /*size of symbol table entry */ + H5O__ainfo_encode, /*encode message */ + H5O__ainfo_copy, /*copy the native value */ + H5O__ainfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__ainfo_free, /* free method */ H5O__ainfo_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_ainfo_pre_copy_file, /* pre copy native value to file */ + H5O__ainfo_pre_copy_file, /* pre copy native value to file */ H5O__ainfo_copy_file, /* copy native value to file */ H5O__ainfo_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ @@ -156,7 +156,7 @@ done: } /* end H5O__ainfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_encode + * Function: H5O__ainfo_encode * * Purpose: Encodes a message. * @@ -168,12 +168,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; unsigned char flags; /* Flags for encoding attribute info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -205,10 +205,10 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co HDassert(!H5F_addr_defined(ainfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_encode() */ +} /* end H5O__ainfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_copy + * Function: H5O__ainfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -222,13 +222,13 @@ H5O_ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *------------------------------------------------------------------------- */ static void * -H5O_ainfo_copy(const void *_mesg, void *_dest) +H5O__ainfo_copy(const void *_mesg, void *_dest) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; H5O_ainfo_t * dest = (H5O_ainfo_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(ainfo); @@ -243,10 +243,10 @@ H5O_ainfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_copy() */ +} /* end H5O__ainfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_size + * Function: H5O__ainfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -261,12 +261,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ainfo_t *ainfo = (const H5O_ainfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = @@ -280,7 +280,7 @@ H5O_ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void : 0)); /* Address of v2 B-tree for indexing creation order values of attributes */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ainfo_size() */ +} /* end H5O__ainfo_size() */ /*------------------------------------------------------------------------- * Function: H5O__ainfo_free @@ -344,7 +344,7 @@ done: } /* end H5O__ainfo_delete() */ /*------------------------------------------------------------------------- - * Function: H5O_ainfo_pre_copy_file + * Function: H5O__ainfo_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files. @@ -358,10 +358,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, - hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) +H5O__ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, + hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -374,7 +374,7 @@ H5O_ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ainfo_pre_copy_file() */ +} /* end H5O__ainfo_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__ainfo_copy_file diff --git a/src/H5Oattr.c b/src/H5Oattr.c index a8c3c03..db53eaf 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -23,65 +23,65 @@ #include "H5Spkg.h" /* Dataspaces */ /* PRIVATE PROTOTYPES */ -static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void * H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, +static herr_t H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg); +static void *H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static void * H5O_attr_copy(const void *_mesg, void *_dest); -static size_t H5O_attr_size(const H5F_t *f, const void *_mesg); +static void *H5O__attr_copy(const void *_mesg, void *_dest); +static size_t H5O__attr_size(const H5F_t *f, const void *_mesg); static herr_t H5O__attr_free(void *mesg); -static herr_t H5O_attr_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *udata); +static herr_t H5O__attr_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *udata); static void * H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata); static herr_t H5O__attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, void *mesg_dst, H5O_copy_t *cpy_info); -static herr_t H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx); -static herr_t H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx); +static herr_t H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx); +static herr_t H5O__attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx); static herr_t H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_ATTR -#define H5O_SHARED_DECODE H5O_attr_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_attr_decode -#define H5O_SHARED_ENCODE H5O_attr_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_attr_encode -#define H5O_SHARED_SIZE H5O_attr_shared_size -#define H5O_SHARED_SIZE_REAL H5O_attr_size +#define H5O_SHARED_DECODE H5O__attr_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__attr_decode +#define H5O_SHARED_ENCODE H5O__attr_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__attr_encode +#define H5O_SHARED_SIZE H5O__attr_shared_size +#define H5O_SHARED_SIZE_REAL H5O__attr_size #define H5O_SHARED_DELETE H5O__attr_shared_delete #define H5O_SHARED_DELETE_REAL H5O__attr_delete #define H5O_SHARED_LINK H5O__attr_shared_link #define H5O_SHARED_LINK_REAL H5O__attr_link #define H5O_SHARED_COPY_FILE H5O__attr_shared_copy_file #define H5O_SHARED_COPY_FILE_REAL H5O__attr_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_attr_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__attr_shared_post_copy_file #define H5O_SHARED_POST_COPY_FILE_REAL H5O__attr_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_attr_shared_debug +#define H5O_SHARED_DEBUG H5O__attr_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__attr_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{ - H5O_ATTR_ID, /* message id number */ - "attribute", /* message name for debugging */ - sizeof(H5A_t), /* native message size */ - H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ - H5O_attr_shared_decode, /* decode message */ - H5O_attr_shared_encode, /* encode message */ - H5O_attr_copy, /* copy the native value */ - H5O_attr_shared_size, /* size of raw message */ - H5O__attr_reset, /* reset method */ - H5O__attr_free, /* free method */ - H5O__attr_shared_delete, /* file delete method */ - H5O__attr_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /* can share method */ - H5O_attr_pre_copy_file, /* pre copy native value to file */ - H5O__attr_shared_copy_file, /* copy native value to file */ - H5O_attr_shared_post_copy_file, /* post copy native value to file */ - H5O_attr_get_crt_index, /* get creation index */ - H5O_attr_set_crt_index, /* set creation index */ - H5O_attr_shared_debug /* debug the message */ + H5O_ATTR_ID, /* message id number */ + "attribute", /* message name for debugging */ + sizeof(H5A_t), /* native message size */ + H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ + H5O__attr_shared_decode, /* decode message */ + H5O__attr_shared_encode, /* encode message */ + H5O__attr_copy, /* copy the native value */ + H5O__attr_shared_size, /* size of raw message */ + H5O__attr_reset, /* reset method */ + H5O__attr_free, /* free method */ + H5O__attr_shared_delete, /* file delete method */ + H5O__attr_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + H5O__attr_pre_copy_file, /* pre copy native value to file */ + H5O__attr_shared_copy_file, /* copy native value to file */ + H5O__attr_shared_post_copy_file, /* post copy native value to file */ + H5O__attr_get_crt_index, /* get creation index */ + H5O__attr_set_crt_index, /* set creation index */ + H5O__attr_shared_debug /* debug the message */ }}; /* Flags for attribute flag encoding */ @@ -97,14 +97,17 @@ H5FL_EXTERN(H5S_extent_t); /*-------------------------------------------------------------------------- NAME - H5O_attr_decode + H5O__attr_decode PURPOSE Decode a attribute message and return a pointer to a memory struct with the decoded information USAGE - void *H5O_attr_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct - unsigned mesg_flags; IN: Message flags to influence decoding + void *H5O__attr_decode(f, mesg_flags, p) + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header + unsigned mesg_flags; IN: message flags to influence decoding + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure @@ -114,8 +117,8 @@ H5FL_EXTERN(H5S_extent_t); function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p) { H5A_t * attr = NULL; H5S_extent_t *extent; /*extent dimensionality information */ @@ -126,7 +129,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, un unsigned flags = 0; /* Attribute flags */ H5A_t * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -264,15 +267,15 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_decode() */ +} /* end H5O__attr_decode() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_encode + H5O__attr_encode PURPOSE Encode a simple attribute message USAGE - herr_t H5O_attr_encode(f, p, mesg) + herr_t H5O__attr_encode(f, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const uint8 *p; IN: the raw information buffer const void *mesg; IN: Pointer to the simple datatype struct @@ -283,7 +286,7 @@ done: message in the "raw" disk form. --------------------------------------------------------------------------*/ static herr_t -H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) +H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) { const H5A_t *attr = (const H5A_t *)mesg; size_t name_len; /* Attribute name length */ @@ -292,7 +295,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) unsigned flags = 0; /* Attribute flags */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -372,15 +375,15 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) done: FUNC_LEAVE_NOAPI(ret_value); -} /* end H5O_attr_encode() */ +} /* end H5O__attr_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_copy + H5O__attr_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_attr_copy(mesg, dest) + void *H5O__attr_copy(mesg, dest) const void *mesg; IN: Pointer to the source attribute struct const void *dest; IN: Pointer to the destination attribute struct RETURNS @@ -390,11 +393,11 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_attr_copy(const void *_src, void *_dst) +H5O__attr_copy(const void *_src, void *_dst) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(_src); @@ -405,15 +408,15 @@ H5O_attr_copy(const void *_src, void *_dst) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_copy() */ +} /* end H5O__attr_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_attr_size + H5O__attr_size PURPOSE Return the raw message size in bytes USAGE - size_t H5O_attr_size(f, mesg) + size_t H5O__attr_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source attribute struct RETURNS @@ -424,13 +427,13 @@ done: portion of the message). It doesn't take into account alignment. --------------------------------------------------------------------------*/ static size_t -H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) +H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) { const H5A_t *attr = (const H5A_t *)_mesg; size_t name_len; size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); @@ -465,7 +468,7 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) HDassert(0 && "Bad attribute version"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_size() */ +} /* end H5O__attr_size() */ /*------------------------------------------------------------------------- * Function: H5O__attr_reset @@ -594,7 +597,7 @@ done: } /* end H5O__attr_link() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_pre_copy_file + * Function: H5O__attr_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files for attribute messages. @@ -607,13 +610,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) +H5O__attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(deleted); @@ -634,7 +637,7 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, h done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_attr_pre_copy_file() */ +} /* end H5O__attr_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__attr_copy_file @@ -710,7 +713,7 @@ done: } /* H5O__attr_post_copy_file() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_get_crt_index + * Function: H5O__attr_get_crt_index * * Purpose: Get creation index from the message * @@ -722,11 +725,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) +H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) { const H5A_t *attr = (const H5A_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); HDassert(crt_idx); @@ -735,10 +738,10 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) *crt_idx = attr->shared->crt_idx; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_attr_get_crt_index() */ +} /* end H5O__attr_get_crt_index() */ /*------------------------------------------------------------------------- - * Function: H5O_attr_set_crt_index + * Function: H5O__attr_set_crt_index * * Purpose: Set creation index from the message * @@ -750,11 +753,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) *------------------------------------------------------------------------- */ static herr_t -H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) +H5O__attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) { H5A_t *attr = (H5A_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(attr); @@ -762,7 +765,7 @@ H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) attr->shared->crt_idx = crt_idx; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_attr_set_crt_index() */ +} /* end H5O__attr_set_crt_index() */ /*-------------------------------------------------------------------------- NAME @@ -833,8 +836,9 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt break; } /* end switch */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, "Object opened:", mesg->obj_opened); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Object:", mesg->oloc.addr); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Object opened:", mesg->obj_opened ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr); /* Check for attribute creation order index on the attribute */ if (mesg->shared->crt_idx != H5O_MAX_CRT_ORDER_IDX) diff --git a/src/H5Obogus.c b/src/H5Obogus.c index aa6759c..c7fcdb9 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -38,8 +38,8 @@ /* PRIVATE PROTOTYPES */ static void * H5O__bogus_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__bogus_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ @@ -49,9 +49,9 @@ const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{ 0, /*native message size */ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O_bogus_encode, /*encode message */ + H5O__bogus_encode, /*encode message */ NULL, /*copy the native value */ - H5O_bogus_size, /*raw message size */ + H5O__bogus_size, /*raw message size */ NULL, /*free internal memory */ NULL, /*free method */ NULL, /* file delete method */ @@ -73,9 +73,9 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ 0, /*native message size */ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */ H5O__bogus_decode, /*decode message */ - H5O_bogus_encode, /*encode message */ + H5O__bogus_encode, /*encode message */ NULL, /*copy the native value */ - H5O_bogus_size, /*raw message size */ + H5O__bogus_size, /*raw message size */ NULL, /*free internal memory */ NULL, /*free method */ NULL, /* file delete method */ @@ -140,7 +140,7 @@ done: } /* end H5O__bogus_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_bogus_encode + * Function: H5O__bogus_encode * * Purpose: Encodes a "bogus" message. * @@ -152,10 +152,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void H5_ATTR_UNUSED *mesg) +H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -166,10 +166,10 @@ H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, UINT32ENCODE(p, H5O_BOGUS_VALUE); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_bogus_encode() */ +} /* end H5O__bogus_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_bogus_size + * Function: H5O__bogus_size * * Purpose: Returns the size of the raw message in bytes not * counting the message typ or size fields, but only the data @@ -186,13 +186,13 @@ H5O_bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *------------------------------------------------------------------------- */ static size_t -H5O_bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *mesg) +H5O__bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, + const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(4) -} /* end H5O_bogus_size() */ +} /* end H5O__bogus_size() */ /*------------------------------------------------------------------------- * Function: H5O__bogus_debug diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index c8e0365..a783366 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -25,11 +25,11 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void * H5O_btreek_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, - size_t p_size, const uint8_t *p); -static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_btreek_copy(const void *_mesg, void *_dest); -static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static void * H5O__btreek_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__btreek_copy(const void *_mesg, void *_dest); +static size_t H5O__btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__btreek_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ @@ -37,11 +37,11 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ H5O_BTREEK_ID, /*message id number */ "v1 B-tree 'K' values", /*message name for debugging */ sizeof(H5O_btreek_t), /*native message size */ - 0, /* messages are sharable? */ - H5O_btreek_decode, /*decode message */ - H5O_btreek_encode, /*encode message */ - H5O_btreek_copy, /*copy the native value */ - H5O_btreek_size, /*raw message size */ + 0, /* messages are sharable? */ + H5O__btreek_decode, /*decode message */ + H5O__btreek_encode, /*encode message */ + H5O__btreek_copy, /*copy the native value */ + H5O__btreek_size, /*raw message size */ NULL, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -60,7 +60,7 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ #define H5O_BTREEK_VERSION 0 /*------------------------------------------------------------------------- - * Function: H5O_btreek_decode + * Function: H5O__btreek_decode * * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_btreek_t struct. @@ -74,13 +74,13 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_btreek_t *mesg; /* Native message */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -104,10 +104,10 @@ H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_decode() */ +} /* end H5O__btreek_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_encode + * Function: H5O__btreek_encode * * Purpose: Encode a v1 B-tree 'K' value message. * @@ -119,12 +119,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -138,10 +138,10 @@ H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared UINT16ENCODE(p, mesg->sym_leaf_k); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_btreek_encode() */ +} /* end H5O__btreek_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_copy + * Function: H5O__btreek_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -155,13 +155,13 @@ H5O_btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared *------------------------------------------------------------------------- */ static void * -H5O_btreek_copy(const void *_mesg, void *_dest) +H5O__btreek_copy(const void *_mesg, void *_dest) { const H5O_btreek_t *mesg = (const H5O_btreek_t *)_mesg; H5O_btreek_t * dest = (H5O_btreek_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -178,10 +178,10 @@ H5O_btreek_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_copy() */ +} /* end H5O__btreek_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_btreek_size + * Function: H5O__btreek_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -195,12 +195,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *_mesg) +H5O__btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, + const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; + size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -211,7 +211,7 @@ H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh 2; /* Symbol table node leaf 'K' value */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_btreek_size() */ +} /* end H5O__btreek_size() */ /*------------------------------------------------------------------------- * Function: H5O__btreek_debug diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 0087cb0..2603f71 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -281,37 +281,8 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) * from the VFD layer at the end of file. As this was the * last file space allocation before shutdown, the cache image * should still be the last item in the file. - * - * If the hack to work around the self referential free space - * manager issue is in use, file space for the non-empty self - * referential free space managers was also allocated from VFD - * layer at the end of file. Since these allocations directly - * preceeded the cache image allocation they should be directly - * adjacent to the cache image block at the end of file. - * - * In this case, just call H5MF_tidy_self_referential_fsm_hack(). - * - * That routine will float the self referential free space - * managers, and reduce the eoa to its value just prior to - * allocation of space for same. Since the cache image appears - * just after the self referential free space managers, this - * will release the file space for the cache image as well. - * - * Note that in this case, there must not have been any file - * space allocations / deallocations prior to the free of the - * cache image. Verify this to the extent possible. - * - * If the hack to work around the persistent self referential - * free space manager issue is NOT in use, just call H5MF_xfree() - * to release the cache iamge. In principle, we should be able - * to just reduce the EOA to the base address of the cache - * image block, as there shouldn't be any file space allocation - * before the first metadata cache access. However, given - * time constraints, I don't want to go there now. */ - if (f->shared->closing) { - /* Get the eoa, and verify that it has the expected value */ if (HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size") @@ -321,11 +292,8 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) if (H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image") } - else { - if (H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") - } - + else if (H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") } /* end if */ done: diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 1910282..8bebc6d 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -25,11 +25,11 @@ #include "H5Opkg.h" /* Object headers */ #include "H5MMprivate.h" /* Memory management */ -static void * H5O_drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, - size_t p_size, const uint8_t *p); -static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_drvinfo_copy(const void *_mesg, void *_dest); -static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static void * H5O__drvinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__drvinfo_copy(const void *_mesg, void *_dest); +static size_t H5O__drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__drvinfo_reset(void *_mesg); static herr_t H5O__drvinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -38,16 +38,16 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ H5O_DRVINFO_ID, /*message id number */ "driver info", /*message name for debugging */ sizeof(H5O_drvinfo_t), /*native message size */ - 0, /* messages are sharable? */ - H5O_drvinfo_decode, /*decode message */ - H5O_drvinfo_encode, /*encode message */ - H5O_drvinfo_copy, /*copy the native value */ - H5O_drvinfo_size, /*raw message size */ + 0, /* messages are sharable? */ + H5O__drvinfo_decode, /*decode message */ + H5O__drvinfo_encode, /*encode message */ + H5O__drvinfo_copy, /*copy the native value */ + H5O__drvinfo_size, /*raw message size */ H5O__drvinfo_reset, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ NULL, /* link method */ - NULL, /*set share method */ + NULL, /*set share method */ NULL, /*can share method */ NULL, /* pre copy native value to file */ NULL, /* copy native value to file */ @@ -61,7 +61,7 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ #define H5O_DRVINFO_VERSION 0 /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_decode + * Function: H5O__drvinfo_decode * * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_drvinfo_t struct. @@ -75,13 +75,14 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, + size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_drvinfo_t *mesg; /* Native message */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -118,10 +119,10 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsig done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_decode() */ +} /* end H5O__drvinfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_encode + * Function: H5O__drvinfo_encode * * Purpose: Encode a v1 B-tree 'K' value message. * @@ -133,12 +134,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -154,10 +155,10 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share H5MM_memcpy(p, mesg->buf, mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_drvinfo_encode() */ +} /* end H5O__drvinfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_copy + * Function: H5O__drvinfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -171,13 +172,13 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share *------------------------------------------------------------------------- */ static void * -H5O_drvinfo_copy(const void *_mesg, void *_dest) +H5O__drvinfo_copy(const void *_mesg, void *_dest) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; H5O_drvinfo_t * dest = (H5O_drvinfo_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -202,10 +203,10 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_copy() */ +} /* end H5O__drvinfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_drvinfo_size + * Function: H5O__drvinfo_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -219,12 +220,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_drvinfo_t *mesg = (const H5O_drvinfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -236,7 +237,7 @@ H5O_drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s mesg->len; /* Buffer */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_drvinfo_size() */ +} /* end H5O__drvinfo_size() */ /*------------------------------------------------------------------------- * Function: H5O__drvinfo_reset diff --git a/src/H5Odtype.c b/src/H5Odtype.c index b0d23af..1be9522 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -26,17 +26,17 @@ #include "H5VMprivate.h" /* Vectors and arrays */ /* PRIVATE PROTOTYPES */ -static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); -static void *H5O_dtype_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, - const uint8_t *p); -static void *H5O_dtype_copy(const void *_mesg, void *_dest); -static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg); +static herr_t H5O__dtype_encode(H5F_t *f, uint8_t *p, const void *mesg); +static void * H5O__dtype_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static void * H5O__dtype_copy(const void *_mesg, void *_dest); +static size_t H5O__dtype_size(const H5F_t *f, const void *_mesg); static herr_t H5O__dtype_reset(void *_mesg); static herr_t H5O__dtype_free(void *_mesg); -static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh); -static htri_t H5O_dtype_can_share(const void *_mesg); -static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *_udata); +static herr_t H5O__dtype_set_share(void *_mesg, const H5O_shared_t *sh); +static htri_t H5O__dtype_can_share(const void *_mesg); +static herr_t H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *_udata); static void * H5O__dtype_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata); @@ -46,22 +46,22 @@ static herr_t H5O__dtype_debug(H5F_t *f, const void *_mesg, FILE *stream, int in /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_DTYPE -#define H5O_SHARED_DECODE H5O_dtype_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_dtype_decode -#define H5O_SHARED_ENCODE H5O_dtype_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_dtype_encode -#define H5O_SHARED_SIZE H5O_dtype_shared_size -#define H5O_SHARED_SIZE_REAL H5O_dtype_size +#define H5O_SHARED_DECODE H5O__dtype_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__dtype_decode +#define H5O_SHARED_ENCODE H5O__dtype_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__dtype_encode +#define H5O_SHARED_SIZE H5O__dtype_shared_size +#define H5O_SHARED_SIZE_REAL H5O__dtype_size #define H5O_SHARED_DELETE H5O__dtype_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__dtype_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__dtype_shared_copy_file #define H5O_SHARED_COPY_FILE_REAL H5O__dtype_copy_file -#define H5O_SHARED_POST_COPY_FILE H5O_dtype_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__dtype_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #define H5O_SHARED_POST_COPY_FILE_UPD H5O__dtype_shared_post_copy_upd -#define H5O_SHARED_DEBUG H5O_dtype_shared_debug +#define H5O_SHARED_DEBUG H5O__dtype_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__dtype_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -90,26 +90,26 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ "datatype", /* message name for debugging */ sizeof(H5T_t), /* native message size */ H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_dtype_shared_decode, /* decode message */ - H5O_dtype_shared_encode, /* encode message */ - H5O_dtype_copy, /* copy the native value */ - H5O_dtype_shared_size, /* size of raw message */ + H5O__dtype_shared_decode, /* decode message */ + H5O__dtype_shared_encode, /* encode message */ + H5O__dtype_copy, /* copy the native value */ + H5O__dtype_shared_size, /* size of raw message */ H5O__dtype_reset, /* reset method */ H5O__dtype_free, /* free method */ H5O__dtype_shared_delete, /* file delete method */ H5O__dtype_shared_link, /* link method */ - H5O_dtype_set_share, /* set share method */ - H5O_dtype_can_share, /* can share method */ - H5O_dtype_pre_copy_file, /* pre copy native value to file */ + H5O__dtype_set_share, /* set share method */ + H5O__dtype_can_share, /* can share method */ + H5O__dtype_pre_copy_file, /* pre copy native value to file */ H5O__dtype_shared_copy_file, /* copy native value to file */ - H5O_dtype_shared_post_copy_file, /* post copy native value to file */ + H5O__dtype_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_dtype_shared_debug /* debug the message */ + H5O__dtype_shared_debug /* debug the message */ }}; /*------------------------------------------------------------------------- - * Function: H5O_dtype_decode_helper + * Function: H5O__dtype_decode_helper * * Purpose: Decodes a datatype * @@ -124,14 +124,14 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ *------------------------------------------------------------------------- */ static htri_t -H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t *dt) +H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t *dt) { unsigned flags, version; unsigned i; size_t z; htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(pp && *pp); @@ -327,7 +327,7 @@ H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Decode the field's datatype information */ - if ((can_upgrade = H5O_dtype_decode_helper(ioflags, pp, temp_type)) < 0) { + if ((can_upgrade = H5O__dtype_decode_helper(ioflags, pp, temp_type)) < 0) { for (j = 0; j <= i; j++) H5MM_xfree(dt->shared->u.compnd.memb[j].name); H5MM_xfree(dt->shared->u.compnd.memb); @@ -469,7 +469,7 @@ H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t dt->shared->u.enumer.nmembs = dt->shared->u.enumer.nalloc = flags & 0xffff; if (NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype") /* Check if the parent of this enum has a version greater than the @@ -512,7 +512,7 @@ H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Decode base type of VL information */ if (NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type") /* Check if the parent of this vlen has a version greater than the @@ -552,7 +552,7 @@ H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Decode base type of array */ if (NULL == (dt->shared->parent = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O_dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type") /* Check if the parent of this array has a version greater than the @@ -577,19 +577,20 @@ H5O_dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t } /* end switch */ done: - if (ret_value < 0) { + if (ret_value < 0) if (dt != NULL) { - if (dt->shared != NULL) + if (dt->shared != NULL) { + HDassert(!dt->shared->owned_vol_obj); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + } /* end if */ dt = H5FL_FREE(H5T_t, dt); } /* end if */ - } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_decode_helper() */ +} /* end H5O__dtype_decode_helper() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_encode_helper + * Function: H5O__dtype_encode_helper * * Purpose: Encodes a datatype. * @@ -605,7 +606,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) +H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) { unsigned flags = 0; uint8_t *hdr = (uint8_t *)*pp; @@ -613,7 +614,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) size_t n, z; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(pp && *pp); @@ -978,7 +979,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Subtype */ - if (H5O_dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0) + if (H5O__dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode member type") } /* end for */ } break; @@ -999,7 +1000,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) flags = dt->shared->u.enumer.nmembs & 0xffff; /* Parent type */ - if (H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode parent datatype") /* Names, each a multiple of eight bytes */ @@ -1036,7 +1037,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Encode base type of VL information */ - if (H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") break; @@ -1074,7 +1075,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* end if */ /* Encode base type of array's information */ - if (H5O_dtype_encode_helper(pp, dt->shared->parent) < 0) + if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") break; @@ -1093,19 +1094,22 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_encode_helper() */ +} /* end H5O__dtype_encode_helper() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_decode + H5O__dtype_decode PURPOSE Decode a message and return a pointer to a memory struct with the decoded information USAGE - void *H5O_dtype_decode(f, mesg_flags, p) - H5F_t *f; IN: pointer to the HDF5 file struct + void *H5O__dtype_decode(f, mesg_flags, p) + H5F_t *f; IN: pointer to the HDF5 file struct + H5O_t *open_oh; IN: pointer to the object header unsigned mesg_flags; IN: Message flags to influence decoding - const uint8 *p; IN: the raw information buffer + unsigned *ioflags; IN/OUT: flags for decoding + size_t p_size; IN: size of buffer *p + const uint8_t *p; IN: the raw information buffer RETURNS Pointer to the new message in native order on success, NULL on failure DESCRIPTION @@ -1114,13 +1118,13 @@ done: function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * -H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned *ioflags /*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned *ioflags /*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5T_t *dt = NULL; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(p); @@ -1130,7 +1134,7 @@ H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigne HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Perform actual decode of message */ - if (H5O_dtype_decode_helper(ioflags, &p, dt) < 0) + if (H5O__dtype_decode_helper(ioflags, &p, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type") /* Set return value */ @@ -1138,15 +1142,15 @@ H5O_dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigne done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_decode() */ +} /* end H5O__dtype_decode() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_encode + H5O__dtype_encode PURPOSE Encode a simple datatype message USAGE - herr_t H5O_dtype_encode(f, raw_size, p, mesg) + herr_t H5O__dtype_encode(f, raw_size, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct size_t raw_size; IN: size of the raw information buffer const uint8 *p; IN: the raw information buffer @@ -1158,12 +1162,12 @@ done: message in the "raw" disk form. --------------------------------------------------------------------------*/ static herr_t -H5O_dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) +H5O__dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) { const H5T_t *dt = (const H5T_t *)mesg; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -1171,20 +1175,20 @@ H5O_dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) HDassert(dt); /* encode */ - if (H5O_dtype_encode_helper(&p, dt) < 0) + if (H5O__dtype_encode_helper(&p, dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode type") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_encode() */ +} /* end H5O__dtype_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_copy + H5O__dtype_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_dtype_copy(mesg, dest) + void *H5O__dtype_copy(mesg, dest) const void *mesg; IN: Pointer to the source simple datatype struct const void *dest; IN: Pointer to the destination simple @@ -1196,13 +1200,13 @@ done: allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_dtype_copy(const void *_src, void *_dst) +H5O__dtype_copy(const void *_src, void *_dst) { const H5T_t *src = (const H5T_t *)_src; H5T_t * dst; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(src); @@ -1223,15 +1227,15 @@ H5O_dtype_copy(const void *_src, void *_dst) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_copy() */ +} /* end H5O__dtype_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_dtype_size + H5O__dtype_size PURPOSE Return the raw message size in bytes USAGE - void *H5O_dtype_size(f, mesg) + void *H5O__dtype_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source simple datatype struct RETURNS @@ -1242,13 +1246,13 @@ done: portion of the message). It doesn't take into account alignment. --------------------------------------------------------------------------*/ static size_t -H5O_dtype_size(const H5F_t *f, const void *_mesg) +H5O__dtype_size(const H5F_t *f, const void *_mesg) { const H5T_t *dt = (const H5T_t *)_mesg; unsigned u; /* Local index variable */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(dt); @@ -1311,12 +1315,12 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) 4 + /*permutation*/ 4 + /*reserved*/ 16; /*dimensions*/ - ret_value += H5O_dtype_size(f, dt->shared->u.compnd.memb[u].type); + ret_value += H5O__dtype_size(f, dt->shared->u.compnd.memb[u].type); } /* end for */ } break; case H5T_ENUM: - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); for (u = 0; u < dt->shared->u.enumer.nmembs; u++) { size_t name_len; /* Length of field's name */ @@ -1333,7 +1337,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) break; case H5T_VLEN: - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); break; case H5T_ARRAY: @@ -1343,7 +1347,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) ret_value += 4 * dt->shared->u.array.ndims; /* dimensions */ if (dt->shared->version < H5O_DTYPE_VERSION_3) ret_value += 4 * dt->shared->u.array.ndims; /* dimension permutations */ - ret_value += H5O_dtype_size(f, dt->shared->parent); + ret_value += H5O__dtype_size(f, dt->shared->parent); break; case H5T_NO_CLASS: @@ -1356,7 +1360,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg) } /* end switch */ FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_dtype_size() */ +} /* H5O__dtype_size() */ /*------------------------------------------------------------------------- * Function: H5O__dtype_reset @@ -1415,7 +1419,7 @@ done: } /* end H5O__dtype_free() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_set_share + * Function: H5O__dtype_set_share * * Purpose: Copies sharing information from SH into the message. * @@ -1427,12 +1431,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) +H5O__dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) { H5T_t *dt = (H5T_t *)_mesg; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(dt); HDassert(sh); @@ -1463,10 +1467,10 @@ H5O_dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_set_share() */ +} /* end H5O__dtype_set_share() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_can_share + * Function: H5O__dtype_can_share * * Purpose: Determines if this datatype is allowed to be shared or * not. Immutable datatypes or datatypes that are already @@ -1482,13 +1486,13 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_dtype_can_share(const void *_mesg) +H5O__dtype_can_share(const void *_mesg) { const H5T_t *mesg = (const H5T_t *)_mesg; htri_t tri_ret; htri_t ret_value = TRUE; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(mesg); @@ -1506,10 +1510,10 @@ H5O_dtype_can_share(const void *_mesg) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_can_share() */ +} /* end H5O__dtype_can_share() */ /*------------------------------------------------------------------------- - * Function: H5O_dtype_pre_copy_file + * Function: H5O__dtype_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -1524,14 +1528,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, - const H5O_copy_t *cpy_info, void *_udata) +H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, + const H5O_copy_t *cpy_info, void *_udata) { const H5T_t * dt_src = (const H5T_t *)mesg_src; /* Source datatype */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file_src); @@ -1563,7 +1567,7 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_U done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_dtype_pre_copy_file() */ +} /* end H5O__dtype_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__dtype_copy_file @@ -1589,7 +1593,7 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg FUNC_ENTER_STATIC /* Perform a normal copy of the object header message */ - if (NULL == (dst_mesg = (H5T_t *)H5O_dtype_copy(native_src, NULL))) + if (NULL == (dst_mesg = (H5T_t *)H5O__dtype_copy(native_src, NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") /* The datatype will be in the new file; set its location. */ diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 5ec85aa..1ecaf36 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -26,11 +26,11 @@ #include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void * H5O_efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, - const uint8_t *p); -static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_efl_copy(const void *_mesg, void *_dest); -static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static void * H5O__efl_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, + const uint8_t *p); +static herr_t H5O__efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__efl_copy(const void *_mesg, void *_dest); +static size_t H5O__efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__efl_reset(void *_mesg); static void * H5O__efl_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); @@ -42,10 +42,10 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ "external file list", /*message name for debugging */ sizeof(H5O_efl_t), /*native message size */ 0, /* messages are sharable? */ - H5O_efl_decode, /*decode message */ - H5O_efl_encode, /*encode message */ - H5O_efl_copy, /*copy native value */ - H5O_efl_size, /*size of message on disk */ + H5O__efl_decode, /*decode message */ + H5O__efl_encode, /*encode message */ + H5O__efl_copy, /*copy native value */ + H5O__efl_size, /*size of message on disk */ H5O__efl_reset, /*reset method */ NULL, /* free method */ NULL, /* file delete method */ @@ -63,7 +63,7 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ #define H5O_EFL_VERSION 1 /*------------------------------------------------------------------------- - * Function: H5O_efl_decode + * Function: H5O__efl_decode * * Purpose: Decode an external file list message and return a pointer to * the message (and some other data). @@ -83,8 +83,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ *------------------------------------------------------------------------- */ static void * -H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_efl_t * mesg = NULL; int version; @@ -93,7 +93,7 @@ H5O_efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED size_t u; /* Local index variable */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(f); @@ -172,10 +172,10 @@ done: H5MM_xfree(mesg); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_decode() */ +} /* end H5O__efl_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_encode + * Function: H5O__efl_encode * * Purpose: Encodes a message. * @@ -187,12 +187,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; size_t u; /* Local index variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -230,10 +230,10 @@ H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, cons } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_efl_encode() */ +} /* end H5O__efl_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_copy + * Function: H5O__efl_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -248,7 +248,7 @@ H5O_efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, cons *------------------------------------------------------------------------- */ static void * -H5O_efl_copy(const void *_mesg, void *_dest) +H5O__efl_copy(const void *_mesg, void *_dest) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; H5O_efl_t * dest = (H5O_efl_t *)_dest; @@ -256,7 +256,7 @@ H5O_efl_copy(const void *_mesg, void *_dest) hbool_t slot_allocated = FALSE; /* Flag to indicate that dynamic allocation has begun */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -296,10 +296,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_copy() */ +} /* end H5O__efl_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_efl_size + * Function: H5O__efl_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. This @@ -316,12 +316,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *)_mesg; size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -336,7 +336,7 @@ H5O_efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * (size_t)H5F_SIZEOF_SIZE(f)); /*file size */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_efl_size() */ +} /* end H5O__efl_size() */ /*------------------------------------------------------------------------- * Function: H5O__efl_reset @@ -396,7 +396,7 @@ H5O_efl_total_size(H5O_efl_t *efl) { hsize_t ret_value = 0, tmp; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(0) if (efl->nused > 0 && H5O_EFL_UNLIMITED == efl->slot[efl->nused - 1].size) ret_value = H5O_EFL_UNLIMITED; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index f94a649..5068039 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -30,15 +30,15 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspaces */ -static void * H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, - size_t p_size, const uint8_t *p); -static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg); -static void * H5O_fill_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, - size_t p_size, const uint8_t *p); -static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg); -static void * H5O_fill_copy(const void *_mesg, void *_dest); +static void * H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static size_t H5O__fill_old_size(const H5F_t *f, const void *_mesg); +static void * H5O__fill_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static size_t H5O__fill_new_size(const H5F_t *f, const void *_mesg); +static void * H5O__fill_copy(const void *_mesg, void *_dest); static herr_t H5O__fill_reset(void *_mesg); static herr_t H5O__fill_free(void *_mesg); static herr_t H5O__fill_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, @@ -47,22 +47,22 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_FILL -#define H5O_SHARED_DECODE H5O_fill_shared_decode -#define H5O_SHARED_DECODE_REAL H5O_fill_old_decode -#define H5O_SHARED_ENCODE H5O_fill_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_fill_old_encode -#define H5O_SHARED_SIZE H5O_fill_shared_size -#define H5O_SHARED_SIZE_REAL H5O_fill_old_size +#define H5O_SHARED_DECODE H5O__fill_shared_decode +#define H5O_SHARED_DECODE_REAL H5O__fill_old_decode +#define H5O_SHARED_ENCODE H5O__fill_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__fill_old_encode +#define H5O_SHARED_SIZE H5O__fill_shared_size +#define H5O_SHARED_SIZE_REAL H5O__fill_old_size #define H5O_SHARED_DELETE H5O__fill_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__fill_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__fill_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_fill_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__fill_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_fill_shared_debug +#define H5O_SHARED_DEBUG H5O__fill_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__fill_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -71,17 +71,17 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind #undef H5O_SHARED_TYPE #define H5O_SHARED_TYPE H5O_MSG_FILL_NEW #undef H5O_SHARED_DECODE -#define H5O_SHARED_DECODE H5O_fill_new_shared_decode +#define H5O_SHARED_DECODE H5O__fill_new_shared_decode #undef H5O_SHARED_DECODE_REAL -#define H5O_SHARED_DECODE_REAL H5O_fill_new_decode +#define H5O_SHARED_DECODE_REAL H5O__fill_new_decode #undef H5O_SHARED_ENCODE -#define H5O_SHARED_ENCODE H5O_fill_new_shared_encode +#define H5O_SHARED_ENCODE H5O__fill_new_shared_encode #undef H5O_SHARED_ENCODE_REAL -#define H5O_SHARED_ENCODE_REAL H5O_fill_new_encode +#define H5O_SHARED_ENCODE_REAL H5O__fill_new_encode #undef H5O_SHARED_SIZE -#define H5O_SHARED_SIZE H5O_fill_new_shared_size +#define H5O_SHARED_SIZE H5O__fill_new_shared_size #undef H5O_SHARED_SIZE_REAL -#define H5O_SHARED_SIZE_REAL H5O_fill_new_size +#define H5O_SHARED_SIZE_REAL H5O__fill_new_size #undef H5O_SHARED_DELETE #define H5O_SHARED_DELETE H5O__fill_new_shared_delete #undef H5O_SHARED_DELETE_REAL @@ -92,11 +92,11 @@ static herr_t H5O__fill_debug(H5F_t *f, const void *_mesg, FILE *stream, int ind #define H5O_SHARED_COPY_FILE H5O__fill_new_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE -#define H5O_SHARED_POST_COPY_FILE H5O_fill_new_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__fill_new_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD #undef H5O_SHARED_DEBUG -#define H5O_SHARED_DEBUG H5O_fill_new_shared_debug +#define H5O_SHARED_DEBUG H5O__fill_new_shared_debug #undef H5O_SHARED_DEBUG_REAL #define H5O_SHARED_DEBUG_REAL H5O__fill_debug #undef H5Oshared_H @@ -108,10 +108,10 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{ "fill", /*message name for debugging */ sizeof(H5O_fill_t), /*native message size */ H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_fill_shared_decode, /*decode message */ - H5O_fill_shared_encode, /*encode message */ - H5O_fill_copy, /*copy the native value */ - H5O_fill_shared_size, /*raw message size */ + H5O__fill_shared_decode, /*decode message */ + H5O__fill_shared_encode, /*encode message */ + H5O__fill_copy, /*copy the native value */ + H5O__fill_shared_size, /*raw message size */ H5O__fill_reset, /*free internal memory */ H5O__fill_free, /* free method */ H5O__fill_shared_delete, /* file delete method */ @@ -120,10 +120,10 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{ NULL, /*can share method */ H5O__fill_pre_copy_file, /* pre copy native value to file */ H5O__fill_shared_copy_file, /* copy native value to file */ - H5O_fill_shared_post_copy_file, /* post copy native value to file */ + H5O__fill_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_fill_shared_debug /*debug the message */ + H5O__fill_shared_debug /*debug the message */ }}; /* This message derives from H5O message class, for new fill value after version 1.4 */ @@ -132,10 +132,10 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ "fill_new", /*message name for debugging */ sizeof(H5O_fill_t), /*native message size */ H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_fill_new_shared_decode, /*decode message */ - H5O_fill_new_shared_encode, /*encode message */ - H5O_fill_copy, /*copy the native value */ - H5O_fill_new_shared_size, /*raw message size */ + H5O__fill_new_shared_decode, /*decode message */ + H5O__fill_new_shared_encode, /*encode message */ + H5O__fill_copy, /*copy the native value */ + H5O__fill_new_shared_size, /*raw message size */ H5O__fill_reset, /*free internal memory */ H5O__fill_free, /* free method */ H5O__fill_new_shared_delete, /* file delete method */ @@ -144,10 +144,10 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{ NULL, /*can share method */ H5O__fill_pre_copy_file, /* pre copy native value to file */ H5O__fill_new_shared_copy_file, /* copy native value to file */ - H5O_fill_new_shared_post_copy_file, /* post copy native value to file */ + H5O__fill_new_shared_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ NULL, /* set creation index */ - H5O_fill_new_shared_debug /*debug the message */ + H5O__fill_new_shared_debug /*debug the message */ }}; /* Format version bounds for fill value */ @@ -177,7 +177,7 @@ H5FL_DEFINE(H5O_fill_t); H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- - * Function: H5O_fill_new_decode + * Function: H5O__fill_new_decode * * Purpose: Decode a new fill value message. The new fill value * message is fill value plus space allocation time and @@ -192,14 +192,15 @@ H5FL_BLK_EXTERN(type_conv); *------------------------------------------------------------------------- */ static void * -H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, - const uint8_t *p) +H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - H5O_fill_t *fill = NULL; - void * ret_value = NULL; /* Return value */ + H5O_fill_t * fill = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(f); HDassert(p); @@ -228,8 +229,11 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, INT32DECODE(p, fill->size); if (fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if ((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") + + /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ + if (p + fill->size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") + if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") H5MM_memcpy(fill->buf, p, (size_t)fill->size); @@ -292,10 +296,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_new_decode() */ +} /* end H5O__fill_new_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_decode + * Function: H5O__fill_old_decode * * Purpose: Decode an old fill value message. * @@ -308,15 +312,16 @@ done: *------------------------------------------------------------------------- */ static void * -H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) +H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fill_t *fill = NULL; /* Decoded fill value message */ - htri_t exists = FALSE; - H5T_t * dt = NULL; - void * ret_value = NULL; /* Return value */ + H5O_fill_t * fill = NULL; /* Decoded fill value message */ + htri_t exists = FALSE; + H5T_t * dt = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(f); HDassert(p); @@ -335,8 +340,10 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags /* Only decode the fill value itself if there is one */ if (fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - if ((size_t)fill->size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") + + /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ + if (p + fill->size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") /* Get the datatype message */ if ((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) @@ -371,10 +378,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_old_decode() */ +} /* end H5O__fill_old_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_encode + * Function: H5O__fill_new_encode * * Purpose: Encode a new fill value message. The new fill value * message is fill value plus space allocation time and @@ -388,11 +395,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) +H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(p); @@ -469,10 +476,10 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fill_new_encode() */ +} /* end H5O__fill_new_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_encode + * Function: H5O__fill_old_encode * * Purpose: Encode an old fill value message. * @@ -484,11 +491,11 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *------------------------------------------------------------------------- */ static herr_t -H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) +H5O__fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(p); @@ -499,10 +506,10 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) H5MM_memcpy(p, fill->buf, (size_t)fill->size); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fill_old_encode() */ +} /* end H5O__fill_old_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_copy + * Function: H5O__fill_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. The new fill value message is fill value plus @@ -518,13 +525,13 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *------------------------------------------------------------------------- */ static void * -H5O_fill_copy(const void *_src, void *_dst) +H5O__fill_copy(const void *_src, void *_dst) { const H5O_fill_t *src = (const H5O_fill_t *)_src; H5O_fill_t * dst = (H5O_fill_t *)_dst; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC HDassert(src); @@ -617,10 +624,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_copy() */ +} /* end H5O__fill_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_new_size + * Function: H5O__fill_new_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. This @@ -637,12 +644,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) +H5O__fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(f); HDassert(fill); @@ -654,22 +661,22 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) 1 + /* Fill value write time */ 1; /* Fill value defined */ if (fill->fill_defined) - ret_value += 4 + /* Fill value size */ + ret_value += 4 + /* Fill value size */ (fill->size > 0 ? (size_t)fill->size : 0); /* Size of fill value */ } /* end if */ else { ret_value = 1 + /* Version number */ 1; /* Status flags */ if (fill->size > 0) - ret_value += 4 + /* Fill value size */ - (size_t)fill->size; /* Size of fill value */ + ret_value += 4 + /* Fill value size */ + (size_t)fill->size; /* Size of fill value */ } /* end else */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fill_new_size() */ +} /* end H5O__fill_new_size() */ /*------------------------------------------------------------------------- - * Function: H5O_fill_old_size + * Function: H5O__fill_old_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. This @@ -684,16 +691,16 @@ H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) *------------------------------------------------------------------------- */ static size_t -H5O_fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) +H5O__fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) { const H5O_fill_t *fill = (const H5O_fill_t *)_fill; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(fill); FUNC_LEAVE_NOAPI(4 + (size_t)fill->size) -} /* end H5O_fill_old_size() */ +} /* end H5O__fill_old_size() */ /*------------------------------------------------------------------------- * Function: H5O_fill_reset_dyn diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 3d07b10..44c4985 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -25,17 +25,17 @@ #include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5Opkg.h" /* Object headers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void * H5O_fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, - size_t p_size, const uint8_t *p); -static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_fsinfo_copy(const void *_mesg, void *_dest); -static size_t H5O_fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static void * H5O__fsinfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__fsinfo_copy(const void *_mesg, void *_dest); +static size_t H5O__fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__fsinfo_free(void *mesg); static herr_t H5O__fsinfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -45,22 +45,22 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ "fsinfo", /* message name for debugging */ sizeof(H5O_fsinfo_t), /* native message size */ 0, /* messages are sharable? */ - H5O_fsinfo_decode, /* decode message */ - H5O_fsinfo_encode, /* encode message */ - H5O_fsinfo_copy, /* copy the native value */ - H5O_fsinfo_size, /* size of free-space manager info message */ - NULL, /* default reset method */ - H5O__fsinfo_free, /* free method */ - NULL, /* file delete method */ - NULL, /* link method */ - NULL, /* set share method */ - NULL, /* can share method */ + H5O__fsinfo_decode, /* decode message */ + H5O__fsinfo_encode, /* encode message */ + H5O__fsinfo_copy, /* copy the native value */ + H5O__fsinfo_size, /* size of free-space manager info message */ + NULL, /* default reset method */ + H5O__fsinfo_free, /* free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ NULL, /* pre copy native value to file */ - NULL, /* copy native value to file */ + NULL, /* copy native value to file */ NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__fsinfo_debug /* debug the message */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__fsinfo_debug /* debug the message */ }}; /* Format version bounds for fsinfo message */ @@ -78,7 +78,7 @@ static const unsigned H5O_fsinfo_ver_bounds[] = { H5FL_DEFINE_STATIC(H5O_fsinfo_t); /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_decode + * Function: H5O__fsinfo_decode * * Purpose: Decode a message and return a pointer to a newly allocated one. * @@ -90,15 +90,15 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t); *------------------------------------------------------------------------- */ static void * -H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_fsinfo_t * fsinfo = NULL; /* File space info message */ H5F_mem_page_t ptype; /* Memory type for iteration */ unsigned vers; /* message version */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); @@ -191,10 +191,10 @@ done: fsinfo = H5FL_FREE(H5O_fsinfo_t, fsinfo); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_decode() */ +} /* end H5O__fsinfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_encode + * Function: H5O__fsinfo_encode * * Purpose: Encodes a message. * @@ -205,12 +205,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; H5F_mem_page_t ptype; /* Memory type for iteration */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -233,10 +233,10 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_fsinfo_encode() */ +} /* end H5O__fsinfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_copy + * Function: H5O__fsinfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -249,13 +249,13 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *------------------------------------------------------------------------- */ static void * -H5O_fsinfo_copy(const void *_mesg, void *_dest) +H5O__fsinfo_copy(const void *_mesg, void *_dest) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; H5O_fsinfo_t * dest = (H5O_fsinfo_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(fsinfo); @@ -270,10 +270,10 @@ H5O_fsinfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_copy() */ +} /* end H5O__fsinfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_fsinfo_size + * Function: H5O__fsinfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -287,12 +287,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR ret_value = 3 /* Version, strategy & persist */ + (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */ @@ -305,7 +305,7 @@ H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi ret_value += (H5F_MEM_PAGE_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_fsinfo_size() */ +} /* end H5O__fsinfo_size() */ /*------------------------------------------------------------------------- * Function: H5O__fsinfo_free diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c index 8a2bb97..8540cc4 100644 --- a/src/H5Oginfo.c +++ b/src/H5Oginfo.c @@ -30,11 +30,11 @@ #include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ -static void *H5O_ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, - const uint8_t *p); -static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_ginfo_copy(const void *_mesg, void *_dest); -static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static void * H5O__ginfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, + size_t p_size, const uint8_t *p); +static herr_t H5O__ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__ginfo_copy(const void *_mesg, void *_dest); +static size_t H5O__ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__ginfo_free(void *_mesg); static herr_t H5O__ginfo_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -44,10 +44,10 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{ "ginfo", /*message name for debugging */ sizeof(H5O_ginfo_t), /*native message size */ 0, /* messages are sharable? */ - H5O_ginfo_decode, /*decode message */ - H5O_ginfo_encode, /*encode message */ - H5O_ginfo_copy, /*copy the native value */ - H5O_ginfo_size, /*size of symbol table entry */ + H5O__ginfo_decode, /*decode message */ + H5O__ginfo_encode, /*encode message */ + H5O__ginfo_copy, /*copy the native value */ + H5O__ginfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__ginfo_free, /* free method */ NULL, /* file delete method */ @@ -74,7 +74,7 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{ H5FL_DEFINE_STATIC(H5O_ginfo_t); /*------------------------------------------------------------------------- - * Function: H5O_ginfo_decode + * Function: H5O__ginfo_decode * * Purpose: Decode a message and return a pointer to * a newly allocated one. @@ -89,14 +89,14 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); *------------------------------------------------------------------------- */ static void * -H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { H5O_ginfo_t * ginfo = NULL; /* Pointer to group information message */ unsigned char flags; /* Flags for encoding group info */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(p); @@ -145,10 +145,10 @@ done: ginfo = H5FL_FREE(H5O_ginfo_t, ginfo); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_decode() */ +} /* end H5O__ginfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_encode + * Function: H5O__ginfo_encode * * Purpose: Encodes a message. * @@ -160,13 +160,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; unsigned char flags = 0; /* Flags for encoding group info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(p); @@ -193,10 +193,10 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_ginfo_encode() */ +} /* end H5O__ginfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_copy + * Function: H5O__ginfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -211,13 +211,13 @@ H5O_ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *------------------------------------------------------------------------- */ static void * -H5O_ginfo_copy(const void *_mesg, void *_dest) +H5O__ginfo_copy(const void *_mesg, void *_dest) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; H5O_ginfo_t * dest = (H5O_ginfo_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(ginfo); @@ -232,10 +232,10 @@ H5O_ginfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_copy() */ +} /* end H5O__ginfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_ginfo_size + * Function: H5O__ginfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -251,12 +251,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = 1 + /* Version */ @@ -271,7 +271,7 @@ H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha : 0); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_ginfo_size() */ +} /* end H5O__ginfo_size() */ /*------------------------------------------------------------------------- * Function: H5O__ginfo_free @@ -288,7 +288,7 @@ H5O_ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha static herr_t H5O__ginfo_free(void *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR HDassert(mesg); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index ce5f87b..651e317 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -90,12 +90,13 @@ H5FL_DEFINE(H5O_layout_t); */ static void * H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_layout_t *mesg = NULL; - uint8_t * heap_block = NULL; - unsigned u; - void * ret_value = NULL; /* Return value */ + H5O_layout_t * mesg = NULL; + uint8_t * heap_block = NULL; + unsigned u; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -179,6 +180,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU if (mesg->type == H5D_COMPACT) { UINT32DECODE(p, mesg->storage.u.compact.size); if (mesg->storage.u.compact.size > 0) { + /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ + if (p + mesg->storage.u.compact.size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") @@ -198,6 +203,10 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU UINT16DECODE(p, mesg->storage.u.compact.size); if (mesg->storage.u.compact.size > 0) { + /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ + if (p + mesg->storage.u.compact.size - 1 > p_end) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + /* Allocate space for compact data */ if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index f7ddfa7..711f199 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -36,9 +36,9 @@ /* PRIVATE PROTOTYPES */ static void * H5O__linfo_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_linfo_copy(const void *_mesg, void *_dest); -static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__linfo_copy(const void *_mesg, void *_dest); +static size_t H5O__linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__linfo_free(void *_mesg); static herr_t H5O__linfo_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); static void *H5O__linfo_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, @@ -55,9 +55,9 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{ sizeof(H5O_linfo_t), /*native message size */ 0, /* messages are sharable? */ H5O__linfo_decode, /*decode message */ - H5O_linfo_encode, /*encode message */ - H5O_linfo_copy, /*copy the native value */ - H5O_linfo_size, /*size of symbol table entry */ + H5O__linfo_encode, /*encode message */ + H5O__linfo_copy, /*copy the native value */ + H5O__linfo_size, /*size of symbol table entry */ NULL, /*default reset method */ H5O__linfo_free, /* free method */ H5O__linfo_delete, /* file delete method */ @@ -166,7 +166,7 @@ done: } /* end H5O__linfo_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_linfo_encode + * Function: H5O__linfo_encode * * Purpose: Encodes a message. * @@ -178,12 +178,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; unsigned char index_flags; /* Flags for encoding link index info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -215,10 +215,10 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co HDassert(!H5F_addr_defined(linfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_linfo_encode() */ +} /* end H5O__linfo_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_linfo_copy + * Function: H5O__linfo_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -232,13 +232,13 @@ H5O_linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co *------------------------------------------------------------------------- */ static void * -H5O_linfo_copy(const void *_mesg, void *_dest) +H5O__linfo_copy(const void *_mesg, void *_dest) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; H5O_linfo_t * dest = (H5O_linfo_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(linfo); @@ -253,10 +253,10 @@ H5O_linfo_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_linfo_copy() */ +} /* end H5O__linfo_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_linfo_size + * Function: H5O__linfo_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -271,12 +271,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_linfo_t *linfo = (const H5O_linfo_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = @@ -289,7 +289,7 @@ H5O_linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void : 0); /* Address of v2 B-tree for indexing creation order values of links */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_linfo_size() */ +} /* end H5O__linfo_size() */ /*------------------------------------------------------------------------- * Function: H5O__linfo_free @@ -379,7 +379,7 @@ H5O__linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fi HDassert(cpy_info); /* Copy the source message */ - if (NULL == (linfo_dst = (H5O_linfo_t *)H5O_linfo_copy(linfo_src, NULL))) + if (NULL == (linfo_dst = (H5O_linfo_t *)H5O__linfo_copy(linfo_src, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed") /* If we are performing a 'shallow hierarchy' copy, and the links in this diff --git a/src/H5Olink.c b/src/H5Olink.c index 183ec2a..75456f4 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -38,13 +38,13 @@ /* PRIVATE PROTOTYPES */ static void *H5O__link_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_link_copy(const void *_mesg, void *_dest); -static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__link_copy(const void *_mesg, void *_dest); +static size_t H5O__link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__link_reset(void *_mesg); static herr_t H5O__link_free(void *_mesg); -static herr_t H5O_link_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *udata); +static herr_t H5O__link_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *udata); static void * H5O__link_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata); static herr_t H5O__link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc, @@ -58,16 +58,16 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{ sizeof(H5O_link_t), /*native message size */ 0, /* messages are sharable? */ H5O__link_decode, /*decode message */ - H5O_link_encode, /*encode message */ - H5O_link_copy, /*copy the native value */ - H5O_link_size, /*size of symbol table entry */ + H5O__link_encode, /*encode message */ + H5O__link_copy, /*copy the native value */ + H5O__link_size, /*size of symbol table entry */ H5O__link_reset, /* reset method */ H5O__link_free, /* free method */ H5O_link_delete, /* file delete method */ NULL, /* link method */ NULL, /*set share method */ NULL, /*can share method */ - H5O_link_pre_copy_file, /* pre copy native value to file */ + H5O__link_pre_copy_file, /* pre copy native value to file */ H5O__link_copy_file, /* copy native value to file */ H5O__link_post_copy_file, /* post copy native value to file */ NULL, /* get creation index */ @@ -275,7 +275,7 @@ done: } /* end H5O__link_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_link_encode + * Function: H5O__link_encode * * Purpose: Encodes a link message. * @@ -287,13 +287,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; uint64_t len; /* Length of a string in the message */ unsigned char link_flags; /* Flags for encoding link info */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -393,10 +393,10 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_link_encode() */ +} /* end H5O__link_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_link_copy + * Function: H5O__link_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -411,13 +411,13 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *------------------------------------------------------------------------- */ static void * -H5O_link_copy(const void *_mesg, void *_dest) +H5O__link_copy(const void *_mesg, void *_dest) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; H5O_link_t * dest = (H5O_link_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check args */ HDassert(lnk); @@ -458,10 +458,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_link_copy() */ +} /* end H5O__link_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_link_size + * Function: H5O__link_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -477,14 +477,14 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_link_t *lnk = (const H5O_link_t *)_mesg; uint64_t name_len; /* Length of name */ size_t name_size; /* Size of encoded name length */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDcompile_assert(sizeof(uint64_t) >= sizeof(size_t)); @@ -533,7 +533,7 @@ H5O_link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void } /* end switch */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_link_size() */ +} /* end H5O__link_size() */ /*------------------------------------------------------------------------- * Function: H5O__link_reset @@ -664,7 +664,7 @@ done: } /* end H5O_link_delete() */ /*------------------------------------------------------------------------- - * Function: H5O_link_pre_copy_file + * Function: H5O__link_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files for link messages. @@ -679,10 +679,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, - hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) +H5O__link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, + hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -697,7 +697,7 @@ H5O_link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_link_pre_copy_file() */ +} /* end H5O__link_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__link_copy_file diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 684292f..163ea32 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -27,14 +27,14 @@ static void * H5O__mtime_new_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static size_t H5O__mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static void * H5O__mtime_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_mtime_copy(const void *_mesg, void *_dest); -static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__mtime_copy(const void *_mesg, void *_dest); +static size_t H5O__mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__mtime_free(void *_mesg); static herr_t H5O__mtime_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -45,9 +45,9 @@ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{ sizeof(time_t), /*native message size */ 0, /* messages are sharable? */ H5O__mtime_decode, /*decode message */ - H5O_mtime_encode, /*encode message */ - H5O_mtime_copy, /*copy the native value */ - H5O_mtime_size, /*raw message size */ + H5O__mtime_encode, /*encode message */ + H5O__mtime_copy, /*copy the native value */ + H5O__mtime_size, /*raw message size */ NULL, /* reset method */ H5O__mtime_free, /* free method */ NULL, /* file delete method */ @@ -70,9 +70,9 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ sizeof(time_t), /*native message size */ 0, /* messages are sharable? */ H5O__mtime_new_decode, /*decode message */ - H5O_mtime_new_encode, /*encode message */ - H5O_mtime_copy, /*copy the native value */ - H5O_mtime_new_size, /*raw message size */ + H5O__mtime_new_encode, /*encode message */ + H5O__mtime_copy, /*copy the native value */ + H5O__mtime_new_size, /*raw message size */ NULL, /* reset method */ H5O__mtime_free, /* free method */ NULL, /* file delete method */ @@ -211,7 +211,7 @@ done: } /* end H5O__mtime_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_encode + * Function: H5O__mtime_new_encode * * Purpose: Encodes a new modification time message. * @@ -223,12 +223,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const time_t *mesg = (const time_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -247,10 +247,10 @@ H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha UINT32ENCODE(p, *mesg); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_mtime_new_encode() */ +} /* end H5O__mtime_new_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_encode + * Function: H5O__mtime_encode * * Purpose: Encodes a modification time message. * @@ -262,13 +262,13 @@ H5O_mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha *------------------------------------------------------------------------- */ static herr_t -H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const time_t *mesg = (const time_t *)_mesg; struct tm * tm; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -281,10 +281,10 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, tm->tm_hour, tm->tm_min, tm->tm_sec); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__mtime_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_copy + * Function: H5O__mtime_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -299,13 +299,13 @@ H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *------------------------------------------------------------------------- */ static void * -H5O_mtime_copy(const void *_mesg, void *_dest) +H5O__mtime_copy(const void *_mesg, void *_dest) { const time_t *mesg = (const time_t *)_mesg; time_t * dest = (time_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -320,10 +320,10 @@ H5O_mtime_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5O__mtime_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_new_size + * Function: H5O__mtime_new_size * * Purpose: Returns the size of the raw message in bytes not * counting the message type or size fields, but only the data @@ -340,20 +340,20 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *mesg) +H5O__mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, + const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); HDassert(mesg); FUNC_LEAVE_NOAPI(8) -} /* end H5O_mtime_new_size() */ +} /* end H5O__mtime_new_size() */ /*------------------------------------------------------------------------- - * Function: H5O_mtime_size + * Function: H5O__mtime_size * * Purpose: Returns the size of the raw message in bytes not * counting the message type or size fields, but only the data @@ -370,17 +370,17 @@ H5O_mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable *------------------------------------------------------------------------- */ static size_t -H5O_mtime_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *mesg) +H5O__mtime_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, + const void H5_ATTR_UNUSED *mesg) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); HDassert(mesg); FUNC_LEAVE_NOAPI(16) -} /* end H5O_mtime_size() */ +} /* end H5O__mtime_size() */ /*------------------------------------------------------------------------- * Function: H5O__mtime_free diff --git a/src/H5Oname.c b/src/H5Oname.c index c25e4b3..1636a0e 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -32,9 +32,9 @@ /* PRIVATE PROTOTYPES */ static void *H5O__name_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_name_copy(const void *_mesg, void *_dest); -static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__name_copy(const void *_mesg, void *_dest); +static size_t H5O__name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__name_reset(void *_mesg); static herr_t H5O__name_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); @@ -45,9 +45,9 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ sizeof(H5O_name_t), /*native message size */ 0, /* messages are sharable? */ H5O__name_decode, /*decode message */ - H5O_name_encode, /*encode message */ - H5O_name_copy, /*copy the native value */ - H5O_name_size, /*raw message size */ + H5O__name_encode, /*encode message */ + H5O__name_copy, /*copy the native value */ + H5O__name_size, /*raw message size */ H5O__name_reset, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -108,7 +108,7 @@ done: } /* end H5O__name_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_name_encode + * Function: H5O__name_encode * * Purpose: Encodes a name message. * @@ -120,11 +120,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -135,10 +136,10 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, HDstrcpy((char *)p, mesg->s); FUNC_LEAVE_NOAPI(SUCCEED) -} +} /* end H5O__name_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_name_copy + * Function: H5O__name_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -153,13 +154,13 @@ H5O_name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, *------------------------------------------------------------------------- */ static void * -H5O_name_copy(const void *_mesg, void *_dest) +H5O__name_copy(const void *_mesg, void *_dest) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; H5O_name_t * dest = (H5O_name_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -181,10 +182,10 @@ done: dest = (H5O_name_t *)H5MM_xfree(dest); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_name_copy() */ +} /* end H5O__name_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_name_size + * Function: H5O__name_size * * Purpose: Returns the size of the raw message in bytes not * counting the message typ or size fields, but only the data @@ -201,12 +202,12 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) +H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -215,7 +216,7 @@ H5O_name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_name_size() */ +} /* end H5O__name_size() */ /*------------------------------------------------------------------------- * Function: H5O__name_reset diff --git a/src/H5Opline.c b/src/H5Opline.c index 64dd610..221e323 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -22,68 +22,68 @@ #define H5Z_FRIEND /*suppress error about including H5Zpkg */ #include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Zpkg.h" /* Data filters */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Zpkg.h" /* Data filters */ /* PRIVATE PROTOTYPES */ -static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg); +static herr_t H5O__pline_encode(H5F_t *f, uint8_t *p, const void *mesg); static void * H5O__pline_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static void * H5O_pline_copy(const void *_mesg, void *_dest); -static size_t H5O_pline_size(const H5F_t *f, const void *_mesg); +static void * H5O__pline_copy(const void *_mesg, void *_dest); +static size_t H5O__pline_size(const H5F_t *f, const void *_mesg); static herr_t H5O__pline_reset(void *_mesg); static herr_t H5O__pline_free(void *_mesg); -static herr_t H5O_pline_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *_udata); +static herr_t H5O__pline_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *_udata); static herr_t H5O__pline_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_PLINE -#define H5O_SHARED_DECODE H5O_pline_shared_decode +#define H5O_SHARED_DECODE H5O__pline_shared_decode #define H5O_SHARED_DECODE_REAL H5O__pline_decode -#define H5O_SHARED_ENCODE H5O_pline_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_pline_encode -#define H5O_SHARED_SIZE H5O_pline_shared_size -#define H5O_SHARED_SIZE_REAL H5O_pline_size +#define H5O_SHARED_ENCODE H5O__pline_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__pline_encode +#define H5O_SHARED_SIZE H5O__pline_shared_size +#define H5O_SHARED_SIZE_REAL H5O__pline_size #define H5O_SHARED_DELETE H5O__pline_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__pline_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__pline_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_pline_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__pline_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_pline_shared_debug +#define H5O_SHARED_DEBUG H5O__pline_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__pline_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{ - H5O_PLINE_ID, /* message id number */ - "filter pipeline", /* message name for debugging */ - sizeof(H5O_pline_t), /* native message size */ + H5O_PLINE_ID, /* message id number */ + "filter pipeline", /* message name for debugging */ + sizeof(H5O_pline_t), /* native message size */ H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_pline_shared_decode, /* decode message */ - H5O_pline_shared_encode, /* encode message */ - H5O_pline_copy, /* copy the native value */ - H5O_pline_shared_size, /* size of raw message */ - H5O__pline_reset, /* reset method */ - H5O__pline_free, /* free method */ - H5O__pline_shared_delete, /* file delete method */ - H5O__pline_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ - H5O_pline_pre_copy_file, /* pre copy native value to file */ + H5O__pline_shared_decode, /* decode message */ + H5O__pline_shared_encode, /* encode message */ + H5O__pline_copy, /* copy the native value */ + H5O__pline_shared_size, /* size of raw message */ + H5O__pline_reset, /* reset method */ + H5O__pline_free, /* free method */ + H5O__pline_shared_delete, /* file delete method */ + H5O__pline_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ + H5O__pline_pre_copy_file, /* pre copy native value to file */ H5O__pline_shared_copy_file, /* copy native value to file */ - H5O_pline_shared_post_copy_file, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_pline_shared_debug /* debug the message */ + H5O__pline_shared_post_copy_file, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__pline_shared_debug /* debug the message */ }}; /* Format version bounds for filter pipleline */ @@ -101,7 +101,7 @@ H5FL_DEFINE(H5O_pline_t); /*------------------------------------------------------------------------- * Function: H5O__pline_decode * - * Purpose: Decodes a filter pipeline message. + * Purpose: Decodes a filter pipeline message. * * Return: Success: Ptr to the native message. * Failure: NULL @@ -242,7 +242,7 @@ done: } /* end H5O__pline_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_encode + * Function: H5O__pline_encode * * Purpose: Encodes message MESG into buffer P. * @@ -254,13 +254,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) +H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) { const H5O_pline_t * pline = (const H5O_pline_t *)mesg; /* Pipeline message to encode */ const H5Z_filter_info_t *filter; /* Filter to encode */ size_t i, j; /* Local index variables */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check args */ HDassert(p); @@ -336,10 +336,10 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_pline_encode() */ +} /* end H5O__pline_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_copy + * Function: H5O__pline_copy * * Purpose: Copies a filter pipeline message from SRC to DST allocating * DST if necessary. If DST is already allocated then we assume @@ -355,14 +355,14 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) *------------------------------------------------------------------------- */ static void * -H5O_pline_copy(const void *_src, void *_dst /*out*/) +H5O__pline_copy(const void *_src, void *_dst /*out*/) { const H5O_pline_t *src = (const H5O_pline_t *)_src; /* Source pipeline message */ H5O_pline_t * dst = (H5O_pline_t *)_dst; /* Destination pipeline message */ size_t i; /* Local index variable */ H5O_pline_t * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate pipeline message, if not provided */ if (!dst && NULL == (dst = H5FL_MALLOC(H5O_pline_t))) @@ -430,10 +430,10 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_copy() */ +} /* end H5O__pline_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_size + * Function: H5O__pline_size * * Purpose: Determines the size of a raw filter pipeline message. * @@ -447,13 +447,13 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) +H5O__pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t *)mesg; /* Pipeline message */ size_t i; /* Local index variable */ size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Message header */ ret_value = (size_t)(1 + /*version */ @@ -471,7 +471,7 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) else { H5Z_class2_t *cls; /* Filter class */ - /* Get the name of the filter, same as done with H5O_pline_encode() */ + /* Get the name of the filter, same as done with H5O__pline_encode() */ if (NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id))) name = cls->name; name_len = name ? HDstrlen(name) + 1 : 0; @@ -494,7 +494,7 @@ H5O_pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) } /* end for */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_size() */ +} /* end H5O__pline_size() */ /*------------------------------------------------------------------------- * Function: H5O__pline_reset @@ -575,7 +575,7 @@ H5O__pline_free(void *mesg) } /* end H5O__pline_free() */ /*------------------------------------------------------------------------- - * Function: H5O_pline_pre_copy_file + * Function: H5O__pline_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -590,14 +590,14 @@ H5O__pline_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hbool_t H5_ATTR_UNUSED *deleted, - const H5O_copy_t *cpy_info, void *_udata) +H5O__pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, + hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) { const H5O_pline_t * pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */ H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(pline_src); @@ -614,12 +614,12 @@ H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hb * the object copying process. */ if (udata) - if (NULL == (udata->src_pline = (H5O_pline_t *)H5O_pline_copy(pline_src, NULL))) + if (NULL == (udata->src_pline = (H5O_pline_t *)H5O__pline_copy(pline_src, NULL))) HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to copy") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_pline_pre_copy_file() */ +} /* end H5O__pline_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__pline_debug diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c index ccd21b8..52eee14 100644 --- a/src/H5Orefcount.c +++ b/src/H5Orefcount.c @@ -32,36 +32,36 @@ /* PRIVATE PROTOTYPES */ static void * H5O__refcount_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_refcount_copy(const void *_mesg, void *_dest); -static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__refcount_copy(const void *_mesg, void *_dest); +static size_t H5O__refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__refcount_free(void *_mesg); -static herr_t H5O_refcount_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *udata); +static herr_t H5O__refcount_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *udata); static herr_t H5O__refcount_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_REFCOUNT[1] = {{ - H5O_REFCOUNT_ID, /*message id number */ - "refcount", /*message name for debugging */ - sizeof(H5O_refcount_t), /*native message size */ - 0, /* messages are sharable? */ - H5O__refcount_decode, /*decode message */ - H5O_refcount_encode, /*encode message */ - H5O_refcount_copy, /*copy the native value */ - H5O_refcount_size, /*size of symbol table entry */ - NULL, /*default reset method */ - H5O__refcount_free, /* free method */ - NULL, /* file delete method */ - NULL, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - H5O_refcount_pre_copy_file, /* pre copy native value to file */ - NULL, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__refcount_debug /*debug the message */ + H5O_REFCOUNT_ID, /*message id number */ + "refcount", /*message name for debugging */ + sizeof(H5O_refcount_t), /*native message size */ + 0, /* messages are sharable? */ + H5O__refcount_decode, /*decode message */ + H5O__refcount_encode, /*encode message */ + H5O__refcount_copy, /*copy the native value */ + H5O__refcount_size, /*size of symbol table entry */ + NULL, /*default reset method */ + H5O__refcount_free, /* free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /*set share method */ + NULL, /*can share method */ + H5O__refcount_pre_copy_file, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__refcount_debug /*debug the message */ }}; /* Current version of ref. count information */ @@ -119,7 +119,7 @@ done: } /* end H5O__refcount_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_encode + * Function: H5O__refcount_encode * * Purpose: Encodes a message. * @@ -131,12 +131,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, - const void *_mesg) +H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, + const void *_mesg) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -150,10 +150,10 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar UINT32ENCODE(p, *refcount); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_refcount_encode() */ +} /* end H5O__refcount_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_copy + * Function: H5O__refcount_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -167,13 +167,13 @@ H5O_refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar *------------------------------------------------------------------------- */ static void * -H5O_refcount_copy(const void *_mesg, void *_dest) +H5O__refcount_copy(const void *_mesg, void *_dest) { const H5O_refcount_t *refcount = (const H5O_refcount_t *)_mesg; H5O_refcount_t * dest = (H5O_refcount_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(refcount); @@ -188,10 +188,10 @@ H5O_refcount_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_refcount_copy() */ +} /* end H5O__refcount_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_size + * Function: H5O__refcount_size * * Purpose: Returns the size of the raw message in bytes not counting * the message type or size fields, but only the data fields. @@ -206,19 +206,19 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *_mesg) +H5O__refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, + const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; /* Return value */ + size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Set return value */ ret_value = 1 /* Version */ + 4; /* Ref. count */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_refcount_size() */ +} /* end H5O__refcount_size() */ /*------------------------------------------------------------------------- * Function: H5O__refcount_free @@ -245,7 +245,7 @@ H5O__refcount_free(void *mesg) } /* end H5O__refcount_free() */ /*------------------------------------------------------------------------- - * Function: H5O_refcount_pre_copy_file + * Function: H5O__refcount_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files. @@ -259,11 +259,11 @@ H5O__refcount_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, - hbool_t *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, - void H5_ATTR_UNUSED *udata) +H5O__refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src, + hbool_t *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, + void H5_ATTR_UNUSED *udata) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(deleted); @@ -275,7 +275,7 @@ H5O_refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UN *deleted = TRUE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_refcount_pre_copy_file() */ +} /* end H5O__refcount_pre_copy_file() */ /*------------------------------------------------------------------------- * Function: H5O__refcount_debug diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 5f94c31..2cdf6ec 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -26,33 +26,33 @@ /* PRIVATE PROTOTYPES */ static void * H5O__sdspace_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static void * H5O_sdspace_copy(const void *_mesg, void *_dest); -static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); +static herr_t H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); +static void * H5O__sdspace_copy(const void *_mesg, void *_dest); +static size_t H5O__sdspace_size(const H5F_t *f, const void *_mesg); static herr_t H5O__sdspace_reset(void *_mesg); static herr_t H5O__sdspace_free(void *_mesg); -static herr_t H5O_sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, - const H5O_copy_t *cpy_info, void *_udata); +static herr_t H5O__sdspace_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t *deleted, + const H5O_copy_t *cpy_info, void *_udata); static herr_t H5O__sdspace_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* Set up & include shared message "interface" info */ #define H5O_SHARED_TYPE H5O_MSG_SDSPACE -#define H5O_SHARED_DECODE H5O_sdspace_shared_decode +#define H5O_SHARED_DECODE H5O__sdspace_shared_decode #define H5O_SHARED_DECODE_REAL H5O__sdspace_decode -#define H5O_SHARED_ENCODE H5O_sdspace_shared_encode -#define H5O_SHARED_ENCODE_REAL H5O_sdspace_encode -#define H5O_SHARED_SIZE H5O_sdspace_shared_size -#define H5O_SHARED_SIZE_REAL H5O_sdspace_size +#define H5O_SHARED_ENCODE H5O__sdspace_shared_encode +#define H5O_SHARED_ENCODE_REAL H5O__sdspace_encode +#define H5O_SHARED_SIZE H5O__sdspace_shared_size +#define H5O_SHARED_SIZE_REAL H5O__sdspace_size #define H5O_SHARED_DELETE H5O__sdspace_shared_delete #undef H5O_SHARED_DELETE_REAL #define H5O_SHARED_LINK H5O__sdspace_shared_link #undef H5O_SHARED_LINK_REAL #define H5O_SHARED_COPY_FILE H5O__sdspace_shared_copy_file #undef H5O_SHARED_COPY_FILE_REAL -#define H5O_SHARED_POST_COPY_FILE H5O_sdspace_shared_post_copy_file +#define H5O_SHARED_POST_COPY_FILE H5O__sdspace_shared_post_copy_file #undef H5O_SHARED_POST_COPY_FILE_REAL #undef H5O_SHARED_POST_COPY_FILE_UPD -#define H5O_SHARED_DEBUG H5O_sdspace_shared_debug +#define H5O_SHARED_DEBUG H5O__sdspace_shared_debug #define H5O_SHARED_DEBUG_REAL H5O__sdspace_debug #include "H5Oshared.h" /* Shared Object Header Message Callbacks */ @@ -61,23 +61,23 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{ H5O_SDSPACE_ID, /* message id number */ "dataspace", /* message name for debugging */ sizeof(H5S_extent_t), /* native message size */ - H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ - H5O_sdspace_shared_decode, /* decode message */ - H5O_sdspace_shared_encode, /* encode message */ - H5O_sdspace_copy, /* copy the native value */ - H5O_sdspace_shared_size, /* size of symbol table entry */ + H5O_SHARE_IS_SHARABLE | H5O_SHARE_IN_OHDR, /* messages are sharable? */ + H5O__sdspace_shared_decode, /* decode message */ + H5O__sdspace_shared_encode, /* encode message */ + H5O__sdspace_copy, /* copy the native value */ + H5O__sdspace_shared_size, /* size of symbol table entry */ H5O__sdspace_reset, /* default reset method */ H5O__sdspace_free, /* free method */ - H5O__sdspace_shared_delete, /* file delete method */ - H5O__sdspace_shared_link, /* link method */ - NULL, /* set share method */ - NULL, /*can share method */ - H5O_sdspace_pre_copy_file, /* pre copy native value to file */ - H5O__sdspace_shared_copy_file, /* copy native value to file */ - H5O_sdspace_shared_post_copy_file, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O_sdspace_shared_debug /* debug the message */ + H5O__sdspace_shared_delete, /* file delete method */ + H5O__sdspace_shared_link, /* link method */ + NULL, /* set share method */ + NULL, /*can share method */ + H5O__sdspace_pre_copy_file, /* pre copy native value to file */ + H5O__sdspace_shared_copy_file, /* copy native value to file */ + H5O__sdspace_shared_post_copy_file, /* post copy native value to file*/ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__sdspace_shared_debug /* debug the message */ }}; /* Declare external the free list for H5S_extent_t's */ @@ -138,8 +138,11 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN flags = *p++; /* Get or determine the type of the extent */ - if (version >= H5O_SDSPACE_VERSION_2) + if (version >= H5O_SDSPACE_VERSION_2) { sdim->type = (H5S_class_t)*p++; + if (sdim->type != H5S_SIMPLE && sdim->rank > 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid rank for scalar or NULL dataspace") + } /* end if */ else { /* Set the dataspace type to be simple or scalar as appropriate */ if (sdim->rank > 0) @@ -194,11 +197,11 @@ done: /*-------------------------------------------------------------------------- NAME - H5O_sdspace_encode + H5O__sdspace_encode PURPOSE Encode a simple dimensionality message USAGE - herr_t H5O_sdspace_encode(f, raw_size, p, mesg) + herr_t H5O__sdspace_encode(f, raw_size, p, mesg) H5F_t *f; IN: pointer to the HDF5 file struct size_t raw_size; IN: size of the raw information buffer const uint8 *p; IN: the raw information buffer @@ -211,13 +214,13 @@ done: --------------------------------------------------------------------------*/ static herr_t -H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) +H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) { const H5S_extent_t *sdim = (const H5S_extent_t *)_mesg; unsigned flags = 0; unsigned u; /* Local counting variable */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -248,26 +251,28 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) *p++ = 0; /*reserved*/ } /* end else */ - /* Current & maximum dimensions */ - if (sdim->rank > 0) { - for (u = 0; u < sdim->rank; u++) - H5F_ENCODE_LENGTH(f, p, sdim->size[u]); - if (flags & H5S_VALID_MAX) { + /* Encode dataspace dimensions for simple dataspaces */ + if (H5S_SIMPLE == sdim->type) { + /* Encode current & maximum dimensions */ + if (sdim->rank > 0) { for (u = 0; u < sdim->rank; u++) - H5F_ENCODE_LENGTH(f, p, sdim->max[u]); + H5F_ENCODE_LENGTH(f, p, sdim->size[u]); + if (flags & H5S_VALID_MAX) + for (u = 0; u < sdim->rank; u++) + H5F_ENCODE_LENGTH(f, p, sdim->max[u]); } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_sdspace_encode() */ +} /* end H5O__sdspace_encode() */ /*-------------------------------------------------------------------------- NAME - H5O_sdspace_copy + H5O__sdspace_copy PURPOSE Copies a message from MESG to DEST, allocating DEST if necessary. USAGE - void *H5O_sdspace_copy(_mesg, _dest) + void *H5O__sdspace_copy(_mesg, _dest) const void *_mesg; IN: Pointer to the source extent dimensionality struct const void *_dest; IN: Pointer to the destination extent dimensionality struct RETURNS @@ -277,13 +282,13 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) allocating the destination structure if necessary. --------------------------------------------------------------------------*/ static void * -H5O_sdspace_copy(const void *_mesg, void *_dest) +H5O__sdspace_copy(const void *_mesg, void *_dest) { const H5S_extent_t *mesg = (const H5S_extent_t *)_mesg; H5S_extent_t * dest = (H5S_extent_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(mesg); @@ -303,15 +308,15 @@ done: dest = H5FL_FREE(H5S_extent_t, dest); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_sdspace_copy() */ +} /* end H5O__sdspace_copy() */ /*-------------------------------------------------------------------------- NAME - H5O_sdspace_size + H5O__sdspace_size PURPOSE Return the raw message size in bytes USAGE - void *H5O_sdspace_size(f, mesg) + void *H5O__sdspace_size(f, mesg) H5F_t *f; IN: pointer to the HDF5 file struct const void *mesg; IN: Pointer to the source extent dimensionality struct RETURNS @@ -323,12 +328,12 @@ done: --------------------------------------------------------------------------*/ static size_t -H5O_sdspace_size(const H5F_t *f, const void *_mesg) +H5O__sdspace_size(const H5F_t *f, const void *_mesg) { const H5S_extent_t *space = (const H5S_extent_t *)_mesg; size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Basic information for all dataspace messages */ ret_value = (size_t)(1 + /* Version */ @@ -344,7 +349,7 @@ H5O_sdspace_size(const H5F_t *f, const void *_mesg) ret_value += space->max ? (space->rank * H5F_SIZEOF_SIZE(f)) : 0; FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_sdspace_size() */ +} /* end H5O__sdspace_size() */ /*------------------------------------------------------------------------- * Function: H5O__sdspace_reset @@ -396,7 +401,7 @@ H5O__sdspace_free(void *mesg) } /* end H5O__sdspace_free() */ /*------------------------------------------------------------------------- - * Function: H5O_sdspace_pre_copy_file + * Function: H5O__sdspace_pre_copy_file * * Purpose: Perform any necessary actions before copying message between * files @@ -411,14 +416,14 @@ H5O__sdspace_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, - hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) +H5O__sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, + hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata) { const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */ H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(file_src); diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index cd666a0..1c894a5 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -27,9 +27,9 @@ static void * H5O__shmesg_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); -static void * H5O_shmesg_copy(const void *_mesg, void *_dest); -static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); +static herr_t H5O__shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__shmesg_copy(const void *_mesg, void *_dest); +static size_t H5O__shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__shmesg_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ @@ -39,9 +39,9 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{ sizeof(H5O_shmesg_table_t), /*native message size */ 0, /* messages are sharable? */ H5O__shmesg_decode, /*decode message */ - H5O_shmesg_encode, /*encode message */ - H5O_shmesg_copy, /*copy the native value */ - H5O_shmesg_size, /*raw message size */ + H5O__shmesg_encode, /*encode message */ + H5O__shmesg_copy, /*copy the native value */ + H5O__shmesg_size, /*raw message size */ NULL, /*free internal memory */ NULL, /* free method */ NULL, /* file delete method */ @@ -100,7 +100,7 @@ done: } /* end H5O__shmesg_decode() */ /*------------------------------------------------------------------------- - * Function: H5O_shmesg_encode + * Function: H5O__shmesg_encode * * Purpose: Encode a shared message table message. * @@ -112,11 +112,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) +H5O__shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -129,10 +129,10 @@ H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *p++ = (uint8_t)mesg->nindexes; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5O_shmesg_encode() */ +} /* end H5O__shmesg_encode() */ /*------------------------------------------------------------------------- - * Function: H5O_shmesg_copy + * Function: H5O__shmesg_copy * * Purpose: Copies a message from _MESG to _DEST, allocating _DEST if * necessary. @@ -146,13 +146,13 @@ H5O_shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c *------------------------------------------------------------------------- */ static void * -H5O_shmesg_copy(const void *_mesg, void *_dest) +H5O__shmesg_copy(const void *_mesg, void *_dest) { const H5O_shmesg_table_t *mesg = (const H5O_shmesg_table_t *)_mesg; H5O_shmesg_table_t * dest = (H5O_shmesg_table_t *)_dest; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(mesg); @@ -169,10 +169,10 @@ H5O_shmesg_copy(const void *_mesg, void *_dest) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shmesg_copy() */ +} /* end H5O__shmesg_copy() */ /*------------------------------------------------------------------------- - * Function: H5O_shmesg_size + * Function: H5O__shmesg_size * * Purpose: Returns the size of the raw message in bytes not counting the * message type or size fields, but only the data fields. @@ -186,11 +186,11 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) +H5O__shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { size_t ret_value = 0; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(f); @@ -200,7 +200,7 @@ H5O_shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi 1); /* Number of indexes */ FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_shmesg_size() */ +} /* end H5O__shmesg_size() */ /*------------------------------------------------------------------------- * Function: H5O__shmesg_debug diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 4c059fe..fa030bd 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -95,7 +95,7 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE H5O_stab_t *stab = NULL; void * ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check args */ HDassert(f); -- cgit v0.12