summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/h5_elink_unix2win.c16
-rw-r--r--src/H5Lexternal.c17
-rw-r--r--src/H5Pdxpl.c246
-rw-r--r--src/H5Plapl.c139
-rw-r--r--src/H5Ppublic.h2
5 files changed, 263 insertions, 157 deletions
diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c
index b4998fd..447d392 100644
--- a/examples/h5_elink_unix2win.c
+++ b/examples/h5_elink_unix2win.c
@@ -45,6 +45,7 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void *
char *obj_name;
char *elink_prefix; /* External link prefix */
char *new_fname = NULL; /* Buffer allocated to hold Unix file path */
+ ssize_t prefix_len; /* External link prefix length */
size_t fname_len;
size_t start_pos; /* Initial position in new_fname buffer */
size_t x; /* Counter variable */
@@ -57,25 +58,22 @@ static hid_t elink_unix2win_trav(const char *link_name, hid_t cur_group, void *
fname_len = strlen(file_name);
/* See if the external link prefix property is set */
- if(H5Pget_elink_prefix(lapl_id, &elink_prefix) < 0)
+ if((prefix_len = H5Pget_elink_prefix(lapl_id, NULL, 0)) < 0)
goto error;
/* If so, prepend it to the filename. We assume that the prefix
* is in the correct format for the current file system.
*/
- if(elink_prefix != NULL)
+ if(prefix_len > 0)
{
- size_t buf_size; /* Size prefix buffer */
-
- buf_size = strlen(elink_prefix);
-
/* Allocate a buffer to hold the filename plus prefix */
- new_fname = malloc(buf_size + fname_len + 1);
+ new_fname = malloc(prefix_len + fname_len + 1);
/* Copy the prefix into the buffer */
- strcpy(new_fname, elink_prefix);
+ if(H5Pget_elink_prefix(lapl_id, new_fname, prefix_len + 1) < 0)
+ goto error;
- start_pos = buf_size;
+ start_pos = prefix_len;
}
else
{
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index 094bde3..9b53c14 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -94,7 +94,7 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
hid_t fid;
char *file_name;
char *obj_name;
- char *prefix;
+ ssize_t prefix_len; /* External link prefix length */
size_t fname_len;
hbool_t fname_alloc = FALSE;
unsigned intent;
@@ -106,22 +106,21 @@ H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group,
obj_name = ((char *) udata) + fname_len + 1;
/* See if the external link prefix property is set */
- if(H5Pget_elink_prefix(lapl_id, &prefix) < 0)
+ if((prefix_len = H5Pget_elink_prefix(lapl_id, NULL, (size_t)0)) < 0)
goto error;
/* If so, prepend it to the filename */
- if(prefix != NULL)
+ if(prefix_len > 0)
{
- size_t buf_size;
-
- buf_size = HDstrlen(prefix);
-
/* Allocate a buffer to hold the filename plus prefix */
- file_name = H5MM_malloc(buf_size + fname_len + 1);
+ file_name = H5MM_malloc(prefix_len + fname_len + 1);
fname_alloc = TRUE;
+ /* Copy the prefix into the buffer */
+ if(H5Pget_elink_prefix(lapl_id, file_name, (size_t)(prefix_len + 1)) < 0)
+ goto error;
+
/* Add the external link's filename to the prefix supplied */
- HDstrcpy(file_name, prefix);
HDstrcat(file_name, udata);
}
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 3350658..4fb2b07 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -333,9 +333,9 @@ H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data)
/* Get the driver information */
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info")
/* Check if we have a valid driver ID */
if(driver_id > 0) {
@@ -384,7 +384,7 @@ H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data)
/* Get values from old property list */
if(H5P_get(src_plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID")
if(H5P_get(src_plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info")
@@ -433,9 +433,9 @@ H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID")
if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info")
if(driver_id > 0) {
/* Close the driver for the property list */
if(H5FD_dxpl_close(driver_id, driver_info) < 0)
@@ -466,7 +466,7 @@ H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5P_dxfr_xform_del, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_xform_del)
HDassert(value);
@@ -498,7 +498,9 @@ H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5P_dxfr_xform_copy, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_xform_copy)
+
+ HDassert(value);
if(H5Z_xform_copy((H5Z_data_xform_t **)value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error copying the data transform info")
@@ -527,7 +529,7 @@ H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5P_dxfr_xform_close, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_xform_close)
HDassert(value);
@@ -552,43 +554,42 @@ done:
* Programmer: Leon Arber
* Monday, March 07, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-herr_t H5Pset_data_transform(hid_t plist_id, const char* expression)
+herr_t
+H5Pset_data_transform(hid_t plist_id, const char* expression)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5Z_data_xform_t *data_xform_prop=NULL; /* New data xform property */
- herr_t ret_value=SUCCEED; /* return value */
+ H5Z_data_xform_t *data_xform_prop = NULL; /* New data xform property */
+ herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_data_transform, FAIL);
+ FUNC_ENTER_API(H5Pset_data_transform, FAIL)
/* Check arguments */
- if (expression == NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL");
+ if(expression == NULL)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Create data transform info from expression */
if(NULL == (data_xform_prop = H5Z_xform_create(expression)))
- HGOTO_ERROR (H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info")
+ HGOTO_ERROR(H5E_PLINE, H5E_NOSPACE, FAIL, "unable to create data transform info")
/* Update property list */
- if(H5P_set(plist, H5D_XFER_XFORM_NAME, &data_xform_prop)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression");
+ if(H5P_set(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression")
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop)<0)
+ if(H5Z_xform_destroy(data_xform_prop) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pset_data_transform() */
/*-------------------------------------------------------------------------
@@ -612,56 +613,53 @@ done:
* Programmer: Leon Arber
* August 27, 2004
*
- * Modifications:
- * October 20, 2004 LA: Changed API to use size and return ssize_t
*-------------------------------------------------------------------------
*/
-ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, size_t size)
+ssize_t
+H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
- H5Z_data_xform_t *data_xform_prop=NULL; /* New data xform property */
- ssize_t ret_value; /* return value */
-
+ H5Z_data_xform_t *data_xform_prop = NULL; /* New data xform property */
size_t len;
char* pexp;
+ ssize_t ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_data_transform, FAIL);
+ FUNC_ENTER_API(H5Pget_data_transform, FAIL)
/* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Error getting data transform expression");
+ if(H5P_get(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression")
if(NULL == data_xform_prop)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Cannot get a data transform that has not been set");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "data transform has not been set")
/* Get the data transform string */
pexp = H5Z_xform_extract_xform_str(data_xform_prop);
if(!pexp)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Failed to retrieve transform expression");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "failed to retrieve transform expression")
len = HDstrlen(pexp);
- if(expression)
- {
- HDstrncpy(expression, pexp, MIN(len+1,size));
+ if(expression) {
+ HDstrncpy(expression, pexp, MIN(len + 1, size));
if(len >= size)
- expression[size-1]='\0';
- }
+ expression[size - 1] = '\0';
+ } /* end if */
ret_value = (ssize_t)len;
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
if(data_xform_prop)
- if(H5Z_xform_destroy(data_xform_prop)<0)
+ if(H5Z_xform_destroy(data_xform_prop) < 0)
HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "unable to release data transform expression")
} /* end if */
- FUNC_LEAVE_API(ret_value);
-}
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_data_transform() */
/*-------------------------------------------------------------------------
@@ -693,27 +691,27 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_buffer, FAIL);
+ FUNC_ENTER_API(H5Pset_buffer, FAIL)
H5TRACE4("e","izxx",plist_id,size,tconv,bkg);
/* Check arguments */
if (size<=0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size")
if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer")
if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -740,30 +738,30 @@ H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
size_t size; /* Type conversion buffer size */
size_t ret_value; /* Return value */
- FUNC_ENTER_API(H5Pget_buffer, 0);
+ FUNC_ENTER_API(H5Pget_buffer, 0)
H5TRACE3("z","ixx",plist_id,tconv,bkg);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID")
/* Return values */
if (tconv)
if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer")
if (bkg)
if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer")
/* Get the size */
if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size")
/* Set the return value */
ret_value=size;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -792,20 +790,20 @@ H5Pset_preserve(hid_t plist_id, hbool_t status)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_preserve, FAIL);
+ FUNC_ENTER_API(H5Pset_preserve, FAIL)
H5TRACE2("e","ib",plist_id,status);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -832,22 +830,22 @@ H5Pget_preserve(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
int ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_preserve, FAIL);
+ FUNC_ENTER_API(H5Pget_preserve, FAIL)
H5TRACE1("Is","i",plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get value */
if (H5P_get(plist,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Set return value */
ret_value= need_bkg ? TRUE : FALSE;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -874,23 +872,23 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_edc_check, FAIL);
+ FUNC_ENTER_API(H5Pset_edc_check, FAIL)
H5TRACE2("e","iZe",plist_id,check);
/* Check argument */
if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist,H5D_XFER_EDC_NAME,&check)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -917,23 +915,23 @@ H5Pget_edc_check(hid_t plist_id)
H5P_genplist_t *plist; /* Property list pointer */
H5Z_EDC_t ret_value; /* return value */
- FUNC_ENTER_API(H5Pget_edc_check, H5Z_ERROR_EDC);
+ FUNC_ENTER_API(H5Pget_edc_check, H5Z_ERROR_EDC)
H5TRACE1("Ze","i",plist_id);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID")
/* Update property list */
if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value")
/* check valid value */
if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -960,22 +958,22 @@ H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data)
herr_t ret_value=SUCCEED; /* return value */
H5Z_cb_t cb_struct;
- FUNC_ENTER_API(H5Pset_filter_callback, FAIL);
+ FUNC_ENTER_API(H5Pset_filter_callback, FAIL)
H5TRACE3("e","ixx",plist_id,func,op_data);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
cb_struct.func = func;
cb_struct.op_data = op_data;
if (H5P_set(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1002,22 +1000,22 @@ H5Pset_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t op, void *operate_dat
herr_t ret_value=SUCCEED; /* return value */
H5T_conv_cb_t cb_struct;
- FUNC_ENTER_API(H5Pset_type_conv_cb, FAIL);
+ FUNC_ENTER_API(H5Pset_type_conv_cb, FAIL)
H5TRACE3("e","ixx",plist_id,op,operate_data);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
cb_struct.func = op;
cb_struct.user_data = operate_data;
if (H5P_set(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1044,23 +1042,23 @@ H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op, void **operate_d
H5T_conv_cb_t cb_struct;
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_type_conv_cb, FAIL);
+ FUNC_ENTER_API(H5Pget_type_conv_cb, FAIL)
H5TRACE3("e","i*xx",plist_id,op,operate_data);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get property */
if (H5P_get(plist,H5D_XFER_CONV_CB_NAME,&cb_struct)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
/* Assign return value */
*op = cb_struct.func;
*operate_data = cb_struct.user_data;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1089,16 +1087,16 @@ H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_btree_ratios, FAIL);
+ FUNC_ENTER_API(H5Pget_btree_ratios, FAIL)
H5TRACE4("e","ixxx",plist_id,left,middle,right);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the split ratios */
if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
/* Get values */
if (left)
@@ -1109,7 +1107,7 @@ H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
*right = btree_split_ratio[2];
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1143,17 +1141,17 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_btree_ratios, FAIL);
+ FUNC_ENTER_API(H5Pset_btree_ratios, FAIL)
H5TRACE4("e","iddd",plist_id,left,middle,right);
/* Check arguments */
if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 ||
right<0.0 || right>1.0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set values */
split_ratio[0] = left;
@@ -1162,10 +1160,10 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
/* Set the split ratios */
if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1196,22 +1194,22 @@ H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
{
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5P_set_vlen_mem_manager, FAIL);
+ FUNC_ENTER_NOAPI(H5P_set_vlen_mem_manager, FAIL)
assert(plist);
/* Update property list */
if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_set_vlen_mem_manager() */
@@ -1243,19 +1241,19 @@ H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_vlen_mem_manager, FAIL);
+ FUNC_ENTER_API(H5Pset_vlen_mem_manager, FAIL)
H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
/* Check arguments */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
/* Update property list */
if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_vlen_mem_manager() */
@@ -1282,28 +1280,28 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_vlen_mem_manager, FAIL);
+ FUNC_ENTER_API(H5Pget_vlen_mem_manager, FAIL)
H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
if(alloc_func!=NULL)
if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
if(alloc_info!=NULL)
if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
if(free_func!=NULL)
if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
if(free_info!=NULL)
if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -1336,23 +1334,23 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pset_hyper_vector_size, FAIL);
+ FUNC_ENTER_API(H5Pset_hyper_vector_size, FAIL)
H5TRACE2("e","iz",plist_id,vector_size);
/* Check arguments */
if (vector_size<1)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Update property list */
if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pset_hyper_vector_size() */
@@ -1376,19 +1374,19 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_API(H5Pget_hyper_vector_size, FAIL);
+ FUNC_ENTER_API(H5Pget_hyper_vector_size, FAIL)
H5TRACE2("e","ix",plist_id,vector_size);
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Return values */
if (vector_size)
if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Pget_hyper_vector_size() */
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 795f5e0..eb3fb1c 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -35,6 +35,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
@@ -49,6 +50,9 @@
/* Definitions for external link prefix */
#define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *)
#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */
+#define H5L_ACS_ELINK_PREFIX_DEL H5P_lacc_elink_pref_del
+#define H5L_ACS_ELINK_PREFIX_COPY H5P_lacc_elink_pref_copy
+#define H5L_ACS_ELINK_PREFIX_CLOSE H5P_lacc_elink_pref_close
/******************/
/* Local Typedefs */
@@ -67,6 +71,12 @@
/* Property class callbacks */
static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass);
+/* Property list callbacks */
+static herr_t H5P_lacc_elink_pref_del(hid_t prop_id, const char* name, size_t size, void* value);
+static herr_t H5P_lacc_elink_pref_copy(const char* name, size_t size, void* value);
+static herr_t H5P_lacc_elink_pref_close(const char* name, size_t size, void* value);
+
+
/*********************/
/* Package Variables */
/*********************/
@@ -125,7 +135,7 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass)
/* Register property for external link prefix */
if(H5P_register(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE,
- &elink_prefix, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
+ &elink_prefix, NULL, NULL, NULL, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, NULL, H5L_ACS_ELINK_PREFIX_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
done:
@@ -134,6 +144,84 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_del
+ *
+ * Purpose: Frees memory used to store the external link prefix string
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * November 2, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+/* ARGSUSED */
+static herr_t
+H5P_lacc_elink_pref_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_lacc_elink_pref_del)
+
+ HDassert(value);
+
+ H5MM_xfree(*(void **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P_lacc_elink_pref_del() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_copy
+ *
+ * Purpose: Creates a copy of the external link prefix string
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * November 2, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+/* ARGSUSED */
+static herr_t
+H5P_lacc_elink_pref_copy(const char UNUSED *name, size_t UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_lacc_elink_pref_copy)
+
+ HDassert(value);
+
+ *(char **)value = H5MM_xstrdup(*(const char **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P_lacc_elink_pref_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_lacc_elink_pref_close
+ *
+ * Purpose: Frees memory used to store the external link prefix string
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * November 2, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+/* ARGSUSED */
+static herr_t
+H5P_lacc_elink_pref_close(const char UNUSED *name, size_t UNUSED size, void *value)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_lacc_elink_pref_close)
+
+ HDassert(value);
+
+ H5MM_xfree(*(void **)value);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P_lacc_elink_pref_close() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_nlinks
*
* Purpose: Set the number of soft or UD link traversals allowed before
@@ -227,10 +315,6 @@ done:
* traversed. The prefix is appended to the filename stored
* in the external link.
*
- * The prefix is supplied by giving a pointer to a user-
- * allocated buffer. This buffer should not be freed
- * until this property list has been closed.
- *
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
@@ -242,6 +326,7 @@ herr_t
H5Pset_elink_prefix(hid_t plist_id, const char *prefix)
{
H5P_genplist_t *plist; /* Property list pointer */
+ char *my_prefix; /* Copy of prefix string */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pset_elink_prefix, FAIL)
@@ -251,8 +336,19 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix)
if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+ /* Get current prefix value */
+ if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get prefix info")
+
+ /* Free existing prefix, if there is one */
+ H5MM_xfree(my_prefix);
+
+ /* Make a copy of the user's prefix string */
+ if(NULL == (my_prefix = H5MM_xstrdup(prefix)))
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy prefix")
+
/* Set prefix */
- if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0)
+ if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info")
done:
@@ -276,27 +372,42 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
-H5Pget_elink_prefix(hid_t plist_id, char **prefix)
+ssize_t
+H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size)
{
H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ const char *my_prefix; /* Library's copy of the prefix */
+ size_t len; /* Length of prefix string */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(H5Pget_elink_prefix, FAIL)
H5TRACE2("e","i*s",plist_id,prefix);
- if(!prefix)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer passed in");
-
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Get the current prefix */
- if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, prefix) < 0)
+ if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix")
+ /* Check for prefix being set */
+ if(my_prefix) {
+ /* Copy to user's buffer, if given */
+ len = HDstrlen(my_prefix);
+ if(prefix) {
+ HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ if(len >= size)
+ prefix[size - 1] = '\0';
+ } /* end if */
+ } /* end if */
+ else
+ len = 0;
+
+ /* Set return value */
+ ret_value = (ssize_t)len;
+
done:
FUNC_LEAVE_API(ret_value)
-}
+} /* end H5Pget_elink_prefix() */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 999f509..6724036 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -388,7 +388,7 @@ H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/)
H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks);
H5_DLL herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks);
H5_DLL herr_t H5Pset_elink_prefix(hid_t plist_id, const char *prefix);
-H5_DLL herr_t H5Pget_elink_prefix(hid_t plist_id, char **prefix);
+H5_DLL ssize_t H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size);
/* Object copy property list (OCPL) routines */
H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned crt_intmd);