summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-05-15 01:33:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-05-15 01:33:12 (GMT)
commit3d5e75b0930bc87589727ce941e3e1f79a36bf20 (patch)
treefed45a49ba7dd2078604973738fbdabe4ee259a4
parente81f0ade7781aec1960d50202fb838e300da0f96 (diff)
downloadhdf5-3d5e75b0930bc87589727ce941e3e1f79a36bf20.zip
hdf5-3d5e75b0930bc87589727ce941e3e1f79a36bf20.tar.gz
hdf5-3d5e75b0930bc87589727ce941e3e1f79a36bf20.tar.bz2
[svn-r27068] Description:
Clean up the H5A interface code, to better align with v3 metadata cache changes. Tested on: MacOSX/64 10.10.3 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial & parallel
-rw-r--r--src/H5A.c292
-rw-r--r--src/H5Abtree2.c132
-rw-r--r--src/H5Adense.c2
-rw-r--r--src/H5Aint.c307
-rw-r--r--src/H5Apkg.h7
5 files changed, 370 insertions, 370 deletions
diff --git a/src/H5A.c b/src/H5A.c
index d474234..3b993ec 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -21,7 +21,7 @@
#define H5O_PACKAGE /*suppress error about including H5Opkg */
/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5A_init_interface
+#define H5_INTERFACE_INIT_FUNC H5A__init_interface
/***********/
@@ -63,6 +63,9 @@ typedef struct H5A_iter_cb1 {
/* Local Prototypes */
/********************/
+static herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
+static herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
+static ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf);
/*********************/
/* Package Variables */
@@ -125,9 +128,9 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5A_init_interface -- Initialize interface-specific information
+ H5A__init_interface -- Initialize interface-specific information
USAGE
- herr_t H5A_init_interface()
+ herr_t H5A__init_interface()
RETURNS
Non-negative on success/Negative on failure
@@ -136,11 +139,11 @@ DESCRIPTION
--------------------------------------------------------------------------*/
static herr_t
-H5A_init_interface(void)
+H5A__init_interface(void)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/*
* Create attribute ID type.
@@ -150,7 +153,7 @@ H5A_init_interface(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_init_interface() */
+} /* end H5A__init_interface() */
/*--------------------------------------------------------------------------
@@ -407,7 +410,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t UNUSED aapl_id)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name)
/* Finish initializing attribute */
- if(H5A_open_common(&loc, attr) < 0)
+ if(H5A__open_common(&loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize attribute")
/* Register the attribute and get an ID for it */
@@ -595,7 +598,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
/* Go write the actual data to the attribute */
- if((ret_value = H5A_write(attr, mem_type, buf, H5AC_dxpl_id)) < 0)
+ if((ret_value = H5A__write(attr, mem_type, buf, H5AC_dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute")
done:
@@ -605,6 +608,120 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5A__write
+ PURPOSE
+ Actually write out data to an attribute
+ USAGE
+ herr_t H5A__write (attr, mem_type, buf)
+ H5A_t *attr; IN: Attribute to write
+ const H5T_t *mem_type; IN: Memory datatype of buffer
+ const void *buf; IN: Buffer of data to write
+ RETURNS
+ Non-negative on success/Negative on failure
+
+ DESCRIPTION
+ This function writes a complete attribute to disk.
+--------------------------------------------------------------------------*/
+static herr_t
+H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
+{
+ uint8_t *tconv_buf = NULL; /* datatype conv buffer */
+ hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */
+ uint8_t *bkg_buf = NULL; /* temp conversion buffer */
+ hssize_t snelmts; /* elements in attribute */
+ size_t nelmts; /* elements in attribute */
+ H5T_path_t *tpath = NULL; /* conversion information*/
+ hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
+ size_t src_type_size; /* size of source type */
+ size_t dst_type_size; /* size of destination type*/
+ size_t buf_size; /* desired buffer size */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL)
+
+ HDassert(attr);
+ HDassert(mem_type);
+ HDassert(buf);
+
+ /* Get # of elements for attribute's dataspace */
+ if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
+
+ /* If there's actually data elements for the attribute, make a copy of the data passed in */
+ if(nelmts > 0) {
+ /* Get the memory and file datatype sizes */
+ src_type_size = H5T_GET_SIZE(mem_type);
+ dst_type_size = H5T_GET_SIZE(attr->shared->dt);
+
+ /* Convert memory buffer into disk buffer */
+ /* Set up type conversion function */
+ if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
+
+ /* Check for type conversion required */
+ if(!H5T_path_noop(tpath)) {
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
+
+ /* Get the maximum buffer size needed and allocate it */
+ buf_size = nelmts * MAX(src_type_size, dst_type_size);
+ if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Copy the user's data into the buffer for conversion */
+ HDmemcpy(tconv_buf, buf, (src_type_size * nelmts));
+
+ /* Perform datatype conversion */
+ if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
+
+ /* Free the previous attribute data buffer, if there is one */
+ if(attr->shared->data)
+ attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data);
+
+ /* Set the pointer to the attribute data to the converted information */
+ attr->shared->data = tconv_buf;
+ tconv_owned = TRUE;
+ } /* end if */
+ /* No type conversion necessary */
+ else {
+ HDassert(dst_type_size == src_type_size);
+
+ /* Allocate the attribute buffer, if there isn't one */
+ if(attr->shared->data == NULL)
+ if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Copy the attribute data into the user's buffer */
+ HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts));
+ } /* end else */
+
+ /* Modify the attribute in the object header */
+ if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute")
+ } /* end if */
+
+done:
+ /* Release resources */
+ if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
+ if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
+ if(tconv_buf && !tconv_owned)
+ tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
+ if(bkg_buf)
+ bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* H5A__write() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5Aread
PURPOSE
Read in data from an attribute
@@ -638,7 +755,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer")
/* Go write the actual data to the attribute */
- if((ret_value = H5A_read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0)
+ if((ret_value = H5A__read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute")
done:
@@ -648,6 +765,109 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5A__read
+ PURPOSE
+ Actually read in data from an attribute
+ USAGE
+ herr_t H5A__read (attr, mem_type, buf)
+ H5A_t *attr; IN: Attribute to read
+ const H5T_t *mem_type; IN: Memory datatype of buffer
+ void *buf; IN: Buffer for data to read
+ RETURNS
+ Non-negative on success/Negative on failure
+
+ DESCRIPTION
+ This function reads a complete attribute from disk.
+--------------------------------------------------------------------------*/
+static herr_t
+H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
+{
+ uint8_t *tconv_buf = NULL; /* datatype conv buffer*/
+ uint8_t *bkg_buf = NULL; /* background buffer */
+ hssize_t snelmts; /* elements in attribute */
+ size_t nelmts; /* elements in attribute*/
+ H5T_path_t *tpath = NULL; /* type conversion info */
+ hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
+ size_t src_type_size; /* size of source type */
+ size_t dst_type_size; /* size of destination type */
+ size_t buf_size; /* desired buffer size */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(attr);
+ HDassert(mem_type);
+ HDassert(buf);
+
+ /* Create buffer for data to store on disk */
+ if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
+ H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
+
+ if(nelmts > 0) {
+ /* Get the memory and file datatype sizes */
+ src_type_size = H5T_GET_SIZE(attr->shared->dt);
+ dst_type_size = H5T_GET_SIZE(mem_type);
+
+ /* Check if the attribute has any data yet, if not, fill with zeroes */
+ if(attr->obj_opened && !attr->shared->data)
+ HDmemset(buf, 0, (dst_type_size * nelmts));
+ else { /* Attribute exists and has a value */
+ /* Convert memory buffer into disk buffer */
+ /* Set up type conversion function */
+ if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE)))
+ HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
+
+ /* Check for type conversion required */
+ if(!H5T_path_noop(tpath)) {
+ if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 ||
+ (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
+
+ /* Get the maximum buffer size needed and allocate it */
+ buf_size = nelmts * MAX(src_type_size, dst_type_size);
+ if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
+ HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
+ HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
+
+ /* Copy the attribute data into the buffer for conversion */
+ HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
+
+ /* Perform datatype conversion. */
+ if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
+
+ /* Copy the converted data into the user's buffer */
+ HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts));
+ } /* end if */
+ /* No type conversion necessary */
+ else {
+ HDassert(dst_type_size == src_type_size);
+
+ /* Copy the attribute data into the user's buffer */
+ HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts));
+ } /* end else */
+ } /* end else */
+ } /* end if */
+
+done:
+ /* Release resources */
+ if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
+ if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
+ if(tconv_buf)
+ tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
+ if(bkg_buf)
+ bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5A__read() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5Aget_space
PURPOSE
Gets a copy of the dataspace for an attribute
@@ -799,7 +1019,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer")
/* Call private function in turn */
- if(0 > (ret_value = H5A_get_name(my_attr, buf_size, buf)))
+ if(0 > (ret_value = H5A__get_name(my_attr, buf_size, buf)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
done:
@@ -807,6 +1027,52 @@ done:
} /* H5Aget_name() */
+/*--------------------------------------------------------------------------
+ NAME
+ H5A__get_name
+ PURPOSE
+ Private function for H5Aget_name. Gets a copy of the name for an
+ attribute
+ RETURNS
+ This function returns the length of the attribute's name (which may be
+ longer than 'buf_size') on success or negative for failure.
+ DESCRIPTION
+ This function retrieves the name of an attribute for an attribute ID.
+ Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string
+ terminator. If the name of the attribute is longer than 'buf_size'-1,
+ the string terminator is stored in the last position of the buffer to
+ properly terminate the string.
+--------------------------------------------------------------------------*/
+static ssize_t
+H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
+{
+ size_t copy_len, nbytes;
+ ssize_t ret_value;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* get the real attribute length */
+ nbytes = HDstrlen(attr->shared->name);
+ HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/
+
+ /* compute the string length which will fit into the user's buffer */
+ copy_len = MIN(buf_size - 1, nbytes);
+
+ /* Copy all/some of the name */
+ if(buf && copy_len > 0) {
+ HDmemcpy(buf, attr->shared->name, copy_len);
+
+ /* Terminate the string */
+ buf[copy_len]='\0';
+ } /* end if */
+
+ /* Set return value */
+ ret_value = (ssize_t)nbytes;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5A_get_name() */
+
+
/*-------------------------------------------------------------------------
* Function: H5Aget_name_by_idx
*
@@ -942,7 +1208,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute")
/* Get the attribute information */
- if(H5A_get_info(attr, ainfo) < 0)
+ if(H5A__get_info(attr, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -996,7 +1262,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if(H5A_get_info(attr, ainfo) < 0)
+ if(H5A__get_info(attr, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1058,7 +1324,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if(H5A_get_info(attr, ainfo) < 0)
+ if(H5A__get_info(attr, ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 9b7dba6..5e74e55 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -79,27 +79,27 @@ typedef struct H5A_fh_ud_cmp_t {
/* v2 B-tree function callbacks */
/* v2 B-tree driver callbacks for 'creation order' index */
-static herr_t H5A_dense_btree2_corder_store(void *native, const void *udata);
-static herr_t H5A_dense_btree2_corder_compare(const void *rec1, const void *rec2);
-static herr_t H5A_dense_btree2_corder_encode(uint8_t *raw, const void *native,
+static herr_t H5A__dense_btree2_corder_store(void *native, const void *udata);
+static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2);
+static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
-static herr_t H5A_dense_btree2_corder_decode(const uint8_t *raw, void *native,
+static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+static herr_t H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
/* v2 B-tree driver callbacks for 'name' index */
-static herr_t H5A_dense_btree2_name_store(void *native, const void *udata);
-static herr_t H5A_dense_btree2_name_compare(const void *rec1, const void *rec2);
-static herr_t H5A_dense_btree2_name_encode(uint8_t *raw, const void *native,
+static herr_t H5A__dense_btree2_name_store(void *native, const void *udata);
+static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2);
+static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
-static herr_t H5A_dense_btree2_name_decode(const uint8_t *raw, void *native,
+static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native,
void *ctx);
-static herr_t H5A_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+static herr_t H5A__dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
/* Fractal heap function callbacks */
-static herr_t H5A_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
+static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
/*********************/
@@ -112,11 +112,11 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
sizeof(H5A_dense_bt2_name_rec_t), /* Size of native record */
NULL, /* Create client callback context */
NULL, /* Destroy client callback context */
- H5A_dense_btree2_name_store, /* Record storage callback */
- H5A_dense_btree2_name_compare, /* Record comparison callback */
- H5A_dense_btree2_name_encode, /* Record encoding callback */
- H5A_dense_btree2_name_decode, /* Record decoding callback */
- H5A_dense_btree2_name_debug, /* Record debugging callback */
+ H5A__dense_btree2_name_store, /* Record storage callback */
+ H5A__dense_btree2_name_compare, /* Record comparison callback */
+ H5A__dense_btree2_name_encode, /* Record encoding callback */
+ H5A__dense_btree2_name_decode, /* Record decoding callback */
+ H5A__dense_btree2_name_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
}};
@@ -128,11 +128,11 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
sizeof(H5A_dense_bt2_corder_rec_t),/* Size of native record */
NULL, /* Create client callback context */
NULL, /* Destroy client callback context */
- H5A_dense_btree2_corder_store, /* Record storage callback */
- H5A_dense_btree2_corder_compare, /* Record comparison callback */
- H5A_dense_btree2_corder_encode, /* Record encoding callback */
- H5A_dense_btree2_corder_decode, /* Record decoding callback */
- H5A_dense_btree2_corder_debug, /* Record debugging callback */
+ H5A__dense_btree2_corder_store, /* Record storage callback */
+ H5A__dense_btree2_corder_compare, /* Record comparison callback */
+ H5A__dense_btree2_corder_encode, /* Record encoding callback */
+ H5A__dense_btree2_corder_decode, /* Record decoding callback */
+ H5A__dense_btree2_corder_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
}};
@@ -150,7 +150,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_fh_name_cmp
+ * Function: H5A__dense_fh_name_cmp
*
* Purpose: Compares the name of a attribute in a fractal heap to another
* name
@@ -164,14 +164,14 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
+H5A__dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
{
H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5A_t *attr = NULL; /* Pointer to attribute created from heap object */
hbool_t took_ownership = FALSE; /* Whether the "found" operator took ownership of the attribute */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* Decode attribute information */
if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
@@ -200,11 +200,11 @@ done:
H5O_msg_free(H5O_ATTR_ID, attr);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_dense_fh_name_cmp() */
+} /* end H5A__dense_fh_name_cmp() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_store
+ * Function: H5A__dense_btree2_name_store
*
* Purpose: Store user information into native record for v2 B-tree
*
@@ -217,12 +217,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
+H5A__dense_btree2_name_store(void *_nrecord, const void *_udata)
{
const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Copy user information info native record */
nrecord->id = udata->id;
@@ -231,11 +231,11 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
nrecord->hash = udata->common.name_hash;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_name_store() */
+} /* H5A__dense_btree2_name_store() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_compare
+ * Function: H5A__dense_btree2_name_compare
*
* Purpose: Compare two native information records, according to some key
*
@@ -249,13 +249,13 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
{
const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(bt2_udata);
@@ -294,7 +294,7 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
HDassert(fheap);
/* Check if the user's attribute and the B-tree's attribute have the same name */
- status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata);
+ status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata);
HDassert(status >= 0);
/* Callback will set comparison value */
@@ -302,11 +302,11 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
} /* end else */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_dense_btree2_name_compare() */
+} /* H5A__dense_btree2_name_compare() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_encode
+ * Function: H5A__dense_btree2_name_encode
*
* Purpose: Encode native information into raw form for storing on disk
*
@@ -319,11 +319,11 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx)
+H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
@@ -333,11 +333,11 @@ H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ct
UINT32ENCODE(raw, nrecord->hash)
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_name_encode() */
+} /* H5A__dense_btree2_name_encode() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_decode
+ * Function: H5A__dense_btree2_name_decode
*
* Purpose: Decode raw disk form of record into native form
*
@@ -350,11 +350,11 @@ H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ct
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx)
+H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx)
{
H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
@@ -364,11 +364,11 @@ H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ct
UINT32DECODE(raw, nrecord->hash)
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_name_decode() */
+} /* H5A__dense_btree2_name_decode() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_name_debug
+ * Function: H5A__dense_btree2_name_debug
*
* Purpose: Debug native form of record
*
@@ -381,23 +381,23 @@ H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ct
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+H5A__dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth,
"Record:",
(hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder, (unsigned long)nrecord->hash);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_name_debug() */
+} /* H5A__dense_btree2_name_debug() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_store
+ * Function: H5A__dense_btree2_corder_store
*
* Purpose: Store user information into native record for v2 B-tree
*
@@ -410,12 +410,12 @@ H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dx
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata)
+H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata)
{
const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Copy user information info native record */
nrecord->id = udata->id;
@@ -423,11 +423,11 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata)
nrecord->corder = udata->common.corder;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_corder_store() */
+} /* H5A__dense_btree2_corder_store() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_compare
+ * Function: H5A__dense_btree2_corder_compare
*
* Purpose: Compare two native information records, according to some key
*
@@ -441,13 +441,13 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
+H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
{
const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata;
const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(bt2_udata);
@@ -462,11 +462,11 @@ H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
ret_value = 0;
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_dense_btree2_corder_compare() */
+} /* H5A__dense_btree2_corder_compare() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_encode
+ * Function: H5A__dense_btree2_corder_encode
*
* Purpose: Encode native information into raw form for storing on disk
*
@@ -479,11 +479,11 @@ H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx)
+H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ctx)
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Encode the record's fields */
HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
@@ -492,11 +492,11 @@ H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *
UINT32ENCODE(raw, nrecord->corder)
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_corder_encode() */
+} /* H5A__dense_btree2_corder_encode() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_decode
+ * Function: H5A__dense_btree2_corder_decode
*
* Purpose: Decode raw disk form of record into native form
*
@@ -509,11 +509,11 @@ H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx)
+H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ctx)
{
H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
/* Decode the record's fields */
HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
@@ -522,11 +522,11 @@ H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *
UINT32DECODE(raw, nrecord->corder)
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_corder_decode() */
+} /* H5A__dense_btree2_corder_decode() */
/*-------------------------------------------------------------------------
- * Function: H5A_dense_btree2_corder_debug
+ * Function: H5A__dense_btree2_corder_debug
*
* Purpose: Debug native form of record
*
@@ -539,17 +539,17 @@ H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
+H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata)
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ FUNC_ENTER_STATIC_NOERR
HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth,
"Record:",
(hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5A_dense_btree2_corder_debug() */
+} /* H5A__dense_btree2_corder_debug() */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index e0499f5..674ab5d 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -1082,7 +1082,7 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
H5A_info_t ainfo; /* Info for attribute */
/* Get the attribute information */
- if(H5A_get_info(fh_udata.attr, &ainfo) < 0)
+ if(H5A__get_info(fh_udata.attr, &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info")
/* Make the application callback */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index bfc8eaf..84f7ecd 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -92,7 +92,7 @@ typedef struct {
static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
-static herr_t H5A_dense_build_table_cb(const H5A_t *attr, void *_udata);
+static herr_t H5A__dense_build_table_cb(const H5A_t *attr, void *_udata);
static int H5A__attr_cmp_name_inc(const void *attr1, const void *attr2);
static int H5A__attr_cmp_name_dec(const void *attr1, const void *attr2);
static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2);
@@ -283,13 +283,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_open_common
+ * Function: H5A__open_common
*
* Purpose:
* Finishes initializing an attributes the open
*
* Usage:
- * herr_t H5A_open_common(loc, name, dxpl_id)
+ * herr_t H5A__open_common(loc, name, dxpl_id)
* const H5G_loc_t *loc; IN: Pointer to group location for object
* H5A_t *attr; IN/OUT: Pointer to attribute to initialize
*
@@ -301,11 +301,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5A_open_common(const H5G_loc_t *loc, H5A_t *attr)
+H5A__open_common(const H5G_loc_t *loc, H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -336,7 +336,7 @@ H5A_open_common(const H5G_loc_t *loc, H5A_t *attr)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_open_common() */
+} /* H5A__open_common() */
/*-------------------------------------------------------------------------
@@ -383,7 +383,7 @@ H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header")
/* Finish initializing attribute */
- if(H5A_open_common(&obj_loc, attr) < 0)
+ if(H5A__open_common(&obj_loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute")
/* Set return value */
@@ -448,7 +448,7 @@ H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_na
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header")
/* Finish initializing attribute */
- if(H5A_open_common(loc, attr) < 0)
+ if(H5A__open_common(loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute")
/* Set return value */
@@ -468,223 +468,6 @@ done:
} /* H5A_open_by_name() */
-/*--------------------------------------------------------------------------
- NAME
- H5A_write
- PURPOSE
- Actually write out data to an attribute
- USAGE
- herr_t H5A_write (attr, mem_type, buf)
- H5A_t *attr; IN: Attribute to write
- const H5T_t *mem_type; IN: Memory datatype of buffer
- const void *buf; IN: Buffer of data to write
- RETURNS
- Non-negative on success/Negative on failure
-
- DESCRIPTION
- This function writes a complete attribute to disk.
---------------------------------------------------------------------------*/
-herr_t
-H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
-{
- uint8_t *tconv_buf = NULL; /* datatype conv buffer */
- hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */
- uint8_t *bkg_buf = NULL; /* temp conversion buffer */
- hssize_t snelmts; /* elements in attribute */
- size_t nelmts; /* elements in attribute */
- H5T_path_t *tpath = NULL; /* conversion information*/
- hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
- size_t src_type_size; /* size of source type */
- size_t dst_type_size; /* size of destination type*/
- size_t buf_size; /* desired buffer size */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT_TAG(dxpl_id, attr->oloc.addr, FAIL)
-
- HDassert(attr);
- HDassert(mem_type);
- HDassert(buf);
-
- /* Get # of elements for attribute's dataspace */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
-
- /* If there's actually data elements for the attribute, make a copy of the data passed in */
- if(nelmts > 0) {
- /* Get the memory and file datatype sizes */
- src_type_size = H5T_GET_SIZE(mem_type);
- dst_type_size = H5T_GET_SIZE(attr->shared->dt);
-
- /* Convert memory buffer into disk buffer */
- /* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
-
- /* Check for type conversion required */
- if(!H5T_path_noop(tpath)) {
- if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
-
- /* Get the maximum buffer size needed and allocate it */
- buf_size = nelmts * MAX(src_type_size, dst_type_size);
- if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
-
- /* Copy the user's data into the buffer for conversion */
- HDmemcpy(tconv_buf, buf, (src_type_size * nelmts));
-
- /* Perform datatype conversion */
- if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
-
- /* Free the previous attribute data buffer, if there is one */
- if(attr->shared->data)
- attr->shared->data = H5FL_BLK_FREE(attr_buf, attr->shared->data);
-
- /* Set the pointer to the attribute data to the converted information */
- attr->shared->data = tconv_buf;
- tconv_owned = TRUE;
- } /* end if */
- /* No type conversion necessary */
- else {
- HDassert(dst_type_size == src_type_size);
-
- /* Allocate the attribute buffer, if there isn't one */
- if(attr->shared->data == NULL)
- if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Copy the attribute data into the user's buffer */
- HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts));
- } /* end else */
-
- /* Modify the attribute in the object header */
- if(H5O_attr_write(&(attr->oloc), dxpl_id, attr) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute")
- } /* end if */
-
-done:
- /* Release resources */
- if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(tconv_buf && !tconv_owned)
- tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
- if(bkg_buf)
- bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
-
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
-} /* H5A_write() */
-
-
-/*--------------------------------------------------------------------------
- NAME
- H5A_read
- PURPOSE
- Actually read in data from an attribute
- USAGE
- herr_t H5A_read (attr, mem_type, buf)
- H5A_t *attr; IN: Attribute to read
- const H5T_t *mem_type; IN: Memory datatype of buffer
- void *buf; IN: Buffer for data to read
- RETURNS
- Non-negative on success/Negative on failure
-
- DESCRIPTION
- This function reads a complete attribute from disk.
---------------------------------------------------------------------------*/
-herr_t
-H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id)
-{
- uint8_t *tconv_buf = NULL; /* datatype conv buffer*/
- uint8_t *bkg_buf = NULL; /* background buffer */
- hssize_t snelmts; /* elements in attribute */
- size_t nelmts; /* elements in attribute*/
- H5T_path_t *tpath = NULL; /* type conversion info */
- hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
- size_t src_type_size; /* size of source type */
- size_t dst_type_size; /* size of destination type */
- size_t buf_size; /* desired buffer size */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- HDassert(attr);
- HDassert(mem_type);
- HDassert(buf);
-
- /* Create buffer for data to store on disk */
- if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid")
- H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t);
-
- if(nelmts > 0) {
- /* Get the memory and file datatype sizes */
- src_type_size = H5T_GET_SIZE(attr->shared->dt);
- dst_type_size = H5T_GET_SIZE(mem_type);
-
- /* Check if the attribute has any data yet, if not, fill with zeroes */
- if(attr->obj_opened && !attr->shared->data)
- HDmemset(buf, 0, (dst_type_size * nelmts));
- else { /* Attribute exists and has a value */
- /* Convert memory buffer into disk buffer */
- /* Set up type conversion function */
- if(NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes")
-
- /* Check for type conversion required */
- if(!H5T_path_noop(tpath)) {
- if((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 ||
- (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion")
-
- /* Get the maximum buffer size needed and allocate it */
- buf_size = nelmts * MAX(src_type_size, dst_type_size);
- if(NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size)))
- HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
- HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed")
-
- /* Copy the attribute data into the buffer for conversion */
- HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts));
-
- /* Perform datatype conversion. */
- if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf, dxpl_id) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed")
-
- /* Copy the converted data into the user's buffer */
- HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts));
- } /* end if */
- /* No type conversion necessary */
- else {
- HDassert(dst_type_size == src_type_size);
-
- /* Copy the attribute data into the user's buffer */
- HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts));
- } /* end else */
- } /* end else */
- } /* end if */
-
-done:
- /* Release resources */
- if(src_id >= 0 && H5I_dec_ref(src_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(dst_id >= 0 && H5I_dec_ref(dst_id) < 0)
- HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object")
- if(tconv_buf)
- tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf);
- if(bkg_buf)
- bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_read() */
-
-
/*-------------------------------------------------------------------------
* Function: H5A_get_space
*
@@ -826,54 +609,8 @@ done:
} /* end H5Aget_create_plist() */
-/*--------------------------------------------------------------------------
- NAME
- H5A_get_name
- PURPOSE
- Private function for H5Aget_name. Gets a copy of the name for an
- attribute
- RETURNS
- This function returns the length of the attribute's name (which may be
- longer than 'buf_size') on success or negative for failure.
- DESCRIPTION
- This function retrieves the name of an attribute for an attribute ID.
- Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string
- terminator. If the name of the attribute is longer than 'buf_size'-1,
- the string terminator is stored in the last position of the buffer to
- properly terminate the string.
---------------------------------------------------------------------------*/
-ssize_t
-H5A_get_name(H5A_t *attr, size_t buf_size, char *buf)
-{
- size_t copy_len, nbytes;
- ssize_t ret_value;
-
- FUNC_ENTER_NOAPI_NOERR
-
- /* get the real attribute length */
- nbytes = HDstrlen(attr->shared->name);
- HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/
-
- /* compute the string length which will fit into the user's buffer */
- copy_len = MIN(buf_size - 1, nbytes);
-
- /* Copy all/some of the name */
- if(buf && copy_len > 0) {
- HDmemcpy(buf, attr->shared->name, copy_len);
-
- /* Terminate the string */
- buf[copy_len]='\0';
- } /* end if */
-
- /* Set return value */
- ret_value = (ssize_t)nbytes;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5A_get_name() */
-
-
/*-------------------------------------------------------------------------
- * Function: H5A_get_info
+ * Function: H5A__get_info
*
* Purpose: Retrieve information about an attribute.
*
@@ -886,7 +623,7 @@ H5A_get_name(H5A_t *attr, size_t buf_size, char *buf)
*-------------------------------------------------------------------------
*/
herr_t
-H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo)
+H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo)
{
FUNC_ENTER_NOAPI_NOERR
@@ -907,7 +644,7 @@ H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo)
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5A_get_info() */
+} /* end H5A__get_info() */
/*-------------------------------------------------------------------------
@@ -1347,7 +1084,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_dense_build_table_cb
+ * Function: H5A__dense_build_table_cb
*
* Purpose: Callback routine for building table of attributes from dense
* attribute storage.
@@ -1362,12 +1099,12 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_build_table_cb(const H5A_t *attr, void *_udata)
+H5A__dense_build_table_cb(const H5A_t *attr, void *_udata)
{
H5A_dense_bt_ud_t *udata = (H5A_dense_bt_ud_t *)_udata; /* 'User data' passed in */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(attr);
@@ -1387,7 +1124,7 @@ H5A_dense_build_table_cb(const H5A_t *attr, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_dense_build_table_cb() */
+} /* end H5A__dense_build_table_cb() */
/*-------------------------------------------------------------------------
@@ -1453,7 +1190,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
/* Build iterator operator */
attr_op.op_type = H5A_ATTR_OP_LIB;
- attr_op.u.lib_op = H5A_dense_build_table_cb;
+ attr_op.u.lib_op = H5A__dense_build_table_cb;
/* Iterate over the links in the group, building a table of the link messages */
if(H5A_dense_iterate(f, dxpl_id, (hid_t)0, ainfo, H5_INDEX_NAME,
@@ -1689,7 +1426,7 @@ H5A_attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip,
H5A_info_t ainfo; /* Info for attribute */
/* Get the attribute information */
- if(H5A_get_info(atable->attrs[u], &ainfo) < 0)
+ if(H5A__get_info(atable->attrs[u], &ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info")
/* Make the application callback */
@@ -2257,7 +1994,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_dense_post_copy_file_cb
+ * Function: H5A__dense_post_copy_file_cb
*
* Purpose: Callback routine for copying a dense attribute from SRC to DST.
*
@@ -2271,13 +2008,13 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
+H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata)
{
H5A_dense_file_cp_ud_t *udata = (H5A_dense_file_cp_ud_t *)_udata;
H5A_t *attr_dst = NULL;
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check arguments */
HDassert(attr_src);
@@ -2313,7 +2050,7 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_dense_post_copy_file_cb() */
+} /* end H5A__dense_post_copy_file_cb() */
/*-------------------------------------------------------------------------
@@ -2354,7 +2091,7 @@ H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo
udata.oloc_dst = dst_oloc;
attr_op.op_type = H5A_ATTR_OP_LIB;
- attr_op.u.lib_op = H5A_dense_post_copy_file_cb;
+ attr_op.u.lib_op = H5A__dense_post_copy_file_cb;
if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME,
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index f587f81..f656214 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -192,12 +192,9 @@ H5_DLL H5A_t *H5A_open_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name, hid_t lapl_id, hid_t dxpl_id);
H5_DLL H5A_t *H5A_open_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t dxpl_id);
-H5_DLL herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr);
-H5_DLL herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
-H5_DLL herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
-H5_DLL ssize_t H5A_get_name(H5A_t *attr, size_t buf_size, char *buf);
+H5_DLL herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr);
-H5_DLL herr_t H5A_get_info(const H5A_t *attr, H5A_info_t *ainfo);
+H5_DLL herr_t H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo);
H5_DLL hid_t H5A_get_type(H5A_t *attr);
H5_DLL hid_t H5A_get_space(H5A_t *attr);
H5_DLL hid_t H5A_get_create_plist(H5A_t* attr);