summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-10-08 01:55:21 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-10-08 01:55:21 (GMT)
commit3c470c9db63424d8a07c1fb789ee8e8c513dd2a6 (patch)
tree8ce7ec40f5c5e04898281cefa0f72c3e91cf9d66 /src
parent6747ebd9858374ae912b6182024861b1710518c8 (diff)
downloadhdf5-3c470c9db63424d8a07c1fb789ee8e8c513dd2a6.zip
hdf5-3c470c9db63424d8a07c1fb789ee8e8c513dd2a6.tar.gz
hdf5-3c470c9db63424d8a07c1fb789ee8e8c513dd2a6.tar.bz2
[svn-r19543] Description:
Bring r19411:19542 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/H5Aint.c3
-rw-r--r--src/H5C.c2
-rw-r--r--src/H5Dchunk.c139
-rw-r--r--src/H5Dcontig.c983
-rw-r--r--src/H5Defl.c216
-rw-r--r--src/H5Dint.c2
-rw-r--r--src/H5Dpkg.h8
-rw-r--r--src/H5G.c16
-rw-r--r--src/H5Gent.c85
-rw-r--r--src/H5Glink.c5
-rw-r--r--src/H5Gloc.c5
-rw-r--r--src/H5Gnode.c24
-rw-r--r--src/H5Gobj.c29
-rw-r--r--src/H5Goh.c2
-rw-r--r--src/H5Gpkg.h41
-rw-r--r--src/H5Gprivate.h5
-rw-r--r--src/H5Groot.c9
-rw-r--r--src/H5Gstab.c11
-rw-r--r--src/H5Gtraverse.c10
-rw-r--r--src/H5L.c8
-rw-r--r--src/H5Ocopy.c66
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Oprivate.h3
-rw-r--r--src/H5Oshared.c3
-rw-r--r--src/H5Ostab.c12
-rw-r--r--src/H5Shyper.c1794
-rw-r--r--src/H5Sselect.c4
-rw-r--r--src/H5V.c433
-rw-r--r--src/H5Vprivate.h11
-rw-r--r--src/H5private.h2
-rw-r--r--src/H5public.h4
-rw-r--r--src/Makefile.in22
33 files changed, 2467 insertions, 1496 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b66c872..92469a3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -561,10 +561,10 @@ SET (H5_PUBLIC_HEADERS
# --------------------------------------------------------------------
# If we are compiling on Windows then add the windows specific files
# --------------------------------------------------------------------
-IF (WIN32)
+IF (WIN32 AND NOT CYGWIN)
SET (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5FDwindows.c)
SET (H5_PUBLIC_HEADERS ${H5_PUBLIC_HEADERS} ${HDF5_SRC_DIR}/H5FDwindows.h)
-ENDIF (WIN32)
+ENDIF (WIN32 AND NOT CYGWIN)
SET (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5private.h
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 30d662e..3ffc6d3 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -872,7 +872,8 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si
dst_oloc->file = file_dst;
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info, FALSE) < 0)
+ if(H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info, FALSE,
+ NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object")
/* Update shared message info from named datatype info */
diff --git a/src/H5C.c b/src/H5C.c
index de45d20..5b7984b 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -8713,7 +8713,7 @@ H5C_make_space_in_cache(H5F_t * f,
#endif /* H5C_COLLECT_CACHE_STATS */
HDassert( ( entries_examined > (2 * initial_list_len) ) ||
- ( (cache_ptr->pl_size + cache_ptr->min_clean_size) >
+ ( (cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) >
cache_ptr->max_cache_size ) ||
( ( cache_ptr->clean_index_size + empty_space )
>= cache_ptr->min_clean_size ) );
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 02de7ed..b14d28d 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -163,6 +163,13 @@ typedef struct H5D_chunk_it_ud4_t {
unsigned ndims; /* Number of dimensions for chunk/dataset */
} H5D_chunk_it_ud4_t;
+/* Callback info for nonexistent readvv operation */
+typedef struct H5D_chunk_readvv_ud_t {
+ unsigned char *rbuf; /* Read buffer to initialize */
+ H5D_t *dset; /* Dataset to operate on */
+ hid_t dxpl_id; /* DXPL for operation */
+} H5D_chunk_readvv_ud_t;
+
/********************/
/* Local Prototypes */
@@ -5635,6 +5642,55 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D_nonexistent_readvv_cb
+ *
+ * Purpose: Callback operation for performing fill value I/O operation
+ * on memory buffer.
+ *
+ * Note: This algorithm is pretty inefficient about initializing and
+ * terminating the fill buffer info structure and it would be
+ * faster to refactor this into a "real" initialization routine,
+ * and a "vectorized fill" routine. -QAK
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * 30 Sep 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_nonexistent_readvv_cb(hsize_t UNUSED dst_off, hsize_t src_off, size_t len,
+ void *_udata)
+{
+ H5D_chunk_readvv_ud_t *udata = (H5D_chunk_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
+ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_nonexistent_readvv_cb)
+
+ /* Initialize the fill value buffer */
+ if(H5D_fill_init(&fb_info, (udata->rbuf + src_off), NULL, NULL, NULL, NULL,
+ &udata->dset->shared->dcpl_cache.fill, udata->dset->shared->type,
+ udata->dset->shared->type_id, (size_t)0, len, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
+ fb_info_init = TRUE;
+
+ /* Check for VL datatype & fill the buffer with VL datatype fill values */
+ if(fb_info.has_vlen_fill_type && H5D_fill_refill_vl(&fb_info, fb_info.elmts_per_buf, udata->dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
+
+done:
+ /* Release the fill buffer info, if it's been initialized */
+ if(fb_info_init && H5D_fill_term(&fb_info) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D_nonexistent_readvv_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D_nonexistent_readvv
*
* Purpose: When the chunk doesn't exist on disk and the chunk is bigger
@@ -5656,82 +5712,35 @@ done:
*/
static ssize_t
H5D_nonexistent_readvv(const H5D_io_info_t *io_info,
- size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[])
+ size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_off_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */
- H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */
- hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */
- ssize_t bytes_processed = 0; /* Eventual return value */
- size_t u, v; /* Local index variables */
- ssize_t ret_value; /* Return value */
+ H5D_chunk_readvv_ud_t udata; /* User data for H5V_opvv() operator */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5D_nonexistent_readvv)
/* Check args */
+ HDassert(io_info);
+ HDassert(chunk_curr_seq);
HDassert(chunk_len_arr);
- HDassert(chunk_offset_arr);
+ HDassert(chunk_off_arr);
+ HDassert(mem_curr_seq);
HDassert(mem_len_arr);
- HDassert(mem_offset_arr);
-
- /* Work through all the sequences */
- for(u = *mem_curr_seq, v = *chunk_curr_seq; u < mem_max_nseq && v < chunk_max_nseq; ) {
- unsigned char *buf; /* Temporary pointer into read buffer */
- size_t size; /* Size of sequence in bytes */
+ HDassert(mem_off_arr);
- /* Choose smallest buffer to write */
- if(chunk_len_arr[v] < mem_len_arr[u])
- size = chunk_len_arr[v];
- else
- size = mem_len_arr[u];
-
- /* Compute offset in memory */
- buf = (unsigned char *)io_info->u.rbuf + mem_offset_arr[u];
-
- /* Initialize the fill value buffer */
- if(H5D_fill_init(&fb_info, buf, NULL, NULL, NULL, NULL,
- &dset->shared->dcpl_cache.fill, dset->shared->type,
- dset->shared->type_id, (size_t)0, size, io_info->dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
- fb_info_init = TRUE;
-
- /* Check for VL datatype & fill the buffer with VL datatype fill values */
- if(fb_info.has_vlen_fill_type && H5D_fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer")
-
- /* Release the fill buffer info */
- if(H5D_fill_term(&fb_info) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
- fb_info_init = FALSE;
-
- /* Update source information */
- chunk_len_arr[v] -= size;
- chunk_offset_arr[v] += size;
- if(chunk_len_arr[v] == 0)
- v++;
-
- /* Update destination information */
- mem_len_arr[u] -= size;
- mem_offset_arr[u] += size;
- if(mem_len_arr[u] == 0)
- u++;
-
- /* Increment number of bytes copied */
- bytes_processed += (ssize_t)size;
- } /* end for */
+ /* Set up user data for H5V_opvv() */
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
+ udata.dset = io_info->dset;
+ udata.dxpl_id = io_info->dxpl_id;
- /* Update current sequence vectors */
- *mem_curr_seq = u;
- *chunk_curr_seq = v;
-
- /* Set return value */
- ret_value = bytes_processed;
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_nonexistent_readvv_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized fill value init")
done:
- /* Release the fill buffer info, if it's been initialized */
- if(fb_info_init && H5D_fill_term(&fb_info) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D_nonexistent_readvv() */
diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c
index dcc7cdc..9b4f338 100644
--- a/src/H5Dcontig.c
+++ b/src/H5Dcontig.c
@@ -55,6 +55,40 @@
/* Local Typedefs */
/******************/
+/* Callback info for sieve buffer readvv operation */
+typedef struct H5D_contig_readvv_sieve_ud_t {
+ H5F_t *file; /* File for dataset */
+ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
+ unsigned char *rbuf; /* Pointer to buffer to fill */
+ hid_t dxpl_id; /* DXPL for operation */
+} H5D_contig_readvv_sieve_ud_t;
+
+/* Callback info for [plain] readvv operation */
+typedef struct H5D_contig_readvv_ud_t {
+ H5F_t *file; /* File for dataset */
+ haddr_t dset_addr; /* Address of dataset */
+ unsigned char *rbuf; /* Pointer to buffer to fill */
+ hid_t dxpl_id; /* DXPL for operation */
+} H5D_contig_readvv_ud_t;
+
+/* Callback info for sieve buffer writevv operation */
+typedef struct H5D_contig_writevv_sieve_ud_t {
+ H5F_t *file; /* File for dataset */
+ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */
+ const unsigned char *wbuf; /* Pointer to buffer to write */
+ hid_t dxpl_id; /* DXPL for operation */
+} H5D_contig_writevv_sieve_ud_t;
+
+/* Callback info for [plain] writevv operation */
+typedef struct H5D_contig_writevv_ud_t {
+ H5F_t *file; /* File for dataset */
+ haddr_t dset_addr; /* Address of dataset */
+ const unsigned char *wbuf; /* Pointer to buffer to write */
+ hid_t dxpl_id; /* DXPL for operation */
+} H5D_contig_writevv_ud_t;
+
/********************/
/* Local Prototypes */
@@ -65,6 +99,12 @@ static herr_t H5D_contig_construct(H5F_t *f, H5D_t *dset);
static herr_t H5D_contig_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *cm);
+static ssize_t H5D_contig_readvv(const H5D_io_info_t *io_info,
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
+static ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info,
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
static herr_t H5D_contig_flush(H5D_t *dset, hid_t dxpl_id);
/* Helper routines */
@@ -600,573 +640,590 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D_contig_readvv
+ * Function: H5D_contig_readvv_sieve_cb
*
- * Purpose: Reads some data vectors from a dataset into a buffer.
- * The data is contiguous. The address is the start of the dataset,
- * relative to the base address for the file and the offsets and
- * sequence lengths are in bytes.
+ * Purpose: Callback operator for H5D_contig_readvv() with sieve buffer.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Friday, May 3, 2001
- *
- * Notes:
- * Offsets in the sequences must be monotonically increasing
+ * Thursday, Sept 30, 2010
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5D_contig_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[])
+static herr_t
+H5D_contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
+ void *_udata)
{
- H5F_t *file = io_info->dset->oloc.file; /* File for dataset */
- H5D_rdcdc_t *dset_contig = &(io_info->dset->shared->cache.contig); /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig = &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
- unsigned char *buf = (unsigned char *)io_info->u.rbuf; /* Pointer to buffer to fill */
+ H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ H5F_t *file = udata->file; /* File for dataset */
+ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */
+ unsigned char *buf; /* Pointer to buffer to fill */
haddr_t addr; /* Actual address to read */
- size_t total_size = 0; /* Total size of sequence in bytes */
- size_t size; /* Size of sequence in bytes */
- size_t u; /* Counting variable */
- size_t v; /* Counting variable */
- ssize_t ret_value; /* Return value */
+ haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ size_t sieve_size = (size_t)-1; /* Size of sieve buffer */
+ haddr_t rel_eoa; /* Relative end of file address */
+ hsize_t max_data; /* Actual maximum size of data to cache */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL)
-#ifdef QAK
-HDfprintf(stderr, "%s: dset_max_nseq = %Zu\n", FUNC, dset_max_nseq);
-HDfprintf(stderr, "%s: mem_max_nseq = %Zu\n", FUNC, mem_max_nseq);
-HDfprintf(stderr, "%s: *dset_curr_seq= %Zu\n", FUNC, *dset_curr_seq);
-HDfprintf(stderr, "%s: *mem_curr_seq= %Zu\n", FUNC, *mem_curr_seq);
-for(u = 0; u < dset_max_nseq; u++)
- HDfprintf(stderr, "%s: dset_len_arr[%Zu] = %Zu, dset_offset_arr[%Zu] = %Hu\n", FUNC, u, dset_len_arr[u], u, dset_offset_arr[u]);
-for(u = 0; u < mem_max_nseq; u++)
- HDfprintf(stderr, "%s: mem_len_arr[%Zu] = %Zu, mem_offset_arr[%Zu] = %Hu\n", FUNC, u, mem_len_arr[u], u, mem_offset_arr[u]);
-#endif /* QAK */
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_readvv_sieve_cb)
- /* Check args */
- HDassert(io_info);
- HDassert(io_info->dset);
- HDassert(io_info->store);
- HDassert(buf);
+ /* Stash local copies of these value */
+ if(dset_contig->sieve_buf != NULL) {
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
+ } /* end if */
- /* Check if data sieving is enabled */
- if(H5F_HAS_FEATURE(file, H5FD_FEAT_DATA_SIEVE)) {
- haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
- haddr_t contig_end; /* End locations of block to write */
- size_t sieve_size = (size_t)-1; /* size of sieve buffer */
- haddr_t rel_eoa; /* Relative end of file address */
- hsize_t max_data; /* Actual maximum size of data to cache */
-
- /* Set offsets in sequence lists */
- u = *dset_curr_seq;
- v = *mem_curr_seq;
-
- /* Stash local copies of these value */
- if(dset_contig->sieve_buf != NULL) {
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start+sieve_size;
+ /* Compute offset on disk */
+ addr = store_contig->dset_addr + dst_off;
+
+ /* Compute offset in memory */
+ buf = udata->rbuf + src_off;
+
+ /* Check if the sieve buffer is allocated yet */
+ if(NULL == dset_contig->sieve_buf) {
+ /* Check if we can actually hold the I/O request in the sieve buffer */
+ if(len > dset_contig->sieve_buf_size) {
+ if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, udata->dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
+ else {
+ /* Allocate room for the data sieve buffer */
+ if(NULL == (dset_contig->sieve_buf = H5FL_BLK_MALLOC(sieve_buf, dset_contig->sieve_buf_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
- /* Works through sequences as fast as possible */
- for(; u < dset_max_nseq && v < mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v] < dset_len_arr[u])
- size = mem_len_arr[v];
- else
- size = dset_len_arr[u];
+ /* Determine the new sieve buffer size & location */
+ dset_contig->sieve_loc = addr;
- /* Compute offset on disk */
- addr = store_contig->dset_addr + dset_offset_arr[u];
+ /* Make certain we don't read off the end of the file */
+ if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
- /* Compute offset in memory */
- buf = (unsigned char *)io_info->u.rbuf + mem_offset_arr[v];
+ /* Set up the buffer parameters */
+ max_data = store_contig->dset_size - dst_off;
- /* Check if the sieve buffer is allocated yet */
- if(dset_contig->sieve_buf == NULL) {
- /* Check if we can actually hold the I/O request in the sieve buffer */
- if(size>dset_contig->sieve_buf_size) {
- if(H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
- } /* end if */
- else {
- /* Allocate room for the data sieve buffer */
- if (NULL==(dset_contig->sieve_buf=H5FL_BLK_MALLOC(sieve_buf,dset_contig->sieve_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ /* Compute the size of the sieve buffer */
+ H5_ASSIGN_OVERFLOW(dset_contig->sieve_size, MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size), hsize_t, size_t);
- /* Determine the new sieve buffer size & location */
- dset_contig->sieve_loc=addr;
+ /* Read the new sieve buffer */
+ if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
- /* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
+ /* Grab the data out of the buffer (must be first piece of data in buffer ) */
+ HDmemcpy(buf, dset_contig->sieve_buf, len);
- /* Set up the buffer parameters */
- max_data = store_contig->dset_size-dset_offset_arr[u];
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
- /* Compute the size of the sieve buffer */
- H5_ASSIGN_OVERFLOW(dset_contig->sieve_size, MIN3(rel_eoa-dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size), hsize_t, size_t);
+ /* Stash local copies of these value */
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start+sieve_size;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Compute end of sequence to retrieve */
+ contig_end = addr + len - 1;
- /* Read the new sieve buffer */
- if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
+ /* If entire read is within the sieve buffer, read it from the buffer */
+ if(addr >= sieve_start && contig_end < sieve_end) {
+ unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
- /* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, size);
+ /* Grab the data out of the buffer */
+ HDmemcpy(buf, base_sieve_buf, len);
+ } /* end if */
+ /* Entire request is not within this data sieve buffer */
+ else {
+ /* Check if we can actually hold the I/O request in the sieve buffer */
+ if(len > dset_contig->sieve_buf_size) {
+ /* Check for any overlap with the current sieve buffer */
+ if((sieve_start >= addr && sieve_start < (contig_end + 1))
+ || ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
+ /* Flush the sieve buffer, if it's dirty */
+ if(dset_contig->sieve_dirty) {
+ /* Write to file */
+ if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty = 0;
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
+ } /* end if */
+ } /* end if */
- /* Stash local copies of these value */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start+sieve_size;
- } /* end else */
+ /* Read directly into the user's buffer */
+ if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, udata->dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
} /* end if */
+ /* Element size fits within the buffer size */
else {
- /* Compute end of sequence to retrieve */
- contig_end = addr + size - 1;
+ /* Flush the sieve buffer if it's dirty */
+ if(dset_contig->sieve_dirty) {
+ /* Write to file */
+ if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
- /* If entire read is within the sieve buffer, read it from the buffer */
- if(addr>=sieve_start && contig_end<sieve_end) {
- unsigned char *base_sieve_buf=dset_contig->sieve_buf+(addr-sieve_start);
-
- /* Grab the data out of the buffer */
- HDmemcpy(buf, base_sieve_buf, size);
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
} /* end if */
- /* Entire request is not within this data sieve buffer */
- else {
- /* Check if we can actually hold the I/O request in the sieve buffer */
- if(size>dset_contig->sieve_buf_size) {
- /* Check for any overlap with the current sieve buffer */
- if((sieve_start>=addr && sieve_start<(contig_end+1))
- || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
- /* Flush the sieve buffer, if it's dirty */
- if(dset_contig->sieve_dirty) {
- /* Write to file */
- if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty = 0;
- } /* end if */
- } /* end if */
-
- /* Read directly into the user's buffer */
- if(H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
- } /* end if */
- /* Element size fits within the buffer size */
- else {
- /* Flush the sieve buffer if it's dirty */
- if(dset_contig->sieve_dirty) {
- /* Write to file */
- if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty=0;
- } /* end if */
+ /* Determine the new sieve buffer size & location */
+ dset_contig->sieve_loc = addr;
- /* Determine the new sieve buffer size & location */
- dset_contig->sieve_loc=addr;
+ /* Make certain we don't read off the end of the file */
+ if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
- /* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
+ /* Only need this when resizing sieve buffer */
+ max_data = store_contig->dset_size - dst_off;
- /* Only need this when resizing sieve buffer */
- max_data=store_contig->dset_size-dset_offset_arr[u];
+ /* Compute the size of the sieve buffer */
+ /* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
+ H5_ASSIGN_OVERFLOW(dset_contig->sieve_size, MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size), hsize_t, size_t);
- /* Compute the size of the sieve buffer */
- /* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- H5_ASSIGN_OVERFLOW(dset_contig->sieve_size,MIN3(rel_eoa-dset_contig->sieve_loc,max_data,dset_contig->sieve_buf_size),hsize_t,size_t);
+ /* Update local copies of sieve information */
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
- /* Update local copies of sieve information */
- sieve_start=dset_contig->sieve_loc;
- sieve_size=dset_contig->sieve_size;
- sieve_end=sieve_start+sieve_size;
+ /* Read the new sieve buffer */
+ if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
- /* Read the new sieve buffer */
- if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
-
- /* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(buf, dset_contig->sieve_buf, size);
+ /* Grab the data out of the buffer (must be first piece of data in buffer ) */
+ HDmemcpy(buf, dset_contig->sieve_buf, len);
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty = 0;
- } /* end else */
- } /* end else */
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
} /* end else */
+ } /* end else */
+ } /* end else */
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
-
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
-
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
- } /* end if */
- else {
- /* Work through all the sequences */
- for(u = *dset_curr_seq, v = *mem_curr_seq; u < dset_max_nseq && v < mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v] < dset_len_arr[u])
- size = mem_len_arr[v];
- else
- size = dset_len_arr[u];
-
- /* Compute offset on disk */
- addr = store_contig->dset_addr + dset_offset_arr[u];
-
- /* Compute offset in memory */
- buf = (unsigned char *)io_info->u.rbuf + mem_offset_arr[v];
-
- /* Write data */
- if(H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
-
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_contig_readvv_sieve_cb() */
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
- } /* end else */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_contig_readvv_cb
+ *
+ * Purpose: Callback operator for H5D_contig_readvv() without sieve buffer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, Sept 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
+{
+ H5D_contig_readvv_ud_t *udata = (H5D_contig_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Update current sequence vectors */
- *dset_curr_seq = u;
- *mem_curr_seq = v;
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_readvv_cb)
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value, total_size, size_t, ssize_t);
+ /* Write data */
+ if(H5F_block_read(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off),
+ len, udata->dxpl_id, (udata->rbuf + src_off)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_contig_readvv() */
+} /* end H5D_contig_readvv_cb() */
/*-------------------------------------------------------------------------
- * Function: H5D_contig_writevv
+ * Function: H5D_contig_readvv
*
- * Purpose: Writes some data vectors into a dataset from vectors into a
- * buffer. The address is the start of the dataset,
+ * Purpose: Reads some data vectors from a dataset into a buffer.
+ * The data is contiguous. The address is the start of the dataset,
* relative to the base address for the file and the offsets and
* sequence lengths are in bytes.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
- * Friday, May 2, 2003
+ * Friday, May 3, 2001
*
* Notes:
* Offsets in the sequences must be monotonically increasing
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5D_contig_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[])
+static ssize_t
+H5D_contig_readvv(const H5D_io_info_t *io_info,
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- H5F_t *file = io_info->dset->oloc.file; /* File for dataset */
- H5D_rdcdc_t *dset_contig = &(io_info->dset->shared->cache.contig); /* Cached information about contiguous data */
- const H5D_contig_storage_t *store_contig = &(io_info->store->contig); /* Contiguous storage info for this I/O operation */
- const unsigned char *buf = (const unsigned char *)io_info->u.wbuf; /* Pointer to buffer to fill */
- haddr_t addr; /* Actual address to read */
- size_t total_size = 0; /* Size of sequence in bytes */
- size_t size; /* Size of sequence in bytes */
- size_t u; /* Counting variable */
- size_t v; /* Counting variable */
ssize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5D_contig_writevv, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_readvv)
/* Check args */
HDassert(io_info);
- HDassert(io_info->dset);
- HDassert(io_info->store);
- HDassert(buf);
+ HDassert(dset_curr_seq);
+ HDassert(dset_len_arr);
+ HDassert(dset_off_arr);
+ HDassert(mem_curr_seq);
+ HDassert(mem_len_arr);
+ HDassert(mem_off_arr);
/* Check if data sieving is enabled */
- if(H5F_HAS_FEATURE(file,H5FD_FEAT_DATA_SIEVE)) {
- haddr_t sieve_start=HADDR_UNDEF, sieve_end=HADDR_UNDEF; /* Start & end locations of sieve buffer */
- haddr_t contig_end; /* End locations of block to write */
- size_t sieve_size=(size_t)-1; /* size of sieve buffer */
- haddr_t rel_eoa; /* Relative end of file address */
- hsize_t max_data; /* Actual maximum size of data to cache */
-
- /* Set offsets in sequence lists */
- u=*dset_curr_seq;
- v=*mem_curr_seq;
-
- /* Stash local copies of these values */
- if(dset_contig->sieve_buf!=NULL) {
- sieve_start=dset_contig->sieve_loc;
- sieve_size=dset_contig->sieve_size;
- sieve_end=sieve_start+sieve_size;
+ if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) {
+ H5D_contig_readvv_sieve_ud_t udata; /* User data for H5V_opvv() operator */
+
+ /* Set up user data for H5V_opvv() */
+ udata.file = io_info->dset->oloc.file;
+ udata.dset_contig = &(io_info->dset->shared->cache.contig);
+ udata.store_contig = &(io_info->store->contig);
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
+ udata.dxpl_id = io_info->dxpl_id;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_contig_readvv_sieve_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer read")
+ } /* end if */
+ else {
+ H5D_contig_readvv_ud_t udata; /* User data for H5V_opvv() operator */
+
+ /* Set up user data for H5V_opvv() */
+ udata.file = io_info->dset->oloc.file;
+ udata.dset_addr = io_info->store->contig.dset_addr;
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
+ udata.dxpl_id = io_info->dxpl_id;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_contig_readvv_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_contig_readvv() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_contig_writevv_sieve_cb
+ *
+ * Purpose: Callback operator for H5D_contig_writevv() with sieve buffer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, Sept 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len,
+ void *_udata)
+{
+ H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ H5F_t *file = udata->file; /* File for dataset */
+ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */
+ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */
+ const unsigned char *buf; /* Pointer to buffer to fill */
+ haddr_t addr; /* Actual address to read */
+ haddr_t sieve_start = HADDR_UNDEF, sieve_end = HADDR_UNDEF; /* Start & end locations of sieve buffer */
+ haddr_t contig_end; /* End locations of block to write */
+ size_t sieve_size = (size_t)-1; /* size of sieve buffer */
+ haddr_t rel_eoa; /* Relative end of file address */
+ hsize_t max_data; /* Actual maximum size of data to cache */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_writevv_sieve_cb)
+
+ /* Stash local copies of these values */
+ if(dset_contig->sieve_buf != NULL) {
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
+ } /* end if */
+
+ /* Compute offset on disk */
+ addr = store_contig->dset_addr + dst_off;
+
+ /* Compute offset in memory */
+ buf = udata->wbuf + src_off;
+
+ /* No data sieve buffer yet, go allocate one */
+ if(NULL == dset_contig->sieve_buf) {
+ /* Check if we can actually hold the I/O request in the sieve buffer */
+ if(len > dset_contig->sieve_buf_size) {
+ if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, udata->dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
} /* end if */
+ else {
+ /* Allocate room for the data sieve buffer */
+ if(NULL == (dset_contig->sieve_buf = H5FL_BLK_MALLOC(sieve_buf, dset_contig->sieve_buf_size)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed")
+#ifdef H5_CLEAR_MEMORY
+if(dset_contig->sieve_size > len)
+ HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len));
+#endif /* H5_CLEAR_MEMORY */
- /* Works through sequences as fast as possible */
- for(; u<dset_max_nseq && v<mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v]<dset_len_arr[u])
- size=mem_len_arr[v];
- else
- size=dset_len_arr[u];
+ /* Determine the new sieve buffer size & location */
+ dset_contig->sieve_loc = addr;
+
+ /* Make certain we don't read off the end of the file */
+ if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
+
+ /* Set up the buffer parameters */
+ max_data = store_contig->dset_size - dst_off;
+
+ /* Compute the size of the sieve buffer */
+ H5_ASSIGN_OVERFLOW(dset_contig->sieve_size, MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size), hsize_t, size_t);
+
+ /* Check if there is any point in reading the data from the file */
+ if(dset_contig->sieve_size > len) {
+ /* Read the new sieve buffer */
+ if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
+ } /* end if */
- /* Compute offset on disk */
- addr=store_contig->dset_addr+dset_offset_arr[u];
+ /* Grab the data out of the buffer (must be first piece of data in buffer ) */
+ HDmemcpy(dset_contig->sieve_buf, buf, len);
- /* Compute offset in memory */
- buf = (const unsigned char *)io_info->u.wbuf + mem_offset_arr[v];
+ /* Set sieve buffer dirty flag */
+ dset_contig->sieve_dirty = TRUE;
- /* No data sieve buffer yet, go allocate one */
- if(dset_contig->sieve_buf==NULL) {
- /* Check if we can actually hold the I/O request in the sieve buffer */
- if(size>dset_contig->sieve_buf_size) {
- if(H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
+ /* Stash local copies of these values */
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
+ } /* end else */
+ } /* end if */
+ else {
+ /* Compute end of sequence to retrieve */
+ contig_end = addr + len - 1;
+
+ /* If entire write is within the sieve buffer, write it to the buffer */
+ if(addr >= sieve_start && contig_end < sieve_end) {
+ unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
+
+ /* Put the data into the sieve buffer */
+ HDmemcpy(base_sieve_buf, buf, len);
+
+ /* Set sieve buffer dirty flag */
+ dset_contig->sieve_dirty = TRUE;
+ } /* end if */
+ /* Entire request is not within this data sieve buffer */
+ else {
+ /* Check if we can actually hold the I/O request in the sieve buffer */
+ if(len > dset_contig->sieve_buf_size) {
+ /* Check for any overlap with the current sieve buffer */
+ if((sieve_start >= addr && sieve_start < (contig_end + 1))
+ || ((sieve_end - 1) >= addr && (sieve_end - 1) < (contig_end + 1))) {
+ /* Flush the sieve buffer, if it's dirty */
+ if(dset_contig->sieve_dirty) {
+ /* Write to file */
+ if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
+
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
+ } /* end if */
+
+ /* Force the sieve buffer to be re-read the next time */
+ dset_contig->sieve_loc = HADDR_UNDEF;
+ dset_contig->sieve_size = 0;
} /* end if */
+
+ /* Write directly from the user's buffer */
+ if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, udata->dxpl_id, buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
+ } /* end if */
+ /* Element size fits within the buffer size */
+ else {
+ /* Check if it is possible to (exactly) prepend or append to existing (dirty) sieve buffer */
+ if(((addr + len) == sieve_start || addr == sieve_end) &&
+ (len + sieve_size) <= dset_contig->sieve_buf_size &&
+ dset_contig->sieve_dirty) {
+ /* Prepend to existing sieve buffer */
+ if((addr + len) == sieve_start) {
+ /* Move existing sieve information to correct location */
+ HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, dset_contig->sieve_size);
+
+ /* Copy in new information (must be first in sieve buffer) */
+ HDmemcpy(dset_contig->sieve_buf, buf, len);
+
+ /* Adjust sieve location */
+ dset_contig->sieve_loc = addr;
+
+ } /* end if */
+ /* Append to existing sieve buffer */
+ else {
+ /* Copy in new information */
+ HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, len);
+ } /* end else */
+
+ /* Adjust sieve size */
+ dset_contig->sieve_size += len;
+
+ /* Update local copies of sieve information */
+ sieve_start = dset_contig->sieve_loc;
+ sieve_size = dset_contig->sieve_size;
+ sieve_end = sieve_start + sieve_size;
+ } /* end if */
+ /* Can't add the new data onto the existing sieve buffer */
else {
- /* Allocate room for the data sieve buffer */
- if(NULL == (dset_contig->sieve_buf = H5FL_BLK_MALLOC(sieve_buf, dset_contig->sieve_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
-#ifdef H5_CLEAR_MEMORY
-if(dset_contig->sieve_size > size)
- HDmemset(dset_contig->sieve_buf + size, 0, (dset_contig->sieve_size - size));
-#endif /* H5_CLEAR_MEMORY */
+ /* Flush the sieve buffer if it's dirty */
+ if(dset_contig->sieve_dirty) {
+ /* Write to file */
+ if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
+
+ /* Reset sieve buffer dirty flag */
+ dset_contig->sieve_dirty = FALSE;
+ } /* end if */
/* Determine the new sieve buffer size & location */
- dset_contig->sieve_loc=addr;
+ dset_contig->sieve_loc = addr;
/* Make certain we don't read off the end of the file */
if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size")
- /* Set up the buffer parameters */
- max_data=store_contig->dset_size-dset_offset_arr[u];
+ /* Only need this when resizing sieve buffer */
+ max_data = store_contig->dset_size - dst_off;
/* Compute the size of the sieve buffer */
- H5_ASSIGN_OVERFLOW(dset_contig->sieve_size,MIN3(rel_eoa-dset_contig->sieve_loc,max_data,dset_contig->sieve_buf_size),hsize_t,size_t);
-
- /* Check if there is any point in reading the data from the file */
- if(dset_contig->sieve_size>size) {
- /* Read the new sieve buffer */
- if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
- } /* end if */
-
- /* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, size);
-
- /* Set sieve buffer dirty flag */
- dset_contig->sieve_dirty = 1;
+ /* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
+ H5_ASSIGN_OVERFLOW(dset_contig->sieve_size, MIN3(rel_eoa - dset_contig->sieve_loc, max_data, dset_contig->sieve_buf_size), hsize_t, size_t);
- /* Stash local copies of these values */
+ /* Update local copies of sieve information */
sieve_start = dset_contig->sieve_loc;
sieve_size = dset_contig->sieve_size;
sieve_end = sieve_start + sieve_size;
- } /* end else */
- } /* end if */
- else {
- /* Compute end of sequence to retrieve */
- contig_end=addr+size-1;
- /* If entire write is within the sieve buffer, write it to the buffer */
- if(addr>=sieve_start && contig_end<sieve_end) {
- unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start);
+ /* Check if there is any point in reading the data from the file */
+ if(dset_contig->sieve_size > len) {
+ /* Read the new sieve buffer */
+ if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, udata->dxpl_id, dset_contig->sieve_buf) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed")
+ } /* end if */
- /* Put the data into the sieve buffer */
- HDmemcpy(base_sieve_buf, buf, size);
+ /* Grab the data out of the buffer (must be first piece of data in buffer ) */
+ HDmemcpy(dset_contig->sieve_buf, buf, len);
/* Set sieve buffer dirty flag */
- dset_contig->sieve_dirty = 1;
- } /* end if */
- /* Entire request is not within this data sieve buffer */
- else {
- /* Check if we can actually hold the I/O request in the sieve buffer */
- if(size>dset_contig->sieve_buf_size) {
- /* Check for any overlap with the current sieve buffer */
- if((sieve_start>=addr && sieve_start<(contig_end+1))
- || ((sieve_end-1)>=addr && (sieve_end-1)<(contig_end+1))) {
- /* Flush the sieve buffer, if it's dirty */
- if(dset_contig->sieve_dirty) {
- /* Write to file */
- if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty=0;
- } /* end if */
-
- /* Force the sieve buffer to be re-read the next time */
- dset_contig->sieve_loc=HADDR_UNDEF;
- dset_contig->sieve_size=0;
- } /* end if */
-
- /* Write directly from the user's buffer */
- if(H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
- } /* end if */
- /* Element size fits within the buffer size */
- else {
- /* Check if it is possible to (exactly) prepend or append to existing (dirty) sieve buffer */
- if(((addr+size)==sieve_start || addr==sieve_end) &&
- (size+sieve_size)<=dset_contig->sieve_buf_size &&
- dset_contig->sieve_dirty) {
- /* Prepend to existing sieve buffer */
- if((addr + size) == sieve_start) {
- /* Move existing sieve information to correct location */
- HDmemmove(dset_contig->sieve_buf + size, dset_contig->sieve_buf, dset_contig->sieve_size);
-
- /* Copy in new information (must be first in sieve buffer) */
- HDmemcpy(dset_contig->sieve_buf, buf, size);
-
- /* Adjust sieve location */
- dset_contig->sieve_loc = addr;
-
- } /* end if */
- /* Append to existing sieve buffer */
- else {
- /* Copy in new information */
- HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, size);
- } /* end else */
-
- /* Adjust sieve size */
- dset_contig->sieve_size += size;
-
- /* Update local copies of sieve information */
- sieve_start = dset_contig->sieve_loc;
- sieve_size = dset_contig->sieve_size;
- sieve_end = sieve_start + sieve_size;
- } /* end if */
- /* Can't add the new data onto the existing sieve buffer */
- else {
- /* Flush the sieve buffer if it's dirty */
- if(dset_contig->sieve_dirty) {
- /* Write to file */
- if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Reset sieve buffer dirty flag */
- dset_contig->sieve_dirty=0;
- } /* end if */
-
- /* Determine the new sieve buffer size & location */
- dset_contig->sieve_loc=addr;
-
- /* Make certain we don't read off the end of the file */
- if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size")
-
- /* Only need this when resizing sieve buffer */
- max_data=store_contig->dset_size-dset_offset_arr[u];
-
- /* Compute the size of the sieve buffer */
- /* Don't read off the end of the file, don't read past the end of the data element and don't read more than the buffer size */
- H5_ASSIGN_OVERFLOW(dset_contig->sieve_size,MIN3(rel_eoa-dset_contig->sieve_loc,max_data,dset_contig->sieve_buf_size),hsize_t,size_t);
-
- /* Update local copies of sieve information */
- sieve_start=dset_contig->sieve_loc;
- sieve_size=dset_contig->sieve_size;
- sieve_end=sieve_start+sieve_size;
-
- /* Check if there is any point in reading the data from the file */
- if(dset_contig->sieve_size>size) {
- /* Read the new sieve buffer */
- if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed")
- } /* end if */
-
- /* Grab the data out of the buffer (must be first piece of data in buffer ) */
- HDmemcpy(dset_contig->sieve_buf, buf, size);
-
- /* Set sieve buffer dirty flag */
- dset_contig->sieve_dirty = 1;
- } /* end else */
- } /* end else */
+ dset_contig->sieve_dirty = TRUE;
} /* end else */
} /* end else */
+ } /* end else */
+ } /* end else */
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
-
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
-
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
- } /* end if */
- else {
- /* Work through all the sequences */
- for(u = *dset_curr_seq, v = *mem_curr_seq; u < dset_max_nseq && v < mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v] < dset_len_arr[u])
- size = mem_len_arr[v];
- else
- size = dset_len_arr[u];
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_contig_writevv_sieve_cb() */
- /* Compute offset on disk */
- addr = store_contig->dset_addr + dset_offset_arr[u];
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_contig_writevv_cb
+ *
+ * Purpose: Callback operator for H5D_contig_writevv().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, Sept 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
+{
+ H5D_contig_writevv_ud_t *udata = (H5D_contig_writevv_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Compute offset in memory */
- buf = (const unsigned char *)io_info->u.wbuf + mem_offset_arr[v];
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_writevv_cb)
- /* Write data */
- if(H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
+ /* Write data */
+ if(H5F_block_write(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, udata->dxpl_id, (udata->wbuf + src_off)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed")
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_contig_writevv_cb() */
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_contig_writevv
+ *
+ * Purpose: Writes some data vectors into a dataset from vectors into a
+ * buffer. The address is the start of the dataset,
+ * relative to the base address for the file and the offsets and
+ * sequence lengths are in bytes.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, May 2, 2003
+ *
+ * Notes:
+ * Offsets in the sequences must be monotonically increasing
+ *
+ *-------------------------------------------------------------------------
+ */
+static ssize_t
+H5D_contig_writevv(const H5D_io_info_t *io_info,
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
+{
+ ssize_t ret_value; /* Return value (Size of sequence in bytes) */
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
- } /* end else */
+ FUNC_ENTER_NOAPI_NOINIT(H5D_contig_writevv)
- /* Update current sequence vectors */
- *dset_curr_seq = u;
- *mem_curr_seq = v;
+ /* Check args */
+ HDassert(io_info);
+ HDassert(dset_curr_seq);
+ HDassert(dset_len_arr);
+ HDassert(dset_off_arr);
+ HDassert(mem_curr_seq);
+ HDassert(mem_len_arr);
+ HDassert(mem_off_arr);
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value, total_size, size_t, ssize_t);
+ /* Check if data sieving is enabled */
+ if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) {
+ H5D_contig_writevv_sieve_ud_t udata; /* User data for H5V_opvv() operator */
+
+ /* Set up user data for H5V_opvv() */
+ udata.file = io_info->dset->oloc.file;
+ udata.dset_contig = &(io_info->dset->shared->cache.contig);
+ udata.store_contig = &(io_info->store->contig);
+ udata.wbuf = (const unsigned char *)io_info->u.wbuf;
+ udata.dxpl_id = io_info->dxpl_id;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_contig_writevv_sieve_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer write")
+ } /* end if */
+ else {
+ H5D_contig_writevv_ud_t udata; /* User data for H5V_opvv() operator */
+
+ /* Set up user data for H5V_opvv() */
+ udata.file = io_info->dset->oloc.file;
+ udata.dset_addr = io_info->store->contig.dset_addr;
+ udata.wbuf = (const unsigned char *)io_info->u.wbuf;
+ udata.dxpl_id = io_info->dxpl_id;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_contig_writevv_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read")
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Defl.c b/src/H5Defl.c
index b0233d4..bcb47a2 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -33,6 +33,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
#include "H5HLprivate.h" /* Local Heaps */
+#include "H5Vprivate.h" /* Vector and array functions */
/****************/
@@ -44,6 +45,18 @@
/* Local Typedefs */
/******************/
+/* Callback info for readvv operation */
+typedef struct H5D_efl_readvv_ud_t {
+ const H5O_efl_t *efl; /* Pointer to efl info */
+ unsigned char *rbuf; /* Read buffer */
+} H5D_efl_readvv_ud_t;
+
+/* Callback info for writevv operation */
+typedef struct H5D_efl_writevv_ud_t {
+ const H5O_efl_t *efl; /* Pointer to efl info */
+ const unsigned char *wbuf; /* Write buffer */
+} H5D_efl_writevv_ud_t;
+
/********************/
/* Local Prototypes */
@@ -398,6 +411,35 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D_efl_readvv_cb
+ *
+ * Purpose: Callback operator for H5D_efl_readvv().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, Sept 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
+{
+ H5D_efl_readvv_ud_t *udata = (H5D_efl_readvv_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5D_efl_readvv_cb)
+
+ /* Read data */
+ if(H5D_efl_read(udata->efl, dst_off, len, (udata->rbuf + src_off)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_efl_readvv_cb() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D_efl_readvv
*
* Purpose: Reads data from an external file list. It is an error to
@@ -414,68 +456,67 @@ done:
*/
static ssize_t
H5D_efl_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[])
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- const H5O_efl_t *efl = &(io_info->store->efl); /* Pointer to efl info */
- unsigned char *buf; /* Pointer to buffer to write */
- haddr_t addr; /* Actual address to read */
- size_t total_size = 0; /* Total size of sequence in bytes */
- size_t size; /* Size of sequence in bytes */
- size_t u; /* Counting variable */
- size_t v; /* Counting variable */
- ssize_t ret_value; /* Return value */
+ H5D_efl_readvv_ud_t udata; /* User data for H5V_opvv() operator */
+ ssize_t ret_value; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_NOAPI_NOINIT(H5D_efl_readvv)
/* Check args */
- HDassert(efl && efl->nused > 0);
+ HDassert(io_info);
+ HDassert(io_info->store->efl.nused > 0);
HDassert(io_info->u.rbuf);
+ HDassert(dset_curr_seq);
+ HDassert(dset_len_arr);
+ HDassert(dset_off_arr);
+ HDassert(mem_curr_seq);
+ HDassert(mem_len_arr);
+ HDassert(mem_off_arr);
+
+ /* Set up user data for H5V_opvv() */
+ udata.efl = &(io_info->store->efl);
+ udata.rbuf = (unsigned char *)io_info->u.rbuf;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_efl_readvv_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL read")
- /* Work through all the sequences */
- for(u = *dset_curr_seq, v = *mem_curr_seq; u < dset_max_nseq && v < mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v] < dset_len_arr[u])
- size = mem_len_arr[v];
- else
- size = dset_len_arr[u];
-
- /* Compute offset on disk */
- addr = dset_offset_arr[u];
-
- /* Compute offset in memory */
- buf = (unsigned char *)io_info->u.rbuf + mem_offset_arr[v];
-
- /* Read data */
- if(H5D_efl_read(efl, addr, size, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
-
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
-
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D_efl_readvv() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D_efl_writevv_cb
+ *
+ * Purpose: Callback operator for H5D_efl_writevv().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, Sept 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D_efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata)
+{
+ H5D_efl_writevv_ud_t *udata = (H5D_efl_writevv_ud_t *)_udata; /* User data for H5V_opvv() operator */
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Update current sequence vectors */
- *dset_curr_seq = u;
- *mem_curr_seq = v;
+ FUNC_ENTER_NOAPI_NOINIT(H5D_efl_writevv_cb)
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value, total_size, size_t, ssize_t);
+ /* Write data */
+ if(H5D_efl_write(udata->efl, dst_off, len, (udata->wbuf + src_off)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_efl_readvv() */
+} /* end H5D_efl_writevv_cb() */
/*-------------------------------------------------------------------------
@@ -495,65 +536,34 @@ done:
*/
static ssize_t
H5D_efl_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[])
+ size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[],
+ size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[])
{
- const H5O_efl_t *efl = &(io_info->store->efl); /* Pointer to efl info */
- const unsigned char *buf; /* Pointer to buffer to write */
- haddr_t addr; /* Actual address to read */
- size_t total_size = 0; /* Total size of sequence in bytes */
- size_t size; /* Size of sequence in bytes */
- size_t u; /* Counting variable */
- size_t v; /* Counting variable */
- ssize_t ret_value; /* Return value */
+ H5D_efl_writevv_ud_t udata; /* User data for H5V_opvv() operator */
+ ssize_t ret_value; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_NOAPI_NOINIT(H5D_efl_writevv)
/* Check args */
- HDassert(efl && efl->nused > 0);
+ HDassert(io_info);
+ HDassert(io_info->store->efl.nused > 0);
HDassert(io_info->u.wbuf);
-
- /* Work through all the sequences */
- for(u = *dset_curr_seq, v = *mem_curr_seq; u < dset_max_nseq && v < mem_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(mem_len_arr[v] < dset_len_arr[u])
- size = mem_len_arr[v];
- else
- size = dset_len_arr[u];
-
- /* Compute offset on disk */
- addr = dset_offset_arr[u];
-
- /* Compute offset in memory */
- buf = (const unsigned char *)io_info->u.wbuf + mem_offset_arr[v];
-
- /* Write data */
- if(H5D_efl_write(efl, addr, size, buf) < 0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed")
-
- /* Update memory information */
- mem_len_arr[v] -= size;
- mem_offset_arr[v] += size;
- if(mem_len_arr[v] == 0)
- v++;
-
- /* Update file information */
- dset_len_arr[u] -= size;
- dset_offset_arr[u] += size;
- if(dset_len_arr[u] == 0)
- u++;
-
- /* Increment number of bytes copied */
- total_size += size;
- } /* end for */
-
- /* Update current sequence vectors */
- *dset_curr_seq = u;
- *mem_curr_seq = v;
-
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value, total_size, size_t, ssize_t);
-
+ HDassert(dset_curr_seq);
+ HDassert(dset_len_arr);
+ HDassert(dset_off_arr);
+ HDassert(mem_curr_seq);
+ HDassert(mem_len_arr);
+ HDassert(mem_off_arr);
+
+ /* Set up user data for H5V_opvv() */
+ udata.efl = &(io_info->store->efl);
+ udata.wbuf = (const unsigned char *)io_info->u.wbuf;
+
+ /* Call generic sequence operation routine */
+ if((ret_value = H5V_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr,
+ mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr,
+ H5D_efl_writevv_cb, &udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL write")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D_efl_writevv() */
diff --git a/src/H5Dint.c b/src/H5Dint.c
index ff53db0..46f15ea 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -563,7 +563,7 @@ done:
if(ret_value == NULL)
if(new_dset != NULL) {
if(new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement temporary datatype ID")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID")
new_dset = H5FL_FREE(H5D_shared_t, new_dset);
} /* end if */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index b701908..45e9870 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -423,7 +423,7 @@ typedef struct H5D_rdcdc_t {
haddr_t sieve_loc; /* File location (offset) of the data sieve buffer */
size_t sieve_size; /* Size of the data sieve buffer used (in bytes) */
size_t sieve_buf_size; /* Size of the data sieve buffer allocated (in bytes) */
- unsigned sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */
+ hbool_t sieve_dirty; /* Flag to indicate that the data sieve buffer is dirty */
} H5D_rdcdc_t;
/*
@@ -642,12 +642,6 @@ H5_DLL herr_t H5D_contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *typ
H5_DLL herr_t H5D_contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space,
H5D_chunk_map_t *fm);
-H5_DLL ssize_t H5D_contig_readvv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
-H5_DLL ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info,
- size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[],
- size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]);
H5_DLL herr_t H5D_contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src,
H5F_t *f_dst, H5O_storage_contig_t *storage_dst, H5T_t *src_dtype,
H5O_copy_t *cpy_info, hid_t dxpl_id);
diff --git a/src/H5G.c b/src/H5G.c
index 0b42324..18e6403 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -256,6 +256,8 @@ H5G_create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id,
/* Set up group creation info */
gcrt_info.gcpl_id = gcpl_id;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
/* Set up object creation information */
ocrt_info.obj_type = H5O_TYPE_GROUP;
@@ -315,6 +317,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
{
H5G_loc_t loc;
H5G_t *grp = NULL;
+ H5G_obj_create_t gcrt_info; /* Information for group creation */
hid_t ret_value;
FUNC_ENTER_API(H5Gcreate_anon, FAIL)
@@ -338,8 +341,13 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list")
+ /* Set up group creation info */
+ gcrt_info.gcpl_id = gcpl_id;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
+
/* Create the new group & get its ID */
- if(NULL == (grp = H5G_create(loc.oloc->file, gcpl_id, H5AC_dxpl_id)))
+ if(NULL == (grp = H5G_create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
@@ -853,7 +861,7 @@ H5G_term_interface(void)
*-------------------------------------------------------------------------
*/
H5G_t *
-H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id)
+H5G_create(H5F_t *file, H5G_obj_create_t *gcrt_info, hid_t dxpl_id)
{
H5G_t *grp = NULL; /*new group */
unsigned oloc_init = 0; /* Flag to indicate that the group object location was created successfully */
@@ -863,7 +871,7 @@ H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id)
/* check args */
HDassert(file);
- HDassert(gcpl_id != H5P_DEFAULT);
+ HDassert(gcrt_info->gcpl_id != H5P_DEFAULT);
HDassert(dxpl_id != H5P_DEFAULT);
/* create an open group */
@@ -873,7 +881,7 @@ H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Create the group object header */
- if(H5G_obj_create(file, dxpl_id, gcpl_id, &(grp->oloc)/*out*/) < 0)
+ if(H5G_obj_create(file, dxpl_id, gcrt_info, &(grp->oloc)/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header")
oloc_init = 1; /* Indicate that the object location information is valid */
diff --git a/src/H5Gent.c b/src/H5Gent.c
index a2e6159..cec788c 100644
--- a/src/H5Gent.c
+++ b/src/H5Gent.c
@@ -352,7 +352,8 @@ H5G_ent_reset(H5G_entry_t *ent)
*/
herr_t
H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name,
- const H5O_link_t *lnk, H5G_entry_t *ent)
+ const H5O_link_t *lnk, H5O_type_t obj_type, const void *crt_info,
+ H5G_entry_t *ent)
{
size_t name_offset; /* Offset of name in heap */
herr_t ret_value = SUCCEED; /* Return value */
@@ -373,13 +374,91 @@ H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name,
*/
name_offset = H5HL_insert(f, dxpl_id, heap, HDstrlen(name) + 1, name);
if(0 == name_offset || (size_t)(-1) == name_offset)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap")
ent->name_off = name_offset;
/* Build correct information for symbol table entry based on link type */
switch(lnk->type) {
case H5L_TYPE_HARD:
- ent->type = H5G_NOTHING_CACHED;
+ if(obj_type == H5O_TYPE_GROUP) {
+ const H5G_obj_create_t *gcrt_info = (const H5G_obj_create_t *)crt_info;
+
+ ent->type = gcrt_info->cache_type;
+ if(ent->type != H5G_NOTHING_CACHED)
+ ent->cache = gcrt_info->cache;
+#ifndef NDEBUG
+ else {
+ /* Make sure there is no stab message in the target object
+ */
+ H5O_loc_t targ_oloc; /* Location of link target */
+ htri_t stab_exists; /* Whether the target symbol table exists */
+
+ /* Build target object location */
+ if(H5O_loc_reset(&targ_oloc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location")
+ targ_oloc.file = f;
+ targ_oloc.addr = lnk->u.hard.addr;
+
+ /* Check if a symbol table message exists */
+ if((stab_exists = H5O_msg_exists(&targ_oloc, H5O_STAB_ID,
+ dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message")
+
+ HDassert(!stab_exists);
+ } /* end else */
+#endif /* NDEBUG */
+ } /* end if */
+ else if(obj_type == H5O_TYPE_UNKNOWN){
+ /* Try to retrieve symbol table information for caching */
+ H5O_loc_t targ_oloc; /* Location of link target */
+ H5O_t *oh; /* Link target object header */
+ H5O_stab_t stab; /* Link target symbol table */
+ htri_t stab_exists; /* Whether the target symbol table exists */
+
+ /* Build target object location */
+ if(H5O_loc_reset(&targ_oloc) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location")
+ targ_oloc.file = f;
+ targ_oloc.addr = lnk->u.hard.addr;
+
+ /* Get the object header */
+ if(NULL == (oh = H5O_protect(&targ_oloc, dxpl_id, H5AC_READ)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, FAIL, "unable to protect target object header")
+
+ /* Check if a symbol table message exists */
+ if((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) {
+ if(H5O_unprotect(&targ_oloc, dxpl_id, oh, H5AC__NO_FLAGS_SET)
+ < 0)
+ HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header");
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message")
+ } /* end if */
+
+ if(stab_exists) {
+ /* Read symbol table message */
+ if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_STAB_ID,
+ &stab)) {
+ if(H5O_unprotect(&targ_oloc, dxpl_id, oh,
+ H5AC__NO_FLAGS_SET) < 0)
+ HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header");
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read STAB message")
+ } /* end if */
+
+ /* Cache symbol table message */
+ ent->type = H5G_CACHED_STAB;
+ ent->cache.stab.btree_addr = stab.btree_addr;
+ ent->cache.stab.heap_addr = stab.heap_addr;
+ } /* end if */
+ else
+ /* No symbol table message, don't cache anything */
+ ent->type = H5G_NOTHING_CACHED;
+
+ if(H5O_unprotect(&targ_oloc, dxpl_id, oh, H5AC__NO_FLAGS_SET)
+ < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+ } /* end else */
+ else
+ ent->type = H5G_NOTHING_CACHED;
+
ent->header = lnk->u.hard.addr;
break;
diff --git a/src/H5Glink.c b/src/H5Glink.c
index d8e87b3..0049bfd 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -491,7 +491,10 @@ H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
HDassert(H5F_addr_defined(tmp_src_oloc.addr));
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ /* Don't care about obj_type or udata because those are only important
+ * for old style groups */
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info,
+ TRUE, NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Copy new destination object's information for eventual insertion */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index d95d705..82b7575 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -609,7 +609,7 @@ done:
*/
herr_t
H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
- hid_t dxpl_id)
+ H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id)
{
H5O_link_t lnk; /* Link for object to insert */
herr_t ret_value = SUCCEED; /* Return value */
@@ -631,7 +631,8 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc,
lnk.u.hard.addr = obj_loc->oloc->addr;
/* Insert new group into current group's symbol table */
- if(H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, obj_type, crt_info,
+ dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object")
/* Set the name of the object location */
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 2b793a9..5a2d736 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -640,7 +640,8 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr,
idx += cmp > 0 ? 1 : 0;
/* Convert link information & name to symbol table entry */
- if(H5G_ent_convert(f, dxpl_id, udata->common.heap, udata->common.name, udata->lnk, &ent) < 0)
+ if(H5G_ent_convert(f, dxpl_id, udata->common.heap, udata->common.name,
+ udata->lnk, udata->obj_type, udata->crt_info, &ent) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_INS_ERROR, "unable to convert link")
/* Determine where to place entry in node */
@@ -1238,6 +1239,9 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
H5O_link_t lnk; /* Link to insert */
const char *name; /* Name of source object */
H5G_entry_t tmp_src_ent; /* Temperary copy. Change will not affect the cache */
+ H5O_type_t obj_type; /* Target object type */
+ H5G_copy_file_ud_t *cpy_udata; /* Copy file udata */
+ H5G_obj_create_t gcrt_info; /* Group creation info */
/* expand soft link */
if(H5G_CACHED_SLINK == src_ent->type && cpy_info->expand_soft_link) {
@@ -1281,15 +1285,27 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
tmp_src_oloc.addr = src_ent->header;
/* Copy the shared object from source to destination */
- if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id, cpy_info, TRUE) < 0)
+ if(H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, dxpl_id,
+ cpy_info, TRUE, &obj_type, (void **)&cpy_udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy object")
+ /* Set up object creation info for symbol table insertion. Only
+ * case so far is for inserting old-style groups (for caching stab
+ * info). */
+ if(obj_type == H5O_TYPE_GROUP) {
+ gcrt_info.gcpl_id = H5P_DEFAULT;
+ gcrt_info.cache_type = cpy_udata->cache_type;
+ gcrt_info.cache = cpy_udata->cache;
+ } /* end if */
+
/* Construct link information for eventual insertion */
lnk.type = H5L_TYPE_HARD;
lnk.u.hard.addr = new_dst_oloc.addr;
} /* ( H5F_addr_defined(src_ent->header)) */
else if(H5G_CACHED_SLINK == src_ent->type) {
/* it is a soft link */
+ /* Set object type to unknown */
+ obj_type = H5O_TYPE_UNKNOWN;
/* Construct link information for eventual insertion */
lnk.type = H5L_TYPE_SOFT;
@@ -1313,7 +1329,9 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
/* Insert the new object in the destination file's group */
/* (Don't increment the link count - that's already done above for hard links) */
- if(H5G_stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, dxpl_id) < 0)
+ if(H5G_stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk,
+ obj_type, (obj_type == H5O_TYPE_GROUP ? &gcrt_info : NULL),
+ dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name")
/* Reset metadata tag */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 0dcf015..ce11990 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -126,7 +126,8 @@ static herr_t H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo,
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
+H5G_obj_create(H5F_t *f, hid_t dxpl_id, H5G_obj_create_t *gcrt_info,
+ H5O_loc_t *oloc/*out*/)
{
H5P_genplist_t *gc_plist; /* Group creation property list */
H5O_ginfo_t ginfo; /* Group info */
@@ -143,7 +144,7 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
HDassert(oloc);
/* Get the property list */
- if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcpl_id)))
+ if(NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcrt_info->gcpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a property list")
/* Get the group info property */
@@ -159,7 +160,8 @@ H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id, H5O_loc_t *oloc/*out*/)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info")
/* Call the "real" group creation routine now */
- if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcpl_id, oloc) < 0)
+ if(H5G_obj_create_real(f, dxpl_id, &ginfo, &linfo, &pline, gcrt_info, oloc)
+ < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group")
done:
@@ -182,11 +184,12 @@ done:
*/
herr_t
H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
- const H5O_linfo_t *linfo, const H5O_pline_t *pline, hid_t gcpl_id,
- H5O_loc_t *oloc/*out*/)
+ const H5O_linfo_t *linfo, const H5O_pline_t *pline,
+ H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/)
{
size_t hdr_size; /* Size of object header to request */
hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hid_t gcpl_id = gcrt_info->gcpl_id; /* Group creation property list ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_obj_create_real, FAIL)
@@ -285,6 +288,11 @@ H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* The group doesn't currently have a 'stab' message, go create one */
if(H5G_stab_create(oloc, dxpl_id, ginfo, &stab) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table")
+
+ /* Cache the symbol table information */
+ gcrt_info->cache_type = H5G_CACHED_STAB;
+ gcrt_info->cache.stab.btree_addr = stab.btree_addr;
+ gcrt_info->cache.stab.heap_addr = stab.heap_addr;
} /* end else */
done:
@@ -421,7 +429,8 @@ H5G_obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata)
/* Insert link into group */
/* (Casting away const OK - QAK) */
- if(H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, udata->dxpl_id) < 0)
+ if(H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE,
+ H5O_TYPE_UNKNOWN, NULL, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group")
done:
@@ -448,7 +457,7 @@ done:
*/
herr_t
H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
- hbool_t adj_link, hid_t dxpl_id)
+ hbool_t adj_link, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id)
{
H5O_pline_t tmp_pline; /* Pipeline message */
H5O_pline_t *pline = NULL; /* Pointer to pipeline message */
@@ -572,7 +581,8 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
* group is in the "new format" now and the link info should be
* set up, etc.
*/
- if(H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, dxpl_id) < 0)
+ if(H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, obj_type,
+ crt_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group")
/* Done with insertion now */
@@ -585,7 +595,8 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
/* Insert into symbol table or "dense" storage */
if(use_old_format) {
/* Insert into symbol table */
- if(H5G_stab_insert(grp_oloc, name, obj_lnk, dxpl_id) < 0)
+ if(H5G_stab_insert(grp_oloc, name, obj_lnk, obj_type, crt_info, dxpl_id)
+ < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table")
} /* end if */
else {
diff --git a/src/H5Goh.c b/src/H5Goh.c
index 4dc569c..fc7a1df 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -263,7 +263,7 @@ H5O_group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id)
HDassert(obj_loc);
/* Create the the group */
- if(NULL == (grp = H5G_create(f, crt_info->gcpl_id, dxpl_id)))
+ if(NULL == (grp = H5G_create(f, crt_info, dxpl_id)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group")
/* Set up the new group's location */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index 82aa2e0..f9bc41e 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -200,8 +200,10 @@ typedef struct H5G_bt_common_t {
*/
typedef struct H5G_bt_ins_t {
/* downward */
- H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
+ H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */
const H5O_link_t *lnk; /* Link to insert into table */
+ H5O_type_t obj_type; /* Type of object being inserted */
+ const void *crt_info; /* Creation info for object being inserted */
} H5G_bt_ins_t;
/*
@@ -331,10 +333,19 @@ typedef herr_t (*H5G_traverse_t)(H5G_loc_t *grp_loc/*in*/, const char *name,
H5G_own_loc_t *own_loc/*out*/);
/* Typedef for group creation operation */
-typedef struct {
+typedef struct H5G_obj_create_t{
hid_t gcpl_id; /* Group creation property list */
+ H5G_cache_type_t cache_type; /* Type of symbol table entry cache */
+ H5G_cache_t cache; /* Cached data for symbol table entry */
} H5G_obj_create_t;
+/* Callback information for copying groups */
+typedef struct H5G_copy_file_ud_t {
+ H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
+ H5G_cache_type_t cache_type; /* Type of symbol table entry cache */
+ H5G_cache_t cache; /* Cached data for symbol table entry */
+} H5G_copy_file_ud_t;
+
/*****************************/
/* Package Private Variables */
@@ -367,7 +378,8 @@ H5FL_EXTERN(H5G_shared_t);
/*
* General group routines
*/
-H5_DLL H5G_t *H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id);
+H5_DLL H5G_t *H5G_create(H5F_t *file, H5G_obj_create_t *gcrt_info,
+ hid_t dxpl_id);
H5_DLL H5G_t *H5G_create_named(const H5G_loc_t *loc, const char *name,
hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id);
H5_DLL H5G_t *H5G_open_name(const H5G_loc_t *loc, const char *name,
@@ -403,9 +415,11 @@ H5_DLL herr_t H5G_stab_create(H5O_loc_t *grp_oloc, hid_t dxpl_id,
const H5O_ginfo_t *ginfo, H5O_stab_t *stab);
H5_DLL herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name,
- H5O_link_t *obj_lnk, hid_t dxpl_id);
+ H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info,
+ hid_t dxpl_id);
H5_DLL herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
- H5O_link_t *obj_lnk, hid_t dxpl_id);
+ H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info,
+ hid_t dxpl_id);
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab);
H5_DLL herr_t H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data);
@@ -443,7 +457,8 @@ H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp,
H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp,
const H5G_entry_t *ent, unsigned n);
H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap,
- const char *name, const H5O_link_t *lnk, H5G_entry_t *ent);
+ const char *name, const H5O_link_t *lnk, H5O_type_t obj_type,
+ const void *crt_info, H5G_entry_t *ent);
H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent,
int fwidth, const H5HL_t *heap);
@@ -539,15 +554,17 @@ H5_DLL H5G_obj_t H5G_dense_get_type_by_idx(H5F_t *f, hid_t dxpl_id,
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Functions that understand group objects */
-H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id, hid_t gcpl_id,
- H5O_loc_t *oloc/*out*/);
-H5_DLL herr_t H5G_obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
- const H5O_linfo_t *linfo, const H5O_pline_t *pline, hid_t gcpl_id,
+H5_DLL herr_t H5G_obj_create(H5F_t *f, hid_t dxpl_id,
+ H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/);
+H5_DLL herr_t H5G_obj_create_real(H5F_t *f, hid_t dxpl_id,
+ const H5O_ginfo_t *ginfo, const H5O_linfo_t *linfo,
+ const H5O_pline_t *pline, H5G_obj_create_t *gcrt_info,
H5O_loc_t *oloc/*out*/);
H5_DLL htri_t H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo,
hid_t dxpl_id);
H5_DLL herr_t H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name,
- H5O_link_t *obj_lnk, hbool_t adj_link, hid_t dxpl_id);
+ H5O_link_t *obj_lnk, hbool_t adj_link, H5O_type_t obj_type,
+ const void *crt_info, hid_t dxpl_id);
H5_DLL herr_t H5G_obj_iterate(const H5O_loc_t *grp_oloc,
H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
H5G_lib_iterate_t op, void *op_data, hid_t dxpl_id);
@@ -576,7 +593,7 @@ H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char
H5_DLL herr_t H5G_loc_root(H5F_t *f, H5G_loc_t *loc);
H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth);
H5_DLL herr_t H5G_loc_insert(H5G_loc_t *grp_loc, const char *name,
- H5G_loc_t *obj_loc, hid_t dxpl_id);
+ H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info, hid_t dxpl_id);
/* Testing functions */
#ifdef H5G_TESTING
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 7b09423..05de2ba 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -141,11 +141,6 @@ typedef struct {
H5G_name_t *path; /* Group hierarchy path */
} H5G_loc_t;
-/* Callback information for copying groups */
-typedef struct H5G_copy_file_ud_t {
- H5O_copy_file_ud_common_t common; /* Shared information (must be first) */
-} H5G_copy_file_ud_t;
-
typedef struct H5G_t H5G_t;
typedef struct H5G_shared_t H5G_shared_t;
typedef struct H5G_entry_t H5G_entry_t;
diff --git a/src/H5Groot.c b/src/H5Groot.c
index f754f29..a79a5dd 100644
--- a/src/H5Groot.c
+++ b/src/H5Groot.c
@@ -97,6 +97,7 @@ herr_t
H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root)
{
H5G_loc_t root_loc; /* Root location information */
+ H5G_obj_create_t gcrt_info; /* Root group object creation info */
htri_t stab_exists = -1; /* Whether the symbol table exists */
hbool_t sblock_dirty = FALSE; /* Whether superblock was dirtied */
hbool_t path_init = FALSE; /* Whether path was initialized */
@@ -140,7 +141,9 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root)
if(create_root) {
/* Create root group */
/* (Pass the FCPL which is a sub-class of the group creation property class) */
- if(H5G_obj_create(f, dxpl_id, f->shared->fcpl_id, root_loc.oloc/*out*/) < 0)
+ gcrt_info.gcpl_id = f->shared->fcpl_id;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ if(H5G_obj_create(f, dxpl_id, &gcrt_info, root_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
if(1 != H5O_link(root_loc.oloc, 1, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
@@ -156,7 +159,9 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, hbool_t create_root)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for symbol table entry")
/* Initialize the root group symbol table entry */
- f->shared->sblock->root_ent->type = H5G_NOTHING_CACHED; /* We will cache the stab later */
+ f->shared->sblock->root_ent->type = gcrt_info.cache_type;
+ if(gcrt_info.cache_type != H5G_NOTHING_CACHED)
+ f->shared->sblock->root_ent->cache = gcrt_info.cache;
f->shared->sblock->root_ent->name_off = 0; /* No name (yet) */
f->shared->sblock->root_ent->header = root_loc.oloc->addr;
} /* end if */
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 0566725..7d0ad48 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -221,7 +221,8 @@ done:
*/
herr_t
H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
- H5O_link_t *obj_lnk, hid_t dxpl_id)
+ H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info,
+ hid_t dxpl_id)
{
H5HL_t *heap = NULL; /* Pointer to local heap */
H5G_bt_ins_t udata; /* Data to pass through B-tree */
@@ -243,6 +244,8 @@ H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name,
udata.common.name = name;
udata.common.heap = heap;
udata.lnk = obj_lnk;
+ udata.obj_type = obj_type;
+ udata.crt_info = crt_info;
/* Insert into symbol table */
if(H5B_insert(f, dxpl_id, H5B_SNODE, stab->btree_addr, &udata) < 0)
@@ -273,7 +276,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
+H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name,
+ H5O_link_t *obj_lnk, H5O_type_t obj_type, const void *crt_info,
hid_t dxpl_id)
{
H5O_stab_t stab; /* Symbol table message */
@@ -290,7 +294,8 @@ H5G_stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk
if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
- if(H5G_stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, dxpl_id) < 0)
+ if(H5G_stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, obj_type,
+ crt_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name")
done:
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index d8cf0f3..4016068 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -735,6 +735,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
const H5O_ginfo_t *ginfo; /* Group info settings for new group */
const H5O_linfo_t *linfo; /* Link info settings for new group */
const H5O_pline_t *pline; /* Filter pipeline settings for new group */
+ H5G_obj_create_t gcrt_info; /* Group creation info */
/* Check for the parent group having a group info message */
/* (OK if not found) */
@@ -788,11 +789,16 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Create the intermediate group */
/* XXX: Should we allow user to control the group creation params here? -QAK */
- if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, H5P_GROUP_CREATE_DEFAULT, obj_loc.oloc/*out*/) < 0)
+ gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT;
+ gcrt_info.cache_type = H5G_NOTHING_CACHED;
+ HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
+ if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo,
+ pline, &gcrt_info, obj_loc.oloc/*out*/) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
/* Insert new group into current group's symbol table */
- if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc, dxpl_id) < 0)
+ if(H5G_loc_insert(&grp_loc, H5G_comp_g, &obj_loc,
+ H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group")
/* Close new group */
diff --git a/src/H5L.c b/src/H5L.c
index 42399fb..64e194a 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1716,7 +1716,10 @@ H5L_link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t UNUSED
udata->lnk->name = (char *)name;
/* Insert link into group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE,
+ udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN,
+ udata->ocrt_info ? udata->ocrt_info->crt_info : NULL,
+ udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object")
/* Set object's path if it has been passed in and is not set */
@@ -2418,7 +2421,8 @@ H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
udata->lnk->name = (char *)name;
/* Insert the link into the group */
- if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->dxpl_id) < 0)
+ if(H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN,
+ NULL, udata->dxpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object")
/* If the link was a user-defined link, call its move callback if it has one */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 7a10765..1ecd16f 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -66,7 +66,7 @@
static herr_t H5O_copy_free_addrmap_cb(void *item, void *key, void *op_data);
static herr_t H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
- hid_t dxpl_id, H5O_copy_t *cpy_info);
+ hid_t dxpl_id, H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata);
static herr_t H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
hid_t dxpl_id, unsigned cpy_option);
static herr_t H5O_copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc,
@@ -285,7 +285,7 @@ done:
*/
static herr_t
H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
- hid_t dxpl_id, H5O_copy_t *cpy_info)
+ hid_t dxpl_id, H5O_copy_t *cpy_info, H5O_type_t *obj_type, void **udata)
{
H5O_addr_map_t *addr_map = NULL; /* Address mapping of object copied */
H5O_t *oh_src = NULL; /* Object header for source object */
@@ -299,7 +299,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
H5O_mesg_t *mesg_dst; /* Message in source object header */
const H5O_msg_class_t *copy_type; /* Type of message to use for copying */
const H5O_obj_class_t *obj_class = NULL; /* Type of object we are copying */
- void *udata = NULL; /* User data for passing to message callbacks */
+ void *cpy_udata = NULL; /* User data for passing to message callbacks */
uint64_t dst_oh_size; /* Total size of the destination OH */
size_t dst_oh_null; /* Size of the null message to add to destination OH */
unsigned dst_oh_gap; /* Size of the gap in chunk #0 of destination OH */
@@ -325,7 +325,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Retrieve user data for particular type of object to copy */
if(obj_class->get_copy_file_udata &&
- (NULL == (udata = (obj_class->get_copy_file_udata)())))
+ (NULL == (cpy_udata = (obj_class->get_copy_file_udata)())))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to retrieve copy user data")
/* Flush any dirty messages in source object header to update the header chunks */
@@ -404,7 +404,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, 0, oh_src, mesg_src, FAIL)
/* Perform "pre copy" operation on message */
- if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native, &(deleted[mesgno]), cpy_info, udata) < 0)
+ if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native,
+ &(deleted[mesgno]), cpy_info, cpy_udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'pre copy' operation on message")
/* Check if the message should be deleted in the destination */
@@ -478,7 +479,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
recompute_size = FALSE;
if((mesg_dst->native = H5O_msg_copy_file(copy_type,
oloc_src->file, mesg_src->native, oloc_dst->file,
- &recompute_size, cpy_info, udata, dxpl_id)) == NULL)
+ &recompute_size, cpy_info, cpy_udata, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
/* Check if new message is shared */
@@ -680,6 +681,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
addr_map->dst_addr = oloc_dst->addr;
addr_map->is_locked = TRUE; /* We've locked the object currently */
addr_map->inc_ref_count = 0; /* Start with no additional ref counts to add */
+ addr_map->obj_class = obj_class;
+ addr_map->udata = cpy_udata;
/* Insert into skip list */
if(H5SL_insert(cpy_info->map_list, addr_map, &(addr_map->src_obj_pos)) < 0)
@@ -742,7 +745,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
if(H5AC_insert_entry(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header")
oh_dst = NULL;
-
+
/* Reset metadat tag */
H5_END_TAG(FAIL);
@@ -750,6 +753,13 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
if(H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries")
+ /* Set obj_type and udata, if requested */
+ if(obj_type) {
+ HDassert(udata);
+ *obj_type = obj_class->type;
+ *udata = cpy_udata;
+ } /* end if */
+
done:
/* Free deleted array */
if(deleted)
@@ -763,13 +773,6 @@ done:
if(ret_value < 0 && oh_dst && H5O_free(oh_dst) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- /* Release user data for particular type of object to copy */
- if(udata) {
- HDassert(obj_class);
- HDassert(obj_class->free_copy_file_udata);
- (obj_class->free_copy_file_udata)(udata);
- } /* end if */
-
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_copy_header_real() */
@@ -789,7 +792,8 @@ done:
*/
herr_t
H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
- hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth)
+ hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth,
+ H5O_type_t *obj_type, void **udata)
{
H5O_addr_map_t *addr_map = NULL; /* Address mapping of object copied */
H5_obj_t src_obj_pos; /* Position of source object */
@@ -823,7 +827,8 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
cpy_info->curr_depth++;
/* Copy object referred to */
- if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, cpy_info) < 0)
+ if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, cpy_info, obj_type,
+ udata) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Check for incrementing the depth of copy */
@@ -840,6 +845,13 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Object has already been copied, set its address in destination file */
oloc_dst->addr = addr_map->dst_addr;
+ /* Return saved obj_type and udata, if requested */
+ if(obj_type) {
+ HDassert(udata);
+ *obj_type = addr_map->obj_class->type;
+ *udata = addr_map->udata;
+ } /* end if */
+
/* If the object is locked currently (because we are copying a group
* hierarchy and this is a link to a group higher in the hierarchy),
* increment it's deferred reference count instead of incrementing the
@@ -883,12 +895,21 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5O_copy_free_addrmap_cb(void *item, void UNUSED *key, void UNUSED *op_data)
+H5O_copy_free_addrmap_cb(void *_item, void UNUSED *key, void UNUSED *op_data)
{
+ H5O_addr_map_t *item = (H5O_addr_map_t *)_item;
+
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_copy_free_addrmap_cb)
HDassert(item);
+ /* Release user data for particular type of object */
+ if(item->udata) {
+ HDassert(item->obj_class);
+ HDassert(item->obj_class->free_copy_file_udata);
+ (item->obj_class->free_copy_file_udata)(item->udata);
+ } /* end if */
+
/* Release the item */
item = H5FL_FREE(H5O_addr_map_t, item);
@@ -947,7 +968,8 @@ H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list")
/* copy the object from the source file to the destination file */
- if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info) < 0)
+ if(H5O_copy_header_real(oloc_src, oloc_dst, dxpl_id, &cpy_info, NULL, NULL)
+ < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
done:
@@ -1057,7 +1079,8 @@ H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc,
HDassert(dst_oloc);
/* Perform the copy, or look up existing copy */
- if((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info, FALSE)) < 0)
+ if((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, dxpl_id, cpy_info,
+ FALSE, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Check if a new valid object is copied to the destination */
@@ -1078,6 +1101,11 @@ H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc,
sprintf(tmp_obj_name, "~obj_pointed_by_%llu", (unsigned long long)dst_oloc->addr);
/* Create a link to the newly copied object */
+ /* Note: since H5O_copy_header_map actually copied the target object, it
+ * must exist either in cache or on disk, therefore it is is safe to not
+ * pass the obj_type and udata fields returned by H5O_copy_header_map.
+ * This could be changed in the future to slightly improve performance
+ * --NAF */
if(H5L_link(dst_root_loc, tmp_obj_name, &new_loc, H5P_DEFAULT, H5P_DEFAULT, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link")
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 6ff20b2..68b70a5 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -333,6 +333,8 @@ typedef struct H5O_addr_map_t {
haddr_t dst_addr; /* Address of object in destination file */
hbool_t is_locked; /* Indicate that the destination object is locked currently */
hsize_t inc_ref_count; /* Number of deferred increments to reference count */
+ H5O_obj_class_t *obj_class; /* Object class */
+ void *udata; /* Object class copy file udata */
} H5O_addr_map_t;
/* Stack of continuation messages to interpret */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 3d5aa86..0d10fb9 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -792,7 +792,8 @@ H5_DLL herr_t H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_
/* Object copying routines */
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
- hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth);
+ hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth,
+ H5O_type_t *obj_type, void **udata);
H5_DLL herr_t H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id,
H5F_t *file_dst, void *_dst_ref, size_t ref_count, H5R_type_t ref_type,
H5O_copy_t *cpy_info);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index ad7e594..68fc4ad 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -612,7 +612,8 @@ H5O_shared_copy_file(H5F_t UNUSED *file_src, H5F_t *file_dst,
dst_oloc.file = file_dst;
src_oloc.file = shared_src->file;
src_oloc.addr = shared_src->u.loc.oh_addr;
- if(H5O_copy_header_map(&src_oloc, &dst_oloc, dxpl_id, cpy_info, FALSE) < 0)
+ if(H5O_copy_header_map(&src_oloc, &dst_oloc, dxpl_id, cpy_info, FALSE,
+ NULL, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
/* Set up destination message's shared info */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 4829e93..e29a856 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -44,7 +44,7 @@ static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *
static herr_t H5O_stab_free(void *_mesg);
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg);
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
- H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata,
+ H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *_udata,
hid_t dxpl_id);
static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
@@ -307,11 +307,12 @@ done:
*/
static void *
H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
- hbool_t UNUSED *recompute_size, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata,
+ hbool_t UNUSED *recompute_size, H5O_copy_t UNUSED *cpy_info, void *_udata,
hid_t dxpl_id)
{
H5O_stab_t *stab_src = (H5O_stab_t *) native_src;
H5O_stab_t *stab_dst = NULL;
+ H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata;
size_t size_hint; /* Local heap initial size */
void *ret_value; /* Return value */
@@ -328,7 +329,7 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
/* Get the old local heap's size and use that as the hint for the new heap */
if(H5HL_get_size(file_src, dxpl_id, stab_src->heap_addr, &size_hint) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
-
+
/* Set copy metadata tag */
H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL);
@@ -339,6 +340,11 @@ H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
/* Reset metadata tag */
H5_END_TAG(NULL);
+ /* Cache stab in udata */
+ udata->cache_type = H5G_CACHED_STAB;
+ udata->cache.stab.btree_addr = stab_dst->btree_addr;
+ udata->cache.stab.heap_addr = stab_dst->heap_addr;
+
/* Set return value */
ret_value = stab_dst;
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 628512f..4aa887b 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -140,7 +140,7 @@ H5FL_DEFINE_STATIC(H5S_hyper_span_info_t);
static herr_t
H5S_hyper_print_spans_helper(FILE *f, struct H5S_hyper_span_t *span,unsigned depth)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans_helper)
while(span) {
HDfprintf(f,"%s: depth=%u, span=%p, (%d, %d), nelem=%u, pstride=%u\n",FUNC,depth,span,(int)span->low,(int)span->high,(unsigned)span->nelem,(unsigned)span->pstride);
@@ -151,30 +151,30 @@ H5S_hyper_print_spans_helper(FILE *f, struct H5S_hyper_span_t *span,unsigned dep
span=span->next;
} /* end while */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
herr_t
H5S_hyper_print_spans(FILE *f, const struct H5S_hyper_span_info_t *span_lst)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_spans)
if(span_lst!=NULL) {
HDfprintf(f,"%s: spans=%p, count=%u, scratch=%p, head=%p\n",FUNC,span_lst,span_lst->count,span_lst->scratch,span_lst->head);
H5S_hyper_print_spans_helper(f,span_lst->head,0);
} /* end if */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
herr_t
H5S_space_print_spans(FILE *f, const H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_space_print_spans);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_space_print_spans)
H5S_hyper_print_spans(f,space->select.sel_info.hslab->span_lst);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
static herr_t
@@ -182,7 +182,7 @@ H5S_hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, const
{
unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo_helper)
if(dinfo!=NULL) {
HDfprintf(f,"%s: %s: start=[",FUNC,field);
@@ -201,18 +201,18 @@ H5S_hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, const
else
HDfprintf(f,"%s: %s==NULL\n",FUNC,field);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
herr_t
H5S_hyper_print_diminfo(FILE *f, const H5S_t *space)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_print_diminfo)
H5S_hyper_print_diminfo_helper(f,"opt_diminfo",space->extent.rank,space->select.sel_info.hslab->opt_diminfo);
H5S_hyper_print_diminfo_helper(f,"app_diminfo",space->extent.rank,space->select.sel_info.hslab->app_diminfo);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
}
#endif /* H5S_HYPER_DEBUG */
@@ -232,8 +232,6 @@ H5S_hyper_print_diminfo(FILE *f, const H5S_t *space)
* is used by the H5S_select_shape_same() code to avoid changing
* the rank and appearance of the selection.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -245,31 +243,31 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
unsigned u; /* Index variable */
int i; /* Index variable */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_iter_init);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_iter_init)
/* Check args */
- assert(space && H5S_SEL_HYPERSLABS==H5S_GET_SELECT_TYPE(space));
- assert(iter);
+ HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space));
+ HDassert(iter);
/* Initialize the number of points to iterate over */
- iter->elmt_left=space->select.num_elem;
- iter->u.hyp.iter_rank=0;
+ iter->elmt_left = space->select.num_elem;
+ iter->u.hyp.iter_rank = 0;
/* Get the rank of the dataspace */
- rank=space->extent.rank;
+ rank = space->extent.rank;
/* Set the temporary pointer to the dimension information */
- tdiminfo=space->select.sel_info.hslab->opt_diminfo;
+ tdiminfo = space->select.sel_info.hslab->opt_diminfo;
/* Check for the special case of just one H5Sselect_hyperslab call made */
if(space->select.sel_info.hslab->diminfo_valid) {
/* Initialize the information needed for regular hyperslab I/O */
const hsize_t *mem_size; /* Temporary pointer to dataspace extent's dimension sizes */
hsize_t acc; /* Accumulator for "flattened" dimension's sizes */
- unsigned cont_dim=0; /* # of contiguous dimensions */
+ unsigned cont_dim = 0; /* # of contiguous dimensions */
/* Set the temporary pointer to the dataspace extent's dimension sizes */
- mem_size=space->extent.size;
+ mem_size = space->extent.size;
/*
* For a regular hyperslab to be contiguous up to some dimension, it
@@ -295,7 +293,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
} /* end if */
/* Check if the regular selection can be "flattened" */
- if(cont_dim>0) {
+ if(cont_dim > 0) {
unsigned last_dim_flattened = 1; /* Flag to indicate that the last dimension was flattened */
unsigned flat_rank = rank-cont_dim; /* Number of dimensions after flattening */
unsigned curr_dim; /* Current dimension */
@@ -320,7 +318,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[curr_dim].start = tdiminfo[i].start * acc;
/* Special case for single block regular selections */
- if(tdiminfo[i].count==1)
+ if(tdiminfo[i].count == 1)
iter->u.hyp.diminfo[curr_dim].stride = 1;
else
iter->u.hyp.diminfo[curr_dim].stride = tdiminfo[i].stride * acc;
@@ -333,7 +331,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
last_dim_flattened = 0;
/* Reset the "accumulator" for possible further dimension flattening */
- acc=1;
+ acc = 1;
} /* end if */
else {
/* All other dimensions */
@@ -351,13 +349,13 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
} /* end for */
/* Initialize "flattened" iterator offset to initial location and dataspace extent and selection information to correct values */
- for(u=0; u<flat_rank; u++)
- iter->u.hyp.off[u]=iter->u.hyp.diminfo[u].start;
+ for(u = 0; u < flat_rank; u++)
+ iter->u.hyp.off[u] = iter->u.hyp.diminfo[u].start;
} /* end if */
else {
/* Initialize position to initial location */
/* Also make local copy of the regular selection information */
- for(u=0; u<rank; u++) {
+ for(u = 0; u < rank; u++) {
/* Regular selection information */
iter->u.hyp.diminfo[u].start = tdiminfo[u].start;
iter->u.hyp.diminfo[u].stride = tdiminfo[u].stride;
@@ -365,51 +363,50 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
iter->u.hyp.diminfo[u].block = tdiminfo[u].block;
/* Position information */
- iter->u.hyp.off[u]=tdiminfo[u].start;
+ iter->u.hyp.off[u] = tdiminfo[u].start;
} /* end if */
} /* end else */
/* Flag the diminfo information as valid in the iterator */
- iter->u.hyp.diminfo_valid=TRUE;
+ iter->u.hyp.diminfo_valid = TRUE;
/* Initialize irregular region information also (for release) */
- iter->u.hyp.spans=NULL;
+ iter->u.hyp.spans = NULL;
} /* end if */
else {
/* Initialize the information needed for non-regular hyperslab I/O */
- assert(space->select.sel_info.hslab->span_lst);
+ HDassert(space->select.sel_info.hslab->span_lst);
/* Make a copy of the span tree to iterate over */
- iter->u.hyp.spans=H5S_hyper_copy_span(space->select.sel_info.hslab->span_lst);
+ iter->u.hyp.spans = H5S_hyper_copy_span(space->select.sel_info.hslab->span_lst);
/* Set the nelem & pstride values according to the element size */
H5S_hyper_span_precompute(iter->u.hyp.spans,iter->elmt_size);
/* Initialize the starting span_info's and spans */
- spans=iter->u.hyp.spans;
- for(u=0; u<rank; u++) {
+ spans = iter->u.hyp.spans;
+ for(u = 0; u < rank; u++) {
/* Set the pointers to the initial span in each dimension */
- assert(spans);
- assert(spans->head);
+ HDassert(spans);
+ HDassert(spans->head);
/* Set the pointer to the first span in the list for this node */
iter->u.hyp.span[u] = spans->head;
/* Set the initial offset to low bound of span */
- iter->u.hyp.off[u]=iter->u.hyp.span[u]->low;
+ iter->u.hyp.off[u] = iter->u.hyp.span[u]->low;
/* Get the pointer to the next level down */
- spans=spans->head->down;
+ spans = spans->head->down;
} /* end for */
/* Flag the diminfo information as not valid in the iterator */
- iter->u.hyp.diminfo_valid=FALSE;
-
+ iter->u.hyp.diminfo_valid = FALSE;
} /* end else */
/* Initialize type of selection iterator */
- iter->type=H5S_sel_iter_hyper;
+ iter->type = H5S_sel_iter_hyper;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_init() */
@@ -431,11 +428,11 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
static herr_t
H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_coords);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_coords)
/* Check args */
- assert (iter);
- assert (coords);
+ HDassert(iter);
+ HDassert(coords);
/* Copy the offset of the current point */
@@ -496,7 +493,7 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
else
HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_coords() */
@@ -523,12 +520,12 @@ H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_block);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_block)
/* Check args */
- assert (iter);
- assert (start);
- assert (end);
+ HDassert(iter);
+ HDassert(start);
+ HDassert(end);
/* Copy the offset of the current point */
@@ -550,7 +547,7 @@ H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
end[u]=iter->u.hyp.span[u]->high;
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_block() */
@@ -571,12 +568,12 @@ H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
static hsize_t
H5S_hyper_iter_nelmts (const H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_nelmts);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_nelmts)
/* Check args */
- assert (iter);
+ HDassert(iter);
- FUNC_LEAVE_NOAPI(iter->elmt_left);
+ FUNC_LEAVE_NOAPI(iter->elmt_left)
} /* H5S_hyper_iter_nelmts() */
@@ -661,7 +658,7 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned i; /* Counters */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_next);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_next)
/* Check for the special case of just one H5Sselect_hyperslab call made */
/* (i.e. a regular hyperslab selection */
@@ -826,9 +823,9 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
if(curr_dim>=0) {
/* Walk back down the iterator positions, reseting them */
while(curr_dim<fast_dim) {
- assert(curr_span);
- assert(curr_span->down);
- assert(curr_span->down->head);
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
/* Increment current dimension */
curr_dim++;
@@ -844,12 +841,12 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
} /* end while */
/* Verify that the curr_span points to the fastest dim */
- assert(curr_span==ispan[fast_dim]);
+ HDassert(curr_span==ispan[fast_dim]);
} /* end if */
} /* end while */
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_next() */
@@ -876,7 +873,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
unsigned u; /* Counters */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_next_block);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_next_block)
/* Check for the special case of just one H5Sselect_hyperslab call made */
/* (i.e. a regular hyperslab selection */
@@ -1012,9 +1009,9 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
if(curr_dim>=0) {
/* Walk back down the iterator positions, reseting them */
while(curr_dim<fast_dim) {
- assert(curr_span);
- assert(curr_span->down);
- assert(curr_span->down->head);
+ HDassert(curr_span);
+ HDassert(curr_span->down);
+ HDassert(curr_span->down->head);
/* Increment current dimension */
curr_dim++;
@@ -1030,11 +1027,11 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
} /* end while */
/* Verify that the curr_span points to the fastest dim */
- assert(curr_span==ispan[fast_dim]);
+ HDassert(curr_span == ispan[fast_dim]);
} /* end if */
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_next() */
@@ -1058,17 +1055,17 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
static herr_t
H5S_hyper_iter_release (H5S_sel_iter_t *iter)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_release);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_release)
/* Check args */
- assert (iter);
+ HDassert(iter);
/* Release the information needed for non-regular hyperslab I/O */
/* Free the copy of the selections span tree */
- if(iter->u.hyp.spans!=NULL)
+ if(iter->u.hyp.spans != NULL)
H5S_hyper_free_span_info(iter->u.hyp.spans);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_iter_release() */
@@ -1144,11 +1141,11 @@ static herr_t
H5S_hyper_span_precompute_helper (H5S_hyper_span_info_t *spans, size_t elmt_size)
{
H5S_hyper_span_t *span; /* Hyperslab span */
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_span_precompute_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_span_precompute_helper)
- assert(spans);
+ HDassert(spans);
/* Check if we've already set this down span tree */
if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
@@ -1163,7 +1160,7 @@ H5S_hyper_span_precompute_helper (H5S_hyper_span_info_t *spans, size_t elmt_size
/* If there are down spans, set their scratch value also */
if(span->down!=NULL) {
if(H5S_hyper_span_precompute_helper(span->down,elmt_size)==FAIL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't reset hyperslab scratch pointer");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't reset hyperslab scratch pointer")
} /* end if */
/* Change the nelem & pstride values into bytes */
@@ -1176,7 +1173,7 @@ H5S_hyper_span_precompute_helper (H5S_hyper_span_info_t *spans, size_t elmt_size
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_span_precompute_helper() */
@@ -1422,7 +1419,7 @@ H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *s
htri_t nest=FAIL;
htri_t ret_value=FAIL;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_cmp_spans);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_cmp_spans)
/* Check for redundant comparison */
if(span_info1==span_info2)
@@ -1441,8 +1438,8 @@ H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *s
span2=span_info2->head;
/* Sanity checking */
- assert(span1);
- assert(span2);
+ HDassert(span1);
+ HDassert(span2);
/* infinite loop which must be broken out of */
while (1) {
@@ -1494,7 +1491,7 @@ H5S_hyper_cmp_spans (H5S_hyper_span_info_t *span_info1, H5S_hyper_span_info_t *s
} /* end else */
} /* end else */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_cmp_spans() */
@@ -1523,9 +1520,9 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info)
H5S_hyper_span_t *span, *next_span;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_free_span_info);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_free_span_info)
- assert(span_info);
+ HDassert(span_info);
/* Decrement the span tree's reference count */
span_info->count--;
@@ -1538,7 +1535,7 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info)
while(span!=NULL) {
next_span=span->next;
if(H5S_hyper_free_span(span)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span")
span=next_span;
} /* end while */
@@ -1547,7 +1544,7 @@ H5S_hyper_free_span_info (H5S_hyper_span_info_t *span_info)
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_free_span_info() */
@@ -1575,21 +1572,21 @@ H5S_hyper_free_span (H5S_hyper_span_t *span)
{
herr_t ret_value=SUCCEED;
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_free_span);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_free_span)
- assert(span);
+ HDassert(span);
/* Decrement the reference count of the 'down spans', freeing them if appropriate */
if(span->down!=NULL) {
if(H5S_hyper_free_span_info(span->down)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span tree");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab span tree")
} /* end if */
/* Free this span */
span = H5FL_FREE(H5S_hyper_span_t, span);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_free_span() */
@@ -1624,14 +1621,14 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
const H5S_hyper_sel_t *src_hslab; /* Pointer to source hyperslab info */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_copy, FAIL);
+ FUNC_ENTER_NOAPI(H5S_hyper_copy, FAIL)
- assert(src);
- assert(dst);
+ HDassert(src);
+ HDassert(dst);
/* Allocate space for the hyperslab selection information */
if(NULL == (dst->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
/* Set temporary pointers */
dst_hslab=dst->select.sel_info.hslab;
@@ -1662,7 +1659,7 @@ H5S_hyper_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_copy() */
@@ -1696,12 +1693,12 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o
htri_t tmp; /* temporary return value */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_is_valid_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_is_valid_helper)
- assert(spans);
- assert(offset);
- assert(size);
- assert(rank<H5O_LAYOUT_NDIMS);
+ HDassert(spans);
+ HDassert(offset);
+ HDassert(size);
+ HDassert(rank < H5O_LAYOUT_NDIMS);
/* Check each point to determine whether selection+offset is within extent */
curr=spans->head;
@@ -1728,7 +1725,7 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o
curr=curr->next;
} /* end while */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_is_valid_helper() */
@@ -1758,9 +1755,9 @@ H5S_hyper_is_valid (const H5S_t *space)
unsigned u; /* Counter */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_valid);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_valid)
- assert(space);
+ HDassert(space);
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
@@ -1792,7 +1789,7 @@ H5S_hyper_is_valid (const H5S_t *space)
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_is_valid() */
@@ -2003,14 +2000,14 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
hsize_t u; /* Index variable */
herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_serialize_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_serialize_helper)
/* Sanity checks */
- assert(spans);
- assert(start);
- assert(end);
- assert(rank<H5O_LAYOUT_NDIMS);
- assert(buf && *buf);
+ HDassert(spans);
+ HDassert(start);
+ HDassert(end);
+ HDassert(rank < H5O_LAYOUT_NDIMS);
+ HDassert(buf && *buf);
/* Walk through the list of spans, recursing or outputing them */
curr=spans->head;
@@ -2023,7 +2020,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
/* Recurse down to the next dimension */
if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,buf)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
} /* end if */
else {
/* Encode all the previous dimensions starting & ending points */
@@ -2048,7 +2045,7 @@ H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start,
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_serialize_helper() */
@@ -2250,17 +2247,17 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
unsigned i,j; /* local counting variables */
herr_t ret_value=FAIL; /* return value */
- FUNC_ENTER_NOAPI(H5S_hyper_deserialize, FAIL);
+ FUNC_ENTER_NOAPI(H5S_hyper_deserialize, FAIL)
/* Check args */
- assert(space);
- assert(buf);
+ HDassert(space);
+ HDassert(buf);
/* Deserialize slabs to select */
buf+=16; /* Skip over selection header */
UINT32DECODE(buf,rank); /* decode the rank of the point selection */
if(rank!=space->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace")
UINT32DECODE(buf,num_elem); /* decode the number of points */
/* Set the count & stride for all blocks */
@@ -2285,11 +2282,11 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
/* Select or add the hyperslab to the current selection */
if((ret_value=H5S_select_hyperslab(space,(i==0 ? H5S_SELECT_SET : H5S_SELECT_OR),start,stride,count,block))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
} /* end for */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_deserialize() */
@@ -2355,7 +2352,7 @@ H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t
/* Recurse down to the next dimension */
if(H5S_hyper_span_blocklist(curr->down, start, end, (rank + 1), startblock, numblocks, buf) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
} /* end if */
else {
/* Skip this block if we haven't skipped all the startblocks yet */
@@ -2889,9 +2886,9 @@ H5S_hyper_is_contiguous(const H5S_t *space)
unsigned u; /* index variable */
htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_contiguous);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_contiguous)
- assert(space);
+ HDassert(space);
/* Check for a "regular" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
@@ -3044,7 +3041,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
ret_value=TRUE;
} /* end else */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_is_contiguous() */
@@ -3074,9 +3071,9 @@ H5S_hyper_is_single(const H5S_t *space)
unsigned u; /* index variable */
htri_t ret_value=TRUE; /* return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_single);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_single)
- assert(space);
+ HDassert(space);
/* Check for a "single" hyperslab selection */
if(space->select.sel_info.hslab->diminfo_valid) {
@@ -3112,7 +3109,7 @@ H5S_hyper_is_single(const H5S_t *space)
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_is_single() */
@@ -3141,10 +3138,10 @@ H5S_hyper_is_regular(const H5S_t *space)
{
htri_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_regular);
+ FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_is_regular)
/* Check args */
- assert(space);
+ HDassert(space);
/* Only simple check for regular hyperslabs for now... */
if(space->select.sel_info.hslab->diminfo_valid)
@@ -3152,7 +3149,7 @@ H5S_hyper_is_regular(const H5S_t *space)
else
ret_value=FALSE;
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_is_regular() */
@@ -3228,10 +3225,10 @@ done:
static herr_t
H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyper_span_t *next_span)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_recover_span);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_recover_span)
- assert(recover);
- assert(curr_span);
+ HDassert(recover);
+ HDassert(curr_span);
/* Check if the span should be recovered */
if(*recover) {
@@ -3242,7 +3239,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp
/* Set the current span to next span */
*curr_span=next_span;
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_recover_span() */
@@ -3271,16 +3268,16 @@ H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords)
H5S_hyper_span_info_t *down=NULL; /* Pointer to new span tree for next level down */
H5S_hyper_span_t *ret_value=NULL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_coord_to_span);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_coord_to_span)
- assert(rank>0);
- assert(coords);
+ HDassert(rank > 0);
+ HDassert(coords);
/* Search for location to insert new element in tree */
if(rank>1) {
/* Allocate a span info node */
if((down = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set the reference count */
down->count=0;
@@ -3290,12 +3287,12 @@ H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords)
/* Build span tree for coordinates below this one */
if((down->head=H5S_hyper_coord_to_span(rank-1,&coords[1]))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
/* Build span for this coordinate */
if((new_span = H5S_hyper_new_span(coords[0],coords[0],down,NULL))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set return value */
ret_value=new_span;
@@ -3306,7 +3303,7 @@ done:
H5S_hyper_free_span_info(down);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_coord_to_span() */
@@ -3340,11 +3337,11 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
H5S_hyper_span_t *new_span; /* New span created for element */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_add_span_element_helper)
- assert(span_tree);
- assert(rank>0);
- assert(coords);
+ HDassert(span_tree);
+ HDassert(rank > 0);
+ HDassert(coords);
/* Get pointer to last span in span tree */
tspan_info=span_tree;
@@ -3352,7 +3349,7 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
tmp_span=(H5S_hyper_span_t *)span_tree->scratch;
else {
tmp_span=span_tree->head;
- assert(tmp_span);
+ HDassert(tmp_span);
span_tree->scratch=(H5S_hyper_span_info_t *)tmp_span;
} /* end else */
@@ -3372,7 +3369,7 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
tmp_span=(H5S_hyper_span_t *)tspan_info->scratch;
else {
tmp_span=tspan_info->head;
- assert(tmp_span);
+ HDassert(tmp_span);
tspan_info->scratch=(H5S_hyper_span_info_t *)tmp_span;
} /* end else */
} /* end while */
@@ -3424,14 +3421,14 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
/* Make span tree for current coordinates */
if((new_span=H5S_hyper_coord_to_span(rank,coords))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Add new span tree as span */
- assert(tmp_span);
+ HDassert(tmp_span);
tmp_span->next=new_span;
/* Make scratch pointer point to last span in list */
- assert(tspan_info);
+ HDassert(tspan_info);
tspan_info->scratch=(H5S_hyper_span_info_t *)new_span;
/* Set the proper 'pstride' for new span */
@@ -3493,10 +3490,10 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
} /* end if */
else {
if((new_span = H5S_hyper_new_span(coords[0],coords[0],NULL,NULL))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Add new span tree as span */
- assert(tmp_span);
+ HDassert(tmp_span);
tmp_span->next=new_span;
/* Make scratch pointer point to last span in list */
@@ -3508,7 +3505,7 @@ H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ran
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_add_span_element_helper() */
@@ -3652,9 +3649,9 @@ H5S_hyper_convert(H5S_t *space)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_convert);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_convert)
- assert(space);
+ HDassert(space);
/* Check the type of selection */
switch(H5S_GET_SELECT_TYPE(space)) {
@@ -3677,7 +3674,7 @@ H5S_hyper_convert(H5S_t *space)
/* Convert to hyperslab selection */
if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
} /* end case */
break;
@@ -3689,11 +3686,11 @@ H5S_hyper_convert(H5S_t *space)
case H5S_SEL_ERROR: /* Selection error */
case H5S_SEL_N: /* Selection count */
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "can't convert to span tree selection");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "can't convert to span tree selection")
} /* end switch */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_convert() */
#ifdef LATER
@@ -3724,10 +3721,10 @@ H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t
htri_t status; /* Status from recursive call */
htri_t ret_value=FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_helper)
/* Sanity check */
- assert((spans1 && spans2) || (spans1==NULL && spans2==NULL));
+ HDassert((spans1 && spans2) || (spans1 == NULL && spans2 == NULL));
/* "NULL" span trees compare as overlapping */
if(spans1==NULL && spans2==NULL)
@@ -3749,7 +3746,7 @@ H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t
else {
/* Recursively check spans in next dimension down */
if((status=H5S_hyper_intersect_helper(curr1->down,curr2->down))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
/* If there is a span intersection in the down dimensions, the span trees overlap */
if(status==TRUE)
@@ -3764,7 +3761,7 @@ H5S_hyper_intersect_helper (H5S_hyper_span_info_t *spans1, H5S_hyper_span_info_t
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_intersect_helper() */
@@ -3791,27 +3788,27 @@ H5S_hyper_intersect (H5S_t *space1, H5S_t *space2)
{
htri_t ret_value=FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect)
/* Sanity check */
- assert(space1);
- assert(space2);
+ HDassert(space1);
+ HDassert(space2);
/* Check that the space selections both have span trees */
if(space1->select.sel_info.hslab->span_lst==NULL ||
space2->select.sel_info.hslab->span_lst==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
/* Check that the dataspaces are both the same rank */
if(space1->extent.rank!=space2->extent.rank)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "dataspace ranks don't match")
/* Perform the span-by-span intersection check */
if((ret_value=H5S_hyper_intersect_helper(space1->select.sel_info.hslab->span_lst,space2->select.sel_info.hslab->span_lst))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_intersect() */
#endif /* LATER */
@@ -3843,12 +3840,12 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hsize_t *s
htri_t status; /* Status from recursive call */
htri_t ret_value=FALSE; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_block_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_block_helper)
/* Sanity check */
- assert(spans);
- assert(start);
- assert(end);
+ HDassert(spans);
+ HDassert(start);
+ HDassert(end);
/* Get the span list for spans in this tree */
curr=spans->head;
@@ -3869,7 +3866,7 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hsize_t *s
else {
/* Recursively check spans in next dimension down */
if((status=H5S_hyper_intersect_block_helper(curr->down,start+1,end+1))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
/* If there is a span intersection in the down dimensions, the span trees overlap */
if(status==TRUE)
@@ -3882,7 +3879,7 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hsize_t *s
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_intersect_block_helper() */
@@ -3910,12 +3907,12 @@ H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end)
{
htri_t ret_value=FAIL; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_block);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_intersect_block)
/* Sanity check */
- assert(space);
- assert(start);
- assert(end);
+ HDassert(space);
+ HDassert(start);
+ HDassert(end);
/* Check for 'all' selection, instead of a hyperslab selection */
/* (Technically, this shouldn't be in the "hyperslab" routines...) */
@@ -3925,14 +3922,14 @@ H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end)
/* Check that the space selection has a span tree */
if(space->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
/* Perform the span-by-span intersection check */
if((ret_value=H5S_hyper_intersect_block_helper(space->select.sel_info.hslab->span_lst,start,end))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab intersection check")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_intersect_block() */
@@ -3959,11 +3956,11 @@ H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
{
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_u);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_u)
/* Sanity check */
- assert(spans);
- assert(offset);
+ HDassert(spans);
+ HDassert(offset);
/* Check if we've already set this down span tree */
if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
@@ -3976,7 +3973,7 @@ H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
/* Iterate over the spans in tree */
while(span!=NULL) {
/* Adjust span offset */
- assert(span->low>=*offset);
+ HDassert(span->low>=*offset);
span->low-=*offset;
span->high-=*offset;
@@ -3989,7 +3986,7 @@ H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
} /* end while */
} /* end if */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_adjust_helper_u() */
@@ -4017,15 +4014,15 @@ H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
unsigned u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_u);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_u)
- assert(space);
- assert(offset);
+ HDassert(space);
+ HDassert(offset);
/* Subtract the offset from the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
for(u=0; u<space->extent.rank; u++) {
- assert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
+ HDassert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
} /* end for */
} /* end if */
@@ -4033,14 +4030,14 @@ H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
if(H5S_hyper_adjust_helper_u(space->select.sel_info.hslab->span_lst,offset)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment")
/* Reset the scratch pointers for the next routine which needs them */
H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL);
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_adjust_u() */
@@ -4629,7 +4626,7 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp
H5S_hyper_span_t *new_span = NULL;
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_append_span);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_append_span)
HDassert(prev_span);
HDassert(span_tree);
@@ -4638,16 +4635,16 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp
if(*prev_span==NULL) {
/* Allocate new span node to append to list */
if((new_span = H5S_hyper_new_span(low,high,down,next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make first node in span list */
/* Check that we haven't already allocated a span tree */
- assert(*span_tree==NULL);
+ HDassert(*span_tree==NULL);
/* Allocate a new span_info node */
if((*span_tree = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Set the span tree's basic information */
(*span_tree)->count=1;
@@ -4669,7 +4666,7 @@ H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** sp
else {
/* Allocate new span node to append to list */
if((new_span = H5S_hyper_new_span(low,high,down,next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check if there is actually a down span */
if(new_span->down) {
@@ -4753,14 +4750,14 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_clip_spans);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_clip_spans)
/* Check args */
- assert (a_spans);
- assert (b_spans);
- assert (a_not_b);
- assert (a_and_b);
- assert (b_not_a);
+ HDassert(a_spans);
+ HDassert(b_spans);
+ HDassert(a_not_b);
+ HDassert(a_and_b);
+ HDassert(b_not_a);
/* Check if both span trees are not defined */
if(a_spans==NULL && b_spans==NULL) {
@@ -4773,12 +4770,12 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
*a_not_b=NULL;
*a_and_b=NULL;
if((*b_not_a=H5S_hyper_copy_span(b_spans))==NULL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
} /* end if */
/* If span 'b' is not defined, but 'a' is, copy 'a' and set the other return span trees to empty */
else if(b_spans==NULL) {
if((*a_not_b=H5S_hyper_copy_span(a_spans))==NULL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
*a_and_b=NULL;
*b_not_a=NULL;
} /* end if */
@@ -4788,7 +4785,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(H5S_hyper_cmp_spans(a_spans,b_spans)==TRUE) {
*a_not_b=NULL;
if((*a_and_b=H5S_hyper_copy_span(a_spans))==NULL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree")
*b_not_a=NULL;
} /* end if */
else {
@@ -4815,7 +4812,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add span 'a' with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a', leave span 'b' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -4830,18 +4827,18 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add lower part of span 'a' with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between upper part of span 'a' and lower part of span 'b' */
/* Make certain both spans either have a down span or both don't have one */
- assert((span_a->down!=NULL && span_b->down!=NULL) || (span_a->down==NULL && span_b->down==NULL));
+ HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -4852,13 +4849,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_a->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_not_b);
@@ -4868,7 +4865,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_a->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_and_b);
@@ -4878,7 +4875,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_b_not_a);
@@ -4891,7 +4888,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(span_a->high<span_b->high) {
/* Allocate new span node for upper part of span 'b' */
if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -4917,18 +4914,18 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add lower part of span 'a' with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Check for overlaps between middle part of span 'a' and span 'b' */
/* Make certain both spans either have a down span or both don't have one */
- assert((span_a->down!=NULL && span_b->down!=NULL) || (span_a->down==NULL && span_b->down==NULL));
+ HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -4939,13 +4936,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_b->low,span_b->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_not_b);
@@ -4955,7 +4952,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_b->low,span_b->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_and_b);
@@ -4965,7 +4962,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_b_not_a);
@@ -4976,7 +4973,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Allocate new span node for upper part of span 'a' */
if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' the new span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
@@ -4996,7 +4993,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5005,13 +5002,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps between span 'a' and midle of span 'b' */
/* Make certain both spans either have a down span or both don't have one */
- assert((span_a->down!=NULL && span_b->down!=NULL) || (span_a->down==NULL && span_b->down==NULL));
+ HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5022,13 +5019,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_not_b);
@@ -5038,7 +5035,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_a->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_and_b);
@@ -5048,7 +5045,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_a->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_b_not_a);
@@ -5061,7 +5058,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Allocate new span node for upper part of spans 'a' */
if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* And advance span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5088,7 +5085,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add lower part of span 'b' with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
else {
/* Keep going, nothing to split off */
@@ -5097,13 +5094,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps between lower part of span 'a' and upper part of span 'b' */
/* Make certain both spans either have a down span or both don't have one */
- assert((span_a->down!=NULL && span_b->down!=NULL) || (span_a->down==NULL && span_b->down==NULL));
+ HDassert((span_a->down != NULL && span_b->down != NULL) || (span_a->down == NULL && span_b->down == NULL));
/* If there are no down spans, just add the overlapping area to the a_and_b list */
if(span_a->down==NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,NULL,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
} /* end if */
/* If there are down spans, check for the overlap in them and add to each appropriate list */
else {
@@ -5114,13 +5111,13 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Check for overlaps in the 'down spans' of span 'a' & 'b' */
if(H5S_hyper_clip_spans(span_a->down,span_b->down,&down_a_not_b,&down_a_and_b,&down_b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Check for additions to the a_not_b list */
if(down_a_not_b!=NULL) {
/* Merge/add overlapped part with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_b->high,down_a_not_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_not_b);
@@ -5130,7 +5127,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_a_and_b!=NULL) {
/* Merge/add overlapped part with/to a_and_b list */
if(H5S_hyper_append_span(&last_a_and_b,a_and_b,span_a->low,span_b->high,down_a_and_b,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_a_and_b);
@@ -5140,7 +5137,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
if(down_b_not_a!=NULL) {
/* Merge/add overlapped part with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_a->low,span_b->high,down_b_not_a,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Release the down span tree generated */
H5S_hyper_free_span_info(down_b_not_a);
@@ -5151,7 +5148,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Allocate new span node for upper part of span 'a' */
if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Make upper part of span 'a' into new span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
@@ -5169,7 +5166,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add span 'b' with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance span 'b', leave span 'a' */
H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
@@ -5183,7 +5180,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add span 'a' with/to a_not_b list */
if(H5S_hyper_append_span(&last_a_not_b,a_not_b,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance to the next 'a' span */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5196,7 +5193,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
/* Merge/add span 'b' with/to b_not_a list */
if(H5S_hyper_append_span(&last_b_not_a,b_not_a,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Advance to the next 'b' span */
H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
@@ -5206,7 +5203,7 @@ H5S_hyper_clip_spans (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_clip_spans() */
@@ -5243,10 +5240,10 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
unsigned recover_a, recover_b; /* Flags to indicate when to recover temporary spans */
H5S_hyper_span_info_t *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_merge_spans_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_merge_spans_helper)
/* Make certain both 'a' & 'b' spans have down span trees or neither does */
- assert((a_spans!=NULL && b_spans!=NULL) || (a_spans==NULL && b_spans==NULL));
+ HDassert((a_spans != NULL && b_spans != NULL) || (a_spans == NULL && b_spans == NULL));
/* Check if the span trees for the 'a' span and the 'b' span are the same */
if(H5S_hyper_cmp_spans(a_spans,b_spans)==TRUE) {
@@ -5255,7 +5252,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
else {
/* Copy one of the span trees to return */
if((merged_spans=H5S_hyper_copy_span(a_spans))==NULL)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree")
} /* end else */
} /* end if */
else {
@@ -5278,7 +5275,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(span_a->high<span_b->low) {
/* Merge/add span 'a' with/to the merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5293,19 +5290,19 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of span 'a' with/to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' with/to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
tmp_spans=H5S_hyper_merge_spans_helper(span_a->down,span_b->down);
/* Merge/add overlapped section to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S_hyper_free_span_info(tmp_spans);
@@ -5317,7 +5314,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Allocate new span node to append to list */
if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5342,19 +5339,19 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of lower & middle parts of span 'a' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Merge/add lower part of span 'a' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->low-1,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Get merged span tree for overlapped section */
tmp_spans=H5S_hyper_merge_spans_helper(span_a->down,span_b->down);
/* Merge/add overlapped section to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S_hyper_free_span_info(tmp_spans);
@@ -5364,7 +5361,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Allocate new span node to append to list */
if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
@@ -5382,14 +5379,14 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of lower & middle parts of span 'b' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* No lower part of span 'b' , keep going... */
@@ -5400,7 +5397,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Merge/add overlapped section to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S_hyper_free_span_info(tmp_spans);
@@ -5412,7 +5409,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Allocate new span node to append to list */
if((tmp_span = H5S_hyper_new_span(span_a->high+1,span_b->high,span_b->down,span_b->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'a' */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5437,14 +5434,14 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
if(H5S_hyper_cmp_spans(span_a->down,span_b->down)==TRUE) {
/* Merge/add copy of span 'b' to merged spans if so */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* Check if there is a lower part of span 'b' */
if(span_a->low>span_b->low) {
/* Merge/add lower part of span 'b' to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_a->low-1,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
} /* end if */
else {
/* No lower part of span 'b' , keep going... */
@@ -5455,7 +5452,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Merge/add overlapped section to merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_b->high,tmp_spans,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Release merged span tree for overlapped section */
H5S_hyper_free_span_info(tmp_spans);
@@ -5465,7 +5462,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
/* Allocate new span node to append to list */
if((tmp_span = H5S_hyper_new_span(span_b->high+1,span_a->high,span_a->down,span_a->next))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set new span 'a' to tmp_span */
H5S_hyper_recover_span(&recover_a,&span_a,tmp_span);
@@ -5481,7 +5478,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
else {
/* Merge/add span 'b' with the merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance span 'b' */
H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
@@ -5493,7 +5490,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
while(span_a!=NULL) {
/* Merge/add all 'a' spans into the merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_a->low,span_a->high,span_a->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance to next 'a' span, until all processed */
H5S_hyper_recover_span(&recover_a,&span_a,span_a->next);
@@ -5505,7 +5502,7 @@ H5S_hyper_merge_spans_helper (H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf
while(span_b!=NULL) {
/* Merge/add all 'b' spans into the merged spans */
if(H5S_hyper_append_span(&prev_span_merge,&merged_spans,span_b->low,span_b->high,span_b->down,NULL)==FAIL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Advance to next 'b' span, until all processed */
H5S_hyper_recover_span(&recover_b,&span_b,span_b->next);
@@ -5523,7 +5520,7 @@ done:
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, NULL, "failed to release merged hyperslab spans")
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_merge_spans_helper() */
@@ -5555,11 +5552,11 @@ done:
static herr_t
H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t can_own)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_merge_spans);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_merge_spans)
/* Check args */
- assert (space);
- assert (new_spans);
+ HDassert(space);
+ HDassert(new_spans);
/* If this is the first span tree in the hyperslab selection, just use it */
if(space->select.sel_info.hslab->span_lst==NULL) {
@@ -5575,7 +5572,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
merged_spans=H5S_hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans);
/* Sanity checking since we started with some spans, we should still have some after the merge */
- assert(merged_spans);
+ HDassert(merged_spans);
/* Free the previous spans */
H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst);
@@ -5584,7 +5581,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
space->select.sel_info.hslab->span_lst=merged_spans;
} /* end else */
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5S_hyper_merge_spans() */
@@ -5611,7 +5608,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
H5S_hyper_span_t *span; /* Hyperslab span */
hsize_t ret_value;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_spans_nelem);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_spans_nelem)
/* Count the number of elements in the span tree */
if(spans==NULL)
@@ -5632,7 +5629,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
} /* end while */
} /* end else */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_spans_nelem() */
@@ -5673,7 +5670,7 @@ H5S_hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride,
unsigned u; /* Counters */
H5S_hyper_span_info_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_make_spans);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_make_spans)
/* Check args */
HDassert(rank > 0);
@@ -6004,10 +6001,10 @@ H5S_hyper_generate_spans(H5S_t *space)
unsigned u; /* Counter */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_generate_spans);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_generate_spans)
- assert(space);
- assert(H5S_GET_SELECT_TYPE(space)==H5S_SEL_HYPERSLABS);
+ HDassert(space);
+ HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
/* Get the diminfo */
for(u=0; u<space->extent.rank; u++) {
@@ -6019,10 +6016,10 @@ H5S_hyper_generate_spans(H5S_t *space)
/* Build the hyperslab information also */
if(H5S_generate_hyperslab (space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_generate_spans() */
#ifndef NEW_HYPERSLAB_API
@@ -6054,25 +6051,25 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_generate_hyperslab);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_generate_hyperslab)
/* Check args */
- assert(space);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
- assert(start);
- assert(stride);
- assert(count);
- assert(block);
+ HDassert(space);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+ HDassert(start);
+ HDassert(stride);
+ HDassert(count);
+ HDassert(block);
/* Generate span tree for new hyperslab information */
if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
/* Generate list of blocks to add/remove based on selection operation */
if(op==H5S_SELECT_SET) {
/* Add new spans to current selection */
if(H5S_hyper_merge_spans(space,new_spans,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Set the number of elements in current selection */
space->select.num_elem=H5S_hyper_spans_nelem(new_spans);
@@ -6085,14 +6082,14 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Generate lists of spans which overlap and don't overlap */
if(H5S_hyper_clip_spans(space->select.sel_info.hslab->span_lst,new_spans,&a_not_b,&a_and_b,&b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
switch(op) {
case H5S_SELECT_OR:
/* Add any new spans from b_not_a to current selection */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
@@ -6105,7 +6102,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_AND:
/* Free the current selection */
if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
space->select.sel_info.hslab->span_lst=NULL;
/* Reset the number of items in selection */
@@ -6114,7 +6111,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Check if there are any overlapped selections */
if(a_and_b!=NULL) {
if(H5S_hyper_merge_spans(space,a_and_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
@@ -6130,7 +6127,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_XOR:
/* Free the current selection */
if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
space->select.sel_info.hslab->span_lst=NULL;
/* Reset the number of items in selection */
@@ -6139,7 +6136,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Check if there are any non-overlapped selections */
if(a_not_b!=NULL) {
if(H5S_hyper_merge_spans(space,a_not_b,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
@@ -6149,7 +6146,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
@@ -6162,7 +6159,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTB:
/* Free the current selection */
if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
space->select.sel_info.hslab->span_lst=NULL;
/* Reset the number of items in selection */
@@ -6171,7 +6168,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Check if there are any non-overlapped selections */
if(a_not_b!=NULL) {
if(H5S_hyper_merge_spans(space,a_not_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
@@ -6187,7 +6184,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTA:
/* Free the current selection */
if(H5S_hyper_free_span_info(space->select.sel_info.hslab->span_lst)<0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans");
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans")
space->select.sel_info.hslab->span_lst=NULL;
/* Reset the number of items in selection */
@@ -6196,7 +6193,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Check if there are any non-overlapped selections */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(space,b_not_a,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
space->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
@@ -6215,7 +6212,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_PREPEND:
case H5S_SELECT_INVALID:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
/* Check if the resulting hyperslab span tree is empty */
@@ -6223,11 +6220,11 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
/* Sanity check */
- assert(space->select.num_elem==0);
+ HDassert(space->select.num_elem == 0);
/* Allocate a span info node */
if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
/* Set the reference count */
spans->count=1;
@@ -6268,7 +6265,7 @@ done:
if(H5S_hyper_free_span_info(new_spans) < 0)
HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_generate_hyperslab() */
@@ -6300,13 +6297,13 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
unsigned u; /* Counters */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_hyperslab, FAIL);
+ FUNC_ENTER_NOAPI(H5S_select_hyperslab, FAIL)
/* Check args */
- assert(space);
- assert(start);
- assert(count);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
+ HDassert(space);
+ HDassert(start);
+ HDassert(count);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Point to the correct stride values */
if(stride==NULL)
@@ -6322,7 +6319,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
for(u=0; u<space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
if(count[u]>1 && stride[u]<block[u])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
/* Detect zero-sized hyperslabs in new selection */
if(count[u] == 0 || block[u] == 0) {
@@ -6332,7 +6329,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
@@ -6345,7 +6342,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_PREPEND:
case H5S_SELECT_INVALID:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
} /* end if */
} /* end for */
@@ -6376,7 +6373,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
if(count[u]==1)
int_stride[u]=1;
else {
- assert(stride[u]>block[u]);
+ HDassert(stride[u] > block[u]);
int_stride[u]=stride[u];
} /* end else */
int_count[u]=count[u];
@@ -6408,7 +6405,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_PREPEND:
case H5S_SELECT_INVALID:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
break;
@@ -6445,14 +6442,14 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert to hyperslab selection */
if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
} /* end case */
break;
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_NOOP:
@@ -6460,7 +6457,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_PREPEND:
case H5S_SELECT_INVALID:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
break;
@@ -6476,7 +6473,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SEL_ERROR:
case H5S_SEL_N:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
if(op == H5S_SELECT_SET) {
@@ -6571,7 +6568,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
unsigned u; /* Local index variable */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
+ FUNC_ENTER_API(H5Sselect_hyperslab, FAIL)
H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
/* Check args */
@@ -6589,15 +6586,15 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
/* Check for 0-sized strides */
for(u=0; u<space->extent.rank; u++) {
if(stride[u]==0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
} /* end for */
} /* end if */
if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_hyperslab() */
#else /* NEW_HYPERSLAB_API */ /* Works */
@@ -6625,18 +6622,18 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_operate_hyperslab);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_operate_hyperslab)
/* Check args */
- assert(result);
- assert(spans2);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
+ HDassert(result);
+ HDassert(spans2);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Just copy the selection from spans2 if we are setting the selection */
/* ('space1' to 'result' aliasing happens at the next layer up) */
if(op==H5S_SELECT_SET) {
if(H5S_hyper_merge_spans(result,spans2,can_own_span2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(spans2);
@@ -6648,11 +6645,11 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
else {
hbool_t updated_spans = FALSE; /* Whether the spans in the selection were modified */
- assert(spans1);
+ HDassert(spans1);
/* Generate lists of spans which overlap and don't overlap */
if(H5S_hyper_clip_spans(spans1,spans2,&a_not_b,&a_and_b,&b_not_a)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
/* Switch on the operation */
switch(op) {
@@ -6660,7 +6657,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Copy spans from spans1 to current selection */
if(spans1!=NULL) {
if(H5S_hyper_merge_spans(result,spans1,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(spans1);
@@ -6669,7 +6666,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Add any new spans from spans2 to current selection */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
@@ -6683,7 +6680,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Check if there are any overlapped selections */
if(a_and_b!=NULL) {
if(H5S_hyper_merge_spans(result,a_and_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
@@ -6700,7 +6697,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Check if there are any non-overlapped selections */
if(a_not_b!=NULL) {
if(H5S_hyper_merge_spans(result,a_not_b,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
@@ -6710,7 +6707,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
@@ -6724,7 +6721,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Check if there are any non-overlapped selections */
if(a_not_b!=NULL) {
if(H5S_hyper_merge_spans(result,a_not_b,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
@@ -6741,7 +6738,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
/* Check if there are any non-overlapped selections */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(result,b_not_a,TRUE)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs")
/* Update the number of elements in current selection */
result->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
@@ -6755,7 +6752,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
break;
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
/* Free the hyperslab trees generated from the clipping algorithm */
@@ -6771,11 +6768,11 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
H5S_hyper_span_info_t *spans; /* Empty hyperslab span tree */
/* Sanity check */
- assert(result->select.num_elem==0);
+ HDassert(result->select.num_elem == 0);
/* Allocate a span info node */
if((spans = H5FL_MALLOC(H5S_hyper_span_info_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab span")
/* Set the reference count */
spans->count=1;
@@ -6802,7 +6799,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
} /* end else */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_operate_hyperslab() */
@@ -6832,19 +6829,19 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_generate_hyperslab);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_generate_hyperslab)
/* Check args */
- assert(space);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
- assert(start);
- assert(stride);
- assert(count);
- assert(block);
+ HDassert(space);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
+ HDassert(start);
+ HDassert(stride);
+ HDassert(count);
+ HDassert(block);
/* Generate span tree for new hyperslab information */
if((new_spans=H5S_hyper_make_spans(space->extent.rank,start,stride,count,block))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information")
/* Copy the original dataspace */
if(space->select.sel_info.hslab->span_lst!=NULL) {
@@ -6855,27 +6852,27 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Reset the other dataspace selection information */
if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
/* Allocate space for the hyperslab selection information */
if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
} /* end if */
/* Combine tmp_space (really space) & new_space, with the result in space */
if(H5S_operate_hyperslab(space,tmp_spans,op,new_spans,TRUE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
done:
/* Free temporary data structures */
if(tmp_spans!=NULL)
if(H5S_hyper_free_span_info(tmp_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans");
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
if(new_spans!=NULL && span2_owned==FALSE)
if(H5S_hyper_free_span_info(new_spans)<0)
- HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans");
+ HDONE_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release temporary hyperslab spans")
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_generate_hyperslab() */
@@ -6909,13 +6906,13 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
unsigned u; /* Counters */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5S_select_hyperslab, FAIL);
+ FUNC_ENTER_NOAPI(H5S_select_hyperslab, FAIL)
/* Check args */
- assert(space);
- assert(start);
- assert(count);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
+ HDassert(space);
+ HDassert(start);
+ HDassert(count);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Point to the correct stride values */
if(stride==NULL)
@@ -6931,7 +6928,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
for(u=0; u<space->extent.rank; u++) {
/* Check for overlapping hyperslab blocks in new selection. */
if(count[u]>1 && stride[u]<block[u])
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap")
/* Detect zero-sized hyperslabs in new selection */
if(count[u] == 0 || block[u] == 0) {
@@ -6941,7 +6938,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */
@@ -6950,7 +6947,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_DONE(SUCCEED); /* Selection stays same */
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
} /* end if */
} /* end for */
@@ -6981,7 +6978,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
if(count[u]==1)
int_stride[u]=1;
else {
- assert(stride[u]>block[u]);
+ HDassert(stride[u] > block[u]);
int_stride[u]=stride[u];
} /* end else */
int_count[u]=count[u];
@@ -7009,7 +7006,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_DONE(SUCCEED); /* Selection stays "none" */
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
break;
@@ -7046,18 +7043,18 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert to hyperslab selection */
if(H5S_select_hyperslab(space,H5S_SELECT_SET,tmp_start,tmp_stride,tmp_count,tmp_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
} /* end case */
break;
case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */
/* Convert to "none" selection */
if(H5S_select_none(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection")
HGOTO_DONE(SUCCEED);
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
break;
@@ -7071,18 +7068,18 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Else fall through to error */
default:
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
} /* end switch */
if(op==H5S_SELECT_SET) {
/* If we are setting a new selection, remove current selection first */
if(H5S_SELECT_RELEASE(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab")
/* Allocate space for the hyperslab selection information */
if((space->select.sel_info.hslab=H5FL_MALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
/* Save the diminfo */
space->select.num_elem=1;
@@ -7108,28 +7105,28 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
} /* end if */
else if(op>=H5S_SELECT_OR && op<=H5S_SELECT_NOTA) {
/* Sanity check */
- assert(H5S_GET_SELECT_TYPE(space)==H5S_SEL_HYPERSLABS);
+ HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS);
/* Check if there's no hyperslab span information currently */
if(space->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
/* Add in the new hyperslab information */
if(H5S_generate_hyperslab (space, op, start, opt_stride, opt_count, opt_block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs")
/* Indicate that the regular dimensions are no longer valid */
space->select.sel_info.hslab->diminfo_valid=FALSE;
} /* end if */
else
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Set selection type */
space->select.type=H5S_sel_hyper;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_hyperslab() */
@@ -7166,35 +7163,35 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
+ FUNC_ENTER_API(H5Sselect_hyperslab, FAIL)
H5TRACE6("e", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space")
if (H5S_NULL==H5S_GET_EXTENT_TYPE(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space")
if(start==NULL || count==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
if(stride!=NULL) {
unsigned u; /* Local index variable */
/* Check for 0-sized strides */
for(u=0; u<space->extent.rank; u++) {
if(stride[u]==0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value")
} /* end for */
} /* end if */
if (H5S_select_hyperslab(space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_hyperslab() */
@@ -7235,35 +7232,35 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
H5S_t *new_space = NULL; /* New dataspace created */
hid_t ret_value;
- FUNC_ENTER_API(H5Scombine_hyperslab, FAIL);
+ FUNC_ENTER_API(H5Scombine_hyperslab, FAIL)
H5TRACE6("i", "iSs*h*h*h*h", space_id, op, start, stride, count, block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(start==NULL || count==NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified")
if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space")
/* Go modify the selection in the new dataspace */
if (H5S_select_hyperslab(new_space, op, start, stride, count, block)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection")
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
if (ret_value<0 && new_space)
H5S_close(new_space);
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Scombine_hyperslab() */
@@ -7288,36 +7285,36 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
H5S_t *ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_combine_select);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_combine_select)
/* Check args */
- assert(space1);
- assert(space2);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
+ HDassert(space1);
+ HDassert(space2);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Check that the space selections both have span trees */
if(space1->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
if(space2->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree")
/* Copy the first dataspace */
if (NULL == (new_space = H5S_copy (space1, TRUE, TRUE)))
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space")
/* Free the current selection for the new dataspace */
if(H5S_SELECT_RELEASE(new_space)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection")
/* Allocate space for the hyperslab selection information */
if((new_space->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate hyperslab info")
/* Combine space1 & space2, with the result in new_space */
if(H5S_operate_hyperslab(new_space,space1->select.sel_info.hslab->span_lst,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information")
/* Set return value */
ret_value=new_space;
@@ -7326,7 +7323,7 @@ done:
if(ret_value==NULL && new_space!=NULL)
H5S_close(new_space);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_combine_select() */
@@ -7360,38 +7357,38 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
H5S_t *new_space = NULL; /* New Dataspace */
hid_t ret_value;
- FUNC_ENTER_API(H5Scombine_select, FAIL);
+ FUNC_ENTER_API(H5Scombine_select, FAIL)
H5TRACE3("i", "iSsi", space1_id, op, space2_id);
/* Check args */
if (NULL == (space1=H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if (NULL == (space2=H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Check that both dataspaces have the same rank */
if(space1->extent.rank!=space2->extent.rank)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
/* Check that both dataspaces have hyperslab selections */
if(H5S_GET_SELECT_TYPE(space1)!=H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2)!=H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go combine the dataspaces */
if ((new_space=H5S_combine_select(space1, op, space2))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to create hyperslab selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to create hyperslab selection")
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, new_space, TRUE))<0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom")
done:
if (ret_value<0 && new_space)
H5S_close(new_space);
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Scombine_select() */
@@ -7416,20 +7413,20 @@ H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
hbool_t span2_owned=FALSE; /* Flag to indicate that span2 was used in H5S_operate_hyperslab() */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_select_select);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_select_select)
/* Check args */
- assert(space1);
- assert(space2);
- assert(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID);
+ HDassert(space1);
+ HDassert(space2);
+ HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID);
/* Check that the space selections both have span trees */
if(space1->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
if(space2->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree")
/* Take ownership of the dataspace's hyperslab spans */
/* (These are freed later) */
@@ -7438,21 +7435,21 @@ H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
/* Reset the other dataspace selection information */
if(H5S_SELECT_RELEASE(space1)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection")
/* Allocate space for the hyperslab selection information */
if((space1->select.sel_info.hslab=H5FL_CALLOC(H5S_hyper_sel_t))==NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
/* Combine tmp_spans (from space1) & spans from space2, with the result in space1 */
if(H5S_operate_hyperslab(space1,tmp_spans,op,space2->select.sel_info.hslab->span_lst,FALSE,&span2_owned)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information")
done:
if(tmp_spans!=NULL)
H5S_hyper_free_span_info(tmp_spans);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_select() */
@@ -7485,31 +7482,31 @@ H5Sselect_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id)
H5S_t *space2; /* Second Dataspace */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Sselect_select, FAIL);
+ FUNC_ENTER_API(H5Sselect_select, FAIL)
H5TRACE3("e", "iSsi", space1_id, op, space2_id);
/* Check args */
if (NULL == (space1=H5I_object_verify(space1_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if (NULL == (space2=H5I_object_verify(space2_id, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
if(!(op>H5S_SELECT_NOOP && op<H5S_SELECT_INVALID))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation")
/* Check that both dataspaces have the same rank */
if(space1->extent.rank!=space2->extent.rank)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank")
/* Check that both dataspaces have hyperslab selections */
if(H5S_GET_SELECT_TYPE(space1)!=H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2)!=H5S_SEL_HYPERSLABS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections")
/* Go refine the first selection */
if (H5S_select_select(space1, op, space2)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection");
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection")
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
} /* end H5Sselect_select() */
#endif /* NEW_HYPERSLAB_API */ /* Works */
@@ -7973,10 +7970,10 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
hsize_t *mem_size; /* Size of the source buffer */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
const hssize_t *sel_off; /* Selection offset in dataspace */
- hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
+ hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
@@ -7994,15 +7991,14 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
int temp_dim; /* Temporary rank holder */
hsize_t acc; /* Accumulator */
hsize_t loc; /* Coordinate offset */
- unsigned u; /* Local index variable */
- int i; /* Local index variable */
- size_t curr_seq=0; /* Current sequence being operated on */
+ size_t curr_seq = 0; /* Current sequence being operated on */
size_t actual_elem; /* The actual number of elements to count */
size_t actual_bytes;/* The actual number of bytes to copy */
- size_t nelmts; /* Starting number of elements */
size_t io_left; /* The number of elements left in I/O operation */
size_t start_io_left; /* The initial number of elements left in I/O operation */
size_t elem_size; /* Size of each element iterating over */
+ unsigned u; /* Local index variable */
+ int i; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_opt)
@@ -8051,251 +8047,118 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
} /* end for */
/* Calculate the number of elements to sequence through */
- H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t);
- start_io_left=io_left=MIN((size_t)iter->elmt_left,maxelem);
-
- /* Check if we stopped in the middle of a sequence of elements */
- if((iter->u.hyp.off[fast_dim]-tdiminfo[fast_dim].start)%tdiminfo[fast_dim].stride!=0 ||
- ((iter->u.hyp.off[fast_dim]!=tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count==1)) {
- size_t leftover; /* The number of elements left over from the last sequence */
-
- /* Calculate the number of elements left in the sequence */
- if(tdiminfo[fast_dim].count==1) {
- H5_ASSIGN_OVERFLOW(leftover, tdiminfo[fast_dim].block-(iter->u.hyp.off[fast_dim]-tdiminfo[fast_dim].start) ,hsize_t,size_t);
- } /* end if */
- else {
- H5_ASSIGN_OVERFLOW(leftover, tdiminfo[fast_dim].block-((iter->u.hyp.off[fast_dim]-tdiminfo[fast_dim].start)%tdiminfo[fast_dim].stride) ,hsize_t,size_t);
- } /* end else */
-
- /* Make certain that we don't write too many */
- actual_elem=MIN(leftover,io_left);
-
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
-
- /* Add a new sequence */
- off[curr_seq] = loc;
- H5_ASSIGN_OVERFLOW(len[curr_seq], actual_elem * elem_size, hsize_t, size_t);
-
- /* Increment sequence count */
- curr_seq++;
-
- /* Decrement the number of elements left */
- io_left -= actual_elem;
-
- /* Advance the hyperslab iterator */
- H5S_hyper_iter_next(iter, actual_elem);
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
- /* Decrement the number of elements left in selection */
- iter->elmt_left -= actual_elem;
- } /* end if */
+ /* Sanity check that there aren't any "remainder" sequences in process */
+ HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)));
- /* Now that we've cleared the "remainder" of the previous fastest dimension
- * sequence, we must be at the beginning of a sequence, so use the fancy
- * algorithm to compute the offsets and run through as many as possible,
- * until the buffer fills up.
+ /* We've cleared the "remainder" of the previous fastest dimension
+ * sequence before calling this routine, so we must be at the beginning of
+ * a sequence. Use the fancy algorithm to compute the offsets and run
+ * through as many as possible, until the buffer fills up.
*/
- if(io_left > 0 && curr_seq < maxseq) { /* Just in case the "remainder" above filled the buffer */
- /* Keep the number of elements we started with */
- nelmts = io_left;
-
- /* Compute the arrays to perform I/O on */
-
- /* Copy the location of the point to get */
- /* (Add in the selection offset) */
- for(u = 0; u < ndims; u++)
- offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
-
- /* Compute the current "counts" for this location */
- for(u = 0; u < ndims; u++) {
- if(tdiminfo[u].count == 1) {
- tmp_count[u] = 0;
- tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
- } /* end if */
- else {
- tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
- tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
- } /* end else */
- } /* end for */
- /* Compute the initial buffer offset */
- for(u = 0, loc = 0; u < ndims; u++)
- loc += offset[u] * slab[u];
+ /* Keep the number of elements we started with */
+ start_io_left = io_left;
- /* Set the number of elements to write each time */
- H5_ASSIGN_OVERFLOW(actual_elem,tdiminfo[fast_dim].block,hsize_t,size_t);
+ /* Compute the arrays to perform I/O on */
- /* Set the number of actual bytes */
- actual_bytes=actual_elem*elem_size;
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
- /* Set local copies of information for the fastest changing dimension */
- fast_dim_start = tdiminfo[fast_dim].start;
- fast_dim_stride = tdiminfo[fast_dim].stride;
- fast_dim_block = tdiminfo[fast_dim].block;
- H5_ASSIGN_OVERFLOW(fast_dim_buf_off, slab[fast_dim] * fast_dim_stride, hsize_t, size_t);
- fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
+ /* Compute the current "counts" for this location */
+ for(u = 0; u < ndims; u++) {
+ if(tdiminfo[u].count == 1) {
+ tmp_count[u] = 0;
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+ } /* end if */
+ else {
+ tmp_count[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) / tdiminfo[u].stride;
+ tmp_block[u] = (iter->u.hyp.off[u] - tdiminfo[u].start) % tdiminfo[u].stride;
+ } /* end else */
+ } /* end for */
- /* Compute the number of blocks which would fit into the buffer */
- H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
- tot_blk_count = (size_t)(io_left / fast_dim_block);
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
- /* Don't go over the maximum number of sequences allowed */
- tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
+ /* Set the number of elements to write each time */
+ H5_ASSIGN_OVERFLOW(actual_elem, tdiminfo[fast_dim].block, hsize_t, size_t);
- /* Compute the amount to wrap at the end of each row */
- for(u = 0; u < ndims; u++)
- wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
- /* Compute the amount to skip between blocks */
- for(u = 0; u < ndims; u++)
- skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_start = tdiminfo[fast_dim].start;
+ fast_dim_stride = tdiminfo[fast_dim].stride;
+ fast_dim_block = tdiminfo[fast_dim].block;
+ H5_ASSIGN_OVERFLOW(fast_dim_buf_off, slab[fast_dim] * fast_dim_stride, hsize_t, size_t);
+ fast_dim_offset = (hsize_t)((hssize_t)fast_dim_start + sel_off[fast_dim]);
- /* Check if there is a partial row left (with full blocks) */
- if(tmp_count[fast_dim] > 0) {
- /* Get number of blocks in fastest dimension */
- H5_ASSIGN_OVERFLOW(fast_dim_count, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t, size_t);
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
- /* Make certain this entire row will fit into buffer */
- fast_dim_count=MIN(fast_dim_count,tot_blk_count);
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, (maxseq - curr_seq));
- /* Number of blocks to sequence over */
- act_blk_count=fast_dim_count;
+ /* Compute the amount to wrap at the end of each row */
+ for(u = 0; u < ndims; u++)
+ wrap[u] = (mem_size[u] - (tdiminfo[u].stride * tdiminfo[u].count)) * slab[u];
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count>0) {
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
+ /* Compute the amount to skip between blocks */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (tdiminfo[u].stride - tdiminfo[u].block) * slab[u];
- /* Increment sequence count */
- curr_seq++;
+ /* Check if there is a partial row left (with full blocks) */
+ if(tmp_count[fast_dim] > 0) {
+ /* Get number of blocks in fastest dimension */
+ H5_ASSIGN_OVERFLOW(fast_dim_count, tdiminfo[fast_dim].count - tmp_count[fast_dim], hsize_t, size_t);
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
+ /* Make certain this entire row will fit into buffer */
+ fast_dim_count = MIN(fast_dim_count, tot_blk_count);
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
+ /* Number of blocks to sequence over */
+ act_blk_count = fast_dim_count;
- /* Decrement number of elements left */
- io_left -= actual_elem*act_blk_count;
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
- /* Decrement number of blocks left */
- tot_blk_count -= act_blk_count;
+ /* Increment sequence count */
+ curr_seq++;
/* Increment information to reflect block just processed */
- tmp_count[fast_dim]+=act_blk_count;
-
- /* Check if we finished the entire row of blocks */
- if(tmp_count[fast_dim]>=tdiminfo[fast_dim].count) {
- /* Increment offset in destination buffer */
- loc += wrap[fast_dim];
-
- /* Increment information to reflect block just processed */
- offset[fast_dim]=fast_dim_offset; /* reset the offset in the fastest dimension */
- tmp_count[fast_dim]=0;
-
- /* Increment the offset and count for the other dimensions */
- temp_dim = (int)fast_dim - 1;
- while(temp_dim >= 0) {
- /* Move to the next row in the curent dimension */
- offset[temp_dim]++;
- tmp_block[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
- break;
- else {
- /* Move to the next block in the current dimension */
- offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
- loc += skip[temp_dim];
- tmp_block[temp_dim] = 0;
- tmp_count[temp_dim]++;
-
- /* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
- break;
- else {
- offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
- loc += wrap[temp_dim];
- tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
- tmp_block[temp_dim] = 0;
- } /* end else */
- } /* end else */
+ loc += fast_dim_buf_off;
- /* Decrement dimension count */
- temp_dim--;
- } /* end while */
- } /* end if */
- else {
- /* Update the offset in the fastest dimension */
- offset[fast_dim] += (fast_dim_stride * act_blk_count);
- } /* end else */
- } /* end if */
-
- /* Compute the number of entire rows to read in */
- H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
- curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
-
- /* Reset copy of number of blocks in fastest dimension */
- H5_ASSIGN_OVERFLOW(fast_dim_count,tdiminfo[fast_dim].count,hsize_t,size_t);
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
- /* Read in data until an entire sequence can't be written out any longer */
- while(curr_rows>0) {
+ /* Decrement number of elements left */
+ io_left -= actual_elem * act_blk_count;
-#define DUFF_GUTS \
- /* Store the sequence information */ \
- off[curr_seq] = loc; \
- len[curr_seq] = actual_bytes; \
- \
- /* Increment sequence count */ \
- curr_seq++; \
- \
- /* Increment information to reflect block just processed */ \
- loc += fast_dim_buf_off;
+ /* Decrement number of blocks left */
+ tot_blk_count -= act_blk_count;
-#ifdef NO_DUFFS_DEVICE
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count>0) {
- DUFF_GUTS
-
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
-#else /* NO_DUFFS_DEVICE */
- {
- size_t duffs_index; /* Counting index for Duff's device */
-
- duffs_index = (fast_dim_count + 7) / 8;
- switch (fast_dim_count % 8) {
- case 0:
- do
- {
- DUFF_GUTS
- case 7:
- DUFF_GUTS
- case 6:
- DUFF_GUTS
- case 5:
- DUFF_GUTS
- case 4:
- DUFF_GUTS
- case 3:
- DUFF_GUTS
- case 2:
- DUFF_GUTS
- case 1:
- DUFF_GUTS
- } while (--duffs_index > 0);
- } /* end switch */
- }
-#endif /* NO_DUFFS_DEVICE */
-#undef DUFF_GUTS
+ /* Increment information to reflect block just processed */
+ tmp_count[fast_dim] += act_blk_count;
+ /* Check if we finished the entire row of blocks */
+ if(tmp_count[fast_dim] >= tdiminfo[fast_dim].count) {
/* Increment offset in destination buffer */
loc += wrap[fast_dim];
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] = fast_dim_offset; /* reset the offset in the fastest dimension */
+ tmp_count[fast_dim] = 0;
+
/* Increment the offset and count for the other dimensions */
temp_dim = (int)fast_dim - 1;
while(temp_dim >= 0) {
@@ -8314,7 +8177,7 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
tmp_count[temp_dim]++;
/* If this block is still in the range of blocks to output for the dimension, break out of loop */
- if(tmp_count[temp_dim]<tdiminfo[temp_dim].count)
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
break;
else {
offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
@@ -8327,90 +8190,474 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space, H5S_sel_iter_t *iter,
/* Decrement dimension count */
temp_dim--;
} /* end while */
+ } /* end if */
+ else {
+ /* Update the offset in the fastest dimension */
+ offset[fast_dim] += (fast_dim_stride * act_blk_count);
+ } /* end else */
+ } /* end if */
+
+ /* Compute the number of entire rows to read in */
+ H5_CHECK_OVERFLOW(tot_blk_count / tdiminfo[fast_dim].count, hsize_t, size_t);
+ curr_rows = total_rows = (size_t)(tot_blk_count / tdiminfo[fast_dim].count);
- /* Decrement the number of rows left */
- curr_rows--;
+ /* Reset copy of number of blocks in fastest dimension */
+ H5_ASSIGN_OVERFLOW(fast_dim_count, tdiminfo[fast_dim].count, hsize_t, size_t);
+
+ /* Read in data until an entire sequence can't be written out any longer */
+ while(curr_rows > 0) {
+
+#define DUFF_GUTS \
+/* Store the sequence information */ \
+off[curr_seq] = loc; \
+len[curr_seq] = actual_bytes; \
+ \
+/* Increment sequence count */ \
+curr_seq++; \
+ \
+/* Increment information to reflect block just processed */ \
+loc += fast_dim_buf_off;
+
+#ifdef NO_DUFFS_DEVICE
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ DUFF_GUTS
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
} /* end while */
+#else /* NO_DUFFS_DEVICE */
+ {
+ size_t duffs_index; /* Counting index for Duff's device */
+
+ duffs_index = (fast_dim_count + 7) / 8;
+ switch (fast_dim_count % 8) {
+ case 0:
+ do
+ {
+ DUFF_GUTS
+ case 7:
+ DUFF_GUTS
+ case 6:
+ DUFF_GUTS
+ case 5:
+ DUFF_GUTS
+ case 4:
+ DUFF_GUTS
+ case 3:
+ DUFF_GUTS
+ case 2:
+ DUFF_GUTS
+ case 1:
+ DUFF_GUTS
+ } while (--duffs_index > 0);
+ } /* end switch */
+ }
+#endif /* NO_DUFFS_DEVICE */
+#undef DUFF_GUTS
- /* Adjust the number of blocks & elements left to transfer */
+ /* Increment offset in destination buffer */
+ loc += wrap[fast_dim];
- /* Decrement number of elements left */
- H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
- io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
+ /* Increment the offset and count for the other dimensions */
+ temp_dim = (int)fast_dim - 1;
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
- /* Decrement number of blocks left */
- H5_CHECK_OVERFLOW( (total_rows*tdiminfo[fast_dim].count) ,hsize_t,size_t);
- tot_blk_count -= (size_t)(total_rows*tdiminfo[fast_dim].count);
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ /* Move to the next block in the current dimension */
+ offset[temp_dim] += (tdiminfo[temp_dim].stride - tdiminfo[temp_dim].block);
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ tmp_count[temp_dim]++;
- /* Read in partial row of blocks */
- if(io_left>0 && curr_seq<maxseq) {
- /* Get remaining number of blocks left to output */
- fast_dim_count=tot_blk_count;
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_count[temp_dim] < tdiminfo[temp_dim].count)
+ break;
+ else {
+ offset[temp_dim] = (hsize_t)((hssize_t)tdiminfo[temp_dim].start + sel_off[temp_dim]);
+ loc += wrap[temp_dim];
+ tmp_count[temp_dim] = 0; /* reset back to the beginning of the line */
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement the number of rows left */
+ curr_rows--;
+ } /* end while */
- /* Loop over all the blocks in the fastest changing dimension */
- while(fast_dim_count>0) {
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
+ /* Adjust the number of blocks & elements left to transfer */
- /* Increment sequence count */
- curr_seq++;
+ /* Decrement number of elements left */
+ H5_CHECK_OVERFLOW(actual_elem * (total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ io_left -= (size_t)(actual_elem * (total_rows * tdiminfo[fast_dim].count));
- /* Increment information to reflect block just processed */
- loc+=fast_dim_buf_off;
+ /* Decrement number of blocks left */
+ H5_CHECK_OVERFLOW((total_rows * tdiminfo[fast_dim].count), hsize_t, size_t);
+ tot_blk_count -= (size_t)(total_rows * tdiminfo[fast_dim].count);
- /* Decrement number of blocks */
- fast_dim_count--;
- } /* end while */
+ /* Read in partial row of blocks */
+ if(io_left > 0 && curr_seq < maxseq) {
+ /* Get remaining number of blocks left to output */
+ fast_dim_count = tot_blk_count;
- /* Decrement number of elements left */
- io_left -= actual_elem*tot_blk_count;
+ /* Loop over all the blocks in the fastest changing dimension */
+ while(fast_dim_count > 0) {
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
/* Increment information to reflect block just processed */
- offset[fast_dim]+=(fast_dim_stride*tot_blk_count); /* move the offset in the fastest dimension */
+ loc += fast_dim_buf_off;
+
+ /* Decrement number of blocks */
+ fast_dim_count--;
+ } /* end while */
+
+ /* Decrement number of elements left */
+ io_left -= actual_elem * tot_blk_count;
+
+ /* Increment information to reflect block just processed */
+ offset[fast_dim] += (fast_dim_stride * tot_blk_count); /* move the offset in the fastest dimension */
+
+ /* Handle any leftover, partial blocks in this row */
+ if(io_left > 0 && curr_seq < maxseq) {
+ actual_elem = io_left;
+ actual_bytes = actual_elem * elem_size;
+
+ /* Store the sequence information */
+ off[curr_seq] = loc;
+ len[curr_seq] = actual_bytes;
+
+ /* Increment sequence count */
+ curr_seq++;
+
+ /* Decrement the number of elements left */
+ io_left -= actual_elem;
+
+ /* Increment buffer correctly */
+ offset[fast_dim] += actual_elem;
+ } /* end if */
+
+ /* don't bother checking slower dimensions */
+ HDassert(io_left == 0 || curr_seq == maxseq);
+ } /* end if */
+
+ /* Update the iterator */
+
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= (start_io_left - io_left);
+
+ /* Increment the number of sequences generated */
+ *nseq += curr_seq;
+
+ /* Increment the number of elements used */
+ *nelem += start_io_left - io_left;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5S_hyper_get_seq_list_opt() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_get_seq_list_single
+ PURPOSE
+ Create a list of offsets & lengths for a selection
+ USAGE
+ herr_t H5S_hyper_get_seq_list_single(space, flags, iter, maxseq, maxelem, nseq, nelem, off, len)
+ H5S_t *space; IN: Dataspace containing selection to use.
+ unsigned flags; IN: Flags for extra information about operation
+ H5S_sel_iter_t *iter; IN/OUT: Selection iterator describing last
+ position of interest in selection.
+ size_t maxseq; IN: Maximum number of sequences to generate
+ size_t maxelem; IN: Maximum number of elements to include in the
+ generated sequences
+ size_t *nseq; OUT: Actual number of sequences generated
+ size_t *nelem; OUT: Actual number of elements in sequences generated
+ hsize_t *off; OUT: Array of offsets
+ size_t *len; OUT: Array of lengths
+ RETURNS
+ Non-negative on success/Negative on failure.
+ DESCRIPTION
+ Use the selection in the dataspace to generate a list of byte offsets and
+ lengths for the region(s) selected. Start/Restart from the position in the
+ ITER parameter. The number of sequences generated is limited by the MAXSEQ
+ parameter and the number of sequences actually generated is stored in the
+ NSEQ parameter.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter,
+ size_t maxseq, size_t maxelem, size_t *nseq, size_t *nelem,
+ hsize_t *off, size_t *len)
+{
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t *mem_size; /* Size of the source buffer */
+ hsize_t base_offset[H5O_LAYOUT_NDIMS]; /* Base coordinate offset in dataspace */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
+ hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
+ hsize_t fast_dim_block; /* Local copies of fastest changing dimension info */
+ hsize_t acc; /* Accumulator */
+ hsize_t loc; /* Coordinate offset */
+ size_t tot_blk_count; /* Total number of blocks left to output */
+ size_t elem_size; /* Size of each element iterating over */
+ size_t io_left; /* The number of elements left in I/O operation */
+ size_t actual_elem; /* The actual number of elements to count */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ unsigned skip_dim; /* Rank of the dimension to skip along */
+ unsigned u; /* Local index variable */
+ int i; /* Local index variable */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list_single)
+
+ /* Check args */
+ HDassert(space);
+ HDassert(iter);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
+
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
+
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = space->extent.rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = space->select.offset;
- /* Handle any leftover, partial blocks in this row */
- if(io_left>0 && curr_seq<maxseq) {
- actual_elem=io_left;
- actual_bytes=actual_elem*elem_size;
+ /* Set up the pointer to the size of the memory space */
+ mem_size = space->extent.size;
+ } /* end else */
+ fast_dim = ndims - 1;
- /* Store the sequence information */
- off[curr_seq]=loc;
- len[curr_seq]=actual_bytes;
+ /* initialize row sizes for each dimension */
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
+ } /* end for */
+
+ /* Copy the base location of the block */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ base_offset[u] = (hsize_t)((hssize_t)tdiminfo[u].start + sel_off[u]);
- /* Increment sequence count */
- curr_seq++;
+ /* Copy the location of the point to get */
+ /* (Add in the selection offset) */
+ for(u = 0; u < ndims; u++)
+ offset[u] = (hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u]);
- /* Decrement the number of elements left */
- io_left -= actual_elem;
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += offset[u] * slab[u];
+
+ /* Set local copies of information for the fastest changing dimension */
+ fast_dim_block = tdiminfo[fast_dim].block;
+
+ /* Calculate the number of elements to sequence through */
+ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t);
+ io_left = MIN((size_t)iter->elmt_left, maxelem);
+
+ /* Compute the number of blocks which would fit into the buffer */
+ H5_CHECK_OVERFLOW(io_left / fast_dim_block, hsize_t, size_t);
+ tot_blk_count = (size_t)(io_left / fast_dim_block);
+
+ /* Don't go over the maximum number of sequences allowed */
+ tot_blk_count = MIN(tot_blk_count, maxseq);
+
+ /* Set the number of elements to write each time */
+ H5_ASSIGN_OVERFLOW(actual_elem, fast_dim_block, hsize_t, size_t);
+
+ /* Check for blocks to operate on */
+ if(tot_blk_count > 0) {
+ size_t actual_bytes; /* The actual number of bytes to copy */
+
+ /* Set the number of actual bytes */
+ actual_bytes = actual_elem * elem_size;
+
+ /* Check for 1-dim selection */
+ if(0 == fast_dim) {
+ /* Sanity checks */
+ HDassert(1 == tot_blk_count);
+ HDassert(io_left == actual_elem);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+ } /* end if */
+ else {
+ hsize_t skip_slab; /* Temporary copy of slab[fast_dim - 1] */
+ size_t blk_count; /* Total number of blocks left to output */
+
+ /* Find first dimension w/block >1 */
+ skip_dim = fast_dim;
+ for(i = (int)(fast_dim - 1); i >= 0; i--)
+ if(tdiminfo[i].block > 1) {
+ skip_dim = (unsigned)i;
+ break;
+ } /* end if */
+ skip_slab = slab[skip_dim];
+
+ /* Check for being able to use fast algorithm for 1-D */
+ if(0 == skip_dim) {
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
- /* Increment buffer correctly */
- offset[fast_dim]+=actual_elem;
+ /* Move to the next location */
+ offset[skip_dim] += tot_blk_count;
} /* end if */
+ else {
+ hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
+ hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
+ int temp_dim; /* Temporary rank holder */
+
+ /* Set the starting block location */
+ for(u = 0; u < ndims; u++)
+ tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start;
+
+ /* Compute the amount to skip between sequences */
+ for(u = 0; u < ndims; u++)
+ skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u];
+
+ /* Create sequences until an entire row can't be used */
+ blk_count = tot_blk_count;
+ while(blk_count > 0) {
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = actual_bytes;
+
+ /* Set temporary dimension for advancing offsets */
+ temp_dim = (int)skip_dim;
- /* don't bother checking slower dimensions */
- assert(io_left==0 || curr_seq==maxseq);
+ /* Increment offset in destination buffer */
+ loc += skip_slab;
+
+ /* Increment the offset and count for the other dimensions */
+ while(temp_dim >= 0) {
+ /* Move to the next row in the curent dimension */
+ offset[temp_dim]++;
+ tmp_block[temp_dim]++;
+
+ /* If this block is still in the range of blocks to output for the dimension, break out of loop */
+ if(tmp_block[temp_dim] < tdiminfo[temp_dim].block)
+ break;
+ else {
+ offset[temp_dim] = base_offset[temp_dim];
+ loc += skip[temp_dim];
+ tmp_block[temp_dim] = 0;
+ } /* end else */
+
+ /* Decrement dimension count */
+ temp_dim--;
+ } /* end while */
+
+ /* Decrement block count */
+ blk_count--;
+ } /* end while */
+ } /* end else */
+ } /* end else */
+
+ /* Update the iterator, if there were any blocks used */
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= tot_blk_count * actual_elem;
+
+ /* Check if there are elements left in iterator */
+ if(iter->elmt_left > 0) {
+ /* Update the iterator with the location we stopped */
+ /* (Subtract out the selection offset) */
+ for(u = 0; u < ndims; u++)
+ iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
} /* end if */
- /* Update the iterator */
+ /* Increment the number of sequences generated */
+ *nseq += tot_blk_count;
+
+ /* Increment the number of elements used */
+ *nelem += tot_blk_count * actual_elem;
+ } /* end if */
+
+ /* Check for partial block, with room for another sequence */
+ if(io_left > (tot_blk_count * actual_elem) && tot_blk_count < maxseq) {
+ size_t elmt_remainder; /* Elements remaining */
+
+ /* Compute elements left */
+ elmt_remainder = io_left - (tot_blk_count * actual_elem);
+ HDassert(elmt_remainder < fast_dim_block);
+ HDassert(elmt_remainder > 0);
+
+ /* Store the sequence information */
+ *off++ = loc;
+ *len++ = elmt_remainder * elem_size;
/* Update the iterator with the location we stopped */
- /* (Subtract out the selection offset) */
- for(u = 0; u < ndims; u++)
- iter->u.hyp.off[u] = (hsize_t)((hssize_t)offset[u] - sel_off[u]);
+ iter->u.hyp.off[fast_dim] += (hsize_t)elmt_remainder;
/* Decrement the number of elements left in selection */
- iter->elmt_left -= (nelmts - io_left);
- } /* end if */
+ iter->elmt_left -= elmt_remainder;
- /* Set the number of sequences generated */
- *nseq = curr_seq;
+ /* Increment the number of sequences generated */
+ (*nseq)++;
- /* Set the number of bytes used */
- *nelem = start_io_left - io_left;
+ /* Increment the number of elements used */
+ *nelem += elmt_remainder;
+ } /* end if */
+
+ /* Sanity check */
+ HDassert(*nseq > 0);
+ HDassert(*nelem > 0);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5S_hyper_get_seq_list_opt() */
+} /* end H5S_hyper_get_seq_list_single() */
/*--------------------------------------------------------------------------
@@ -8451,26 +8698,141 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t
{
herr_t ret_value; /* return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_get_seq_list)
/* Check args */
- assert(space);
- assert(iter);
- assert(maxseq>0);
- assert(maxelem>0);
- assert(nseq);
- assert(nelem);
- assert(off);
- assert(len);
+ HDassert(space);
+ HDassert(iter);
+ HDassert(iter->elmt_left > 0);
+ HDassert(maxseq > 0);
+ HDassert(maxelem > 0);
+ HDassert(nseq);
+ HDassert(nelem);
+ HDassert(off);
+ HDassert(len);
/* Check for the special case of just one H5Sselect_hyperslab call made */
- if(space->select.sel_info.hslab->diminfo_valid)
- /* Use optimized call to generate sequence list */
- ret_value=H5S_hyper_get_seq_list_opt(space,iter,maxseq,maxelem,nseq,nelem,off,len);
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
+ const hssize_t *sel_off; /* Selection offset in dataspace */
+ hsize_t *mem_size; /* Size of the source buffer */
+ unsigned ndims; /* Number of dimensions of dataset */
+ unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */
+ hbool_t single_block; /* Whether the selection is a single block */
+ unsigned u; /* Local index variable */
+
+ /* Set a local copy of the diminfo pointer */
+ tdiminfo = iter->u.hyp.diminfo;
+
+ /* Check if this is a "flattened" regular hyperslab selection */
+ if(iter->u.hyp.iter_rank != 0 && iter->u.hyp.iter_rank < space->extent.rank) {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = iter->u.hyp.iter_rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = iter->u.hyp.sel_off;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = iter->u.hyp.size;
+ } /* end if */
+ else {
+ /* Set the aliases for a few important dimension ranks */
+ ndims = space->extent.rank;
+
+ /* Set the local copy of the selection offset */
+ sel_off = space->select.offset;
+
+ /* Set up the pointer to the size of the memory space */
+ mem_size = space->extent.size;
+ } /* end else */
+ fast_dim = ndims - 1;
+
+ /* Check if we stopped in the middle of a sequence of elements */
+ if((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 ||
+ ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1)) {
+ hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
+ hsize_t loc; /* Coordinate offset */
+ hsize_t acc; /* Accumulator */
+ size_t leftover; /* The number of elements left over from the last sequence */
+ size_t actual_elem; /* The actual number of elements to count */
+ size_t elem_size; /* Size of each element iterating over */
+ int i; /* Local index variable */
+
+
+ /* Calculate the number of elements left in the sequence */
+ if(tdiminfo[fast_dim].count == 1) {
+ H5_ASSIGN_OVERFLOW(leftover, tdiminfo[fast_dim].block - (iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start), hsize_t, size_t);
+ } /* end if */
+ else {
+ H5_ASSIGN_OVERFLOW(leftover, tdiminfo[fast_dim].block - ((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride), hsize_t, size_t);
+ } /* end else */
+
+ /* Make certain that we don't write too many */
+ actual_elem = MIN3(leftover, (size_t)iter->elmt_left, maxelem);
+
+ /* initialize row sizes for each dimension */
+ elem_size = iter->elmt_size;
+ for(i = (int)fast_dim, acc = elem_size; i >= 0; i--) {
+ slab[i] = acc;
+ acc *= mem_size[i];
+ } /* end for */
+
+ /* Compute the initial buffer offset */
+ for(u = 0, loc = 0; u < ndims; u++)
+ loc += ((hsize_t)((hssize_t)iter->u.hyp.off[u] + sel_off[u])) * slab[u];
+
+ /* Add a new sequence */
+ off[0] = loc;
+ H5_ASSIGN_OVERFLOW(len[0], actual_elem * elem_size, hsize_t, size_t);
+
+ /* Increment sequence array locations */
+ off++;
+ len++;
+
+ /* Advance the hyperslab iterator */
+ H5S_hyper_iter_next(iter, actual_elem);
+
+ /* Decrement the number of elements left in selection */
+ iter->elmt_left -= actual_elem;
+
+ /* Decrement element/sequence limits */
+ maxelem -= actual_elem;
+ maxseq--;
+
+ /* Set the number of sequences generated and elements used */
+ *nseq = 1;
+ *nelem = actual_elem;
+
+ /* Check for using up all the sequences/elements */
+ if(0 == iter->elmt_left || 0 == maxelem || 0 == maxseq)
+ return(SUCCEED);
+ } /* end if */
+ else {
+ /* Reset the number of sequences generated and elements used */
+ *nseq = 0;
+ *nelem = 0;
+ } /* end else */
+
+ /* Check for a single block selected */
+ single_block = TRUE;
+ for(u = 0; u < ndims; u++)
+ if(1 != tdiminfo[u].count) {
+ single_block = FALSE;
+ break;
+ } /* end if */
+
+ /* Check for single block selection */
+ if(single_block)
+ /* Use single-block optimized call to generate sequence list */
+ ret_value = H5S_hyper_get_seq_list_single(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+ else
+ /* Use optimized call to generate sequence list */
+ ret_value = H5S_hyper_get_seq_list_opt(space, iter, maxseq, maxelem, nseq, nelem, off, len);
+ } /* end if */
else
/* Call the general sequence generator routine */
- ret_value=H5S_hyper_get_seq_list_gen(space,iter,maxseq,maxelem,nseq,nelem,off,len);
+ ret_value = H5S_hyper_get_seq_list_gen(space, iter, maxseq, maxelem, nseq, nelem, off, len);
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_get_seq_list() */
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 17b7fab..2a0e63f 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -189,10 +189,10 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
FUNC_ENTER_NOAPI_NOFUNC(H5S_select_get_seq_list)
- assert(space);
+ HDassert(space);
/* Call the selection type's get_seq_list function */
- ret_value=(*space->select.type->get_seq_list)(space,flags,iter,maxseq,maxbytes,nseq,nbytes,off,len);
+ ret_value = (*space->select.type->get_seq_list)(space, flags, iter, maxseq, maxbytes, nseq, nbytes, off, len);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_get_seq_list() */
diff --git a/src/H5V.c b/src/H5V.c
index 1efe497..515a2c5 100644
--- a/src/H5V.c
+++ b/src/H5V.c
@@ -24,6 +24,12 @@
#include "H5Oprivate.h"
#include "H5Vprivate.h"
+/* Local typedefs */
+typedef struct H5V_memcpy_ud_t {
+ unsigned char *dst; /* Pointer to destination buffer */
+ const unsigned char *src; /* Pointer to source buffer */
+} H5V_memcpy_ud_t;
+
/* Local macros */
#define H5V_HYPER_NDIMS H5O_LAYOUT_NDIMS
@@ -1150,8 +1156,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *total_size,
- const hsize_t *down, hsize_t *coords)
+H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down,
+ hsize_t *coords)
{
unsigned u; /* Local index variable */
@@ -1159,7 +1165,6 @@ H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *total_size,
/* Sanity check */
HDassert(n <= H5V_HYPER_NDIMS);
- HDassert(total_size);
HDassert(coords);
/* Compute the coordinates from the offset */
@@ -1210,7 +1215,7 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *c
HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute down sizes")
/* Compute the coordinates from the offset */
- if(H5V_array_calc_pre(offset, n, total_size, idx, coords) < 0)
+ if(H5V_array_calc_pre(offset, n, idx, coords) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute coordinates")
done:
@@ -1356,6 +1361,212 @@ H5V_unswizzle_coords(hsize_t *coords, unsigned unlim_dim)
/*-------------------------------------------------------------------------
+ * Function: H5V_opvv
+ *
+ * Purpose: Perform an operation on a source & destination sequences
+ * of offset/length pairs. Each set of sequnces has an array
+ * of lengths, an array of offsets, the maximum number of
+ * sequences and the current sequence to start at in the sequence.
+ *
+ * There may be different numbers of bytes in the source and
+ * destination sequences, the operation stops when either the
+ * source or destination sequence runs out of information.
+ *
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5V_memcpyvv(). Changes should be made to both!
+ *
+ * Return: Non-negative # of bytes operated on, on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 30, 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+ssize_t
+H5V_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[],
+ hsize_t dst_off_arr[],
+ size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[],
+ hsize_t src_off_arr[],
+ H5V_opvv_func_t op, void *op_data)
+{
+ hsize_t *max_dst_off_ptr, *max_src_off_ptr; /* Pointers to max. source and destination offset locations */
+ hsize_t *dst_off_ptr, *src_off_ptr; /* Pointers to source and destination offset arrays */
+ size_t *dst_len_ptr, *src_len_ptr; /* Pointers to source and destination length arrays */
+ hsize_t tmp_dst_off, tmp_src_off; /* Temporary source and destination offset values */
+ size_t tmp_dst_len, tmp_src_len; /* Temporary source and destination length values */
+ size_t acc_len; /* Accumulated length of sequences */
+ ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */
+
+ FUNC_ENTER_NOAPI(H5V_opvv, FAIL)
+
+ /* Sanity check */
+ HDassert(dst_curr_seq);
+ HDassert(*dst_curr_seq < dst_max_nseq);
+ HDassert(dst_len_arr);
+ HDassert(dst_off_arr);
+ HDassert(src_curr_seq);
+ HDassert(*src_curr_seq < src_max_nseq);
+ HDassert(src_len_arr);
+ HDassert(src_off_arr);
+ HDassert(op);
+
+ /* Set initial offset & length pointers */
+ dst_len_ptr = dst_len_arr + *dst_curr_seq;
+ dst_off_ptr = dst_off_arr + *dst_curr_seq;
+ src_len_ptr = src_len_arr + *src_curr_seq;
+ src_off_ptr = src_off_arr + *src_curr_seq;
+
+ /* Get temporary source & destination sequence offsets & lengths */
+ tmp_dst_len = *dst_len_ptr;
+ tmp_dst_off = *dst_off_ptr;
+ tmp_src_len = *src_len_ptr;
+ tmp_src_off = *src_off_ptr;
+
+ /* Compute maximum offset pointer values */
+ max_dst_off_ptr = dst_off_arr + dst_max_nseq;
+ max_src_off_ptr = src_off_arr + src_max_nseq;
+
+/* Work through the sequences */
+/* (Choose smallest sequence available initially) */
+
+ /* Source sequence is less than destination sequence */
+ if(tmp_src_len < tmp_dst_len) {
+src_smaller:
+ acc_len = 0;
+ do {
+ /* Make operator callback */
+ if((*op)(tmp_dst_off, tmp_src_off, tmp_src_len, op_data) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation")
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_src_len;
+
+ /* Update destination length */
+ tmp_dst_off += tmp_src_len;
+ tmp_dst_len -= tmp_src_len;
+
+ /* Advance source offset & check for being finished */
+ src_off_ptr++;
+ if(src_off_ptr >= max_src_off_ptr) {
+ /* Roll accumulated changes into appropriate counters */
+ *dst_off_ptr = tmp_dst_off;
+ *dst_len_ptr = tmp_dst_len;
+
+ /* Done with sequences */
+ goto finished;
+ } /* end if */
+ tmp_src_off = *src_off_ptr;
+
+ /* Update source information */
+ src_len_ptr++;
+ tmp_src_len = *src_len_ptr;
+ } while(tmp_src_len < tmp_dst_len);
+
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Transition to next state */
+ if(tmp_dst_len < tmp_src_len)
+ goto dst_smaller;
+ else
+ goto equal;
+ } /* end if */
+ /* Destination sequence is less than source sequence */
+ else if(tmp_dst_len < tmp_src_len) {
+dst_smaller:
+ acc_len = 0;
+ do {
+ /* Make operator callback */
+ if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation")
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_dst_len;
+
+ /* Update source length */
+ tmp_src_off += tmp_dst_len;
+ tmp_src_len -= tmp_dst_len;
+
+ /* Advance destination offset & check for being finished */
+ dst_off_ptr++;
+ if(dst_off_ptr >= max_dst_off_ptr) {
+ /* Roll accumulated changes into appropriate counters */
+ *src_off_ptr = tmp_src_off;
+ *src_len_ptr = tmp_src_len;
+
+ /* Done with sequences */
+ goto finished;
+ } /* end if */
+ tmp_dst_off = *dst_off_ptr;
+
+ /* Update destination information */
+ dst_len_ptr++;
+ tmp_dst_len = *dst_len_ptr;
+ } while(tmp_dst_len < tmp_src_len);
+
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Transition to next state */
+ if(tmp_src_len < tmp_dst_len)
+ goto src_smaller;
+ else
+ goto equal;
+ } /* end else-if */
+ /* Destination sequence and source sequence are same length */
+ else {
+equal:
+ acc_len = 0;
+ do {
+ /* Make operator callback */
+ if((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation")
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_dst_len;
+
+ /* Advance source & destination offset & check for being finished */
+ src_off_ptr++;
+ dst_off_ptr++;
+ if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr)
+ /* Done with sequences */
+ goto finished;
+ tmp_src_off = *src_off_ptr;
+ tmp_dst_off = *dst_off_ptr;
+
+ /* Update source information */
+ src_len_ptr++;
+ tmp_src_len = *src_len_ptr;
+
+ /* Update destination information */
+ dst_len_ptr++;
+ tmp_dst_len = *dst_len_ptr;
+ } while(tmp_dst_len == tmp_src_len);
+
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Transition to next state */
+ if(tmp_dst_len < tmp_src_len)
+ goto dst_smaller;
+ else
+ goto src_smaller;
+ } /* end else */
+
+finished:
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Update current sequence vectors */
+ *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr);
+ *src_curr_seq = (size_t)(src_off_ptr - src_off_arr);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5V_opvv() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5V_memcpyvv
*
* Purpose: Given source and destination buffers in memory (SRC & DST)
@@ -1368,13 +1579,14 @@ H5V_unswizzle_coords(hsize_t *coords, unsigned unlim_dim)
* destination sequences, data copying stops when either the
* source or destination buffer runs out of sequence information.
*
+ * Note: The algorithm in this routine is [basically] the same as for
+ * H5V_opvv(). Changes should be made to both!
+ *
* Return: Non-negative # of bytes copied on success/Negative on failure
*
* Programmer: Quincey Koziol
* Friday, May 2, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
ssize_t
@@ -1385,64 +1597,181 @@ H5V_memcpyvv(void *_dst,
{
unsigned char *dst; /* Destination buffer pointer */
const unsigned char *src; /* Source buffer pointer */
- size_t total_size=0; /* Total size of sequence in bytes */
- size_t size; /* Size of sequence in bytes */
- size_t u,v; /* Local index variables */
- ssize_t ret_value; /* Return value */
+ hsize_t *max_dst_off_ptr, *max_src_off_ptr; /* Pointers to max. source and destination offset locations */
+ hsize_t *dst_off_ptr, *src_off_ptr; /* Pointers to source and destination offset arrays */
+ size_t *dst_len_ptr, *src_len_ptr; /* Pointers to source and destination length arrays */
+ size_t tmp_dst_len; /* Temporary dest. length value */
+ size_t tmp_src_len; /* Temporary source length value */
+ size_t acc_len; /* Accumulated length of sequences */
+ ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */
FUNC_ENTER_NOAPI_NOFUNC(H5V_memcpyvv)
/* Sanity check */
- assert(_dst);
- assert(dst_curr_seq);
- assert(*dst_curr_seq<dst_max_nseq);
- assert(dst_len_arr);
- assert(dst_off_arr);
- assert(_src);
- assert(src_curr_seq);
- assert(*src_curr_seq<src_max_nseq);
- assert(src_len_arr);
- assert(src_off_arr);
-
- /* Work through all the sequences */
- for(u=*dst_curr_seq, v=*src_curr_seq; u<dst_max_nseq && v<src_max_nseq; ) {
- /* Choose smallest buffer to write */
- if(src_len_arr[v]<dst_len_arr[u])
- size=src_len_arr[v];
- else
- size=dst_len_arr[u];
+ HDassert(_dst);
+ HDassert(dst_curr_seq);
+ HDassert(*dst_curr_seq < dst_max_nseq);
+ HDassert(dst_len_arr);
+ HDassert(dst_off_arr);
+ HDassert(_src);
+ HDassert(src_curr_seq);
+ HDassert(*src_curr_seq < src_max_nseq);
+ HDassert(src_len_arr);
+ HDassert(src_off_arr);
+
+ /* Set initial offset & length pointers */
+ dst_len_ptr = dst_len_arr + *dst_curr_seq;
+ dst_off_ptr = dst_off_arr + *dst_curr_seq;
+ src_len_ptr = src_len_arr + *src_curr_seq;
+ src_off_ptr = src_off_arr + *src_curr_seq;
+
+ /* Get temporary source & destination sequence lengths */
+ tmp_dst_len = *dst_len_ptr;
+ tmp_src_len = *src_len_ptr;
+
+ /* Compute maximum offset pointer values */
+ max_dst_off_ptr = dst_off_arr + dst_max_nseq;
+ max_src_off_ptr = src_off_arr + src_max_nseq;
+
+ /* Compute buffer offsets */
+ dst = (unsigned char *)_dst + *dst_off_ptr;
+ src = (const unsigned char *)_src + *src_off_ptr;
+
+/* Work through the sequences */
+/* (Choose smallest sequence available initially) */
+
+ /* Source sequence is less than destination sequence */
+ if(tmp_src_len < tmp_dst_len) {
+src_smaller:
+ acc_len = 0;
+ do {
+ /* Copy data */
+ HDmemcpy(dst, src, tmp_src_len);
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_src_len;
+
+ /* Update destination length */
+ tmp_dst_len -= tmp_src_len;
+
+ /* Advance source offset & check for being finished */
+ src_off_ptr++;
+ if(src_off_ptr >= max_src_off_ptr) {
+ /* Roll accumulated changes into appropriate counters */
+ *dst_off_ptr += acc_len;
+ *dst_len_ptr = tmp_dst_len;
+
+ /* Done with sequences */
+ goto finished;
+ } /* end if */
- /* Compute offset on disk */
- dst=(unsigned char *)_dst+dst_off_arr[u];
+ /* Update destination pointer */
+ dst += tmp_src_len;
- /* Compute offset in memory */
- src=(const unsigned char *)_src+src_off_arr[v];
+ /* Update source information */
+ src_len_ptr++;
+ tmp_src_len = *src_len_ptr;
+ src = (const unsigned char *)_src + *src_off_ptr;
+ } while(tmp_src_len < tmp_dst_len);
- /* Copy data */
- HDmemcpy(dst,src,size);
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
- /* Update source information */
- src_len_arr[v]-=size;
- src_off_arr[v]+=size;
- if(src_len_arr[v]==0)
- v++;
+ /* Transition to next state */
+ if(tmp_dst_len < tmp_src_len)
+ goto dst_smaller;
+ else
+ goto equal;
+ } /* end if */
+ /* Destination sequence is less than source sequence */
+ else if(tmp_dst_len < tmp_src_len) {
+dst_smaller:
+ acc_len = 0;
+ do {
+ /* Copy data */
+ HDmemcpy(dst, src, tmp_dst_len);
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_dst_len;
+
+ /* Update source length */
+ tmp_src_len -= tmp_dst_len;
+
+ /* Advance destination offset & check for being finished */
+ dst_off_ptr++;
+ if(dst_off_ptr >= max_dst_off_ptr) {
+ /* Roll accumulated changes into appropriate counters */
+ *src_off_ptr += acc_len;
+ *src_len_ptr = tmp_src_len;
+
+ /* Done with sequences */
+ goto finished;
+ } /* end if */
- /* Update destination information */
- dst_len_arr[u]-=size;
- dst_off_arr[u]+=size;
- if(dst_len_arr[u]==0)
- u++;
+ /* Update source pointer */
+ src += tmp_dst_len;
- /* Increment number of bytes copied */
- total_size+=size;
- } /* end for */
+ /* Update destination information */
+ dst_len_ptr++;
+ tmp_dst_len = *dst_len_ptr;
+ dst = (unsigned char *)_dst + *dst_off_ptr;
+ } while(tmp_dst_len < tmp_src_len);
- /* Update current sequence vectors */
- *dst_curr_seq=u;
- *src_curr_seq=v;
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
- /* Set return value */
- H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t);
+ /* Transition to next state */
+ if(tmp_src_len < tmp_dst_len)
+ goto src_smaller;
+ else
+ goto equal;
+ } /* end else-if */
+ /* Destination sequence and source sequence are same length */
+ else {
+equal:
+ acc_len = 0;
+ do {
+ /* Copy data */
+ HDmemcpy(dst, src, tmp_dst_len);
+
+ /* Accumulate number of bytes copied */
+ acc_len += tmp_dst_len;
+
+ /* Advance source & destination offset & check for being finished */
+ src_off_ptr++;
+ dst_off_ptr++;
+ if(src_off_ptr >= max_src_off_ptr || dst_off_ptr >= max_dst_off_ptr)
+ /* Done with sequences */
+ goto finished;
+
+ /* Update source information */
+ src_len_ptr++;
+ tmp_src_len = *src_len_ptr;
+ src = (const unsigned char *)_src + *src_off_ptr;
+
+ /* Update destination information */
+ dst_len_ptr++;
+ tmp_dst_len = *dst_len_ptr;
+ dst = (unsigned char *)_dst + *dst_off_ptr;
+ } while(tmp_dst_len == tmp_src_len);
+
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Transition to next state */
+ if(tmp_dst_len < tmp_src_len)
+ goto dst_smaller;
+ else
+ goto src_smaller;
+ } /* end else */
+
+finished:
+ /* Roll accumulated sequence lengths into return value */
+ ret_value += (ssize_t)acc_len;
+
+ /* Update current sequence vectors */
+ *dst_curr_seq = (size_t)(dst_off_ptr - dst_off_arr);
+ *src_curr_seq = (size_t)(src_off_ptr - src_off_arr);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5V_memcpyvv() */
diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h
index faa2505..18630d6 100644
--- a/src/H5Vprivate.h
+++ b/src/H5Vprivate.h
@@ -24,6 +24,10 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+/* Vector-Vector sequence operation callback */
+typedef herr_t (*H5V_opvv_func_t)(hsize_t dst_off, hsize_t src_off,
+ size_t len, void *udata);
+
/* Vector comparison functions like Fortran66 comparison operators */
#define H5V_vector_eq_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)==0)
#define H5V_vector_lt_s(N,V1,V2) (H5V_vector_cmp_s (N, V1, V2)<0)
@@ -83,7 +87,7 @@ H5_DLL hsize_t H5V_array_offset_pre(unsigned n,
const hsize_t *acc, const hsize_t *offset);
H5_DLL hsize_t H5V_array_offset(unsigned n, const hsize_t *total_size,
const hsize_t *offset);
-H5_DLL herr_t H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *total_size,
+H5_DLL herr_t H5V_array_calc_pre(hsize_t offset, unsigned n,
const hsize_t *down, hsize_t *coords);
H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n,
const hsize_t *total_size, hsize_t *coords);
@@ -91,6 +95,11 @@ H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hsize_t *coord,
const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx);
H5_DLL void H5V_swizzle_coords(hsize_t *coords, unsigned unlim_dim);
H5_DLL void H5V_unswizzle_coords(hsize_t *coords, unsigned unlim_dim);
+H5_DLL ssize_t H5V_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[],
+ hsize_t dst_off_arr[],
+ size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[],
+ hsize_t src_off_arr[],
+ H5V_opvv_func_t op, void *op_data);
H5_DLL ssize_t H5V_memcpyvv(void *_dst,
size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[],
const void *_src,
diff --git a/src/H5private.h b/src/H5private.h
index d506a59..f13ad84 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -145,12 +145,12 @@
#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */
#ifdef H5_HAVE_WINSOCK_H
#include <winsock2.h>
#endif
-#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */
#include <windows.h>
#include <direct.h> /* For _getcwd() */
diff --git a/src/H5public.h b/src/H5public.h
index c92e628..4fc8c7e 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -75,10 +75,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 9 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 75 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 76 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "FA_a5" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.9.75-FA_a5" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.9.76-FA_a5" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/Makefile.in b/src/Makefile.in
index fddf135..d668dc0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -425,14 +425,24 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la
LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la
LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la
+# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below
+# has been removed. According to the official description of DESTDIR by Gnu at
+# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is
+# prepended to the normal and complete install path that it precedes for the
+# purpose of installing in a temporary directory which is useful for building
+# rpms and other packages. The '/' after ${DESTDIR} will be followed by another
+# '/' at the beginning of the normal install path. When DESTDIR is empty the
+# path then begins with '//', which is incorrect and causes problems at least for
+# Cygwin.
+
# Scripts used to build examples
# If only shared libraries have been installed, have h5cc build examples with
# shared libraries instead of static libraries
-H5CC = $(bindir)/h5cc
-H5CC_PP = $(bindir)/h5pcc
-H5FC = $(bindir)/h5fc
-H5FC_PP = $(bindir)/h5pfc
-H5CPP = $(bindir)/h5c++
+H5CC = ${DESTDIR}$(bindir)/h5cc
+H5CC_PP = ${DESTDIR}$(bindir)/h5pcc
+H5FC = ${DESTDIR}$(bindir)/h5fc
+H5FC_PP = ${DESTDIR}$(bindir)/h5pfc
+H5CPP = ${DESTDIR}$(bindir)/h5c++
ACLOCAL_AMFLAGS = "-I m4"
# The trace script; this is used on source files from the C library to
@@ -447,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 65
+LT_VERS_REVISION = 66
LT_VERS_AGE = 0
H5detect_CFLAGS = -g $(AM_CFLAGS)