diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/H5.c | 9 | ||||
-rw-r--r-- | src/H5C.c | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 137 | ||||
-rw-r--r-- | src/H5Dcontig.c | 973 | ||||
-rw-r--r-- | src/H5Defl.c | 212 | ||||
-rw-r--r-- | src/H5Dpkg.h | 8 | ||||
-rw-r--r-- | src/H5E.c | 3 | ||||
-rw-r--r-- | src/H5Faccum.c | 15 | ||||
-rw-r--r-- | src/H5Shyper.c | 991 | ||||
-rw-r--r-- | src/H5V.c | 403 | ||||
-rw-r--r-- | src/H5Vprivate.h | 11 | ||||
-rw-r--r-- | src/H5public.h | 4 | ||||
-rw-r--r-- | src/Makefile.in | 22 |
14 files changed, 1631 insertions, 1163 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f40dda..3330b8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -557,10 +557,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 @@ -214,7 +214,7 @@ H5_term_library(void) int pending, ntries = 0, n; size_t at = 0; char loop[1024]; - H5E_auto_t func; + H5E_auto2_t func; #ifdef H5_HAVE_THREADSAFE /* explicit locking of the API */ @@ -227,11 +227,8 @@ H5_term_library(void) goto done; /* Check if we should display error output */ -#ifdef H5_USE_16_API_DEFAULT - (void)H5Eget_auto(&func, NULL); -#else - (void)H5Eget_auto(H5E_DEFAULT, &func, NULL); -#endif + (void)H5Eget_auto2(H5E_DEFAULT, &func, NULL); + /* * Terminate each interface. The termination functions return a positive * value if they do something that might affect some other interface in a @@ -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 1511515..910497b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -161,6 +161,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 */ @@ -4928,6 +4935,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 @@ -4949,80 +5005,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 */ - size_t u, v; /* Local index variables */ - ssize_t ret_value = 0; /* 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 */ - - /* 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]; + HDassert(mem_off_arr); - /* 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") + /* 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; - /* 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; - if(chunk_len_arr[v] == 0) - v++; - else - chunk_offset_arr[v] += size; - - /* Update destination information */ - mem_len_arr[u] -= size; - if(mem_len_arr[u] == 0) - u++; - else - mem_offset_arr[u] += size; - - /* Increment number of bytes copied */ - ret_value += (ssize_t)size; - } /* end for */ - - /* Update current sequence vectors */ - *mem_curr_seq = u; - *chunk_curr_seq = v; + /* 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 78c07e6..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,572 +640,591 @@ 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 size; /* Size of sequence in bytes */ - size_t u, v; /* Counting variables */ - ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */ - - 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 */ + 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 */ - /* Check args */ - HDassert(io_info); - HDassert(io_info->dset); - HDassert(io_info->store); - HDassert(buf); + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_readvv_sieve_cb) - /* 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; + /* 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 */ + + /* 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; - - /* 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); + /* 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") - /* 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_FILE, H5E_CANTOPENFILE, 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_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") - /* Only need this when resizing sieve buffer */ - 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 */ - /* 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, io_info->dxpl_id, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_IO, 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, udata->dxpl_id, dset_contig->sieve_buf) < 0) + HGOTO_ERROR(H5E_DATASET, 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; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; - - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; - - /* Increment number of bytes copied */ - ret_value += (ssize_t)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; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_contig_readvv_sieve_cb() */ - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; + +/*------------------------------------------------------------------------- + * 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 */ - /* Increment number of bytes copied */ - ret_value += (ssize_t)size; - } /* end for */ - } /* end else */ + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_readvv_cb) - /* Update current sequence vectors */ - *dset_curr_seq = u; - *mem_curr_seq = v; + /* 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 size; /* Size of sequence in bytes */ - size_t u, v; /* Counting variables */ - ssize_t ret_value = 0; /* Return value (Size of sequence in bytes) */ + 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) { + 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 */ + + /* 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 */ + + /* 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 = TRUE; + + /* 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") - /* 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]; + /* Reset sieve buffer dirty flag */ + dset_contig->sieve_dirty = FALSE; + } /* end if */ - /* Compute offset on disk */ - addr = store_contig->dset_addr + dset_offset_arr[u]; + /* 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; - /* Compute offset in memory */ - buf = (const unsigned char *)io_info->u.wbuf + mem_offset_arr[v]; + } /* end if */ + /* Append to existing sieve buffer */ + else { + /* Copy in new information */ + HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, len); + } /* end else */ - /* 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(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") + /* 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; /* 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 */ + /* 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); - /* 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; - - /* 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; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_contig_writevv_sieve_cb() */ - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; + +/*------------------------------------------------------------------------- + * 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 */ - /* Increment number of bytes copied */ - ret_value += (ssize_t)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]; + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_writevv_cb) - /* Compute offset on disk */ - addr = store_contig->dset_addr + dset_offset_arr[u]; + /* 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") - /* Compute offset in memory */ - buf = (const unsigned char *)io_info->u.wbuf + mem_offset_arr[v]; +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end 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") + +/*------------------------------------------------------------------------- + * 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) */ - /* Update memory information */ - mem_len_arr[v] -= size; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; + FUNC_ENTER_NOAPI_NOINIT(H5D_contig_writevv) - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; + /* 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); - /* Increment number of bytes copied */ - ret_value += (ssize_t)size; - } /* end for */ + /* 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 */ - /* Update current sequence vectors */ - *dset_curr_seq = u; - *mem_curr_seq = v; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_writevv() */ diff --git a/src/H5Defl.c b/src/H5Defl.c index 87471f1..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,65 +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 size; /* Size of sequence in bytes */ - size_t u, v; /* Counting variables */ - ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */ + 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; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; - - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; - - /* Increment number of bytes copied */ - ret_value += (ssize_t)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 */ + + FUNC_ENTER_NOAPI_NOINIT(H5D_efl_writevv_cb) - /* Update current sequence vectors */ - *dset_curr_seq = u; - *mem_curr_seq = v; + /* 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() */ /*------------------------------------------------------------------------- @@ -492,62 +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 size; /* Size of sequence in bytes */ - size_t u, v; /* Counting variables */ - ssize_t ret_value = 0; /* Return value (Total size of sequence in bytes) */ + 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; - if(mem_len_arr[v] == 0) - v++; - else - mem_offset_arr[v] += size; - - /* Update file information */ - dset_len_arr[u] -= size; - if(dset_len_arr[u] == 0) - u++; - else - dset_offset_arr[u] += size; - - /* Increment number of bytes copied */ - ret_value += (ssize_t)size; - } /* end for */ - - /* Update current sequence vectors */ - *dset_curr_seq = u; - *mem_curr_seq = v; - + 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/H5Dpkg.h b/src/H5Dpkg.h index 34bf1da..96acc58 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -394,7 +394,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; /* @@ -583,12 +583,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); @@ -173,7 +173,8 @@ H5E_set_default_auto(H5E_t *stk) #ifndef H5_NO_DEPRECATED_SYMBOLS #ifdef H5_USE_16_API_DEFAULT stk->auto_op.vers = 1; -#else /* H5_USE_16_API_DEFAULT */ + stk->auto_op.u.func1 = (H5E_auto1_t)H5Eprint1; +#else /* H5_USE_16_API */ stk->auto_op.vers = 2; #endif /* H5_USE_16_API_DEFAULT */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 2fc53ea..600c3f3 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -312,12 +312,6 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, accum->dirty = FALSE; } /* end if */ - /* Move remnant of accumulator down */ - HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); - - /* Adjust accumulator's location */ - accum->loc += shrink_size; - /* Adjust dirty region tracking info */ accum->dirty_off -= shrink_size; } /* end else */ @@ -325,6 +319,15 @@ H5F_accum_adjust(H5F_meta_accum_t *accum, H5FD_t *lf, hid_t dxpl_id, /* Trim the accumulator's use of its buffer */ accum->size = remnant_size; + + /* When appending, need to adjust location of accumulator */ + if(H5F_ACCUM_APPEND == adjust) { + /* Move remnant of accumulator down */ + HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); + + /* Adjust accumulator's location */ + accum->loc += shrink_size; + } /* end if */ } /* end if */ /* Check for accumulator needing to be reallocated */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 1f56737..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 */ @@ -8420,18 +8417,16 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, 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 skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */ 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 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 */ - int temp_dim; /* Temporary rank holder */ + unsigned skip_dim; /* Rank of the dimension to skip along */ unsigned u; /* Local index variable */ int i; /* Local index variable */ @@ -8454,7 +8449,6 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, 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; - fast_dim = ndims - 1; /* Set the local copy of the selection offset */ sel_off = iter->u.hyp.sel_off; @@ -8465,7 +8459,6 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, else { /* Set the aliases for a few important dimension ranks */ ndims = space->extent.rank; - fast_dim = ndims - 1; /* Set the local copy of the selection offset */ sel_off = space->select.offset; @@ -8473,6 +8466,7 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, /* Set up the pointer to the size of the memory space */ mem_size = space->extent.size; } /* end else */ + fast_dim = ndims - 1; /* initialize row sizes for each dimension */ elem_size = iter->elmt_size; @@ -8481,10 +8475,6 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, acc *= mem_size[i]; } /* end for */ - /* Compute the amount to skip between sequences */ - for(u = 0; u < ndims; u++) - skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u]; - /* Copy the base location of the block */ /* (Add in the selection offset) */ for(u = 0; u < ndims; u++) @@ -8518,16 +8508,11 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, /* Check for blocks to operate on */ if(tot_blk_count > 0) { - hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */ size_t actual_bytes; /* The actual number of bytes to copy */ /* Set the number of actual bytes */ actual_bytes = actual_elem * elem_size; - /* Set the starting block location */ - for(u = 0; u < ndims; u++) - tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start; - /* Check for 1-dim selection */ if(0 == fast_dim) { /* Sanity checks */ @@ -8539,53 +8524,101 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, *len++ = actual_bytes; } /* end if */ else { - /* 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)fast_dim - 1; + 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 offset in destination buffer */ - loc += slab[temp_dim]; + /* 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 */ - /* 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]++; + /* Set the starting block location */ + for(u = 0; u < ndims; u++) + tmp_block[u] = iter->u.hyp.off[u] - tdiminfo[u].start; - /* 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 */ + /* Compute the amount to skip between sequences */ + for(u = 0; u < ndims; u++) + skip[u] = (mem_size[u] - tdiminfo[u].block) * slab[u]; - /* Decrement dimension count */ - temp_dim--; - } /* end while */ + /* 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; - /* Decrement block count */ - blk_count--; - } /* end while */ + /* Set temporary dimension for advancing offsets */ + temp_dim = (int)skip_dim; + + /* 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 */ - /* 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 -= 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 */ + /* Increment the number of sequences generated */ *nseq += tot_blk_count; @@ -8619,6 +8652,10 @@ H5S_hyper_get_seq_list_single(const H5S_t *space, H5S_sel_iter_t *iter, *nelem += elmt_remainder; } /* end if */ + /* Sanity check */ + HDassert(*nseq > 0); + HDassert(*nelem > 0); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S_hyper_get_seq_list_single() */ @@ -8666,6 +8703,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t /* Check args */ HDassert(space); HDassert(iter); + HDassert(iter->elmt_left > 0); HDassert(maxseq > 0); HDassert(maxelem > 0); HDassert(nseq); @@ -8690,7 +8728,6 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t 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; - fast_dim = ndims - 1; /* Set the local copy of the selection offset */ sel_off = iter->u.hyp.sel_off; @@ -8701,7 +8738,6 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t else { /* Set the aliases for a few important dimension ranks */ ndims = space->extent.rank; - fast_dim = ndims - 1; /* Set the local copy of the selection offset */ sel_off = space->select.offset; @@ -8709,6 +8745,7 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t /* 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 || @@ -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 @@ -1149,9 +1155,9 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5V_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *total_size, - const hsize_t *down, hsize_t *coords) +static herr_t +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: @@ -1287,6 +1292,212 @@ H5V_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, /*------------------------------------------------------------------------- + * 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) @@ -1299,6 +1510,9 @@ H5V_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, * 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 @@ -1314,8 +1528,12 @@ H5V_memcpyvv(void *_dst, { unsigned char *dst; /* Destination buffer pointer */ const unsigned char *src; /* Source buffer pointer */ - size_t size; /* Size of sequence in bytes */ - size_t u,v; /* Local index variables */ + 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) @@ -1332,44 +1550,159 @@ H5V_memcpyvv(void *_dst, HDassert(src_len_arr); HDassert(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]; + /* 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; - if(0 == src_len_arr[v]) - v++; + /* Transition to next state */ + if(tmp_dst_len < tmp_src_len) + goto dst_smaller; else - src_off_arr[v] += size; + 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 source pointer */ + src += tmp_dst_len; + + /* 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 destination information */ - dst_len_arr[u] -= size; - if(0 == dst_len_arr[u]) - u++; + /* 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 { + /* 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 - dst_off_arr[u] += size; + goto src_smaller; + } /* end else */ - /* Increment number of bytes copied */ - ret_value += (ssize_t)size; - } /* end for */ +finished: + /* Roll accumulated sequence lengths into return value */ + ret_value += (ssize_t)acc_len; /* Update current sequence vectors */ - *dst_curr_seq = u; - *src_curr_seq = v; + *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 e351f86..382263f 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,12 +87,15 @@ 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, - 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); 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 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/H5public.h b/src/H5public.h index df2ce6f..e94b758 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 77 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.75" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.77" /* 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 5037064..48f1878 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -423,14 +423,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 @@ -445,7 +455,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 = 67 LT_VERS_AGE = 0 H5detect_CFLAGS = -g $(AM_CFLAGS) |