summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hl/test/test_dset_append.c1
-rw-r--r--hl/test/test_dset_opt.c1
-rw-r--r--src/H5Dchunk.c19
-rw-r--r--src/H5Dfill.c25
-rw-r--r--src/H5Dio.c37
-rw-r--r--src/H5Dscatgath.c333
-rw-r--r--src/H5Dselect.c84
-rw-r--r--src/H5FDfamily.c44
-rw-r--r--src/H5FL.c18
-rw-r--r--src/H5FLprivate.h12
-rw-r--r--src/H5HFcache.c4
-rw-r--r--src/H5Oalloc.c5
-rw-r--r--src/H5Ocache.c4
-rw-r--r--src/H5Pfapl.c2
-rw-r--r--src/H5Shyper.c60
-rw-r--r--src/H5Sselect.c111
-rw-r--r--src/H5system.c29
-rw-r--r--src/H5timer.c38
-rw-r--r--test/cmpd_dset.c185
-rw-r--r--test/dsets.c659
-rw-r--r--test/file_image.c1
-rw-r--r--test/filter_fail.c1
-rw-r--r--test/freespace.c16
-rw-r--r--test/getname.c89
-rw-r--r--test/links.c1
-rw-r--r--test/mtime.c2
-rw-r--r--test/ohdr.c1
-rw-r--r--test/set_extent.c6
-rw-r--r--test/testframe.c4
-rw-r--r--test/tmeta.c2
-rw-r--r--test/tvltypes.c94
-rw-r--r--test/vds.c1
-rw-r--r--testpar/t_shapesame.c16
-rw-r--r--tools/h5copy/h5copy.c24
-rw-r--r--tools/h5diff/h5diff_main.c5
-rw-r--r--tools/h5diff/h5diffgentest.c217
-rw-r--r--tools/h5format_convert/h5fc_gentest.c4
-rw-r--r--tools/h5jam/h5unjam.c10
-rw-r--r--tools/h5ls/h5ls.c10
-rw-r--r--tools/h5repack/h5repack.c5
-rw-r--r--tools/h5repack/h5repack_filters.c17
-rw-r--r--tools/lib/h5tools_filters.c4
-rw-r--r--tools/lib/h5tools_ref.c2
-rw-r--r--tools/perform/sio_engine.c32
-rw-r--r--tools/perform/sio_perf.c89
-rw-r--r--tools/perform/sio_perf.h32
-rw-r--r--tools/perform/zip_perf.c24
47 files changed, 1316 insertions, 1064 deletions
diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c
index 0f193d9..57dab81 100644
--- a/hl/test/test_dset_append.c
+++ b/hl/test/test_dset_append.c
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
-#include "H5srcdir.h"
#include "H5DOpublic.h"
#include <math.h>
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
index c1e369e..b03ab44 100644
--- a/hl/test/test_dset_opt.c
+++ b/hl/test/test_dset_opt.c
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <string.h>
#include "h5hltest.h"
-#include "H5srcdir.h"
#include "H5DOpublic.h"
#include <math.h>
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 8cf86ac..dde83fe 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -364,6 +364,9 @@ H5FL_DEFINE(H5D_chunk_info_t);
/* Declare a free list to manage the chunk sequence information */
H5FL_BLK_DEFINE_STATIC(chunk);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*-------------------------------------------------------------------------
* Function: H5D__chunk_direct_write
@@ -4557,14 +4560,14 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */
unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */
const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */
- H5S_sel_iter_t chunk_iter; /* Memory selection iteration info */
+ H5S_sel_iter_t *chunk_iter = NULL; /* Memory selection iteration info */
+ hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
hssize_t sel_nelmts; /* Number of elements in selection */
hsize_t count[H5O_LAYOUT_NDIMS]; /* Element count of hyperslab */
size_t chunk_size; /*size of a chunk */
void *chunk; /* The file chunk */
H5D_chunk_ud_t chk_udata; /* User data for locking chunk */
uint32_t bytes_accessed; /* Bytes accessed in chunk */
- hbool_t chunk_iter_init = FALSE; /* Whether the chunk iterator has been initialized */
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4629,13 +4632,17 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->md_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
+ /* Allocate the chunk selection iterator */
+ if(NULL == (chunk_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator")
+
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(&chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank]) < 0)
+ if(H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information")
chunk_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(udata->fb_info.fill_buf, udata->chunk_space, &chunk_iter, (size_t)sel_nelmts, io_info->dxpl_cache, chunk/*out*/) < 0)
+ if(H5D__scatter_mem(udata->fb_info.fill_buf, udata->chunk_space, chunk_iter, (size_t)sel_nelmts, io_info->dxpl_cache, chunk/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
@@ -4650,8 +4657,10 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk)
done:
/* Release the selection iterator */
- if(chunk_iter_init && H5S_SELECT_ITER_RELEASE(&chunk_iter) < 0)
+ if(chunk_iter_init && H5S_SELECT_ITER_RELEASE(chunk_iter) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(chunk_iter)
+ chunk_iter = H5FL_FREE(H5S_sel_iter_t, chunk_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_prune_fill */
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index e5b2161..50c964b 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -88,6 +88,9 @@ H5FL_BLK_DEFINE_STATIC(non_zero_fill);
/* Declare the free list to manage blocks of zero fill-value data */
H5FL_BLK_DEFINE_STATIC(zero_fill);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*--------------------------------------------------------------------------
NAME
@@ -174,6 +177,8 @@ herr_t
H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id)
{
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Whether the memory selection iterator has been initialized */
H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */
uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */
H5WB_t *bkg_elem_wb = NULL; /* Wrapped buffer for background data */
@@ -246,7 +251,6 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(TRUE == H5T_detect_class(fill_type, H5T_VLEN, FALSE)) {
H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */
H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */
- H5S_sel_iter_t mem_iter; /* Memory selection iteration info */
hssize_t nelmts; /* Number of data elements */
/* Get the number of elements in the selection */
@@ -273,19 +277,18 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache")
+ /* Allocate the chunk selection iterator */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator")
+
/* Create a selection iterator for scattering the elements to memory buffer */
- if(H5S_select_iter_init(&mem_iter, space, dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, space, dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
+ mem_iter_init = TRUE;
/* Scatter the data into memory */
- if(H5D__scatter_mem(tmp_buf, space, &mem_iter, (size_t)nelmts, dxpl_cache, buf/*out*/) < 0) {
- H5S_SELECT_ITER_RELEASE(&mem_iter);
+ if(H5D__scatter_mem(tmp_buf, space, mem_iter, (size_t)nelmts, dxpl_cache, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
- } /* end if */
-
- /* Release the selection iterator */
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
else {
const uint8_t *fill_buf; /* Buffer to use for writing fill values */
@@ -335,6 +338,10 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf,
} /* end else */
done:
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
if(src_id != (-1) && H5I_dec_ref(src_id) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID")
if(dst_id != (-1) && H5I_dec_ref(dst_id) < 0)
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 5004132..f5087da 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -87,6 +87,9 @@ static herr_t H5D__typeinfo_term(const H5D_type_info_t *type_info);
/* Declare a free list to manage blocks of type conversion data */
H5FL_BLK_DEFINE(type_conv);
+/* Declare a free list to manage the H5D_chunk_map_t struct */
+H5FL_DEFINE(H5D_chunk_map_t);
+
/*-------------------------------------------------------------------------
@@ -366,7 +369,7 @@ 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*/)
{
- H5D_chunk_map_t fm; /* Chunk file<->memory mapping */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_type_info_t type_info; /* Datatype info for operation */
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
@@ -523,26 +526,31 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
|| dataset->shared->dcpl_cache.efl.nused > 0
|| dataset->shared->layout.type == H5D_COMPACT);
+ /* Allocate the chunk map */
+ if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
+
/* Call storage method's I/O initialization routine */
- HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data")
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
+ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+ if(fm)
+ fm = H5FL_FREE(H5D_chunk_map_t, fm);
if(io_info_init) {
#ifdef H5_DEBUG_BUILD
@@ -587,7 +595,7 @@ herr_t
H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, const void *buf)
{
- H5D_chunk_map_t fm; /* Chunk file<->memory mapping */
+ H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */
H5D_io_info_t io_info; /* Dataset I/O info */
H5D_type_info_t type_info; /* Datatype info for operation */
hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */
@@ -765,20 +773,23 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
} /* end if */
+ /* Allocate the chunk map */
+ if(NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map")
+
/* Call storage method's I/O initialization routine */
- HDmemset(&fm, 0, sizeof(H5D_chunk_map_t));
- if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info")
io_op_init = TRUE;
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel I/O */
- if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, &fm) < 0)
+ if(H5D__ioinfo_adjust(&io_info, dataset, dxpl_id, file_space, mem_space, &type_info, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O")
#endif /*H5_HAVE_PARALLEL*/
/* Invoke correct "high level" I/O routine */
- if((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0)
+ if((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data")
#ifdef OLD_WAY
@@ -801,8 +812,10 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
done:
/* Shut down the I/O op information */
- if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0)
+ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info")
+ if(fm)
+ fm = H5FL_FREE(H5D_chunk_map_t, fm);
if(io_info_init) {
#ifdef H5_DEBUG_BUILD
diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c
index 7c1abca..55111f0 100644
--- a/src/H5Dscatgath.c
+++ b/src/H5Dscatgath.c
@@ -67,10 +67,13 @@ static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type
/* Local Variables */
/*******************/
-/* Declare a free list to manage sequences of size_t */
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
+/* Declare extern free list to manage sequences of size_t */
H5FL_SEQ_EXTERN(size_t);
-/* Declare a free list to manage sequences of hsize_t */
+/* Declare extern free list to manage sequences of hsize_t */
H5FL_SEQ_EXTERN(hsize_t);
@@ -97,17 +100,16 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
const void *_buf)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
hsize_t mem_off; /* Offset in memory */
size_t mem_curr_seq; /* "Current sequence" in memory */
size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Array to store sequence lengths */
size_t orig_mem_len, mem_len; /* Length of sequence in memory */
- size_t nseq; /* Number of sequences generated */
- size_t nelem; /* Number of elements used in sequences */
- herr_t ret_value = SUCCEED; /* Return value */
+ size_t nseq; /* Number of sequences generated */
+ size_t nelem; /* Number of elements used in sequences */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -124,21 +126,19 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
tmp_io_info.u.wbuf = _buf;
/* Allocate the vector I/O arrays */
- if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = tmp_io_info.dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, tmp_io_info.dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Reset the current sequence information */
@@ -160,9 +160,9 @@ H5D__scatter_file(const H5D_io_info_t *_io_info,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -196,16 +196,15 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
void *_buf/*out*/)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
hsize_t mem_off; /* Offset in memory */
size_t mem_curr_seq; /* "Current sequence" in memory */
size_t dset_curr_seq; /* "Current sequence" in dataset */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Pointer to sequence lengths */
size_t orig_mem_len, mem_len; /* Length of sequence in memory */
size_t nseq; /* Number of sequences generated */
size_t nelem; /* Number of elements used in sequences */
+ size_t vec_size; /* Vector length */
size_t ret_value = nelmts; /* Return value */
FUNC_ENTER_STATIC
@@ -225,21 +224,19 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
tmp_io_info.u.rbuf = _buf;
/* Allocate the vector I/O arrays */
- if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, tmp_io_info.dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = tmp_io_info.dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* Loop until all elements are read */
while(nelmts > 0) {
/* Get list of sequences for selection to read */
- if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, tmp_io_info.dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, H5S_GET_SEQ_LIST_SORTED, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Reset the current sequence information */
@@ -261,9 +258,9 @@ H5D__gather_file(const H5D_io_info_t *_io_info,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -292,15 +289,14 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
{
uint8_t *buf = (uint8_t *)_buf; /* Get local copies for address arithmetic */
const uint8_t *tscat_buf = (const uint8_t *)_tscat_buf;
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t *len = NULL; /* Pointer to sequence lengths */
+ hsize_t *off = NULL; /* Pointer to sequence offsets */
+ size_t *len = NULL; /* Pointer to sequence lengths */
size_t curr_len; /* Length of bytes left to process in sequence */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequence being processed */
size_t nelem; /* Number of elements used in sequences */
- herr_t ret_value = SUCCEED; /* Number of elements scattered */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Number of elements scattered */
FUNC_ENTER_PACKAGE
@@ -312,21 +308,19 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
HDassert(buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -346,9 +340,9 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -379,15 +373,14 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
{
const uint8_t *buf = (const uint8_t *)_buf; /* Get local copies for address arithmetic */
uint8_t *tgath_buf = (uint8_t *)_tgath_buf;
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
- size_t *len = NULL; /* Pointer to sequence lengths */
+ size_t *len = NULL; /* Pointer to sequence lengths */
size_t curr_len; /* Length of bytes left to process in sequence */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequence being processed */
size_t nelem; /* Number of elements used in sequences */
- size_t ret_value = nelmts; /* Number of elements gathered */
+ size_t vec_size; /* Vector length */
+ size_t ret_value = nelmts; /* Number of elements gathered */
FUNC_ENTER_STATIC
@@ -399,21 +392,19 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
HDassert(tgath_buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array")
/* Loop until all elements are written */
while(nelmts > 0) {
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, dxpl_cache->vec_size, nelmts, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -433,9 +424,9 @@ H5D__gather_mem(const void *_buf, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -460,15 +451,15 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
{
const H5D_dxpl_cache_t *dxpl_cache = io_info->dxpl_cache; /* Local pointer to dataset transfer info */
void *buf = io_info->u.rbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /*memory selection iteration info has been initialized */
- H5S_sel_iter_t bkg_iter; /*background iteration info*/
- hbool_t bkg_iter_init = FALSE; /*background iteration info has been initialized */
- H5S_sel_iter_t file_iter; /*file selection iteration info*/
- hbool_t file_iter_init = FALSE; /*file selection iteration info has been initialized */
- hsize_t smine_start; /*strip mine start loc */
- size_t smine_nelmts; /*elements per strip */
- herr_t ret_value = SUCCEED; /*return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -483,14 +474,22 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
if(nelmts == 0)
HGOTO_DONE(SUCCEED)
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
+
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(&file_iter, file_space, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, type_info->src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(&mem_iter, mem_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(&bkg_iter, mem_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@@ -499,7 +498,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
- HDassert(H5S_SELECT_ITER_NELMTS(&file_iter) == (nelmts - smine_start));
+ HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start));
/*
@@ -511,8 +510,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/*
* Gather data
*/
- n = H5D__gather_file(io_info, file_space, &file_iter, smine_nelmts,
- type_info->tconv_buf/*out*/);
+ n = H5D__gather_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
@@ -521,14 +519,12 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
* bypass the rest of steps.
*/
if(type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) {
- if(H5D__compound_opt_read(smine_nelmts, mem_space, &mem_iter, dxpl_cache,
- type_info, buf /*out*/) < 0)
+ if(H5D__compound_opt_read(smine_nelmts, mem_space, mem_iter, dxpl_cache, type_info, buf /*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed")
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_mem(buf, mem_space, &bkg_iter, smine_nelmts,
- dxpl_cache, type_info->bkg_buf/*out*/);
+ n = H5D__gather_mem(buf, mem_space, bkg_iter, smine_nelmts, dxpl_cache, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed")
} /* end if */
@@ -549,26 +545,25 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
/*
* Scatter the data into memory.
*/
- if(H5D__scatter_mem(type_info->tconv_buf, mem_space, &mem_iter,
- smine_nelmts, dxpl_cache, buf/*out*/) < 0)
+ if(H5D__scatter_mem(type_info->tconv_buf, mem_space, mem_iter, smine_nelmts, dxpl_cache, buf/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed")
} /* end else */
} /* end for */
done:
/* Release selection iterators */
- if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
+ if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(bkg_iter)
+ bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_read() */
@@ -592,15 +587,15 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
{
const H5D_dxpl_cache_t *dxpl_cache = io_info->dxpl_cache; /* Local pointer to dataset transfer info */
const void *buf = io_info->u.wbuf; /* Local pointer to application buffer */
- H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
- hbool_t mem_iter_init = FALSE; /*memory selection iteration info has been initialized */
- H5S_sel_iter_t bkg_iter; /*background iteration info*/
- hbool_t bkg_iter_init = FALSE; /*background iteration info has been initialized */
- H5S_sel_iter_t file_iter; /*file selection iteration info*/
- hbool_t file_iter_init = FALSE; /*file selection iteration info has been initialized */
- hsize_t smine_start; /*strip mine start loc */
- size_t smine_nelmts; /*elements per strip */
- herr_t ret_value = SUCCEED; /*return value */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/
+ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info*/
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
+ hsize_t smine_start; /* Strip mine start loc */
+ size_t smine_nelmts; /* Elements per strip */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -615,14 +610,22 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
if(nelmts == 0)
HGOTO_DONE(SUCCEED)
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
+
/* Figure out the strip mine size. */
- if(H5S_select_iter_init(&file_iter, file_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information")
file_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(&mem_iter, mem_space, type_info->src_type_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information")
mem_iter_init = TRUE; /*file selection iteration info has been initialized */
- if(H5S_select_iter_init(&bkg_iter, file_space, type_info->dst_type_size) < 0)
+ if(H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information")
bkg_iter_init = TRUE; /*file selection iteration info has been initialized */
@@ -631,7 +634,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
size_t n; /* Elements operated on */
/* Go figure out how many elements to read from the file */
- HDassert(H5S_SELECT_ITER_NELMTS(&file_iter) == (nelmts - smine_start));
+ HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start));
smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start));
/*
@@ -639,8 +642,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
* buffer. Also gather data from the file into the background buffer
* if necessary.
*/
- n = H5D__gather_mem(buf, mem_space, &mem_iter, smine_nelmts,
- dxpl_cache, type_info->tconv_buf/*out*/);
+ n = H5D__gather_mem(buf, mem_space, mem_iter, smine_nelmts, dxpl_cache, type_info->tconv_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed")
@@ -657,8 +659,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
} /* end if */
else {
if(H5T_BKG_YES == type_info->need_bkg) {
- n = H5D__gather_file(io_info, file_space, &bkg_iter, smine_nelmts,
- type_info->bkg_buf/*out*/);
+ n = H5D__gather_file(io_info, file_space, bkg_iter, smine_nelmts, type_info->bkg_buf/*out*/);
if(n != smine_nelmts)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed")
} /* end if */
@@ -681,25 +682,24 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in
/*
* Scatter the data out to the file.
*/
- if(H5D__scatter_file(io_info, file_space, &file_iter, smine_nelmts,
- type_info->tconv_buf) < 0)
+ if(H5D__scatter_file(io_info, file_space, file_iter, smine_nelmts, type_info->tconv_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed")
} /* end for */
done:
/* Release selection iterators */
- if(file_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(mem_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
- if(bkg_iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&bkg_iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
+ if(bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(bkg_iter)
+ bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__scatgath_write() */
@@ -744,12 +744,11 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
{
uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */
uint8_t *xdbuf; /* Pointer into dataset buffer */
- hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
- size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Pointer to sequence lengths */
size_t src_stride, dst_stride, copy_size;
- herr_t ret_value = SUCCEED; /*return value */
+ size_t vec_size; /* Vector length */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -765,16 +764,14 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
HDassert(user_buf);
/* Allocate the vector I/O arrays */
- if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (len = H5FL_SEQ_MALLOC(size_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- len = _len;
- off = _off;
- } /* end else */
+ if(dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Get source & destination strides */
src_stride = type_info->src_type_size;
@@ -791,7 +788,7 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
size_t elmtno; /* Element counter */
/* Get list of sequences for selection to write */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, dxpl_cache->vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -827,9 +824,9 @@ H5D__compound_opt_read(size_t nelmts, const H5S_t *space,
done:
/* Release resources, if allocated */
- if(len && len != _len)
+ if(len)
len = H5FL_SEQ_FREE(size_t, len);
- if(off && off != _off)
+ if(off)
off = H5FL_SEQ_FREE(hsize_t, off);
FUNC_LEAVE_NOAPI(ret_value)
@@ -923,7 +920,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
{
H5T_t *type; /* Datatype */
H5S_t *dst_space; /* Dataspace */
- H5S_sel_iter_t iter; /* Selection iteration info*/
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
const void *src_buf = NULL; /* Source (contiguous) data buffer */
size_t src_buf_nbytes = 0; /* Size of src_buf */
@@ -959,8 +956,12 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
if((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize selection iterator */
- if(H5S_select_iter_init(&iter, dst_space, type_size) < 0)
+ if(H5S_select_iter_init(iter, dst_space, type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
@@ -984,7 +985,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection")
/* Scatter data */
- if(H5D__scatter_mem(src_buf, dst_space, &iter, nelmts_scatter, dxpl_cache, dst_buf) < 0)
+ if(H5D__scatter_mem(src_buf, dst_space, iter, nelmts_scatter, dxpl_cache, dst_buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed")
nelmts -= (hssize_t)nelmts_scatter;
@@ -992,10 +993,10 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
} /* H5Dscatter() */
@@ -1023,7 +1024,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
{
H5T_t *type; /* Datatype */
H5S_t *src_space; /* Dataspace */
- H5S_sel_iter_t iter; /* Selection iteration info*/
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info*/
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
size_t type_size; /* Datatype element size */
hssize_t nelmts; /* Number of remaining elements in selection */
@@ -1071,15 +1072,19 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
if(((size_t)nelmts > dst_buf_nelmts) && (op == NULL))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize selection iterator */
- if(H5S_select_iter_init(&iter, src_space, type_size) < 0)
+ if(H5S_select_iter_init(iter, src_space, type_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information")
iter_init = TRUE;
/* Loop until all data has been scattered */
while(nelmts > 0) {
/* Gather data */
- if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, &iter, MIN(dst_buf_nelmts, (size_t)nelmts), dxpl_cache, dst_buf)))
+ if(0 == (nelmts_gathered = H5D__gather_mem(src_buf, src_space, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dxpl_cache, dst_buf)))
HGOTO_ERROR(H5E_IO, H5E_CANTCOPY, FAIL, "gather failed")
HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts));
@@ -1093,10 +1098,10 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
done:
/* Release selection iterator */
- if(iter_init) {
- if(H5S_SELECT_ITER_RELEASE(&iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
- } /* end if */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_API(ret_value)
} /* H5Dgather() */
diff --git a/src/H5Dselect.c b/src/H5Dselect.c
index 312beba..53829e5 100644
--- a/src/H5Dselect.c
+++ b/src/H5Dselect.c
@@ -68,6 +68,9 @@ H5FL_SEQ_DEFINE(size_t);
/* Declare a free list to manage sequences of hsize_t */
H5FL_SEQ_DEFINE(hsize_t);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/*-------------------------------------------------------------------------
@@ -86,22 +89,19 @@ static herr_t
H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
size_t nelmts, const H5S_t *file_space, const H5S_t *mem_space)
{
- H5S_sel_iter_t mem_iter; /* Memory selection iteration info */
- hbool_t mem_iter_init = 0; /* Memory selection iteration info has been initialized */
- H5S_sel_iter_t file_iter; /* File selection iteration info */
- hbool_t file_iter_init = 0; /* File selection iteration info has been initialized */
- hsize_t _mem_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in memory */
+ H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */
+ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */
+ H5S_sel_iter_t *file_iter = NULL; /* File selection iteration info */
+ hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */
hsize_t *mem_off = NULL; /* Pointer to sequence offsets in memory */
- hsize_t _file_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in the file */
hsize_t *file_off = NULL; /* Pointer to sequence offsets in the file */
- size_t _mem_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in memory */
size_t *mem_len = NULL; /* Pointer to sequence lengths in memory */
- size_t _file_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in the file */
size_t *file_len = NULL; /* Pointer to sequence lengths in the file */
size_t curr_mem_seq; /* Current memory sequence to operate on */
size_t curr_file_seq; /* Current file sequence to operate on */
size_t mem_nseq; /* Number of sequences generated in the file */
size_t file_nseq; /* Number of sequences generated in memory */
+ size_t vec_size; /* Vector length */
ssize_t tmp_file_len; /* Temporary number of bytes in file sequence */
herr_t ret_value = SUCCEED; /* Return value */
@@ -115,22 +115,18 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
HDassert(io_info->u.rbuf);
/* Allocate the vector I/O arrays */
- if(io_info->dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
- if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
- if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
- } /* end if */
- else {
- mem_len = _mem_len;
- mem_off = _mem_off;
- file_len = _file_len;
- file_off = _file_off;
- } /* end else */
+ if(io_info->dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE)
+ vec_size = io_info->dxpl_cache->vec_size;
+ else
+ vec_size = H5D_IO_VECTOR_SIZE;
+ if(NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
+ if(NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array")
+ if(NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array")
/* Check for only one element in selection */
if(nelmts == 1) {
@@ -169,13 +165,19 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
size_t mem_nelem; /* Number of elements used in memory sequences */
size_t file_nelem; /* Number of elements used in file sequences */
+ /* Allocate the iterators */
+ if(NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator")
+ if(NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator")
+
/* Initialize file iterator */
- if(H5S_select_iter_init(&file_iter, file_space, elmt_size) < 0)
+ if(H5S_select_iter_init(file_iter, file_space, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
file_iter_init = 1; /* File selection iteration info has been initialized */
/* Initialize memory iterator */
- if(H5S_select_iter_init(&mem_iter, mem_space, elmt_size) < 0)
+ if(H5S_select_iter_init(mem_iter, mem_space, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
mem_iter_init = 1; /* Memory selection iteration info has been initialized */
@@ -188,7 +190,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more file sequences are needed */
if(curr_file_seq >= file_nseq) {
/* Get sequences for file selection */
- if(H5S_SELECT_GET_SEQ_LIST(file_space, H5S_GET_SEQ_LIST_SORTED, &file_iter, io_info->dxpl_cache->vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(file_space, H5S_GET_SEQ_LIST_SORTED, file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -198,7 +200,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
/* Check if more memory sequences are needed */
if(curr_mem_seq >= mem_nseq) {
/* Get sequences for memory selection */
- if(H5S_SELECT_GET_SEQ_LIST(mem_space, 0, &mem_iter, io_info->dxpl_cache->vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(mem_space, 0, mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Start at the beginning of the sequences again */
@@ -227,24 +229,24 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size,
} /* end else */
done:
- /* Release file selection iterator */
- if(file_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&file_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
-
- /* Release memory selection iterator */
- if(mem_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&mem_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ /* Release selection iterators */
+ if(file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(file_iter)
+ file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter);
+ if(mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(mem_iter)
+ mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter);
/* Release vector arrays, if allocated */
- if(file_len && file_len != _file_len)
+ if(file_len)
file_len = H5FL_SEQ_FREE(size_t, file_len);
- if(file_off && file_off != _file_off)
+ if(file_off)
file_off = H5FL_SEQ_FREE(hsize_t, file_off);
- if(mem_len && mem_len != _mem_len)
+ if(mem_len)
mem_len = H5FL_SEQ_FREE(size_t, mem_len);
- if(mem_off && mem_off != _mem_off)
+ if(mem_off)
mem_off = H5FL_SEQ_FREE(hsize_t, mem_off);
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 3b38836..7ec8751 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -46,10 +46,8 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
-#undef MAX
-#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-#undef MIN
-#define MIN(X,Y) ((X)<(Y)?(X):(Y))
+/* The size of the member name buffers */
+#define H5FD_FAM_MEMB_NAME_BUF_SIZE 4096
/* The driver identification number, initialized at runtime */
static hid_t H5FD_FAMILY_g = 0;
@@ -623,11 +621,11 @@ static H5FD_t *
H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
- H5FD_family_t *file=NULL;
- H5FD_t *ret_value=NULL;
- char memb_name[4096], temp[4096];
- hsize_t eof=HADDR_UNDEF;
+ H5FD_family_t *file = NULL;
+ char *memb_name = NULL, *temp = NULL;
+ hsize_t eof = HADDR_UNDEF;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
+ H5FD_t *ret_value = NULL;
FUNC_ENTER_NOAPI_NOINIT
@@ -683,15 +681,21 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
file->name = H5MM_strdup(name);
file->flags = flags;
+ /* Allocate space for the string buffers */
+ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate member name")
+ if(NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name")
+
/* Check that names are unique */
- HDsnprintf(memb_name, sizeof(memb_name), name, 0);
- HDsnprintf(temp, sizeof(temp), name, 1);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0);
+ HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1);
if(!HDstrcmp(memb_name, temp))
HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique")
/* Open all the family members */
while(1) {
- HDsnprintf(memb_name, sizeof(memb_name), name, file->nmembs);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs);
/* Enlarge member array */
if(file->nmembs >= file->amembs) {
@@ -732,6 +736,12 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
ret_value=(H5FD_t *)file;
done:
+ /* Release resources */
+ if(memb_name)
+ H5MM_xfree(memb_name);
+ if(temp)
+ H5MM_xfree(temp);
+
/* Cleanup and fail */
if(ret_value == NULL && file != NULL) {
unsigned nerrors = 0; /* Number of errors closing member files */
@@ -941,12 +951,16 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
H5FD_family_t *file = (H5FD_family_t*)_file;
haddr_t addr = abs_eoa;
- char memb_name[4096];
+ char *memb_name = NULL;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
+ /* Allocate space for the member name buffer */
+ if(NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate member name")
+
for(u = 0; addr || u < file->nmembs; u++) {
/* Enlarge member array */
@@ -964,7 +978,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
/* Create another file if necessary */
if(u >= file->nmembs || !file->memb[u]) {
file->nmembs = MAX(file->nmembs, u+1);
- HDsnprintf(memb_name, sizeof(memb_name), file->name, u);
+ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u);
H5E_BEGIN_TRY {
H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t);
file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT,
@@ -992,6 +1006,10 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
file->eoa = abs_eoa;
done:
+ /* Release resources */
+ if(memb_name)
+ H5MM_xfree(memb_name);
+
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5FL.c b/src/H5FL.c
index 00cbf0c..db51809 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -293,7 +293,7 @@ H5FL_reg_init(H5FL_reg_head_t *head)
H5FL_reg_gc_head.first=new_node;
/* Indicate that the free list is initialized */
- head->init=1;
+ head->init = TRUE;
/* Make certain that the space allocated is large enough to store a free list pointer (eventually) */
if(head->size<sizeof(H5FL_reg_node_t))
@@ -655,7 +655,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.fir
/* No allocations left open for list, get rid of it */
else {
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_reg_gc_head.first->list->init = 0;
+ H5FL_reg_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_xfree(H5FL_reg_gc_head.first);
@@ -822,7 +822,7 @@ H5FL_blk_init(H5FL_blk_head_t *head)
H5FL_blk_gc_head.first=new_node;
/* Indicate that the PQ is initialized */
- head->init=1;
+ head->init = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1326,7 +1326,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.fir
/* No allocations left open for list, get rid of it */
else {
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_blk_gc_head.first->pq->init = 0;
+ H5FL_blk_gc_head.first->pq->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_free(H5FL_blk_gc_head.first);
@@ -1379,7 +1379,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
H5FL_arr_gc_head.first=new_node;
/* Allocate room for the free lists */
- if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem*sizeof(H5FL_arr_node_t))))
+ if(NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem * sizeof(H5FL_arr_node_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize the size of each array */
@@ -1387,7 +1387,7 @@ H5FL_arr_init(H5FL_arr_head_t *head)
head->list_arr[u].size = head->base_size + (head->elem_size * u);
/* Indicate that the free list is initialized */
- head->init = 1;
+ head->init = TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1795,7 +1795,7 @@ printf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.fir
H5MM_xfree(H5FL_arr_gc_head.first->list->list_arr);
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_arr_gc_head.first->list->init = 0;
+ H5FL_arr_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5MM_free(H5FL_arr_gc_head.first);
@@ -2007,7 +2007,7 @@ H5FL_fac_init(size_t size)
#endif /* H5FL_TRACK */
/* Indicate that the free list is initialized */
- factory->init = 1;
+ factory->init = TRUE;
/* Set return value */
ret_value = factory;
@@ -2417,7 +2417,7 @@ printf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_hea
HDassert(H5FL_fac_gc_head.first->list->allocated == 0);
/* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */
- H5FL_fac_gc_head.first->list->init = 0;
+ H5FL_fac_gc_head.first->list->init = FALSE;
/* Free the node from the garbage collection list */
H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first);
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 3cd30a6..f44d359 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -97,7 +97,7 @@ typedef struct H5FL_reg_node_t {
/* Data structure for free list of blocks */
typedef struct H5FL_reg_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
unsigned onlist; /* Number of blocks on free list */
const char *name; /* Name of the type */
@@ -166,9 +166,9 @@ typedef struct H5FL_blk_node_t {
/* Data structure for priority queue of native block free lists */
typedef struct H5FL_blk_head_t {
- unsigned init; /* Whether the free list has been initialized */
- unsigned allocated; /* Number of blocks allocated */
- unsigned onlist; /* Number of blocks on free list */
+ hbool_t init; /* Whether the free list has been initialized */
+ unsigned allocated; /* Number of blocks allocated */
+ unsigned onlist; /* Number of blocks on free list */
size_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
H5FL_blk_node_t *head; /* Pointer to first free list in queue */
@@ -237,7 +237,7 @@ typedef struct H5FL_arr_node_t {
/* Data structure for free list of array blocks */
typedef struct H5FL_arr_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
size_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
@@ -354,7 +354,7 @@ typedef struct H5FL_fac_node_t H5FL_fac_node_t;
/* Data structure for free list block factory */
typedef struct H5FL_fac_head_t {
- unsigned init; /* Whether the free list has been initialized */
+ hbool_t init; /* Whether the free list has been initialized */
unsigned allocated; /* Number of blocks allocated */
unsigned onlist; /* Number of blocks on free list */
size_t size; /* Size of the blocks in the list */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 759fff0..31ecc62 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -618,8 +618,8 @@ H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len,
*-------------------------------------------------------------------------
*/
static herr_t
-H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing,
- haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len,
+H5HF__cache_hdr_pre_serialize(const H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id,
+ void *_thing, haddr_t addr, size_t len, size_t H5_ATTR_UNUSED compressed_len,
haddr_t H5_ATTR_UNUSED *new_addr, size_t H5_ATTR_UNUSED *new_len,
size_t H5_ATTR_UNUSED *new_compressed_len, unsigned *flags)
{
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 99f1322..69b4b11 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -763,7 +763,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
size_t idx; /* Message number */
uint8_t *p = NULL; /*ptr into new chunk */
H5O_cont_t *cont = NULL; /*native continuation message */
- size_t chunkno; /* Chunk allocated */
+ unsigned chunkno; /* Chunk allocated */
haddr_t new_chunk_addr;
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
@@ -921,7 +921,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new
oh->chunk = x;
} /* end if */
- chunkno = (unsigned)oh->nchunks++;
+ H5_CHECKED_ASSIGN(chunkno, unsigned, oh->nchunks, size_t);
+ oh->nchunks++;
oh->chunk[chunkno].addr = new_chunk_addr;
oh->chunk[chunkno].size = size;
oh->chunk[chunkno].gap = 0;
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index fbbbe60..3803978 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -770,7 +770,7 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata,
/* Set the fields for the chunk proxy */
chk_proxy->oh = udata->oh;
- chk_proxy->chunkno = udata->oh->nchunks - 1;
+ H5_CHECKED_ASSIGN(chk_proxy->chunkno, unsigned, udata->oh->nchunks - 1, size_t);
} /* end if */
else {
/* Sanity check */
@@ -1324,7 +1324,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Decode continuation message */
cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, oh->mesg[curmesg].raw);
- cont->chunkno = udata->cont_msg_info->nmsgs + 1; /*the next continuation message/chunk */
+ H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */
/* Save 'native' form of continuation message */
oh->mesg[curmesg].native = cont;
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index a315f92..96de39c 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -778,7 +778,7 @@ done:
const void *
H5P_peek_driver_info(H5P_genplist_t *plist)
{
- void *ret_value = NULL; /* Return value */
+ const void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index fe013a7..5231c6e 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -145,6 +145,9 @@ H5FL_DEFINE_STATIC(H5S_hyper_span_t);
/* Declare a free list to manage the H5S_hyper_span_info_t struct */
H5FL_DEFINE_STATIC(H5S_hyper_span_info_t);
+/* Declare extern free list to manage the H5S_sel_iter_t struct */
+H5FL_EXTERN(H5S_sel_iter_t);
+
/* #define H5S_HYPER_DEBUG */
#ifdef H5S_HYPER_DEBUG
static herr_t
@@ -9288,7 +9291,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
size_t ss_nelem; /* Number of elements for src_space */
size_t ss_i = (size_t)0; /* Index into offset/length arrays for src_space */
hbool_t advance_ss = FALSE; /* Whether to advance ss_i on the next iteration */
- H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */
+ H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */
hbool_t ss_iter_init = FALSE; /* Whether ss_iter is initialized */
hsize_t ss_sel_off = (hsize_t)0; /* Offset within src_space selection */
hsize_t ds_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for dst_space */
@@ -9296,7 +9299,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
size_t ds_nseq; /* Number of sequences for dst_space */
size_t ds_nelem; /* Number of elements for dst_space */
size_t ds_i = (size_t)0; /* Index into offset/length arrays for dst_space */
- H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */
+ H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */
hbool_t ds_iter_init = FALSE; /* Whether ds_iter is initialized */
hsize_t ds_sel_off = (hsize_t)0; /* Offset within dst_space selection */
hsize_t sis_off[H5S_PROJECT_INTERSECT_NSEQS]; /* Offset array for src_intersect_space */
@@ -9305,7 +9308,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
size_t sis_nelem; /* Number of elements for src_intersect_space */
size_t sis_i = (size_t)0; /* Index into offset/length arrays for src_intersect_space */
hbool_t advance_sis = FALSE; /* Whether to advance sis_i on the next iteration */
- H5S_sel_iter_t sis_iter; /* Selection iterator for src_intersect_space */
+ H5S_sel_iter_t *sis_iter = NULL; /* Selection iterator for src_intersect_space */
hbool_t sis_iter_init = FALSE; /* Whether sis_iter is initialized */
hsize_t int_sel_off; /* Offset within intersected selections (ss/sis and ds/ps) */
size_t int_len; /* Length of segment in intersected selections */
@@ -9384,35 +9387,47 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Set unlim_dim */
proj_space->select.sel_info.hslab->unlim_dim = -1;
+ /* Allocate the source space iterator */
+ if(NULL == (ss_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source space iterator")
+
/* Initialize source space iterator */
- if(H5S_select_iter_init(&ss_iter, src_space, (size_t)1) < 0)
+ if(H5S_select_iter_init(ss_iter, src_space, (size_t)1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
ss_iter_init = TRUE;
/* Get sequence list for source space */
- if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, &ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
ss_nelem -= nelem;
HDassert(ss_nseq > 0);
+ /* Allocate the destination space iterator */
+ if(NULL == (ds_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination space iterator")
+
/* Initialize destination space iterator */
- if(H5S_select_iter_init(&ds_iter, dst_space, (size_t)1) < 0)
+ if(H5S_select_iter_init(ds_iter, dst_space, (size_t)1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
ds_iter_init = TRUE;
/* Get sequence list for destination space */
- if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, &ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
ds_nelem -= nelem;
HDassert(ds_nseq > 0);
+ /* Allocate the source intersect space iterator */
+ if(NULL == (sis_iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source intersect space iterator")
+
/* Initialize source intersect space iterator */
- if(H5S_select_iter_init(&sis_iter, src_intersect_space, (size_t)1) < 0)
+ if(H5S_select_iter_init(sis_iter, src_intersect_space, (size_t)1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
sis_iter_init = TRUE;
/* Get sequence list for source intersect space */
- if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, &sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
sis_nelem -= nelem;
HDassert(sis_nseq > 0);
@@ -9427,7 +9442,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(++ss_i == ss_nseq) {
if(ss_nelem > 0) {
/* Try to grab more sequences from src_space */
- if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, &ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(src_space, 0u, ss_iter, H5S_PROJECT_INTERSECT_NSEQS, ss_nelem, &ss_nseq, &nelem, ss_off, ss_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
HDassert(ss_len[0] > 0);
@@ -9459,7 +9474,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
if(sis_nelem > 0) {
/* Try to grab more sequences from src_intersect_space
*/
- if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, &sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(src_intersect_space, 0u, sis_iter, H5S_PROJECT_INTERSECT_NSEQS, sis_nelem, &sis_nseq, &nelem, sis_off, sis_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
HDassert(sis_len[0] > 0);
@@ -9511,7 +9526,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(ds_nelem > 0);
/* Try to grab more sequences from dst_space */
- if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, &ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
HDassert(ds_len[0] > 0);
@@ -9625,19 +9640,22 @@ loop_end:
done:
/* Release source selection iterator */
- if(ss_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&ss_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(ss_iter)
+ ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter);
/* Release destination selection iterator */
- if(ds_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&ds_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(ds_iter)
+ ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter);
/* Release source intersect selection iterator */
- if(sis_iter_init)
- if(H5S_SELECT_ITER_RELEASE(&sis_iter) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(sis_iter_init && H5S_SELECT_ITER_RELEASE(sis_iter) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(sis_iter)
+ sis_iter = H5FL_FREE(H5S_sel_iter_t, sis_iter);
/* Cleanup on error */
if(ret_value < 0) {
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index d4a4d69..2968bed 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -39,6 +39,15 @@ static htri_t H5S_select_iter_has_next_block(const H5S_sel_iter_t *iter);
static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter);
#endif /* LATER */
+/* Declare a free list to manage the H5S_sel_iter_t struct */
+H5FL_DEFINE(H5S_sel_iter_t);
+
+/* Declare extern free list to manage sequences of size_t */
+H5FL_SEQ_EXTERN(size_t);
+
+/* Declare extern free list to manage sequences of hsize_t */
+H5FL_SEQ_EXTERN(hsize_t);
+
/*--------------------------------------------------------------------------
@@ -1364,8 +1373,10 @@ herr_t
H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
const H5S_sel_iter_op_t *op, void *op_data)
{
- H5S_sel_iter_t iter; /* Selection iteration info */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */
+ hsize_t *off = NULL; /* Array to store sequence offsets */
+ size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
size_t max_elem; /* Maximum number of elements allowed in sequences */
@@ -1386,8 +1397,12 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
if(0 == (elmt_size = H5T_get_size(type)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid")
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize iterator */
- if(H5S_select_iter_init(&iter, space, elmt_size) < 0)
+ if(H5S_select_iter_init(iter, space, elmt_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = TRUE; /* Selection iteration info has been initialized */
@@ -1408,16 +1423,20 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
/* Compute the maximum number of bytes required */
H5_CHECKED_ASSIGN(max_elem, size_t, nelmts, hssize_t);
+ /* Allocate the offset & length arrays */
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array")
+
/* Loop, while elements left in selection */
while(max_elem > 0 && user_ret == 0) {
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t nelem; /* Number of elements used in sequences */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequence being worked on */
/* Get the sequences of bytes */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop, while sequences left to process */
@@ -1477,9 +1496,17 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space,
ret_value = user_ret;
done:
+ /* Release resources, if allocated */
+ if(len)
+ len = H5FL_SEQ_FREE(size_t, len);
+ if(off)
+ off = H5FL_SEQ_FREE(hsize_t, off);
+
/* Release selection iterator */
- if(iter_init && H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_iterate() */
@@ -1583,8 +1610,8 @@ H5S_get_select_type(const H5S_t *space)
htri_t
H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
{
- H5S_sel_iter_t iter_a; /* Selection a iteration info */
- H5S_sel_iter_t iter_b; /* Selection b iteration info */
+ H5S_sel_iter_t *iter_a = NULL; /* Selection a iteration info */
+ H5S_sel_iter_t *iter_b = NULL; /* Selection b iteration info */
hbool_t iter_a_init = 0; /* Selection a iteration info has been initialized */
hbool_t iter_b_init = 0; /* Selection b iteration info has been initialized */
htri_t ret_value = TRUE; /* Return value */
@@ -1729,15 +1756,21 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
hsize_t off_b[H5O_LAYOUT_NDIMS]; /* Offset of selection b blocks */
hbool_t first_block = TRUE; /* Flag to indicate the first block */
+ /* Allocate the selection iterators */
+ if(NULL == (iter_a = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+ if(NULL == (iter_b = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize iterator for each dataspace selection
* Use '0' for element size instead of actual element size to indicate
* that the selection iterator shouldn't be "flattened", since we
* aren't actually going to be doing I/O with the iterators.
*/
- if(H5S_select_iter_init(&iter_a, space_a, (size_t)0) < 0)
+ if(H5S_select_iter_init(iter_a, space_a, (size_t)0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a")
iter_a_init = 1;
- if(H5S_select_iter_init(&iter_b, space_b, (size_t)0) < 0)
+ if(H5S_select_iter_init(iter_b, space_b, (size_t)0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b")
iter_b_init = 1;
@@ -1748,9 +1781,9 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
htri_t status_a, status_b; /* Status from next block checks */
/* Get the current block for each selection iterator */
- if(H5S_SELECT_ITER_BLOCK(&iter_a, start_a, end_a) < 0)
+ if(H5S_SELECT_ITER_BLOCK(iter_a, start_a, end_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block a")
- if(H5S_SELECT_ITER_BLOCK(&iter_b, start_b, end_b) < 0)
+ if(H5S_SELECT_ITER_BLOCK(iter_b, start_b, end_b) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block b")
space_a_dim = (int)space_a_rank - 1;
@@ -1821,10 +1854,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end else */
/* Check if we are able to advance to the next selection block */
- if((status_a = H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter_a)) < 0)
+ if((status_a = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_a)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block a")
- if((status_b = H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter_b)) < 0)
+ if((status_b = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_b)) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block b")
/* Did we run out of blocks at the same time? */
@@ -1834,10 +1867,10 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
HGOTO_DONE(FALSE)
else {
/* Advance to next block in selection iterators */
- if(H5S_SELECT_ITER_NEXT_BLOCK(&iter_a) < 0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(iter_a) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block a")
- if(H5S_SELECT_ITER_NEXT_BLOCK(&iter_b) < 0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(iter_b) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block b")
} /* end else */
} /* end while */
@@ -1845,12 +1878,14 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2)
} /* end else */
done:
- if(iter_a_init)
- if(H5S_SELECT_ITER_RELEASE(&iter_a) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a")
- if(iter_b_init)
- if(H5S_SELECT_ITER_RELEASE(&iter_b) < 0)
- HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b")
+ if(iter_a_init && H5S_SELECT_ITER_RELEASE(iter_a) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a")
+ if(iter_a)
+ iter_a = H5FL_FREE(H5S_sel_iter_t, iter_a);
+ if(iter_b_init && H5S_SELECT_ITER_RELEASE(iter_b) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b")
+ if(iter_b)
+ iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_shape_same() */
@@ -2152,8 +2187,10 @@ done:
herr_t
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
{
- H5S_sel_iter_t iter; /* Selection iteration info */
+ H5S_sel_iter_t *iter = NULL; /* Selection iteration info */
hbool_t iter_init = 0; /* Selection iteration info has been initialized */
+ hsize_t *off = NULL; /* Array to store sequence offsets */
+ size_t *len = NULL; /* Array to store sequence lengths */
hssize_t nelmts; /* Number of elements in selection */
size_t max_elem; /* Total number of elements in selection */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2166,8 +2203,12 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
HDassert(space);
HDassert(_buf);
+ /* Allocate the selection iterator */
+ if(NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Initialize iterator */
- if(H5S_select_iter_init(&iter, space, fill_size) < 0)
+ if(H5S_select_iter_init(iter, space, fill_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator")
iter_init = 1; /* Selection iteration info has been initialized */
@@ -2178,16 +2219,20 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
/* Compute the number of bytes to process */
H5_CHECKED_ASSIGN(max_elem, size_t, nelmts, hssize_t);
+ /* Allocate the offset & length arrays */
+ if(NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array")
+ if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array")
+
/* Loop, while elements left in selection */
while(max_elem > 0) {
- hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
- size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t nseq; /* Number of sequences generated */
size_t curr_seq; /* Current sequnce being worked on */
size_t nelem; /* Number of elements used in sequences */
/* Get the sequences of bytes */
- if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
+ if(H5S_SELECT_GET_SEQ_LIST(space, 0, iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed")
/* Loop over sequences */
@@ -2207,9 +2252,17 @@ H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_b
} /* end while */
done:
- /* Release resouces */
- if(iter_init && H5S_SELECT_ITER_RELEASE(&iter) < 0)
+ /* Release resources, if allocated */
+ if(len)
+ len = H5FL_SEQ_FREE(size_t, len);
+ if(off)
+ off = H5FL_SEQ_FREE(hsize_t, off);
+
+ /* Release selection iterator */
+ if(iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
+ if(iter)
+ iter = H5FL_FREE(H5S_sel_iter_t, iter);
FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_select_fill() */
diff --git a/src/H5system.c b/src/H5system.c
index e6ca5d4..e17373c 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -172,7 +172,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
s = rest;
} /* end if */
else if ('*'==*s) {
- fwidth = va_arg (ap, int);
+ fwidth = va_arg(ap, int);
if(fwidth < 0) {
leftjust = 1;
fwidth = -fwidth;
@@ -269,23 +269,22 @@ HDfprintf(FILE *stream, const char *fmt, ...)
len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier);
HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv);
-
/* Conversion */
switch (conv) {
case 'd':
case 'i':
if(!HDstrcmp(modifier, "h")) {
- short x = (short)va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
+ short x = (short)va_arg(ap, int);
+ n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- int x = va_arg (ap, int);
- n = fprintf (stream, format_templ, x);
- } else if(!HDstrcmp (modifier, "l")) {
- long x = va_arg (ap, long);
- n = fprintf (stream, format_templ, x);
+ int x = va_arg(ap, int);
+ n = fprintf(stream, format_templ, x);
+ } else if(!HDstrcmp(modifier, "l")) {
+ long x = va_arg(ap, long);
+ n = fprintf(stream, format_templ, x);
} else {
int64_t x = va_arg(ap, int64_t);
- n = fprintf (stream, format_templ, x);
+ n = fprintf(stream, format_templ, x);
}
break;
@@ -294,13 +293,13 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'x':
case 'X':
if(!HDstrcmp(modifier, "h")) {
- unsigned short x = (unsigned short)va_arg (ap, unsigned int);
+ unsigned short x = (unsigned short)va_arg(ap, unsigned int);
n = fprintf(stream, format_templ, x);
} else if(!*modifier) {
- unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
+ unsigned int x = va_arg(ap, unsigned int); /*lint !e732 Loss of sign not really occuring */
n = fprintf(stream, format_templ, x);
} else if(!HDstrcmp(modifier, "l")) {
- unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
+ unsigned long x = va_arg(ap, unsigned long); /*lint !e732 Loss of sign not really occuring */
n = fprintf(stream, format_templ, x);
} else {
uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */
@@ -336,7 +335,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
case 'a':
{
- haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
+ haddr_t x = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */
if(H5F_addr_defined(x)) {
len = 0;
@@ -405,7 +404,7 @@ HDfprintf(FILE *stream, const char *fmt, ...)
htri_t tri_var = va_arg(ap, htri_t);
if(tri_var > 0)
- fprintf (stream, "TRUE");
+ fprintf(stream, "TRUE");
else if(!tri_var)
fprintf(stream, "FALSE");
else
diff --git a/src/H5timer.c b/src/H5timer.c
index d9be6bb..f36681e 100644
--- a/src/H5timer.c
+++ b/src/H5timer.c
@@ -127,16 +127,16 @@ H5_timer_begin (H5_timer_t *timer)
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage (RUSAGE_SELF, &rusage);
timer->utime = (double)rusage.ru_utime.tv_sec +
- ((double)rusage.ru_utime.tv_usec / 1e6F);
+ ((double)rusage.ru_utime.tv_usec / (double)1e6F);
timer->stime = (double)rusage.ru_stime.tv_sec +
- ((double)rusage.ru_stime.tv_usec / 1e6F);
+ ((double)rusage.ru_stime.tv_usec / (double)1e6F);
#else
timer->utime = 0.0F;
timer->stime = 0.0F;
#endif
#ifdef H5_HAVE_GETTIMEOFDAY
HDgettimeofday (&etime, NULL);
- timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / 1e6F);
+ timer->etime = (double)etime.tv_sec + ((double)etime.tv_usec / (double)1e6F);
#else
timer->etime = 0.0F;
#endif
@@ -166,9 +166,9 @@ H5_timer_end (H5_timer_t *sum/*in,out*/, H5_timer_t *timer/*in,out*/)
HDassert(timer);
H5_timer_begin(&now);
- timer->utime = MAX(0.0F, now.utime - timer->utime);
- timer->stime = MAX(0.0F, now.stime - timer->stime);
- timer->etime = MAX(0.0F, now.etime - timer->etime);
+ timer->utime = MAX((double)0.0F, now.utime - timer->utime);
+ timer->stime = MAX((double)0.0F, now.stime - timer->stime);
+ timer->etime = MAX((double)0.0F, now.etime - timer->etime);
if (sum) {
sum->utime += timer->utime;
@@ -208,28 +208,28 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds)
{
double bw;
- if(nseconds <= 0.0F)
+ if(nseconds <= (double)0.0F)
HDstrcpy(buf, " NaN");
else {
bw = nbytes/nseconds;
- if(H5_DBL_ABS_EQUAL(bw, 0.0F))
- HDstrcpy(buf, "0.000 B/s");
- else if(bw < 1.0F)
+ if(H5_DBL_ABS_EQUAL(bw, (double)0.0F))
+ HDstrcpy(buf, "0.000 B/s");
+ else if(bw < (double)1.0F)
sprintf(buf, "%10.4e", bw);
- else if(bw < H5_KB) {
+ else if(bw < (double)H5_KB) {
sprintf(buf, "%05.4f", bw);
HDstrcpy(buf+5, " B/s");
- } else if(bw < H5_MB) {
- sprintf(buf, "%05.4f", bw / H5_KB);
+ } else if(bw < (double)H5_MB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_KB);
HDstrcpy(buf+5, " kB/s");
- } else if(bw < H5_GB) {
- sprintf(buf, "%05.4f", bw / H5_MB);
+ } else if(bw < (double)H5_GB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_MB);
HDstrcpy(buf+5, " MB/s");
- } else if(bw < H5_TB) {
- sprintf(buf, "%05.4f", bw / H5_GB);
+ } else if(bw < (double)H5_TB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_GB);
HDstrcpy(buf+5, " GB/s");
- } else if(bw < H5_PB) {
- sprintf(buf, "%05.4f", bw / H5_TB);
+ } else if(bw < (double)H5_PB) {
+ sprintf(buf, "%05.4f", bw / (double)H5_TB);
HDstrcpy(buf+5, " TB/s");
} else {
sprintf(buf, "%10.4e", bw);
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 22bf3a2..311b9bb 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -102,15 +102,18 @@ typedef struct {
float f, g, h[16], i, j;
double k, l, m, n;
} stype1;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
double k, l, m, n;
long o, p, q;
} stype2;
+
typedef struct {
int a, b, c[8], d, e;
} stype3;
+
typedef struct {
int a, b, c[8], d, e;
float f, g, h[16], i, j;
@@ -147,7 +150,7 @@ typedef struct {
* Moved this part of code from MAIN to TEST_COMPOUND function.
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_compound (char *filename, hid_t fapl)
{
/* First dataset */
@@ -868,31 +871,31 @@ error:
*-------------------------------------------------------------------------
*/
static void
-initialize_stype1(unsigned char *buf, const size_t num)
+initialize_stype1(unsigned char *buf, size_t num)
{
int i, j;
stype1 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype1*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype1 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = i / 7 + 1;
+ s_ptr->l = i / 7 + 2;
+ s_ptr->m = i / 7 + 3;
+ s_ptr->n = i / 7 + 4;
}
}
@@ -911,35 +914,35 @@ initialize_stype1(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype2(unsigned char *buf, const size_t num)
+initialize_stype2(unsigned char *buf, size_t num)
{
size_t i, j;
stype2 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype2*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype2 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
}
}
@@ -958,19 +961,19 @@ initialize_stype2(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype3(unsigned char *buf, const size_t num)
+initialize_stype3(unsigned char *buf, size_t num)
{
int i, j;
stype3 *s_ptr;
- for (i=0; i<(int)num; i++) {
- s_ptr = (stype3*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ for(i = 0; i < (int)num; i++) {
+ s_ptr = (stype3 *)buf + i;
+ s_ptr->a = i * 8 + 0;
+ s_ptr->b = i * 8 + 1;
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = i * 8 + j;
+ s_ptr->d = i * 8 + 6;
+ s_ptr->e = i * 8 + 7;
}
}
@@ -989,39 +992,39 @@ initialize_stype3(unsigned char *buf, const size_t num)
*-------------------------------------------------------------------------
*/
static void
-initialize_stype4(unsigned char *buf, const size_t num)
+initialize_stype4(unsigned char *buf, size_t num)
{
size_t i, j;
stype4 *s_ptr;
- for (i=0; i<num; i++) {
- s_ptr = (stype4*)buf + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- for(j=0; j<8; j++)
- s_ptr->c[j] = i*8+j;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
-
- s_ptr->f = i*2/3;
- s_ptr->g = i*2/3+1;
- for(j=0; j<16; j++)
- s_ptr->h[j] = i*j/5+j;
- s_ptr->i = i*2/3+2;
- s_ptr->j = i*2/3+3;
-
- s_ptr->k = i/7+1;
- s_ptr->l = i/7+2;
- s_ptr->m = i/7+3;
- s_ptr->n = i/7+4;
-
- s_ptr->o = i*3+0;
- s_ptr->p = i*3+1;
- s_ptr->q = i*3+2;
-
- s_ptr->r = i*5+1;
- s_ptr->s = i*5+2;
- s_ptr->t = i*5+3;
+ for(i = 0; i < num; i++) {
+ s_ptr = (stype4 *)buf + i;
+ s_ptr->a = (int)(i * 8 + 0);
+ s_ptr->b = (int)(i * 8 + 1);
+ for(j = 0; j < 8; j++)
+ s_ptr->c[j] = (int)(i * 8 + j);
+ s_ptr->d = (int)(i * 8 + 6);
+ s_ptr->e = (int)(i * 8 + 7);
+
+ s_ptr->f = (float)(i * 2 / 3);
+ s_ptr->g = (float)(i * 2 / 3 + 1);
+ for(j = 0; j < 16; j++)
+ s_ptr->h[j] = (float)(i * j / 5 + j);
+ s_ptr->i = (float)(i * 2 / 3 + 2);
+ s_ptr->j = (float)(i * 2 / 3 + 3);
+
+ s_ptr->k = (double)(i / 7 + 1);
+ s_ptr->l = (double)(i / 7 + 2);
+ s_ptr->m = (double)(i / 7 + 3);
+ s_ptr->n = (double)(i / 7 + 4);
+
+ s_ptr->o = (long)(i * 3 + 0);
+ s_ptr->p = (long)(i * 3 + 1);
+ s_ptr->q = (long)(i * 3 + 2);
+
+ s_ptr->r = (long long)(i * 5 + 1);
+ s_ptr->s = (long long)(i * 5 + 2);
+ s_ptr->t = (long long)(i * 5 + 3);
}
}
@@ -1349,7 +1352,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_src_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1554,7 +1557,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_hdf5_dst_subset(char *filename, hid_t fapl)
{
hid_t file;
@@ -1763,7 +1766,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_pack_ooo(void)
{
hid_t cmpd, sub_cmpd; /* Datatype IDs */
@@ -1788,7 +1791,7 @@ test_pack_ooo(void)
for(i=0; i<PACK_NMEMBS; i++) {
/* Generate index into free_order array */
num_free = PACK_NMEMBS - i;
- j = HDrand() % num_free;
+ j = (unsigned)HDrandom() % num_free;
/* Update order array at the randomly generated (but guaranteed to be
* free) location */
@@ -1800,7 +1803,7 @@ test_pack_ooo(void)
} /* end for */
/* Generate order to insert inner compound type */
- sub_cmpd_order = HDrand() % PACK_NMEMBS;
+ sub_cmpd_order = (unsigned)HDrandom() % PACK_NMEMBS;
for(extra_space=0; extra_space<2; extra_space ++) {
if(extra_space)
@@ -1995,7 +1998,7 @@ error:
* Modifications:
*-------------------------------------------------------------------------
*/
-static int
+static unsigned
test_ooo_order(char *filename)
{
hid_t file = -1; /* File ID */
diff --git a/test/dsets.c b/test/dsets.c
index bca57e5..fe6a0c0 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -2952,25 +2952,34 @@ test_nbit_float(hid_t file)
/* Define user-defined single-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F32BE);
- if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
offset = 7;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 20;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)31) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_FLOAT_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -2980,9 +2989,8 @@ test_nbit_float(hid_t file)
*/
TESTING(" nbit float (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -2993,17 +3001,17 @@ test_nbit_float(hid_t file)
TESTING(" nbit float (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of int = size of float
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_FLT_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3016,10 +3024,14 @@ test_nbit_float(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3077,25 +3089,34 @@ test_nbit_double(hid_t file)
/* Define user-defined doule-precision floating-point type for dataset */
datatype = H5Tcopy(H5T_IEEE_F64BE);
- if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0) goto error;
+ if(H5Tset_fields(datatype, (size_t)55, (size_t)46, (size_t)9, (size_t)5, (size_t)41) < 0)
+ FAIL_STACK_ERROR
offset = 5;
- if(H5Tset_offset(datatype,offset) < 0) goto error;
+ if(H5Tset_offset(datatype,offset) < 0)
+ FAIL_STACK_ERROR
precision = 51;
- if(H5Tset_precision(datatype,precision) < 0) goto error;
- if(H5Tset_size(datatype, (size_t)8) < 0) goto error;
- if(H5Tset_ebias(datatype, (size_t)255) < 0) goto error;
+ if(H5Tset_precision(datatype,precision) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(datatype, (size_t)8) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(datatype, (size_t)255) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_DOUBLE_NAME, datatype, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3106,9 +3127,8 @@ test_nbit_double(hid_t file)
*/
TESTING(" nbit double (write)");
- if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3118,17 +3138,17 @@ test_nbit_double(hid_t file)
TESTING(" nbit double (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Assume size of long long = size of double
*/
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(!(orig_data[i][j]==orig_data[i][j])) continue; /* skip if value is NaN */
- if(new_data[i][j] != orig_data[i][j]) {
+ for(i = 0; i < (size_t)size[0]; i++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
+ if(!(orig_data[i][j] == orig_data[i][j]))
+ continue; /* skip if value is NaN */
+ if(!H5_DBL_ABS_EQUAL(new_data[i][j], orig_data[i][j])) {
H5_FAILED();
printf(" Read different values than written.\n");
printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
@@ -3141,10 +3161,14 @@ test_nbit_double(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(datatype) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(datatype) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3330,73 +3354,103 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory compound datatype before setting the order */
- mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset compound datatype and insert some atomic types */
- cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME, cmpd_tid, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
- for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].f = float_val[i][j];
-
- /* some even-numbered integer values are negtive */
- if((i*size[1]+j+1)%2 == 0) {
- orig_data[i][j].i = -orig_data[i][j].i;
- orig_data[i][j].s = (short)-orig_data[i][j].s;
+ for(i = 0; i < (size_t)size[0]; i++)
+ for(j = 0; j < (size_t)size[1]; j++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].f = float_val[i][j];
+
+ /* some even-numbered integer values are negtive */
+ if((i * size[1] + j + 1) % 2 == 0) {
+ orig_data[i][j].i = -orig_data[i][j].i;
+ orig_data[i][j].s = (short)-orig_data[i][j].s;
+ }
}
- }
PASSED();
@@ -3407,9 +3461,8 @@ test_nbit_compound(hid_t file)
*/
TESTING(" nbit compound (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3419,9 +3472,8 @@ test_nbit_compound(hid_t file)
TESTING(" nbit compound (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3429,12 +3481,12 @@ test_nbit_compound(hid_t file)
i_mask = ~((unsigned)~0 << (precision[0] + offset[0])) & ((unsigned)~0 << offset[0]);
c_mask = ~((unsigned)~0 << (precision[1] + offset[1])) & ((unsigned)~0 << offset[1]);
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
+ for(i = 0; i < size[0]; i++) {
+ for(j = 0; j < size[1]; j++) {
if(((unsigned)new_data[i][j].i & i_mask) != ((unsigned)orig_data[i][j].i & i_mask) ||
((unsigned)new_data[i][j].c & c_mask) != ((unsigned)orig_data[i][j].c & c_mask) ||
((unsigned)new_data[i][j].s & s_mask) != ((unsigned)orig_data[i][j].s & s_mask) ||
- (orig_data[i][j].f==orig_data[i][j].f && new_data[i][j].f != orig_data[i][j].f))
+ (orig_data[i][j].f == orig_data[i][j].f && !H5_FLT_ABS_EQUAL(new_data[i][j].f, orig_data[i][j].f)))
{
H5_FAILED();
printf(" Read different values than written.\n");
@@ -3448,15 +3500,24 @@ test_nbit_compound(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3525,119 +3586,169 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (setup)");
/* Define datatypes of members of compound datatype */
- i_tid=H5Tcopy(H5T_NATIVE_INT);
- c_tid=H5Tcopy(H5T_NATIVE_CHAR);
- s_tid=H5Tcopy(H5T_NATIVE_SHORT);
- v_tid=H5Tcopy(H5T_NATIVE_UINT);
- f_tid=H5Tcopy(H5T_IEEE_F32BE);
+ if((i_tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR
+ if((c_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if((s_tid = H5Tcopy(H5T_NATIVE_SHORT)) < 0)
+ FAIL_STACK_ERROR
+ if((v_tid = H5Tcopy(H5T_NATIVE_UINT)) < 0)
+ FAIL_STACK_ERROR
+ if((f_tid = H5Tcopy(H5T_IEEE_F32BE)) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset etc. of atomic compound datatype members */
- if(H5Tset_precision(i_tid,precision[0]) < 0) goto error;
- if(H5Tset_offset(i_tid,offset[0]) < 0) goto error;
+ if(H5Tset_precision(i_tid,precision[0]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(i_tid,offset[0]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(c_tid,precision[1]) < 0) goto error;
- if(H5Tset_offset(c_tid,offset[1]) < 0) goto error;
+ if(H5Tset_precision(c_tid,precision[1]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(c_tid,offset[1]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_precision(s_tid,precision[2]) < 0) goto error;
- if(H5Tset_offset(s_tid,offset[2]) < 0) goto error;
+ if(H5Tset_precision(s_tid,precision[2]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(s_tid,offset[2]) < 0)
+ FAIL_STACK_ERROR
- if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0) goto error;
- if(H5Tset_offset(f_tid, (size_t)7) < 0) goto error;
- if(H5Tset_precision(f_tid, (size_t)20) < 0) goto error;
- if(H5Tset_size(f_tid, (size_t)4) < 0) goto error;
- if(H5Tset_ebias(f_tid, (size_t)31) < 0) goto error;
+ if(H5Tset_fields(f_tid, (size_t)26, (size_t)20, (size_t)6, (size_t)7, (size_t)13) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(f_tid, (size_t)7) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(f_tid, (size_t)20) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_size(f_tid, (size_t)4) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_ebias(f_tid, (size_t)31) < 0)
+ FAIL_STACK_ERROR
/* Create a memory atomic compound datatype before setting the order */
- mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0) goto error;
+ if((mem_cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid1, "f", HOFFSET(atomic, f), H5T_NATIVE_FLOAT) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset atomic compound datatype and insert some atomic types */
- cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic));
- if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0) goto error;
+ if((cmpd_tid1 = H5Tcreate(H5T_COMPOUND, sizeof(atomic))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "i", HOFFSET(atomic, i), i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "c", HOFFSET(atomic, c), c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "s", HOFFSET(atomic, s), s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid1, "f", HOFFSET(atomic, f), f_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset compound datatype */
- if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(cmpd_tid1, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Set precision and offset of the other data member */
- if(H5Tset_precision(v_tid,precision[3]) < 0) goto error;
- if(H5Tset_offset(v_tid,offset[3]) < 0) goto error;
+ if(H5Tset_precision(v_tid,precision[3]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(v_tid,offset[3]) < 0)
+ FAIL_STACK_ERROR
/* Create the simple array datatype */
- base_tid = H5Tcopy(H5T_NATIVE_CHAR);
- if(H5Tset_precision(base_tid,precision[4]) < 0) goto error;
- if(H5Tset_offset(base_tid,offset[4]) < 0) goto error;
- array_tid = H5Tarray_create2(base_tid, 2, array_dims);
+ if((base_tid = H5Tcopy(H5T_NATIVE_CHAR)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_precision(base_tid,precision[4]) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tset_offset(base_tid,offset[4]) < 0)
+ FAIL_STACK_ERROR
+ if((array_tid = H5Tarray_create2(base_tid, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create the complex memory and dataset array datatype */
- array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims);
- mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims);
+ if((array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
+ if((mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims)) < 0)
+ FAIL_STACK_ERROR
/* Create a memory complex compound datatype before setting the order */
- mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0) goto error;
+ if((mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "a", HOFFSET(complex, a), mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(mem_cmpd_tid2, "d", HOFFSET(complex, d), mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Set order of dataset other complex compound member datatype */
- if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0) goto error;
+ if(H5Tset_order(v_tid, H5T_ORDER_BE) < 0)
+ FAIL_STACK_ERROR
/* Create a dataset complex compound datatype and insert members */
- cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex));
- if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0) goto error;
- if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0) goto error;
+ if((cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex))) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "a", HOFFSET(complex, a), cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "v", HOFFSET(complex, v), v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "b", HOFFSET(complex, b), array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tinsert(cmpd_tid2, "d", HOFFSET(complex, d), array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
/* Create the data space */
- if((space = H5Screate_simple(2, size, NULL)) < 0) goto error;
+ if((space = H5Screate_simple(2, size, NULL)) < 0)
+ FAIL_STACK_ERROR
/* Use nbit filter */
- if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dc, 2, chunk_size) < 0) goto error;
- if(H5Pset_nbit(dc) < 0) goto error;
+ if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_nbit(dc) < 0)
+ FAIL_STACK_ERROR
/* Create the dataset */
- if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2,
- space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0) goto error;
+ if((dataset = H5Dcreate2(file, DSET_NBIT_COMPOUND_NAME_2, cmpd_tid2, space, H5P_DEFAULT, dc, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Initialize data, assuming size of long long >= size of member datatypes */
for(i= 0;i< (size_t)size[0]; i++)
- for(j = 0; j < (size_t)size[1]; j++) {
- power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
- power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
- power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].a.f = float_val[i][j];
-
- power = HDpow(2.0F, (double)precision[3]);
- orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
- power = HDpow(2.0F, (double)(precision[4]-1));
- orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
- } /* end for */
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++) {
+ for(j = 0; j < (size_t)size[1]; j++) {
power = HDpow(2.0F, (double)(precision[0]-1));
- orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ orig_data[i][j].a.i = (int)(((long long)HDrandom() % (long long)power) << offset[0]);
power = HDpow(2.0F, (double)(precision[1]-1));
- orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ orig_data[i][j].a.c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
power = HDpow(2.0F, (double)(precision[2]-1));
- orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
- orig_data[i][j].d[m][n].f = float_val[i][j];
- } /* end for */
- } /* end for */
+ orig_data[i][j].a.s = (short)(-((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].a.f = float_val[i][j];
+
+ power = HDpow(2.0F, (double)precision[3]);
+ orig_data[i][j].v = (unsigned int)(((long long)HDrandom() % (long long)power) << offset[3]);
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[4]-1));
+ orig_data[i][j].b[m][n] = (char)(((long long)HDrandom() % (long long)power) << offset[4]);
+ } /* end for */
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++) {
+ power = HDpow(2.0F, (double)(precision[0]-1));
+ orig_data[i][j].d[m][n].i = (int)(-((long long)HDrandom() % (long long)power) << offset[0]);
+ power = HDpow(2.0F, (double)(precision[1]-1));
+ orig_data[i][j].d[m][n].c = (char)(((long long)HDrandom() % (long long)power) << offset[1]);
+ power = HDpow(2.0F, (double)(precision[2]-1));
+ orig_data[i][j].d[m][n].s = (short)(((long long)HDrandom() % (long long)power) << offset[2]);
+ orig_data[i][j].d[m][n].f = float_val[i][j];
+ } /* end for */
+ } /* end for */
PASSED();
@@ -3648,9 +3759,8 @@ test_nbit_compound_2(hid_t file)
*/
TESTING(" nbit compound complex (write)");
- if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- orig_data) < 0)
- goto error;
+ if(H5Dwrite(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0)
+ FAIL_STACK_ERROR
PASSED();
/*----------------------------------------------------------------------
@@ -3660,9 +3770,8 @@ test_nbit_compound_2(hid_t file)
TESTING(" nbit compound complex (read)");
/* Read the dataset back */
- if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT,
- new_data) < 0)
- goto error;
+ if(H5Dread(dataset, mem_cmpd_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0)
+ FAIL_STACK_ERROR
/* Check that the values read are the same as the values written
* Use mask for checking the significant bits, ignoring the padding bits
@@ -3683,63 +3792,77 @@ test_nbit_compound_2(hid_t file)
s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]);
b_mask = ~((unsigned)~0 << (precision[4] + offset[4])) & ((unsigned)~0 << offset[4]);
for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- b_failed = 0;
- d_failed = 0;
+ for(j=0; j<(size_t)size[1]; j++) {
+ b_failed = 0;
+ d_failed = 0;
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].b[m][n] & b_mask)!=((unsigned)orig_data[i][j].b[m][n] & b_mask)) {
b_failed = 1;
goto out;
- }
-
- for(m = 0; m < (size_t)array_dims[0]; m++)
- for(n = 0; n < (size_t)array_dims[1]; n++)
- if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
- ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
- ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
- (new_data[i][j].d[m][n].f==new_data[i][j].d[m][n].f &&
- new_data[i][j].d[m][n].f != new_data[i][j].d[m][n].f)) {
- d_failed = 1;
- goto out;
- }
-
- out:
- if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
- ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
- ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
- (new_data[i][j].a.f==new_data[i][j].a.f &&
- new_data[i][j].a.f != new_data[i][j].a.f)||
- new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- goto error;
+ }
+
+ for(m = 0; m < (size_t)array_dims[0]; m++)
+ for(n = 0; n < (size_t)array_dims[1]; n++)
+ if(((unsigned)new_data[i][j].d[m][n].i & i_mask) != ((unsigned)orig_data[i][j].d[m][n].i & i_mask)||
+ ((unsigned)new_data[i][j].d[m][n].c & c_mask) != ((unsigned)orig_data[i][j].d[m][n].c & c_mask)||
+ ((unsigned)new_data[i][j].d[m][n].s & s_mask) != ((unsigned)orig_data[i][j].d[m][n].s & s_mask)||
+ (new_data[i][j].d[m][n].f == new_data[i][j].d[m][n].f && !H5_FLT_ABS_EQUAL(new_data[i][j].d[m][n].f, new_data[i][j].d[m][n].f))) {
+ d_failed = 1;
+ goto out;
+ }
+
+out:
+ if(((unsigned)new_data[i][j].a.i & i_mask) != ((unsigned)orig_data[i][j].a.i & i_mask)||
+ ((unsigned)new_data[i][j].a.c & c_mask) != ((unsigned)orig_data[i][j].a.c & c_mask)||
+ ((unsigned)new_data[i][j].a.s & s_mask) != ((unsigned)orig_data[i][j].a.s & s_mask)||
+ (new_data[i][j].a.f == new_data[i][j].a.f && !H5_FLT_ABS_EQUAL(new_data[i][j].a.f, new_data[i][j].a.f)) ||
+ new_data[i][j].v != orig_data[i][j].v || b_failed || d_failed) {
+ H5_FAILED();
+ printf(" Read different values than written.\n");
+ printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ goto error;
+ }
}
- }
}
/*----------------------------------------------------------------------
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Tclose(i_tid) < 0) goto error;
- if(H5Tclose(c_tid) < 0) goto error;
- if(H5Tclose(s_tid) < 0) goto error;
- if(H5Tclose(f_tid) < 0) goto error;
- if(H5Tclose(v_tid) < 0) goto error;
- if(H5Tclose(cmpd_tid2) < 0) goto error;
- if(H5Tclose(cmpd_tid1) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid2) < 0) goto error;
- if(H5Tclose(mem_cmpd_tid1) < 0) goto error;
- if(H5Tclose(array_tid) < 0) goto error;
- if(H5Tclose(base_tid) < 0) goto error;
- if(H5Tclose(array_cmplx_tid) < 0) goto error;
- if(H5Tclose(mem_array_cmplx_tid) < 0) goto error;
- if(H5Pclose(dc) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
- if(H5Dclose(dataset) < 0) goto error;
+ if(H5Tclose(i_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(c_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(s_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(f_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(v_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid2) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_cmpd_tid1) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(base_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Tclose(mem_array_cmplx_tid) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pclose(dc) < 0)
+ FAIL_STACK_ERROR
+ if(H5Sclose(space) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(dataset) < 0)
+ FAIL_STACK_ERROR
PASSED();
@@ -3832,7 +3955,7 @@ test_nbit_compound_3(hid_t file)
for(i = 0; i < (size_t)size[0]; i++) {
power = HDpow(2.0F, 17.0F - 1.0F);
HDmemset(&orig_data[i], 0, sizeof(orig_data[i]));
- orig_data[i].i = HDrandom() % (long)power;
+ orig_data[i].i = (int)(HDrandom() % (long)power);
HDstrcpy(orig_data[i].str, "fixed-length C string");
orig_data[i].vl_str = HDstrdup("variable-length C string");
@@ -4203,7 +4326,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (rand() % 1234567) / 2;
+ orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4587,7 +4710,7 @@ test_scaleoffset_float(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[i][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
if((i*size[1]+j+1)%2 == 0)
@@ -4718,10 +4841,10 @@ test_scaleoffset_float_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (float)((HDrandom() % 100000) / 1000.0F);
+ orig_data[0][j] = (float)(HDrandom() % 100000) / 1000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -4829,10 +4952,10 @@ test_scaleoffset_double(hid_t file)
/* Initialize data */
for(i= 0;i< (size_t)size[0]; i++)
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[i][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[i][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((i*size[1]+j+1)%2 == 0)
+ if((i* size[1] + j + 1) % 2 == 0)
orig_data[i][j] = -orig_data[i][j];
}
@@ -4960,10 +5083,10 @@ test_scaleoffset_double_2(hid_t file)
/* Initialize data of hyperslab */
for(j = 0; j < (size_t)size[1]; j++) {
- orig_data[0][j] = (HDrandom() % 10000000) / 10000000.0F;
+ orig_data[0][j] = (float)(HDrandom() % 10000000) / 10000000.0F;
/* even-numbered values are negtive */
- if((j+1)%2 == 0)
+ if((j + 1) % 2 == 0)
orig_data[0][j] = -orig_data[0][j];
}
@@ -5958,7 +6081,7 @@ test_set_local(hid_t fapl)
for(j=0; j<dims[1]; j++) {
/* If the difference between two values is greater than 0.001%, they're
* considered not equal. */
- if(!H5_DBL_REL_EQUAL(points_dbl[i][j],check_dbl[i][j],0.00001F)) {
+ if(!H5_DBL_REL_EQUAL(points_dbl[i][j], check_dbl[i][j], (double)0.00001F)) {
H5_FAILED();
printf(" Line %d: Read different values than written.\n",__LINE__);
printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j));
@@ -6717,7 +6840,7 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)j + (i * MISSING_CHUNK_DIM);
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
rdata2[i][j] = 911;
}
} /* end for */
@@ -7635,7 +7758,7 @@ test_chunk_cache(hid_t fapl)
/* Set new rdcc settings on fapl */
nslots_2 = nslots_1 * 2;
nbytes_2 = nbytes_1 * 2;
- w0_2 = w0_1 / 2.0F;
+ w0_2 = w0_1 / (double)2.0F;
if (H5Pset_cache(fapl_local, 0, nslots_2, nbytes_2, w0_2) < 0) FAIL_STACK_ERROR
h5_fixname(FILENAME[8], fapl, filename, sizeof filename);
@@ -8074,7 +8197,7 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_chunk_fast(const char *env_h5_driver, hid_t fapl)
+test_chunk_fast(hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
hid_t fid = -1; /* File ID */
@@ -8135,7 +8258,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
unsigned ndims; /* Current # of dims to test */
/* Loop over dataspace ranks to test */
@@ -8435,7 +8558,7 @@ test_reopen_chunk_fast(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -8566,7 +8689,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9192,7 +9315,7 @@ test_fixed_array(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9564,10 +9687,10 @@ test_single_chunk(hid_t fapl)
TEST_ERROR
for(i = n = 0; i < (DSET_DIM1 * DSET_DIM2); i++)
- wbuf[i] = n++;
+ wbuf[i] = (int)n++;
for(i = n = 0; i < (50* 100); i++)
- t_wbuf[i] = n++;
+ t_wbuf[i] = (int)n++;
#ifdef H5_HAVE_FILTER_DEFLATE
/* Loop over compressing chunks */
@@ -9575,7 +9698,7 @@ test_single_chunk(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9866,7 +9989,7 @@ test_unfiltered_edge_chunks(hid_t fapl)
/* Initialize write buffer */
for(i=0; i<dim[0]; i++)
for(j=0; j<dim[1]; j++)
- wbuf[i][j] = (char)(2 * i) - (char)j;
+ wbuf[i][j] = (char)((2 * i) - j);
/* Reset byte counts */
count_nbytes_read = (size_t)0;
@@ -11944,7 +12067,7 @@ main(void)
nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
diff --git a/test/file_image.c b/test/file_image.c
index 6d1845f..ef7adb8 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -22,7 +22,6 @@
*************************************************************/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Fprivate.h" /* required to test property removals */
#define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0)
diff --git a/test/filter_fail.c b/test/filter_fail.c
index 0b92abb..c7248cc 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -22,7 +22,6 @@
*/
#include "h5test.h"
-#include "H5srcdir.h"
#define DSET_NAME "dset_fail"
#define H5Z_FILTER_FAIL_TEST 312
diff --git a/test/freespace.c b/test/freespace.c
index 6e680c3..1c28bc2 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -455,7 +455,7 @@ test_fs_create(hid_t fapl)
h5_stat_size_t file_size, empty_size; /* File size */
frspace_state_t state; /* State of free space*/
H5FS_create_t cparam, test_cparam; /* creation parameters */
- size_t nclasses;
+ uint16_t nclasses;
unsigned init_flags=0;
TESTING("the creation/close/reopen/deletion of the free-space manager");
@@ -589,7 +589,7 @@ test_fs_sect_add(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -921,7 +921,7 @@ test_fs_sect_find(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1302,7 +1302,7 @@ test_fs_sect_merge(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -1768,7 +1768,7 @@ test_fs_sect_shrink(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2106,7 +2106,7 @@ test_fs_sect_change_class(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
@@ -2396,7 +2396,7 @@ test_fs_sect_extend(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
@@ -2744,7 +2744,7 @@ test_fs_sect_iterate(hid_t fapl)
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
haddr_t fs_addr=HADDR_UNDEF; /* address of free space */
- size_t nclasses;
+ uint16_t nclasses;
H5FS_create_t cparam; /* creation parameters */
TEST_free_section_t *sect_node=NULL;
diff --git a/test/getname.c b/test/getname.c
index 2700b49..e6d26ce 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2433,6 +2433,7 @@ test_obj_ref(hid_t fapl)
hsize_t dims1[] = {SPACE1_DIM1};
hobj_ref_t wbuf[SPACE1_DIM1]; /* Buffer to write to disk */
int tu32[SPACE1_DIM1]; /* Int data */
+ ssize_t namelen; /* Length of the name */
int i; /* counting variables */
char buf[100];
@@ -2575,104 +2576,104 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to normal dataset in root group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[0])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
*buf = '\0';
/* Check H5Rget_name returns the correct length of the name when name is NULL */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(namelen != 9) TEST_ERROR
/* Make sure size parameter is ignored */
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
- if(i != 9) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(namelen != 9) TEST_ERROR
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(namelen == 9))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in /Group1");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to /Group1");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[2])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1") == 0) &&(namelen == 7))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to datatype in /Group1");
if((tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[3])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(tid1, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(tid1, (char*)buf, sizeof(buf));
if(H5Tclose(tid1) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(namelen == 17))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset in nested group");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(namelen == 23))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to nested group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[5])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(namelen == 14))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to dataset created via hard link");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[6])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(namelen == 16))) TEST_ERROR
PASSED()
HDmemset(buf, 0, sizeof(buf));
TESTING("getting path to root group");
if((group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[7])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(group, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(group, (char*)buf, sizeof(buf));
if(H5Gclose(group) < 0) FAIL_STACK_ERROR
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
- if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf));
+ if(!((HDstrcmp(buf, "/") == 0) &&(namelen == 1))) TEST_ERROR
PASSED()
/* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */
@@ -2682,12 +2683,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset hidden by a mounted file");
if((dataset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &wbuf[4])) < 0) FAIL_STACK_ERROR
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */
@@ -2698,12 +2699,12 @@ test_obj_ref(hid_t fapl)
TESTING("getting path to dataset that has been unlinked");
*buf = '\0';
- i = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
+ namelen = H5Iget_name(dataset2, (char*)buf, sizeof(buf));
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
- if(i != 0) TEST_ERROR
+ if(namelen != 0) TEST_ERROR
*buf = '\0';
- i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
- if(i != 0) TEST_ERROR
+ namelen = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf));
+ if(namelen != 0) TEST_ERROR
PASSED()
/* Close disk dataspace */
diff --git a/test/links.c b/test/links.c
index dcea7ce..f60a88a 100644
--- a/test/links.c
+++ b/test/links.c
@@ -7335,7 +7335,6 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
hid_t dtid = -1; /* Dataset's datatype ID */
hid_t dcpl = -1; /* Dataset creation property list */
int wdata = 99; /* Attribute data written */
- int rdata = 0; /* Attribute data read */
int wbuf[60]; /* Data buffer for writing */
int rbuf[60]; /* Data buffer for reading */
int i; /* Local index variable */
diff --git a/test/mtime.c b/test/mtime.c
index 0c0c923..88ed31c 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -114,7 +114,7 @@ main(void)
puts(" Modification times will be mantained in the file but");
puts(" cannot be queried on this system. See H5O_mtime_decode().");
return 0;
- } else if(HDfabs(HDdifftime(now, oi1.ctime)) > 60.0F) {
+ } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) {
H5_FAILED();
tm = HDlocaltime(&(oi1.ctime));
HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm);
diff --git a/test/ohdr.c b/test/ohdr.c
index aa1ac85..5642c41 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -17,7 +17,6 @@
* Tuesday, November 24, 1998
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Iprivate.h"
/*
diff --git a/test/set_extent.c b/test/set_extent.c
index fd3270b..a992419 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -348,11 +348,9 @@ static int do_ranks( hid_t fapl, hbool_t new_format )
/* Iterate over different index types, but only if using the new format
*/
- for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES;
- index_type++) {
+ for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) {
/* Standard test */
- if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters,
- FALSE, index_type) < 0) {
+ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE
? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray"
diff --git a/test/testframe.c b/test/testframe.c
index 1c56f88..df5abe0 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -26,9 +26,9 @@
/*
* Definitions for the testing structure.
*/
-#define MAXNUMOFTESTS 60
+#define MAXNUMOFTESTS 24
#define MAXTESTNAME 16
-#define MAXTESTDESC 64
+#define MAXTESTDESC 32
typedef struct TestStruct {
int NumErrors;
diff --git a/test/tmeta.c b/test/tmeta.c
index e69c057..43fdeac 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -123,7 +123,7 @@ test_metadata(void)
*
*-------------------------------------------------------------------------
*/
-H5_ATTR_PURE void
+H5_ATTR_PURE H5_ATTR_CONST void
cleanup_metadata(void)
{
/* no file to clean */
diff --git a/test/tvltypes.c b/test/tvltypes.c
index b7bbaee..f8a6a91 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -169,7 +169,7 @@ static void
test_vltypes_funcs(void)
{
hid_t type; /* Datatype ID */
- int size;
+ size_t size;
H5T_pad_t inpad;
H5T_norm_t norm;
H5T_cset_t cset;
@@ -183,16 +183,16 @@ test_vltypes_funcs(void)
type = H5Tvlen_create (H5T_IEEE_F32BE);
CHECK(type, FAIL, "H5Tvlen_create");
- size=H5Tget_precision(type);
- CHECK(size, FAIL, "H5Tget_precision");
+ size = H5Tget_precision(type);
+ CHECK(size, 0, "H5Tget_precision");
- size=H5Tget_size(type);
- CHECK(size, FAIL, "H5Tget_size");
+ size = H5Tget_size(type);
+ CHECK(size, 0, "H5Tget_size");
- size=H5Tget_ebias(type);
- CHECK(size, FAIL, "H5Tget_ebias");
+ size = H5Tget_ebias(type);
+ CHECK(size, 0, "H5Tget_ebias");
- ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
+ ret = H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE);
CHECK(ret, FAIL, "H5Tset_pad");
inpad = H5Tget_inpad(type);
@@ -558,7 +558,7 @@ rewrite_vltypes_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -730,8 +730,8 @@ test_vltypes_vlen_compound(void)
wdata[i].p=HDmalloc((i+1)*sizeof(s1));
wdata[i].len=i+1;
for(j=0; j<(i+1); j++) {
- ((s1 *)wdata[i].p)[j].i=i*10+j;
- ((s1 *)wdata[i].p)[j].f=(float)((i*20+j)/3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 20 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -865,7 +865,7 @@ rewrite_vltypes_vlen_compound(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -876,8 +876,8 @@ rewrite_vltypes_vlen_compound(void)
wdata[i].p = HDmalloc((i + increment) * sizeof(s1));
wdata[i].len = i + increment;
for(j = 0; j < (i + increment); j++) {
- ((s1 *)wdata[i].p)[j].i = i * 40 + j;
- ((s1 *)wdata[i].p)[j].f = (float)((i * 60 + j) / 3.0F);
+ ((s1 *)wdata[i].p)[j].i = (int)(i * 40 + j);
+ ((s1 *)wdata[i].p)[j].f = (float)(i * 60 + j) / 3.0F;
} /* end for */
} /* end for */
@@ -1016,17 +1016,17 @@ test_vltypes_compound_vlen_vlen(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE3_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t));
- wdata[i].v.len=i+L1_INCM;
- for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) {
- t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int));
- t1->len=j+L2_INCM;
- for(k=0; k<j+L2_INCM; k++)
- ((unsigned int*)t1->p)[k] = i*100 + j*10 + k;
- }
+ for(i = 0; i < SPACE3_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + L1_INCM) * sizeof(hvl_t));
+ wdata[i].v.len = i + L1_INCM;
+ for(t1 = (hvl_t *)((wdata[i].v).p), j = 0; j < (i + L1_INCM); j++, t1++) {
+ t1->p = HDmalloc((j + L2_INCM) * sizeof(unsigned int));
+ t1->len = j + L2_INCM;
+ for(k = 0; k < j + L2_INCM; k++)
+ ((unsigned int*)t1->p)[k] = i * 100 + j * 10 + k;
+ } /* end for */
} /* end for */
/* Create file */
@@ -1477,13 +1477,13 @@ test_vltypes_compound_vlen_atomic(void)
MESSAGE(5, ("Testing Compound Datatypes with VL Atomic Datatype Component Functionality\n"));
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].i=i*10;
- wdata[i].f=(float)((i*20)/3.0F);
- wdata[i].v.p=HDmalloc((i+1)*sizeof(unsigned int));
- wdata[i].v.len=i+1;
- for(j=0; j<(i+1); j++)
- ((unsigned int *)wdata[i].v.p)[j]=i*10+j;
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].i = (int)(i * 10);
+ wdata[i].f = (float)(i * 20) / 3.0F;
+ wdata[i].v.p = HDmalloc((i + 1)*sizeof(unsigned int));
+ wdata[i].v.len = i + 1;
+ for(j = 0; j < (i + 1); j++)
+ ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j;
} /* end for */
/* Create file */
@@ -1688,7 +1688,7 @@ rewrite_vltypes_compound_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=4;
+ unsigned increment=4;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1696,8 +1696,8 @@ rewrite_vltypes_compound_vlen_atomic(void)
/* Allocate and initialize VL data to write */
for(i = 0; i < SPACE1_DIM1; i++) {
- wdata[i].i = i * 40;
- wdata[i].f = (float)((i * 50) / 3.0F);
+ wdata[i].i = (int)(i * 40);
+ wdata[i].f = (float)(i * 50) / 3.0F;
wdata[i].v.p = HDmalloc((i + increment) * sizeof(unsigned int));
wdata[i].v.len = i + increment;
for(j = 0; j < (i + increment); j++)
@@ -1960,7 +1960,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret = H5Dread(dataset, tid2, H5S_ALL, H5S_ALL, xfer_pid, rdata);
@@ -1969,7 +1969,7 @@ test_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used, ((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1 * (SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2048,7 +2048,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2224,7 +2224,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
hsize_t size; /* Number of bytes which will be used */
unsigned i,j,k; /* counting variables */
size_t mem_used=0; /* Memory used during allocation */
- int increment=1;
+ unsigned increment=1;
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -2316,7 +2316,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(size, ((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int), "H5Dvlen_get_buf_size");
+ VERIFY(size, (hsize_t)(((SPACE1_DIM1*(SPACE1_DIM1 + 1)) / 2) * sizeof(hvl_t) + vlen_size_func((unsigned long)SPACE1_DIM1) * sizeof(unsigned int)), "H5Dvlen_get_buf_size");
/* Read dataset from disk */
ret=H5Dread(dataset,tid2,H5S_ALL,H5S_ALL,xfer_pid,rdata);
@@ -2325,7 +2325,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
/* Make certain the correct amount of memory has been used */
/* 10 hvl_t elements allocated = 1 + 2 + 3 + 4 elements for each array position */
/* 20 unsigned int elements allocated = 1 + 3 + 6 + 10 elements */
- VERIFY(mem_used,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int),"H5Dread");
+ VERIFY(mem_used, (size_t)(((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(hvl_t)+vlen_size_func((unsigned long)SPACE1_DIM1)*sizeof(unsigned int)),"H5Dread");
/* Compare data read in */
for(i=0; i<SPACE1_DIM1; i++) {
@@ -2597,6 +2597,10 @@ test_vltypes_fill_value(void)
}
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2700,6 +2704,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
@@ -2897,6 +2905,10 @@ test_vltypes_fill_value(void)
dset_elmts = SPACE4_DIM_LARGE;
break;
+ case H5D_VIRTUAL:
+ assert(0 && "Invalid layout type!");
+ break;
+
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
diff --git a/test/vds.c b/test/vds.c
index 50523f0..2fd492a 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -19,7 +19,6 @@
* Purpose: Tests datasets with virtual layout.
*/
#include "h5test.h"
-#include "H5srcdir.h"
#include "H5Dprivate.h" /* For H5D_VIRTUAL_DEF_LIST_SIZE */
typedef enum {
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index e66eaa7..12d0587 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -5078,24 +5078,24 @@ int main(int argc, char **argv)
/* Shape Same tests using contigous hyperslab */
#if 1
AddTest("sscontig1", sscontig1, NULL,
- "Shape Same, contigous hyperslab, ind IO, contig datasets", PARATESTFILE);
+ "Cntg hslab, ind IO, cntg dsets", PARATESTFILE);
AddTest("sscontig2", sscontig2, NULL,
- "Shape Same, contigous hyperslab, col IO, contig datasets", PARATESTFILE);
+ "Cntg hslab, col IO, cntg dsets", PARATESTFILE);
AddTest("sscontig3", sscontig3, NULL,
- "Shape Same, contigous hyperslab, ind IO, chunked datasets", PARATESTFILE);
+ "Cntg hslab, ind IO, chnk dsets", PARATESTFILE);
AddTest("sscontig4", sscontig4, NULL,
- "Shape Same, contigous hyperslab, col IO, chunked datasets", PARATESTFILE);
+ "Cntg hslab, col IO, chnk dsets", PARATESTFILE);
#endif
/* Shape Same tests using checker board hyperslab */
AddTest("sschecker1", sschecker1, NULL,
- "Shape Same, checker hyperslab, ind IO, contig datasets", PARATESTFILE);
+ "Check hslab, ind IO, cntg dsets", PARATESTFILE);
AddTest("sschecker2", sschecker2, NULL,
- "Shape Same, checker hyperslab, col IO, contig datasets", PARATESTFILE);
+ "Check hslab, col IO, cntg dsets", PARATESTFILE);
AddTest("sschecker3", sschecker3, NULL,
- "Shape Same, checker hyperslab, ind IO, chunked datasets", PARATESTFILE);
+ "Check hslab, ind IO, chnk dsets", PARATESTFILE);
AddTest("sschecker4", sschecker4, NULL,
- "Shape Same, checker hyperslab, col IO, chunked datasets", PARATESTFILE);
+ "Check hslab, col IO, chnk dsets", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index f3a0d7a..5371a21 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -417,19 +417,19 @@ main (int argc, const char *argv[])
/* create property to pass copy options */
if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
/* set options for object copy */
if (flag)
{
if ( H5Pset_copy_object(ocpl_id, flag) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed");
}
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
error_msg("Could not create link creation property list\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed");
} /* end if */
/* Check for creating intermediate groups */
@@ -437,7 +437,7 @@ main (int argc, const char *argv[])
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
error_msg("Could not set property for creating parent groups\n");
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed");
} /* end if */
/* Display some output if requested */
@@ -464,7 +464,7 @@ main (int argc, const char *argv[])
{
error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr);
HDfree(str_ptr);
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lexists failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed");
}
HDfree(str_ptr);
}
@@ -484,7 +484,7 @@ main (int argc, const char *argv[])
if(H5Lcopy(fid_src, oname_src,
fid_dst, oname_dst,
H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed");
}
else /* valid link */
{
@@ -494,7 +494,7 @@ main (int argc, const char *argv[])
oname_dst, /* Name of the destination object */
ocpl_id, /* Object copy property list */
lcpl_id)<0) /* Link creation property list */
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed");
}
/* free link info path */
@@ -503,15 +503,15 @@ main (int argc, const char *argv[])
/* close propertis */
if(H5Pclose(ocpl_id)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
if(H5Pclose(lcpl_id)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed");
/* close files */
if (H5Fclose(fid_src)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
if (H5Fclose(fid_dst)<0)
- HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ HGOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed");
leave(EXIT_SUCCESS);
@@ -529,6 +529,6 @@ done:
H5Fclose(fid_dst);
} H5E_END_TRY;
- leave(EXIT_FAILURE);
+ leave(ret_value);
}
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 7b4bc39..cdaca29 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <assert.h>
#include <memory.h>
+#include "H5private.h"
#include "h5diff.h"
#include "h5diff_common.h"
#include "h5tools.h"
@@ -136,9 +137,9 @@ int main(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
-void
+H5_ATTR_NORETURN void
h5diff_exit(int status)
{
- exit(status);
+ HDexit(status);
}
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 937bd32..339ff6c 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -28,7 +28,7 @@
* NOTE: this value should stay in sync with the value defined in the tools
* library file: h5tools_utils.h
*/
-hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
+size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
/*-------------------------------------------------------------------------
* Program: h5diffgentest
@@ -3745,7 +3745,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* vlen string */
hid_t sid_vlen_str=0; /* dataspace ID */
hid_t tid_vlen_str=0; /* datatype ID */
- const char vlen_str_buf[]= {
+ char vlen_str_buf[]= {
"Variable length string"
};
hsize_t dims_vlen_str[] = {VLEN_STR_DIM};
@@ -3762,7 +3762,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
hid_t sid_vlen_str_array=0; /* dataspace ID */
hid_t tid_vlen_str_array_pre=0; /* datatype ID */
hid_t tid_vlen_str_array=0; /* datatype ID */
- const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= {
+ char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= {
"1 - Variable length string Array",
"2 - Testing variable length string array in compound type",
"3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation,"
@@ -4478,8 +4478,8 @@ static void test_comps_array (const char *fname, const char *dset, const char *a
wdata[i].i1 = i;
for(j=0; j < SDIM_CMPD_ARRAY; j++)
{
- wdata[i].cmpd2[j].i2 = i*10 + diff;
- wdata[i].cmpd2[j].f2 = (float)(i*10.5F) + diff;
+ wdata[i].cmpd2[j].i2 = i * 10 + diff;
+ wdata[i].cmpd2[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
}
@@ -4588,15 +4588,13 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SDIM_DSET; i++)
- {
- wdata[i].i1 = i;
- wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
- wdata[i].vl.len = i+1;
- for(j=0; j<(i+1); j++)
- {
- ((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff;
- ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)(i*10.5F) + diff;
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff);
+ ((cmpd2_t *)wdata[i].vl.p)[j].f2 = (float)i * 10.5F + (float)diff;
} /* end for */
} /* end for */
@@ -4703,26 +4701,24 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch
hid_t tid_cmpd3; /* Compound3 Datatype ID */
hsize_t sdims_dset[] = {SDIM_DSET};
hsize_t sdims_arry[] = {SDIM_CMPD_ARRAY};
- int i,j,k; /* counting variables */
- herr_t ret; /* Generic return value */
+ unsigned i, j, k; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Initialize array data to write in compound1 */
- for(i=0; i < SDIM_DSET; i++)
- {
- wdata[i].i1 = i;
+ for(i = 0; i < SDIM_DSET; i++) {
+ wdata[i].i1 = (int)i;
+
/* Allocate and initialize VL data to write in compound2 */
- for(j=0; j < SDIM_CMPD_ARRAY; j++)
- {
- wdata[i].cmpd2[j].i2 = j*10;
- wdata[i].cmpd2[j].vl.p = HDmalloc((j+1)*sizeof(cmpd3_t));
- wdata[i].cmpd2[j].vl.len = j+1;
- for(k=0; k<(j+1); k++)
- {
+ for(j = 0; j < SDIM_CMPD_ARRAY; j++) {
+ wdata[i].cmpd2[j].i2 = (int)(j * 10);
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].vl.len = j + 1;
+ for(k = 0; k < (j + 1); k++) {
/* Initialize data of compound3 */
- ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = j*10 + diff;
- ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)(j*10.5F) + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].i3 = (int)j * 10 + diff;
+ ((cmpd3_t *)wdata[i].cmpd2[j].vl.p)[k].f3 = (float)j * 10.5F + (float)diff;
} /* end for */
} /* end for */
}
@@ -4856,22 +4852,19 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SDIM_DSET; i++)
- {
+ for(i = 0; i < SDIM_DSET; i++) {
/* compound 1 data */
- wdata[i].i1 = i;
- wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
- wdata[i].vl.len = i+1;
- for(j=0; j<(i+1); j++)
- {
+ wdata[i].i1 = (int)i;
+ wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t));
+ wdata[i].vl.len = i + 1;
+ for(j = 0; j < (i + 1); j++) {
/* compound2 data */
- ((cmpd2_t *)wdata[i].vl.p)[j].i2 = i*10 + diff;
- for (k=0; k < SDIM_CMPD_ARRAY; k++)
- {
+ ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)i * 10 + diff;
+ for(k = 0; k < SDIM_CMPD_ARRAY; k++) {
/* compound 3 data */
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = k*10.5F + diff;
- ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)(k*10.5F) + diff;
- }
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].i3 = (int)((float)k * 10.5F) + diff;
+ ((cmpd2_t *)(wdata[i].vl.p))[j].cmpd3[k].f3 = (float)k * 10.5F + (float)diff;
+ } /* end for */
} /* end for */
} /* end for */
@@ -5857,13 +5850,15 @@ void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 2; j++) {
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
- for (l = 0; l < i + 1; l++)
- if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
- else ((int *)buf52[i][j].p)[l] = n++;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++)
+ if(make_diffs)
+ ((int *)buf52[i][j].p)[l] = 0;
+ else
+ ((int *)buf52[i][j].p)[l] = n++;
}
}
@@ -6074,8 +6069,10 @@ void write_attr_in(hid_t loc_id,
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
- if (make_diffs) buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -6132,12 +6129,12 @@ void write_attr_in(hid_t loc_id,
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
if (make_diffs) {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0.0F;
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
}
}
@@ -6275,11 +6272,13 @@ void write_attr_in(hid_t loc_id,
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
- if (make_diffs)((int *)buf53[i][j][k].p)[l] = 0;
- else ((int *)buf53[i][j][k].p)[l] = n++;
+ if(make_diffs)
+ ((int *)buf53[i][j][k].p)[l] = 0;
+ else
+ ((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
@@ -6649,22 +6648,21 @@ void write_dset_in(hid_t loc_id,
status = H5Tclose(tid);
{
-
double *dbuf; /* information to write */
- hid_t did; /* dataset ID */
- hid_t sid; /* dataspace ID */
- hid_t tid; /* datatype ID */
+ hid_t ldid; /* dataset ID */
+ hid_t lsid; /* dataspace ID */
+ hid_t ltid; /* datatype ID */
size_t size;
hsize_t sdims[] = {1};
hsize_t tdims[] = {H5TOOLS_MALLOCSIZE / sizeof(double) + 1};
- int j;
+ size_t jj;
/* allocate and initialize array data to write */
size = ( H5TOOLS_MALLOCSIZE / sizeof(double) + 1 ) * sizeof(double);
- dbuf = (double *)HDmalloc( size );
+ dbuf = (double *)HDmalloc(size);
- for( j = 0; j < H5TOOLS_MALLOCSIZE / sizeof(double) + 1; j++)
- dbuf[j] = j;
+ for(jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++)
+ dbuf[jj] = (double)jj;
if (make_diffs)
{
@@ -6673,19 +6671,19 @@ void write_dset_in(hid_t loc_id,
}
/* create a type larger than H5TOOLS_MALLOCSIZE */
- tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
- size = H5Tget_size(tid);
- sid = H5Screate_simple(1, sdims, NULL);
- did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ ltid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims);
+ size = H5Tget_size(ltid);
+ lsid = H5Screate_simple(1, sdims, NULL);
+ ldid = H5Dcreate2(loc_id, "arrayd", ltid, lsid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
#if defined(WRITE_ARRAY)
- H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
+ H5Dwrite(ldid, ltid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
#endif
/* close */
- H5Dclose(did);
- H5Tclose(tid);
- H5Sclose(sid);
- HDfree( dbuf );
+ H5Dclose(ldid);
+ H5Tclose(ltid);
+ H5Sclose(lsid);
+ HDfree(dbuf);
}
/*-------------------------------------------------------------------------
@@ -6815,15 +6813,12 @@ void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n = 0;
- for(i = 0; i < 3; i++)
- {
- for(j = 0; j < 2; j++)
- {
- buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
- buf52[i][j].len = i + 1;
- for(l = 0; l < i + 1; l++)
- {
- if (make_diffs)
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < 2; j++) {
+ buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf52[i][j].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
+ if(make_diffs)
((int *)buf52[i][j].p)[l] = 0;
else
((int *)buf52[i][j].p)[l] = n++;
@@ -6933,15 +6928,13 @@ void write_dset_in(hid_t loc_id,
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- buf23[i][j][k]=0;
- else buf23[i][j][k]=n++;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if(make_diffs)
+ buf23[i][j][k] = 0;
+ else
+ buf23[i][j][k] = (char)n++;
}
}
}
@@ -6966,20 +6959,16 @@ void write_dset_in(hid_t loc_id,
*/
n=1;
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 3; j++)
- {
- for (k = 0; k < 2; k++)
- {
- if (make_diffs)
- {
- buf33[i][j][k].a=0;
- buf33[i][j][k].b=0.0F;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 3; j++) {
+ for (k = 0; k < 2; k++) {
+ if (make_diffs) {
+ buf33[i][j][k].a = 0;
+ buf33[i][j][k].b = 0.0F;
}
else {
- buf33[i][j][k].a=n++;
- buf33[i][j][k].b=n++;
+ buf33[i][j][k].a = (char)n++;
+ buf33[i][j][k].b = n++;
}
}
}
@@ -7026,16 +7015,12 @@ void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
- for(i = 0; i < 4; i++)
- {
- for(j = 0; j < 3; j++)
- {
- for(k = 0; k < 2; k++)
- {
- buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
- buf53[i][j][k].len = i + 1;
- for(l = 0; l < i + 1; l++)
- {
+ for(i = 0; i < 4; i++) {
+ for(j = 0; j < 3; j++) {
+ for(k = 0; k < 2; k++) {
+ buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int));
+ buf53[i][j][k].len = (size_t)(i + 1);
+ for(l = 0; l < i + 1; l++) {
if(make_diffs)
((int *)buf53[i][j][k].p)[l] = 0;
else
@@ -7265,7 +7250,7 @@ int test_hyperslab(const char *fname,
if(make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
- hs_start[0] = i * GBLL/(1024*1024);
+ hs_start[0] = (unsigned long long)i * GBLL / (1024 * 1024);
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c
index 8d3c5ae..97def9a 100644
--- a/tools/h5format_convert/h5fc_gentest.c
+++ b/tools/h5format_convert/h5fc_gentest.c
@@ -471,9 +471,9 @@ gen_err_level(const char *fname)
hsize_t extent[2] = {0, 0};
start[0] = 0;
- start[1] = n;
+ start[1] = (hsize_t)n;
extent[0] = 1;
- extent[1] = n+1;
+ extent[1] = (hsize_t)(n + 1);
/* Set current dimension sizes for the dataset */
if(H5Dset_extent(did, extent) < 0)
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index 8e4eac4..8f88398 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -347,17 +347,19 @@ done:
* Returns 0 on success, -1 on failure.
*/
herr_t
-copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much )
+copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much )
{
static char buf[COPY_BUF_SIZE];
+ size_t how_much;
off_t where = (off_t)_where;
off_t to;
off_t from;
herr_t ret_value = 0;
/* nothing to copy */
- if(how_much <= 0)
+ if(show_much <= 0)
goto done;
+ how_much = (size_t)show_much;
/* rewind */
HDfseek(infid, 0L, 0);
@@ -392,8 +394,8 @@ copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t how_much )
/* Update positions/size */
how_much -= bytes_read;
- from += bytes_read;
- to += bytes_read;
+ from += (off_t)bytes_read;
+ to += (off_t)bytes_read;
/* Write nchars bytes to output file */
bytes_wrote = HDfwrite(buf, (size_t)1, bytes_read, ofid);
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 98468c9..62de46c 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -196,7 +196,9 @@ usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\
as a soft link or external link and prints the value\n\
assigned to the symbolic link; it does not provide any\n\
information regarding the target object or determine\n\
- whether the link is a dangling link.\n\
+ whether the link is a dangling link.\n",
+ h5tools_getprogname());
+ HDfprintf(rawerrorstream, "\
--no-dangling-links\n\
Must be used with --follow-symlinks option;\n\
otherwise, h5ls shows error message and returns an exit\n\
@@ -216,7 +218,8 @@ usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\
-v, --verbose Generate more verbose output\n\
-V, --version Print version number and exit\n\
--vfd=DRIVER Use the specified virtual file driver\n\
- -x, --hexdump Show raw data in hexadecimal format\n\
+ -x, --hexdump Show raw data in hexadecimal format\n");
+ HDfprintf(rawerrorstream, "\
\n\
file/OBJECT\n\
Each object consists of an HDF5 file name optionally followed by a\n\
@@ -235,8 +238,7 @@ usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\
-E or --external Follow external links.\n\
Replaced by --follow-symlinks.\n\
-e, --errors Show all HDF5 error reporting\n\
- Replaced by --enable-error-stack.\n",
- h5tools_getprogname());
+ Replaced by --enable-error-stack.\n");
}
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index cf30b2b..b915d3a 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -564,7 +564,7 @@ done:
H5Aclose(attr_out);
} H5E_END_TRY;
- return -1;
+ return ret_value;
} /* end copy_attr() */
/*-------------------------------------------------------------------------
@@ -606,6 +606,9 @@ static int check_options(pack_opt_t *options) {
case H5D_CHUNKED:
strcpy(slayout, "chunked");
break;
+ case H5D_VIRTUAL:
+ strcpy(slayout, "virtual");
+ break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
error_msg("invalid layout\n");
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index 56e08ef..e21b829 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -34,8 +34,8 @@
*
*-------------------------------------------------------------------------
*/
-static
-int aux_find_obj(const char* name, /* object name from traverse list */
+static int
+aux_find_obj(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
@@ -48,7 +48,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */
if (HDstrcmp(options->op_tbl->objs[i].path,name)==0)
{
*obj = options->op_tbl->objs[i];
- return i;
+ return (int)i;
}
pdest = HDstrstr(name,options->op_tbl->objs[i].path);
@@ -58,7 +58,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */
if( pdest != NULL && result==1 )
{
*obj = options->op_tbl->objs[i];
- return i;
+ return (int)i;
}
}/*i*/
@@ -76,8 +76,8 @@ int aux_find_obj(const char* name, /* object name from traverse list */
*
*-------------------------------------------------------------------------
*/
-static
-int aux_assign_obj(const char* name, /* object name from traverse list */
+static int
+aux_assign_obj(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
@@ -109,6 +109,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -128,6 +129,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -184,6 +186,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis
case H5D_LAYOUT_ERROR:
case H5D_COMPACT:
case H5D_CONTIGUOUS:
+ case H5D_VIRTUAL:
case H5D_NLAYOUTS:
break;
default:
@@ -433,7 +436,7 @@ int apply_filters(const char* name, /* object name from traverse list */
int scale_factor;
scale_type = (H5Z_SO_scale_type_t)obj.filter[i].cd_values[0];
- scale_factor = obj.filter[i].cd_values[1];
+ scale_factor = (int)obj.filter[i].cd_values[1];
if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0)
return -1;
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index 748eb78..486d1c6 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -13,7 +13,7 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include "hdf5.h"
+#include "H5private.h"
#include "h5tools.h"
/*-------------------------------------------------------------------------
@@ -147,7 +147,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr
*
*-------------------------------------------------------------------------
*/
-int
+H5_ATTR_CONST int
h5tools_can_encode(H5Z_filter_t filtn) {
switch (filtn) {
/* user defined filter */
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 60666f1..8c869c8 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -39,7 +39,7 @@
typedef struct {
haddr_t objno; /* Object ID (i.e. address) */
- const char *path; /* Object path */
+ char *path; /* Object path */
} ref_path_node_t;
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
diff --git a/tools/perform/sio_engine.c b/tools/perform/sio_engine.c
index 505b0f7..11d8f65 100644
--- a/tools/perform/sio_engine.c
+++ b/tools/perform/sio_engine.c
@@ -123,8 +123,8 @@ static hid_t h5dxpl = -1; /* Dataset transfer property list */
* Programmer: Christian Chilan, April, 2008
* Modifications:
*/
- results
-do_sio(parameters param)
+void
+do_sio(parameters param, results *res)
{
char *buffer = NULL; /*data buffer pointer */
size_t buf_size[MAX_DIMS]; /* general buffer size in bytes */
@@ -133,7 +133,6 @@ do_sio(parameters param)
char base_name[256]; /* test file base name */
/* return codes */
herr_t ret_code = 0; /*return code */
- results res;
char fname[FILENAME_MAX]; /* test file name */
int i;
@@ -148,11 +147,11 @@ do_sio(parameters param)
switch (iot) {
case POSIXIO:
fd.posixfd = -1;
- res.timers = io_time_new(SYS_CLOCK);
+ res->timers = io_time_new(SYS_CLOCK);
break;
case HDF5:
fd.h5fd = -1;
- res.timers = io_time_new(SYS_CLOCK);
+ res->timers = io_time_new(SYS_CLOCK);
break;
default:
/* unknown request */
@@ -209,18 +208,18 @@ do_sio(parameters param)
HDfprintf(output, "data filename=%s\n",
fname);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_CREATE | SIO_WRITE);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
- hrc = do_write(&res, &fd, &param, buffer);
- set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
+ hrc = do_write(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_write failed");
/* Close file for write */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
if (!param.h5_write_only) {
@@ -229,19 +228,19 @@ do_sio(parameters param)
*/
/* Open file for read */
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART);
hrc = do_fopen(&param, fname, &fd, SIO_READ);
VRFY((hrc == SUCCESS), "do_fopen failed");
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
- hrc = do_read(&res, &fd, &param, buffer);
- set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART);
+ hrc = do_read(res, &fd, &param, buffer);
+ set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_read failed");
/* Close file for read */
hrc = do_fclose(iot, &fd);
- set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
+ set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_fclose failed");
}
@@ -272,8 +271,7 @@ done:
if (buffer)
free(buffer);
- res.ret_code = ret_code;
- return res;
+ res->ret_code = ret_code;
}
/*
diff --git a/tools/perform/sio_perf.c b/tools/perform/sio_perf.c
index a69e929..aceccb0 100644
--- a/tools/perform/sio_perf.c
+++ b/tools/perform/sio_perf.c
@@ -68,7 +68,7 @@
#define SIO_HDF5 0x4
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) (((t)==0.0F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) (H5_DBL_ABS_EQUAL(t, (double)0.0F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1
@@ -279,18 +279,18 @@ struct options {
long num_files; /* number of files */
off_t num_bpp; /* number of bytes per proc per dset */
int num_iters; /* number of iterations */
- off_t dset_size[MAX_DIMS]; /* Dataset size */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
size_t buf_size[MAX_DIMS]; /* Buffer size */
size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Dimension access order */
- int dset_rank; /* Rank */
- int buf_rank; /* Rank */
+ int order[MAX_DIMS]; /* Dimension access order */
+ int dset_rank; /* Rank */
+ int buf_rank; /* Rank */
int order_rank; /* Rank */
- int chk_rank; /* Rank */
+ int chk_rank; /* Rank */
int print_times; /* print times as well as throughputs */
int print_raw; /* print raw data throughput info */
- off_t h5_alignment; /* alignment in HDF5 file */
- off_t h5_threshold; /* threshold for alignment in HDF5 file */
+ hsize_t h5_alignment; /* alignment in HDF5 file */
+ hsize_t h5_threshold; /* threshold for alignment in HDF5 file */
int h5_use_chunks; /* Make HDF5 dataset chunked */
int h5_write_only; /* Perform the write tests only */
int h5_extendable; /* Perform the write tests only */
@@ -307,13 +307,13 @@ typedef struct _minmax {
} minmax;
/* local functions */
-static off_t parse_size_directive(const char *size);
+static hsize_t parse_size_directive(const char *size);
static struct options *parse_command_line(int argc, char *argv[]);
static void run_test_loop(struct options *options);
static int run_test(iotype iot, parameters parms, struct options *opts);
static void output_all_info(minmax *mm, int count, int indent_level);
static void get_minmax(minmax *mm, double val);
-static minmax accumulate_minmax_stuff(minmax *mm, int count);
+static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm);
static void output_results(const struct options *options, const char *name,
minmax *table, int table_size, off_t data_size);
static void output_report(const char *fmt, ...);
@@ -392,6 +392,7 @@ run_test_loop(struct options *opts)
parameters parms;
int i;
size_t buf_bytes;
+
/* load options into parameter structure */
parms.num_files = opts->num_files;
parms.num_dsets = opts->num_dsets;
@@ -496,7 +497,8 @@ run_test(iotype iot, parameters parms, struct options *opts)
/* Do IO iteration times, collecting statistics each time */
for (i = 0; i < parms.num_iters; ++i) {
double t;
- res = do_sio(parms);
+
+ do_sio(parms, &res);
/* gather all of the "sys write" times */
t = get_time(res.timers, HDF5_MPI_WRITE);
@@ -711,30 +713,27 @@ get_minmax(minmax *mm, double val)
* Modifications:
* Changed to use seconds instead of MB/s - QAK, 5/9/02
*/
-static minmax
-accumulate_minmax_stuff(minmax *mm, int count)
+static void
+accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm)
{
int i;
- minmax total_mm;
- total_mm.sum = 0.0F;
- total_mm.max = -DBL_MAX;
- total_mm.min = DBL_MAX;
- total_mm.num = count;
+ total_mm->sum = 0.0F;
+ total_mm->max = -DBL_MAX;
+ total_mm->min = DBL_MAX;
+ total_mm->num = count;
for (i = 0; i < count; ++i) {
double m = mm[i].max;
- total_mm.sum += m;
+ total_mm->sum += m;
- if (m < total_mm.min)
- total_mm.min = m;
+ if (m < total_mm->min)
+ total_mm->min = m;
- if (m > total_mm.max)
- total_mm.max = m;
+ if (m > total_mm->max)
+ total_mm->max = m;
}
-
- return total_mm;
}
@@ -752,7 +751,7 @@ output_results(const struct options *opts, const char *name, minmax *table,
{
minmax total_mm;
- total_mm = accumulate_minmax_stuff(table, table_size);
+ accumulate_minmax_stuff(table, table_size, &total_mm);
print_indent(3);
output_report("%s (%d iteration(s)):\n", name,table_size);
@@ -940,10 +939,11 @@ report_parameters(struct options *opts)
static struct options *
parse_command_line(int argc, char *argv[])
{
- register int opt;
+ int opt;
struct options *cl_opts;
int i, default_rank, actual_rank, ranks[4];
- cl_opts = (struct options *)malloc(sizeof(struct options));
+
+ cl_opts = (struct options *)HDmalloc(sizeof(struct options));
cl_opts->output_file = NULL;
cl_opts->io_types = 0; /* will set default after parsing options */
@@ -956,11 +956,11 @@ parse_command_line(int argc, char *argv[])
cl_opts->chk_rank = 0;
cl_opts->order_rank = 0;
- for (i=0; i<MAX_DIMS; i++){
- cl_opts->buf_size[i]=(i+1)*10;
- cl_opts->dset_size[i]=(i+1)*100;
- cl_opts->chk_size[i]=(i+1)*10;
- cl_opts->order[i]=i+1;
+ for(i = 0; i < MAX_DIMS; i++) {
+ cl_opts->buf_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->dset_size[i] = (hsize_t)((i + 1) * 100);
+ cl_opts->chk_size[i] = (size_t)((i + 1) * 10);
+ cl_opts->order[i] = i + 1;
}
cl_opts->vfd = sec2;
@@ -985,7 +985,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1024,7 +1024,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1052,7 +1052,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1110,7 +1110,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1174,7 +1174,7 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
@@ -1202,13 +1202,13 @@ parse_command_line(int argc, char *argv[])
while (end && *end != '\0') {
char buf[10];
- memset(buf, '\0', sizeof(buf));
+ HDmemset(buf, '\0', sizeof(buf));
for (i = 0; *end != '\0' && *end != ','; ++end)
if (isalnum(*end) && i < 10)
buf[i++] = *end;
- cl_opts->order[j] = parse_size_directive(buf);
+ cl_opts->order[j] = (int)parse_size_directive(buf);
j++;
@@ -1294,13 +1294,13 @@ parse_command_line(int argc, char *argv[])
* Modifications:
*/
-static off_t
+static hsize_t
parse_size_directive(const char *size)
{
- off_t s;
+ hsize_t s;
char *endptr;
- s = strtol(size, &endptr, 10);
+ s = HDstrtoull(size, &endptr, 10);
if (endptr && *endptr) {
while (*endptr != '\0' && (*endptr == ' ' || *endptr == '\t'))
@@ -1311,14 +1311,17 @@ parse_size_directive(const char *size)
case 'k':
s *= ONE_KB;
break;
+
case 'M':
case 'm':
s *= ONE_MB;
break;
+
case 'G':
case 'g':
s *= ONE_GB;
break;
+
default:
fprintf(stderr, "Illegal size specifier '%c'\n", *endptr);
exit(EXIT_FAILURE);
diff --git a/tools/perform/sio_perf.h b/tools/perform/sio_perf.h
index 311d909..7a7d708 100644
--- a/tools/perform/sio_perf.h
+++ b/tools/perform/sio_perf.h
@@ -52,21 +52,21 @@ typedef enum vfdtype_ {
typedef struct parameters_ {
iotype io_type; /* The type of IO test to perform */
vfdtype vfd;
- long num_files; /* Number of files to create */
- long num_dsets; /* Number of datasets to create */
- off_t num_bytes; /* Number of bytes in each dset */
- int num_iters; /* Number of times to loop doing the IO */
- int rank; /* Rank of dataset */
- off_t dset_size[MAX_DIMS]; /* Dataset size */
- size_t buf_size[MAX_DIMS]; /* Buffer size */
- size_t chk_size[MAX_DIMS]; /* Chunk size */
- int order[MAX_DIMS]; /* Buffer size */
- hsize_t h5_align; /* HDF5 object alignment */
- hsize_t h5_thresh; /* HDF5 object alignment threshold */
- int h5_use_chunks; /* Make HDF5 dataset chunked */
- int h5_extendable; /* Make HDF5 dataset chunked */
- int h5_write_only; /* Perform the write tests only */
- int verify; /* Verify data correctness */
+ long num_files; /* Number of files to create */
+ long num_dsets; /* Number of datasets to create */
+ hsize_t num_bytes; /* Number of bytes in each dset */
+ int num_iters; /* Number of times to loop doing the IO */
+ int rank; /* Rank of dataset */
+ hsize_t dset_size[MAX_DIMS]; /* Dataset size */
+ size_t buf_size[MAX_DIMS]; /* Buffer size */
+ size_t chk_size[MAX_DIMS]; /* Chunk size */
+ int order[MAX_DIMS]; /* Buffer size */
+ hsize_t h5_align; /* HDF5 object alignment */
+ hsize_t h5_thresh; /* HDF5 object alignment threshold */
+ int h5_use_chunks; /* Make HDF5 dataset chunked */
+ int h5_extendable; /* Make HDF5 dataset chunked */
+ int h5_write_only; /* Perform the write tests only */
+ int verify; /* Verify data correctness */
} parameters;
typedef struct results_ {
@@ -95,7 +95,7 @@ extern int sio_debug_level; /* The debug level:
extern "C" {
#endif /* __cplusplus */
-extern results do_sio(parameters param);
+extern void do_sio(parameters param, results *res);
#ifdef __cplusplus
}
diff --git a/tools/perform/zip_perf.c b/tools/perform/zip_perf.c
index d025602..d9b1fa2 100644
--- a/tools/perform/zip_perf.c
+++ b/tools/perform/zip_perf.c
@@ -37,7 +37,7 @@
#define MICROSECOND 1000000.0F
/* report 0.0 in case t is zero too */
-#define MB_PER_SEC(bytes,t) ((fabs(t)<0.0000000001F) ? 0.0F : ((((double)bytes) / ONE_MB) / (t)))
+#define MB_PER_SEC(bytes,t) ((fabs(t) < (double)0.0000000001F) ? (double)0.0F : ((((double)bytes) / (double)ONE_MB) / (t)))
#ifndef TRUE
#define TRUE 1
@@ -173,7 +173,7 @@ write_file(Bytef *source, uLongf sourceLen)
/* destination buffer needs to be at least 0.1% larger than sourceLen
* plus 12 bytes */
- destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1F)) + 12;
+ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * (double)0.1F)) + 12;
dest = (Bytef *)HDmalloc(destLen);
if (!dest)
@@ -184,9 +184,9 @@ write_file(Bytef *source, uLongf sourceLen)
HDgettimeofday(&timer_stop, NULL);
compression_time += ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
if (report_once_flag) {
HDfprintf(stdout, "\tCompression Ratio: %g\n", ((double)destLen) / (double)sourceLen);
@@ -206,7 +206,7 @@ write_file(Bytef *source, uLongf sourceLen)
if (rc == (int)d_len)
break;
- d_len -= rc;
+ d_len -= (size_t)rc;
d_ptr += rc;
}
@@ -419,7 +419,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
break;
buf += rc;
- len -= rc;
+ len -= (size_t)rc;
}
} else {
HDfprintf(stdout, "Using random() for random data\n");
@@ -429,7 +429,7 @@ fill_with_random_data(Bytef *src, uLongf src_len)
}
if (compress_percent) {
- unsigned long s = src_len * compress_percent / 100;
+ size_t s = (size_t)((src_len * (uLongf)compress_percent) / 100);
HDmemset(src, '\0', s);
}
@@ -495,7 +495,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
if (rc == (ssize_t)s_len)
break;
- s_len -= rc;
+ s_len -= (size_t)rc;
s_ptr += rc;
}
}
@@ -504,9 +504,9 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDgettimeofday(&timer_stop, NULL);
total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tUncompressed Write Time: %.2fs\n", total_time);
HDfprintf(stdout, "\tUncompressed Write Throughput: %.2fMB/s\n",
@@ -530,9 +530,9 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size,
HDgettimeofday(&timer_stop, NULL);
total_time = ((double)timer_stop.tv_sec +
- ((double)timer_stop.tv_usec) / MICROSECOND) -
+ ((double)timer_stop.tv_usec) / (double)MICROSECOND) -
((double)timer_start.tv_sec +
- ((double)timer_start.tv_usec) / MICROSECOND);
+ ((double)timer_start.tv_usec) / (double)MICROSECOND);
HDfprintf(stdout, "\tCompressed Write Time: %.2fs\n", total_time);
HDfprintf(stdout, "\tCompressed Write Throughput: %.2fMB/s\n",