summaryrefslogtreecommitdiffstats
path: root/src/H5Oattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Oattr.c')
-rw-r--r--src/H5Oattr.c281
1 files changed, 141 insertions, 140 deletions
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index cb802ea..e38ef5c 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -25,67 +25,67 @@
/* 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, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+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 herr_t H5O_attr_free(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 void *H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
+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, hid_t dxpl_id);
-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, hid_t dxpl_id,
+ 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_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
- FILE * stream, int indent, int fwidth);
+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_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_REAL H5O_attr_post_copy_file
+#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_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_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_REAL H5O_attr_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 */
@@ -107,9 +107,8 @@ H5FL_EXTERN(H5S_extent_t);
Decode a attribute message and return a pointer to a memory struct
with the decoded information
USAGE
- void *H5O_attr_decode(f, dxpl_id, mesg_flags, p)
+ void *H5O_attr_decode(f, mesg_flags, p)
H5F_t *f; IN: pointer to the HDF5 file struct
- hid_t dxpl_id; IN: DXPL for any I/O
unsigned mesg_flags; IN: Message flags to influence decoding
const uint8_t *p; IN: the raw information buffer
RETURNS
@@ -120,8 +119,8 @@ H5FL_EXTERN(H5S_extent_t);
function using malloc() and is returned to the caller.
--------------------------------------------------------------------------*/
static void *
-H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned *ioflags, const uint8_t *p)
+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)
{
H5A_t *attr = NULL;
H5S_extent_t *extent; /*extent dimensionality information */
@@ -177,15 +176,20 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode and store the name */
if(NULL == (attr->shared->name = H5MM_strdup((const char *)p)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */
+ if(name_len != (HDstrlen(attr->shared->name) + 1))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length")
+
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */
else
p += name_len; /* advance the memory pointer */
/* Decode the attribute's datatype */
- if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
+ if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, open_oh,
+ ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->dt_size, p)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(attr->shared->dt_size);
@@ -196,15 +200,15 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
* What's actually shared, though, is only the extent.
*/
if(NULL == (attr->shared->ds = H5FL_CALLOC(H5S_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Decode attribute's dataspace extent */
- if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, open_oh,
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->ds_size, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
- HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
+ H5MM_memcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t));
/* Release temporary extent information */
extent = H5FL_FREE(H5S_extent_t, extent);
@@ -234,9 +238,14 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Go get the data */
if(attr->shared->data_size) {
+ /* Ensure that data size doesn't exceed buffer size, in case of
+ it's being corrupted in the file */
+ if(attr->shared->data_size > p_size)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds buffer size")
+
if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(attr->shared->data, p, attr->shared->data_size);
+ H5MM_memcpy(attr->shared->data, p, attr->shared->data_size);
} /* end if */
/* Increment the reference count for this object header message in cache(compact
@@ -249,15 +258,11 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
done:
if(NULL == ret_value)
if(attr) {
- if(attr->shared) {
- /* Free any dynamicly allocated items */
- if(H5A_free(attr) < 0)
+ /* Free any dynamically allocated items */
+ if(attr->shared)
+ if(H5A__shared_free(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info")
- /* Destroy shared attribute struct */
- attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
- } /* end if */
-
attr = H5FL_FREE(H5A_t, attr);
} /* end if */
@@ -329,10 +334,10 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* The character encoding for the attribute's name, in later versions */
if(attr->shared->version >= H5O_ATTR_VERSION_3)
- *p++ = attr->shared->encoding;
+ *p++ = (uint8_t)attr->shared->encoding;
/* Write the name including null terminator */
- HDmemcpy(p, attr->shared->name, name_len);
+ H5MM_memcpy(p, attr->shared->name, name_len);
if(attr->shared->version < H5O_ATTR_VERSION_2) {
/* Pad to the correct number of bytes */
HDmemset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len);
@@ -365,7 +370,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* Store attribute data. If there's no data, store 0 as fill value. */
if(attr->shared->data)
- HDmemcpy(p, attr->shared->data, attr->shared->data_size);
+ H5MM_memcpy(p, attr->shared->data, attr->shared->data_size);
else
HDmemset(p, 0, attr->shared->data_size);
@@ -400,7 +405,7 @@ H5O_attr_copy(const void *_src, void *_dst)
HDassert(_src);
/* copy */
- if(NULL == (ret_value = (H5A_t *)H5A_copy((H5A_t *)_dst, (const H5A_t *)_src)))
+ if(NULL == (ret_value = (H5A_t *)H5A__copy((H5A_t *)_dst, (const H5A_t *)_src)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute")
done:
@@ -470,40 +475,33 @@ H5O_attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O_attr_reset
+ * Function: H5O__attr_reset
*
* Purpose: Frees resources within a attribute message, but doesn't free
* the message itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
- * Modification:Raymond Lu
- * 25 June 2008
- * Made this function empty. The freeing action is actually
- * done in H5O_attr_free (see H5O_msg_free_real). But this
- * empty reset function needs to be here. Otherwise, the
- * caller function H5O_msg_reset_real will zero-set the whole
- * message.
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_reset(void H5_ATTR_UNUSED *_mesg)
+H5O__attr_reset(void H5_ATTR_UNUSED *_mesg)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_attr_reset() */
+} /* end H5O__attr_reset() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_free
+ * Function: H5O__attr_free
*
- * Purpose: Free's the message
+ * Purpose: Frees the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, November 18, 2004
@@ -511,29 +509,29 @@ H5O_attr_reset(void H5_ATTR_UNUSED *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_free(void *mesg)
+H5O__attr_free(void *mesg)
{
H5A_t *attr = (H5A_t *)mesg;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
HDassert(mesg);
- if(H5A_close(attr) < 0)
+ if(H5A__close(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute object")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_free() */
+} /* end H5O__attr_free() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_delete
+ * Function: H5O__attr_delete
*
* Purpose: Free file space referenced by message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -541,7 +539,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *_mesg)
+H5O__attr_delete(H5F_t *f, H5O_t *oh, void *_mesg)
{
H5A_t *attr = (H5A_t *) _mesg;
herr_t ret_value = SUCCEED; /* Return value */
@@ -553,25 +551,25 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *_mesg)
HDassert(attr);
/* Decrement reference count on datatype in file */
- if((H5O_MSG_DTYPE->del)(f, dxpl_id, oh, attr->shared->dt) < 0)
+ if((H5O_MSG_DTYPE->del)(f, oh, attr->shared->dt) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count")
/* Decrement reference count on dataspace in file */
- if((H5O_MSG_SDSPACE->del)(f, dxpl_id, oh, attr->shared->ds) < 0)
+ if((H5O_MSG_SDSPACE->del)(f, oh, attr->shared->ds) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_delete() */
+} /* end H5O__attr_delete() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_link
+ * Function: H5O__attr_link
*
* Purpose: Increment reference count on any objects referenced by
* message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Friday, September 26, 2003
@@ -579,12 +577,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *_mesg)
+H5O__attr_link(H5F_t *f, H5O_t *oh, void *_mesg)
{
H5A_t *attr = (H5A_t *) _mesg;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(f);
@@ -596,14 +594,14 @@ H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *oh, void *_mesg)
* message is deleted.
*/
/* Increment reference count on datatype & dataspace in file */
- if((H5O_MSG_DTYPE->link)(f, dxpl_id, oh, attr->shared->dt) < 0)
+ if((H5O_MSG_DTYPE->link)(f, oh, attr->shared->dt) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count")
- if((H5O_MSG_SDSPACE->link)(f, dxpl_id, oh, attr->shared->ds) < 0)
+ if((H5O_MSG_SDSPACE->link)(f, oh, attr->shared->ds) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_link() */
+} /* end H5O__attr_link() */
/*-------------------------------------------------------------------------
@@ -612,9 +610,7 @@ done:
* Purpose: Perform any necessary actions before copying message between
* files for attribute messages.
*
- * Return: Success: Non-negative
- *
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Monday, June 26, 2006
@@ -622,14 +618,24 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src,
+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)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(deleted);
HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ * the message version allowed by the destination file's high bound.
+ */
+ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
/* If we are not copying attributes into the destination file, indicate
* that this message should be deleted.
@@ -637,17 +643,17 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
if(cpy_info->copy_without_attr)
*deleted = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_pre_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_copy_file
+ * Function: H5O__attr_copy_file
*
* Purpose: Copies a message from _MESG to _DEST in file
*
* Return: Success: Ptr to _DEST
- *
* Failure: NULL
*
* Programmer: Quincey Koziol
@@ -656,13 +662,13 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
*-------------------------------------------------------------------------
*/
static void *
-H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_type,
+H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_type,
void *native_src, H5F_t *file_dst, hbool_t *recompute_size,
- H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata, hid_t dxpl_id)
+ H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
{
void *ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(native_src);
@@ -673,19 +679,19 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_t
/* Mark datatype as being on disk now. This step used to be done in a lower level
* by H5O_dtype_decode. But it has been moved up. Not an ideal place, but no better
* place than here. */
- if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, file_src, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(((H5A_t *)native_src)->shared->dt, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location")
- if(NULL == (ret_value = H5A_attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info, dxpl_id)))
+ if(NULL == (ret_value = H5A__attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_attr_copy_file() */
+} /* H5O__attr_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_post_copy_file
+ * Function: H5O__attr_post_copy_file
*
* Purpose: Finish copying a message from between files.
* We have to copy the values of a reference attribute in the
@@ -693,7 +699,7 @@ done:
* an object may have a reference attribute that points to the
* object itself.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
* Programmer: Peter Cao
* March 6, 2005
@@ -701,30 +707,27 @@ done:
*-------------------------------------------------------------------------
*/
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, hid_t dxpl_id, H5O_copy_t *cpy_info)
+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)
{
herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_STATIC
- FUNC_ENTER_NOAPI_NOINIT
-
- if ( H5A_attr_post_copy_file(src_oloc, (const H5A_t *)mesg_src,
- dst_oloc, (H5A_t *)mesg_dst, dxpl_id, cpy_info) < 0)
+ if(H5A__attr_post_copy_file(src_oloc, (const H5A_t *)mesg_src, dst_oloc, (H5A_t *)mesg_dst, cpy_info) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_attr_post_copy_file() */
+} /* H5O__attr_post_copy_file() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_get_crt_index
+ * Function: H5O_attr_get_crt_index
*
- * Purpose: Get creation index from the message
+ * Purpose: Get creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
@@ -749,12 +752,11 @@ H5O_attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/)
/*-------------------------------------------------------------------------
- * Function: H5O_attr_set_crt_index
+ * Function: H5O_attr_set_crt_index
*
- * Purpose: Set creation index from the message
+ * Purpose: Set creation index from the message
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* Thursday, January 18, 2007
@@ -779,11 +781,11 @@ H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx)
/*--------------------------------------------------------------------------
NAME
- H5O_attr_debug
+ H5O__attr_debug
PURPOSE
Prints debugging information for an attribute message
USAGE
- void *H5O_attr_debug(f, mesg, stream, indent, fwidth)
+ void *H5O__attr_debug(f, mesg, stream, indent, fwidth)
H5F_t *f; IN: pointer to the HDF5 file struct
const void *mesg; IN: Pointer to the source attribute struct
FILE *stream; IN: Pointer to the stream for output data
@@ -796,15 +798,14 @@ H5O_attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx)
parameter.
--------------------------------------------------------------------------*/
static herr_t
-H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent,
- int fwidth)
+H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwidth)
{
const H5A_t *mesg = (const H5A_t *)_mesg;
const char *s; /* Temporary string pointer */
char buf[128]; /* Temporary string buffer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(f);
@@ -868,17 +869,17 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0,fwidth - 3),
"Encoded Size:",
(unsigned long)(mesg->shared->dt_size));
- if((H5O_MSG_DTYPE->debug)(f, dxpl_id, mesg->shared->dt, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
+ if((H5O_MSG_DTYPE->debug)(f, mesg->shared->dt, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display datatype message info")
HDfprintf(stream, "%*sDataspace...\n", indent, "");
HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3),
"Encoded Size:",
(unsigned long)(mesg->shared->ds_size));
- if(H5S_debug(f, dxpl_id, mesg->shared->ds, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
+ if(H5S_debug(f, mesg->shared->ds, stream, indent + 3, MAX(0, fwidth - 3)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display dataspace message info")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_debug() */
+} /* end H5O__attr_debug() */