summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c4
-rw-r--r--src/H5C.c10
-rw-r--r--src/H5CS.c14
-rw-r--r--src/H5D.c47
-rw-r--r--src/H5Dchunk.c10
-rw-r--r--src/H5Dint.c12
-rw-r--r--src/H5Dio.c7
-rw-r--r--src/H5Dmpio.c39
-rw-r--r--src/H5Dpkg.h11
-rw-r--r--src/H5F.c21
-rw-r--r--src/H5FD.c10
-rw-r--r--src/H5FDcore.c2
-rw-r--r--src/H5FDdirect.c90
-rw-r--r--src/H5FDfamily.c16
-rw-r--r--src/H5FDint.c2
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmpi.c34
-rw-r--r--src/H5FDmpio.c52
-rw-r--r--src/H5FDmpiposix.c4
-rw-r--r--src/H5FO.c28
-rw-r--r--src/H5Fmpi.c6
-rw-r--r--src/H5Fpkg.h1
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5Gname.c14
-rw-r--r--src/H5HG.c8
-rw-r--r--src/H5HP.c134
-rw-r--r--src/H5MM.c4
-rw-r--r--src/H5Oefl.c4
-rw-r--r--src/H5Olayout.c2
-rw-r--r--src/H5Oname.c14
-rw-r--r--src/H5Ostab.c16
-rw-r--r--src/H5PL.c4
-rw-r--r--src/H5Pdcpl.c21
-rw-r--r--src/H5Pfapl.c2
-rw-r--r--src/H5Pint.c2
-rw-r--r--src/H5Pocpl.c2
-rw-r--r--src/H5S.c10
-rw-r--r--src/H5SL.c42
-rw-r--r--src/H5Sall.c54
-rw-r--r--src/H5Sselect.c52
-rw-r--r--src/H5T.c74
-rw-r--r--src/H5Tconv.c627
-rw-r--r--src/H5Tenum.c20
-rw-r--r--src/H5Tfields.c12
-rw-r--r--src/H5Tfixed.c2
-rw-r--r--src/H5Tnative.c53
-rw-r--r--src/H5Toffset.c12
-rw-r--r--src/H5Tprecis.c12
-rw-r--r--src/H5V.c146
-rw-r--r--src/H5Vprivate.h2
-rw-r--r--src/H5Z.c235
-rw-r--r--src/H5Zfletcher32.c2
-rw-r--r--src/H5Zprivate.h3
-rw-r--r--src/H5Zscaleoffset.c4
-rw-r--r--src/H5Zszip.c20
-rw-r--r--src/H5Ztrans.c68
-rw-r--r--src/H5detect.c98
-rw-r--r--src/H5make_libsettings.c6
-rw-r--r--src/H5private.h3
-rw-r--r--src/H5system.c4
-rw-r--r--src/H5timer.c10
-rw-r--r--src/H5trace.c10
62 files changed, 1198 insertions, 1033 deletions
diff --git a/src/H5.c b/src/H5.c
index 25525a4..03d82a8 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -144,7 +144,7 @@ H5_init_library(void)
MPI_Initialized(&mpi_initialized);
if (mpi_initialized){
mpe_code = MPE_Init_log();
- assert(mpe_code >=0);
+ HDassert(mpe_code >=0);
H5_MPEinit_g = TRUE;
}
}
@@ -309,7 +309,7 @@ H5_term_library(void)
MPI_Initialized(&mpi_initialized);
if(mpi_initialized) {
mpe_code = MPE_Finish_log("h5log");
- assert(mpe_code >=0);
+ HDassert(mpe_code >=0);
} /* end if */
H5_MPEinit_g = FALSE; /* turn it off no matter what */
} /* end if */
diff --git a/src/H5C.c b/src/H5C.c
index fa385fa..0946af9 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -479,10 +479,10 @@ H5C_apply_candidate_list(H5F_t * f,
sprintf(&(tbl_buf[0]), "candidate list = ");
for ( i = 0; i < num_candidates; i++ )
{
- sprintf(&(tbl_buf[strlen(tbl_buf)]), " 0x%llx",
+ sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx",
(long long)(*(candidates_list_ptr + i)));
}
- sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
+ sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
@@ -539,8 +539,8 @@ H5C_apply_candidate_list(H5F_t * f,
tbl_buf[i] = '\0';
sprintf(&(tbl_buf[0]), "candidate assignment table = ");
for(i = 0; i <= mpi_size; i++)
- sprintf(&(tbl_buf[strlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
- sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
+ sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]);
+ sprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
HDfprintf(stdout, "%s", tbl_buf);
HDfprintf(stdout, "%s:%d: flush entries [%d, %d].\n",
@@ -814,7 +814,7 @@ H5C_apply_candidate_list(H5F_t * f,
entries_cleared, entries_flushed);
HDfprintf(stdout, "%s:%d: done.\n", FUNC, mpi_rank);
- fsync(stdout);
+ HDfsync(stdout);
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
/* ====================================================================== *
diff --git a/src/H5CS.c b/src/H5CS.c
index c2ca49b..4ccd0f8 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -173,7 +173,7 @@ H5CS_print(FILE *stream)
FUNC_ENTER_NOAPI_NOERR_NOFS
/* Sanity check */
- assert(fstack);
+ HDassert(fstack);
H5CS_print_stack(fstack, stream);
@@ -205,8 +205,8 @@ H5CS_push(const char *func_name)
FUNC_ENTER_NOAPI_NOERR_NOFS
/* Sanity check */
- assert (fstack);
- assert (func_name);
+ HDassert(fstack);
+ HDassert(func_name);
/*
* Push the function if there's room. Otherwise just increment count
@@ -242,8 +242,8 @@ H5CS_pop(void)
FUNC_ENTER_NOAPI_NOERR_NOFS
/* Sanity check */
- assert (fstack);
- assert (fstack->nused>0);
+ HDassert(fstack);
+ HDassert(fstack->nused>0);
/* Pop the function. */
fstack->nused--;
@@ -276,7 +276,7 @@ H5CS_copy_stack(H5CS_t *new_stack)
FUNC_ENTER_NOAPI_NOERR_NOFS
/* Sanity check */
- HDassert (old_stack);
+ HDassert(old_stack);
/* Copy old stack to new one, duplicating the strings */
for(u = 0; u < old_stack->nused; u++)
@@ -310,7 +310,7 @@ H5CS_close_stack(H5CS_t *stack)
FUNC_ENTER_NOAPI_NOERR_NOFS
/* Sanity check */
- HDassert (stack);
+ HDassert(stack);
/* Free strings on stack */
for(u = 0; u < stack->nused; u++)
diff --git a/src/H5D.c b/src/H5D.c
index d81d4c7..f47a84c 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -105,7 +105,7 @@ H5D__init_pub_interface(void)
* properties (DCPL_ID).
*
* All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, data spaces, and creation
+ * allowed to derive new types, dataspaces, and creation
* parameters from the old ones and reuse them in calls to
* create other datasets.
*
@@ -191,7 +191,7 @@ done:
* properties (DCPL_ID).
*
* All arguments are copied into the dataset, so the caller is
- * allowed to derive new types, data spaces, and creation
+ * allowed to derive new types, dataspaces, and creation
* parameters from the old ones and reuse them in calls to
* create other datasets.
*
@@ -409,9 +409,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Dget_space
*
- * Purpose: Returns a copy of the file data space for a dataset.
+ * Purpose: Returns a copy of the file dataspace for a dataset.
*
- * Return: Success: ID for a copy of the data space. The data
+ * Return: Success: ID for a copy of the dataspace. The data
* space should be released by calling
* H5Sclose().
*
@@ -436,13 +436,13 @@ H5Dget_space(hid_t dset_id)
if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- /* Read the data space message and return a data space object */
+ /* Read the dataspace message and return a dataspace object */
if(NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get data space")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace")
/* Create an atom */
if((ret_value = H5I_register (H5I_DATASPACE, space, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace")
done:
if(ret_value < 0) {
@@ -459,7 +459,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5Dget_space_status
*
- * Purpose: Returns the status of data space allocation.
+ * Purpose: Returns the status of dataspace allocation.
*
* Return:
* Success: Non-negative
@@ -483,7 +483,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
if(NULL==(dset=(H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
- /* Read data space address and return */
+ /* Read dataspace address and return */
if(H5D__get_space_status(dset, allocation, H5AC_ind_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
@@ -573,10 +573,6 @@ hid_t
H5Dget_create_plist(hid_t dset_id)
{
H5D_t *dataset; /* Dataset structure */
- H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */
- H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */
- H5O_fill_t copied_fill; /* Fill value to tweak */
- hid_t new_dcpl_id = FAIL;
hid_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -1030,6 +1026,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
hsize_t *size)
{
H5D_vlen_bufsize_t vlen_bufsize = {0, 0, 0, 0, 0, 0, 0};
+ H5D_t *dset; /* Dataset for operation */
+ H5S_t *fspace = NULL; /* Dataset's dataspace */
+ H5S_t *mspace = NULL; /* Memory dataspace */
char bogus; /* bogus value to pass to H5Diterate() */
H5S_t *space; /* Dataspace for iteration */
H5P_genclass_t *pclass; /* Property class */
@@ -1043,21 +1042,25 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
if(H5I_DATASET != H5I_get_type(dataset_id) ||
H5I_DATATYPE != H5I_get_type(type_id) || size == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument")
+ if(NULL == (dset = (H5D_t *)H5I_object(dataset_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace")
if(!(H5S_has_extent(space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set")
- /* Save the dataset ID */
- vlen_bufsize.dataset_id = dataset_id;
+ /* Save the dataset */
+ vlen_bufsize.dset = dset;
- /* Get a copy of the dataspace ID */
- if((vlen_bufsize.fspace_id = H5Dget_space(dataset_id)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace")
+ /* Get a copy of the dataset's dataspace */
+ if(NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace")
+ vlen_bufsize.fspace = fspace;
/* Create a scalar for the memory dataspace */
- if((vlen_bufsize.mspace_id = H5Screate(H5S_SCALAR)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't create dataspace")
+ if(NULL == (mspace = H5S_create(H5S_SCALAR)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace")
+ vlen_bufsize.mspace = mspace;
/* Grab the temporary buffers required */
if(NULL == (vlen_bufsize.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, (size_t)1)))
@@ -1092,9 +1095,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
*size = vlen_bufsize.size;
done:
- if(vlen_bufsize.fspace_id > 0 && H5I_dec_ref(vlen_bufsize.fspace_id) < 0)
+ if(fspace && H5S_close(fspace) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- if(vlen_bufsize.mspace_id > 0 && H5I_dec_ref(vlen_bufsize.mspace_id) < 0)
+ if(mspace && H5S_close(mspace) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
if(vlen_bufsize.fl_tbuf != NULL)
vlen_bufsize.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.fl_tbuf);
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 31e3179..2838a39 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -1206,7 +1206,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
FUNC_ENTER_STATIC
/* Sanity check */
- assert(fm->f_ndims>0);
+ HDassert(fm->f_ndims>0);
/* Get number of elements selected in file */
sel_points = fm->nelmts;
@@ -1383,7 +1383,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
FUNC_ENTER_STATIC
/* Sanity check */
- assert(fm->f_ndims>0);
+ HDassert(fm->f_ndims>0);
/* Check for all I/O going to a single chunk */
if(H5SL_count(fm->sel_chunks)==1) {
@@ -1394,7 +1394,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
- assert(chunk_info);
+ HDassert(chunk_info);
/* Just point at the memory dataspace & selection */
/* (Casting away const OK -QAK) */
@@ -1413,7 +1413,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
- assert(fm->m_ndims==fm->f_ndims);
+ HDassert(fm->m_ndims==fm->f_ndims);
for(u=0; u<fm->f_ndims; u++) {
H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t);
H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t);
@@ -1427,7 +1427,7 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm)
/* Get pointer to chunk's information */
chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node);
- assert(chunk_info);
+ HDassert(chunk_info);
/* Copy the information */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index f313e52..5545a98 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -374,7 +374,7 @@ H5D__get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache)
FUNC_ENTER_PACKAGE
/* Check args */
- assert(cache);
+ HDassert(cache);
/* Check for the default DXPL */
if(dxpl_id==H5P_DATASET_XFER_DEFAULT)
@@ -2052,18 +2052,18 @@ H5D__vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, c
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object(type_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype")
/* Make certain there is enough fixed-length buffer available */
if(NULL == (vlen_bufsize->fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->fl_tbuf, H5T_get_size(dt))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf")
+ HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if(H5Sselect_elements(vlen_bufsize->fspace_id, H5S_SELECT_SET, (size_t)1, point) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't select point")
+ if(H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
- if(H5Dread(vlen_bufsize->dataset_id, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0)
+ if(H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, vlen_bufsize->xfer_pid, vlen_bufsize->fl_tbuf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point")
done:
diff --git a/src/H5Dio.c b/src/H5Dio.c
index df1c4a3..9b2f8ff 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -52,9 +52,6 @@
/********************/
/* Internal I/O routines */
-static herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
- const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist,
- void *buf/*out*/);
static herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id,
const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist,
const void *buf);
@@ -384,7 +381,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, void *buf/*out*/)
{
@@ -416,7 +413,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_TAG(dxpl_id, dataset->oloc.addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dataset->oloc.addr, FAIL)
/* check args */
HDassert(dataset && dataset->oloc.file);
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index 900ad6a..4d4c2bf 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -648,42 +648,49 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
} /* end else */
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+{
+ H5P_genplist_t *plist; /* Property list pointer */
htri_t check_prop;
int new_value;
+ /* Get the dataset transfer property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
/*** Test collective chunk user-input optimization APIs. ***/
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME);
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME);
if(check_prop > 0) {
if(H5D_ONE_LINK_CHUNK_IO == io_option) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
} /* end if */
} /* end if */
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME);
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME);
if(check_prop > 0) {
if(H5D_MULTI_CHUNK_IO == io_option) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, &new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
} /* end if */
} /* end if */
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME);
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME);
if(check_prop > 0) {
if(H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, &new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
} /* end if */
} /* end if */
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME);
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME);
if(check_prop > 0) {
if(temp_not_link_io) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, &new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTSET, FAIL, "unable to set property value")
} /* end if */
} /* end if */
+}
#endif
/* step 2: Go ahead to do IO.*/
@@ -1713,19 +1720,26 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
HDmemcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks);
#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME);
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ /* Get the dataset transfer property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id)))
+ HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list")
+
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME);
if(check_prop > 0) {
for(ic = 0; ic < total_chunks; ic++) {
if(assign_io_mode[ic] == H5D_CHUNK_IO_MODE_COL) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id,H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME,&new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "unable to set property value")
break;
} /* end if */
} /* end for */
} /* end if */
- check_prop = H5Pexist(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME);
+ check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME);
if(check_prop > 0) {
int temp_count = 0;
@@ -1737,10 +1751,11 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm,
} /* end for */
if(temp_count == 0) {
new_value = 0;
- if(H5Pset(io_info->dxpl_id, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, &new_value) < 0)
+ if(H5P_set(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, &new_value) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "unable to set property value")
} /* end if */
} /* end if */
+}
#endif
done:
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index ed6da8f..7e6eb4b 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -479,9 +479,9 @@ typedef struct H5D_fill_buf_info_t {
/* Internal data structure for computing variable-length dataset's total size */
typedef struct {
- hid_t dataset_id; /* ID of the dataset we are working on */
- hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */
- hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */
+ H5D_t *dset; /* Dataset for operation */
+ H5S_t *fspace; /* Dataset's dataspace for operation */
+ H5S_t *mspace; /* Memory dataspace for operation */
void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
hid_t xfer_pid; /* ID of the dataset xfer property list */
@@ -547,6 +547,11 @@ H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id);
H5_DLL herr_t H5D__mark(H5D_t *dataset, hid_t dxpl_id, unsigned flags);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id);
+/* Internal I/O routines */
+H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id,
+ const H5S_t *mem_space, const H5S_t *file_space, hid_t dset_xfer_plist,
+ void *buf/*out*/);
+
/* Functions that perform direct serial I/O operations */
H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info,
const H5D_type_info_t *type_info,
diff --git a/src/H5F.c b/src/H5F.c
index 12c25cd..6c220aa 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2369,8 +2369,10 @@ H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *na
} /* end else */
done:
- if(new_fapl_id > 0 && H5Pclose(new_fapl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close duplicated FAPL")
+ /* Close the property list */
+ if(new_fapl_id > 0)
+ if(H5I_dec_app_ref(new_fapl_id) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close duplicated FAPL")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_build_actual_name() */
@@ -2597,16 +2599,15 @@ done:
* david.pitt@bigpond.com
* Apr 27, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
H5Fget_filesize(hid_t file_id, hsize_t *size)
{
- H5F_t *file; /* File object for file ID */
- haddr_t eof; /* End of file address */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File object for file ID */
+ haddr_t eof; /* End of file address */
+ haddr_t base_addr; /* Base address for the file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", file_id, size);
@@ -2616,10 +2617,12 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Go get the actual file size */
- if(HADDR_UNDEF == (eof = H5FDget_eof(file->shared->lf)))
+ if(HADDR_UNDEF == (eof = H5FD_get_eof(file->shared->lf)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
+ base_addr = H5FD_get_base_addr(file->shared->lf);
- *size = (hsize_t)eof;
+ if(size)
+ *size = (hsize_t)(eof + base_addr); /* Convert relative base address for file to absolute address */
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5FD.c b/src/H5FD.c
index b359d78..b38b904 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -490,7 +490,7 @@ H5FD_sb_size(H5FD_t *file)
FUNC_ENTER_NOAPI(0)
- assert(file && file->cls);
+ HDassert(file && file->cls);
if(file->cls->sb_size)
ret_value = (file->cls->sb_size)(file);
@@ -528,7 +528,7 @@ H5FD_sb_encode(H5FD_t *file, char *name/*out*/, uint8_t *buf)
FUNC_ENTER_NOAPI(FAIL)
- assert(file && file->cls);
+ HDassert(file && file->cls);
if(file->cls->sb_encode &&
(file->cls->sb_encode)(file, name/*out*/, buf/*out*/) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed")
@@ -690,7 +690,7 @@ H5FD_fapl_get(H5FD_t *file)
FUNC_ENTER_NOAPI(NULL)
- assert(file);
+ HDassert(file);
if(file->cls->fapl_get)
ret_value = (file->cls->fapl_get)(file);
@@ -1197,8 +1197,8 @@ H5FDquery(const H5FD_t *f, unsigned long *flags/*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE2("Is", "*xx", f, flags);
- assert(f);
- assert(flags);
+ HDassert(f);
+ HDassert(flags);
ret_value = H5FD_query(f, flags);
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 43c8945..74aeed3 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -211,7 +211,7 @@ H5FD_core_init(void)
FUNC_ENTER_NOAPI(FAIL)
- if(H5I_VFL != H5Iget_type(H5FD_CORE_g))
+ if(H5I_VFL != H5I_get_type(H5FD_CORE_g))
H5FD_CORE_g = H5FD_register(&H5FD_core_g,sizeof(H5FD_class_t),FALSE);
/* Set return value */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 9715bc1..079554d 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -104,36 +104,8 @@ typedef struct H5FD_direct_t {
} H5FD_direct_t;
/*
- * This driver supports systems that have the lseek64() function by defining
- * some macros here so we don't have to have conditional compilations later
- * throughout the code.
- *
- * file_offset_t: The datatype for file offsets, the second argument of
- * the lseek() or lseek64() call.
- *
- * file_seek: The function which adjusts the current file position,
- * either lseek() or lseek64().
- */
-/* adding for windows NT file system support. */
-
-#ifdef H5_HAVE_LSEEK64
-# define file_offset_t off64_t
-# define file_seek lseek64
-# define file_truncate ftruncate64
-#elif defined (H5_HAVE_WIN32_API)
-# /*MSVC*/
-# define file_offset_t __int64
-# define file_seek _lseeki64
-# define file_truncate _chsize
-#else
-# define file_offset_t off_t
-# define file_seek lseek
-# define file_truncate HDftruncate
-#endif
-
-/*
* These macros check for overflow of various quantities. These macros
- * assume that file_offset_t is signed and haddr_t and size_t are unsigned.
+ * assume that HDoff_t is signed and haddr_t and size_t are unsigned.
*
* ADDR_OVERFLOW: Checks whether a file address of type `haddr_t'
* is too large to be represented by the second argument
@@ -146,13 +118,13 @@ typedef struct H5FD_direct_t {
* which can be addressed entirely by the second
* argument of the file seek function.
*/
-#define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1)
+#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \
((A) & ~(haddr_t)MAXADDR))
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR)
#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
HADDR_UNDEF==(A)+(Z) || \
- (file_offset_t)((A)+(Z))<(file_offset_t)(A))
+ (HDoff_t)((A)+(Z))<(HDoff_t)(A))
/* Prototypes */
static herr_t H5FD_direct_term(void);
@@ -454,7 +426,7 @@ H5FD_direct_fapl_copy(const void *_old_fa)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(new_fa);
+ HDassert(new_fa);
/* Copy the general information */
HDmemcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t));
@@ -500,7 +472,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check on file offsets */
- assert(sizeof(file_offset_t)>=sizeof(size_t));
+ HDassert(sizeof(HDoff_t)>=sizeof(size_t));
/* Check arguments */
if (!name || !*name)
@@ -568,26 +540,26 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
if(o_flags & O_CREAT) {
- if(write(file->fd, (void*)buf1, sizeof(int))<0) {
- if(write(file->fd, (void*)buf2, file->fa.fbsize)<0)
+ if(HDwrite(file->fd, (void*)buf1, sizeof(int))<0) {
+ if(HDwrite(file->fd, (void*)buf2, file->fa.fbsize)<0)
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O")
else
file->fa.must_align = TRUE;
} else {
file->fa.must_align = FALSE;
- file_truncate(file->fd, (file_offset_t)0);
+ HDftruncate(file->fd, (HDoff_t)0);
}
} else {
- if(read(file->fd, (void*)buf1, sizeof(int))<0) {
- if(read(file->fd, (void*)buf2, file->fa.fbsize)<0)
+ if(HDread(file->fd, (void*)buf1, sizeof(int))<0) {
+ if(HDread(file->fd, (void*)buf2, file->fa.fbsize)<0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O")
else
file->fa.must_align = TRUE;
} else {
if(o_flags & O_RDWR) {
- if(file_seek(file->fd, (file_offset_t)0, SEEK_SET) < 0)
+ if(HDlseek(file->fd, (HDoff_t)0, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, NULL, "unable to seek to proper position")
- if(write(file->fd, (void *)buf1, sizeof(int))<0)
+ if(HDwrite(file->fd, (void *)buf1, sizeof(int))<0)
file->fa.must_align = TRUE;
else
file->fa.must_align = FALSE;
@@ -911,8 +883,8 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
FUNC_ENTER_NOAPI_NOINIT
- assert(file && file->pub.cls);
- assert(buf);
+ HDassert(file && file->pub.cls);
+ HDassert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
@@ -941,7 +913,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) {
/* Seek to the correct location */
if ((addr!=file->pos || OP_READ!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
+ HDlseek(file->fd, (HDoff_t)addr, SEEK_SET)<0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/* Read the aligned data in file first, being careful of interrupted
* system calls and partial results. */
@@ -956,8 +928,8 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
HDmemset(buf, 0, size);
break;
}
- assert(nbytes>=0);
- assert((size_t)nbytes<=size);
+ HDassert(nbytes>=0);
+ HDassert((size_t)nbytes<=size);
H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t);
size -= (size_t)nbytes;
H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t);
@@ -980,7 +952,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha
/* look for the aligned position for reading the data */
HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize));
- if(file_seek(file->fd, (file_offset_t)((addr / _fbsize) * _fbsize),
+ if(HDlseek(file->fd, (HDoff_t)((addr / _fbsize) * _fbsize),
SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
@@ -1099,8 +1071,8 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
FUNC_ENTER_NOAPI_NOINIT
- assert(file && file->pub.cls);
- assert(buf);
+ HDassert(file && file->pub.cls);
+ HDassert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
@@ -1129,7 +1101,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) {
/* Seek to the correct location */
if ((addr!=file->pos || OP_WRITE!=file->op) &&
- file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
+ HDlseek(file->fd, (HDoff_t)addr, SEEK_SET)<0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
while (size>0) {
@@ -1138,8 +1110,8 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- assert(nbytes>0);
- assert((size_t)nbytes<=size);
+ HDassert(nbytes>0);
+ HDassert((size_t)nbytes<=size);
H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t);
size -= (size_t)nbytes;
H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t);
@@ -1165,7 +1137,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
/* look for the right position for reading or writing the data */
- if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0)
+ if(HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
p3 = buf;
@@ -1207,8 +1179,8 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
/* Seek to the last block, for reading */
HDassert(!((write_addr + write_size - _fbsize) % _fbsize));
- if(file_seek(file->fd,
- (file_offset_t)(write_addr + write_size - _fbsize),
+ if(HDlseek(file->fd,
+ (HDoff_t)(write_addr + write_size - _fbsize),
SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
} /* end if */
@@ -1218,7 +1190,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
if(p1) {
HDassert(!(read_size % _fbsize));
do {
- nbytes = read(file->fd, p1, read_size);
+ nbytes = HDread(file->fd, p1, read_size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
@@ -1245,7 +1217,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h
/*look for the aligned position for writing the data*/
HDassert(!(write_addr % _fbsize));
- if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0)
+ if(HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
@@ -1317,7 +1289,7 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing
FUNC_ENTER_NOAPI_NOINIT
- assert(file);
+ HDassert(file);
/* Extend the file to make sure it's large enough */
if (file->eoa!=file->eof) {
@@ -1335,7 +1307,7 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing
if(SetEndOfFile((HANDLE)filehandle)==0)
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* H5_HAVE_WIN32_API */
- if (-1==file_truncate(file->fd, (file_offset_t)file->eoa))
+ if (-1==HDftruncate(file->fd, (HDoff_t)file->eoa))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* H5_HAVE_WIN32_API */
@@ -1350,7 +1322,7 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing
/*Even though eof is equal to eoa, file is still truncated because Direct I/O
*write introduces some extra data for alignment.
*/
- if (-1==file_truncate(file->fd, (file_offset_t)file->eof))
+ if (-1==HDftruncate(file->fd, (HDoff_t)file->eof))
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
}
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index dc535a2..75c75ad 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -187,19 +187,19 @@ H5FD_family_init_interface(void)
hid_t
H5FD_family_init(void)
{
- hid_t ret_value=H5FD_FAMILY_g; /* Return value */
+ hid_t ret_value = H5FD_FAMILY_g; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- if (H5I_VFL!=H5Iget_type(H5FD_FAMILY_g))
- H5FD_FAMILY_g = H5FD_register(&H5FD_family_g,sizeof(H5FD_class_t),FALSE);
+ if(H5I_VFL != H5I_get_type(H5FD_FAMILY_g))
+ H5FD_FAMILY_g = H5FD_register(&H5FD_family_g, sizeof(H5FD_class_t), FALSE);
/* Set return value */
- ret_value=H5FD_FAMILY_g;
+ ret_value = H5FD_FAMILY_g;
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* H5FD_family_init() */
/*---------------------------------------------------------------------------
@@ -416,7 +416,7 @@ H5FD_family_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the fields of the structure */
- memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
+ HDmemcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t));
/* Deep copy the property list objects in the structure */
if(old_fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) {
@@ -1176,7 +1176,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
tempreq = SIZET_MAX;
req = MIN(size, (size_t)tempreq);
- assert(u<file->nmembs);
+ HDassert(u<file->nmembs);
if (H5FDread(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "member file read failed")
@@ -1245,7 +1245,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
tempreq = SIZET_MAX;
req = MIN(size, (size_t)tempreq);
- assert(u<file->nmembs);
+ HDassert(u<file->nmembs);
if (H5FDwrite(file->memb[u], type, dxpl_id, sub, req, buf)<0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "member file write failed")
diff --git a/src/H5FDint.c b/src/H5FDint.c
index 09af4ed..c9e9a67 100644
--- a/src/H5FDint.c
+++ b/src/H5FDint.c
@@ -298,7 +298,7 @@ H5FD_get_eof(const H5FD_t *file)
/* Dispatch to driver */
if(file->cls->get_eof) {
if(HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file)))
- HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eof request failed")
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed")
} /* end if */
else
ret_value = file->maxaddr;
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 81d050d..cb04b80 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -795,7 +795,7 @@ H5FD_log_close(H5FD_t *_file)
if(file->fa.flags & H5FD_LOG_FLAVOR)
file->flavor = (unsigned char *)H5MM_xfree(file->flavor);
if(file->logfp != stderr)
- fclose(file->logfp);
+ HDfclose(file->logfp);
} /* end if */
/* Release the file info */
diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c
index 295e3c9f..86a5d39 100644
--- a/src/H5FDmpi.c
+++ b/src/H5FDmpi.c
@@ -57,10 +57,10 @@ H5FD_mpi_get_rank(const H5FD_t *file)
FUNC_ENTER_NOAPI(FAIL)
- assert(file);
+ HDassert(file);
cls = (const H5FD_class_mpi_t *)(file->cls);
- assert(cls);
- assert(cls->get_rank); /* All MPI drivers must implement this */
+ HDassert(cls);
+ HDassert(cls->get_rank); /* All MPI drivers must implement this */
/* Dispatch to driver */
if ((ret_value=(cls->get_rank)(file))<0)
@@ -95,10 +95,10 @@ H5FD_mpi_get_size(const H5FD_t *file)
FUNC_ENTER_NOAPI(FAIL)
- assert(file);
+ HDassert(file);
cls = (const H5FD_class_mpi_t *)(file->cls);
- assert(cls);
- assert(cls->get_size); /* All MPI drivers must implement this */
+ HDassert(cls);
+ HDassert(cls->get_size); /* All MPI drivers must implement this */
/* Dispatch to driver */
if ((ret_value=(cls->get_size)(file))<0)
@@ -133,10 +133,10 @@ H5FD_mpi_get_comm(const H5FD_t *file)
FUNC_ENTER_NOAPI(MPI_COMM_NULL)
- assert(file);
+ HDassert(file);
cls = (const H5FD_class_mpi_t *)(file->cls);
- assert(cls);
- assert(cls->get_comm); /* All MPI drivers must implement this */
+ HDassert(cls);
+ HDassert(cls->get_comm); /* All MPI drivers must implement this */
/* Dispatch to driver */
if ((ret_value=(cls->get_comm)(file))==MPI_COMM_NULL)
@@ -217,7 +217,7 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(mpi_off);
+ HDassert(mpi_off);
/* Convert the HDF5 address into an MPI offset */
*mpi_off = (MPI_Offset)addr;
@@ -373,8 +373,8 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file)
FUNC_ENTER_NOAPI(FAIL)
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
/* Portably initialize MPI status variable */
HDmemset(&rcvstat,0,sizeof(MPI_Status));
@@ -427,14 +427,12 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file)
FUNC_ENTER_NOAPI(FAIL)
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
- if (file->mpi_rank != (file->mpi_size-1)) {
- if (MPI_SUCCESS != (mpi_code=MPI_Send(&msgbuf, 0/*empty msg*/, MPI_CHAR,
- file->mpi_rank+1, 0, file->comm)))
+ if(file->mpi_rank != (file->mpi_size - 1))
+ if(MPI_SUCCESS != (mpi_code=MPI_Send(&msgbuf, 0/*empty msg*/, MPI_CHAR, file->mpi_rank + 1, 0, file->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mpi_code)
- }
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 878bf82..f23a3b5 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -825,10 +825,10 @@ H5FD_mpio_fapl_free(void *_fa)
if (H5FD_mpio_Debug[(int)'t'])
fprintf(stderr, "in H5FD_mpio_fapl_free\n");
#endif
- assert(fa);
+ HDassert(fa);
/* Free the internal communicator and INFO object */
- assert(MPI_COMM_NULL!=fa->comm);
+ HDassert(MPI_COMM_NULL!=fa->comm);
H5FD_mpi_comm_info_free(&fa->comm, &fa->info);
H5MM_xfree(fa);
@@ -1167,8 +1167,8 @@ H5FD_mpio_close(H5FD_t *_file)
if (H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "Entering H5FD_mpio_close\n");
#endif
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
/* MPI_File_close sets argument to MPI_FILE_NULL */
if (MPI_SUCCESS != (mpi_code=MPI_File_close(&(file->f)/*in,out*/)))
@@ -1257,8 +1257,8 @@ H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eoa)
}
@@ -1292,8 +1292,8 @@ H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
file->eoa = addr;
@@ -1337,8 +1337,8 @@ H5FD_mpio_get_eof(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->eof)
}
@@ -1468,12 +1468,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add
if (H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "Entering H5FD_mpio_read\n" );
#endif
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
/* Make certain we have the correct type of property list */
- assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(buf);
+ HDassert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
+ HDassert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ HDassert(buf);
/* Portably initialize MPI status variable */
HDmemset(&mpi_stat,0,sizeof(MPI_Status));
@@ -1752,12 +1752,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if (H5FD_mpio_Debug[(int)'t'])
fprintf(stdout, "Entering H5FD_mpio_write\n" );
#endif
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
/* Make certain we have the correct type of property list */
- assert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
- assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
- assert(buf);
+ HDassert(H5I_GENPROP_LST==H5I_get_type(dxpl_id));
+ HDassert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER));
+ HDassert(buf);
/* Portably initialize MPI status variable */
HDmemset(&mpi_stat, 0, sizeof(MPI_Status));
@@ -2058,8 +2058,8 @@ H5FD_mpio_mpi_rank(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_rank)
} /* end H5FD_mpio_mpi_rank() */
@@ -2087,8 +2087,8 @@ H5FD_mpio_mpi_size(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->mpi_size)
} /* end H5FD_mpio_mpi_size() */
@@ -2117,8 +2117,8 @@ H5FD_mpio_communicator(const H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
+ HDassert(file);
+ HDassert(H5FD_MPIO==file->pub.driver_id);
FUNC_LEAVE_NOAPI(file->comm)
}
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 978494e..7248dff 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -263,8 +263,8 @@ H5FD_mpiposix_init(void)
FUNC_ENTER_NOAPI(FAIL)
- if (H5I_VFL != H5Iget_type(H5FD_MPIPOSIX_g))
- H5FD_MPIPOSIX_g = H5FD_register((const H5FD_class_t *)&H5FD_mpiposix_g,sizeof(H5FD_class_mpi_t),FALSE);
+ if(H5I_VFL != H5I_get_type(H5FD_MPIPOSIX_g))
+ H5FD_MPIPOSIX_g = H5FD_register((const H5FD_class_t *)&H5FD_mpiposix_g, sizeof(H5FD_class_mpi_t), FALSE);
/* Set return value */
ret_value = H5FD_MPIPOSIX_g;
diff --git a/src/H5FO.c b/src/H5FO.c
index ace66ec..a6c47cb 100644
--- a/src/H5FO.c
+++ b/src/H5FO.c
@@ -78,8 +78,8 @@ H5FO_create(const H5F_t *f)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- assert(f);
- assert(f->shared);
+ HDassert(f);
+ HDassert(f->shared);
/* Create container used to store open object info */
if((f->shared->open_objs = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL)
@@ -166,11 +166,11 @@ H5FO_insert(const H5F_t *f, haddr_t addr, void *obj, hbool_t delete_flag)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- assert(f);
- assert(f->shared);
- assert(f->shared->open_objs);
- assert(H5F_addr_defined(addr));
- assert(obj);
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->open_objs);
+ HDassert(H5F_addr_defined(addr));
+ HDassert(obj);
/* Allocate new opened object information structure */
if((open_obj=H5FL_MALLOC(H5FO_open_obj_t))==NULL)
@@ -269,10 +269,10 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted)
FUNC_ENTER_NOAPI_NOERR
/* Sanity check */
- assert(f);
- assert(f->shared);
- assert(f->shared->open_objs);
- assert(H5F_addr_defined(addr));
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->open_objs);
+ HDassert(H5F_addr_defined(addr));
/* Get the object node from the container */
if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr)))
@@ -352,9 +352,9 @@ H5FO_dest(const H5F_t *f)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- assert(f);
- assert(f->shared);
- assert(f->shared->open_objs);
+ HDassert(f);
+ HDassert(f->shared);
+ HDassert(f->shared->open_objs);
/* Check if the object info set is empty */
if(H5SL_count(f->shared->open_objs)!=0)
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 07d29f2..4d3ca34 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -101,7 +101,7 @@ H5F_mpi_get_rank(const H5F_t *f)
FUNC_ENTER_NOAPI(FAIL)
- assert(f && f->shared);
+ HDassert(f && f->shared);
/* Dispatch to driver */
if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0)
@@ -135,7 +135,7 @@ H5F_mpi_get_comm(const H5F_t *f)
FUNC_ENTER_NOAPI(MPI_COMM_NULL)
- assert(f && f->shared);
+ HDassert(f && f->shared);
/* Dispatch to driver */
if ((ret_value=H5FD_mpi_get_comm(f->shared->lf))==MPI_COMM_NULL)
@@ -169,7 +169,7 @@ H5F_mpi_get_size(const H5F_t *f)
FUNC_ENTER_NOAPI(FAIL)
- assert(f && f->shared);
+ HDassert(f && f->shared);
/* Dispatch to driver */
if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0)
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 334879c..beb7e88 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -303,7 +303,6 @@ H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing);
H5_DLL herr_t H5F_close_mounts(H5F_t *f);
H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key);
H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
-H5_DLL herr_t H5F_flush_mounts(H5F_t *f, hid_t dxpl_id);
/* Superblock related routines */
H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index e1e1b05..afad362 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -616,6 +616,7 @@ H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl,
H5_DLL hbool_t H5F_is_mount(const H5F_t *file);
H5_DLL hbool_t H5F_has_mount(const H5F_t *file);
H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/);
+H5_DLL herr_t H5F_flush_mounts(H5F_t *f, hid_t dxpl_id);
/* Functions that operate on blocks of bytes wrt super block */
H5_DLL herr_t H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 72da498..1d2644b 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -135,7 +135,7 @@ H5G__component(const char *name, size_t *size_p)
{
FUNC_ENTER_PACKAGE_NOERR
- assert(name);
+ HDassert(name);
while ('/' == *name)
name++;
@@ -236,13 +236,13 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r)
/* Get component of each name */
fullpath=H5RS_get_str(fullpath_r);
- assert(fullpath);
+ HDassert(fullpath);
fullpath=H5G__component(fullpath,&nchars1);
- assert(fullpath);
+ HDassert(fullpath);
prefix=H5RS_get_str(prefix_r);
- assert(prefix);
+ HDassert(prefix);
prefix=H5G__component(prefix,&nchars2);
- assert(prefix);
+ HDassert(prefix);
/* Check if we have a real string for each component */
while(*fullpath && *prefix) {
@@ -256,9 +256,9 @@ H5G_common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r)
/* Get next component of each name */
fullpath=H5G__component(fullpath,&nchars1);
- assert(fullpath);
+ HDassert(fullpath);
prefix=H5G__component(prefix,&nchars2);
- assert(prefix);
+ HDassert(prefix);
} /* end if */
else
HGOTO_DONE(FALSE)
diff --git a/src/H5HG.c b/src/H5HG.c
index 7a90475..d55eaab 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -191,7 +191,7 @@ HDmemset(heap->chunk, 0, size);
/* The freespace object */
heap->obj[0].size = size - H5HG_SIZEOF_HDR(f);
- assert(H5HG_ISALIGNED(heap->obj[0].size));
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
heap->obj[0].nrefs = 0;
heap->obj[0].begin = p;
UINT16ENCODE(p, 0); /*object ID*/
@@ -372,7 +372,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
UINT16ENCODE(p, 0); /*nrefs*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_ENCODE_LENGTH (f, p, heap->obj[0].size);
- assert(H5HG_ISALIGNED(heap->obj[0].size));
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
} /* end else-if */
else {
/*
@@ -381,7 +381,7 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr)
*/
heap->obj[0].size -= need;
heap->obj[0].begin += need;
- assert(H5HG_ISALIGNED(heap->obj[0].size));
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
}
/* Mark the heap as dirty */
@@ -475,7 +475,7 @@ HDmemset(new_chunk + heap->size, 0, need);
UINT16ENCODE(p, 0); /*nrefs*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_ENCODE_LENGTH(f, p, heap->obj[0].size);
- assert(H5HG_ISALIGNED(heap->obj[0].size));
+ HDassert(H5HG_ISALIGNED(heap->obj[0].size));
/* Resize the heap in the cache */
if(H5AC_resize_entry(heap, heap->size) < 0)
diff --git a/src/H5HP.c b/src/H5HP.c
index 335fde2..f6fb20c 100644
--- a/src/H5HP.c
+++ b/src/H5HP.c
@@ -342,7 +342,7 @@ H5HP_create(H5HP_type_t heap_type)
FUNC_ENTER_NOAPI(NULL)
/* Check args */
- assert(heap_type==H5HP_MIN_HEAP || heap_type==H5HP_MAX_HEAP);
+ HDassert(heap_type==H5HP_MIN_HEAP || heap_type==H5HP_MAX_HEAP);
/* Allocate ref-counted string structure */
if((new_heap=H5FL_MALLOC(H5HP_t))==NULL)
@@ -416,15 +416,15 @@ H5HP_count(const H5HP_t *heap)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(heap);
+ HDassert(heap);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Return the number of objects in the heap */
H5_CHECK_OVERFLOW(heap->nobjs,size_t,ssize_t);
@@ -463,16 +463,16 @@ H5HP_insert(H5HP_t *heap, int val, void *obj)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(heap);
- assert(obj);
+ HDassert(heap);
+ HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Increment number of objects in heap */
heap->nobjs++;
@@ -507,11 +507,11 @@ done:
/* Check internal consistency */
/* (Post-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_insert() */
@@ -542,16 +542,16 @@ H5HP_top(const H5HP_t *heap, int *val)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(heap);
- assert(val);
+ HDassert(heap);
+ HDassert(val);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Get value of the top object in the heap */
*val=heap->heap[1].val;
@@ -589,24 +589,24 @@ H5HP_remove(H5HP_t *heap, int *val, void **obj)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(heap);
- assert(val);
- assert(obj);
+ HDassert(heap);
+ HDassert(val);
+ HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Check if there are any objects on the heap to remove */
if(heap->nobjs==0)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap is empty");
/* Get the information for the top object on the heap */
- assert(heap->heap[1].obj->heap_loc==1);
+ HDassert(heap->heap[1].obj->heap_loc==1);
*val=heap->heap[1].val;
*obj=heap->heap[1].obj;
@@ -634,11 +634,11 @@ done:
/* Check internal consistency */
/* (Post-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_remove() */
@@ -675,20 +675,20 @@ H5HP_change(H5HP_t *heap, int val, void *_obj)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(heap);
- assert(obj);
+ HDassert(heap);
+ HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Get the location of the object in the heap */
obj_loc=obj->heap_loc;
- assert(obj_loc>0 && obj_loc<=heap->nobjs);
+ HDassert(obj_loc>0 && obj_loc<=heap->nobjs);
/* Change the heap object's priority */
old_val=heap->heap[obj_loc].val;
@@ -720,11 +720,11 @@ done:
/* Check internal consistency */
/* (Post-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_change() */
@@ -760,20 +760,20 @@ H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(heap);
- assert(obj);
+ HDassert(heap);
+ HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Get the location of the object in the heap */
obj_loc = obj->heap_loc;
- assert(obj_loc > 0 && obj_loc <= heap->nobjs);
+ HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);
/* Change the heap object's priority */
heap->heap[obj_loc].val += (int)amt;
@@ -792,11 +792,11 @@ done:
/* Check internal consistency */
/* (Post-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_incr() */
@@ -832,20 +832,20 @@ H5HP_decr(H5HP_t *heap, unsigned amt, void *_obj)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(heap);
- assert(obj);
+ HDassert(heap);
+ HDassert(obj);
/* Check internal consistency */
/* (Pre-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
/* Get the location of the object in the heap */
obj_loc=obj->heap_loc;
- assert(obj_loc>0 && obj_loc<=heap->nobjs);
+ HDassert(obj_loc>0 && obj_loc<=heap->nobjs);
/* Change the heap object's priority */
heap->heap[obj_loc].val-=amt;
@@ -864,11 +864,11 @@ done:
/* Check internal consistency */
/* (Post-condition) */
- assert(heap->nobjs<heap->nalloc);
- assert(heap->heap);
- assert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
+ HDassert(heap->nobjs<heap->nalloc);
+ HDassert(heap->heap);
+ HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
(heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
- assert(heap->heap[0].obj==NULL);
+ HDassert(heap->heap[0].obj==NULL);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_decr() */
diff --git a/src/H5MM.c b/src/H5MM.c
index 23ef9f9..caeac37 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -59,7 +59,7 @@ H5MM_malloc(size_t size)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(size);
+ HDassert(size);
FUNC_LEAVE_NOAPI(HDmalloc(size));
} /* end H5MM_malloc() */
@@ -92,7 +92,7 @@ H5MM_calloc(size_t size)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(size);
+ HDassert(size);
FUNC_LEAVE_NOAPI(HDcalloc(1,size));
} /* end H5MM_calloc() */
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index db9066e..487b6f4 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -118,9 +118,9 @@ H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh,
/* Number of slots */
UINT16DECODE(p, mesg->nalloc);
- assert(mesg->nalloc>0);
+ HDassert(mesg->nalloc>0);
UINT16DECODE(p, mesg->nused);
- assert(mesg->nused <= mesg->nalloc);
+ HDassert(mesg->nused <= mesg->nalloc);
/* Heap address */
H5F_addr_decode(f, &p, &(mesg->heap_addr));
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 6326fd9..4c43873 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -127,7 +127,7 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
/* Layout class */
mesg->type = (H5D_layout_t)*p++;
- assert(H5D_CONTIGUOUS == mesg->type || H5D_CHUNKED == mesg->type || H5D_COMPACT == mesg->type);
+ HDassert(H5D_CONTIGUOUS == mesg->type || H5D_CHUNKED == mesg->type || H5D_COMPACT == mesg->type);
/* Reserved bytes */
p += 5;
diff --git a/src/H5Oname.c b/src/H5Oname.c
index c1cb8c8..5ca05e1 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -228,8 +228,8 @@ H5O_name_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void *
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(mesg);
+ HDassert(f);
+ HDassert(mesg);
ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0;
@@ -294,11 +294,11 @@ H5O_name_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(mesg);
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(mesg);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
"Name:",
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index d05c7c2..f7c77bc 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -149,9 +149,9 @@ H5O_stab_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(p);
- assert(stab);
+ HDassert(f);
+ HDassert(p);
+ HDassert(stab);
/* encode */
H5F_addr_encode(f, &p, stab->btree_addr);
@@ -433,11 +433,11 @@ H5O_stab_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(f);
- assert(stab);
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(stab);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"B-tree address:", stab->btree_addr);
diff --git a/src/H5PL.c b/src/H5PL.c
index 07e90af..7a8a296 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -415,7 +415,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
/* Get info for directory entry */
if(HDstat(pathname, &my_stat) == -1)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file: %s", strerror(errno))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file: %s", HDstrerror(errno))
/* If it is a directory, skip it */
if(S_ISDIR(my_stat.st_mode))
@@ -437,7 +437,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
done:
if(dirp)
if(HDclosedir(dirp) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", strerror(errno))
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno))
if(pathname)
pathname = (char *)H5MM_xfree(pathname);
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index b3090ab..66c1757 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1669,13 +1669,6 @@ done:
* Programmer: Kent Yang
* Tuesday, April 1, 2003
*
- * Modifications:
- *
- * Nat Furrer and James Laird
- * June 30, 2004
- * Now ensures that SZIP encoding is enabled
- * SZIP defaults to k13 compression
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1685,22 +1678,22 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block)
H5P_genplist_t *plist; /* Property list pointer */
unsigned cd_values[2]; /* Filter parameters */
unsigned int config_flags;
- herr_t ret_value=SUCCEED; /* return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iIuIu", plist_id, options_mask, pixels_per_block);
- if(H5Zget_filter_info(H5Z_FILTER_SZIP, &config_flags) < 0)
+ if(H5Z_get_filter_info(H5Z_FILTER_SZIP, &config_flags) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't get filter info")
- if(! (config_flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED))
+ if(!(config_flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED))
HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.")
/* Check arguments */
- if ((pixels_per_block%2)==1)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even")
- if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large")
+ if((pixels_per_block % 2) == 1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even")
+ if(pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index befec84..a416b00 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -2289,7 +2289,7 @@ H5P_file_image_info_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UN
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed")
} /* end if */
else
- free(info.buffer);
+ HDfree(info.buffer);
} /* end if */
/* Free udata if it exists */
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 88c3247..13cc3c1 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -2681,7 +2681,7 @@ done:
PURPOSE
Internal routine to query the existance of a property in a property list.
USAGE
- herr_t H5P_exist_plist(plist, name)
+ htri_t H5P_exist_plist(plist, name)
const H5P_genplist_t *plist; IN: Property list to check
const char *name; IN: Name of property to check for
RETURNS
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index f80e4e7..2166020 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -1453,7 +1453,7 @@ H5P_get_filter(const H5Z_filter_info_t *filter, unsigned int *flags/*out*/,
/* Filter configuration (assume filter ID has already been checked) */
if(filter_config)
- H5Zget_filter_info(filter->id, filter_config);
+ H5Z_get_filter_info(filter->id, filter_config);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_get_filter() */
diff --git a/src/H5S.c b/src/H5S.c
index 7ef1da4..2eebba4 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -324,7 +324,7 @@ H5S_extent_release(H5S_extent_t *extent)
FUNC_ENTER_NOAPI(FAIL)
- assert(extent);
+ HDassert(extent);
/* Release extent */
if(extent->type == H5S_SIMPLE) {
@@ -725,7 +725,7 @@ H5S_get_npoints_max(const H5S_t *ds)
FUNC_ENTER_NOAPI(0)
/* check args */
- assert(ds);
+ HDassert(ds);
switch (H5S_GET_EXTENT_TYPE(ds)) {
case H5S_NULL:
@@ -755,7 +755,7 @@ H5S_get_npoints_max(const H5S_t *ds)
case H5S_NO_CLASS:
default:
- assert("unknown dataspace class" && 0);
+ HDassert("unknown dataspace class" && 0);
HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)")
}
@@ -1434,7 +1434,7 @@ H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
FUNC_ENTER_NOAPI(NULL)
/* Check arguments */
- assert(rank <=H5S_MAX_RANK);
+ HDassert(rank <=H5S_MAX_RANK);
/* Create the space and set the extent */
if(NULL==(ret_value=H5S_create(H5S_SIMPLE)))
@@ -1712,7 +1712,7 @@ H5S_get_simple_extent_type(const H5S_t *space)
FUNC_ENTER_NOAPI(H5S_NO_CLASS)
- assert(space);
+ HDassert(space);
ret_value=H5S_GET_EXTENT_TYPE(space);
diff --git a/src/H5SL.c b/src/H5SL.c
index 7581858..5c46fd4 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -754,7 +754,7 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -940,7 +940,7 @@ H5SL_count(H5SL_t *slist)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -978,8 +978,8 @@ H5SL_insert(H5SL_t *slist, void *item, const void *key)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(slist);
- assert(key);
+ HDassert(slist);
+ HDassert(key);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1025,8 +1025,8 @@ H5SL_add(H5SL_t *slist, void *item, const void *key)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(slist);
- assert(key);
+ HDassert(slist);
+ HDassert(key);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1252,8 +1252,8 @@ H5SL_search(H5SL_t *slist, const void *key)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
- assert(key);
+ HDassert(slist);
+ HDassert(key);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1341,8 +1341,8 @@ H5SL_less(H5SL_t *slist, const void *key)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
- assert(key);
+ HDassert(slist);
+ HDassert(key);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1535,8 +1535,8 @@ H5SL_find(H5SL_t *slist, const void *key)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
- assert(key);
+ HDassert(slist);
+ HDassert(key);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1806,7 +1806,7 @@ H5SL_first(H5SL_t *slist)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1840,7 +1840,7 @@ H5SL_next(H5SL_node_t *slist_node)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist_node);
+ HDassert(slist_node);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1874,7 +1874,7 @@ H5SL_prev(H5SL_node_t *slist_node)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist_node);
+ HDassert(slist_node);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1909,7 +1909,7 @@ H5SL_last(H5SL_t *slist)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -1943,7 +1943,7 @@ H5SL_item(H5SL_node_t *slist_node)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist_node);
+ HDassert(slist_node);
/* Check internal consistency */
/* (Pre-condition) */
@@ -2040,7 +2040,7 @@ H5SL_release(H5SL_t *slist)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -2086,7 +2086,7 @@ H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -2132,7 +2132,7 @@ H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
@@ -2169,7 +2169,7 @@ H5SL_close(H5SL_t *slist)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(slist);
+ HDassert(slist);
/* Check internal consistency */
/* (Pre-condition) */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 8d56c80..19d1efc 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -118,8 +118,8 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (space && H5S_SEL_ALL==H5S_GET_SELECT_TYPE(space));
- assert (iter);
+ HDassert (space && H5S_SEL_ALL==H5S_GET_SELECT_TYPE(space));
+ HDassert (iter);
/* Initialize the number of elements to iterate over */
iter->elmt_left=H5S_GET_SELECT_NPOINTS(space);
@@ -158,8 +158,8 @@ H5S_all_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert (iter);
- assert (coords);
+ HDassert (iter);
+ HDassert (coords);
/* Calculate the coordinates for the current iterator offset */
if(H5V_array_calc(iter->u.all.elmt_offset,iter->rank,iter->dims,coords)<0)
@@ -193,9 +193,9 @@ H5S_all_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
- assert (start);
- assert (end);
+ HDassert (iter);
+ HDassert (start);
+ HDassert (end);
for(u=0; u<iter->rank; u++) {
/* Set the start of the 'all' block */
@@ -231,7 +231,7 @@ H5S_all_iter_nelmts (const H5S_sel_iter_t *iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
+ HDassert (iter);
FUNC_LEAVE_NOAPI(iter->elmt_left)
} /* H5S_all_iter_nelmts() */
@@ -260,7 +260,7 @@ H5S_all_iter_has_next_block (const H5S_sel_iter_t UNUSED *iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
+ HDassert (iter);
FUNC_LEAVE_NOAPI(FALSE)
} /* H5S_all_iter_has_next_block() */
@@ -290,8 +290,8 @@ H5S_all_iter_next(H5S_sel_iter_t *iter, size_t nelem)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
- assert (nelem>0);
+ HDassert (iter);
+ HDassert (nelem>0);
/* Increment the iterator */
iter->u.all.elmt_offset+=nelem;
@@ -324,7 +324,7 @@ H5S_all_iter_next_block(H5S_sel_iter_t UNUSED *iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
+ HDassert (iter);
FUNC_LEAVE_NOAPI(FAIL)
} /* H5S_all_iter_next_block() */
@@ -353,7 +353,7 @@ H5S_all_iter_release (H5S_sel_iter_t UNUSED * iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert (iter);
+ HDassert (iter);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_all_iter_release() */
@@ -450,7 +450,7 @@ H5S_all_is_valid (const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
} /* end H5S_all_is_valid() */
@@ -480,7 +480,7 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
/* Basic number of bytes required to serialize point selection:
* <type (4 bytes)> + <version (4 bytes)> + <padding (4 bytes)> +
@@ -514,7 +514,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
/* Store the preamble information */
UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */
@@ -671,7 +671,7 @@ H5S_all_is_contiguous(const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
} /* H5S_all_is_contiguous() */
@@ -700,7 +700,7 @@ H5S_all_is_single(const H5S_t UNUSED *space)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
} /* H5S_all_is_single() */
@@ -731,7 +731,7 @@ H5S_all_is_regular(const H5S_t UNUSED *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
+ HDassert(space);
FUNC_LEAVE_NOAPI(TRUE)
} /* H5S_all_is_regular() */
@@ -955,14 +955,14 @@ H5S_all_get_seq_list(const H5S_t UNUSED *space, unsigned UNUSED flags, H5S_sel_i
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq>0);
+ HDassert(maxelem>0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Determine the actual number of elements to use */
H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 9a993a5..1eb0cbc 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -112,8 +112,8 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(dst);
- assert(src);
+ HDassert(dst);
+ HDassert(src);
/* Copy regular fields */
dst->select=src->select;
@@ -152,7 +152,7 @@ H5S_select_release(H5S_t *ds)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(ds);
+ HDassert(ds);
/* Call the selection type's release function */
ret_value=(*ds->select.type->release)(ds);
@@ -224,7 +224,7 @@ H5S_select_serial_size(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
/* Call the selection type's serial_size function */
ret_value=(*space->select.type->serial_size)(space);
@@ -262,8 +262,8 @@ H5S_select_serialize(const H5S_t *space, uint8_t *buf)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
- assert(buf);
+ HDassert(space);
+ HDassert(buf);
/* Call the selection type's serialize function */
ret_value=(*space->select.type->serialize)(space,buf);
@@ -413,7 +413,7 @@ H5S_select_valid(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(space);
+ HDassert(space);
ret_value = (*space->select.type->is_valid)(space);
@@ -452,7 +452,7 @@ H5S_select_deserialize (H5S_t *space, const uint8_t *buf)
FUNC_ENTER_NOAPI(FAIL)
- assert(space);
+ HDassert(space);
tbuf=buf;
UINT32DECODE(tbuf, sel_type);
@@ -571,9 +571,9 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
- assert(start);
- assert(end);
+ HDassert(space);
+ HDassert(start);
+ HDassert(end);
ret_value = (*space->select.type->bounds)(space,start,end);
@@ -650,7 +650,7 @@ H5S_select_is_contiguous(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
+ HDassert(space);
ret_value = (*space->select.type->is_contiguous)(space);
@@ -687,7 +687,7 @@ H5S_select_is_single(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
+ HDassert(space);
ret_value = (*space->select.type->is_single)(space);
@@ -724,7 +724,7 @@ H5S_select_is_regular(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
+ HDassert(space);
ret_value = (*space->select.type->is_regular)(space);
@@ -929,8 +929,8 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hsize_t *coords)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(sel_iter);
- assert(coords);
+ HDassert(sel_iter);
+ HDassert(coords);
/* Call iter_coords routine for selection type */
ret_value = (*sel_iter->type->iter_coords)(sel_iter,coords);
@@ -971,9 +971,9 @@ H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
/* Check args */
- assert(iter);
- assert(start);
- assert(end);
+ HDassert(iter);
+ HDassert(start);
+ HDassert(end);
/* Call iter_block routine for selection type */
ret_value = (*iter->type->iter_block)(iter,start,end);
@@ -1011,7 +1011,7 @@ H5S_select_iter_nelmts (const H5S_sel_iter_t *sel_iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(sel_iter);
+ HDassert(sel_iter);
/* Call iter_nelmts routine for selection type */
ret_value = (*sel_iter->type->iter_nelmts)(sel_iter);
@@ -1050,7 +1050,7 @@ H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter)
FUNC_ENTER_NOAPI_NOINIT_NOINIT_NOERR
/* Check args */
- assert(iter);
+ HDassert(iter);
/* Call iter_has_next_block routine for selection type */
ret_value = (*iter->type->iter_has_next_block)(iter);
@@ -1090,8 +1090,8 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(iter);
- assert(nelem>0);
+ HDassert(iter);
+ HDassert(nelem>0);
/* Call iter_next routine for selection type */
ret_value = (*iter->type->iter_next)(iter,nelem);
@@ -1135,7 +1135,7 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(iter);
+ HDassert(iter);
/* Call iter_next_block routine for selection type */
ret_value = (*iter->type->iter_next_block)(iter);
@@ -1173,7 +1173,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(sel_iter);
+ HDassert(sel_iter);
/* Call selection type-specific release routine */
ret_value = (*sel_iter->type->iter_release)(sel_iter);
@@ -1387,7 +1387,7 @@ H5S_get_select_type(const H5S_t *space)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- assert(space);
+ HDassert(space);
/* Set return value */
ret_value=H5S_GET_SELECT_TYPE(space);
diff --git a/src/H5T.c b/src/H5T.c
index 65460ed..080af8e 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1349,7 +1349,7 @@ H5T_init_interface(void)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)")
/* ========== Datatype Creation Property Class Initialization ============*/
- assert(H5P_CLS_DATATYPE_CREATE_g!=-1);
+ HDassert(H5P_CLS_DATATYPE_CREATE_g!=-1);
/* Get the pointer to group creation class */
if(NULL == (crt_pclass = (H5P_genclass_t *)H5I_object(H5P_CLS_DATATYPE_CREATE_g)))
@@ -1914,7 +1914,7 @@ H5T_get_class(const H5T_t *dt, htri_t internal)
FUNC_ENTER_NOAPI(H5T_NO_CLASS)
- assert(dt);
+ HDassert(dt);
/* Externally, a VL string is a string; internally, a VL string is a VL. */
if(internal) {
@@ -2271,7 +2271,7 @@ H5T_get_super(const H5T_t *dt)
FUNC_ENTER_NOAPI(NULL)
- assert(dt);
+ HDassert(dt);
if (!dt->shared->parent)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type");
@@ -2319,11 +2319,11 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(src);
- assert(dst);
- assert(func);
- assert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers);
- assert(name && *name);
+ HDassert(src);
+ HDassert(dst);
+ HDassert(func);
+ HDassert(H5T_PERS_HARD==pers || H5T_PERS_SOFT==pers);
+ HDassert(name && *name);
if(H5T_PERS_HARD == pers) {
/* Only bother to register the path if it's not a no-op path (for this machine) */
@@ -2369,7 +2369,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
*/
for (i=1; i<H5T_g.npaths; i++) {
old_path = H5T_g.path[i];
- assert(old_path);
+ HDassert(old_path);
/* Does the new soft conversion function apply to this path? */
if (old_path->is_hard ||
@@ -3435,7 +3435,7 @@ H5T_lock (H5T_t *dt, hbool_t immutable)
FUNC_ENTER_NOAPI(FAIL)
- assert (dt);
+ HDassert (dt);
switch (dt->shared->state) {
case H5T_STATE_TRANSIENT:
@@ -3709,10 +3709,10 @@ H5T_set_size(H5T_t *dt, size_t size)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(dt);
- assert(size!=0);
- assert(H5T_REFERENCE!=dt->shared->type);
- assert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
+ HDassert(dt);
+ HDassert(size!=0);
+ HDassert(H5T_REFERENCE!=dt->shared->type);
+ HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
if (dt->shared->parent) {
if (H5T_set_size(dt->shared->parent, size)<0)
@@ -3841,12 +3841,12 @@ H5T_set_size(H5T_t *dt, size_t size)
case H5T_VLEN:
case H5T_ARRAY:
case H5T_REFERENCE:
- assert("can't happen" && 0);
+ HDassert("can't happen" && 0);
case H5T_NO_CLASS:
case H5T_NCLASSES:
- assert("invalid type" && 0);
+ HDassert("invalid type" && 0);
default:
- assert("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
}
/* Commit (if we didn't convert this type to a VL string) */
@@ -3893,7 +3893,7 @@ H5T_get_size(const H5T_t *dt)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(dt);
+ HDassert(dt);
FUNC_LEAVE_NOAPI(dt->shared->size)
}
@@ -3999,9 +3999,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
for (u=0; u<dt1->shared->u.compnd.nmembs-1; u++) {
- assert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name,
+ HDassert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name,
dt1->shared->u.compnd.memb[idx1[u + 1]].name));
- assert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name,
+ HDassert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name,
dt2->shared->u.compnd.memb[idx2[u + 1]].name));
}
#endif
@@ -4079,9 +4079,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
#ifdef H5T_DEBUG
/* I don't quite trust the code above yet :-) --RPM */
for (u=0; u<dt1->shared->u.enumer.nmembs-1; u++) {
- assert(HDstrcmp(dt1->shared->u.enumer.name[idx1[u]],
+ HDassert(HDstrcmp(dt1->shared->u.enumer.name[idx1[u]],
dt1->shared->u.enumer.name[idx1[u+1]]));
- assert(HDstrcmp(dt2->shared->u.enumer.name[idx2[u]],
+ HDassert(HDstrcmp(dt2->shared->u.enumer.name[idx2[u]],
dt2->shared->u.enumer.name[idx2[u+1]]));
}
#endif
@@ -4137,10 +4137,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
break;
case H5T_VLEN:
- assert(dt1->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt1->shared->u.vlen.type<H5T_VLEN_MAXTYPE);
- assert(dt2->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt2->shared->u.vlen.type<H5T_VLEN_MAXTYPE);
- assert(dt1->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt1->shared->u.vlen.loc<H5T_LOC_MAXLOC);
- assert(dt2->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt2->shared->u.vlen.loc<H5T_LOC_MAXLOC);
+ HDassert(dt1->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt1->shared->u.vlen.type<H5T_VLEN_MAXTYPE);
+ HDassert(dt2->shared->u.vlen.type>H5T_VLEN_BADTYPE && dt2->shared->u.vlen.type<H5T_VLEN_MAXTYPE);
+ HDassert(dt1->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt1->shared->u.vlen.loc<H5T_LOC_MAXLOC);
+ HDassert(dt2->shared->u.vlen.loc>=H5T_LOC_BADLOC && dt2->shared->u.vlen.loc<H5T_LOC_MAXLOC);
/* Arbitrarily sort sequence VL datatypes before string VL datatypes */
if (dt1->shared->u.vlen.type==H5T_VLEN_SEQUENCE &&
@@ -4300,14 +4300,14 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
case H5R_BADTYPE:
case H5R_MAXTYPE:
- assert("invalid type" && 0);
+ HDassert("invalid type" && 0);
default:
- assert("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
}
break;
default:
- assert("not implemented yet" && 0);
+ HDassert("not implemented yet" && 0);
}
break;
} /* end switch */
@@ -4633,7 +4633,7 @@ H5T_path_noop(const H5T_path_t *p)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(p);
+ HDassert(p);
FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0==H5T_cmp(p->src, p->dst, FALSE)))
} /* end H5T_path_noop() */
@@ -4702,7 +4702,7 @@ H5T_path_bkg(const H5T_path_t *p)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(p);
+ HDassert(p);
FUNC_LEAVE_NOAPI(p->cdata.need_bkg)
} /* end H5T_path_bkg() */
@@ -4918,7 +4918,7 @@ H5T_is_immutable(const H5T_t *dt)
FUNC_ENTER_NOAPI(FAIL)
- assert(dt);
+ HDassert(dt);
if(dt->shared->state == H5T_STATE_IMMUTABLE)
ret_value = TRUE;
@@ -4951,7 +4951,7 @@ H5T_is_named(const H5T_t *dt)
FUNC_ENTER_NOAPI(FAIL)
- assert(dt);
+ HDassert(dt);
if(dt->shared->state == H5T_STATE_OPEN || dt->shared->state == H5T_STATE_NAMED)
ret_value = TRUE;
@@ -4988,7 +4988,7 @@ H5T_get_ref_type(const H5T_t *dt)
FUNC_ENTER_NOAPI(H5R_BADTYPE)
- assert(dt);
+ HDassert(dt);
if(dt->shared->type==H5T_REFERENCE)
ret_value=dt->shared->u.atomic.u.r.rtype;
@@ -5022,7 +5022,7 @@ H5T_is_sensible(const H5T_t *dt)
FUNC_ENTER_NOAPI(FAIL)
- assert(dt);
+ HDassert(dt);
switch(dt->shared->type) {
case H5T_COMPOUND:
@@ -5087,8 +5087,8 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
FUNC_ENTER_NOAPI(FAIL)
- assert(dt);
- assert(loc>=H5T_LOC_BADLOC && loc<H5T_LOC_MAXLOC);
+ HDassert(dt);
+ HDassert(loc>=H5T_LOC_BADLOC && loc<H5T_LOC_MAXLOC);
/* Datatypes can't change in size if the force_conv flag is not set */
if(dt->shared->force_conv) {
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index b732817..9ff0f00 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -189,7 +189,7 @@
* to the destination. SLU - 2005/06/29
*/
#define H5T_CONV_Xx_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*(S) > (DT)(D_MAX)) { \
+ if (*(S) > (ST)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -198,7 +198,7 @@
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*(S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (ST)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -211,16 +211,16 @@
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Xx_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*(S) > (DT)(D_MAX)) { \
+ if (*(S) > (ST)(D_MAX)) { \
*(D) = (DT)(D_MAX); \
- } else if (*(S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (ST)(D_MIN)) { \
*(D) = (DT)(D_MIN); \
} else \
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ux_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*(S) > (DT)(D_MAX)) { \
+ if (*(S) > (ST)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -233,7 +233,7 @@
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ux_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (*(S) > (DT)(D_MAX)) { \
+ if (*(S) > (ST)(D_MAX)) { \
*(D) = (DT)(D_MAX); \
} else \
*(D) = (DT)(*(S)); \
@@ -241,7 +241,7 @@
#define H5T_CONV_sS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
- H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_sU_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
@@ -266,7 +266,7 @@
#define H5T_CONV_sU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
- H5T_CONV(H5T_CONV_sU, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_sU, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_uS_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
@@ -283,7 +283,7 @@
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_uS_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if (sizeof(ST)==sizeof(DT) && *(S) > (D_MAX)) { \
+ if (sizeof(ST)==sizeof(DT) && *(S) > (DT)(D_MAX)) { \
*(D) = (D_MAX); \
} else \
*(D) = (DT)(*(S)); \
@@ -291,17 +291,17 @@
#define H5T_CONV_uS(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
- H5T_CONV(H5T_CONV_uS, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_uS, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_uU(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
- H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_Ss(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
- H5T_CONV(H5T_CONV_Xx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Xx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_Su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
@@ -314,7 +314,7 @@
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (sizeof(ST)>sizeof(DT) && *(S) > (DT)(D_MAX)) { \
+ } else if (sizeof(ST)>sizeof(DT) && *(S) > (ST)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -329,7 +329,7 @@
#define H5T_CONV_Su_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
if(*(S) < 0) \
*(D) = 0; \
- else if (sizeof(ST)>sizeof(DT) && *(S) > (DT)(D_MAX)) \
+ else if (sizeof(ST)>sizeof(DT) && *(S) > (ST)(D_MAX)) \
*(D) = (DT)(D_MAX); \
else \
*(D) = (DT)(*(S)); \
@@ -337,17 +337,17 @@
#define H5T_CONV_Su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
- H5T_CONV(H5T_CONV_Su, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Su, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_Us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
- H5T_CONV(H5T_CONV_Ux, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Ux, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_Uu(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
- H5T_CONV(H5T_CONV_Ux, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Ux, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_su_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
@@ -374,12 +374,12 @@
#define H5T_CONV_su(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)==sizeof(DT)); \
- H5T_CONV(H5T_CONV_su, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_su, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_us_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if (*(S) > (DT)(D_MAX)) { \
+ if (*(S) > (ST)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -393,7 +393,7 @@
}
#define H5T_CONV_us_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
/* Assumes memory format of unsigned & signed integers is same */ \
- if(*(S) > (DT)(D_MAX)) \
+ if(*(S) > (ST)(D_MAX)) \
*(D) = (DT)(D_MAX); \
else \
*(D) = (DT)(*(S)); \
@@ -401,19 +401,19 @@
#define H5T_CONV_us(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)==sizeof(DT)); \
- H5T_CONV(H5T_CONV_us, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_us, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_CONV_fF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)<=sizeof(DT)); \
- H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
/* Same as H5T_CONV_Xx_CORE, except that instead of using D_MAX and D_MIN
* when an overflow occurs, use the 'float' infinity values.
*/
#define H5T_CONV_Ff_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if(*(S) > (DT)(D_MAX)) { \
+ if(*(S) > (ST)(D_MAX)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -422,7 +422,7 @@
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*(S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (ST)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -435,9 +435,9 @@
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Ff_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if(*(S) > (DT)(D_MAX)) \
+ if(*(S) > (ST)(D_MAX)) \
*(D) = (H5T_NATIVE_FLOAT_POS_INF_g); \
- else if (*(S) < (DT)(D_MIN)) \
+ else if (*(S) < (ST)(D_MIN)) \
*(D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \
else \
*(D) = (DT)(*(S)); \
@@ -445,7 +445,7 @@
#define H5T_CONV_Ff(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
HDcompile_assert(sizeof(ST)>=sizeof(DT)); \
- H5T_CONV(H5T_CONV_Ff, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Ff, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \
}
#define H5T_HI_LO_BIT_SET(TYP, V, LO, HI) { \
@@ -455,8 +455,8 @@
\
count = 0; \
for(u = 0; u < sizeof(TYP); u++) { \
- count = ((sizeof(TYP) - 1) - u) * 8; \
- p = ((V) >> count) & 0xff; \
+ count = (((unsigned)sizeof(TYP) - 1) - u) * 8; \
+ p = (unsigned char)((V) >> count); \
if(p > 0) { \
if(p & 0x80) \
count += 7; \
@@ -480,7 +480,7 @@
\
count = 0; \
for(u = 0; u < sizeof(TYP); u++) { \
- p = ((V) >> (u * 8)) & 0xff; \
+ p = (unsigned char)((V) >> (u * 8)); \
if(p > 0) { \
count = u * 8; \
\
@@ -536,7 +536,7 @@
}
#define H5T_CONV_xF(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- H5T_CONV(H5T_CONV_xF, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_xF, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
}
/* Quincey added the condition branch (else if (*(S) != (ST)((DT)(*(S))))).
@@ -544,11 +544,11 @@
* of "INT_MAX". Compilers do roundup making this value "INT_MAX+1". This branch
* is to check that situation and return exception for some compilers, mainly GCC.
* The branch if (*(S) > (DT)(D_MAX) || (sprec < dprec && *(S) ==
- * (DT)(D_MAX))) is for some compilers like Sun, HP, IBM, and SGI where under
+ * (ST)(D_MAX))) is for some compilers like Sun, HP, IBM, and SGI where under
* the same situation the "int" doesn't overflow. SLU - 2005/9/12
*/
#define H5T_CONV_Fx_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if(*(S) > (DT)(D_MAX) || (sprec < dprec && *(S) == (DT)(D_MAX))) { \
+ if(*(S) > (ST)(D_MAX) || (sprec < dprec && *(S) == (ST)(D_MAX))) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -557,7 +557,7 @@
else if(except_ret == H5T_CONV_ABORT) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \
/* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \
- } else if (*(S) < (DT)(D_MIN)) { \
+ } else if (*(S) < (ST)(D_MIN)) { \
H5T_conv_ret_t except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \
src_id, dst_id, S, D, cb_struct.user_data); \
if(except_ret == H5T_CONV_UNHANDLED) \
@@ -580,28 +580,31 @@
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Fx_NOEX_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
- if(*(S) > (DT)(D_MAX)) \
+ if(*(S) > (ST)(D_MAX)) \
*(D) = (DT)(D_MAX); \
- else if(*(S) < (DT)(D_MIN)) \
+ else if(*(S) < (ST)(D_MIN)) \
*(D) = (DT)(D_MIN); \
else \
*(D) = (DT)(*(S)); \
}
#define H5T_CONV_Fx(STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \
- H5T_CONV(H5T_CONV_Fx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \
+ H5T_CONV(H5T_CONV_Fx, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, Y) \
}
/* Since all "no exception" cores do the same thing (assign the value in the
* source location to the destination location, using casting), use one "core"
* to do them all.
*/
+#ifndef H5_WANT_DCONV_EXCEPTION
#define H5T_CONV_NO_EXCEPT_CORE(S,D,ST,DT,D_MIN,D_MAX) { \
*(D) = (DT)(*(S)); \
}
+#endif /* H5_WANT_DCONV_EXCEPTION */
+
/* The main part of every integer hardware conversion macro */
-#define H5T_CONV(GUTS,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) \
+#define H5T_CONV(GUTS,STYPE,DTYPE,ST,DT,D_MIN,D_MAX,PREC) \
{ \
herr_t ret_value=SUCCEED; /* Return value */ \
\
@@ -609,13 +612,11 @@
\
{ \
size_t elmtno; /*element number */ \
- size_t sprec; /*source precision */ \
- size_t dprec; /*destination precision */ \
+ H5T_CONV_DECL_PREC(PREC) /*declare precision variables, or not */ \
uint8_t *src_buf; /*'raw' source buffer */ \
uint8_t *dst_buf; /*'raw' destination buffer */ \
ST *src, *s; /*source buffer */ \
DT *dst, *d; /*destination buffer */ \
- H5T_class_t tclass; /*datatype's class */ \
H5T_t *st, *dt; /*datatype descriptors */ \
ST src_aligned; /*source aligned type */ \
DT dst_aligned; /*destination aligned type */ \
@@ -647,8 +648,8 @@
case H5T_CONV_CONV: \
/* Initialize source & destination strides */ \
if (buf_stride) { \
- assert(buf_stride>=sizeof(ST)); \
- assert(buf_stride>=sizeof(DT)); \
+ HDassert(buf_stride >= sizeof(ST)); \
+ HDassert(buf_stride >= sizeof(DT)); \
s_stride = d_stride = (ssize_t)buf_stride; \
} else { \
s_stride = sizeof(ST); \
@@ -659,11 +660,11 @@
s_mv = H5T_NATIVE_##STYPE##_ALIGN_g>1 && \
((size_t)buf%H5T_NATIVE_##STYPE##_ALIGN_g || \
/* Cray */ ((size_t)((ST*)buf)!=(size_t)buf) || \
- s_stride%H5T_NATIVE_##STYPE##_ALIGN_g); \
+ (size_t)s_stride%H5T_NATIVE_##STYPE##_ALIGN_g); \
d_mv = H5T_NATIVE_##DTYPE##_ALIGN_g>1 && \
((size_t)buf%H5T_NATIVE_##DTYPE##_ALIGN_g || \
/* Cray */ ((size_t)((DT*)buf)!=(size_t)buf) || \
- d_stride%H5T_NATIVE_##DTYPE##_ALIGN_g); \
+ (size_t)d_stride%H5T_NATIVE_##DTYPE##_ALIGN_g); \
CI_INC_SRC(s_mv) \
CI_INC_DST(d_mv) \
\
@@ -679,19 +680,7 @@
if(NULL == (st = (H5T_t *)H5I_object(src_id)) || NULL == (dt = (H5T_t *)H5I_object(dst_id))) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to dereference datatype object ID") \
\
- /* Get source & destination precisions into a variable */ \
- tclass = st->shared->type; \
- HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
- if(tclass == H5T_INTEGER) \
- sprec = st->shared->u.atomic.prec; \
- else \
- sprec = 1 + st->shared->u.atomic.u.f.msize; \
- tclass = dt->shared->type; \
- HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
- if(tclass == H5T_INTEGER) \
- dprec = dt->shared->u.atomic.prec; \
- else \
- dprec = 1 + dt->shared->u.atomic.u.f.msize; \
+ H5T_CONV_SET_PREC(PREC) /*init precision variables, or not */ \
\
/* The outer loop of the type conversion macro, controlling which */ \
/* direction the buffer is walked */ \
@@ -701,21 +690,21 @@
/* Compute the number of "safe" destination elements at */ \
/* the end of the buffer (Those which don't overlap with */ \
/* any source elements at the beginning of the buffer) */ \
- safe=nelmts-(((nelmts*s_stride)+(d_stride-1))/d_stride); \
+ safe = nelmts - (((nelmts * (size_t)s_stride) + (size_t)(d_stride - 1)) / (size_t)d_stride); \
\
/* If we're down to the last few elements, just wrap up */ \
/* with a "real" reverse copy */ \
if(safe<2) { \
- src = (ST *)(src_buf = (uint8_t*)buf+(nelmts-1)*s_stride); \
- dst = (DT *)(dst_buf = (uint8_t*)buf+(nelmts-1)*d_stride); \
+ src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride); \
+ dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride); \
s_stride = -s_stride; \
d_stride = -d_stride; \
\
safe=nelmts; \
} /* end if */ \
else { \
- src = (ST *)(src_buf = (uint8_t*)buf+(nelmts-safe)*s_stride); \
- dst = (DT *)(dst_buf = (uint8_t*)buf+(nelmts-safe)*d_stride); \
+ src = (ST *)(src_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride); \
+ dst = (DT *)(dst_buf = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride); \
} /* end else */ \
} /* end if */ \
else { \
@@ -757,6 +746,36 @@ done: \
FUNC_LEAVE_NOAPI(ret_value) \
}
+/* Declare the source & destination precision variables */
+#define H5T_CONV_DECL_PREC(PREC) H5_GLUE(H5T_CONV_DECL_PREC_, PREC)
+
+#define H5T_CONV_DECL_PREC_Y \
+ size_t sprec; /*source precision */ \
+ size_t dprec; /*destination precision */ \
+ H5T_class_t tclass; /*datatype's class */
+
+#define H5T_CONV_DECL_PREC_N /*no precision variables */
+
+/* Initialize the source & destination precision variables */
+#define H5T_CONV_SET_PREC(PREC) H5_GLUE(H5T_CONV_SET_PREC_, PREC)
+
+#define H5T_CONV_SET_PREC_Y \
+ /* Get source & destination precisions into a variable */ \
+ tclass = st->shared->type; \
+ HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
+ if(tclass == H5T_INTEGER) \
+ sprec = st->shared->u.atomic.prec; \
+ else \
+ sprec = 1 + st->shared->u.atomic.u.f.msize; \
+ tclass = dt->shared->type; \
+ HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \
+ if(tclass == H5T_INTEGER) \
+ dprec = dt->shared->u.atomic.prec; \
+ else \
+ dprec = 1 + dt->shared->u.atomic.u.f.msize;
+
+#define H5T_CONV_SET_PREC_N /*don't init precision variables */
+
/* Macro defining action on source data which needs to be aligned (before main action) */
#define H5T_CONV_LOOP_PRE_SALIGN(ST) { \
HDmemcpy(&src_aligned, src, sizeof(ST)); \
@@ -903,7 +922,7 @@ typedef struct H5T_conv_struct_t {
/* Conversion data for H5T__conv_enum() */
typedef struct H5T_enum_struct_t {
int base; /*lowest `in' value */
- int length; /*num elements in arrays */
+ unsigned length; /*num elements in arrays */
int *src2dst; /*map from src to dst index */
} H5T_enum_struct_t;
@@ -1085,6 +1104,15 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported")
break;
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported")
}
@@ -1402,6 +1430,9 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
H5_SWAP_BYTES(buf, 7, 8);
} /* end for */
break;
+
+ default:
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "invalid conversion size")
} /* end switch */
break;
@@ -1487,6 +1518,16 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end if */
break;
+ case H5T_NO_CLASS:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_OPAQUE:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported")
} /* end switch */
@@ -1543,7 +1584,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
{
uint8_t *buf = (uint8_t*)_buf;
H5T_t *src = NULL, *dst = NULL; /*source and dest datatypes */
- int direction; /*direction of traversal */
+ ssize_t direction; /*direction of traversal */
size_t elmtno; /*element number */
size_t olap; /*num overlapping elements */
size_t half_size; /*1/2 of total size for swapping*/
@@ -1620,6 +1661,9 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
src_rev = (uint8_t *)H5MM_calloc(src->shared->size);
/* The conversion loop */
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
for(elmtno = 0; elmtno < nelmts; elmtno++) {
/*
@@ -1703,6 +1747,9 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T__bit_set(d, (size_t)0, dst->shared->u.atomic.offset, TRUE);
break;
+ case H5T_PAD_ERROR:
+ case H5T_PAD_BACKGROUND:
+ case H5T_NPAD:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding")
} /* end switch */
@@ -1715,6 +1762,10 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_PAD_ONE:
H5T__bit_set(d, msb_pad_offset, 8 * dst->shared->size - msb_pad_offset, TRUE);
break;
+
+ case H5T_PAD_ERROR:
+ case H5T_PAD_BACKGROUND:
+ case H5T_NPAD:
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding")
} /* end switch */
@@ -1739,12 +1790,12 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if(d == dbuf)
HDmemcpy(dp, d, dst->shared->size);
if(buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
+ sp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
+ dp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
} /* end if */
else {
- sp += direction * src->shared->size;
- dp += direction * dst->shared->size;
+ sp += direction * (ssize_t)src->shared->size; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
+ dp += direction * (ssize_t)dst->shared->size; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */
} /* end else */
} /* end for */
@@ -2062,20 +2113,6 @@ H5T__conv_struct_subset(const H5T_cdata_t *cdata)
* Programmer: Robb Matzke
* Thursday, January 22, 1998
*
- * Modifications:
- * Robb Matzke, 1999-06-16
- * Added support for non-zero strides. If BUF_STRIDE is
- * non-zero then convert one value at each memory location
- * advancing BUF_STRIDE bytes each time; otherwise assume
- * both source and destination values are packed.
- *
- * Robb Matzke, 2000-05-17
- * Added the BKG_STRIDE argument to fix a design bug. If
- * BUF_STRIDE and BKG_STRIDE are both non-zero then each
- * data element converted will be placed temporarily at a
- * multiple of BKG_STRIDE in the BKG buffer; otherwise the
- * BKG buffer is assumed to be a packed array of destination
- * datatype.
*-------------------------------------------------------------------------
*/
herr_t
@@ -2091,7 +2128,8 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_cmemb_t *src_memb = NULL; /*source struct member descript.*/
H5T_cmemb_t *dst_memb = NULL; /*destination struct memb desc. */
size_t offset; /*byte offset wrt struct */
- size_t src_delta; /*source stride */
+ ssize_t src_delta; /*source stride */
+ ssize_t bkg_delta; /*background stride */
size_t elmtno;
unsigned u; /*counters */
int i; /*counters */
@@ -2149,17 +2187,22 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Direction of conversion and striding through background.
*/
if(buf_stride) {
- src_delta = buf_stride;
- if(!bkg_stride)
- bkg_stride = dst->shared->size;
+ H5_ASSIGN_OVERFLOW(src_delta, buf_stride, size_t, ssize_t);
+ if(!bkg_stride) {
+ H5_ASSIGN_OVERFLOW(bkg_delta, dst->shared->size, size_t, ssize_t);
+ } /* end if */
+ else
+ H5_ASSIGN_OVERFLOW(bkg_delta, bkg_stride, size_t, ssize_t);
} /* end if */
else if(dst->shared->size <= src->shared->size) {
- src_delta = src->shared->size;
- bkg_stride = dst->shared->size;
+ H5_ASSIGN_OVERFLOW(src_delta, src->shared->size, size_t, ssize_t);
+ H5_ASSIGN_OVERFLOW(bkg_delta, dst->shared->size, size_t, ssize_t);
} /* end else-if */
else {
- src_delta = -(int)src->shared->size; /*overflow shouldn't be possible*/
- bkg_stride = -(int)dst->shared->size; /*overflow shouldn't be possible*/
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ src_delta = -(ssize_t)src->shared->size;
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ bkg_delta = -(ssize_t)dst->shared->size;
xbuf += (nelmts - 1) * src->shared->size;
xbkg += (nelmts - 1) * dst->shared->size;
} /* end else */
@@ -2204,7 +2247,8 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* yet). Then copy the member to the destination offset in the
* background buffer.
*/
- for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
+ H5_CHECK_OVERFLOW(src->shared->u.compnd.nmembs, size_t, int);
+ for(i = (int)src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
if(src2dst[i] < 0)
continue; /*subsetting*/
src_memb = src->shared->u.compnd.memb + i;
@@ -2229,12 +2273,12 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Update pointers
*/
xbuf += src_delta;
- xbkg += bkg_stride;
+ xbkg += bkg_delta;
} /* end for */
- /* If the bkg_stride was set to -(dst->shared->size), make it positive now */
+ /* If the bkg_delta was set to -(dst->shared->size), make it positive now */
if(buf_stride == 0 && dst->shared->size > src->shared->size)
- bkg_stride = dst->shared->size;
+ H5_ASSIGN_OVERFLOW(bkg_delta, dst->shared->size, size_t, ssize_t);
/*
* Copy the background buffer back into the in-place conversion
@@ -2243,7 +2287,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
for(xbuf = buf, xbkg = bkg, elmtno = 0; elmtno < nelmts; elmtno++) {
HDmemmove(xbuf, xbkg, dst->shared->size);
xbuf += buf_stride ? buf_stride : dst->shared->size;
- xbkg += bkg_stride;
+ xbkg += bkg_delta;
} /* end for */
break;
@@ -2390,7 +2434,8 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
if(dst_memb->size > src_memb->size)
offset += src_memb->size;
} /* end for */
- for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
+ H5_CHECK_OVERFLOW(src->shared->u.compnd.nmembs, size_t, int);
+ for(i = (int)src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
if(src2dst[i] < 0)
continue;
src_memb = src->shared->u.compnd.memb + i;
@@ -2509,7 +2554,8 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
* is larger than the source) and them to their final position in the
* bkg buffer.
*/
- for(i = src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
+ H5_CHECK_OVERFLOW(src->shared->u.compnd.nmembs, size_t, int);
+ for(i = (int)src->shared->u.compnd.nmembs - 1; i >= 0; --i) {
if(src2dst[i] < 0)
continue;
src_memb = src->shared->u.compnd.memb + i;
@@ -2605,7 +2651,7 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
j++;
if(j >= dst->shared->u.enumer.nmembs)
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source type is not a subset of destination type")
- priv->src2dst[i] = j;
+ priv->src2dst[i] = (int)j;
} /* end for */
/*
@@ -2634,45 +2680,44 @@ H5T_conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata)
* Because this is the optimized code, we won't fix it. It should still work in some
* situations. SLU - 2011/5/24)
*/
- if (1==src->shared->size || sizeof(short)==src->shared->size || sizeof(int)==src->shared->size) {
- for (i=0; i<src->shared->u.enumer.nmembs; i++) {
- if (1==src->shared->size) {
- n = *((signed char*)(src->shared->u.enumer.value+i));
- } else if (sizeof(short)==src->shared->size) {
- n = *((short*)(src->shared->u.enumer.value+i*src->shared->size));
- } else {
- n = *((int*)(src->shared->u.enumer.value+i*src->shared->size));
- }
- if (0==i) {
+ if(1 == src->shared->size || sizeof(short) == src->shared->size || sizeof(int) == src->shared->size) {
+ for(i = 0; i < src->shared->u.enumer.nmembs; i++) {
+ if(1 == src->shared->size)
+ n = *((signed char *)(src->shared->u.enumer.value + i));
+ else if (sizeof(short) == src->shared->size)
+ n = *((short *)(src->shared->u.enumer.value + i * src->shared->size));
+ else
+ n = *((int *)(src->shared->u.enumer.value + i * src->shared->size));
+ if(0 == i) {
domain[0] = domain[1] = n;
} else {
domain[0] = MIN(domain[0], n);
domain[1] = MAX(domain[1], n);
}
- }
+ } /* end for */
- length = (domain[1]-domain[0])+1;
- if (src->shared->u.enumer.nmembs<2 ||
- (double)length/src->shared->u.enumer.nmembs<1.2) {
+ HDassert(domain[1] >= domain[0]);
+ length = (unsigned)(domain[1] - domain[0]) + 1;
+ if(src->shared->u.enumer.nmembs < 2 ||
+ (double)length / src->shared->u.enumer.nmembs < (double)(1.2f)) {
priv->base = domain[0];
priv->length = length;
- if (NULL==(map=(int *)H5MM_malloc(length*sizeof(int))))
+ if(NULL == (map = (int *)H5MM_malloc(length * sizeof(int))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- for (i=0; i<length; i++)
+ for(i = 0; i < length; i++)
map[i] = -1; /*entry unused*/
- for (i=0; i<src->shared->u.enumer.nmembs; i++) {
- if (1==src->shared->size) {
- n = *((signed char*)(src->shared->u.enumer.value+i));
- } else if (sizeof(short)==src->shared->size) {
- n = *((short*)(src->shared->u.enumer.value+i*src->shared->size));
- } else {
- n = *((int*)(src->shared->u.enumer.value+i*src->shared->size));
- }
+ for(i = 0; i < src->shared->u.enumer.nmembs; i++) {
+ if(1 == src->shared->size)
+ n = *((signed char *)(src->shared->u.enumer.value + i));
+ else if(sizeof(short) == src->shared->size)
+ n = *((short *)(src->shared->u.enumer.value + i * src->shared->size));
+ else
+ n = *((int *)(src->shared->u.enumer.value + i * src->shared->size));
n -= priv->base;
- assert(n>=0 && n<priv->length);
- assert(map[n]<0);
+ HDassert(n >= 0 && (unsigned)n < priv->length);
+ HDassert(map[n] < 0);
map[n] = priv->src2dst[i];
- }
+ } /* end for */
/*
* Replace original src2dst array with our new one. The original
@@ -2718,9 +2763,8 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
{
uint8_t *buf = (uint8_t*)_buf; /*cast for pointer arithmetic */
H5T_t *src = NULL, *dst = NULL; /*src and dst datatypes */
- H5T_t *src_super = NULL, *dst_super = NULL; /*parent types for src and dst*/
uint8_t *s = NULL, *d = NULL; /*src and dst BUF pointers */
- int src_delta, dst_delta; /*conversion strides */
+ ssize_t src_delta, dst_delta; /*conversion strides */
int n; /*src value cast as native int */
H5T_enum_struct_t *priv = (H5T_enum_struct_t*)(cdata->priv);
H5P_genplist_t *plist; /*property list pointer */
@@ -2785,17 +2829,20 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Direction of conversion.
*/
if(buf_stride) {
- src_delta = dst_delta = (int)buf_stride;
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ src_delta = dst_delta = (ssize_t)buf_stride;
s = d = buf;
} else if(dst->shared->size <= src->shared->size) {
- src_delta = (int)src->shared->size; /*overflow shouldn't be possible*/
- dst_delta = (int)dst->shared->size; /*overflow shouldn't be possible*/
+ H5_ASSIGN_OVERFLOW(src_delta, src->shared->size, size_t, ssize_t);
+ H5_ASSIGN_OVERFLOW(dst_delta, dst->shared->size, size_t, ssize_t);
s = d = buf;
} else {
- src_delta = -(int)src->shared->size; /*overflow shouldn't be possible*/
- dst_delta = -(int)dst->shared->size; /*overflow shouldn't be possible*/
- s = buf + (nelmts-1) * src->shared->size;
- d = buf + (nelmts-1) * dst->shared->size;
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ src_delta = -(ssize_t)src->shared->size;
+ dst_delta = -(ssize_t)dst->shared->size;
+ s = buf + (nelmts - 1) * src->shared->size;
+ d = buf + (nelmts - 1) * dst->shared->size;
}
/* Get the plist structure */
@@ -2822,28 +2869,29 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
else
n = *((int*)s);
n -= priv->base;
- if(n < 0 || n >= priv->length || priv->src2dst[n] < 0) {
+ if(n < 0 || (unsigned)n >= priv->length || priv->src2dst[n] < 0) {
/*overflow*/
except_ret = H5T_CONV_UNHANDLED;
- if(cb_struct.func) { /*If user's exception handler is present, use it*/
+ /*If user's exception handler is present, use it*/
+ if(cb_struct.func)
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id,
s, d, cb_struct.user_data);
- }
- if(except_ret == H5T_CONV_UNHANDLED) {
+ if(except_ret == H5T_CONV_UNHANDLED)
HDmemset(d, 0xff, dst->shared->size);
- } else if(except_ret == H5T_CONV_ABORT)
+ else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
- } else {
+ } else
HDmemcpy(d,
- dst->shared->u.enumer.value+priv->src2dst[n]*dst->shared->size,
+ dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size,
dst->shared->size);
- }
- } else {
+ } /* end if */
+ else {
/* Use O(log N) lookup */
- int lt = 0;
- int rt = src->shared->u.enumer.nmembs;
- int md, cmp;
+ unsigned lt = 0;
+ unsigned rt = src->shared->u.enumer.nmembs;
+ unsigned md;
+ int cmp;
while(lt < rt) {
md = (lt + rt) / 2;
@@ -2858,22 +2906,23 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} /* end while */
if(lt >= rt) {
except_ret = H5T_CONV_UNHANDLED;
- if(cb_struct.func) { /*If user's exception handler is present, use it*/
+ /*If user's exception handler is present, use it*/
+ if(cb_struct.func)
except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, src_id, dst_id,
src, d, cb_struct.user_data);
- }
- if(except_ret == H5T_CONV_UNHANDLED) {
+ if(except_ret == H5T_CONV_UNHANDLED)
HDmemset(d, 0xff, dst->shared->size);
- } else if(except_ret == H5T_CONV_ABORT)
+ else if(except_ret == H5T_CONV_ABORT)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
} /* end if */
else {
+ HDassert(priv->src2dst[md] >= 0);
HDmemcpy(d,
- dst->shared->u.enumer.value+priv->src2dst[md]*dst->shared->size,
+ dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size,
dst->shared->size);
} /* end else */
- }
+ } /* end else */
}
break;
@@ -2906,7 +2955,7 @@ done:
*/
herr_t
H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
- size_t buf_stride, size_t UNUSED bkg_stride, void *_buf,
+ size_t UNUSED buf_stride, size_t UNUSED bkg_stride, void *_buf,
void UNUSED *bkg, hid_t UNUSED dxpl_id)
{
H5T_t *src, *dst; /*src and dst datatypes */
@@ -3017,7 +3066,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_path_t *tpath = NULL; /* Type conversion path */
hbool_t noop_conv = FALSE; /* Flag to indicate a noop conversion */
hbool_t write_to_file = FALSE; /* Flag to indicate writing to file */
- hbool_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
+ htri_t parent_is_vlen; /* Flag to indicate parent is vlen datatyp */
hid_t tsrc_id = -1, tdst_id = -1;/*temporary type atoms */
H5T_t *src = NULL; /*source datatype */
H5T_t *dst = NULL; /*destination datatype */
@@ -3028,7 +3077,6 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
ssize_t s_stride, d_stride; /*src and dst strides */
ssize_t b_stride; /*bkg stride */
size_t safe; /*how many elements are safe to process in each pass */
- ssize_t seq_len; /*the number of elements in the current sequence*/
size_t bg_seq_len = 0;
size_t src_base_size, dst_base_size;/*source & destination base size*/
void *conv_buf = NULL; /*temporary conversion buffer */
@@ -3116,12 +3164,13 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
noop_conv = TRUE;
/* Check if we need a temporary buffer for this conversion */
- parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE);
+ if((parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_SYSTEM, FAIL, "internal error when detecting variable-length class")
if(tpath->cdata.need_bkg || parent_is_vlen) {
/* Set up initial background buffer */
tmp_buf_size = MAX(src_base_size, dst_base_size);
if(NULL == (tmp_buf = H5FL_BLK_CALLOC(vlen_seq,tmp_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion")
} /* end if */
/* Get the allocation info */
@@ -3141,17 +3190,22 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
while(nelmts > 0) {
/* Check if we need to go backwards through the buffer */
if(d_stride > s_stride) {
+ /* Sanity check */
+ HDassert(s_stride > 0);
+ HDassert(d_stride > 0);
+ HDassert(b_stride >= 0);
+
/* Compute the number of "safe" destination elements at */
/* the end of the buffer (Those which don't overlap with */
/* any source elements at the beginning of the buffer) */
- safe = nelmts - (((nelmts * s_stride) + (d_stride - 1)) / d_stride);
+ safe = nelmts - (((nelmts * (size_t)s_stride) + ((size_t)d_stride - 1)) / (size_t)d_stride);
/* If we're down to the last few elements, just wrap up */
/* with a "real" reverse copy */
if(safe < 2) {
- s = (uint8_t *)buf + (nelmts - 1) * s_stride;
- d = (uint8_t *)buf + (nelmts - 1) * d_stride;
- b = (uint8_t *)bkg + (nelmts - 1) * b_stride;
+ s = (uint8_t *)buf + (nelmts - 1) * (size_t)s_stride;
+ d = (uint8_t *)buf + (nelmts - 1) * (size_t)d_stride;
+ b = (uint8_t *)bkg + (nelmts - 1) * (size_t)b_stride;
s_stride = -s_stride;
d_stride = -d_stride;
b_stride = -b_stride;
@@ -3159,9 +3213,9 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
safe = nelmts;
} /* end if */
else {
- s = (uint8_t *)buf + (nelmts - safe) * s_stride;
- d = (uint8_t *)buf + (nelmts - safe) * d_stride;
- b = (uint8_t *)bkg + (nelmts - safe) * b_stride;
+ s = (uint8_t *)buf + (nelmts - safe) * (size_t)s_stride;
+ d = (uint8_t *)buf + (nelmts - safe) * (size_t)d_stride;
+ b = (uint8_t *)bkg + (nelmts - safe) * (size_t)b_stride;
} /* end else */
} /* end if */
else {
@@ -3179,9 +3233,13 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'")
} /* end if */
else {
+ ssize_t sseq_len; /* (signed) The number of elements in the current sequence*/
+ size_t seq_len; /* The number of elements in the current sequence*/
+
/* Get length of element sequences */
- if((seq_len = (*(src->shared->u.vlen.getlen))(s)) < 0)
+ if((sseq_len = (*(src->shared->u.vlen.getlen))(s)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "incorrect length")
+ seq_len = (size_t)sseq_len;
/* If we are reading from memory and there is no conversion, just get the pointer to sequence */
if(write_to_file && noop_conv) {
@@ -3230,7 +3288,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* If we are writing and there is a nested VL type, read
* the sequence into the background buffer */
if(nested) {
- uint8_t *tmp = b;
+ const uint8_t *tmp = b;
UINT32DECODE(tmp, bg_seq_len);
if(bg_seq_len > 0) {
@@ -3240,40 +3298,40 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
HDmemset(tmp_buf, 0, tmp_buf_size);
} /* end if */
- H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp, &(bg_hobjid.addr));
- INT32DECODE(tmp, bg_hobjid.idx);
+ H5F_addr_decode(dst->shared->u.vlen.f, &tmp, &(bg_hobjid.addr));
+ UINT32DECODE(tmp, bg_hobjid.idx);
if(NULL == H5HG_read(dst->shared->u.vlen.f, dxpl_id, &bg_hobjid, tmp_buf, NULL))
HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL sequence into background buffer")
} /* end if */
/* If the sequence gets shorter, pad out the original sequence with zeros */
- if((ssize_t)bg_seq_len < seq_len)
+ if(bg_seq_len < seq_len)
HDmemset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, (seq_len - bg_seq_len) * dst_base_size);
} /* end if */
/* Convert VL sequence */
- if(H5T_convert(tpath, tsrc_id, tdst_id, (size_t)seq_len, (size_t)0, (size_t)0, conv_buf, tmp_buf, dxpl_id) < 0)
+ if(H5T_convert(tpath, tsrc_id, tdst_id, seq_len, (size_t)0, (size_t)0, conv_buf, tmp_buf, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
/* Write sequence to destination location */
- if((*(dst->shared->u.vlen.write))(dst->shared->u.vlen.f, dxpl_id, vl_alloc_info, d, conv_buf, b, (size_t)seq_len, dst_base_size) < 0)
+ if((*(dst->shared->u.vlen.write))(dst->shared->u.vlen.f, dxpl_id, vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data")
if(!noop_conv) {
/* For nested VL case, free leftover heap objects from the deeper level if the length of new data elements is shorter than the old data elements.*/
- if(nested && seq_len < (ssize_t)bg_seq_len) {
+ if(nested && seq_len < bg_seq_len) {
size_t parent_seq_len;
- uint8_t *tmp_p;
+ const uint8_t *tmp;
size_t u;
/* TMP_P is reset each time in the loop because DST_BASE_SIZE may include some data in addition to VL info. - SLU */
for(u = seq_len; u < bg_seq_len; u++) {
- tmp_p = (uint8_t*)tmp_buf + u * dst_base_size;
- UINT32DECODE(tmp_p, parent_seq_len);
+ tmp = (uint8_t *)tmp_buf + u * dst_base_size;
+ UINT32DECODE(tmp, parent_seq_len);
if(parent_seq_len > 0) {
- H5F_addr_decode(dst->shared->u.vlen.f, (const uint8_t **)&tmp_p, &(parent_hobjid.addr));
- INT32DECODE(tmp_p, parent_hobjid.idx);
+ H5F_addr_decode(dst->shared->u.vlen.f, &tmp, &(parent_hobjid.addr));
+ UINT32DECODE(tmp, parent_hobjid.idx);
if(H5HG_remove(dst->shared->u.vlen.f, dxpl_id, &parent_hobjid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "Unable to remove heap object")
} /* end if */
@@ -3343,7 +3401,7 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_t *src = NULL; /*source datatype */
H5T_t *dst = NULL; /*destination datatype */
uint8_t *sp, *dp; /*source and dest traversal ptrs */
- size_t src_delta, dst_delta; /*source & destination stride */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
int direction; /*direction of traversal */
size_t elmtno; /*element number counter */
unsigned u; /* local index variable */
@@ -3408,8 +3466,11 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/*
* Direction & size of buffer traversal.
*/
- src_delta = direction * (buf_stride ? buf_stride : src->shared->size);
- dst_delta = direction * (buf_stride ? buf_stride : dst->shared->size);
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ src_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : src->shared->size);
+ dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size);
/* Set up conversion path for base elements */
if(NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent, NULL, NULL, dxpl_id, FALSE))) {
@@ -3499,6 +3560,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
{
H5T_t *src = NULL; /*source datatype */
H5T_t *dst = NULL; /*destination datatype */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
int direction; /*direction of traversal */
size_t elmtno; /*element number */
size_t half_size; /*half the type size */
@@ -3563,6 +3625,15 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
direction = -1;
}
+ /*
+ * Direction & size of buffer traversal.
+ */
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ src_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : src->shared->size);
+ dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size);
+
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID")
@@ -3575,25 +3646,25 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
src_rev = (uint8_t*)H5MM_calloc(src->shared->size);
/* The conversion loop */
- for (elmtno=0; elmtno<nelmts; elmtno++) {
+ for(elmtno = 0; elmtno < nelmts; elmtno++) {
/*
* If the source and destination buffers overlap then use a
* temporary buffer for the destination.
*/
- if (direction>0) {
+ if(direction > 0) {
s = sp;
- d = elmtno<olap ? dbuf : dp;
+ d = elmtno < olap ? dbuf : dp;
} else {
s = sp;
- d = elmtno+olap >= nelmts ? dbuf : dp;
+ d = elmtno + olap >= nelmts ? dbuf : dp;
}
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src->shared->size) || (sp>=dp && sp<dp+dst->shared->size));
+ HDassert((dp>=sp && dp<sp+src->shared->size) || (sp>=dp && sp<dp+dst->shared->size));
} else {
- assert ((dp<sp && dp+dst->shared->size<=sp) || (sp<dp && sp+src->shared->size<=dp));
+ HDassert((dp<sp && dp+dst->shared->size<=sp) || (sp<dp && sp+src->shared->size<=dp));
}
#endif
@@ -3817,11 +3888,11 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Set padding areas in destination.
*/
if (dst->shared->u.atomic.offset>0) {
- assert(H5T_PAD_ZERO==dst->shared->u.atomic.lsb_pad || H5T_PAD_ONE==dst->shared->u.atomic.lsb_pad);
+ HDassert(H5T_PAD_ZERO==dst->shared->u.atomic.lsb_pad || H5T_PAD_ONE==dst->shared->u.atomic.lsb_pad);
H5T__bit_set(d, (size_t)0, dst->shared->u.atomic.offset, (hbool_t)(H5T_PAD_ONE==dst->shared->u.atomic.lsb_pad));
}
if (dst->shared->u.atomic.offset+dst->shared->u.atomic.prec!=8*dst->shared->size) {
- assert (H5T_PAD_ZERO==dst->shared->u.atomic.msb_pad || H5T_PAD_ONE==dst->shared->u.atomic.msb_pad);
+ HDassert(H5T_PAD_ZERO==dst->shared->u.atomic.msb_pad || H5T_PAD_ONE==dst->shared->u.atomic.msb_pad);
H5T__bit_set (d, dst->shared->u.atomic.offset+dst->shared->u.atomic.prec,
8*dst->shared->size - (dst->shared->u.atomic.offset+ dst->shared->u.atomic.prec),
(hbool_t)(H5T_PAD_ONE==dst->shared->u.atomic.msb_pad));
@@ -3844,16 +3915,13 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* If we had used a temporary buffer for the destination then we
* should copy the value to the true destination buffer.
*/
- if (d==dbuf)
- HDmemcpy (dp, d, dst->shared->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src->shared->size;
- dp += direction * dst->shared->size;
- }
- }
+ if(d==dbuf)
+ HDmemcpy(dp, d, dst->shared->size);
+
+ /* Advance source & destination pointers by delta amounts */
+ sp += src_delta;
+ dp += dst_delta;
+ } /* end for */
break;
@@ -3909,6 +3977,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
H5T_t *dst_p; /*destination datatype */
H5T_atomic_t src; /*atomic source info */
H5T_atomic_t dst; /*atomic destination info */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
int direction; /*forward or backward traversal */
size_t elmtno; /*element number */
size_t half_size; /*half the type size */
@@ -3921,11 +3990,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
uint8_t tmp1, tmp2; /*temp variables for swapping bytes*/
/* Conversion-related variables */
- hssize_t expo; /*exponent */
+ int64_t expo; /*exponent */
hssize_t expo_max; /*maximum possible dst exponent */
size_t msize = 0; /*useful size of mantissa in src*/
size_t mpos; /*offset to useful mant is src */
- hssize_t sign; /*source sign bit value */
+ uint64_t sign; /*source sign bit value */
size_t mrsh; /*amount to right shift mantissa*/
hbool_t carry = 0; /*carry after rounding mantissa */
size_t i; /*miscellaneous counters */
@@ -3991,6 +4060,15 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
direction = -1;
}
+ /*
+ * Direction & size of buffer traversal.
+ */
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(src_p->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst_p->shared->size, size_t, ssize_t);
+ src_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : src_p->shared->size);
+ dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst_p->shared->size);
+
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dxpl_id,H5P_DATASET_XFER)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find property list for ID")
@@ -4022,10 +4100,10 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src_p->shared->size) ||
+ HDassert((dp>=sp && dp<sp+src_p->shared->size) ||
(sp>=dp && sp<dp+dst_p->shared->size));
} else {
- assert ((dp<sp && dp+dst_p->shared->size<=sp) ||
+ HDassert((dp<sp && dp+dst_p->shared->size<=sp) ||
(sp<dp && sp+src_p->shared->size<=dp));
}
#endif
@@ -4044,7 +4122,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
} else if (H5T_ORDER_VAX==src.order) {
tsize = src_p->shared->size;
- assert(0 == tsize % 2);
+ HDassert(0 == tsize % 2);
for (i = 0; i < tsize; i += 4) {
tmp1 = s[i];
@@ -4142,9 +4220,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
goto padding;
-#ifdef H5_VMS
- } /*Temporary solution to handle VAX special values*/
-#else /*H5_VMS*/
+#ifndef H5_VMS /*Temporary solution to handle VAX special values*/
} else if (H5T__bit_find (s, src.u.f.epos, src.u.f.esize,
H5T_BIT_LSB, FALSE)<0) {
/* NaN */
@@ -4169,15 +4245,15 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception")
goto padding;
- }
#endif /*H5_VMS*/
+ }
/*
* Get the exponent as an unsigned quantity from the section of
* the source bit field where it's located. Don't worry about
* the exponent bias yet.
*/
- expo = H5T__bit_get_d(s, src.u.f.epos, src.u.f.esize);
+ expo = (int64_t)H5T__bit_get_d(s, src.u.f.epos, src.u.f.esize);
if(expo==0)
denormalized=TRUE;
@@ -4189,10 +4265,9 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
implied = 1;
mpos = src.u.f.mpos;
mrsh = 0;
- if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
- if ((bitno=H5T__bit_find(s, src.u.f.mpos, src.u.f.msize,
- H5T_BIT_MSB, TRUE))>0) {
- msize = bitno;
+ if(0 == expo || H5T_NORM_NONE == src.u.f.norm) {
+ if((bitno = H5T__bit_find(s, src.u.f.mpos, src.u.f.msize, H5T_BIT_MSB, TRUE)) > 0) {
+ msize = (size_t)bitno;
} else if (0==bitno) {
msize = 1;
H5T__bit_set(s, src.u.f.mpos, (size_t)1, FALSE);
@@ -4200,8 +4275,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} else if (H5T_NORM_IMPLIED==src.u.f.norm) {
msize = src.u.f.msize;
} else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet")
}
/*
@@ -4215,13 +4289,12 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* the source exponent bias.
*/
if (0==expo || H5T_NORM_NONE==src.u.f.norm) {
- assert(bitno>=0);
- expo -= (src.u.f.ebias-1) + (src.u.f.msize-bitno);
+ HDassert(bitno>=0);
+ expo -= (int64_t)((src.u.f.ebias - 1) + (src.u.f.msize - (size_t)bitno));
} else if (H5T_NORM_IMPLIED==src.u.f.norm) {
- expo -= src.u.f.ebias;
+ expo -= (int64_t)src.u.f.ebias;
} else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet")
}
/*
@@ -4236,7 +4309,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* bias and clipping by the minimum and maximum possible
* destination exponent values.
*/
- expo += dst.u.f.ebias;
+ expo += (int64_t)dst.u.f.ebias;
if (expo < -(hssize_t)(dst.u.f.msize)) {
/* The exponent is way too small. Result is zero. */
@@ -4250,7 +4323,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* accomodate that value. The mantissa of course is no
* longer normalized.
*/
- H5_ASSIGN_OVERFLOW(mrsh,(mrsh+1-expo),hssize_t,size_t);
+ mrsh += (size_t)(1 - expo);
expo = 0;
denormalized=TRUE;
} else if (expo>=expo_max) {
@@ -4289,20 +4362,20 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* mantissa bit is `1', else it is `10' binary.
*/
if (msize>0 && mrsh<=dst.u.f.msize && mrsh+msize>dst.u.f.msize) {
- bitno = (ssize_t)(mrsh+msize - dst.u.f.msize);
- assert(bitno>=0 && (size_t)bitno<=msize);
- /*If the 1st bit being cut off is set and source isn't denormalized.*/
- if(H5T__bit_get_d(s, (mpos + bitno) - 1, (size_t)1) && !denormalized) {
- /*Don't do rounding if exponent is 111...110 and mantissa is 111...11.
- *To do rounding and increment exponent in this case will create an infinity value.*/
- if((H5T__bit_find(s, mpos+bitno, msize-bitno, H5T_BIT_LSB, FALSE)>=0 || expo<expo_max-1)) {
- carry = H5T__bit_inc(s, mpos+bitno-1, 1+msize-bitno);
- if (carry)
+ bitno = (ssize_t)(mrsh + msize - dst.u.f.msize);
+ HDassert(bitno >= 0 && (size_t)bitno <= msize);
+ /* If the 1st bit being cut off is set and source isn't denormalized.*/
+ if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && !denormalized) {
+ /* Don't do rounding if exponent is 111...110 and mantissa is 111...11.
+ * To do rounding and increment exponent in this case will create an infinity value.*/
+ if((H5T__bit_find(s, mpos + (size_t)bitno, msize - (size_t)bitno, H5T_BIT_LSB, FALSE) >= 0 || expo < expo_max - 1)) {
+ carry = (hbool_t)H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
+ if(carry)
implied = 2;
}
- } else if(H5T__bit_get_d(s, (mpos + bitno) - 1, (size_t)1) && denormalized)
- /*For either source or destination, denormalized value doesn't increment carry.*/
- H5T__bit_inc(s, mpos+bitno-1, 1+msize-bitno);
+ } else if(H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && denormalized)
+ /* For either source or destination, denormalized value doesn't increment carry.*/
+ H5T__bit_inc(s, mpos + (size_t)bitno - 1, 1 + msize - (size_t)bitno);
}
else
carry=0;
@@ -4379,11 +4452,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Set external padding areas
*/
if (dst.offset>0) {
- assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
+ HDassert(H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
H5T__bit_set (d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad));
}
if (dst.offset+dst.prec!=8*dst_p->shared->size) {
- assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
+ HDassert(H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
H5T__bit_set (d, dst.offset+dst.prec, 8*dst_p->shared->size - (dst.offset+dst.prec),
(hbool_t)(H5T_PAD_ONE==dst.msb_pad));
}
@@ -4401,7 +4474,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
} else if (H5T_ORDER_VAX==dst.order && reverse) {
tsize = dst_p->shared->size;
- assert(0 == tsize % 2);
+ HDassert(0 == tsize % 2);
for (i = 0; i < tsize; i += 4) {
tmp1 = d[i];
@@ -4420,15 +4493,12 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* should copy the value to the true destination buffer.
*/
next:
- if (d==dbuf)
- HDmemcpy (dp, d, dst_p->shared->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src_p->shared->size;
- dp += direction * dst_p->shared->size;
- }
+ if(d == dbuf)
+ HDmemcpy(dp, d, dst_p->shared->size);
+
+ /* Advance source & destination pointers by delta amounts */
+ sp += src_delta;
+ dp += dst_delta;
}
break;
@@ -4474,7 +4544,8 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
{
H5T_t *src=NULL; /*source datatype */
H5T_t *dst=NULL; /*destination datatype */
- int direction; /*direction of traversal */
+ ssize_t src_delta, dst_delta; /*source & destination stride */
+ int direction; /*direction of traversal */
size_t elmtno; /*element number */
size_t olap; /*num overlapping elements */
size_t nchars=0; /*number of characters copied */
@@ -4499,8 +4570,8 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if((H5T_CSET_ASCII == src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == dst->shared->u.atomic.u.s.cset)
|| (H5T_CSET_ASCII == dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == src->shared->u.atomic.u.s.cset))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "The library doesn't convert between strings of ASCII and UTF")
- if(src->shared->u.atomic.u.s.pad < 0 || src->shared->u.atomic.u.s.pad >= H5T_NPAD ||
- dst->shared->u.atomic.u.s.pad < 0 || dst->shared->u.atomic.u.s.pad >= H5T_NPAD)
+ if(src->shared->u.atomic.u.s.pad < 0 || src->shared->u.atomic.u.s.pad >= H5T_NSTR ||
+ dst->shared->u.atomic.u.s.pad < 0 || dst->shared->u.atomic.u.s.pad >= H5T_NSTR)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding")
cdata->need_bkg = H5T_BKG_NO;
break;
@@ -4541,6 +4612,15 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
direction = -1;
}
+ /*
+ * Direction & size of buffer traversal.
+ */
+ H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(src->shared->size, size_t, ssize_t);
+ H5_CHECK_OVERFLOW(dst->shared->size, size_t, ssize_t);
+ src_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : src->shared->size);
+ dst_delta = (ssize_t)direction * (ssize_t)(buf_stride ? buf_stride : dst->shared->size);
+
/* Allocate the overlap buffer */
if(NULL == (dbuf = (uint8_t *)H5MM_malloc(dst->shared->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion")
@@ -4562,12 +4642,12 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (src->shared->size==dst->shared->size || buf_stride) {
- assert(s==d);
+ HDassert(s==d);
} else if (d==dbuf) {
- assert((dp>=sp && dp<sp+src->shared->size) ||
+ HDassert((dp>=sp && dp<sp+src->shared->size) ||
(sp>=dp && sp<dp+dst->shared->size));
} else {
- assert((dp<sp && dp+dst->shared->size<=sp) ||
+ HDassert((dp<sp && dp+dst->shared->size<=sp) ||
(sp<dp && sp+src->shared->size<=dp));
}
#endif
@@ -4613,6 +4693,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
case H5T_STR_ERROR:
+ default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "source string padding method not supported")
} /* end switch */
@@ -4648,6 +4729,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
case H5T_STR_ERROR:
+ default:
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination string padding method not supported")
} /* end switch */
@@ -4655,15 +4737,12 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* If we used a temporary buffer for the destination then we
* should copy the value to the true destination buffer.
*/
- if (d==dbuf)
+ if(d == dbuf)
HDmemcpy(dp, d, dst->shared->size);
- if (buf_stride) {
- sp += direction * buf_stride;
- dp += direction * buf_stride;
- } else {
- sp += direction * src->shared->size;
- dp += direction * dst->shared->size;
- }
+
+ /* Advance source & destination pointers by delta amounts */
+ sp += src_delta;
+ dp += dst_delta;
} /* end for */
break;
@@ -8865,10 +8944,10 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src_p->shared->size) ||
+ HDassert((dp>=sp && dp<sp+src_p->shared->size) ||
(sp>=dp && sp<dp+dst_p->shared->size));
} else {
- assert ((dp<sp && dp+dst_p->shared->size<=sp) ||
+ HDassert((dp<sp && dp+dst_p->shared->size<=sp) ||
(sp<dp && sp+src_p->shared->size<=dp));
}
#endif
@@ -8886,7 +8965,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
} else if (H5T_ORDER_VAX==src.order) {
tsize = src_p->shared->size;
- assert(0 == tsize % 2);
+ HDassert(0 == tsize % 2);
for (i = 0; i < tsize; i += 4) {
tmp1 = s[i];
@@ -9044,8 +9123,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
} else if (H5T_NORM_IMPLIED==src.u.f.norm) {
expo -= src.u.f.ebias;
} else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet")
}
/*
@@ -9247,11 +9325,11 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
* Set padding areas in destination.
*/
if (dst.offset>0) {
- assert (H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
+ HDassert(H5T_PAD_ZERO==dst.lsb_pad || H5T_PAD_ONE==dst.lsb_pad);
H5T__bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE==dst.lsb_pad));
}
if (dst.offset+dst.prec!=8*dst_p->shared->size) {
- assert (H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
+ HDassert(H5T_PAD_ZERO==dst.msb_pad || H5T_PAD_ONE==dst.msb_pad);
H5T__bit_set(d, dst.offset+dst.prec,
8*dst_p->shared->size - (dst.offset+ dst.prec),
(hbool_t)(H5T_PAD_ONE==dst.msb_pad));
@@ -9459,10 +9537,10 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
#ifndef NDEBUG
/* I don't quite trust the overlap calculations yet --rpm */
if (d==dbuf) {
- assert ((dp>=sp && dp<sp+src_p->shared->size) ||
+ HDassert((dp>=sp && dp<sp+src_p->shared->size) ||
(sp>=dp && sp<dp+dst_p->shared->size));
} else {
- assert ((dp<sp && dp+dst_p->shared->size<=sp) ||
+ HDassert((dp<sp && dp+dst_p->shared->size<=sp) ||
(sp<dp && sp+src_p->shared->size<=dp));
}
#endif
@@ -9548,8 +9626,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
if (H5T_NORM_NONE==dst.u.f.norm || H5T_NORM_IMPLIED==dst.u.f.norm) {
expo = first + dst.u.f.ebias;
} else {
- assert("normalization method not implemented yet" && 0);
- HDabort();
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "normalization method not implemented yet")
}
/* Handle mantissa part here */
@@ -9629,7 +9706,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
/* Check if the exponent is too big */
- expo_max = (hsize_t)HDpow((double)2.0, (double)dst.u.f.esize) - 1;
+ expo_max = (hsize_t)HDpow((double)2.0f, (double)dst.u.f.esize) - 1;
if(expo > expo_max) { /*overflows*/
if(cb_struct.func) { /*user's exception handler. Reverse back source order*/
@@ -9687,7 +9764,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts,
}
} else if (H5T_ORDER_VAX==dst.order && reverse) {
tsize = dst_p->shared->size;
- assert(0 == tsize % 2);
+ HDassert(0 == tsize % 2);
for (i = 0; i < tsize; i += 4) {
tmp1 = d[i];
@@ -9762,8 +9839,8 @@ H5T_reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(s);
- assert(size);
+ HDassert(s);
+ HDassert(size);
if (H5T_ORDER_VAX == order) {
for (i = 0; i < size; i += 2) {
diff --git a/src/H5Tenum.c b/src/H5Tenum.c
index 8e4e8a2..2b7563b 100644
--- a/src/H5Tenum.c
+++ b/src/H5Tenum.c
@@ -127,14 +127,14 @@ H5T__enum_create(const H5T_t *parent)
FUNC_ENTER_PACKAGE
- assert(parent);
+ HDassert(parent);
/* Build new type */
if(NULL == (ret_value = H5T__alloc()))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
ret_value->shared->type = H5T_ENUM;
ret_value->shared->parent = H5T_copy(parent, H5T_COPY_ALL);
- assert(ret_value->shared->parent);
+ HDassert(ret_value->shared->parent);
ret_value->shared->size = ret_value->shared->parent->shared->size;
done:
@@ -220,9 +220,9 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value)
FUNC_ENTER_PACKAGE
- assert(dt);
- assert(name && *name);
- assert(value);
+ HDassert(dt);
+ HDassert(name && *name);
+ HDassert(value);
/* The name and value had better not already exist */
for (i=0; i<dt->shared->u.enumer.nmembs; i++) {
@@ -322,8 +322,8 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/)
{
FUNC_ENTER_PACKAGE_NOERR
- assert(dt);
- assert(value);
+ HDassert(dt);
+ HDassert(value);
HDmemcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size);
@@ -563,9 +563,9 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/)
FUNC_ENTER_NOAPI_NOINIT
/* Check args */
- assert(dt && H5T_ENUM==dt->shared->type);
- assert(name && *name);
- assert(value);
+ HDassert(dt && H5T_ENUM==dt->shared->type);
+ HDassert(name && *name);
+ HDassert(value);
/* Sanity check */
if (dt->shared->u.enumer.nmembs == 0)
diff --git a/src/H5Tfields.c b/src/H5Tfields.c
index 163bab3..0e0d4e7 100644
--- a/src/H5Tfields.c
+++ b/src/H5Tfields.c
@@ -202,7 +202,7 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno)
FUNC_ENTER_PACKAGE
- assert(dt);
+ HDassert(dt);
switch (dt->shared->type) {
case H5T_COMPOUND:
@@ -435,8 +435,8 @@ H5T__sort_name(const H5T_t *dt, int *map)
FUNC_ENTER_PACKAGE_NOERR
/* Check args */
- assert(dt);
- assert(H5T_COMPOUND==dt->shared->type || H5T_ENUM==dt->shared->type);
+ HDassert(dt);
+ HDassert(H5T_COMPOUND==dt->shared->type || H5T_ENUM==dt->shared->type);
/* Use a bubble sort because we can short circuit */
if (H5T_COMPOUND==dt->shared->type) {
@@ -462,7 +462,7 @@ H5T__sort_name(const H5T_t *dt, int *map)
#ifndef NDEBUG
/* I never trust a sort :-) -RPM */
for (i=0; i<nmembs-1; i++) {
- assert(HDstrcmp(dt->shared->u.compnd.memb[i].name,
+ HDassert(HDstrcmp(dt->shared->u.compnd.memb[i].name,
dt->shared->u.compnd.memb[i+1].name)<0);
}
#endif
@@ -472,7 +472,7 @@ H5T__sort_name(const H5T_t *dt, int *map)
dt->shared->u.enumer.sorted = H5T_SORT_NAME;
nmembs = dt->shared->u.enumer.nmembs;
size = dt->shared->size;
- assert(size<=sizeof(tbuf));
+ HDassert(size<=sizeof(tbuf));
for (i=nmembs-1, swapped=TRUE; i>0 && swapped; --i) {
for (j=0, swapped=FALSE; j<i; j++) {
if (HDstrcmp(dt->shared->u.enumer.name[j],
@@ -502,7 +502,7 @@ H5T__sort_name(const H5T_t *dt, int *map)
#ifndef NDEBUG
/* I never trust a sort :-) -RPM */
for (i=0; i<nmembs-1; i++)
- assert(HDstrcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i+1])<0);
+ HDassert(HDstrcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i+1])<0);
#endif
}
}
diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c
index 51737eb..b2401d4 100644
--- a/src/H5Tfixed.c
+++ b/src/H5Tfixed.c
@@ -113,7 +113,7 @@ H5T_get_sign(H5T_t const *dt)
FUNC_ENTER_NOAPI(H5T_SGN_ERROR)
- assert(dt);
+ HDassert(dt);
/* Defer to parent */
while(dt->shared->parent)
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index b9192f9..e7d1351 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -172,7 +172,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
FUNC_ENTER_NOAPI(NULL)
- assert(dtype);
+ HDassert(dtype);
if(H5T_NO_CLASS == (h5_class = H5T_get_class(dtype, FALSE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class")
@@ -355,6 +355,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
case H5T_ENUM:
{
+ H5T_path_t *tpath; /* Type conversion info */
hid_t super_type_id, nat_super_type_id;
/* Don't need to do anything special for alignment, offset since the ENUM type usually is integer. */
@@ -380,6 +381,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
if(NULL == (new_type = H5T__enum_create(nat_super_type)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type")
+ /* Find the conversion function */
+ if(NULL == (tpath = H5T_path_find(super_type, nat_super_type, NULL, NULL, H5P_DEFAULT, FALSE)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types")
+
/* Retrieve member info and insert members into new enum type */
if((snmemb = H5T_get_nmembers(dtype)) <= 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumerate data type doesn't have any member")
@@ -391,7 +396,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
- if(H5Tconvert(super_type_id, nat_super_type_id, (size_t)1, memb_value, NULL, H5P_DEFAULT) < 0)
+ if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5P_DEFAULT) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value")
if(H5T__enum_insert(new_type, memb_name, memb_value) < 0)
@@ -402,10 +407,10 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig
tmp_memb_value = H5MM_xfree(tmp_memb_value);
/* Close base type */
- if(H5Tclose(nat_super_type_id) < 0)
+ if(H5I_dec_app_ref(nat_super_type_id) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
- /* Close super type */
- if(H5Tclose(super_type_id) < 0)
+ /* Close super type */
+ if(H5I_dec_app_ref(super_type_id) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype")
ret_value = new_type;
@@ -571,19 +576,19 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
FUNC_ENTER_NOAPI(NULL)
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
- if(prec <= H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) {
match = H5T_NATIVE_INT_MATCH_CHAR;
native_size = sizeof(char);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_SHORT)) {
+ } else if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SHORT_g))) {
match = H5T_NATIVE_INT_MATCH_SHORT;
native_size = sizeof(short);
- } else if(prec<=H5Tget_precision(H5T_NATIVE_INT)) {
+ } else if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_INT_g))) {
match = H5T_NATIVE_INT_MATCH_INT;
native_size = sizeof(int);
- } else if(prec <= H5Tget_precision(H5T_NATIVE_LONG)) {
+ } else if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) {
match = H5T_NATIVE_INT_MATCH_LONG;
native_size = sizeof(long);
- } else if(prec <= H5Tget_precision(H5T_NATIVE_LLONG)) {
+ } else if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LLONG_g))) {
match = H5T_NATIVE_INT_MATCH_LLONG;
native_size = sizeof(long long);
} else { /* If no native type matches the querried datatype, simply choose the type of biggest size. */
@@ -591,16 +596,16 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction,
native_size = sizeof(long long);
}
} else if(direction == H5T_DIR_DESCEND) {
- if(prec > H5Tget_precision(H5T_NATIVE_LONG)) {
+ if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) {
match = H5T_NATIVE_INT_MATCH_LLONG;
native_size = sizeof(long long);
- } else if(prec > H5Tget_precision(H5T_NATIVE_INT)) {
+ } else if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_INT_g))) {
match = H5T_NATIVE_INT_MATCH_LONG;
native_size = sizeof(long);
- } else if(prec > H5Tget_precision(H5T_NATIVE_SHORT)) {
+ } else if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SHORT_g))) {
match = H5T_NATIVE_INT_MATCH_INT;
native_size = sizeof(int);
- } else if(prec > H5Tget_precision(H5T_NATIVE_SCHAR)) {
+ } else if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) {
match = H5T_NATIVE_INT_MATCH_SHORT;
native_size = sizeof(short);
} else {
@@ -710,7 +715,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
FUNC_ENTER_NOAPI(NULL)
- assert(size>0);
+ HDassert(size>0);
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
if(size<=sizeof(float)) {
@@ -786,7 +791,7 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig
} /* end switch */
/* Create new native type */
- assert(tid>=0);
+ HDassert(tid>=0);
if(NULL==(dt=(H5T_t *)H5I_object(tid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
if((ret_value=H5T_copy(dt, H5T_COPY_TRANSIENT))==NULL)
@@ -829,19 +834,19 @@ H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_a
FUNC_ENTER_NOAPI(NULL)
if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) {
- if(prec<=H5Tget_precision(H5T_NATIVE_B8)) {
+ if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) {
tid = H5T_NATIVE_B8;
native_size = 1;
align = H5T_NATIVE_UINT8_ALIGN_g;
- } else if(prec<=H5Tget_precision(H5T_NATIVE_B16)) {
+ } else if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B16_g))) {
tid = H5T_NATIVE_B16;
native_size = 2;
align = H5T_NATIVE_UINT16_ALIGN_g;
- } else if(prec<=H5Tget_precision(H5T_NATIVE_B32)) {
+ } else if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) {
tid = H5T_NATIVE_B32;
native_size = 4;
align = H5T_NATIVE_UINT32_ALIGN_g;
- } else if(prec<=H5Tget_precision(H5T_NATIVE_B64)) {
+ } else if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B64_g))) {
tid = H5T_NATIVE_B64;
native_size = 8;
align = H5T_NATIVE_UINT64_ALIGN_g;
@@ -851,15 +856,15 @@ H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_a
align = H5T_NATIVE_UINT64_ALIGN_g;
}
} else if(direction == H5T_DIR_DESCEND) {
- if(prec>H5Tget_precision(H5T_NATIVE_B32)) {
+ if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) {
tid = H5T_NATIVE_B64;
native_size = 8;
align = H5T_NATIVE_UINT64_ALIGN_g;
- } else if(prec>H5Tget_precision(H5T_NATIVE_B16)) {
+ } else if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B16_g))) {
tid = H5T_NATIVE_B32;
native_size = 4;
align = H5T_NATIVE_UINT32_ALIGN_g;
- } else if(prec>H5Tget_precision(H5T_NATIVE_B8)) {
+ } else if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) {
tid = H5T_NATIVE_B16;
native_size = 2;
align = H5T_NATIVE_UINT16_ALIGN_g;
@@ -871,7 +876,7 @@ H5T_get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_a
}
/* Create new native type */
- assert(tid>=0);
+ HDassert(tid>=0);
if(NULL==(dt=(H5T_t *)H5I_object(tid)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type")
diff --git a/src/H5Toffset.c b/src/H5Toffset.c
index bea8d2b..ea4b3b5 100644
--- a/src/H5Toffset.c
+++ b/src/H5Toffset.c
@@ -272,12 +272,12 @@ H5T_set_offset(const H5T_t *dt, size_t offset)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(dt);
- assert(H5T_STRING!=dt->shared->type || 0==offset);
- assert(H5T_REFERENCE!=dt->shared->type);
- assert(H5T_OPAQUE!=dt->shared->type);
- assert(H5T_COMPOUND!=dt->shared->type);
- assert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
+ HDassert(dt);
+ HDassert(H5T_STRING!=dt->shared->type || 0==offset);
+ HDassert(H5T_REFERENCE!=dt->shared->type);
+ HDassert(H5T_OPAQUE!=dt->shared->type);
+ HDassert(H5T_COMPOUND!=dt->shared->type);
+ HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
if (dt->shared->parent) {
if (H5T_set_offset(dt->shared->parent, offset)<0)
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index c5ac186..b3975af 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -236,12 +236,12 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(dt);
- assert(prec>0);
- assert(H5T_OPAQUE!=dt->shared->type);
- assert(H5T_COMPOUND!=dt->shared->type);
- assert(H5T_STRING!=dt->shared->type);
- assert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
+ HDassert(dt);
+ HDassert(prec>0);
+ HDassert(H5T_OPAQUE!=dt->shared->type);
+ HDassert(H5T_COMPOUND!=dt->shared->type);
+ HDassert(H5T_STRING!=dt->shared->type);
+ HDassert(!(H5T_ENUM==dt->shared->type && 0==dt->shared->u.enumer.nmembs));
if (dt->shared->parent) {
if (H5T_set_precision(dt->shared->parent, prec)<0)
diff --git a/src/H5V.c b/src/H5V.c
index 2697822..3277b90 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -78,7 +78,7 @@ H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
- assert(1 == H5V_vector_reduce_product(0, NULL));
+ HDassert(1 == H5V_vector_reduce_product(0, NULL));
/*
* Combine adjacent memory accesses
@@ -127,8 +127,8 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
* This has to be true because if we optimize the dimensionality down to
* zero we still must make one reference.
*/
- assert(1 == H5V_vector_reduce_product(0, NULL));
- assert (*elmt_size>0);
+ HDassert(1 == H5V_vector_reduce_product(0, NULL));
+ HDassert(*elmt_size>0);
/*
* Combine adjacent memory accesses
@@ -267,48 +267,48 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(n <= H5V_HYPER_NDIMS);
- assert(size);
- assert(total_size);
- assert(stride);
+ HDassert(n <= H5V_HYPER_NDIMS);
+ HDassert(size);
+ HDassert(total_size);
+ HDassert(stride);
/* init */
- assert(n>0);
+ HDassert(n>0);
stride[n-1] = 1;
skip = offset ? offset[n-1] : 0;
switch(n) {
case 2: /* 1-D dataset */
- assert (total_size[1]>=size[1]);
+ HDassert(total_size[1]>=size[1]);
stride[0] = total_size[1]-size[1]; /*overflow checked*/
acc = total_size[1];
skip += acc * (offset ? offset[0] : 0);
break;
case 3: /* 2-D dataset */
- assert (total_size[2]>=size[2]);
+ HDassert(total_size[2]>=size[2]);
stride[1] = total_size[2]-size[2]; /*overflow checked*/
acc = total_size[2];
skip += acc * (offset ? (hsize_t)offset[1] : 0);
- assert (total_size[1]>=size[1]);
+ HDassert(total_size[1]>=size[1]);
stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/
acc *= total_size[1];
skip += acc * (offset ? (hsize_t)offset[0] : 0);
break;
case 4: /* 3-D dataset */
- assert (total_size[3]>=size[3]);
+ HDassert(total_size[3]>=size[3]);
stride[2] = total_size[3]-size[3]; /*overflow checked*/
acc = total_size[3];
skip += acc * (offset ? (hsize_t)offset[2] : 0);
- assert (total_size[2]>=size[2]);
+ HDassert(total_size[2]>=size[2]);
stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/
acc *= total_size[2];
skip += acc * (offset ? (hsize_t)offset[1] : 0);
- assert (total_size[1]>=size[1]);
+ HDassert(total_size[1]>=size[1]);
stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/
acc *= total_size[1];
skip += acc * (offset ? (hsize_t)offset[0] : 0);
@@ -317,7 +317,7 @@ H5V_hyper_stride(unsigned n, const hsize_t *size,
default:
/* others */
for (i=(int)(n-2), acc=1; i>=0; --i) {
- assert (total_size[i+1]>=size[i+1]);
+ HDassert(total_size[i+1]>=size[i+1]);
stride[i] = acc * (total_size[i+1] - size[i+1]); /*overflow checked*/
acc *= total_size[i+1];
skip += acc * (offset ? (hsize_t)offset[i] : 0);
@@ -474,14 +474,14 @@ H5V_hyper_fill(unsigned n, const hsize_t *_size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(n > 0 && n <= H5V_HYPER_NDIMS);
- assert(_size);
- assert(total_size);
- assert(dst);
+ HDassert(n > 0 && n <= H5V_HYPER_NDIMS);
+ HDassert(_size);
+ HDassert(total_size);
+ HDassert(dst);
#ifndef NDEBUG
for (u = 0; u < n; u++) {
- assert(_size[u] > 0);
- assert(total_size[u] > 0);
+ HDassert(_size[u] > 0);
+ HDassert(total_size[u] > 0);
}
#endif
@@ -560,17 +560,17 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(n > 0 && n <= H5V_HYPER_NDIMS);
- assert(_size);
- assert(dst_size);
- assert(src_size);
- assert(dst);
- assert(src);
+ HDassert(n > 0 && n <= H5V_HYPER_NDIMS);
+ HDassert(_size);
+ HDassert(dst_size);
+ HDassert(src_size);
+ HDassert(dst);
+ HDassert(src);
#ifndef NDEBUG
for (u = 0; u < n; u++) {
- assert(_size[u] > 0);
- assert(dst_size[u] > 0);
- assert(src_size[u] > 0);
+ HDassert(_size[u] > 0);
+ HDassert(dst_size[u] > 0);
+ HDassert(src_size[u] > 0);
}
#endif
@@ -589,7 +589,7 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
int ii; /*counter */
/* init */
- assert(n>0);
+ HDassert(n>0);
dst_stride[n-1] = 1;
src_stride[n-1] = 1;
dst_start = dst_offset ? dst_offset[n-1] : 0;
@@ -598,8 +598,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
/* Unroll loop for common cases */
switch(n) {
case 2:
- assert (dst_size[1]>=size[1]);
- assert (src_size[1]>=size[1]);
+ HDassert(dst_size[1]>=size[1]);
+ HDassert(src_size[1]>=size[1]);
dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/
src_stride[0] = src_size[1] - size[1]; /*overflow checked*/
dst_acc = dst_size[1];
@@ -609,8 +609,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
break;
case 3:
- assert (dst_size[2]>=size[2]);
- assert (src_size[2]>=size[2]);
+ HDassert(dst_size[2]>=size[2]);
+ HDassert(src_size[2]>=size[2]);
dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/
src_stride[1] = src_size[2] - size[2]; /*overflow checked*/
dst_acc = dst_size[2];
@@ -618,8 +618,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0);
src_start += src_acc * (src_offset ? src_offset[1] : 0);
- assert (dst_size[1]>=size[1]);
- assert (src_size[1]>=size[1]);
+ HDassert(dst_size[1]>=size[1]);
+ HDassert(src_size[1]>=size[1]);
dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/
src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/
dst_acc *= dst_size[1];
@@ -629,8 +629,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
break;
case 4:
- assert (dst_size[3]>=size[3]);
- assert (src_size[3]>=size[3]);
+ HDassert(dst_size[3]>=size[3]);
+ HDassert(src_size[3]>=size[3]);
dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/
src_stride[2] = src_size[3] - size[3]; /*overflow checked*/
dst_acc = dst_size[3];
@@ -638,8 +638,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0);
src_start += src_acc * (src_offset ? src_offset[2] : 0);
- assert (dst_size[2]>=size[2]);
- assert (src_size[2]>=size[2]);
+ HDassert(dst_size[2]>=size[2]);
+ HDassert(src_size[2]>=size[2]);
dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/
src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/
dst_acc *= dst_size[2];
@@ -647,8 +647,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0);
src_start += src_acc * (src_offset ? src_offset[1] : 0);
- assert (dst_size[1]>=size[1]);
- assert (src_size[1]>=size[1]);
+ HDassert(dst_size[1]>=size[1]);
+ HDassert(src_size[1]>=size[1]);
dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/
src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/
dst_acc *= dst_size[1];
@@ -660,8 +660,8 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size,
default:
/* others */
for (ii=(int)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) {
- assert (dst_size[ii+1]>=size[ii+1]);
- assert (src_size[ii+1]>=size[ii+1]);
+ HDassert(dst_size[ii+1]>=size[ii+1]);
+ HDassert(src_size[ii+1]>=size[ii+1]);
dst_stride[ii] = dst_acc * (dst_size[ii+1] - size[ii+1]); /*overflow checked*/
src_stride[ii] = src_acc * (src_size[ii+1] - size[ii+1]); /*overflow checked*/
dst_acc *= dst_size[ii+1];
@@ -713,7 +713,7 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert (elmt_size < SIZET_MAX);
+ HDassert(elmt_size < SIZET_MAX);
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
@@ -729,7 +729,7 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size,
if (--idx[j])
carry = FALSE;
else {
- assert(size);
+ HDassert(size);
idx[j] = size[j];
} /* end else */
}
@@ -775,7 +775,7 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert (elmt_size<SIZET_MAX);
+ HDassert(elmt_size<SIZET_MAX);
if (n) {
H5V_vector_cpy(n, idx, size);
@@ -794,7 +794,7 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size,
if (--idx[j])
carry = FALSE;
else {
- assert(size);
+ HDassert(size);
idx[j] = size[j];
}
}
@@ -844,7 +844,7 @@ H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert (elmt_size<SIZET_MAX);
+ HDassert(elmt_size<SIZET_MAX);
if (n) {
H5V_vector_cpy(n, idx, size);
@@ -863,7 +863,7 @@ H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size,
if (--idx[j])
carry = FALSE;
else {
- assert(size);
+ HDassert(size);
idx[j] = size[j];
}
}
@@ -918,9 +918,9 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert (elmt_size < SIZET_MAX);
- assert(dst_n>0);
- assert(src_n>0);
+ HDassert(elmt_size < SIZET_MAX);
+ HDassert(dst_n>0);
+ HDassert(src_n>0);
H5V_vector_cpy(dst_n, dst_idx, dst_size);
H5V_vector_cpy(src_n, src_idx, src_size);
@@ -937,7 +937,7 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
if (--dst_idx[j])
carry = FALSE;
else {
- assert(dst_size);
+ HDassert(dst_size);
dst_idx[j] = dst_size[j];
} /* end else */
}
@@ -946,7 +946,7 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size,
if (--src_idx[j])
carry = FALSE;
else {
- assert(src_size);
+ HDassert(src_size);
src_idx[j] = src_size[j];
} /* end else */
}
@@ -983,10 +983,10 @@ H5V_array_fill(void *_dst, const void *src, size_t size, size_t count)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert (dst);
- assert (src);
- assert (size < SIZET_MAX && size > 0);
- assert (count < SIZET_MAX && count > 0);
+ HDassert(dst);
+ HDassert(src);
+ HDassert(size < SIZET_MAX && size > 0);
+ HDassert(count < SIZET_MAX && count > 0);
HDmemcpy(dst, src, size); /* copy first item */
@@ -1038,9 +1038,9 @@ H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(n <= H5V_HYPER_NDIMS);
- assert(total_size);
- assert(down);
+ HDassert(n <= H5V_HYPER_NDIMS);
+ HDassert(total_size);
+ HDassert(down);
/* Build the sizes of each dimension in the array */
/* (From fastest to slowest) */
@@ -1084,9 +1084,9 @@ H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(n <= H5V_HYPER_NDIMS);
- assert(acc);
- assert(offset);
+ HDassert(n <= H5V_HYPER_NDIMS);
+ HDassert(acc);
+ HDassert(offset);
/* Compute offset in array */
for (i=(int)(n-1), ret_value=0; i>=0; --i)
@@ -1124,9 +1124,9 @@ H5V_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset)
FUNC_ENTER_NOAPI((HDabort(), 0)) /*lint !e527 Don't worry about unreachable statement */
- assert(n <= H5V_HYPER_NDIMS);
- assert(total_size);
- assert(offset);
+ HDassert(n <= H5V_HYPER_NDIMS);
+ HDassert(total_size);
+ HDassert(offset);
/* Build the sizes of each dimension in the array */
if(H5V_array_down(n,total_size,acc_arr)<0)
@@ -1278,10 +1278,10 @@ H5V_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk,
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- assert(ndims <= H5V_HYPER_NDIMS);
- assert(coord);
- assert(chunk);
- assert(chunk_idx);
+ HDassert(ndims <= H5V_HYPER_NDIMS);
+ HDassert(coord);
+ HDassert(chunk);
+ HDassert(chunk_idx);
/* Compute the scaled coordinates for actual coordinates */
for(u=0; u<ndims; u++)
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index de85fbc..5ce26a0 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -42,7 +42,7 @@ typedef herr_t (*H5V_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
/* Other functions */
#define H5V_vector_cpy(N,DST,SRC) { \
- assert (sizeof(*(DST))==sizeof(*(SRC))); \
+ HDassert(sizeof(*(DST))==sizeof(*(SRC))); \
if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \
else HDmemset (DST, 0, (N)*sizeof(*(DST))); \
}
diff --git a/src/H5Z.c b/src/H5Z.c
index 5861e0e..d415060 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -57,9 +57,6 @@ typedef enum {
H5Z_PRELUDE_SET_LOCAL /* Call "set local" callback */
} H5Z_prelude_type_t;
-/* Maximal number of the list of opened objects (2^16) */
-#define NUM_OBJS 65536
-
/* Local variables */
static size_t H5Z_table_alloc_g = 0;
static size_t H5Z_table_used_g = 0;
@@ -70,8 +67,9 @@ static H5Z_stats_t *H5Z_stat_table_g = NULL;
/* Local functions */
static int H5Z_find_idx(H5Z_filter_t id);
-static int H5Z_get_object_cb(void *obj_ptr, hid_t obj_id, void *key);
-static int H5Z_get_file_cb(void *obj_ptr, hid_t obj_id, void *key);
+static int H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t obj_id, void *key);
+static int H5Z__check_unregister_group_cb(void *obj_ptr, hid_t obj_id, void *key);
+static int H5Z__flush_file_cb(void *obj_ptr, hid_t obj_id, void *key);
/*-------------------------------------------------------------------------
@@ -371,8 +369,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -384,14 +380,14 @@ H5Zunregister(H5Z_filter_t id)
H5TRACE1("e", "Zf", id);
/* Check args */
- if (id<0 || id>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
- if (id<H5Z_FILTER_RESERVED)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
+ if(id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number")
+ if(id < H5Z_FILTER_RESERVED)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters")
/* Do it */
- if (H5Z_unregister (id)<0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter")
+ if(H5Z_unregister(id) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter")
done:
FUNC_LEAVE_API(ret_value)
@@ -409,12 +405,10 @@ done:
* Programmer: Quincey Koziol
* Thursday, November 14, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-H5Z_unregister (H5Z_filter_t filter_id)
+H5Z_unregister(H5Z_filter_t filter_id)
{
size_t filter_index; /* Local index variable for filter */
H5Z_object_t object;
@@ -422,7 +416,7 @@ H5Z_unregister (H5Z_filter_t filter_id)
FUNC_ENTER_NOAPI(FAIL)
- assert (filter_id>=0 && filter_id<=H5Z_FILTER_MAX);
+ HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX);
/* Is the filter already registered? */
for (filter_index=0; filter_index<H5Z_table_used_g; filter_index++)
@@ -438,21 +432,21 @@ H5Z_unregister (H5Z_filter_t filter_id)
object.found = FALSE;
/* Iterate through all opened datasets, returns a failure if any of them uses the filter */
- if(H5I_iterate(H5I_DATASET, H5Z_get_object_cb, &object, FALSE) < 0)
+ if(H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
if(object.found)
HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a dataset is still using it")
/* Iterate through all opened groups, returns a failure if any of them uses the filter */
- if(H5I_iterate(H5I_GROUP, H5Z_get_object_cb, &object, FALSE) < 0)
+ if(H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
if(object.found)
HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "can't unregister filter because a group is still using it")
/* Iterate through all opened files and flush them */
- if(H5I_iterate(H5I_FILE, H5Z_get_file_cb, NULL, FALSE) < 0)
+ if(H5I_iterate(H5I_FILE, H5Z__flush_file_cb, NULL, FALSE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed")
/* Remove filter from table */
@@ -469,7 +463,41 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Z_get_object_cb
+ * Function: H5Z__check_unregister
+ *
+ * Purpose: Check if an object uses the filter to be unregistered.
+ *
+ * Return: TRUE if the object uses the filter.
+ * FALSE if not, NEGATIVE on error.
+ *
+ * Programmer: Quincey Koziol
+ * 11 May 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static htri_t
+H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id)
+{
+ H5P_genplist_t *plist; /* Property list */
+ htri_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Get the plist structure of object creation */
+ if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
+ HGOTO_ERROR(H5E_PLINE, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ /* Check if the object creation property list uses the filter */
+ if((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z__check_unregister() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z__check_unregister_group_cb
*
* Purpose: The callback function for H5Z_unregister. It iterates
* through all opened objects. If the object is a dataset
@@ -485,61 +513,97 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z_get_object_cb(void *obj_ptr, hid_t obj_id, void *key)
+H5Z__check_unregister_group_cb(void *obj_ptr, hid_t UNUSED obj_id, void *key)
{
- H5I_type_t id_type;
- hid_t ocpl_id;
- H5P_genplist_t *plist; /* Property list */
+ hid_t ocpl_id = -1;
H5Z_object_t *object = (H5Z_object_t *)key;
htri_t filter_in_pline = FALSE;
int ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(obj_ptr);
- if((id_type = H5I_get_type(obj_id)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "bad object id");
+ /* Get the group creation property */
+ if((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list")
- switch(id_type) {
- case H5I_GROUP:
- if((ocpl_id = H5G_get_create_plist(obj_ptr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get group creation property list")
+ /* Check if the filter is in the group creation property list */
+ if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
- break;
+ /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and
+ * let H5Z_unregister return failure.
+ */
+ if(filter_in_pline) {
+ object->found = TRUE;
+ ret_value = TRUE;
+ } /* end if */
- case H5I_DATASET:
- if((ocpl_id = H5D_get_create_plist(obj_ptr)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get dataset creation property list")
-
- break;
+done:
+ if(ocpl_id > 0)
+ if(H5I_dec_app_ref(ocpl_id) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object")
- } /* end switch */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z__check_unregister_group_cb() */
- /* Get the plist structure of object creation */
- if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z__check_unregister_dset_cb
+ *
+ * Purpose: The callback function for H5Z_unregister. It iterates
+ * through all opened objects. If the object is a dataset
+ * or a group and it uses the filter to be unregistered, the
+ * function returns TRUE.
+ *
+ * Return: TRUE if the object uses the filter.
+ * FALSE otherwise.
+ *
+ * Programmer: Raymond Lu
+ * 6 May 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t UNUSED obj_id, void *key)
+{
+ hid_t ocpl_id = -1;
+ H5Z_object_t *object = (H5Z_object_t *)key;
+ htri_t filter_in_pline = FALSE;
+ int ret_value = FALSE; /* Return value */
- /* Check if the object creation property list uses the filter */
- if((filter_in_pline = H5P_filter_in_pline(plist, object->filter_id)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+ FUNC_ENTER_STATIC
- /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and let
- * H5Z_unregister return failure */
+ HDassert(obj_ptr);
+
+ /* Get the dataset creation property */
+ if((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list")
+
+ /* Check if the filter is in the dataset creation property list */
+ if((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline")
+
+ /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and
+ * let H5Z_unregister return failure.
+ */
if(filter_in_pline) {
object->found = TRUE;
ret_value = TRUE;
- }
+ } /* end if */
done:
+ if(ocpl_id > 0)
+ if(H5I_dec_app_ref(ocpl_id) < 0)
+ HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist")
+
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_object_cb() */
+} /* end H5Z__check_unregister_dset_cb() */
/*-------------------------------------------------------------------------
- * Function: H5Z_get_file_cb
+ * Function: H5Z__flush_file_cb
*
* Purpose: The callback function for H5Z_unregister. It iterates
* through all opened files and flush them.
@@ -553,11 +617,11 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5Z_get_file_cb(void *obj_ptr, hid_t obj_id, void *key)
+H5Z__flush_file_cb(void *obj_ptr, hid_t UNUSED obj_id, void UNUSED *key)
{
int ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_STATIC
HDassert(obj_ptr);
@@ -565,12 +629,12 @@ H5Z_get_file_cb(void *obj_ptr, hid_t obj_id, void *key)
* if the file is opened for write */
if(H5F_ACC_RDWR & H5F_INTENT((H5F_t *)obj_ptr)) {
if(H5F_flush_mounts((H5F_t *)obj_ptr, H5AC_dxpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy")
} /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_get_file_cb() */
+} /* end H5Z__flush_file_cb() */
/*-------------------------------------------------------------------------
@@ -1238,12 +1302,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags,
FUNC_ENTER_NOAPI(FAIL)
- assert(0==(flags & ~((unsigned)H5Z_FLAG_INVMASK)));
- assert(filter_mask);
- assert(nbytes && *nbytes>0);
- assert(buf_size && *buf_size>0);
- assert(buf && *buf);
- assert(!pline || pline->nused<H5Z_MAX_NFILTERS);
+ HDassert(0==(flags & ~((unsigned)H5Z_FLAG_INVMASK)));
+ HDassert(filter_mask);
+ HDassert(nbytes && *nbytes>0);
+ HDassert(buf_size && *buf_size>0);
+ HDassert(buf && *buf);
+ HDassert(!pline || pline->nused<H5Z_MAX_NFILTERS);
if (pline && (flags & H5Z_FLAG_REVERSE)) { /* Read */
for (i=pline->nused; i>0; --i) {
@@ -1393,8 +1457,8 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter)
FUNC_ENTER_NOAPI(NULL)
- assert(pline);
- assert(filter>=0 && filter<=H5Z_FILTER_MAX);
+ HDassert(pline);
+ HDassert(filter>=0 && filter<=H5Z_FILTER_MAX);
/* Locate the filter in the pipeline */
for(idx=0; idx<pline->nused; idx++)
@@ -1438,8 +1502,8 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter)
FUNC_ENTER_NOAPI(FAIL)
- assert(pline);
- assert(filter>=0 && filter<=H5Z_FILTER_MAX);
+ HDassert(pline);
+ HDassert(filter>=0 && filter<=H5Z_FILTER_MAX);
/* Locate the filter in the pipeline */
for(idx=0; idx<pline->nused; idx++)
@@ -1480,7 +1544,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline)
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
- assert(pline);
+ HDassert(pline);
/* Iterate through all the filters in pipeline */
for(i=0; i<pline->nused; i++) {
@@ -1602,15 +1666,44 @@ done:
herr_t
H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
{
- H5Z_class2_t *fclass;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "Zf*Iu", filter, filter_config_flags);
+ /* Get the filter info */
+ if(H5Z_get_filter_info(filter, filter_config_flags) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Zget_filter_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_get_filter_info
+ *
+ * Purpose: Gets information about a pipeline data filter and stores it
+ * in filter_config_flags.
+ *
+ * Return: zero on success / negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, May 11, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
+{
+ H5Z_class2_t *fclass;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
/* Look up the filter class info */
if(NULL == (fclass = H5Z_find(filter)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Filter not defined")
+ HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined")
/* Set the filter config flags for the application */
if(filter_config_flags != NULL) {
@@ -1623,6 +1716,6 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags)
} /* end if */
done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Zget_filter_info() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5Z_get_filter_info() */
diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c
index d2ad965..8d2643d 100644
--- a/src/H5Zfletcher32.c
+++ b/src/H5Zfletcher32.c
@@ -87,7 +87,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U
FUNC_ENTER_NOAPI(0)
- assert(sizeof(uint32_t)>=4);
+ HDassert(sizeof(uint32_t)>=4);
if (flags & H5Z_FLAG_REVERSE) { /* Read */
/* Do checksum if it's enabled for read; otherwise skip it
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 6c0a46f..bd5bef0 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -74,7 +74,6 @@ struct H5O_pline_t; /*forward decl*/
/* Internal API routines */
H5_DLL herr_t H5Z_init(void);
H5_DLL herr_t H5Z_register(const H5Z_class2_t *cls);
-H5_DLL herr_t H5Z_unregister(H5Z_filter_t id);
H5_DLL herr_t H5Z_append(struct H5O_pline_t *pline, H5Z_filter_t filter,
unsigned flags, size_t cd_nelmts, const unsigned int cd_values[]);
H5_DLL herr_t H5Z_modify(const struct H5O_pline_t *pline, H5Z_filter_t filter,
@@ -93,8 +92,10 @@ H5_DLL H5Z_filter_info_t *H5Z_filter_info(const struct H5O_pline_t *pline,
H5Z_filter_t filter);
H5_DLL htri_t H5Z_filter_in_pline(const struct H5O_pline_t *pline, H5Z_filter_t filter);
H5_DLL htri_t H5Z_all_filters_avail(const struct H5O_pline_t *pline);
+H5_DLL herr_t H5Z_unregister(H5Z_filter_t filter_id);
H5_DLL htri_t H5Z_filter_avail(H5Z_filter_t id);
H5_DLL herr_t H5Z_delete(struct H5O_pline_t *pline, H5Z_filter_t filter);
+H5_DLL herr_t H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags);
/* Data Transform Functions */
typedef struct H5Z_data_xform_t H5Z_data_xform_t; /* Defined in H5Ztrans.c */
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 1538765..0aaff11 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -1164,7 +1164,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
minval |= minval_mask;
}
- assert(minbits <= p.size * 8);
+ HDassert(minbits <= p.size * 8);
p.minbits = minbits;
/* calculate size of output buffer after decompression */
@@ -1241,7 +1241,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "pre-compression failed")
}
- assert(minbits <= p.size * 8);
+ HDassert(minbits <= p.size * 8);
/* calculate buffer size after compression
* minbits and minval are stored in the front of the compressed buffer
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index fd3d90c..4544ec3 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -198,7 +198,7 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
/* Set "local" parameter for this dataset's "pixels-per-scanline" */
/* (Use the chunk's fastest changing dimension size) */
- assert(ndims > 0);
+ HDassert(ndims > 0);
scanline = dims[ndims - 1];
/* Adjust scanline if it is smaller than number of pixels per block or
@@ -288,13 +288,13 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
/* Sanity check to make certain that we haven't drifted out of date with
* the mask options from the szlib.h header */
- assert(H5_SZIP_ALLOW_K13_OPTION_MASK==SZ_ALLOW_K13_OPTION_MASK);
- assert(H5_SZIP_CHIP_OPTION_MASK==SZ_CHIP_OPTION_MASK);
- assert(H5_SZIP_EC_OPTION_MASK==SZ_EC_OPTION_MASK);
- assert(H5_SZIP_LSB_OPTION_MASK==SZ_LSB_OPTION_MASK);
- assert(H5_SZIP_MSB_OPTION_MASK==SZ_MSB_OPTION_MASK);
- assert(H5_SZIP_NN_OPTION_MASK==SZ_NN_OPTION_MASK);
- assert(H5_SZIP_RAW_OPTION_MASK==SZ_RAW_OPTION_MASK);
+ HDassert(H5_SZIP_ALLOW_K13_OPTION_MASK==SZ_ALLOW_K13_OPTION_MASK);
+ HDassert(H5_SZIP_CHIP_OPTION_MASK==SZ_CHIP_OPTION_MASK);
+ HDassert(H5_SZIP_EC_OPTION_MASK==SZ_EC_OPTION_MASK);
+ HDassert(H5_SZIP_LSB_OPTION_MASK==SZ_LSB_OPTION_MASK);
+ HDassert(H5_SZIP_MSB_OPTION_MASK==SZ_MSB_OPTION_MASK);
+ HDassert(H5_SZIP_NN_OPTION_MASK==SZ_NN_OPTION_MASK);
+ HDassert(H5_SZIP_RAW_OPTION_MASK==SZ_RAW_OPTION_MASK);
/* Check arguments */
if (cd_nelmts!=4)
@@ -324,7 +324,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_out=nalloc;
if(SZ_BufftoBuffDecompress(outbuf, &size_out, newbuf, nbytes-4, &sz_param) != SZ_OK)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed")
- assert(size_out==nalloc);
+ HDassert(size_out==nalloc);
/* Free the input buffer */
H5MM_xfree(*buf);
@@ -351,7 +351,7 @@ H5Z_filter_szip (unsigned flags, size_t cd_nelmts, const unsigned cd_values[],
size_out = nbytes;
if(SZ_OK!= SZ_BufftoBuffCompress(dst, &size_out, *buf, nbytes, &sz_param))
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow")
- assert(size_out<=nbytes);
+ HDassert(size_out<=nbytes);
/* Free the input buffer */
H5MM_xfree(*buf);
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 498db03..f9e7186 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -378,7 +378,7 @@ H5Z_unget_token(H5Z_token *current)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
- assert(current);
+ HDassert(current);
current->tok_type = current->tok_last_type;
current->tok_begin = current->tok_last_begin;
@@ -414,7 +414,7 @@ H5Z_get_token(H5Z_token *current)
FUNC_ENTER_NOAPI_NOINIT
/* check args */
- assert(current);
+ HDassert(current);
/* Save the last position for possible ungets */
current->tok_last_type = current->tok_type;
@@ -424,9 +424,9 @@ H5Z_get_token(H5Z_token *current)
current->tok_begin = current->tok_end;
while (current->tok_begin[0] != '\0') {
- if (isspace(current->tok_begin[0])) {
+ if (HDisspace(current->tok_begin[0])) {
/* ignore whitespace */
- } else if (isdigit(current->tok_begin[0]) ||
+ } else if (HDisdigit(current->tok_begin[0]) ||
current->tok_begin[0] == '.') {
current->tok_end = current->tok_begin;
@@ -439,7 +439,7 @@ H5Z_get_token(H5Z_token *current)
/* is number */
current->tok_type = H5Z_XFORM_INTEGER;
- while (isdigit(current->tok_end[0]))
+ while (HDisdigit(current->tok_end[0]))
++current->tok_end;
}
@@ -458,7 +458,7 @@ H5Z_get_token(H5Z_token *current)
if (current->tok_end[0] == '.')
do {
++current->tok_end;
- } while (isdigit(current->tok_end[0]));
+ } while (HDisdigit(current->tok_end[0]));
if (current->tok_end[0] == 'e' ||
current->tok_end[0] == 'E') {
@@ -468,29 +468,29 @@ H5Z_get_token(H5Z_token *current)
current->tok_end[0] == '+')
++current->tok_end;
- if (!isdigit(current->tok_end[0])) {
+ if (!HDisdigit(current->tok_end[0])) {
current->tok_type = H5Z_XFORM_ERROR;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, "Invalidly formatted floating point number")
}
- while (isdigit(current->tok_end[0]))
+ while (HDisdigit(current->tok_end[0]))
++current->tok_end;
}
/* Check that this is a properly formatted numerical value */
- if (isalpha(current->tok_end[0]) || current->tok_end[0] == '.') {
+ if (HDisalpha(current->tok_end[0]) || current->tok_end[0] == '.') {
current->tok_type = H5Z_XFORM_ERROR;
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, "Invalidly formatted floating point number")
}
}
break;
- } else if (isalpha(current->tok_begin[0])) {
+ } else if (HDisalpha(current->tok_begin[0])) {
/* is symbol */
current->tok_type = H5Z_XFORM_SYMBOL;
current->tok_end = current->tok_begin;
- while (isalnum(current->tok_end[0]))
+ while (HDisalnum(current->tok_end[0]))
++current->tok_end;
break;
@@ -995,7 +995,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
H5Z_XFORM_DO_OP5(short, array_size)
else if(array_type == H5T_NATIVE_USHORT)
H5Z_XFORM_DO_OP5(unsigned short, array_size)
- else if( array_type == H5T_NATIVE_INT)
+ else if(array_type == H5T_NATIVE_INT)
H5Z_XFORM_DO_OP5(int, array_size)
else if(array_type == H5T_NATIVE_UINT)
H5Z_XFORM_DO_OP5(unsigned int, array_size)
@@ -1026,10 +1026,10 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
/* If it's a quadratic transform, we have no choice but to store multiple copies of the data */
else {
for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++) {
- if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5Tget_size(array_type))))
+ if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5T_get_size((H5T_t *)H5I_object(array_type)))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "Ran out of memory trying to allocate space for data in data transform")
- HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5Tget_size(array_type));
+ HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
} /* end for */
} /* end else */
@@ -1037,7 +1037,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform")
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
- HDmemcpy(array, res.value.dat_val, array_size * H5Tget_size(array_type));
+ HDmemcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type)));
/* Free the temporary arrays we used */
if(data_xform_prop->dat_val_pointers->num_ptrs > 1)
@@ -1175,60 +1175,60 @@ H5Z_xform_find_type(const H5T_t* type)
HDassert(type);
/* Check for SHORT type */
- if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE))
+ if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_SHORT))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SHORT)
/* Check for INT type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_INT))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_INT)
/* Check for LONG type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LONG))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LONG)
/* Check for LONGLONG type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LLONG))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LLONG)
/* Check for UCHAR type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UCHAR)
/* Check for CHAR type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_CHAR))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_CHAR)
/* Check for SCHAR type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_SCHAR))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_SCHAR)
/* Check for USHORT type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_USHORT))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_USHORT)
/* Check for UINT type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_UINT))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_UINT)
/* Check for ULONG type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_ULONG))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULONG)
/* Check for ULONGLONG type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_ULLONG)
/* Check for FLOAT type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_FLOAT)
/* Check for DOUBLE type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_DOUBLE)
#if H5_SIZEOF_LONG_DOUBLE !=0
/* Check for LONGDOUBLE type */
- else if((tmp = (H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE))
+ else if((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE))
&& 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
#endif
@@ -1258,7 +1258,7 @@ H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datva
FUNC_ENTER_NOAPI(NULL)
- assert(tree);
+ HDassert(tree);
if(tree->type == H5Z_XFORM_INTEGER)
{
@@ -1335,7 +1335,7 @@ H5Z_op_is_numbs(H5Z_node* _tree)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(_tree);
+ HDassert(_tree);
if(((_tree->lchild->type == H5Z_XFORM_INTEGER) || (_tree->lchild->type == H5Z_XFORM_FLOAT)) && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT)))
ret_value = TRUE;
@@ -1364,7 +1364,7 @@ H5Z_op_is_numbs2(H5Z_node* _tree)
FUNC_ENTER_NOAPI_NOINIT_NOERR
- assert(_tree);
+ HDassert(_tree);
if((!_tree->lchild && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT))) ||
((_tree->lchild && ((_tree->lchild->type == H5Z_XFORM_INTEGER) || (_tree->lchild->type == H5Z_XFORM_FLOAT))) && (_tree->rchild && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT)))))
@@ -1494,7 +1494,7 @@ H5Z_xform_create(const char *expr)
FUNC_ENTER_NOAPI(NULL)
- assert(expr);
+ HDassert(expr);
/* Allocate space for the data transform information */
if(NULL == (data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t))))
@@ -1740,7 +1740,7 @@ H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop)
/* There should be no way that this can be NULL since the function
* that calls this one checks to make sure it isn't before
* pasing them */
- assert(data_xform_prop);
+ HDassert(data_xform_prop);
FUNC_LEAVE_NOAPI(data_xform_prop->xform_exp)
} /* H5Z_xform_extract_xform_str() */
diff --git a/src/H5detect.c b/src/H5detect.c
index d6f6a3b..2bf0d2d 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -246,7 +246,7 @@ precision (detected_t *d)
_v = (_v << 8) + _i; \
for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(TYPE); _i++) { \
_j = (*_x++) - 1; \
- assert(_j < (signed)sizeof(TYPE)); \
+ HDassert(_j < (signed)sizeof(TYPE)); \
INFO.perm[_i] = _j; \
} /* end for */ \
} else { /*Not able to detect order if type size is 1 byte. Use native int \
@@ -255,7 +255,7 @@ precision (detected_t *d)
_int_v = (_int_v << 8) + _i; \
for(_i = 0, _x = (unsigned char *)&_int_v; _i < (signed)sizeof(int); _i++) { \
_j = (*_x++)-1; \
- assert(_j < (signed)sizeof(int)); \
+ HDassert(_j < (signed)sizeof(int)); \
INFO.perm[_i] = _j; \
} /* end for */ \
} /* end else */ \
@@ -296,23 +296,23 @@ precision (detected_t *d)
int _i, _j, _last = (-1); \
char *_mesg; \
\
- memset(&INFO, 0, sizeof(INFO)); \
+ HDmemset(&INFO, 0, sizeof(INFO)); \
INFO.varname = #VAR; \
INFO.size = sizeof(TYPE); \
\
/* Completely initialize temporary variables, in case the bits used in */ \
/* the type take less space than the number of bits used to store the type */ \
- memset(&_v3, 0, sizeof(TYPE)); \
- memset(&_v2, 0, sizeof(TYPE)); \
- memset(&_v1, 0, sizeof(TYPE)); \
+ HDmemset(&_v3, 0, sizeof(TYPE)); \
+ HDmemset(&_v2, 0, sizeof(TYPE)); \
+ HDmemset(&_v1, 0, sizeof(TYPE)); \
\
/* Byte Order */ \
for(_i = 0, _v1 = 0.0, _v2 = 1.0; _i < (int)sizeof(TYPE); _i++) { \
_v3 = _v1; \
_v1 += _v2; \
_v2 /= 256.0; \
- memcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \
- memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \
+ HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \
+ HDmemcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \
_j = byte_cmp(sizeof(TYPE), &_buf3, &_buf1); \
if(_j >= 0) { \
INFO.perm[_i] = _j; \
@@ -321,7 +321,7 @@ precision (detected_t *d)
} \
fix_order(sizeof(TYPE), _last, INFO.perm, (const char**)&_mesg); \
\
- if(!strcmp(_mesg, "VAX")) \
+ if(!HDstrcmp(_mesg, "VAX")) \
INFO.is_vax = TRUE; \
\
/* Implicit mantissa bit */ \
@@ -351,8 +351,8 @@ precision (detected_t *d)
INFO.bias = find_bias (INFO.epos, INFO.esize, INFO.perm, &_v1); \
precision (&(INFO)); \
ALIGNMENT(TYPE, INFO); \
- if(!strcmp(INFO.varname, "FLOAT") || !strcmp(INFO.varname, "DOUBLE") || \
- !strcmp(INFO.varname, "LDOUBLE")) { \
+ if(!HDstrcmp(INFO.varname, "FLOAT") || !HDstrcmp(INFO.varname, "DOUBLE") || \
+ !HDstrcmp(INFO.varname, "LDOUBLE")) { \
COMP_ALIGNMENT(TYPE,INFO.comp_align); \
} \
}
@@ -399,7 +399,7 @@ precision (detected_t *d)
void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \
void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler);\
\
- _buf = (char*)malloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \
+ _buf = (char*)HDmalloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]); \
if(H5SETJMP(jbuf_g)) _ano++; \
if(_ano < NELMTS(align_g)) { \
*((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/ \
@@ -409,12 +409,12 @@ precision (detected_t *d)
/* pointer values when pointing to non-word aligned */ \
/* locations with pointers that are supposed to be */ \
/* word aligned. -QAK */ \
- memset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
+ HDmemset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \
/*How to handle VAX types?*/ \
if(INFO.perm[0]) /* Big-Endian */ \
- memcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \
+ HDmemcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \
else /* Little-Endian */ \
- memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \
+ HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \
_val2 = *((TYPE*)(_buf+align_g[_ano])); \
if(_val!=_val2) \
H5LONGJMP(jbuf_g, 1); \
@@ -424,7 +424,7 @@ precision (detected_t *d)
(INFO.align)=0; \
fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE); \
} \
- free(_buf); \
+ HDfree(_buf); \
HDsignal(SIGBUS, _handler); /*restore original handler*/ \
HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \
}
@@ -669,7 +669,7 @@ H5TN_init_interface(void)\n\
dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;\n",
d[i].offset, /*offset */
d[i].precision); /*precision */
- /*assert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */
+ /*HDassert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */
if (0 == d[i].msize) {
/* The part unique to fixed point types */
@@ -705,10 +705,10 @@ H5TN_init_interface(void)\n\
d[i].varname, (unsigned long)(d[i].align));
/* Variables for alignment of compound datatype */
- if(!strcmp(d[i].varname, "SCHAR") || !strcmp(d[i].varname, "SHORT") ||
- !strcmp(d[i].varname, "INT") || !strcmp(d[i].varname, "LONG") ||
- !strcmp(d[i].varname, "LLONG") || !strcmp(d[i].varname, "FLOAT") ||
- !strcmp(d[i].varname, "DOUBLE") || !strcmp(d[i].varname, "LDOUBLE")) {
+ if(!HDstrcmp(d[i].varname, "SCHAR") || !HDstrcmp(d[i].varname, "SHORT") ||
+ !HDstrcmp(d[i].varname, "INT") || !HDstrcmp(d[i].varname, "LONG") ||
+ !HDstrcmp(d[i].varname, "LLONG") || !HDstrcmp(d[i].varname, "FLOAT") ||
+ !HDstrcmp(d[i].varname, "DOUBLE") || !HDstrcmp(d[i].varname, "LDOUBLE")) {
printf(" H5T_NATIVE_%s_COMP_ALIGN_g = %lu;\n",
d[i].varname, (unsigned long)(d[i].comp_align));
}
@@ -823,7 +823,7 @@ iprint(detected_t *d)
printf(" * ");
for (i=MIN(pass*4+3,d->size-1); i>=pass*4; --i) {
printf ("%4d", d->perm[i]);
- if (i>pass*4) fputs (" ", stdout);
+ if (i>pass*4) HDfputs (" ", stdout);
}
/*
@@ -835,23 +835,23 @@ iprint(detected_t *d)
i>=pass*4; --i) {
for (j=7; j>=0; --j) {
if (k==d->sign && d->msize) {
- putchar('S');
+ HDputchar('S');
} else if (k>=d->epos && k<d->epos+d->esize) {
- putchar('E');
+ HDputchar('E');
} else if (k>=d->mpos && k<d->mpos+d->msize) {
- putchar('M');
+ HDputchar('M');
} else if (d->msize) {
- putchar('?'); /*unknown floating point bit */
+ HDputchar('?'); /*unknown floating point bit */
} else if (d->sign) {
- putchar('I');
+ HDputchar('I');
} else {
- putchar('U');
+ HDputchar('U');
}
--k;
}
- if (i>pass*4) putchar(' ');
+ if (i>pass*4) HDputchar(' ');
}
- putchar('\n');
+ HDputchar('\n');
}
/*
@@ -934,13 +934,13 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b)
unsigned char aa, bb;
for (i = 0; i < nbytes; i++) {
- assert(perm[i] < nbytes);
+ HDassert(perm[i] < nbytes);
if ((aa = a[perm[i]]) != (bb = b[perm[i]])) {
for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) {
if ((aa & 1) != (bb & 1)) return i * 8 + j;
}
- assert("INTERNAL ERROR" && 0);
- abort();
+ HDassert("INTERNAL ERROR" && 0);
+ HDabort();
}
}
return -1;
@@ -998,7 +998,7 @@ fix_order(int n, int last, int *perm, const char **mesg)
* It could have some other endianess and fall into this
* case - JKM & QAK)
*/
- assert(0 == n % 2);
+ HDassert(0 == n % 2);
if (mesg) *mesg = "VAX";
for (i = 0; i < n; i += 2) {
perm[i] = (n - 2) - i;
@@ -1008,7 +1008,7 @@ fix_order(int n, int last, int *perm, const char **mesg)
} else {
fprintf(stderr,
"Failed to detect byte order of %d-byte floating point.\n", n);
- exit(1);
+ HDexit(1);
}
}
@@ -1062,7 +1062,7 @@ imp_bit(int n, int *perm, volatile void *_a, volatile void *_b)
* A and B. This is the least significant bit of the exponent.
*/
changed = bit_cmp(n, perm, a, b);
- assert(changed >= 0);
+ HDassert(changed >= 0);
/*
* The bit to the right (less significant) of the changed bit should
@@ -1139,8 +1139,8 @@ static void
print_header(void)
{
- time_t now = time(NULL);
- struct tm *tm = localtime(&now);
+ time_t now = HDtime(NULL);
+ struct tm *tm = HDlocaltime(&now);
char real_name[30];
char host_name[256];
int i;
@@ -1199,13 +1199,13 @@ bit.\n";
{
size_t n;
char *comma;
- if ((pwd = getpwuid(getuid()))) {
- if ((comma = strchr(pwd->pw_gecos, ','))) {
+ if ((pwd = HDgetpwuid(HDgetuid()))) {
+ if ((comma = HDstrchr(pwd->pw_gecos, ','))) {
n = MIN(sizeof(real_name)-1, (unsigned)(comma-pwd->pw_gecos));
- strncpy(real_name, pwd->pw_gecos, n);
+ HDstrncpy(real_name, pwd->pw_gecos, n);
real_name[n] = '\0';
} else {
- strncpy(real_name, pwd->pw_gecos, sizeof(real_name));
+ HDstrncpy(real_name, pwd->pw_gecos, sizeof(real_name));
real_name[sizeof(real_name) - 1] = '\0';
}
} else {
@@ -1220,7 +1220,7 @@ bit.\n";
* The FQDM of this host or the empty string.
*/
#ifdef H5_HAVE_GETHOSTNAME
- if (gethostname(host_name, sizeof(host_name)) < 0) {
+ if (HDgethostname(host_name, sizeof(host_name)) < 0) {
host_name[0] = '\0';
}
#else
@@ -1231,7 +1231,7 @@ bit.\n";
* The file header: warning, copyright notice, build information.
*/
printf("/* Generated automatically by H5detect -- do not edit */\n\n\n");
- puts(FileHeader); /*the copyright notice--see top of this file */
+ HDputs(FileHeader); /*the copyright notice--see top of this file */
printf(" *\n * Created:\t\t%s %2d, %4d\n",
month_name[tm->tm_mon], tm->tm_mday, 1900 + tm->tm_year);
@@ -1239,15 +1239,15 @@ bit.\n";
printf(" *\t\t\t");
if (real_name[0]) printf("%s <", real_name);
#ifdef H5_HAVE_GETPWUID
- if (pwd) fputs(pwd->pw_name, stdout);
+ if (pwd) HDfputs(pwd->pw_name, stdout);
#endif
if (host_name[0]) printf("@%s", host_name);
if (real_name[0]) printf(">");
- putchar('\n');
+ HDputchar('\n');
}
printf(" *\n * Purpose:\t\t");
for (s = purpose; *s; s++) {
- putchar(*s);
+ HDputchar(*s);
if ('\n' == *s && s[1]) printf(" *\t\t\t");
}
@@ -1256,7 +1256,7 @@ bit.\n";
printf(" *\tIt was generated by code in `H5detect.c'.\n");
printf(" *\n *");
- for (i = 0; i < 73; i++) putchar('-');
+ for (i = 0; i < 73; i++) HDputchar('-');
printf("\n */\n\n");
}
@@ -1645,7 +1645,7 @@ main(void)
nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS;
if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0)<0) {
fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n",
- strerror(errno));
+ HDstrerror(errno));
}
#endif
#endif
diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c
index d903592..fa00c64 100644
--- a/src/H5make_libsettings.c
+++ b/src/H5make_libsettings.c
@@ -94,7 +94,7 @@ insert_libhdf5_settings(FILE *flibinfo)
else
HDputc(inchar, flibinfo);
} /* end while */
- if(feof(fsettings)) {
+ if(HDfeof(fsettings)) {
/* wrap up */
if(!bol)
/* EOF found without a new line */
@@ -182,7 +182,7 @@ information about the library build configuration\n";
size_t n;
char *comma;
- if((pwd = HDgetpwuid(getuid()))) {
+ if((pwd = HDgetpwuid(HDgetuid()))) {
if((comma = HDstrchr(pwd->pw_gecos, ','))) {
n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos));
HDstrncpy(real_name, pwd->pw_gecos, n);
@@ -204,7 +204,7 @@ information about the library build configuration\n";
* The FQDM of this host or the empty string.
*/
#ifdef H5_HAVE_GETHOSTNAME
- if(gethostname(host_name, sizeof(host_name)) < 0)
+ if(HDgethostname(host_name, sizeof(host_name)) < 0)
host_name[0] = '\0';
#else
host_name[0] = '\0';
diff --git a/src/H5private.h b/src/H5private.h
index 731a7f6..2701c63 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -844,6 +844,9 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#ifndef HDgetgroups
#define HDgetgroups(Z,G) getgroups(Z,G)
#endif /* HDgetgroups */
+#ifndef HDgethostname
+ #define HDgethostname(N,L) gethostname(N,L)
+#endif /* HDgetlogin */
#ifndef HDgetlogin
#define HDgetlogin() getlogin()
#endif /* HDgetlogin */
diff --git a/src/H5system.c b/src/H5system.c
index 3ffe411..a93a128 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -117,8 +117,8 @@ HDfprintf(FILE *stream, const char *fmt, ...)
const char *s;
va_list ap;
- assert (stream);
- assert (fmt);
+ HDassert(stream);
+ HDassert(fmt);
va_start (ap, fmt);
while (*fmt) {
diff --git a/src/H5timer.c b/src/H5timer.c
index 7bdee8a..301d98b 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -97,8 +97,8 @@
void
H5_timer_reset (H5_timer_t *timer)
{
- assert (timer);
- HDmemset (timer, 0, sizeof *timer);
+ HDassert(timer);
+ HDmemset(timer, 0, sizeof *timer);
} /* end H5_timer_reset() */
@@ -126,7 +126,7 @@ H5_timer_begin (H5_timer_t *timer)
struct timeval etime;
#endif
- assert (timer);
+ HDassert(timer);
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage (RUSAGE_SELF, &rusage);
@@ -169,7 +169,7 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
{
H5_timer_t now;
- assert (timer);
+ HDassert(timer);
H5_timer_begin (&now);
timer->utime = MAX(0.0, now.utime - timer->utime);
@@ -220,7 +220,7 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
HDstrcpy(buf, " NaN");
else {
bw = nbytes/nseconds;
- if(fabs(bw) < 0.0000000001)
+ if(HDfabs(bw) < 0.0000000001)
/* That is == 0.0, but direct comparison between floats is bad */
HDstrcpy(buf, "0.000 B/s");
else if(bw < 1.0)
diff --git a/src/H5trace.c b/src/H5trace.c
index 92736d4..2babcd4 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -156,7 +156,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
/* Get tim for event */
- if(fabs(first_time.etime) < 0.0000000001)
+ if(HDfabs(first_time.etime) < 0.0000000001)
/* That is == 0.0, but direct comparison between floats is bad */
H5_timer_begin(&first_time);
if(H5_debug_g.ttimes)
@@ -179,10 +179,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
char tmp[128];
sprintf(tmp, "%.6f", event_time.etime-first_time.etime);
- fprintf(out, " %*s ", (int)strlen(tmp), "");
+ fprintf(out, " %*s ", (int)HDstrlen(tmp), "");
} /* end if */
for(i = 0; i < current_depth; i++)
- fputc('+', out);
+ HDfputc('+', out);
fprintf(out, "%*s%s = ", 2*current_depth, "", func);
} /* end if */
else {
@@ -192,11 +192,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
} /* end if */
else {
if(current_depth>last_call_depth)
- fputs(" = <delayed>\n", out);
+ HDfputs(" = <delayed>\n", out);
if(H5_debug_g.ttimes)
fprintf(out, "@%.6f ", event_time.etime - first_time.etime);
for(i = 0; i < current_depth; i++)
- fputc('+', out);
+ HDfputc('+', out);
fprintf(out, "%*s%s(", 2*current_depth, "", func);
} /* end else */