summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5D.c6
-rw-r--r--src/H5Dprivate.h2
-rw-r--r--src/H5P.c207
-rw-r--r--src/H5Pprivate.h1
-rw-r--r--src/H5Ppublic.h2
5 files changed, 55 insertions, 163 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 256da83..7cd7688 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -140,7 +140,7 @@ static herr_t
H5D_init_interface(void)
{
H5P_genclass_t *pclass; /* Property list class to modify */
- hsize_t def_max_temp_buf=H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
+ size_t def_max_temp_buf=H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */
void *def_tconv_buf=H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */
void *def_bkgr_buf=H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */
H5T_bkg_t def_bkgr_buf_type=H5D_XFER_BKGR_BUF_TYPE_DEF; /* Default value for background buffer type */
@@ -1956,7 +1956,7 @@ printf("%s: check 1.2, \n",FUNC);
src_type_size = H5T_get_size(dataset->type);
dst_type_size = H5T_get_size(mem_type);
- target_size = H5P_peek_hsize_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = H5P_peek_size_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
#ifdef QAK
printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
#endif /* QAK */
@@ -2432,7 +2432,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
src_type_size = H5T_get_size(mem_type);
dst_type_size = H5T_get_size(dataset->type);
- target_size = H5P_peek_hsize_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
+ target_size = H5P_peek_size_t(dxpl_id,H5D_XFER_MAX_TEMP_BUF_NAME);
#ifdef QAK
printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d\n",FUNC,(int)src_type_size,(int)dst_type_size,(int)target_size);
#endif /* QAK */
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index ef942f7..288de47 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -54,7 +54,7 @@ typedef struct H5D_create_t {
/* Data transfer properties */
/* Definitions for maximum temp buffer size property */
#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf"
-#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(hsize_t)
+#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t)
#define H5D_XFER_MAX_TEMP_BUF_DEF (1024*1024)
/* Definitions for type conversion buffer property */
#define H5D_XFER_TCONV_BUF_NAME "tconv_buf"
diff --git a/src/H5P.c b/src/H5P.c
index c95e2ac..d022b6e 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -2278,7 +2278,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
*
*-------------------------------------------------------------------------
*/
-hsize_t
+size_t
H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
{
size_t size; /* Type conversion buffer size */
@@ -5088,6 +5088,7 @@ herr_t H5Pset(hid_t plist_id, const char *name, void *value)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalied property value");
/* Create the new property list class */
+printf("%s: name, value=%u\n",FUNC,name,*(size_t *)(value));
if ((ret_value=H5P_set(plist_id,name,value))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value in plist");
@@ -6375,52 +6376,14 @@ done:
--------------------------------------------------------------------------*/
uintn H5P_peek_uintn(hid_t plist_id, const char *name)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5P_genprop_t *prop; /* Temporary property pointer */
uintn ret_value; /* return value */
FUNC_ENTER (H5P_peek_uintn, UFAIL);
assert(name);
- /* Check arguments. */
- if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
- assert(0 && "not a property list");
-
- /* Find property */
- if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL)
- assert(0 && "property doesn't exist");
-
- /* Check for property size >0 */
- if(prop->size==0)
- assert(0 && "property has zero size");
-
- /* Check for property size not the same as the return type */
- if(prop->size!=sizeof(uintn))
- assert(0 && "property has incorrect size");
-
- /* Make a copy of the value and pass to 'get' callback */
- if(prop->get!=NULL) {
- void *tmp_value; /* Temporary value for property */
-
- /* Make a copy of the current value, in case the callback fails */
- if (NULL==(tmp_value=H5MM_malloc(prop->size)))
- assert(0 && "memory allocation failed temporary property value");
- HDmemcpy(tmp_value,prop->value,prop->size);
-
- /* Call user's callback */
- if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0)
- assert(0 && "can't get property value");
-
- /* Copy new [possibly unchanged] value into return value */
- HDmemcpy(&ret_value,tmp_value,sizeof(uintn));
-
- /* Free the temporary value buffer */
- H5MM_xfree(tmp_value);
- } /* end if */
- /* No 'get' callback, just copy value */
- else
- HDmemcpy(&ret_value,prop->value,sizeof(uintn));
+ /* Get the value to return, don't worry about the return value, we can't return it */
+ H5P_get(plist_id,name,&ret_value);
FUNC_LEAVE (ret_value);
} /* H5P_peek_uintn() */
@@ -6455,52 +6418,14 @@ uintn H5P_peek_uintn(hid_t plist_id, const char *name)
--------------------------------------------------------------------------*/
hid_t H5P_peek_hid_t(hid_t plist_id, const char *name)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5P_genprop_t *prop; /* Temporary property pointer */
hid_t ret_value; /* return value */
FUNC_ENTER (H5P_peek_hid_t, FAIL);
assert(name);
- /* Check arguments. */
- if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
- assert(0 && "not a property list");
-
- /* Find property */
- if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL)
- assert(0 && "property doesn't exist");
-
- /* Check for property size >0 */
- if(prop->size==0)
- assert(0 && "property has zero size");
-
- /* Check for property size not the same as the return type */
- if(prop->size!=sizeof(hid_t))
- assert(0 && "property has incorrect size");
-
- /* Make a copy of the value and pass to 'get' callback */
- if(prop->get!=NULL) {
- void *tmp_value; /* Temporary value for property */
-
- /* Make a copy of the current value, in case the callback fails */
- if (NULL==(tmp_value=H5MM_malloc(prop->size)))
- assert(0 && "memory allocation failed temporary property value");
- HDmemcpy(tmp_value,prop->value,prop->size);
-
- /* Call user's callback */
- if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0)
- assert(0 && "can't get property value");
-
- /* Copy new [possibly unchanged] value into return value */
- HDmemcpy(&ret_value,tmp_value,sizeof(hid_t));
-
- /* Free the temporary value buffer */
- H5MM_xfree(tmp_value);
- } /* end if */
- /* No 'get' callback, just copy value */
- else
- HDmemcpy(&ret_value,prop->value,sizeof(hid_t));
+ /* Get the value to return, don't worry about the return value, we can't return it */
+ H5P_get(plist_id,name,&ret_value);
FUNC_LEAVE (ret_value);
} /* H5P_peek_hid_t() */
@@ -6535,52 +6460,14 @@ hid_t H5P_peek_hid_t(hid_t plist_id, const char *name)
--------------------------------------------------------------------------*/
void *H5P_peek_voidp(hid_t plist_id, const char *name)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5P_genprop_t *prop; /* Temporary property pointer */
void * ret_value; /* return value */
- FUNC_ENTER (H5P_peek_hid_t, NULL);
+ FUNC_ENTER (H5P_peek_voidp_t, NULL);
assert(name);
- /* Check arguments. */
- if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
- assert(0 && "not a property list");
-
- /* Find property */
- if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL)
- assert(0 && "property doesn't exist");
-
- /* Check for property size >0 */
- if(prop->size==0)
- assert(0 && "property has zero size");
-
- /* Check for property size not the same as the return type */
- if(prop->size!=sizeof(void *))
- assert(0 && "property has incorrect size");
-
- /* Make a copy of the value and pass to 'get' callback */
- if(prop->get!=NULL) {
- void *tmp_value; /* Temporary value for property */
-
- /* Make a copy of the current value, in case the callback fails */
- if (NULL==(tmp_value=H5MM_malloc(prop->size)))
- assert(0 && "memory allocation failed temporary property value");
- HDmemcpy(tmp_value,prop->value,prop->size);
-
- /* Call user's callback */
- if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0)
- assert(0 && "can't get property value");
-
- /* Copy new [possibly unchanged] value into return value */
- HDmemcpy(&ret_value,tmp_value,sizeof(void *));
-
- /* Free the temporary value buffer */
- H5MM_xfree(tmp_value);
- } /* end if */
- /* No 'get' callback, just copy value */
- else
- HDmemcpy(&ret_value,prop->value,sizeof(void *));
+ /* Get the value to return, don't worry about the return value, we can't return it */
+ H5P_get(plist_id,name,&ret_value);
FUNC_LEAVE (ret_value);
} /* H5P_peek_voidp() */
@@ -6615,55 +6502,59 @@ void *H5P_peek_voidp(hid_t plist_id, const char *name)
--------------------------------------------------------------------------*/
hsize_t H5P_peek_hsize_t(hid_t plist_id, const char *name)
{
- H5P_genplist_t *plist; /* Property list pointer */
- H5P_genprop_t *prop; /* Temporary property pointer */
hsize_t ret_value; /* return value */
- FUNC_ENTER (H5P_peek_hid_t, UFAIL);
+ FUNC_ENTER (H5P_peek_hsize_t, UFAIL);
assert(name);
- /* Check arguments. */
- if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
- assert(0 && "not a property list");
-
- /* Find property */
- if((prop=H5P_find_prop(plist->props,plist->pclass->hashsize,name))==NULL)
- assert(0 && "property doesn't exist");
-
- /* Check for property size >0 */
- if(prop->size==0)
- assert(0 && "property has zero size");
+ /* Get the value to return, don't worry about the return value, we can't return it */
+ H5P_get(plist_id,name,&ret_value);
- /* Check for property size not the same as the return type */
- if(prop->size!=sizeof(hsize_t))
- assert(0 && "property has incorrect size");
+ FUNC_LEAVE (ret_value);
+} /* H5P_peek_hsize_t() */
- /* Make a copy of the value and pass to 'get' callback */
- if(prop->get!=NULL) {
- void *tmp_value; /* Temporary value for property */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5P_peek_size_t
+ PURPOSE
+ Internal routine to quickly retrieve the value of a property in a property list.
+ USAGE
+ hsize_t H5P_peek_size_t(plist_id, name)
+ hid_t plist_id; IN: Property list to check
+ const char *name; IN: Name of property to query
+ RETURNS
+ Directly returns the value of the property in the list
+ DESCRIPTION
+ This function directly returns the value of a property in a property
+ list. Because this function is only able to just copy a particular property
+ value to the return value, there is no way to check for errors. We attempt
+ to make certain that bad things don't happen by validating that the size of
+ the property is the same as the size of the return type, but that can't
+ catch all errors.
+ This function does call the user's 'get' callback routine still.
- /* Make a copy of the current value, in case the callback fails */
- if (NULL==(tmp_value=H5MM_malloc(prop->size)))
- assert(0 && "memory allocation failed temporary property value");
- HDmemcpy(tmp_value,prop->value,prop->size);
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ No error checking!
+ Use with caution!
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+size_t H5P_peek_size_t(hid_t plist_id, const char *name)
+{
+ size_t ret_value; /* return value */
- /* Call user's callback */
- if((*(prop->get))(plist_id,name,prop->size,tmp_value)<0)
- assert(0 && "can't get property value");
+ FUNC_ENTER (H5P_peek_size_t, UFAIL);
- /* Copy new [possibly unchanged] value into return value */
- HDmemcpy(&ret_value,tmp_value,sizeof(hsize_t));
+ assert(name);
- /* Free the temporary value buffer */
- H5MM_xfree(tmp_value);
- } /* end if */
- /* No 'get' callback, just copy value */
- else
- HDmemcpy(&ret_value,prop->value,sizeof(hsize_t));
+ /* Get the value to return, don't worry about the return value, we can't return it */
+ H5P_get(plist_id,name,&ret_value);
FUNC_LEAVE (ret_value);
-} /* H5P_peek_hsize_t() */
+} /* H5P_peek_size_t() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 93c8beb..c11b14b 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -120,5 +120,6 @@ __DLL__ uintn H5P_peek_uintn(hid_t plist_id, const char *name);
__DLL__ hid_t H5P_peek_hid_t(hid_t plist_id, const char *name);
__DLL__ void *H5P_peek_voidp(hid_t plist_id, const char *name);
__DLL__ hsize_t H5P_peek_hsize_t(hid_t plist_id, const char *name);
+__DLL__ size_t H5P_peek_size_t(hid_t plist_id, const char *name);
#endif
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index ded0a0b..9b73102 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -182,7 +182,7 @@ __DLL__ hid_t H5Pget_driver(hid_t plist_id);
__DLL__ void *H5Pget_driver_info(hid_t plist_id);
__DLL__ herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv,
void *bkg);
-__DLL__ hsize_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/,
+__DLL__ size_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/,
void **bkg/*out*/);
__DLL__ herr_t H5Pset_preserve(hid_t plist_id, hbool_t status);
__DLL__ int H5Pget_preserve(hid_t plist_id);