[svn-r3252] Purpose:

Code cleanup.
Description:
    Fixed _lots_ (I mean _tons_) of warnings spit out by the gcc with the
    extra warnings.  Including a few show-stoppers for compression on IRIX
    machines.
Solution:
    Changed lots of variables' types to more sensible and consistent types,
    more range-checking, more variable typecasts, etc.
Platforms tested:
    FreeBSD 4.2 (hawkwind), IRIX64-64 (modi4)
This commit is contained in:
Quincey Koziol 2001-01-09 16:22:30 -05:00
parent 1290c4808d
commit 35bc545296
88 changed files with 4735 additions and 4428 deletions

156
src/.indent.pro vendored
View File

@ -1 +1,155 @@
-bap -sob -l78 -br -ce -cli0 -ss -npcs -di24 -nbc -nfca -psl -i4 -lp -lps -T uint8 -T int8 -T uint16 -T int16 -T uint32 -T int32 -T intn -T uintn -T float32 -T float64 -T H5AC_class_t -T H5AC_prot_t -T H5AC_slot_t -T H5AC_subid_t -T H5AC_t -T H5A_t -T H5Asearch_func_t -T H5B_class_t -T H5B_ins_t -T H5B_key_t -T H5B_subid_t -T H5B_t -T H5C_class_t -T H5C_t -T H5D_create_t -T H5D_layout_t -T H5D_t -T H5D_xfer_t -T H5E_error_t -T H5E_major_mesg_t -T H5E_major_t -T H5E_minor_mesg_t -T H5E_minor_t -T H5E_t -T H5F_create_t -T H5F_file_t -T H5F_isop_t -T H5F_istore_key_t -T H5F_istore_ud1_t -T H5F_low_class_t -T H5F_low_t -T H5F_search_t -T H5F_t -T H5Fget_create_t -T H5G_bt_ud1_t -T H5G_bt_ud2_t -T H5G_cache_t -T H5G_cwgstk_t -T H5G_entry_t -T H5G_node_key_t -T H5G_node_t -T H5G_t -T H5G_type_t -T H5H_free_t -T H5H_t -T H5H_type_t -T H5M_find_t -T H5O_chunk_t -T H5O_class_t -T H5O_cont_t -T H5O_efl_t -T H5O_layout_t -T H5O_mesg_t -T H5O_name_t -T H5O_stab_t -T H5O_t -T H5P_class_t -T H5P_simple_t -T H5P_t -T H5T_class_t -T H5T_conv_t -T H5T_cset_t -T H5T_member_t -T H5T_norm_t -T H5T_order_t -T H5T_pad_t -T H5T_path_t -T H5T_sign_t -T H5T_soft_t -T H5T_str_t -T H5T_t -T H5Tget_member_t -T H5_exit_t -T H5_init_t -T H5_t -T H5_term_t -T access_t -T atom_group_t -T atom_info_t -T cache_t -T child_t -T chunk_t -T create_t -T data_t -T detected_t -T group_t -T haddr_t -T hbool_t -T heap_t -T herr_t -T hid_t -T hobjtype_t -T ino_t -T mem_t -T memb_t -T mesg_t -T message_t -T meta_func_t -T new_t -T off_t -T size_t -T ssize_t -T time_t
-bad /* Blank line after declarations */
-bap /* Blank line after procedure */
-bbb /* No blank line before boxed comments */
-sob /* Swallow optional blank lines */
-nfca /* Don't format comments on their own line */
-d0 /* Align comments on their own line with the surrounding code */
-c33 /* Start comments after code in column 33 */
-cd33 /* Start comments after declarations in column 33 */
-cp0 /* Start comments after pre-processor directives immediately after the directive */
-ncdb /* Don't put comment delimiters on their own lines */
-sc /* Put stars at the beginning of multi-line comments */
-br /* Put braces on the same line as the statement */
-ce /* "Cuddle" else statements onto the same line as the closing if statement's brace */
-cdw /* "Cuddle" while statements onto the same line as the closing do statement's brace */
-cli4 /* Indent case statements 4 spaces to right of switch statement */
-cbi0 /* Indent braces below a case statement 0 spaces to right of case statement */
-ss /* Put a space before the semicolon if its the only statement in a for or while loop */
-npcs /* Don't put a space between the procedure name and it's parameters */
-ncs /* Don't put a space between a cast operator and it's object */
-nbs /* Don't put a space between a sizeof operator and it's object */
-nsaf /* Don't put a space between a for statement and it's initial parentheses */
-nsai /* Don't put a space between an if statement and it's initial parentheses */
-nsaw /* Don't put a space between a while statement and it's initial parentheses */
-nprs /* Don't add spaces around parentheses */
-di24 /* Align identifiers in declarations in column 24 */
-nbc /* Don't force newlines after commas in declarations */
-nbfda /* Don't force newlines after commas in function argument declarations */
-psl /* Force the return type of a procedure to be on it's own line */
-brs /* Put braces for struct definitions on the same line as the struct keyword */
-i4 /* Indent space spaces */
-nlp /* Don't align lines continued onto further lines with the opening parentheses */
-ci8 /* Align continued code 8 spaces from initial indention */
-ip4 /* Don't add any extra indention for nested parentheses */
-lps /* Leave spaces in preprocessor directives alone */
-l78 /* Try to break long lines in column 78 */
-bbo /* Try to break long lines at boolean operators && and || */
-hnl /* Honor existing new-lines in long boolen statements */
-pmt /* Preserve modification times on modified files */
/* The rest are typedefs used by the library, feel free to add missing ones, */
/* but try to keep them alphabetized */
-T uint8
-T int8
-T uint16
-T int16
-T uint32
-T int32
-T intn
-T uintn
-T float32
-T float64
-T H5AC_class_t
-T H5AC_prot_t
-T H5AC_slot_t
-T H5AC_subid_t
-T H5AC_t
-T H5A_t
-T H5Asearch_func_t
-T H5B_class_t
-T H5B_ins_t
-T H5B_key_t
-T H5B_subid_t
-T H5B_t
-T H5C_class_t
-T H5C_t
-T H5D_create_t
-T H5D_layout_t
-T H5D_t
-T H5D_xfer_t
-T H5E_error_t
-T H5E_major_mesg_t
-T H5E_major_t
-T H5E_minor_mesg_t
-T H5E_minor_t
-T H5E_t
-T H5F_create_t
-T H5F_file_t
-T H5F_isop_t
-T H5F_istore_key_t
-T H5F_istore_ud1_t
-T H5F_low_class_t
-T H5F_low_t
-T H5F_search_t
-T H5F_t
-T H5Fget_create_t
-T H5G_bt_ud1_t
-T H5G_bt_ud2_t
-T H5G_cache_t
-T H5G_cwgstk_t
-T H5G_entry_t
-T H5G_node_key_t
-T H5G_node_t
-T H5G_t
-T H5G_type_t
-T H5H_free_t
-T H5H_t
-T H5H_type_t
-T H5M_find_t
-T H5O_chunk_t
-T H5O_class_t
-T H5O_cont_t
-T H5O_efl_t
-T H5O_layout_t
-T H5O_mesg_t
-T H5O_name_t
-T H5O_stab_t
-T H5O_t
-T H5P_class_t
-T H5P_simple_t
-T H5P_t
-T H5T_class_t
-T H5T_conv_t
-T H5T_cset_t
-T H5T_member_t
-T H5T_norm_t
-T H5T_order_t
-T H5T_pad_t
-T H5T_path_t
-T H5T_sign_t
-T H5T_soft_t
-T H5T_str_t
-T H5T_t
-T H5Tget_member_t
-T H5_exit_t
-T H5_init_t
-T H5_t
-T H5_term_t
-T access_t
-T atom_group_t
-T atom_info_t
-T cache_t
-T child_t
-T chunk_t
-T create_t
-T data_t
-T detected_t
-T group_t
-T haddr_t
-T hbool_t
-T heap_t
-T herr_t
-T hid_t
-T hobjtype_t
-T hsize_t
-T hssize_t
-T ino_t
-T mem_t
-T memb_t
-T mesg_t
-T message_t
-T meta_func_t
-T new_t
-T off_t
-T size_t
-T ssize_t
-T time_t

View File

@ -512,7 +512,8 @@ H5A_open(H5G_entry_t *ent, unsigned idx)
assert(ent);
/* Read in attribute with H5O_read() */
if (NULL==(attr=H5O_read(ent, H5O_ATTR, idx, attr))) {
H5_CHECK_OVERFLOW(idx,unsigned,int);
if (NULL==(attr=H5O_read(ent, H5O_ATTR, (int)idx, attr))) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL,
"unable to load attribute info from dataset header");
}
@ -616,13 +617,13 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer */
uint8_t *bkg_buf = NULL; /* temp conversion buffer */
size_t nelmts; /* elements in attribute */
hsize_t nelmts; /* elements in attribute */
H5T_path_t *tpath = NULL; /* conversion information*/
hid_t src_id = -1, dst_id = -1;/* temporary type atoms */
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type*/
size_t buf_size; /* desired buffer size */
int idx; /* index of attribute in object header */
hsize_t buf_size; /* desired buffer size */
int idx; /* index of attribute in object header */
herr_t ret_value = FAIL;
FUNC_ENTER(H5A_write, FAIL);
@ -640,15 +641,16 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
/* Get the maximum buffer size needed and allocate it */
buf_size = nelmts*MAX(src_type_size,dst_type_size);
if (NULL==(tconv_buf = H5MM_malloc (buf_size)) ||
NULL==(bkg_buf = H5MM_malloc(buf_size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
assert(buf_size==(hsize_t)((size_t)buf_size)); /*check for overflow*/
if (NULL==(tconv_buf = H5MM_malloc ((size_t)buf_size)) ||
NULL==(bkg_buf = H5MM_calloc((size_t)buf_size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
HDmemset(bkg_buf, 0, buf_size);
/* Copy the user's data into the buffer for conversion */
HDmemcpy(tconv_buf,buf,src_type_size*nelmts);
assert((src_type_size*nelmts)==(hsize_t)((size_t)(src_type_size*nelmts))); /*check for overflow*/
HDmemcpy(tconv_buf,buf,(size_t)(src_type_size*nelmts));
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
@ -668,7 +670,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, void *buf)
/* Perform data type conversion */
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf,
H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
@ -698,7 +700,7 @@ done:
if (dst_id >= 0)
H5I_dec_ref(dst_id);
if (bkg_buf)
H5MM_xfree(bkg_buf);
H5MM_xfree(bkg_buf);
FUNC_LEAVE(ret_value);
} /* H5A_write() */
@ -778,12 +780,12 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
{
uint8_t *tconv_buf = NULL; /* data type conv buffer*/
uint8_t *bkg_buf = NULL; /* background buffer */
size_t nelmts; /* elements in attribute*/
hsize_t nelmts; /* elements in attribute*/
H5T_path_t *tpath = NULL; /* type conversion info */
hid_t src_id = -1, dst_id = -1;/* temporary type atoms*/
size_t src_type_size; /* size of source type */
size_t dst_type_size; /* size of destination type */
size_t buf_size; /* desired buffer size */
hsize_t buf_size; /* desired buffer size */
herr_t ret_value = FAIL;
FUNC_ENTER(H5A_read, FAIL);
@ -800,21 +802,23 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
dst_type_size = H5T_get_size(mem_type);
/* Check if the attribute has any data yet, if not, fill with zeroes */
assert((dst_type_size*nelmts)==(hsize_t)((size_t)(dst_type_size*nelmts))); /*check for overflow*/
if(attr->ent_opened && !attr->initialized) {
HDmemset(buf,0,dst_type_size*nelmts);
HDmemset(buf,0,(size_t)(dst_type_size*nelmts));
} /* end if */
else { /* Attribute exists and has a value */
/* Get the maximum buffer size needed and allocate it */
buf_size = nelmts*MAX(src_type_size,dst_type_size);
if (NULL==(tconv_buf = H5MM_malloc (buf_size)) ||
NULL==(bkg_buf = H5MM_malloc(buf_size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
assert(buf_size==(hsize_t)((size_t)buf_size)); /*check for overflow*/
if (NULL==(tconv_buf = H5MM_malloc ((size_t)buf_size)) ||
NULL==(bkg_buf = H5MM_calloc((size_t)buf_size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
HDmemset(bkg_buf, 0, buf_size);
/* Copy the attribute data into the buffer for conversion */
HDmemcpy(tconv_buf,attr->data,src_type_size*nelmts);
assert((src_type_size*nelmts)==(hsize_t)((size_t)(src_type_size*nelmts))); /*check for overflow*/
HDmemcpy(tconv_buf,attr->data,(size_t)(src_type_size*nelmts));
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
@ -824,22 +828,22 @@ H5A_read(H5A_t *attr, const H5T_t *mem_type, void *buf)
} else if (!H5T_IS_NOOP(tpath)) {
if ((src_id = H5I_register(H5I_DATATYPE,
H5T_copy(attr->dt, H5T_COPY_ALL)))<0 ||
(dst_id = H5I_register(H5I_DATATYPE,
(dst_id = H5I_register(H5I_DATATYPE,
H5T_copy(mem_type, H5T_COPY_ALL)))<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL,
"unable to register types for conversion");
}
}
/* Perform data type conversion. */
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf,
H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
/* Perform data type conversion. */
if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf,
H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL,
"data type conversion failed");
}
/* Copy the converted data into the user's buffer */
HDmemcpy(buf,tconv_buf,dst_type_size*nelmts);
HDmemcpy(buf,tconv_buf,(size_t)(dst_type_size*nelmts));
} /* end else */
ret_value=SUCCEED;

View File

@ -100,13 +100,13 @@ H5AC_create(H5F_t *f, intn size_hint)
"memory allocation failed");
}
cache->nslots = size_hint;
cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,cache->nslots,1);
cache->slot = H5FL_ARR_ALLOC(H5AC_info_ptr_t,(hsize_t)cache->nslots,1);
if (NULL==cache->slot) {
f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache);
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
}
#ifdef H5AC_DEBUG
if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,cache->nslots,1))==NULL) {
if ((cache->prot = H5FL_ARR_ALLOC(H5AC_prot_t,(hsize_t)cache->nslots,1))==NULL) {
cache->slot = H5FL_ARR_FREE (H5AC_info_ptr_t,cache->slot);
f->shared->cache = H5FL_FREE (H5AC_t,f->shared->cache);
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
@ -414,10 +414,10 @@ H5AC_flush(H5F_t *f, const H5AC_class_t *type, haddr_t addr, hbool_t destroy)
* Sort the cache entries by address since flushing them in
* ascending order by address may be much more efficient.
*/
if (NULL==(map=H5FL_ARR_ALLOC(intn,cache->nslots,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
if (NULL==(map=H5FL_ARR_ALLOC(intn,(hsize_t)cache->nslots,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
}
for (i = nslots = 0; i < cache->nslots; i++) {
if (cache->slot[i]!=NULL)
map[nslots++] = i;

View File

@ -124,7 +124,7 @@ static H5B_t *H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata);
static herr_t H5B_decode_key(H5F_t *f, H5B_t *bt, intn idx);
static herr_t H5B_decode_keys(H5F_t *f, H5B_t *bt, intn idx);
static hsize_t H5B_nodesize(H5F_t *f, const H5B_class_t *type,
size_t *total_nkey_size, size_t sizeof_rkey);
hsize_t *total_nkey_size, size_t sizeof_rkey);
static herr_t H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt,
haddr_t old_addr, intn idx,
const double split_ratios[], void *udata,
@ -192,7 +192,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
H5B_t *bt = NULL;
size_t sizeof_rkey;
hsize_t size;
size_t total_native_keysize;
hsize_t total_native_keysize;
size_t offset;
intn i;
herr_t ret_value = FAIL;
@ -229,8 +229,8 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata,
bt->nchildren = 0;
if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,1)) ||
NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_native_keysize,0)) ||
NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,2*H5B_K(f,type),0)) ||
NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(2*H5B_K(f,type)+1),0))) {
NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0)) ||
NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(hsize_t)(2*H5B_K(f,type)+1),0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for B-tree root node");
}
@ -307,7 +307,7 @@ static H5B_t *
H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata)
{
const H5B_class_t *type = (const H5B_class_t *) _type;
size_t total_nkey_size;
hsize_t total_nkey_size;
hsize_t size;
H5B_t *bt = NULL;
intn i;
@ -333,8 +333,8 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata)
bt->ndirty = 0;
if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,0)) ||
NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_nkey_size,0)) ||
NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(2*H5B_K(f,type)+1),0)) ||
NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,2*H5B_K(f,type),0))) {
NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(hsize_t)(2*H5B_K(f,type)+1),0)) ||
NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -1563,7 +1563,7 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
* We've reached the left-most leaf. Now follow the right-sibling
* pointer from leaf to leaf until we've processed all leaves.
*/
if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,2*H5B_K(f,type),0)) ||
if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,(hsize_t)(2*H5B_K(f,type)),0)) ||
NULL==(key=H5MM_malloc((2*H5B_K(f, type)+1)*type->sizeof_nkey))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
@ -2000,7 +2000,7 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata)
*/
static hsize_t
H5B_nodesize(H5F_t *f, const H5B_class_t *type,
size_t *total_nkey_size/*out*/, size_t sizeof_rkey)
hsize_t *total_nkey_size/*out*/, size_t sizeof_rkey)
{
hsize_t size;
@ -2052,9 +2052,9 @@ static H5B_t *
H5B_copy(H5F_t *f, const H5B_t *old_bt)
{
H5B_t *ret_value = NULL;
size_t total_native_keysize;
hsize_t total_native_keysize;
hsize_t size;
uintn nkeys;
hsize_t nkeys;
uintn u;
FUNC_ENTER(H5B_copy, NULL);
@ -2093,9 +2093,12 @@ H5B_copy(H5F_t *f, const H5B_t *old_bt)
/* Copy the other structures */
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(ret_value->page,old_bt->page,(size_t)size);
HDmemcpy(ret_value->native,old_bt->native,total_native_keysize);
HDmemcpy(ret_value->child,old_bt->child,sizeof(haddr_t)*nkeys);
HDmemcpy(ret_value->key,old_bt->key,sizeof(H5B_key_t)*(nkeys+1));
assert(total_native_keysize==(hsize_t)((size_t)total_native_keysize)); /*check for overflow*/
HDmemcpy(ret_value->native,old_bt->native,(size_t)total_native_keysize);
assert((sizeof(haddr_t)*nkeys)==(hsize_t)((size_t)(sizeof(haddr_t)*nkeys))); /*check for overflow*/
HDmemcpy(ret_value->child,old_bt->child,(size_t)(sizeof(haddr_t)*nkeys));
assert((sizeof(H5B_key_t)*(nkeys+1))==(hsize_t)((size_t)(sizeof(H5B_key_t)*(nkeys+1)))); /*check for overflow*/
HDmemcpy(ret_value->key,old_bt->key,(size_t)(sizeof(H5B_key_t)*(nkeys+1)));
/*
* Translate the keys from pointers into the old 'page' buffer into

532
src/H5D.c
View File

@ -948,6 +948,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
H5D_t *new_dset = NULL;
H5D_t *ret_value = NULL;
intn i, ndims;
uintn u;
hsize_t max_dim[H5O_LAYOUT_NDIMS]={0};
H5O_efl_t *efl = NULL;
H5F_t *f = NULL;
@ -960,23 +961,21 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
assert (type);
assert (space);
assert (create_parms);
if (create_parms->pline.nfilters>0 &&
H5D_CHUNKED!=create_parms->layout) {
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
if (create_parms->pline.nfilters>0 && H5D_CHUNKED!=create_parms->layout) {
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
"filters can only be used with chunked layout");
}
/* What file is the dataset being added to? */
if (NULL==(f=H5G_insertion_file(loc, name))) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to locate insertion point");
}
#ifdef H5_HAVE_PARALLEL
/* If MPIO is used, no filter support yet. */
if (IS_H5FD_MPIO(f) &&
create_parms->pline.nfilters>0) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
if (IS_H5FD_MPIO(f) && create_parms->pline.nfilters>0) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
"Parallel IO does not support filters yet");
}
#endif
@ -1004,99 +1003,98 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(new_dset->type);
switch (new_dset->create_parms->layout) {
case H5D_CONTIGUOUS:
/*
* The maximum size of the dataset cannot exceed the storage size.
* Also, only the slowest varying dimension of a simple data space
* can be extendible.
*/
if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim,
max_dim))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize contiguous storage");
}
for (i=1; i<ndims; i++) {
if (max_dim[i]>new_dset->layout.dim[i]) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"only the first dimension can be extendible");
}
}
if (efl->nused>0) {
hsize_t max_points = H5S_get_npoints_max (space);
hsize_t max_storage = H5O_efl_total_size (efl);
case H5D_CONTIGUOUS:
/*
* The maximum size of the dataset cannot exceed the storage size.
* Also, only the slowest varying dimension of a simple data space
* can be extendible.
*/
if ((ndims=H5S_get_simple_extent_dims(space, new_dset->layout.dim,
max_dim))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize contiguous storage");
}
for (i=1; i<ndims; i++) {
if (max_dim[i]>new_dset->layout.dim[i]) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"only the first dimension can be extendible");
}
}
if (efl->nused>0) {
hsize_t max_points = H5S_get_npoints_max (space);
hsize_t max_storage = H5O_efl_total_size (efl);
if (H5S_UNLIMITED==max_points) {
if (H5O_EFL_UNLIMITED!=max_storage) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unlimited data space but finite storage");
}
} else if (max_points * H5T_get_size (type) < max_points) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"data space * type size overflowed");
} else if (max_points * H5T_get_size (type) > max_storage) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"data space size exceeds external storage size");
}
} else if (ndims>0 && max_dim[0]>new_dset->layout.dim[0]) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
"extendible contiguous non-external dataset");
}
break;
if (H5S_UNLIMITED==max_points) {
if (H5O_EFL_UNLIMITED!=max_storage) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unlimited data space but finite storage");
}
} else if (max_points * H5T_get_size (type) < max_points) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"data space * type size overflowed");
} else if (max_points * H5T_get_size (type) > max_storage) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"data space size exceeds external storage size");
}
} else if (ndims>0 && max_dim[0]>new_dset->layout.dim[0]) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
"extendible contiguous non-external dataset");
}
break;
case H5D_CHUNKED:
/*
* Chunked storage allows any type of data space extension, so we
* don't even bother checking.
*/
if (new_dset->create_parms->chunk_ndims !=
H5S_get_simple_extent_ndims(space)) {
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL,
"dimensionality of chunks doesn't match the data space");
}
if (efl->nused>0) {
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
"external storage not supported with chunked layout");
}
for (i=0; i<new_dset->layout.ndims-1; i++) {
new_dset->layout.dim[i] = new_dset->create_parms->chunk_size[i];
}
break;
case H5D_CHUNKED:
/*
* Chunked storage allows any type of data space extension, so we
* don't even bother checking.
*/
if (new_dset->create_parms->chunk_ndims != H5S_get_simple_extent_ndims(space)) {
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL,
"dimensionality of chunks doesn't match the data space");
}
if (efl->nused>0) {
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL,
"external storage not supported with chunked layout");
}
for (u=0; u<new_dset->layout.ndims-1; u++) {
new_dset->layout.dim[u] = new_dset->create_parms->chunk_size[u];
}
break;
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet");
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet");
}
/* Create (open for write access) an object header */
if (H5O_create(f, 256, &(new_dset->ent)) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to create dataset object header");
}
/* Convert the fill value to the dataset type and write the message */
if (H5O_fill_convert(&(new_dset->create_parms->fill), new_dset->type)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to convert fill value to dataset type");
}
if (new_dset->create_parms->fill.buf &&
H5O_modify(&(new_dset->ent), H5O_FILL, 0, H5O_FLAG_CONSTANT,
H5O_modify(&(new_dset->ent), H5O_FILL, 0, H5O_FLAG_CONSTANT,
&(new_dset->create_parms->fill))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update fill value header message");
}
/* Update the type and space header messages */
if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0,
H5O_FLAG_CONSTANT|H5O_FLAG_SHARED, new_dset->type)<0 ||
H5S_modify(&(new_dset->ent), space) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
H5S_modify(&(new_dset->ent), space) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update type or space header messages");
}
/* Update the filters message */
if (new_dset->create_parms->pline.nfilters>0 &&
H5O_modify (&(new_dset->ent), H5O_PLINE, 0, H5O_FLAG_CONSTANT,
H5O_modify (&(new_dset->ent), H5O_PLINE, 0, H5O_FLAG_CONSTANT,
&(new_dset->create_parms->pline))<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update filter header message");
}
@ -1104,7 +1102,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type,
* Add a modification time message.
*/
if (H5O_touch(&(new_dset->ent), TRUE)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update modification time message");
}
@ -1113,7 +1111,7 @@ printf("%s: check 0.5\n",FUNC);
#endif /* QAK */
/* Give the dataset a name */
if (H5G_insert(loc, name, &(new_dset->ent)) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset");
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to name dataset");
}
/*
@ -1125,12 +1123,12 @@ printf("%s: check 0.5\n",FUNC);
printf("%s: check 1.0\n",FUNC);
#endif /* QAK */
if (0==efl->nused) {
if (H5F_arr_create(f, &(new_dset->layout)) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize storage");
}
if (H5F_arr_create(f, &(new_dset->layout)) < 0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize storage");
}
} else {
new_dset->layout.addr = HADDR_UNDEF;
new_dset->layout.addr = HADDR_UNDEF;
}
#ifdef QAK
@ -1139,7 +1137,7 @@ printf("%s: check 2.0\n",FUNC);
/* Update layout message */
if (H5O_modify (&(new_dset->ent), H5O_LAYOUT, 0, H5O_FLAG_CONSTANT,
&(new_dset->layout)) < 0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update layout message");
}
@ -1148,31 +1146,30 @@ printf("%s: check 3.0\n",FUNC);
#endif /* QAK */
/* Update external storage message */
if (efl->nused>0) {
size_t heap_size = H5HL_ALIGN (1);
for (i=0; i<efl->nused; i++) {
heap_size += H5HL_ALIGN (HDstrlen (efl->slot[i].name)+1);
}
if (H5HL_create (f, heap_size, &(efl->heap_addr)/*out*/)<0 ||
(size_t)(-1)==H5HL_insert(f, efl->heap_addr, 1, "")) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to create external file list name heap");
}
for (i=0; i<efl->nused; i++) {
size_t offset = H5HL_insert(f, efl->heap_addr,
HDstrlen(efl->slot[i].name)+1,
efl->slot[i].name);
assert(0==efl->slot[i].name_offset);
if ((size_t)(-1)==offset) {
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, NULL,
"unable to insert URL into name heap");
}
efl->slot[i].name_offset = offset;
}
if (H5O_modify (&(new_dset->ent), H5O_EFL, 0, H5O_FLAG_CONSTANT,
efl)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update external file list message");
}
size_t heap_size = H5HL_ALIGN (1);
for (i=0; i<efl->nused; i++) {
heap_size += H5HL_ALIGN (HDstrlen (efl->slot[i].name)+1);
}
if (H5HL_create (f, heap_size, &(efl->heap_addr)/*out*/)<0 ||
(size_t)(-1)==H5HL_insert(f, efl->heap_addr, 1, "")) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to create external file list name heap");
}
for (i=0; i<efl->nused; i++) {
size_t offset = H5HL_insert(f, efl->heap_addr,
HDstrlen(efl->slot[i].name)+1, efl->slot[i].name);
assert(0==efl->slot[i].name_offset);
if ((size_t)(-1)==offset) {
HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, NULL,
"unable to insert URL into name heap");
}
efl->slot[i].name_offset = offset;
}
if (H5O_modify (&(new_dset->ent), H5O_EFL, 0, H5O_FLAG_CONSTANT, efl)<0) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"unable to update external file list message");
}
}
#ifdef QAK
@ -1180,7 +1177,7 @@ printf("%s: check 4.0\n",FUNC);
#endif /* QAK */
/* Initialize the raw data */
if (H5D_init_storage(new_dset, space)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize storage");
}
@ -1192,16 +1189,17 @@ printf("%s: check 6.0\n",FUNC);
done:
if (!ret_value && new_dset) {
if (new_dset->type) H5T_close(new_dset->type);
if (new_dset->create_parms) {
H5P_close (new_dset->create_parms);
new_dset->create_parms = NULL;
}
if (H5F_addr_defined(new_dset->ent.header)) {
H5O_close(&(new_dset->ent));
}
new_dset->ent.file = NULL;
H5FL_FREE(H5D_t,new_dset);
if (new_dset->type)
H5T_close(new_dset->type);
if (new_dset->create_parms) {
H5P_close (new_dset->create_parms);
new_dset->create_parms = NULL;
}
if (H5F_addr_defined(new_dset->ent.header)) {
H5O_close(&(new_dset->ent));
}
new_dset->ent.file = NULL;
H5FL_FREE(H5D_t,new_dset);
}
FUNC_LEAVE(ret_value);
}
@ -1331,7 +1329,7 @@ H5D_open_oid(H5G_entry_t *ent)
H5D_t *dataset = NULL; /*new dataset struct */
H5D_t *ret_value = NULL; /*return value */
H5S_t *space = NULL; /*data space */
intn i;
uintn u;
FUNC_ENTER(H5D_open_oid, NULL);
@ -1380,8 +1378,7 @@ H5D_open_oid(H5G_entry_t *ent)
#ifdef H5_HAVE_PARALLEL
/* If MPIO is used, no filter support yet. */
if (IS_H5FD_MPIO(dataset->ent.file) &&
dataset->create_parms->pline.nfilters>0){
if (IS_H5FD_MPIO(dataset->ent.file) && dataset->create_parms->pline.nfilters>0) {
HGOTO_ERROR (H5E_DATASET, H5E_UNSUPPORTED, NULL,
"Parallel IO does not support filters yet");
}
@ -1410,8 +1407,8 @@ H5D_open_oid(H5G_entry_t *ent)
*/
dataset->create_parms->layout = H5D_CHUNKED;
dataset->create_parms->chunk_ndims = dataset->layout.ndims - 1;
for (i = 0; i < dataset->layout.ndims - 1; i++) {
dataset->create_parms->chunk_size[i] = dataset->layout.dim[i];
for (u = 0; u < dataset->layout.ndims - 1; u++) {
dataset->create_parms->chunk_size[u] = dataset->layout.dim[u];
}
break;
@ -1423,7 +1420,7 @@ H5D_open_oid(H5G_entry_t *ent)
/* Get the external file list message, which might not exist */
if (NULL==H5O_read (&(dataset->ent), H5O_EFL, 0,
&(dataset->create_parms->efl)) &&
!H5F_addr_defined (dataset->layout.addr)) {
!H5F_addr_defined (dataset->layout.addr)) {
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, NULL,
"storage address is undefined an no external file list");
}
@ -1434,7 +1431,7 @@ H5D_open_oid(H5G_entry_t *ent)
* be fully populated before I/O can happen.
*/
if ((H5F_get_intent(dataset->ent.file) & H5F_ACC_RDWR) &&
H5D_CHUNKED==dataset->layout.type) {
H5D_CHUNKED==dataset->layout.type) {
if (H5D_init_storage(dataset, space)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL,
"unable to initialize file storage");
@ -1562,27 +1559,27 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, void *buf/*out*/)
{
const H5D_xfer_t *xfer_parms = NULL;
hssize_t nelmts; /*number of elements */
size_t smine_start; /*strip mine start loc */
size_t n, smine_nelmts; /*elements per strip */
hssize_t nelmts; /*number of elements */
hsize_t smine_start; /*strip mine start loc */
hsize_t n, smine_nelmts; /*elements per strip */
uint8_t *tconv_buf = NULL; /*data type conv buffer */
uint8_t *bkg_buf = NULL; /*background buffer */
H5T_path_t *tpath = NULL; /*type conversion info */
H5T_path_t *tpath = NULL; /*type conversion info */
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /*mem selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iter info*/
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /*mem selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iter info*/
herr_t ret_value = FAIL; /*return value */
herr_t status; /*function return status*/
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
size_t target_size; /*desired buffer size */
size_t request_nelmts; /*requested strip mine */
size_t min_elem_out=1;/*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way*/
size_t dst_type_size; /*size of destination type*/
hsize_t target_size; /*desired buffer size */
hsize_t request_nelmts; /*requested strip mine */
size_t min_elem_out=1; /*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way*/
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_dxpl_t *dx = NULL;
H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */
@ -1620,7 +1617,8 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
}
file_space = free_this_space;
}
if (!mem_space) mem_space = file_space;
if (!mem_space)
mem_space = file_space;
nelmts = H5S_get_select_npoints(mem_space);
#ifdef H5_HAVE_PARALLEL
@ -1826,14 +1824,11 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
#endif
/* Start strip mining... */
assert(nelmts==(hssize_t)((size_t)nelmts)); /*check for overflow*/
for (smine_start=0;
smine_start<(size_t)nelmts;
smine_start+=smine_nelmts) {
H5_CHECK_OVERFLOW(nelmts,hssize_t,hsize_t);
for (smine_start=0; smine_start<(hsize_t)nelmts; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
smine_nelmts = (sconv->f->avail)(file_space,&file_iter,
MIN(request_nelmts,
(nelmts-smine_start)));
MIN(request_nelmts, (nelmts-smine_start)));
#ifdef QAK
printf("%s: check 5.0, nelmts=%d, smine_start=%d, smine_nelmts=%d\n",
FUNC,(int)nelmts,(int)smine_start,(int)smine_nelmts);
@ -1881,21 +1876,22 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
if (H5T_BKG_YES==need_bkg) {
#ifdef H5S_DEBUG
H5_timer_begin(&timer);
H5_timer_begin(&timer);
#endif
n = (sconv->m->gath)(buf, dst_type_size, mem_space, &bkg_iter,
smine_nelmts, bkg_buf/*out*/);
#ifdef H5S_DEBUG
H5_timer_end(&(sconv->stats[1].bkg_timer), &timer);
sconv->stats[1].bkg_nbytes += n * dst_type_size;
sconv->stats[1].bkg_ncalls++;
H5_timer_end(&(sconv->stats[1].bkg_timer), &timer);
sconv->stats[1].bkg_nbytes += n * dst_type_size;
sconv->stats[1].bkg_ncalls++;
#endif
if (n!=smine_nelmts) {
if (n!=smine_nelmts) {
HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "mem gather failed");
}
} else if (need_bkg) {
HDmemset(bkg_buf, 0, request_nelmts*dst_type_size);
}
assert((request_nelmts*dst_type_size)==(hsize_t)((size_t)(request_nelmts*dst_type_size))); /*check for overflow*/
HDmemset(bkg_buf, 0, (size_t)(request_nelmts*dst_type_size));
}
#ifdef QAK
printf("%s: check 7.0\n",FUNC);
@ -1904,8 +1900,8 @@ printf("%s: check 2.0, src_type_size=%d, dst_type_size=%d, target_size=%d, min_e
/*
* Perform data type conversion.
*/
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf,
bkg_buf, dxpl_id)<0) {
if (H5T_convert(tpath, src_id, dst_id, smine_nelmts, 0, 0, tconv_buf,
bkg_buf, dxpl_id)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
@ -2006,27 +2002,27 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
const H5S_t *file_space, hid_t dxpl_id, const void *buf)
{
const H5D_xfer_t *xfer_parms = NULL;
hssize_t nelmts; /*total number of elmts */
size_t smine_start; /*strip mine start loc */
size_t n, smine_nelmts; /*elements per strip */
hssize_t nelmts; /*total number of elmts */
hsize_t smine_start; /*strip mine start loc */
hsize_t n, smine_nelmts; /*elements per strip */
uint8_t *tconv_buf = NULL; /*data type conv buffer */
uint8_t *bkg_buf = NULL; /*background buffer */
H5T_path_t *tpath = NULL; /*type conversion info */
H5T_path_t *tpath = NULL; /*type conversion info */
hid_t src_id = -1, dst_id = -1;/*temporary type atoms */
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iteration info*/
H5S_conv_t *sconv=NULL; /*space conversion funcs*/
H5S_sel_iter_t mem_iter; /*memory selection iteration info*/
H5S_sel_iter_t bkg_iter; /*background iteration info*/
H5S_sel_iter_t file_iter; /*file selection iteration info*/
herr_t ret_value = FAIL; /*return value */
herr_t status; /*function return status*/
herr_t status; /*function return status*/
size_t src_type_size; /*size of source type */
size_t dst_type_size; /*size of destination type*/
size_t target_size; /*desired buffer size */
size_t request_nelmts; /*requested strip mine */
size_t min_elem_out=1;/*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
size_t dst_type_size; /*size of destination type*/
hsize_t target_size; /*desired buffer size */
hsize_t request_nelmts; /*requested strip mine */
size_t min_elem_out=1; /*Minimum # of elements to output*/
H5T_bkg_t need_bkg; /*type of background buf*/
H5S_t *free_this_space=NULL; /*data space to free */
hbool_t must_convert; /*have to xfer the slow way*/
hbool_t must_convert; /*have to xfer the slow way*/
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_dxpl_t *dx = NULL;
H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */
@ -2294,14 +2290,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#endif
/* Start strip mining... */
assert(nelmts==(hssize_t)((size_t)nelmts)); /*check for overflow*/
for (smine_start=0;
smine_start<(size_t)nelmts;
smine_start+=smine_nelmts) {
H5_CHECK_OVERFLOW(nelmts,hssize_t,hsize_t);
for (smine_start=0; smine_start<(hsize_t)nelmts; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
smine_nelmts = (sconv->f->avail)(file_space,&file_iter,
MIN(request_nelmts,
(nelmts-smine_start)));
MIN(request_nelmts, (nelmts-smine_start)));
#ifdef QAK
printf("%s: check 5.0, nelmts=%d, smine_start=%d, smine_nelmts=%d\n",
@ -2370,7 +2363,8 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#ifdef QAK
printf("%s: check 6.2, need_bkg=%d\n",FUNC,(int)need_bkg);
#endif
HDmemset(bkg_buf, 0, request_nelmts*dst_type_size);
H5_CHECK_OVERFLOW(request_nelmts*dst_type_size,hsize_t,size_t);
HDmemset(bkg_buf, 0, (size_t)(request_nelmts*dst_type_size));
}
/*
@ -2634,8 +2628,8 @@ H5D_get_file (const H5D_t *dset)
static herr_t
H5D_init_storage(H5D_t *dset, const H5S_t *space)
{
hssize_t npoints, ptsperbuf;
size_t size, bufsize=8*1024;
hssize_t npoints, ptsperbuf;
hsize_t size, bufsize=8*1024;
haddr_t addr;
herr_t ret_value = FAIL;
void *buf = NULL;
@ -2645,93 +2639,93 @@ H5D_init_storage(H5D_t *dset, const H5S_t *space)
assert(space);
switch (dset->layout.type) {
case H5D_CONTIGUOUS:
/*
* If the fill value is set then write it to the specified selection
* even if it is all zero. This allows the application to force
* filling when the underlying storage isn't initialized to zero.
*/
npoints = H5S_get_simple_extent_npoints(space);
if (dset->create_parms->fill.buf &&
npoints==H5S_get_select_npoints(space)) {
/*
* Fill the entire current extent with the fill value. We can do
* this quite efficiently by making sure we copy the fill value
* in relatively large pieces.
*/
ptsperbuf = (hssize_t)MAX(1,
bufsize/dset->create_parms->fill.size);
bufsize = ptsperbuf * dset->create_parms->fill.size;
case H5D_CONTIGUOUS:
/*
* If the fill value is set then write it to the specified selection
* even if it is all zero. This allows the application to force
* filling when the underlying storage isn't initialized to zero.
*/
npoints = H5S_get_simple_extent_npoints(space);
if (dset->create_parms->fill.buf &&
npoints==H5S_get_select_npoints(space)) {
/*
* Fill the entire current extent with the fill value. We can do
* this quite efficiently by making sure we copy the fill value
* in relatively large pieces.
*/
ptsperbuf = (hssize_t)MAX(1,
bufsize/dset->create_parms->fill.size);
bufsize = ptsperbuf * dset->create_parms->fill.size;
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_ALLOC(fill_conv,bufsize,0))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for fill buffer");
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_ALLOC(fill_conv,bufsize,0))==NULL)
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for fill buffer");
H5V_array_fill(buf, dset->create_parms->fill.buf,
dset->create_parms->fill.size, ptsperbuf);
if (dset->create_parms->efl.nused) {
addr = 0;
} else {
addr = dset->layout.addr;
}
while (npoints>0) {
size = MIN(ptsperbuf, npoints) * dset->create_parms->fill.size;
if (dset->create_parms->efl.nused) {
if (H5O_efl_write(dset->ent.file,
&(dset->create_parms->efl),
addr, size, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
}
} else {
if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, addr, size,
H5P_DEFAULT, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
}
}
npoints -= MIN(ptsperbuf, npoints);
addr += size;
}
} else if (dset->create_parms->fill.buf) {
/*
* Fill the specified selection with the fill value.
*/
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to initialize dataset with fill value");
}
break;
assert(ptsperbuf==(hssize_t)((size_t)ptsperbuf)); /*check for overflow*/
H5V_array_fill(buf, dset->create_parms->fill.buf,
dset->create_parms->fill.size, (size_t)ptsperbuf);
if (dset->create_parms->efl.nused) {
addr = 0;
} else {
addr = dset->layout.addr;
}
while (npoints>0) {
size = MIN(ptsperbuf, npoints) * dset->create_parms->fill.size;
if (dset->create_parms->efl.nused) {
if (H5O_efl_write(dset->ent.file,
&(dset->create_parms->efl), addr, size, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
}
} else {
if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, addr,
size, H5P_DEFAULT, buf)<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to write fill value to dataset");
}
}
npoints -= MIN(ptsperbuf, npoints);
addr += size;
}
} else if (dset->create_parms->fill.buf) {
/*
* Fill the specified selection with the fill value.
*/
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"unable to initialize dataset with fill value");
}
break;
case H5D_CHUNKED:
case H5D_CHUNKED:
#ifdef H5_HAVE_PARALLEL
/*
* If the dataset is accessed via parallel I/O, allocate file space
* for all chunks now and initialize each chunk with the fill value.
*/
if (IS_H5FD_MPIO(dset->ent.file)) {
/* We only handle simple data spaces so far */
intn ndims;
hsize_t dim[H5O_LAYOUT_NDIMS];
if ((ndims=H5S_get_simple_extent_dims(space, dim, NULL))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to get simple data space info");
}
dim[ndims] = dset->layout.dim[ndims];
ndims++;
/*
* If the dataset is accessed via parallel I/O, allocate file space
* for all chunks now and initialize each chunk with the fill value.
*/
if (IS_H5FD_MPIO(dset->ent.file)) {
/* We only handle simple data spaces so far */
intn ndims;
hsize_t dim[H5O_LAYOUT_NDIMS];
if ((ndims=H5S_get_simple_extent_dims(space, dim, NULL))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to get simple data space info");
}
dim[ndims] = dset->layout.dim[ndims];
ndims++;
if (H5F_istore_allocate(dset->ent.file, H5P_DEFAULT,
&(dset->layout), dim,
&(dset->create_parms->pline),
&(dset->create_parms->fill))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to allocate all chunks of dataset");
}
}
if (H5F_istore_allocate(dset->ent.file, H5P_DEFAULT,
&(dset->layout), dim,
&(dset->create_parms->pline),
&(dset->create_parms->fill))<0) {
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to allocate all chunks of dataset");
}
}
#endif /*H5_HAVE_PARALLEL*/
break;
break;
}
ret_value = SUCCEED;
@ -2802,17 +2796,17 @@ hsize_t
H5D_get_storage_size(H5D_t *dset)
{
hsize_t size;
int i;
uintn u;
FUNC_ENTER(H5D_get_storage_size, 0);
if (H5D_CHUNKED==dset->layout.type) {
size = H5F_istore_allocated(dset->ent.file, dset->layout.ndims,
size = H5F_istore_allocated(dset->ent.file, dset->layout.ndims,
dset->layout.addr);
} else {
for (i=0, size=1; i<dset->layout.ndims; i++) {
size *= dset->layout.dim[i];
}
for (u=0, size=1; u<dset->layout.ndims; u++) {
size *= dset->layout.dim[u];
}
}
FUNC_LEAVE(size);
@ -2980,7 +2974,7 @@ void *H5D_vlen_get_buf_size_alloc(size_t size, void *info)
FUNC_ENTER(H5D_vlen_get_buf_size_alloc, NULL);
/* Get a temporary pointer to space for the VL data */
if ((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,size))!=NULL)
if ((vlen_bufsize->vl_tbuf=H5FL_BLK_REALLOC(vlen_vl_buf,vlen_bufsize->vl_tbuf,(hsize_t)size))!=NULL)
vlen_bufsize->size+=size;
FUNC_LEAVE(vlen_bufsize->vl_tbuf);
@ -3031,7 +3025,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hss
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
/* Make certain there is enough fixed-length buffer available */
if ((vlen_bufsize->fl_tbuf=H5FL_BLK_REALLOC(vlen_fl_buf,vlen_bufsize->fl_tbuf,H5T_get_size(dt)))==NULL)
if ((vlen_bufsize->fl_tbuf=H5FL_BLK_REALLOC(vlen_fl_buf,vlen_bufsize->fl_tbuf,(hsize_t)H5T_get_size(dt)))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf");
/* Select point to read in */
@ -3107,9 +3101,9 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't create dataspace");
/* Grab the temporary buffers required */
if((vlen_bufsize.fl_tbuf=H5FL_BLK_ALLOC(vlen_fl_buf,1,0))==NULL)
if((vlen_bufsize.fl_tbuf=H5FL_BLK_ALLOC(vlen_fl_buf,(hsize_t)1,0))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available");
if((vlen_bufsize.vl_tbuf=H5FL_BLK_ALLOC(vlen_vl_buf,1,0))==NULL)
if((vlen_bufsize.vl_tbuf=H5FL_BLK_ALLOC(vlen_vl_buf,(hsize_t)1,0))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available");
/* Change to the custom memory allocation routines for reading VL data */

View File

@ -151,7 +151,8 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(f->shared->sieve_buf=H5MM_malloc(f->shared->sieve_buf_size))) {
assert(f->shared->sieve_buf_size==(hsize_t)((size_t)f->shared->sieve_buf_size)); /*check for overflow*/
if (NULL==(f->shared->sieve_buf=H5MM_malloc((size_t)f->shared->sieve_buf_size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -325,7 +326,8 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(f->shared->sieve_buf=H5MM_malloc(f->shared->sieve_buf_size))) {
assert(f->shared->sieve_buf_size==(hsize_t)((size_t)f->shared->sieve_buf_size)); /*check for overflow*/
if (NULL==(f->shared->sieve_buf=H5MM_malloc((size_t)f->shared->sieve_buf_size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}

File diff suppressed because it is too large Load Diff

View File

@ -53,16 +53,16 @@ typedef struct H5D_create_t {
/* Data transfer property list */
typedef struct H5D_xfer_t {
size_t buf_size; /*max temp buffer size */
hsize_t buf_size; /*max temp buffer size */
void *tconv_buf; /*type conversion buffer or null */
void *bkg_buf; /*background buffer or null */
H5T_bkg_t need_bkg; /*type of background buffer needed */
H5T_bkg_t need_bkg; /*type of background buffer needed */
double split_ratios[3];/*B-tree node splitting ratios */
uintn cache_hyper; /*cache hyperslab blocks during I/O? */
uintn block_limit; /*largest hyperslab block to cache */
uintn cache_hyper; /*cache hyperslab blocks during I/O? */
uintn block_limit; /*largest hyperslab block to cache */
H5MM_allocate_t vlen_alloc; /*VL datatype allocation function */
void *alloc_info; /*VL datatype allocation information */
H5MM_free_t vlen_free; /*VL datatype free function */
H5MM_free_t vlen_free; /*VL datatype free function */
void *free_info; /*VL datatype free information */
hid_t driver_id; /*File driver ID */
void *driver_info; /*File driver specific information */

View File

@ -59,7 +59,7 @@ herr_t
H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
hsize_t seq_len, hssize_t file_offset, void *buf/*out*/)
hsize_t seq_len, hsize_t file_offset, void *buf/*out*/)
{
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */
@ -285,7 +285,7 @@ herr_t
H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
hsize_t seq_len, hssize_t file_offset, const void *buf)
hsize_t seq_len, hsize_t file_offset, const void *buf)
{
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */

View File

@ -1519,7 +1519,8 @@ H5FD_realloc(H5FD_t *file, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size,
HRETURN_ERROR(H5E_FILE, H5E_NOSPACE, HADDR_UNDEF,
"file allocation failed");
}
if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc(old_size))) {
assert(old_size==(hsize_t)((size_t)old_size)); /*check for overflow*/
if (old_size>sizeof(_buf) && NULL==(buf=H5MM_malloc((size_t)old_size))) {
H5FDfree(file, type, new_addr, new_size);
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF,
"memory allocation failed");
@ -1914,7 +1915,8 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
amount_read=MIN((file->accum_size-read_off),size);
/* Copy the data out of the buffer */
HDmemcpy(read_buf,file->meta_accum+read_off,amount_read);
assert(amount_read==(hsize_t)((size_t)amount_read)); /*check for overflow*/
HDmemcpy(read_buf,file->meta_accum+read_off,(size_t)amount_read);
/* Adjust the buffer, address & size */
read_buf+=amount_read;
@ -2021,7 +2023,7 @@ herr_t
H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size,
const void *buf)
{
size_t new_size; /* New size of the accumulator buffer */
hsize_t new_size; /* New size of the accumulator buffer */
size_t old_offset; /* Offset of old data within the accumulator buffer */
FUNC_ENTER(H5FD_write, FAIL);
@ -2059,10 +2061,12 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
} /* end if */
/* Move the existing metadata to the proper location */
HDmemmove(file->meta_accum+size,file->meta_accum,file->accum_size);
assert(file->accum_size==(hsize_t)((size_t)file->accum_size)); /*check for overflow*/
HDmemmove(file->meta_accum+size,file->meta_accum,(size_t)file->accum_size);
/* Copy the new metadata at the front */
HDmemcpy(file->meta_accum,buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum,buf,(size_t)size);
/* Set the new size & location of the metadata accumulator */
file->accum_loc=addr;
@ -2084,7 +2088,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
} /* end if */
/* Copy the new metadata to the end */
HDmemcpy(file->meta_accum+file->accum_size,buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum+file->accum_size,buf,(size_t)size);
/* Set the new size of the metadata accumulator */
file->accum_size=file->accum_size+size;
@ -2095,7 +2100,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
/* Check if the new metadata is entirely within the current accumulator */
else if(addr>=file->accum_loc && (addr+size)<=(file->accum_loc+file->accum_size)) {
/* Copy the new metadata to the proper location within the accumulator */
HDmemcpy(file->meta_accum+(addr-file->accum_loc),buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum+(addr-file->accum_loc),buf,(size_t)size);
/* Mark it as written to */
file->accum_dirty=TRUE;
@ -2119,10 +2125,12 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
old_offset=(addr+size)-file->accum_loc;
/* Move the existing metadata to the proper location */
HDmemmove(file->meta_accum+size,file->meta_accum+old_offset,file->accum_size-old_offset);
assert((file->accum_size-old_offset)==(hsize_t)((size_t)(file->accum_size-old_offset))); /*check for overflow*/
HDmemmove(file->meta_accum+size,file->meta_accum+old_offset,(size_t)(file->accum_size-old_offset));
/* Copy the new metadata at the front */
HDmemcpy(file->meta_accum,buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum,buf,(size_t)size);
/* Set the new size & location of the metadata accumulator */
file->accum_loc=addr;
@ -2147,7 +2155,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
} /* end if */
/* Copy the new metadata to the end */
HDmemcpy(file->meta_accum+(addr-file->accum_loc),buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum+(addr-file->accum_loc),buf,(size_t)size);
/* Set the new size & location of the metadata accumulator */
file->accum_loc=addr;
@ -2181,7 +2190,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
file->accum_loc=addr;
file->accum_size=size;
file->accum_dirty=TRUE;
HDmemcpy(file->meta_accum,buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum,buf,(size_t)size);
} /* end else */
} /* end if */
/* No metadata in the accumulator, grab this piece and keep it */
@ -2200,7 +2210,8 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
file->accum_loc=addr;
file->accum_size=size;
file->accum_dirty=TRUE;
HDmemcpy(file->meta_accum,buf,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->meta_accum,buf,(size_t)size);
} /* end else */
} /* end if */
else {

View File

@ -303,7 +303,7 @@ H5FD_core_open(const char *name, unsigned UNUSED flags, hid_t fapl_id,
/* Open backing store */
if (fa && fa->backing_store && name &&
(fd=open(name, O_CREAT|O_TRUNC|O_RDWR, 0666))<0) {
(fd=HDopen(name, O_CREAT|O_TRUNC|O_RDWR, 0666))<0) {
HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
"unable to open backing store");
}
@ -358,12 +358,15 @@ H5FD_core_flush(H5FD_t *_file)
haddr_t size = file->eof;
unsigned char *ptr = file->mem;
if (0!=lseek(file->fd, 0, SEEK_SET))
if (0!=HDlseek(file->fd, (off_t)0, SEEK_SET))
HRETURN_ERROR(H5E_IO, H5E_SEEKERROR, FAIL,
"error seeking in backing store");
while (size) {
ssize_t n = write(file->fd, ptr, size);
ssize_t n;
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
n = HDwrite(file->fd, ptr, (size_t)size);
if (n<0 && EINTR==errno) continue;
if (n<0)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
@ -408,10 +411,10 @@ H5FD_core_close(H5FD_t *_file)
HRETURN_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file");
/* Release resources */
if (file->fd>=0) close(file->fd);
if (file->fd>=0) HDclose(file->fd);
if (file->name) H5MM_xfree(file->name);
if (file->mem) H5MM_xfree(file->mem);
memset(file, 0, sizeof(H5FD_core_t));
HDmemset(file, 0, sizeof(H5FD_core_t));
H5MM_xfree(file);
FUNC_LEAVE(0);
}
@ -595,15 +598,18 @@ H5FD_core_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
if (addr < file->eof) {
hsize_t nbytes = MIN(size, file->eof-addr);
memcpy(buf, file->mem + addr, nbytes);
assert(nbytes==(hsize_t)((size_t)nbytes)); /*check for overflow*/
HDmemcpy(buf, file->mem + addr, (size_t)nbytes);
size -= nbytes;
addr += nbytes;
buf = (char *)buf + nbytes;
}
/* Read zeros for the part which is after the EOF markers */
if (size > 0)
memset(buf, 0, size);
if (size > 0) {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemset(buf, 0, (size_t)size);
}
FUNC_LEAVE(SUCCEED);
}
@ -665,7 +671,8 @@ H5FD_core_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
}
/* Write from BUF to memory */
memcpy(file->mem+addr, buf, size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemcpy(file->mem+addr, buf, (size_t)size);
file->dirty = TRUE;
FUNC_LEAVE(SUCCEED);

View File

@ -404,7 +404,7 @@ static H5FD_t *
H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
unsigned o_flags;
int o_flags;
int fd;
struct stat sb;
H5FD_log_t *file=NULL;
@ -434,8 +434,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
/* Open the file */
if ((fd=HDopen(name, o_flags, 0666))<0)
HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file");
if (fstat(fd, &sb)<0) {
close(fd);
if (HDfstat(fd, &sb)<0) {
HDclose(fd);
HRETURN_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file");
}
@ -471,7 +471,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
file->nwrite=H5MM_calloc(file->iosize);
file->flavor=H5MM_calloc(file->iosize);
if(fa->logfile)
file->logfp=fopen(fa->logfile,"w");
file->logfp=HDfopen(fa->logfile,"w");
else
file->logfp=stderr;
} /* end if */
@ -689,7 +689,8 @@ printf("%s: flavor=%s, size=%lu\n",FUNC,flavors[type],(unsigned long)size);
/* Retain the (first) flavor of the information written to the file */
if(file->fa.verbosity>=0) {
assert(addr<file->iosize);
HDmemset(&file->flavor[addr],type,size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemset(&file->flavor[addr],type,(size_t)size);
if(file->fa.verbosity>1)
HDfprintf(file->logfp,"%10a-%10a (%10lu bytes) Allocated, flavor=%s\n",addr,addr+size-1,(unsigned long)size,flavors[file->flavor[addr]]);
@ -856,9 +857,10 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
* and the end of the file.
*/
while (size>0) {
do
nbytes = read(file->fd, buf, size);
while (-1==nbytes && EINTR==errno);
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
nbytes = HDread(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;
@ -867,7 +869,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
}
if (0==nbytes) {
/* end of file but not end of format address space */
memset(buf, 0, size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemset(buf, 0, (size_t)size);
size = 0;
}
assert(nbytes>=0);
@ -903,7 +906,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr,
H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
hsize_t size, const void *buf)
{
H5FD_log_t *file = (H5FD_log_t*)_file;
@ -957,9 +960,10 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
* results
*/
while (size>0) {
do
nbytes = write(file->fd, buf, size);
while (-1==nbytes && EINTR==errno);
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
nbytes = HDwrite(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;

View File

@ -469,8 +469,10 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map/*out*/,
if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id))
H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
if (H5FD_MULTI!=H5P_get_driver(fapl_id))
#ifndef WANT_H5_V1_2_COMPAT
if (H5FD_MULTI!=H5Pget_driver(fapl_id))
H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);
#endif /* WANT_H5_V1_2_COMPAT */
if (NULL==(fa=H5Pget_driver_info(fapl_id)))
H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1);
@ -586,8 +588,10 @@ H5Pget_dxpl_multi(hid_t dxpl_id, hid_t *memb_dxpl/*out*/)
if (H5P_FILE_ACCESS!=H5Pget_class(dxpl_id))
H5Epush_ret(func, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
if (H5FD_MULTI!=H5P_get_driver(dxpl_id))
#ifndef WANT_H5_V1_2_COMPAT
if (H5FD_MULTI!=H5Pget_driver(dxpl_id))
H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", -1);
#endif /* WANT_H5_V1_2_COMPAT */
if (NULL==(dx=H5Pget_driver_info(dxpl_id)))
H5Epush_ret(func, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1);
@ -642,8 +646,8 @@ H5FD_multi_sb_size(H5FD_t *_file)
/* Name templates */
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt])+1;
nbytes += (n+7) & ~0x0007;
size_t n = strlen(file->fa.memb_name[mt])+1;
nbytes += (n+7) & ~((size_t)0x0007);
} END_MEMBERS;
return nbytes;
@ -682,7 +686,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
H5FD_multi_t *file = (H5FD_multi_t*)_file;
haddr_t memb_eoa;
unsigned char *p;
int nseen;
hsize_t nseen;
size_t i;
H5FD_mem_t m;
static const char *func="H5FD_multi_sb_encode"; /* Function Name for error reporting */
@ -695,7 +699,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
assert(7==H5FD_MEM_NTYPES);
for (m=H5FD_MEM_SUPER; m<H5FD_MEM_NTYPES; m++) {
buf[m-1] = file->fa.memb_map[m];
buf[m-1] = file->fa.memb_map[m];
}
buf[7] = 0;
buf[8] = 0;
@ -710,12 +714,12 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
p = buf+8;
assert(sizeof(haddr_t)<=8);
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
memb_eoa = H5FDget_eoa(file->memb[mt]);
memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t));
p += sizeof(haddr_t);
memcpy(p, &memb_eoa, sizeof(haddr_t));
p += sizeof(haddr_t);
nseen++;
memb_eoa = H5FDget_eoa(file->memb[mt]);
memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t));
p += sizeof(haddr_t);
memcpy(p, &memb_eoa, sizeof(haddr_t));
p += sizeof(haddr_t);
nseen++;
} END_MEMBERS;
if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen*2, buf+8, NULL,
H5P_DEFAULT)<0) {
@ -725,10 +729,10 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
/* Encode all name templates */
p = buf + 8 + nseen*2*8;
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
strcpy((char *)p, file->fa.memb_name[mt]);
p += n;
for (i=n; i%8; i++) *p++ = '\0';
size_t n = strlen(file->fa.memb_name[mt]) + 1;
strcpy((char *)p, file->fa.memb_name[mt]);
p += n;
for (i=n; i%8; i++) *p++ = '\0';
} END_MEMBERS;
return 0;
@ -763,7 +767,8 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5FD_multi_t *file = (H5FD_multi_t*)_file;
char x[2*H5FD_MEM_NTYPES*8];
H5FD_mem_t map[H5FD_MEM_NTYPES];
int nseen=0, i;
int i;
hsize_t nseen=0;
hbool_t map_changed=FALSE;
hbool_t in_use[H5FD_MEM_NTYPES];
const char *memb_name[H5FD_MEM_NTYPES];
@ -781,9 +786,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
/* Set default values */
ALL_MEMBERS(mt) {
memb_addr[mt] = HADDR_UNDEF;
memb_eoa[mt] = HADDR_UNDEF;
memb_name[mt] = NULL;
memb_addr[mt] = HADDR_UNDEF;
memb_eoa[mt] = HADDR_UNDEF;
memb_name[mt] = NULL;
} END_MEMBERS;
/*
@ -792,31 +797,32 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
memset(map, 0, sizeof map);
for (i=0; i<6; i++) {
map[i+1] = (H5FD_mem_t)buf[i];
if (file->fa.memb_map[i+1]!=map[i+1]) map_changed=TRUE;
if (file->fa.memb_map[i+1]!=map[i+1])
map_changed=TRUE;
}
UNIQUE_MEMBERS(map, mt) {
nseen++;
nseen++;
} END_MEMBERS;
buf += 8;
/* Decode Address and EOA values */
assert(sizeof(haddr_t)<=8);
memcpy(x, buf, nseen*2*8);
assert((nseen*2*8)==(hsize_t)((size_t)(nseen*2*8))); /*check for overflow*/
memcpy(x, buf, (size_t)(nseen*2*8));
buf += nseen*2*8;
if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL,
H5P_DEFAULT)<0)
if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0)
H5Epush_ret(func, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
ap = (haddr_t*)x;
UNIQUE_MEMBERS(map, mt) {
memb_addr[_unmapped] = *ap++;
memb_eoa[_unmapped] = *ap++;
memb_addr[_unmapped] = *ap++;
memb_eoa[_unmapped] = *ap++;
} END_MEMBERS;
/* Decode name templates */
UNIQUE_MEMBERS(map, mt) {
size_t n = strlen((const char *)buf)+1;
memb_name[_unmapped] = (const char *)buf;
buf += (n+7) & ~0x0007;
size_t n = strlen((const char *)buf)+1;
memb_name[_unmapped] = (const char *)buf;
buf += (n+7) & ~((unsigned)0x0007);
} END_MEMBERS;
/*
@ -827,50 +833,50 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
*/
if (map_changed) {
#ifdef H5FD_MULTI_DEBUG
if (file->flags & H5F_ACC_DEBUG) {
fprintf(stderr, "H5FD_MULTI: member map override\n");
fprintf(stderr, " old value: ");
ALL_MEMBERS(mt) {
fprintf(stderr, "%s%d", mt?", ":"",
(int)(file->fa.memb_map[mt]));
} END_MEMBERS;
fprintf(stderr, "\n new value: ");
ALL_MEMBERS(mt) {
fprintf(stderr, "%s%d", mt?", ":"", (int)(map[mt]));
} END_MEMBERS;
}
if (file->flags & H5F_ACC_DEBUG) {
fprintf(stderr, "H5FD_MULTI: member map override\n");
fprintf(stderr, " old value: ");
ALL_MEMBERS(mt) {
fprintf(stderr, "%s%d", mt?", ":"", (int)(file->fa.memb_map[mt]));
} END_MEMBERS;
fprintf(stderr, "\n new value: ");
ALL_MEMBERS(mt) {
fprintf(stderr, "%s%d", mt?", ":"", (int)(map[mt]));
} END_MEMBERS;
}
#endif
/* Commit map */
ALL_MEMBERS(mt) {
file->fa.memb_map[mt] = map[mt];
} END_MEMBERS;
/* Close files which are unused now */
memset(in_use, 0, sizeof in_use);
UNIQUE_MEMBERS(map, mt) {
in_use[mt] = TRUE;
} END_MEMBERS;
ALL_MEMBERS(mt) {
if (!in_use[mt] && file->memb[mt]) {
/* Commit map */
ALL_MEMBERS(mt) {
file->fa.memb_map[mt] = map[mt];
} END_MEMBERS;
/* Close files which are unused now */
memset(in_use, 0, sizeof in_use);
UNIQUE_MEMBERS(map, mt) {
in_use[mt] = TRUE;
} END_MEMBERS;
ALL_MEMBERS(mt) {
if (!in_use[mt] && file->memb[mt]) {
#ifdef H5FD_MULTI_DEBUG
if (file->flags & H5F_ACC_DEBUG) {
fprintf(stderr, "H5FD_MULTI: close member %d\n", (int)mt);
}
if (file->flags & H5F_ACC_DEBUG) {
fprintf(stderr, "H5FD_MULTI: close member %d\n", (int)mt);
}
#endif
H5FDclose(file->memb[mt]);
file->memb[mt] = NULL;
}
file->fa.memb_map[mt] = map[mt];
} END_MEMBERS;
H5FDclose(file->memb[mt]);
file->memb[mt] = NULL;
}
file->fa.memb_map[mt] = map[mt];
} END_MEMBERS;
}
/* Commit member starting addresses and name templates */
ALL_MEMBERS(mt) {
file->fa.memb_addr[mt] = memb_addr[mt];
if (memb_name[mt]) {
if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]);
file->fa.memb_name[mt] = my_strdup(memb_name[mt]);
}
file->fa.memb_addr[mt] = memb_addr[mt];
if (memb_name[mt]) {
if (file->fa.memb_name[mt])
free(file->fa.memb_name[mt]);
file->fa.memb_name[mt] = my_strdup(memb_name[mt]);
}
} END_MEMBERS;
if (compute_next(file)<0)
H5Epush_ret(func, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1);
@ -881,9 +887,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
/* Set the EOA marker for all open files */
UNIQUE_MEMBERS(file->fa.memb_map, mt) {
if (file->memb[mt]) {
H5FDset_eoa(file->memb[mt], memb_eoa[mt]);
}
if (file->memb[mt]) {
H5FDset_eoa(file->memb[mt], memb_eoa[mt]);
}
} END_MEMBERS;
return 0;
@ -1134,7 +1140,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id,
*/
if (NULL==(file=calloc(1, sizeof(H5FD_multi_t))))
H5Epush_ret(func, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
if (H5P_DEFAULT==fapl_id || H5FD_MULTI!=H5P_get_driver(fapl_id)) {
if (H5P_DEFAULT==fapl_id || H5FD_MULTI!=H5Pget_driver(fapl_id)) {
close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE);
}
@ -1579,7 +1585,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
H5Eclear();
/* Get the data transfer properties */
if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5P_get_driver(dxpl_id)) {
if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) {
dx = H5Pget_driver_info(dxpl_id);
}
@ -1634,7 +1640,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hs
H5Eclear();
/* Get the data transfer properties */
if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5P_get_driver(dxpl_id)) {
if (H5P_DEFAULT!=dxpl_id && H5FD_MULTI==H5Pget_driver(dxpl_id)) {
dx = H5Pget_driver_info(dxpl_id);
}

View File

@ -264,7 +264,7 @@ static H5FD_t *
H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
haddr_t maxaddr)
{
unsigned o_flags;
int o_flags;
int fd;
struct stat sb;
H5FD_sec2_t *file=NULL;
@ -579,9 +579,10 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
* and the end of the file.
*/
while (size>0) {
do
nbytes = read(file->fd, buf, size);
while (-1==nbytes && EINTR==errno);
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
nbytes = HDread(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;
@ -590,7 +591,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
}
if (0==nbytes) {
/* end of file but not end of format address space */
memset(buf, 0, size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemset(buf, 0, (size_t)size);
size = 0;
}
assert(nbytes>=0);
@ -659,9 +661,10 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
* results
*/
while (size>0) {
do
nbytes = write(file->fd, buf, size);
while (-1==nbytes && EINTR==errno);
do {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
nbytes = HDwrite(file->fd, buf, (size_t)size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) {
/* error */
file->pos = HADDR_UNDEF;

View File

@ -608,7 +608,8 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
if (0 == size)
return(0);
if ((haddr_t)addr >= file->eof) {
memset(buf, 0, size);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
memset(buf, 0, (size_t)size);
return(0);
}
@ -649,13 +650,15 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi
* will advance the file position by N. If N is negative or an error
* occurs then the file position is undefined.
*/
n = fread(buf, 1, size, file->fp);
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
n = fread(buf, 1, (size_t)size, file->fp);
if (n <= 0 && ferror(file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_IO, H5E_READERROR, "fread failed", -1);
} else if (n < size) {
memset((unsigned char *)buf + n, 0, size - n);
assert((size-n)==(hsize_t)((size_t)(size-n))); /*check for overflow*/
memset((unsigned char *)buf + n, 0, (size_t)(size - n));
}
/*
@ -740,7 +743,8 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
* advanced by the number of bytes read. Otherwise nobody knows where it
* is.
*/
if (size != fwrite(buf, 1, size, file->fp)) {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
if (size != fwrite(buf, 1, (size_t)size, file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1);

View File

@ -374,7 +374,7 @@ static void *H5FD_stream_fapl_get (H5FD_t *_stream)
static H5FD_STREAM_SOCKET_TYPE
H5FDstream_open_socket (const char *filename, int o_flags,
unsigned int backlog,
int backlog,
const char **errormsg,
H5E_major_t *major, H5E_minor_t *minor)
{
@ -419,7 +419,7 @@ H5FDstream_open_socket (const char *filename, int o_flags,
return (sock);
}
hostname = (char *) H5MM_malloc (separator - filename + 1);
hostname = (char *) H5MM_malloc ((size_t)(separator - filename + 1));
/* Return if out of memory */
if (hostname == NULL)
@ -429,11 +429,11 @@ H5FDstream_open_socket (const char *filename, int o_flags,
return (sock);
}
strncpy (hostname, filename, separator - filename);
HDstrncpy (hostname, filename, (size_t)(separator - filename));
hostname[separator - filename] = 0;
port = atoi (separator + 1);
memset (&server, 0, sizeof (server));
HDmemset (&server, 0, sizeof (server));
server.sin_family = AF_INET;
server.sin_port = htons (port);
@ -450,7 +450,7 @@ H5FDstream_open_socket (const char *filename, int o_flags,
{
if (O_RDONLY == o_flags)
{
memcpy (&server.sin_addr, he->h_addr, he->h_length);
HDmemcpy (&server.sin_addr, he->h_addr, (size_t)he->h_length);
#ifdef DEBUG
fprintf (stderr, "Stream VFD: connecting to host '%s' port %d\n",
hostname, port);
@ -545,7 +545,7 @@ static void H5FDstream_read_from_socket (H5FD_stream_t *stream,
}
/* now receive the next chunk of data */
size = recv (stream->socket, ptr, (int) max_size, 0);
size = recv (stream->socket, ptr, max_size, 0);
if (size < 0 && (EINTR == errno || EAGAIN == errno || EWOULDBLOCK))
{
@ -657,7 +657,7 @@ static H5FD_t *H5FD_stream_open (const char *filename,
}
/* zero out file structure and set file access property list */
memset (&_stream, 0, sizeof (_stream));
HDmemset (&_stream, 0, sizeof (_stream));
_stream.fapl = *fapl;
errormsg = NULL;
@ -781,8 +781,8 @@ static H5FD_t *H5FD_stream_open (const char *filename,
static herr_t H5FD_stream_flush (H5FD_t *_stream)
{
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
int size;
int bytes_send;
size_t size;
ssize_t bytes_send;
int on = 1;
unsigned char *ptr;
struct sockaddr from;
@ -808,7 +808,7 @@ static herr_t H5FD_stream_flush (H5FD_t *_stream)
continue; /* continue the loop for other clients' requests */
}
size = (int) stream->eof;
size = stream->eof;
ptr = stream->mem;
while (size)
@ -878,7 +878,7 @@ static herr_t H5FD_stream_close (H5FD_t *_stream)
{
H5MM_xfree (stream->mem);
}
memset (stream, 0, sizeof (H5FD_stream_t));
HDmemset (stream, 0, sizeof (H5FD_stream_t));
H5MM_xfree (stream);
FUNC_LEAVE (0);
@ -1006,7 +1006,6 @@ static haddr_t H5FD_stream_get_eof (H5FD_t *_stream)
{
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
FUNC_ENTER (H5FD_stream_get_eof, HADDR_UNDEF);
FUNC_LEAVE (MAX (stream->eof, stream->eoa));
@ -1042,7 +1041,6 @@ static herr_t H5FD_stream_read (H5FD_t *_stream,
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
ssize_t nbytes;
FUNC_ENTER (H5FD_stream_read, FAIL);
assert (stream && stream->pub.cls);
@ -1066,7 +1064,7 @@ static herr_t H5FD_stream_read (H5FD_t *_stream,
if (addr < stream->eof)
{
nbytes = (ssize_t) MIN (size, stream->eof - addr);
memcpy (buf, stream->mem + addr, (size_t) nbytes);
HDmemcpy (buf, stream->mem + addr, (size_t) nbytes);
size -= nbytes;
addr += nbytes;
buf = (char *) buf + nbytes;
@ -1075,7 +1073,7 @@ static herr_t H5FD_stream_read (H5FD_t *_stream,
/* Read zeros for the part which is after the EOF markers */
if (size > 0)
{
memset (buf, 0, (size_t) size);
HDmemset (buf, 0, (size_t) size);
}
FUNC_LEAVE (SUCCEED);
@ -1159,7 +1157,7 @@ static herr_t H5FD_stream_write (H5FD_t *_stream,
}
/* Write from BUF to memory */
memcpy (stream->mem + addr, buf, (size_t) size);
HDmemcpy (stream->mem + addr, buf, (size_t) size);
stream->dirty = TRUE;
FUNC_LEAVE (SUCCEED);

View File

@ -62,7 +62,7 @@ typedef struct H5FD_stream_fapl_t
size_t increment; /* how much to grow memory in reallocs */
H5FD_STREAM_SOCKET_TYPE socket; /* external socket descriptor */
hbool_t do_socket_io; /* do I/O on socket */
unsigned int backlog; /* backlog argument for listen call */
int backlog; /* backlog argument for listen call */
H5FD_stream_broadcast_t broadcast_fn; /* READ broadcast callback */
void *broadcast_arg; /* READ broadcast callback user argument*/
} H5FD_stream_fapl_t;

View File

@ -123,19 +123,20 @@ H5FL_DEFINE(H5FL_blk_node_t);
*-------------------------------------------------------------------------
*/
static void *
H5FL_malloc(size_t mem_size)
H5FL_malloc(hsize_t mem_size)
{
void *ret_value=NULL; /* return value*/
FUNC_ENTER (H5FL_malloc, NULL);
/* Attempt to allocate the memory requested */
if(NULL==(ret_value=H5MM_malloc(mem_size))) {
assert(mem_size==(hsize_t)((size_t)mem_size)); /*check for overflow*/
if(NULL==(ret_value=H5MM_malloc((size_t)mem_size))) {
/* If we can't allocate the memory now, try garbage collecting first */
H5FL_garbage_coll();
/* Now try allocating the memory again */
if(NULL==(ret_value=H5MM_malloc(mem_size)))
if(NULL==(ret_value=H5MM_malloc((size_t)mem_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk");
} /* end if */
@ -331,8 +332,10 @@ H5FL_reg_alloc(H5FL_reg_head_t *head, uintn clear)
} /* end else */
/* Clear to zeros, if asked */
if(clear)
HDmemset(ret_value,0,head->size);
if(clear) {
assert(head->size==(hsize_t)((size_t)head->size)); /*check for overflow*/
HDmemset(ret_value,0,(size_t)head->size);
} /* end if */
#endif /* NO_REG_FREE_LISTS */
FUNC_LEAVE (ret_value);
@ -531,7 +534,7 @@ H5FL_reg_term(void)
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
H5FL_blk_find_list(H5FL_blk_node_t **head, hsize_t size)
{
H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */
H5FL_blk_node_t *ret_value=NULL;
@ -585,7 +588,7 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
*-------------------------------------------------------------------------
*/
static H5FL_blk_node_t *
H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size)
H5FL_blk_create_list(H5FL_blk_node_t **head, hsize_t size)
{
H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */
H5FL_blk_node_t *ret_value=NULL;
@ -734,8 +737,10 @@ H5FL_blk_alloc(H5FL_blk_head_t *head, hsize_t size, uintn clear)
} /* end else */
/* Clear the block to zeros, if requested */
if(clear)
HDmemset(ret_value,0,size);
if(clear) {
assert(size==(hsize_t)((size_t)size)); /*check for overflow*/
HDmemset(ret_value,0,(size_t)size);
} /* end if */
#endif /* NO_BLK_FREE_LISTS */
done:
@ -841,7 +846,8 @@ printf("%s: head->name=%s, garbage collecting all block lists\n",FUNC,head->name
void *
H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size)
{
H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */
hsize_t blk_size; /* Temporary block size */
H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */
void *ret_value=NULL; /* Return value */
FUNC_ENTER(H5FL_blk_realloc, NULL);
@ -861,7 +867,9 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, hsize_t new_size)
if(new_size!=temp->size) {
if((ret_value=H5FL_blk_alloc(head,new_size,0))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block");
HDmemcpy(ret_value,block,MIN(new_size,temp->size));
blk_size=MIN(new_size,temp->size);
assert(blk_size==(hsize_t)((size_t)blk_size)); /*check for overflow*/
HDmemcpy(ret_value,block,(size_t)blk_size);
H5FL_blk_free(head,block);
} /* end if */
else
@ -1196,7 +1204,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear)
{
H5FL_arr_node_t *new_obj; /* Pointer to the new free list node allocated */
void *ret_value; /* Pointer to object to return */
size_t mem_size; /* Size of memory block being recycled */
hsize_t mem_size; /* Size of memory block being recycled */
FUNC_ENTER (H5FL_arr_alloc, NULL);
@ -1251,8 +1259,10 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear)
} /* end else */
/* Clear to zeros, if asked */
if(clear)
HDmemset(ret_value,0,mem_size);
if(clear) {
assert(mem_size==(hsize_t)((size_t)mem_size)); /*check for overflow*/
HDmemset(ret_value,0,(size_t)mem_size);
} /* end if */
} /* end if */
/* No fixed number of elements, use PQ routine */
else {
@ -1282,6 +1292,7 @@ H5FL_arr_alloc(H5FL_arr_head_t *head, hsize_t elem, uintn clear)
void *
H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, hsize_t new_elem)
{
hsize_t blk_size; /* Size of block */
H5FL_arr_node_t *temp; /* Temp. ptr to the new free list node allocated */
void *ret_value; /* Pointer to object to return */
@ -1309,7 +1320,9 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, hsize_t new_elem)
ret_value=H5FL_arr_alloc(head,new_elem,0);
/* Copy the appropriate amount of elements */
HDmemcpy(ret_value,obj,head->size*MIN(temp->nelem,new_elem));
blk_size=head->size*MIN(temp->nelem,new_elem);
assert(blk_size==(hsize_t)((size_t)blk_size)); /*check for overflow*/
HDmemcpy(ret_value,obj,(size_t)blk_size);
/* Free the old block */
H5FL_arr_free(head,obj);

View File

@ -47,7 +47,7 @@ typedef struct H5FL_reg_head_t {
uintn onlist; /* Number of blocks on free list */
size_t list_mem; /* Amount of memory on free list */
const char *name; /* Name of the type */
size_t size; /* Size of the blocks in the list */
hsize_t size; /* Size of the blocks in the list */
H5FL_reg_node_t *list; /* List of free blocks */
} H5FL_reg_head_t;
@ -75,7 +75,7 @@ typedef struct H5FL_reg_head_t {
/* Data structure to store each block in free list */
typedef struct H5FL_blk_list_t {
size_t size; /* Size of the page */
hsize_t size; /* Size of the page */
struct H5FL_blk_list_t *next; /* Pointer to next block in free list */
union {
double unused1; /* Unused normally, just here for aligment */
@ -85,7 +85,7 @@ typedef struct H5FL_blk_list_t {
/* Data structure for priority queue node of block free lists */
typedef struct H5FL_blk_node_t {
size_t size; /* Size of the blocks in the list */
hsize_t size; /* Size of the blocks in the list */
H5FL_blk_list_t *list; /* List of free blocks */
struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */
struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */
@ -96,7 +96,7 @@ typedef struct H5FL_blk_head_t {
uintn init; /* Whether the free list has been initialized */
uintn allocated; /* Number of blocks allocated */
uintn onlist; /* Number of blocks on free list */
size_t list_mem; /* Amount of memory in block on free list */
hsize_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
H5FL_blk_node_t *head; /* Pointer to first free list in queue */
} H5FL_blk_head_t;
@ -125,7 +125,7 @@ typedef struct H5FL_blk_head_t {
/* Data structure to store each array in free list */
typedef struct H5FL_arr_node_t {
struct H5FL_arr_node_t *next; /* Pointer to next block in free list */
size_t nelem; /* Number of elements in this array */
hsize_t nelem; /* Number of elements in this array */
union {
double unused1; /* Unused normally, just here for aligment */
haddr_t unused2; /* Unused normally, just here for aligment */
@ -137,10 +137,10 @@ typedef struct H5FL_arr_head_t {
uintn init; /* Whether the free list has been initialized */
uintn allocated; /* Number of blocks allocated */
uintn *onlist; /* Number of blocks on free list */
size_t list_mem; /* Amount of memory in block on free list */
hsize_t list_mem; /* Amount of memory in block on free list */
const char *name; /* Name of the type */
intn maxelem; /* Maximum number of elements in an array */
size_t size; /* Size of the array elements in the list */
hsize_t size; /* Size of the array elements in the list */
union {
H5FL_arr_node_t **list_arr; /* Array of lists of free blocks */
H5FL_blk_head_t queue; /* Priority queue of array blocks */

View File

@ -53,7 +53,7 @@ static intn interface_initialize_g = 0;
herr_t
H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
{
intn i;
uintn u;
hsize_t nbytes;
FUNC_ENTER (H5F_arr_create, FAIL);
@ -64,28 +64,29 @@ H5F_arr_create (H5F_t *f, struct H5O_layout_t *layout/*in,out*/)
layout->addr = HADDR_UNDEF; /*just in case we fail*/
switch (layout->type) {
case H5D_CONTIGUOUS:
/* Reserve space in the file for the entire array */
for (i=0, nbytes=1; i<layout->ndims; i++) nbytes *= layout->dim[i];
assert (nbytes>0);
if (HADDR_UNDEF==(layout->addr=H5MF_alloc(f, H5FD_MEM_DRAW, nbytes))) {
HRETURN_ERROR (H5E_IO, H5E_NOSPACE, FAIL,
"unable to reserve file space");
}
break;
case H5D_CONTIGUOUS:
/* Reserve space in the file for the entire array */
for (u=0, nbytes=1; u<layout->ndims; u++)
nbytes *= layout->dim[u];
assert (nbytes>0);
if (HADDR_UNDEF==(layout->addr=H5MF_alloc(f, H5FD_MEM_DRAW, nbytes))) {
HRETURN_ERROR (H5E_IO, H5E_NOSPACE, FAIL,
"unable to reserve file space");
}
break;
case H5D_CHUNKED:
/* Create the root of the B-tree that describes chunked storage */
if (H5F_istore_create (f, layout/*out*/)<0) {
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL,
"unable to initialize chunked storage");
}
break;
case H5D_CHUNKED:
/* Create the root of the B-tree that describes chunked storage */
if (H5F_istore_create (f, layout/*out*/)<0) {
HRETURN_ERROR (H5E_IO, H5E_CANTINIT, FAIL,
"unable to initialize chunked storage");
}
break;
default:
assert ("not implemented yet" && 0);
HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
default:
assert ("not implemented yet" && 0);
HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
}
FUNC_LEAVE (SUCCEED);
@ -141,9 +142,10 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
hsize_t file_start; /*byte offset to start */
hsize_t elmt_size = 1; /*bytes per element */
size_t nelmts, z; /*number of elements */
intn ndims; /*stride dimensionality */
uintn ndims; /*stride dimensionality */
haddr_t addr; /*address in file */
intn i, j; /*counters */
intn j; /*counters */
uintn u; /*counters */
hbool_t carray; /*carry for subtraction */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT;
@ -193,166 +195,168 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
if(qak_debug) {
printf("%s: layout->ndims=%d\n",FUNC,(int)layout->ndims);
for(i=0; i<layout->ndims; i++)
printf("%s: %d: hslab_size=%d, mem_size=%d, mem_offset=%d, file_offset=%d\n",FUNC,i,(int)_hslab_size[i],(int)mem_size[i],(int)mem_offset[i],(int)file_offset[i]);
for(u=0; u<layout->ndims; u++)
printf("%s: %u: hslab_size=%d, mem_size=%d, mem_offset=%d, file_offset=%d\n",FUNC,u,(int)_hslab_size[u],(int)mem_size[u],(int)mem_offset[u],(int)file_offset[u]);
printf("%s: *buf=%d, *(buf+1)=%d\n", FUNC,(int)*(const uint16_t *)buf,(int)*((const uint16 *)buf+1));
}
}
#endif /* QAK */
switch (layout->type) {
case H5D_CONTIGUOUS:
ndims = layout->ndims;
/*
* Offsets must not be negative for this type of storage.
*/
for (i=0; i<ndims; i++) {
if (mem_offset[i]<0 || file_offset[i]<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"negative offsets are not valid");
}
}
case H5D_CONTIGUOUS:
ndims = layout->ndims;
/*
* Offsets must not be negative for this type of storage.
*/
for (u=0; u<ndims; u++) {
if (mem_offset[u]<0 || file_offset[u]<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"negative offsets are not valid");
}
}
/*
* Filters cannot be used for contiguous data.
*/
if (pline && pline->nfilters>0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"filters are not allowed for contiguous data");
}
/*
* Calculate the strides needed to walk through the array on disk
* and memory. Optimize the strides to result in the fewest number of
* I/O requests.
*/
mem_start = H5V_hyper_stride(ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride(ndims, hslab_size, layout->dim,
file_offset, file_stride/*out*/);
H5V_stride_optimize2(&ndims, &elmt_size, hslab_size,
mem_stride, file_stride);
/*
* Filters cannot be used for contiguous data.
*/
if (pline && pline->nfilters>0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"filters are not allowed for contiguous data");
}
/*
* Calculate the strides needed to walk through the array on disk
* and memory. Optimize the strides to result in the fewest number of
* I/O requests.
*/
mem_start = H5V_hyper_stride(ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride(ndims, hslab_size, layout->dim,
file_offset, file_stride/*out*/);
H5V_stride_optimize2(&ndims, &elmt_size, hslab_size,
mem_stride, file_stride);
/*
* Initialize loop variables. The loop is a multi-dimensional loop
* that counts from SIZE down to zero and IDX is the counter. Each
* element of IDX is treated as a digit with IDX[0] being the least
* significant digit.
*/
H5V_vector_cpy(ndims, idx, hslab_size);
nelmts = H5V_vector_reduce_product(ndims, hslab_size);
if (efl && efl->nused>0) {
addr = 0;
} else {
addr = layout->addr;
}
addr += file_start;
buf += mem_start;
/*
* Initialize loop variables. The loop is a multi-dimensional loop
* that counts from SIZE down to zero and IDX is the counter. Each
* element of IDX is treated as a digit with IDX[0] being the least
* significant digit.
*/
H5V_vector_cpy(ndims, idx, hslab_size);
nelmts = H5V_vector_reduce_product(ndims, hslab_size);
if (efl && efl->nused>0) {
addr = 0;
} else {
addr = layout->addr;
}
addr += file_start;
buf += mem_start;
/*
* Now begin to walk through the array, copying data from disk to
* memory.
*/
/*
* Now begin to walk through the array, copying data from disk to
* memory.
*/
#ifdef H5_HAVE_PARALLEL
if (H5FD_MPIO_COLLECTIVE==xfer_mode){
/*
* Currently supports same number of collective access. Need to
* be changed LATER to combine all reads into one collective MPIO
* call.
*/
unsigned long max, min, temp;
if (H5FD_MPIO_COLLECTIVE==xfer_mode){
/*
* Currently supports same number of collective access. Need to
* be changed LATER to combine all reads into one collective MPIO
* call.
*/
unsigned long max, min, temp;
temp = nelmts;
assert(temp==nelmts); /* verify no overflow */
MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX,
H5FD_mpio_communicator(f->shared->lf));
MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN,
H5FD_mpio_communicator(f->shared->lf));
temp = nelmts;
assert(temp==nelmts); /* verify no overflow */
MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX,
H5FD_mpio_communicator(f->shared->lf));
MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN,
H5FD_mpio_communicator(f->shared->lf));
#ifdef AKC
printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max);
printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max);
#endif
if (max != min)
HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
"collective access with unequal number of "
"blocks not supported yet");
}
if (max != min)
HRETURN_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
"collective access with unequal number of "
"blocks not supported yet");
}
#endif
#ifdef COALESCE_READS
/* Get the dataset transfer property list */
if (H5P_DEFAULT == dxpl_id) {
xfer_parms = &H5D_xfer_dflt;
} else if (H5P_DATASET_XFER != H5P_get_class (dxpl_id) ||
NULL == (xfer_parms = H5I_object (dxpl_id))) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
}
/* Get the dataset transfer property list */
if (H5P_DEFAULT == dxpl_id) {
xfer_parms = &H5D_xfer_dflt;
} else if (H5P_DATASET_XFER != H5P_get_class (dxpl_id) ||
NULL == (xfer_parms = H5I_object (dxpl_id))) {
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms");
}
for (z=0, xfer_parms->gather_reads = nelmts - 1;
z<nelmts;
z++, xfer_parms->gather_reads--) {
for (z=0, xfer_parms->gather_reads = nelmts - 1;
z<nelmts;
z++, xfer_parms->gather_reads--) {
#else
#ifdef QAK
printf("%s: nelmts=%d, addr=%lu, elmt_size=%lu\n",FUNC,(int)nelmts,(unsigned long)addr,(unsigned long)elmt_size);
printf("%s: sieve_buf=%p, sieve_loc=%lu, sieve_size=%lu, sieve_buf_size=%lu, sieve_dirty=%u\n",FUNC,f->shared->sieve_buf,(unsigned long)f->shared->sieve_loc,(unsigned long)f->shared->sieve_size,(unsigned long)f->shared->sieve_buf_size,(unsigned)f->shared->sieve_dirty);
printf("%s: feature_flags=%lx\n",FUNC,(unsigned long)f->shared->lf->feature_flags);
printf("%s: nelmts=%d, addr=%lu, elmt_size=%lu\n",FUNC,(int)nelmts,(unsigned long)addr,(unsigned long)elmt_size);
printf("%s: sieve_buf=%p, sieve_loc=%lu, sieve_size=%lu, sieve_buf_size=%lu, sieve_dirty=%u\n",FUNC,f->shared->sieve_buf,(unsigned long)f->shared->sieve_loc,(unsigned long)f->shared->sieve_size,(unsigned long)f->shared->sieve_buf_size,(unsigned)f->shared->sieve_dirty);
printf("%s: feature_flags=%lx\n",FUNC,(unsigned long)f->shared->lf->feature_flags);
#endif /* QAK */
for (z=0; z<nelmts; z++) {
for (z=0; z<nelmts; z++) {
#endif
/* Read directly from file if the dataset is in an external file */
/* Note: We can't use data sieve buffers for datasets in external files
* because the 'addr' of all external files is set to 0 (above) and
* all datasets in external files would alias to the same set of
* file offsets, totally mixing up the data sieve buffer information. -QAK
*/
if (efl && efl->nused>0) {
if (H5O_efl_read(f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"external data read failed");
/* Read directly from file if the dataset is in an external file */
/* Note: We can't use data sieve buffers for datasets in external files
* because the 'addr' of all external files is set to 0 (above) and
* all datasets in external files would alias to the same set of
* file offsets, totally mixing up the data sieve buffer information. -QAK
*/
if (efl && efl->nused>0) {
if (H5O_efl_read(f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"external data read failed");
}
} else {
if (H5F_contig_read(f, H5FD_MEM_DRAW, addr, elmt_size, dxpl_id, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"block read failed");
}
} /* end else */
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
addr += file_stride[j];
buf += mem_stride[j];
if (--idx[j])
carray = FALSE;
else
idx[j] = hslab_size[j];
}
}
} else {
if (H5F_contig_read(f, H5FD_MEM_DRAW, addr, elmt_size, dxpl_id, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"block read failed");
break;
case H5D_CHUNKED:
/*
* This method is unable to access external raw data files or to copy
* into a proper hyperslab.
*/
if (efl && efl->nused>0) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"chunking and external files are mutually exclusive");
}
} /* end else */
for (u=0; u<layout->ndims; u++) {
if (0!=mem_offset[u] || hslab_size[u]!=mem_size[u]) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unable to copy into a proper hyperslab");
}
}
if (H5F_istore_read(f, dxpl_id, layout, pline, fill, file_offset,
hslab_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "chunked read failed");
}
break;
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
addr += file_stride[j];
buf += mem_stride[j];
if (--idx[j]) carray = FALSE;
else idx[j] = hslab_size[j];
}
}
break;
case H5D_CHUNKED:
/*
* This method is unable to access external raw data files or to copy
* into a proper hyperslab.
*/
if (efl && efl->nused>0) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"chunking and external files are mutually exclusive");
}
for (i=0; i<layout->ndims; i++) {
if (0!=mem_offset[i] || hslab_size[i]!=mem_size[i]) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unable to copy into a proper hyperslab");
}
}
if (H5F_istore_read(f, dxpl_id, layout, pline, fill, file_offset,
hslab_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL, "chunked read failed");
}
break;
default:
assert("not implemented yet" && 0);
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
default:
assert("not implemented yet" && 0);
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
}
FUNC_LEAVE(SUCCEED);
@ -409,9 +413,10 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
hsize_t file_start; /*byte offset to start */
hsize_t elmt_size = 1; /*bytes per element */
size_t nelmts, z; /*number of elements */
intn ndims; /*dimensionality */
uintn ndims; /*dimensionality */
haddr_t addr; /*address in file */
intn i, j; /*counters */
intn j; /*counters */
uintn u; /*counters */
hbool_t carray; /*carry for subtraction */
#ifdef H5_HAVE_PARALLEL
H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT;
@ -469,138 +474,140 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
#endif /* QAK */
switch (layout->type) {
case H5D_CONTIGUOUS:
ndims = layout->ndims;
/*
* Offsets must not be negative for this type of storage.
*/
for (i=0; i<ndims; i++) {
if (mem_offset[i]<0 || file_offset[i]<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"negative offsets are not valid");
}
}
/*
* Filters cannot be used for contiguous data
*/
if (pline && pline->nfilters>0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"filters are not allowed for contiguous data");
}
/*
* Calculate the strides needed to walk through the array on disk.
* Optimize the strides to result in the fewest number of I/O
* requests.
*/
mem_start = H5V_hyper_stride(ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride(ndims, hslab_size, layout->dim,
file_offset, file_stride/*out*/);
H5V_stride_optimize2(&ndims, &elmt_size, hslab_size,
mem_stride, file_stride);
/*
* Initialize loop variables. The loop is a multi-dimensional loop
* that counts from SIZE down to zero and IDX is the counter. Each
* element of IDX is treated as a digit with IDX[0] being the least
* significant digit.
*/
H5V_vector_cpy(ndims, idx, hslab_size);
nelmts = H5V_vector_reduce_product(ndims, hslab_size);
if (efl && efl->nused>0) {
addr = 0;
} else {
addr = layout->addr;
}
addr += file_start;
buf += mem_start;
/*
* Now begin to walk through the array, copying data from memory to
* disk.
*/
#ifdef H5_HAVE_PARALLEL
if (H5FD_MPIO_COLLECTIVE==xfer_mode){
/*
* Currently supports same number of collective access. Need to
* be changed LATER to combine all writes into one collective
* MPIO call.
*/
unsigned long max, min, temp;
temp = nelmts;
assert(temp==nelmts); /* verify no overflow */
MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX,
H5FD_mpio_communicator(f->shared->lf));
MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN,
H5FD_mpio_communicator(f->shared->lf));
#ifdef AKC
printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max);
#endif
if (max != min) {
HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL,
"collective access with unequal number of "
"blocks not supported yet");
}
}
#endif
for (z=0; z<nelmts; z++) {
/* Write to file */
if (efl && efl->nused>0) {
if (H5O_efl_write(f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"external data write failed");
case H5D_CONTIGUOUS:
ndims = layout->ndims;
/*
* Offsets must not be negative for this type of storage.
*/
for (u=0; u<ndims; u++) {
if (mem_offset[u]<0 || file_offset[u]<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"negative offsets are not valid");
}
}
} else {
if (H5F_contig_write(f, H5FD_MEM_DRAW, addr, elmt_size, dxpl_id, buf)<0) {
/*
* Filters cannot be used for contiguous data
*/
if (pline && pline->nfilters>0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
"filters are not allowed for contiguous data");
}
} /* end else */
/*
* Calculate the strides needed to walk through the array on disk.
* Optimize the strides to result in the fewest number of I/O
* requests.
*/
mem_start = H5V_hyper_stride(ndims, hslab_size, mem_size,
mem_offset, mem_stride/*out*/);
file_start = H5V_hyper_stride(ndims, hslab_size, layout->dim,
file_offset, file_stride/*out*/);
H5V_stride_optimize2(&ndims, &elmt_size, hslab_size,
mem_stride, file_stride);
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
addr += file_stride[j];
buf += mem_stride[j];
if (--idx[j]) carray = FALSE;
else idx[j] = hslab_size[j];
}
/*
* Initialize loop variables. The loop is a multi-dimensional loop
* that counts from SIZE down to zero and IDX is the counter. Each
* element of IDX is treated as a digit with IDX[0] being the least
* significant digit.
*/
H5V_vector_cpy(ndims, idx, hslab_size);
nelmts = H5V_vector_reduce_product(ndims, hslab_size);
if (efl && efl->nused>0) {
addr = 0;
} else {
addr = layout->addr;
}
addr += file_start;
buf += mem_start;
}
break;
/*
* Now begin to walk through the array, copying data from memory to
* disk.
*/
#ifdef H5_HAVE_PARALLEL
if (H5FD_MPIO_COLLECTIVE==xfer_mode){
/*
* Currently supports same number of collective access. Need to
* be changed LATER to combine all writes into one collective
* MPIO call.
*/
unsigned long max, min, temp;
case H5D_CHUNKED:
/*
* This method is unable to access external raw data files or to copy
* from a proper hyperslab.
*/
if (efl && efl->nused>0) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"chunking and external files are mutually "
"exclusive");
}
for (i=0; i<layout->ndims; i++) {
if (0!=mem_offset[i] || hslab_size[i]!=mem_size[i]) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unable to copy from a proper hyperslab");
}
}
if (H5F_istore_write(f, dxpl_id, layout, pline, fill, file_offset,
hslab_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"chunked write failed");
}
break;
temp = nelmts;
assert(temp==nelmts); /* verify no overflow */
MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX,
H5FD_mpio_communicator(f->shared->lf));
MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN,
H5FD_mpio_communicator(f->shared->lf));
#ifdef AKC
printf("nelmts=%lu, min=%lu, max=%lu\n", temp, min, max);
#endif
if (max != min) {
HRETURN_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL,
"collective access with unequal number of "
"blocks not supported yet");
}
}
#endif
default:
assert("not implemented yet" && 0);
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
for (z=0; z<nelmts; z++) {
/* Write to file */
if (efl && efl->nused>0) {
if (H5O_efl_write(f, efl, addr, elmt_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_READERROR, FAIL,
"external data write failed");
}
} else {
if (H5F_contig_write(f, H5FD_MEM_DRAW, addr, elmt_size, dxpl_id, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"block write failed");
}
} /* end else */
/* Decrement indices and advance pointers */
for (j=ndims-1, carray=TRUE; j>=0 && carray; --j) {
addr += file_stride[j];
buf += mem_stride[j];
if (--idx[j])
carray = FALSE;
else
idx[j] = hslab_size[j];
}
}
break;
case H5D_CHUNKED:
/*
* This method is unable to access external raw data files or to copy
* from a proper hyperslab.
*/
if (efl && efl->nused>0) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"chunking and external files are mutually "
"exclusive");
}
for (u=0; u<layout->ndims; u++) {
if (0!=mem_offset[u] || hslab_size[u]!=mem_size[u]) {
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unable to copy from a proper hyperslab");
}
}
if (H5F_istore_write(f, dxpl_id, layout, pline, fill, file_offset,
hslab_size, buf)<0) {
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL,
"chunked write failed");
}
break;
default:
assert("not implemented yet" && 0);
HRETURN_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL,
"unsupported storage layout");
}
FUNC_LEAVE (SUCCEED);

View File

@ -151,7 +151,8 @@ H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxp
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(f->shared->sieve_buf=H5MM_malloc(f->shared->sieve_buf_size))) {
assert(f->shared->sieve_buf_size==(hsize_t)((size_t)f->shared->sieve_buf_size)); /*check for overflow*/
if (NULL==(f->shared->sieve_buf=H5MM_malloc((size_t)f->shared->sieve_buf_size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -325,7 +326,8 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size,
} /* end if */
else {
/* Allocate room for the data sieve buffer */
if (NULL==(f->shared->sieve_buf=H5MM_malloc(f->shared->sieve_buf_size))) {
assert(f->shared->sieve_buf_size==(hsize_t)((size_t)f->shared->sieve_buf_size)); /*check for overflow*/
if (NULL==(f->shared->sieve_buf=H5MM_malloc((size_t)f->shared->sieve_buf_size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}

File diff suppressed because it is too large Load Diff

View File

@ -204,9 +204,5 @@ __DLL__ herr_t H5F_contig_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t
__DLL__ herr_t H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr,
hsize_t size, hid_t dxpl_id, const void *buf);
/* Functions for allocation/releasing chunks */
__DLL__ void * H5F_istore_chunk_alloc(size_t chunk_size);
__DLL__ void * H5F_istore_chunk_realloc(void *chunk, size_t new_size);
#endif

View File

@ -342,20 +342,22 @@ __DLL__ herr_t H5F_seq_read(H5F_t *f, hid_t dxpl_id,
const struct H5O_layout_t *layout, const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len,
hssize_t file_offset, void *_buf/*out*/);
hsize_t file_offset, void *_buf/*out*/);
__DLL__ herr_t H5F_seq_write (H5F_t *f, hid_t dxpl_id,
const struct H5O_layout_t *layout, const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
const struct H5S_t *file_space, size_t elmt_size, hsize_t seq_len,
hssize_t file_offset, const void *_buf);
hsize_t file_offset, const void *_buf);
/* Functions that operate on indexed storage */
__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, int ndims, haddr_t addr);
__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, int ndims,
__DLL__ hsize_t H5F_istore_allocated(H5F_t *f, uintn ndims, haddr_t addr);
__DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, uintn ndims,
haddr_t addr);
/* Functions for allocation/releasing chunks */
__DLL__ void * H5F_istore_chunk_alloc(size_t chunk_size);
__DLL__ void * H5F_istore_chunk_realloc(void *chunk, size_t new_size);
__DLL__ void * H5F_istore_chunk_free(void *chunk);
/* Address-related functions */

View File

@ -59,7 +59,7 @@ herr_t
H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
hsize_t seq_len, hssize_t file_offset, void *buf/*out*/)
hsize_t seq_len, hsize_t file_offset, void *buf/*out*/)
{
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */
@ -285,7 +285,7 @@ herr_t
H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const H5O_fill_t *fill,
const struct H5O_efl_t *efl, const H5S_t *file_space, size_t elmt_size,
hsize_t seq_len, hssize_t file_offset, const void *buf)
hsize_t seq_len, hsize_t file_offset, const void *buf)
{
hsize_t dset_dims[H5O_LAYOUT_NDIMS]; /* dataspace dimensions */
hssize_t coords[H5O_LAYOUT_NDIMS]; /* offset of hyperslab in dataspace */

View File

@ -2055,7 +2055,7 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
/* Find the object's symbol table entry */
if (H5G_namei (loc, name, NULL, &grp_ent/*out*/, &obj_ent/*out*/,
follow_link?H5G_TARGET_NORMAL:H5G_TARGET_SLINK, NULL)<0) {
(uintn)(follow_link?H5G_TARGET_NORMAL:H5G_TARGET_SLINK), NULL)<0) {
HRETURN_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to stat object");
}

View File

@ -272,7 +272,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key,
"unable to allocate file space");
}
sym->dirty = TRUE;
sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,2*H5G_NODE_K(f),1);
sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,(hsize_t)(2*H5G_NODE_K(f)),1);
if (NULL==sym->entry) {
H5FL_FREE(H5G_node_t,sym);
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
@ -347,7 +347,7 @@ H5G_node_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5G_node_t *sym)
size = H5G_node_size(f);
/* Allocate temporary buffer */
if ((buf=H5FL_BLK_ALLOC(symbol_node,size, 0))==NULL)
if ((buf=H5FL_BLK_ALLOC(symbol_node,(hsize_t)size, 0))==NULL)
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
p=buf;
@ -415,7 +415,7 @@ H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
void UNUSED *_udata2)
{
H5G_node_t *sym = NULL;
size_t size = 0;
hsize_t size = 0;
uint8_t *buf = NULL;
const uint8_t *p = NULL;
H5G_node_t *ret_value = NULL; /*for error handling */
@ -439,11 +439,11 @@ H5G_node_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
"memory allocation failed for symbol table node");
p=buf;
if (NULL==(sym = H5FL_ALLOC(H5G_node_t,1)) ||
NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,2*H5G_NODE_K(f),1))) {
NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,(hsize_t)(2*H5G_NODE_K(f)),1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, (hsize_t)size, H5P_DEFAULT, buf) < 0) {
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, size, H5P_DEFAULT, buf) < 0) {
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL,
"unabel to read symbol table node");
}
@ -989,7 +989,7 @@ H5G_node_remove(H5F_t *f, haddr_t addr, void *_lt_key/*in,out*/,
sn->dirty = TRUE;
if (H5AC_unprotect(f, H5AC_SNODE, addr, sn)<0 ||
H5AC_flush(f, H5AC_SNODE, addr, TRUE)<0 ||
H5MF_xfree(f, H5FD_MEM_BTREE, addr, H5G_node_size(f))<0) {
H5MF_xfree(f, H5FD_MEM_BTREE, addr, (hsize_t)H5G_node_size(f))<0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR,
"unable to free symbol table node");

View File

@ -52,7 +52,7 @@ struct H5HG_heap_t {
size_t size; /*total size of collection */
uint8_t *chunk; /*the collection, incl. header */
intn nalloc; /*numb object slots allocated */
H5HG_obj_t *obj; /*array of object descriptions */
H5HG_obj_t *obj; /*array of object descriptions */
};
/* PRIVATE PROTOTYPES */
@ -118,7 +118,8 @@ H5HG_create (H5F_t *f, size_t size)
/* Check args */
assert (f);
if (size<H5HG_MINSIZE) size = H5HG_MINSIZE;
if (size<H5HG_MINSIZE)
size = H5HG_MINSIZE;
size = H5HG_ALIGN(size);
#ifdef QAK
printf("%s: size=%d\n",FUNC,(int)size);
@ -136,12 +137,12 @@ printf("%s: size=%d\n",FUNC,(int)size);
heap->addr = addr;
heap->size = size;
heap->dirty = TRUE;
if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,size,0))) {
if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)size,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
heap->nalloc = H5HG_NOBJS (f, size);
if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,heap->nalloc,1))) {
if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)heap->nalloc,1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -252,7 +253,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
"memory allocation failed");
}
heap->addr = addr;
if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,H5HG_MINSIZE,0))) {
if (NULL==(heap->chunk = H5FL_BLK_ALLOC (heap_chunk,(hsize_t)H5HG_MINSIZE,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -288,7 +289,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
*/
if (heap->size > H5HG_MINSIZE) {
haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE;
if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, heap->size))) {
if (NULL==(heap->chunk = H5FL_BLK_REALLOC (heap_chunk, heap->chunk, (hsize_t)heap->size))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -302,7 +303,7 @@ H5HG_load (H5F_t *f, haddr_t addr, const void UNUSED *udata1,
/* Decode each object */
p = heap->chunk + H5HG_SIZEOF_HDR (f);
nalloc = H5HG_NOBJS (f, heap->size);
if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,nalloc,1))) {
if (NULL==(heap->obj = H5FL_ARR_ALLOC (H5HG_obj_t,(hsize_t)nalloc,1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -851,75 +852,74 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
assert (f);
assert (hobj);
if (0==(f->intent & H5F_ACC_RDWR)) {
HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
"no write intent on file");
}
/* Load the heap */
if (NULL==(heap=H5AC_find (f, H5AC_GHEAP, hobj->addr, NULL, NULL))) {
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
HRETURN_ERROR (H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap");
}
assert (hobj->idx>0 && hobj->idx<heap->nalloc);
assert (heap->obj[hobj->idx].begin);
obj_start = heap->obj[hobj->idx].begin;
need = H5HG_ALIGN(heap->obj[hobj->idx].size); /*
* should this include the
need = H5HG_ALIGN(heap->obj[hobj->idx].size); /* should this include the
* object header size? -rpm
*/
/* Move the new free space to the end of the heap */
for (i=0; i<heap->nalloc; i++) {
if (heap->obj[i].begin > heap->obj[hobj->idx].begin) {
heap->obj[i].begin -= need;
}
if (heap->obj[i].begin > heap->obj[hobj->idx].begin) {
heap->obj[i].begin -= need;
}
}
if (NULL==heap->obj[0].begin) {
heap->obj[0].begin = heap->chunk + (heap->size-need);
heap->obj[0].size = need;
heap->obj[0].nrefs = 0;
heap->obj[0].begin = heap->chunk + (heap->size-need);
heap->obj[0].size = need;
heap->obj[0].nrefs = 0;
} else {
heap->obj[0].size += need;
heap->obj[0].size += need;
}
HDmemmove (obj_start, obj_start+need,
heap->size-((obj_start+need)-heap->chunk));
if (heap->obj[0].size>=H5HG_SIZEOF_OBJHDR (f)) {
p = heap->obj[0].begin;
UINT16ENCODE(p, 0); /*id*/
UINT16ENCODE(p, 0); /*nrefs*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_ENCODE_LENGTH (f, p, need);
p = heap->obj[0].begin;
UINT16ENCODE(p, 0); /*id*/
UINT16ENCODE(p, 0); /*nrefs*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_ENCODE_LENGTH (f, p, need);
}
HDmemset (heap->obj+hobj->idx, 0, sizeof(H5HG_obj_t));
heap->dirty = 1;
if (heap->obj[0].size+H5HG_SIZEOF_HDR(f)==heap->size) {
/*
* The collection is empty. Remove it from the CWFS list and return it
* to the file free list.
*/
heap->dirty = FALSE;
H5MF_xfree(f, H5FD_MEM_GHEAP, heap->addr, heap->size);
H5AC_flush (f, H5AC_GHEAP, heap->addr, TRUE);
heap = NULL;
/*
* The collection is empty. Remove it from the CWFS list and return it
* to the file free list.
*/
heap->dirty = FALSE;
H5MF_xfree(f, H5FD_MEM_GHEAP, heap->addr, (hsize_t)heap->size);
H5AC_flush (f, H5AC_GHEAP, heap->addr, TRUE);
heap = NULL;
} else {
/*
* If the heap is in the CWFS list then advance it one position. The
* H5AC_find() might have done that too, but that's okay. If the
* heap isn't on the CWFS list then add it to the end.
*/
for (i=0; i<f->shared->ncwfs; i++) {
if (f->shared->cwfs[i]==heap) {
if (i) {
f->shared->cwfs[i] = f->shared->cwfs[i-1];
f->shared->cwfs[i-1] = heap;
}
break;
}
}
if (i>=f->shared->ncwfs) {
f->shared->ncwfs = MIN (f->shared->ncwfs+1, H5HG_NCWFS);
f->shared->cwfs[f->shared->ncwfs-1] = heap;
}
/*
* If the heap is in the CWFS list then advance it one position. The
* H5AC_find() might have done that too, but that's okay. If the
* heap isn't on the CWFS list then add it to the end.
*/
for (i=0; i<f->shared->ncwfs; i++) {
if (f->shared->cwfs[i]==heap) {
if (i) {
f->shared->cwfs[i] = f->shared->cwfs[i-1];
f->shared->cwfs[i-1] = heap;
}
break;
}
}
if (i>=f->shared->ncwfs) {
f->shared->ncwfs = MIN (f->shared->ncwfs+1, H5HG_NCWFS);
f->shared->cwfs[f->shared->ncwfs-1] = heap;
}
}
FUNC_LEAVE (SUCCEED);

View File

@ -112,7 +112,7 @@ herr_t
H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/)
{
H5HL_t *heap = NULL;
size_t total_size; /*total heap size on disk */
hsize_t total_size; /*total heap size on disk */
herr_t ret_value = FAIL;
FUNC_ENTER(H5HL_create, FAIL);
@ -141,7 +141,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p/*out*/)
heap->addr = *addr_p + (hsize_t)H5HL_SIZEOF_HDR(f);
heap->disk_alloc = size_hint;
heap->mem_alloc = size_hint;
if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,H5HL_SIZEOF_HDR(f) + size_hint,1))) {
if (NULL==(heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + size_hint),1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -253,7 +253,7 @@ H5HL_load(H5F_t *f, haddr_t addr, const void UNUSED *udata1,
/* data */
H5F_addr_decode(f, &p, &(heap->addr));
heap->chunk = H5FL_BLK_ALLOC(heap_chunk,H5HL_SIZEOF_HDR(f) + heap->mem_alloc,1);
heap->chunk = H5FL_BLK_ALLOC(heap_chunk,(hsize_t)(H5HL_SIZEOF_HDR(f) + heap->mem_alloc),1);
if (NULL==heap->chunk) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
@ -350,12 +350,12 @@ H5HL_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5HL_t *heap)
if (heap->mem_alloc > heap->disk_alloc) {
haddr_t old_addr = heap->addr, new_addr;
if (HADDR_UNDEF==(new_addr=H5MF_alloc(f, H5FD_MEM_LHEAP,
heap->mem_alloc))) {
(hsize_t)heap->mem_alloc))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate file space for heap");
}
heap->addr = new_addr;
H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, heap->disk_alloc);
H5MF_xfree(f, H5FD_MEM_LHEAP, old_addr, (hsize_t)heap->disk_alloc);
H5E_clear(); /*don't really care if the free failed */
heap->disk_alloc = heap->mem_alloc;
}
@ -722,7 +722,7 @@ H5HL_insert(H5F_t *f, haddr_t addr, size_t buf_size, const void *buf)
old_size = heap->mem_alloc;
heap->mem_alloc += need_more;
heap->chunk = H5FL_BLK_REALLOC(heap_chunk,heap->chunk,
H5HL_SIZEOF_HDR(f) + heap->mem_alloc);
(hsize_t)(H5HL_SIZEOF_HDR(f) + heap->mem_alloc));
if (NULL==heap->chunk) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1),
"memory allocation failed");

View File

@ -1103,7 +1103,7 @@ H5I_find_id(hid_t id)
*
*-------------------------------------------------------------------------
*/
#ifdef H5I_DEBUG
#ifdef H5I_DEBUG_OUTPUT
static herr_t
H5I_debug(H5I_type_t grp)
{
@ -1150,5 +1150,5 @@ H5I_debug(H5I_type_t grp)
FUNC_LEAVE(SUCCEED);
}
#endif /* H5I_DEBUG */
#endif /* H5I_DEBUG_OUTPUT */

View File

@ -69,12 +69,12 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size)
/* Fail if we don't have write access */
if (0==(f->intent & H5F_ACC_RDWR)) {
HRETURN_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "file is read-only");
HRETURN_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "file is read-only");
}
/* Allocate space from the virtual file layer */
if (HADDR_UNDEF==(ret_value=H5FD_alloc(f->shared->lf, type, size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF,
"file allocation failed");
}
@ -186,7 +186,7 @@ H5MF_realloc(H5F_t *f, H5FD_mem_t type, haddr_t old_addr, hsize_t old_size,
ret_value = H5FD_realloc(f->shared->lf, type, old_addr, old_size,
new_size);
if (HADDR_UNDEF==ret_value) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF,
"unable to allocate new file memory");
}

184
src/H5O.c
View File

@ -157,7 +157,7 @@ H5O_init_interface(void)
herr_t
H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
{
size_t size; /*total size of object header */
hsize_t size; /*total size of object header */
H5O_t *oh = NULL;
haddr_t tmp_addr;
@ -189,7 +189,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
/* create the chunk list and initialize the first chunk */
oh->nchunks = 1;
oh->alloc_nchunks = H5O_NCHUNKS;
if (NULL==(oh->chunk=H5FL_ARR_ALLOC(H5O_chunk_t,oh->alloc_nchunks,0))) {
if (NULL==(oh->chunk=H5FL_ARR_ALLOC(H5O_chunk_t,(hsize_t)oh->alloc_nchunks,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -197,7 +197,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
oh->chunk[0].dirty = TRUE;
oh->chunk[0].addr = tmp_addr;
oh->chunk[0].size = size_hint;
if (NULL==(oh->chunk[0].image = H5FL_BLK_ALLOC(chunk_image,size_hint,1))) {
if (NULL==(oh->chunk[0].image = H5FL_BLK_ALLOC(chunk_image,(hsize_t)size_hint,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -205,7 +205,7 @@ H5O_create(H5F_t *f, size_t size_hint, H5G_entry_t *ent/*out*/)
/* create the message list and initialize the first message */
oh->nmesgs = 1;
oh->alloc_nmesgs = H5O_NMESGS;
if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,oh->alloc_nmesgs,1))) {
if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,(hsize_t)oh->alloc_nmesgs,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -352,7 +352,8 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
H5O_t *oh = NULL;
H5O_t *ret_value = NULL;
uint8_t buf[16], *p;
size_t hdr_size, mesg_size;
size_t mesg_size;
hsize_t hdr_size;
uintn id;
intn mesgno, chunkno, curmesg = 0, nmesgs;
haddr_t chunk_addr;
@ -404,7 +405,7 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
/* build the message array */
oh->alloc_nmesgs = MAX(H5O_NMESGS, nmesgs);
if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,oh->alloc_nmesgs,1))) {
if (NULL==(oh->mesg=H5FL_ARR_ALLOC(H5O_mesg_t,(hsize_t)oh->alloc_nmesgs,1))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -414,10 +415,10 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
/* increase chunk array size */
if (oh->nchunks >= oh->alloc_nchunks) {
size_t na = oh->alloc_nchunks + H5O_NCHUNKS;
hsize_t na = oh->alloc_nchunks + H5O_NCHUNKS;
H5O_chunk_t *x = H5FL_ARR_REALLOC (H5O_chunk_t, oh->chunk, na);
if (!x) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
oh->alloc_nchunks = (intn)na;
@ -429,11 +430,11 @@ H5O_load(H5F_t *f, haddr_t addr, const void UNUSED *_udata1,
oh->chunk[chunkno].dirty = FALSE;
oh->chunk[chunkno].addr = chunk_addr;
oh->chunk[chunkno].size = chunk_size;
if (NULL==(oh->chunk[chunkno].image = H5FL_BLK_ALLOC(chunk_image,chunk_size,0))) {
if (NULL==(oh->chunk[chunkno].image = H5FL_BLK_ALLOC(chunk_image,(hsize_t)chunk_size,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
if (H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, chunk_size, H5P_DEFAULT,
if (H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, (hsize_t)chunk_size, H5P_DEFAULT,
oh->chunk[chunkno].image) < 0) {
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL,
"unable to read object header data");
@ -595,63 +596,60 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh)
/* encode messages */
for (i = 0; i < oh->nmesgs; i++) {
if (oh->mesg[i].dirty) {
p = oh->mesg[i].raw - H5O_SIZEOF_MSGHDR(f);
p = oh->mesg[i].raw - H5O_SIZEOF_MSGHDR(f);
id = oh->mesg[i].type->id;
UINT16ENCODE(p, id);
assert (oh->mesg[i].raw_size<65536);
UINT16ENCODE(p, oh->mesg[i].raw_size);
*p++ = oh->mesg[i].flags;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
if (oh->mesg[i].native) {
assert(oh->mesg[i].type->encode);
id = oh->mesg[i].type->id;
UINT16ENCODE(p, id);
assert (oh->mesg[i].raw_size<65536);
UINT16ENCODE(p, oh->mesg[i].raw_size);
*p++ = oh->mesg[i].flags;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
if (oh->mesg[i].native) {
assert(oh->mesg[i].type->encode);
/* allocate file space for chunks that have none yet */
if (H5O_CONT_ID == oh->mesg[i].type->id &&
!H5F_addr_defined(((H5O_cont_t *)(oh->mesg[i].native))
->addr)) {
cont = (H5O_cont_t *) (oh->mesg[i].native);
assert(cont->chunkno >= 0);
assert(cont->chunkno < oh->nchunks);
assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr));
cont->size = oh->chunk[cont->chunkno].size;
if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f,
H5FD_MEM_OHDR,
cont->size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate space for "
"object header data");
}
oh->chunk[cont->chunkno].addr = cont->addr;
}
/*
* Encode the message. If the message is shared then we
* encode a Shared Object message instead of the object
* which is being shared.
*/
assert(oh->mesg[i].raw >=
oh->chunk[oh->mesg[i].chunkno].image);
assert (oh->mesg[i].raw_size ==
H5O_ALIGN (oh->mesg[i].raw_size));
assert(oh->mesg[i].raw + oh->mesg[i].raw_size <=
oh->chunk[oh->mesg[i].chunkno].image +
oh->chunk[oh->mesg[i].chunkno].size);
if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
encode = H5O_SHARED->encode;
} else {
encode = oh->mesg[i].type->encode;
}
if ((encode)(f, oh->mesg[i].raw, oh->mesg[i].native)<0) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL,
"unable to encode object header message");
}
}
oh->mesg[i].dirty = FALSE;
oh->chunk[oh->mesg[i].chunkno].dirty = TRUE;
/* allocate file space for chunks that have none yet */
if (H5O_CONT_ID == oh->mesg[i].type->id &&
!H5F_addr_defined(((H5O_cont_t *)(oh->mesg[i].native))->addr)) {
cont = (H5O_cont_t *) (oh->mesg[i].native);
assert(cont->chunkno >= 0);
assert(cont->chunkno < oh->nchunks);
assert(!H5F_addr_defined(oh->chunk[cont->chunkno].addr));
cont->size = oh->chunk[cont->chunkno].size;
if (HADDR_UNDEF==(cont->addr=H5MF_alloc(f,
H5FD_MEM_OHDR, (hsize_t)cont->size))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate space for object header data");
}
oh->chunk[cont->chunkno].addr = cont->addr;
}
/*
* Encode the message. If the message is shared then we
* encode a Shared Object message instead of the object
* which is being shared.
*/
assert(oh->mesg[i].raw >=
oh->chunk[oh->mesg[i].chunkno].image);
assert (oh->mesg[i].raw_size ==
H5O_ALIGN (oh->mesg[i].raw_size));
assert(oh->mesg[i].raw + oh->mesg[i].raw_size <=
oh->chunk[oh->mesg[i].chunkno].image +
oh->chunk[oh->mesg[i].chunkno].size);
if (oh->mesg[i].flags & H5O_FLAG_SHARED) {
encode = H5O_SHARED->encode;
} else {
encode = oh->mesg[i].type->encode;
}
if ((encode)(f, oh->mesg[i].raw, oh->mesg[i].native)<0) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL,
"unable to encode object header message");
}
}
oh->mesg[i].dirty = FALSE;
oh->chunk[oh->mesg[i].chunkno].dirty = TRUE;
}
}
@ -661,7 +659,7 @@ H5O_flush(H5F_t *f, hbool_t destroy, haddr_t addr, H5O_t *oh)
assert(H5F_addr_defined(oh->chunk[i].addr));
if(i==0 && combine) {
/* Allocate space for the combined prefix and first chunk */
if((p=H5FL_BLK_ALLOC(chunk_image,H5O_SIZEOF_HDR(f)+oh->chunk[i].size,0))==NULL)
if((p=H5FL_BLK_ALLOC(chunk_image,(hsize_t)(H5O_SIZEOF_HDR(f)+oh->chunk[i].size),0))==NULL)
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
/* Copy in the prefix */
@ -1682,7 +1680,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
/* Be careful not to indroduce garbage */
oh->chunk[chunkno].image = H5FL_BLK_REALLOC(chunk_image,old_addr,
(oh->chunk[chunkno].size + delta));
(hsize_t)(oh->chunk[chunkno].size + delta));
if (NULL==oh->chunk[chunkno].image) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
@ -1706,14 +1704,14 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
/* create a new null message */
if (oh->nmesgs >= oh->alloc_nmesgs) {
size_t na = oh->alloc_nmesgs + H5O_NMESGS;
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
if (NULL==x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nmesgs = (intn)na;
oh->mesg = x;
hsize_t na = oh->alloc_nmesgs + H5O_NMESGS;
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
if (NULL==x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nmesgs = (intn)na;
oh->mesg = x;
}
delta = MAX(H5O_MIN_SIZE, aligned_size+H5O_SIZEOF_MSGHDR(f));
delta = H5O_ALIGN(delta);
@ -1731,7 +1729,7 @@ H5O_alloc_extend_chunk(H5O_t *oh, intn chunkno, size_t size)
old_size = oh->chunk[chunkno].size;
oh->chunk[chunkno].size += delta;
oh->chunk[chunkno].image = H5FL_BLK_REALLOC(chunk_image,old_addr,
oh->chunk[chunkno].size);
(hsize_t)oh->chunk[chunkno].size);
if (NULL==oh->chunk[chunkno].image) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
@ -1845,20 +1843,20 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
* Create the new chunk without giving it a file address.
*/
if (oh->nchunks >= oh->alloc_nchunks) {
size_t na = oh->alloc_nchunks + H5O_NCHUNKS;
H5O_chunk_t *x = H5FL_ARR_REALLOC (H5O_chunk_t, oh->chunk, na);
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nchunks = (intn)na;
oh->chunk = x;
hsize_t na = oh->alloc_nchunks + H5O_NCHUNKS;
H5O_chunk_t *x = H5FL_ARR_REALLOC (H5O_chunk_t, oh->chunk, na);
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nchunks = (intn)na;
oh->chunk = x;
}
chunkno = oh->nchunks++;
oh->chunk[chunkno].dirty = TRUE;
oh->chunk[chunkno].addr = HADDR_UNDEF;
oh->chunk[chunkno].size = size;
if (NULL==(oh->chunk[chunkno].image = p = H5FL_BLK_ALLOC(chunk_image,size,1))) {
if (NULL==(oh->chunk[chunkno].image = p = H5FL_BLK_ALLOC(chunk_image,(hsize_t)size,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -1869,12 +1867,12 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size)
*/
if (oh->nmesgs + 3 > oh->alloc_nmesgs) {
int old_alloc=oh->alloc_nmesgs;
size_t na = oh->alloc_nmesgs + MAX (H5O_NMESGS, 3);
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
hsize_t na = oh->alloc_nmesgs + MAX (H5O_NMESGS, 3);
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nmesgs = (intn)na;
oh->mesg = x;
@ -2026,10 +2024,10 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size)
if (oh->nmesgs >= oh->alloc_nmesgs) {
int old_alloc=oh->alloc_nmesgs;
size_t na = oh->alloc_nmesgs + H5O_NMESGS;
hsize_t na = oh->alloc_nmesgs + H5O_NMESGS;
H5O_mesg_t *x = H5FL_ARR_REALLOC (H5O_mesg_t, oh->mesg, na);
if (!x) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
oh->alloc_nmesgs = (intn)na;

View File

@ -361,7 +361,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
}
/* Do the conversion */
if (H5T_convert(tpath, src_id, dst_id, 1, 0, 0, buf, bkg, H5P_DEFAULT)<0) {
if (H5T_convert(tpath, src_id, dst_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"data type conversion failed");
}

View File

@ -73,7 +73,8 @@ static void *
H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
{
H5O_layout_t *mesg = NULL;
intn i, version;
intn version;
uintn u;
FUNC_ENTER(H5O_layout_decode, NULL);
@ -84,14 +85,14 @@ H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
/* decode */
if (NULL==(mesg = H5FL_ALLOC(H5O_layout_t,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
/* Version */
version = *p++;
if (version!=H5O_LAYOUT_VERSION) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
"bad version number for layout message");
}
@ -114,8 +115,8 @@ H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
H5F_addr_decode(f, &p, &(mesg->addr));
/* Read the size */
for (i = 0; i < mesg->ndims; i++) {
UINT32DECODE(p, mesg->dim[i]);
for (u = 0; u < mesg->ndims; u++) {
UINT32DECODE(p, mesg->dim[u]);
}
FUNC_LEAVE(mesg);
@ -141,7 +142,7 @@ static herr_t
H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
int i;
uintn u;
FUNC_ENTER(H5O_layout_encode, FAIL);
@ -161,14 +162,15 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
*p++ = mesg->type;
/* reserved bytes should be zero */
for (i=0; i<5; i++) *p++ = 0;
for (u=0; u<5; u++)
*p++ = 0;
/* data or B-tree address */
H5F_addr_encode(f, &p, mesg->addr);
/* dimension size */
for (i = 0; i < mesg->ndims; i++) {
UINT32ENCODE(p, mesg->dim[i]);
for (u = 0; u < mesg->ndims; u++) {
UINT32ENCODE(p, mesg->dim[u]);
}
FUNC_LEAVE(SUCCEED);
@ -299,7 +301,7 @@ H5O_layout_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
intn indent, intn fwidth)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
intn i;
uintn u;
FUNC_ENTER(H5O_layout_debug, FAIL);
@ -320,9 +322,9 @@ H5O_layout_debug(H5F_t UNUSED *f, const void *_mesg, FILE * stream,
/* Size */
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:");
for (i = 0; i < mesg->ndims; i++) {
HDfprintf(stream, "%s%lu", i ? ", " : "",
(unsigned long) (mesg->dim[i]));
for (u = 0; u < mesg->ndims; u++) {
HDfprintf(stream, "%s%lu", u ? ", " : "",
(unsigned long) (mesg->dim[u]));
}
HDfprintf(stream, "}\n");

View File

@ -78,7 +78,7 @@ typedef struct H5O_class_t {
herr_t (*reset)(void *); /*free nested data structs */
herr_t (*free)(void *); /*free main data struct */
herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*);
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*);
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*);
herr_t (*debug)(H5F_t*, const void*, FILE*, intn, intn);
} H5O_class_t;
@ -106,11 +106,11 @@ typedef struct H5O_t {
intn version; /*version number */
intn nlink; /*link count */
intn nmesgs; /*number of messages */
intn alloc_nmesgs; /*number of message slots */
H5O_mesg_t *mesg; /*array of messages */
intn alloc_nmesgs; /*number of message slots */
H5O_mesg_t *mesg; /*array of messages */
intn nchunks; /*number of chunks */
intn alloc_nchunks; /*chunks allocated */
H5O_chunk_t *chunk; /*array of chunks */
intn alloc_nchunks; /*chunks allocated */
H5O_chunk_t *chunk; /*array of chunks */
} H5O_t;
/*
@ -157,7 +157,7 @@ typedef struct H5O_fill_t {
__DLLVAR__ const H5O_class_t H5O_EFL[1];/*external file list class */
typedef struct H5O_efl_entry_t {
size_t name_offset; /*offset of name within heap */
size_t name_offset; /*offset of name within heap */
char *name; /*malloc'd name */
off_t offset; /*offset of data within file */
hsize_t size; /*size allocated within file */
@ -167,7 +167,7 @@ typedef struct H5O_efl_t {
haddr_t heap_addr; /*address of name heap */
intn nalloc; /*number of slots allocated */
intn nused; /*number of slots used */
H5O_efl_entry_t *slot; /*array of external file entries */
H5O_efl_entry_t *slot; /*array of external file entries */
} H5O_efl_t;
/*
@ -180,7 +180,7 @@ __DLLVAR__ const H5O_class_t H5O_LAYOUT[1];
typedef struct H5O_layout_t {
int type; /*type of layout, H5D_layout_t */
haddr_t addr; /*file address of data or B-tree */
intn ndims; /*num dimensions in stored data */
uintn ndims; /*num dimensions in stored data */
hsize_t dim[H5O_LAYOUT_NDIMS]; /*size of data or chunk */
} H5O_layout_t;
@ -194,11 +194,11 @@ typedef struct H5O_pline_t {
size_t nfilters; /*num filters defined */
size_t nalloc; /*num elements in `filter' array */
struct {
H5Z_filter_t id; /*filter identification number */
uintn flags; /*defn and invocation flags */
char *name; /*optional filter name */
size_t cd_nelmts; /*number of elements in cd_values[] */
uintn *cd_values; /*client data values */
H5Z_filter_t id; /*filter identification number */
uintn flags; /*defn and invocation flags */
char *name; /*optional filter name */
size_t cd_nelmts; /*number of elements in cd_values[] */
uintn *cd_values; /*client data values */
} *filter; /*array of filters */
} H5O_pline_t;

View File

@ -97,7 +97,7 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
void *ret_value = NULL;
intn u; /* local counting variable */
uintn u; /* local counting variable */
uintn flags, version;
FUNC_ENTER(H5O_sdspace_decode, NULL);
@ -109,47 +109,47 @@ H5O_sdspace_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
/* decode */
if ((sdim = H5FL_ALLOC(H5S_simple_t,1)) != NULL) {
version = *p++;
if (version!=H5O_SDSPACE_VERSION) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
"wrong version number in data space message");
}
sdim->rank = *p++;
if (sdim->rank>H5S_MAX_RANK) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
"simple data space dimensionality is too large");
}
flags = *p++;
p += 5; /*reserved*/
version = *p++;
if (version!=H5O_SDSPACE_VERSION) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
"wrong version number in data space message");
}
sdim->rank = *p++;
if (sdim->rank>H5S_MAX_RANK) {
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
"simple data space dimensionality is too large");
}
flags = *p++;
p += 5; /*reserved*/
if (sdim->rank > 0) {
if (NULL==(sdim->size=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++) {
H5F_DECODE_LENGTH (f, p, sdim->size[u]);
}
if (flags & H5S_VALID_MAX) {
if (NULL==(sdim->max=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++) {
H5F_DECODE_LENGTH (f, p, sdim->max[u]);
}
}
if (sdim->rank > 0) {
if (NULL==(sdim->size=H5FL_ARR_ALLOC(hsize_t,(hsize_t)sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++) {
H5F_DECODE_LENGTH (f, p, sdim->size[u]);
}
if (flags & H5S_VALID_MAX) {
if (NULL==(sdim->max=H5FL_ARR_ALLOC(hsize_t,(hsize_t)sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++) {
H5F_DECODE_LENGTH (f, p, sdim->max[u]);
}
}
#ifdef LATER
if (flags & H5S_VALID_PERM) {
if (NULL==(sdim->perm=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->perm[u]);
}
if (flags & H5S_VALID_PERM) {
if (NULL==(sdim->perm=H5FL_ARR_ALLOC(hsize_t,sdim->rank,0))) {
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
for (u = 0; u < sdim->rank; u++)
UINT32DECODE(p, sdim->perm[u]);
}
#endif
}
}
}
ret_value = (void*)sdim; /*success*/
@ -187,7 +187,7 @@ static herr_t
H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* Local counting variable */
uintn u; /* Local counting variable */
uintn flags = 0;
FUNC_ENTER(H5O_sdspace_encode, FAIL);
@ -198,9 +198,11 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
assert(sdim);
/* set flags */
if (sdim->max) flags |= H5S_VALID_MAX;
if (sdim->max)
flags |= H5S_VALID_MAX;
#ifdef LATER
if (sdim->perm) flags |= H5S_VALID_PERM;
if (sdim->perm)
flags |= H5S_VALID_PERM;
#endif
/* encode */
@ -214,19 +216,17 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *mesg)
*p++ = 0; /*reserved*/
if (sdim->rank > 0) {
for (u = 0; u < sdim->rank; u++) {
H5F_ENCODE_LENGTH (f, p, sdim->size[u]);
}
if (flags & H5S_VALID_MAX) {
for (u = 0; u < sdim->rank; u++) {
H5F_ENCODE_LENGTH (f, p, sdim->max[u]);
}
}
for (u = 0; u < sdim->rank; u++)
H5F_ENCODE_LENGTH (f, p, sdim->size[u]);
if (flags & H5S_VALID_MAX) {
for (u = 0; u < sdim->rank; u++)
H5F_ENCODE_LENGTH (f, p, sdim->max[u]);
}
#ifdef LATER
if (flags & H5S_VALID_PERM) {
for (u = 0; u < sdim->rank; u++)
UINT32ENCODE(p, sdim->perm[u]);
}
if (flags & H5S_VALID_PERM) {
for (u = 0; u < sdim->rank; u++)
UINT32ENCODE(p, sdim->perm[u]);
}
#endif
}
FUNC_LEAVE(SUCCEED);
@ -266,14 +266,14 @@ H5O_sdspace_copy(const void *mesg, void *dest)
HDmemcpy(dst, src, sizeof(H5S_simple_t));
if (src->size) {
if (NULL==(dst->size = H5FL_ARR_ALLOC(hsize_t,src->rank,0))) {
if (NULL==(dst->size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->rank,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
HDmemcpy (dst->size, src->size, src->rank*sizeof(src->size[0]));
}
if (src->max) {
if (NULL==(dst->max=H5FL_ARR_ALLOC(hsize_t,src->rank,0))) {
if (NULL==(dst->max=H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->rank,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@ -417,7 +417,7 @@ H5O_sdspace_debug(H5F_t UNUSED *f, const void *mesg,
FILE * stream, intn indent, intn fwidth)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
intn u; /* local counting variable */
uintn u; /* local counting variable */
FUNC_ENTER(H5O_sdspace_debug, FAIL);
@ -434,32 +434,32 @@ H5O_sdspace_debug(H5F_t UNUSED *f, const void *mesg,
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:");
for (u = 0; u < sdim->rank; u++) {
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]);
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]);
}
HDfprintf (stream, "}\n");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:");
if (sdim->max) {
HDfprintf (stream, "{");
for (u = 0; u < sdim->rank; u++) {
if (H5S_UNLIMITED==sdim->max[u]) {
HDfprintf (stream, "%sINF", u?", ":"");
} else {
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]);
}
}
HDfprintf (stream, "}\n");
HDfprintf (stream, "{");
for (u = 0; u < sdim->rank; u++) {
if (H5S_UNLIMITED==sdim->max[u]) {
HDfprintf (stream, "%sINF", u?", ":"");
} else {
HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]);
}
}
HDfprintf (stream, "}\n");
} else {
HDfprintf (stream, "CONSTANT\n");
HDfprintf (stream, "CONSTANT\n");
}
#ifdef LATER
if (sdim->perm) {
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
for (u = 0; u < sdim->rank; u++) {
HDfprintf (stream, "%s%lu", u?", ":"",
(unsigned long) (sdim->perm[u]));
}
HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Perm:");
for (u = 0; u < sdim->rank; u++) {
HDfprintf (stream, "%s%lu", u?", ":"",
(unsigned long) (sdim->perm[u]));
}
}
#endif

View File

@ -2805,7 +2805,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
H5Pset_buffer(hid_t plist_id, hsize_t size, void *tconv, void *bkg)
{
H5D_xfer_t *plist = NULL;
@ -2848,7 +2848,7 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
*
*-------------------------------------------------------------------------
*/
size_t
hsize_t
H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
{
H5D_xfer_t *plist = NULL;
@ -3093,7 +3093,7 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid filter identifier");
}
if (flags & ~H5Z_FLAG_DEFMASK) {
if (flags & ~((unsigned)H5Z_FLAG_DEFMASK)) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"invalid flags");
}
@ -3564,7 +3564,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
HDmemcpy(buf, plist->fill.buf, H5T_get_size(plist->fill.type));
/* Do the conversion */
if (H5T_convert(tpath, src_id, type_id, 1, 0, 0, buf, bkg, H5P_DEFAULT)<0) {
if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"data type conversion failed");
}
@ -4699,7 +4699,7 @@ done:
hid_t H5Pcreate_list(hid_t cls_id)
{
H5P_genclass_t *pclass; /* Property list class to modify */
H5P_genplist_t *plist; /* Property list created */
H5P_genplist_t *plist=NULL; /* Property list created */
hid_t plist_id=FAIL; /* Property list ID */
hid_t ret_value=FAIL; /* return value */
@ -4871,7 +4871,7 @@ static herr_t H5P_register(H5P_genclass_t *pclass, const char *name, size_t size
*/
if(pclass->plists>0 || pclass->classes>0) {
if((new_class=H5P_create_class(pclass->parent,pclass->name,pclass->hashsize,
pclass->internal,pclass->create_func,pclass->create_data,
(uintn)pclass->internal,pclass->create_func,pclass->create_data,
pclass->close_func,pclass->close_data))==NULL)
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class");
@ -7255,7 +7255,7 @@ done:
PURPOSE
Internal routine to close a property list class.
USAGE
herr_t H5P_create_class(class)
herr_t H5P_close_class(class)
H5P_genclass_t *class; IN: Property list class to close
RETURNS
Returns non-negative on success, negative on failure.

View File

@ -172,9 +172,9 @@ __DLL__ herr_t H5Pget_xfer(hid_t plist_id, H5D_transfer_t *data_xfer_mode);
__DLL__ hid_t H5Pget_driver(hid_t plist_id);
#endif /* WANT_H5_V1_2_COMPAT */
__DLL__ void *H5Pget_driver_info(hid_t plist_id);
__DLL__ herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv,
__DLL__ herr_t H5Pset_buffer(hid_t plist_id, hsize_t size, void *tconv,
void *bkg);
__DLL__ size_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/,
__DLL__ hsize_t H5Pget_buffer(hid_t plist_id, void **tconv/*out*/,
void **bkg/*out*/);
__DLL__ herr_t H5Pset_preserve(hid_t plist_id, hbool_t status);
__DLL__ int H5Pget_preserve(hid_t plist_id);

View File

@ -204,7 +204,8 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
buf_size+=sizeof(haddr_t);
/* Allocate the space to store the serialized information */
if (NULL==(buf = H5MM_malloc(buf_size))) {
assert(buf_size==(hssize_t)((size_t)buf_size)); /*check for overflow*/
if (NULL==(buf = H5MM_malloc((size_t)buf_size))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -220,7 +221,8 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
"Unable to serialize selection");
/* Save the serialized buffer for later */
if(H5HG_insert(loc->file,buf_size,buf,&hobjid)<0)
assert(buf_size==(hssize_t)((size_t)buf_size)); /*check for overflow*/
if(H5HG_insert(loc->file,(size_t)buf_size,buf,&hobjid)<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL,
"Unable to serialize selection");

View File

@ -730,7 +730,8 @@ H5RA_write(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
"unable to set meta data selection");
}
if (NULL==(meta=H5MM_malloc(nrows*sizeof(H5RA_meta_t)))) {
assert((nrows*sizeof(H5RA_meta_t))==(hsize_t)((size_t)(nrows*sizeof(H5RA_meta_t)))); /*check for overflow*/
if (NULL==(meta=H5MM_malloc((size_t)(nrows*sizeof(H5RA_meta_t))))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for meta data");
}
@ -739,8 +740,9 @@ H5RA_write(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_READERROR, FAIL,
"unable to read meta data");
}
assert(((nrows-meta_read_size)*sizeof(H5RA_meta_t))==(hsize_t)((size_t)((nrows-meta_read_size)*sizeof(H5RA_meta_t)))); /*check for overflow*/
HDmemset(meta+meta_read_size, 0,
(nrows-meta_read_size)*sizeof(H5RA_meta_t));
(size_t)((nrows-meta_read_size)*sizeof(H5RA_meta_t)));
/* Write the part of the data that will fit in the raw dataset */
if (NULL==(rf_space=H5D_get_space(ra->raw)) ||
@ -748,15 +750,17 @@ H5RA_write(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
"unable to determine current raw data extents");
}
if (NULL==(raw_buf=H5MM_malloc(nrows*raw_cur_size[1]*type_size))) {
assert((nrows*raw_cur_size[1]*type_size)==(hsize_t)((size_t)(nrows*raw_cur_size[1]*type_size))); /*check for overflow*/
if (NULL==(raw_buf=H5MM_malloc((size_t)(nrows*raw_cur_size[1]*type_size)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"unable to allocate buffer for raw data");
}
for (i=0; i<nrows; i++) {
size_t nbytes = MIN(size[i], raw_cur_size[1])*type_size;
HDmemcpy(raw_buf+i*raw_cur_size[1]*type_size, buf[i], nbytes);
assert((raw_cur_size[1]*type_size-nbytes)==(hsize_t)((size_t)(raw_cur_size[1]*type_size-nbytes))); /*check for overflow*/
HDmemset(raw_buf+i*raw_cur_size[1]*type_size+nbytes, 0,
raw_cur_size[1]*type_size-nbytes);
(size_t)(raw_cur_size[1]*type_size-nbytes));
}
if ((hsize_t)start_row+nrows>raw_cur_size[0]) {
raw_cur_size[0] = (hsize_t)start_row + nrows;
@ -1105,7 +1109,8 @@ H5RA_read(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
* this because if we return failure we want `buf' to have the original
* values.
*/
if (NULL==(buf_out=H5MM_calloc(nrows*sizeof(void*)))) {
assert((nrows*sizeof(void*))==(hsize_t)((size_t)(nrows*sizeof(void*)))); /*check for overflow*/
if (NULL==(buf_out=H5MM_calloc((size_t)(nrows*sizeof(void*))))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for BUF output values");
}
@ -1132,7 +1137,8 @@ H5RA_read(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_CANTINIT, FAIL,
"unable to set raw dataset selection");
}
if (NULL==(raw_buf=H5MM_malloc(nrows*raw_read_size[1]*type_size))) {
assert((nrows*raw_read_size[1]*type_size)==(hsize_t)((size_t)(nrows*raw_read_size[1]*type_size))); /*check for overflow*/
if (NULL==(raw_buf=H5MM_malloc((size_t)(nrows*raw_read_size[1]*type_size)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for raw dataset");
}
@ -1141,11 +1147,13 @@ H5RA_read(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_READERROR, FAIL,
"unable to read raw dataset");
}
assert(((nrows-raw_read_size[0])*raw_read_size[1]*type_size)==(hsize_t)((size_t)((nrows-raw_read_size[0])*raw_read_size[1]*type_size))); /*check for overflow*/
HDmemset(raw_buf+raw_read_size[0]*raw_read_size[1]*type_size, 0,
(nrows-raw_read_size[0])*raw_read_size[1]*type_size);
(size_t)((nrows-raw_read_size[0])*raw_read_size[1]*type_size));
/* Get the meta data */
if (NULL==(meta=H5MM_malloc(nrows*sizeof(H5RA_meta_t)))) {
assert((nrows*sizeof(H5RA_meta_t))==(hsize_t)((size_t)(nrows*sizeof(H5RA_meta_t)))); /*check for overflow*/
if (NULL==(meta=H5MM_malloc((size_t)(nrows*sizeof(H5RA_meta_t))))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for meta data");
}
@ -1171,8 +1179,9 @@ H5RA_read(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
HGOTO_ERROR(H5E_RAGGED, H5E_READERROR, FAIL,
"unable to read meta data");
}
assert(((nrows-meta_read_size)*sizeof(H5RA_meta_t))==(hsize_t)((size_t)((nrows-meta_read_size)*sizeof(H5RA_meta_t)))); /*check for overflow*/
HDmemset(meta+meta_read_size, 0,
(nrows-meta_read_size)*sizeof(H5RA_meta_t));
(size_t)((nrows-meta_read_size)*sizeof(H5RA_meta_t)));
/* Copy data into output buffers */
for (i=0; i<nrows; i++) {
@ -1182,8 +1191,9 @@ H5RA_read(H5RA_t *ra, hssize_t start_row, hsize_t nrows, H5T_t *type,
* size and request the entire row.
*/
if (NULL==(buf_out[i]=buf[i])) {
assert((meta[i].nelmts*type_size)==(hsize_t)((size_t)(meta[i].nelmts*type_size))); /*check for overflow*/
if (meta[i].nelmts>0 &&
NULL==(buf_out[i]=H5MM_malloc(meta[i].nelmts*type_size))) {
NULL==(buf_out[i]=H5MM_malloc((size_t)(meta[i].nelmts*type_size)))) {
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed for result");
}

View File

@ -654,7 +654,7 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id)
herr_t
H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src)
{
int i;
uint u;
FUNC_ENTER(H5S_extent_copy, FAIL);
@ -668,15 +668,15 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src)
case H5S_SIMPLE:
if (src->u.simple.size) {
dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0);
for (i = 0; i < src->u.simple.rank; i++) {
dst->u.simple.size[i] = src->u.simple.size[i];
dst->u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0);
for (u = 0; u < src->u.simple.rank; u++) {
dst->u.simple.size[u] = src->u.simple.size[u];
}
}
if (src->u.simple.max) {
dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,src->u.simple.rank,0);
for (i = 0; i < src->u.simple.rank; i++) {
dst->u.simple.max[i] = src->u.simple.max[i];
dst->u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)src->u.simple.rank,0);
for (u = 0; u < src->u.simple.rank; u++) {
dst->u.simple.max[u] = src->u.simple.max[u];
}
}
break;
@ -754,8 +754,8 @@ H5S_copy(const H5S_t *src)
hssize_t
H5S_get_simple_extent_npoints(const H5S_t *ds)
{
hssize_t ret_value = -1;
intn i;
hssize_t ret_value = -1;
uintn u;
FUNC_ENTER(H5S_get_simple_extent_npoints, -1);
@ -768,8 +768,8 @@ H5S_get_simple_extent_npoints(const H5S_t *ds)
break;
case H5S_SIMPLE:
for (ret_value=1, i=0; i<ds->extent.u.simple.rank; i++) {
ret_value *= ds->extent.u.simple.size[i];
for (ret_value=1, u=0; u<ds->extent.u.simple.rank; u++) {
ret_value *= ds->extent.u.simple.size[u];
}
break;
@ -846,8 +846,8 @@ H5Sget_simple_extent_npoints(hid_t space_id)
hsize_t
H5S_get_npoints_max(const H5S_t *ds)
{
hsize_t ret_value = 0;
intn i;
hsize_t ret_value = 0;
uintn u;
FUNC_ENTER(H5S_get_npoints_max, 0);
@ -861,17 +861,17 @@ H5S_get_npoints_max(const H5S_t *ds)
case H5S_SIMPLE:
if (ds->extent.u.simple.max) {
for (ret_value=1, i=0; i<ds->extent.u.simple.rank; i++) {
if (H5S_UNLIMITED==ds->extent.u.simple.max[i]) {
for (ret_value=1, u=0; u<ds->extent.u.simple.rank; u++) {
if (H5S_UNLIMITED==ds->extent.u.simple.max[u]) {
ret_value = HSIZET_MAX;
break;
} else {
ret_value *= ds->extent.u.simple.max[i];
ret_value *= ds->extent.u.simple.max[u];
}
}
} else {
for (ret_value=1, i=0; i<ds->extent.u.simple.rank; i++) {
ret_value *= ds->extent.u.simple.size[i];
for (ret_value=1, u=0; u<ds->extent.u.simple.rank; u++) {
ret_value *= ds->extent.u.simple.size[u];
}
}
break;
@ -1164,7 +1164,7 @@ H5S_read(H5G_entry_t *ent)
ds->select.type=H5S_SEL_ALL;
/* Allocate space for the offset and set it to zeros */
if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,ds->extent.u.simple.rank,1))) {
if (NULL==(ds->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)ds->extent.u.simple.rank,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
}
@ -1193,7 +1193,7 @@ H5S_read(H5G_entry_t *ent)
intn
H5S_cmp(const H5S_t *ds1, const H5S_t *ds2)
{
intn i;
uintn u;
FUNC_ENTER(H5S_cmp, 0);
@ -1214,22 +1214,22 @@ H5S_cmp(const H5S_t *ds1, const H5S_t *ds2)
if (ds1->extent.u.simple.rank > ds2->extent.u.simple.rank)
HRETURN(1);
for (i = 0; i < ds1->extent.u.simple.rank; i++) {
if (ds1->extent.u.simple.size[i] < ds2->extent.u.simple.size[i])
for (u = 0; u < ds1->extent.u.simple.rank; u++) {
if (ds1->extent.u.simple.size[u] < ds2->extent.u.simple.size[u])
HRETURN(-1);
if (ds1->extent.u.simple.size[i] > ds2->extent.u.simple.size[i])
if (ds1->extent.u.simple.size[u] > ds2->extent.u.simple.size[u])
HRETURN(1);
}
/* don't compare max dimensions */
#ifdef LATER
for (i = 0; i < ds1->extent.u.simple.rank; i++) {
if ((ds1->extent.u.simple.perm ? ds1->extent.u.simple.perm[i] : i) <
(ds2->extent.u.simple.perm ? ds2->extent.u.simple.perm[i] : i))
for (u = 0; u < ds1->extent.u.simple.rank; u++) {
if ((ds1->extent.u.simple.perm ? ds1->extent.u.simple.perm[u] : u) <
(ds2->extent.u.simple.perm ? ds2->extent.u.simple.perm[u] : i))
HRETURN(-1);
if ((ds1->extent.u.simple.perm ? ds2->extent.u.simple.perm[i] : i) >
(ds2->extent.u.simple.perm ? ds2->extent.u.simple.perm[i] : i))
if ((ds1->extent.u.simple.perm ? ds2->extent.u.simple.perm[u] : u) >
(ds2->extent.u.simple.perm ? ds2->extent.u.simple.perm[u] : i))
HRETURN(1);
}
#endif
@ -1415,7 +1415,7 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims,
space->select.offset=H5FL_ARR_FREE(hssize_t,space->select.offset);
/* Allocate space for the offset and set it to zeros */
if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,rank,1))) {
if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)rank,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -1450,12 +1450,12 @@ H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims,
/* Set the rank and copy the dims */
space->extent.u.simple.rank = rank;
space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,rank,0);
space->extent.u.simple.size = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0);
HDmemcpy(space->extent.u.simple.size, dims, sizeof(hsize_t) * rank);
/* Copy the maximum dimensions if specified */
if(max!=NULL) {
space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,rank,0);
space->extent.u.simple.max = H5FL_ARR_ALLOC(hsize_t,(hsize_t)rank,0);
HDmemcpy(space->extent.u.simple.max, max, sizeof(hsize_t) * rank);
} /* end if */
}
@ -1538,8 +1538,10 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space)
H5S_conv_g[i]->read = H5S_all_read;
H5S_conv_g[i]->write = H5S_all_write;
}
else
H5S_conv_g[i]->read = H5S_conv_g[i]->write = NULL;
else {
H5S_conv_g[i]->read = NULL;
H5S_conv_g[i]->write = NULL;
}
HRETURN(H5S_conv_g[i]);
}
@ -1620,7 +1622,8 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space)
intn
H5S_extend (H5S_t *space, const hsize_t *size)
{
intn i, ret_value=0;
intn ret_value=0;
uintn u;
FUNC_ENTER (H5S_extend, FAIL);
@ -1628,11 +1631,11 @@ H5S_extend (H5S_t *space, const hsize_t *size)
assert (space && H5S_SIMPLE==space->extent.type);
assert (size);
for (i=0; i<space->extent.u.simple.rank; i++) {
if (space->extent.u.simple.size[i]<size[i]) {
for (u=0; u<space->extent.u.simple.rank; u++) {
if (space->extent.u.simple.size[u]<size[u]) {
if (space->extent.u.simple.max &&
H5S_UNLIMITED!=space->extent.u.simple.max[i] &&
space->extent.u.simple.max[i]<size[i]) {
H5S_UNLIMITED!=space->extent.u.simple.max[u] &&
space->extent.u.simple.max[u]<size[u]) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"dimension cannot be increased");
}
@ -1642,9 +1645,9 @@ H5S_extend (H5S_t *space, const hsize_t *size)
/* Update */
if (ret_value) {
for (i=0; i<space->extent.u.simple.rank; i++) {
if (space->extent.u.simple.size[i]<size[i]) {
space->extent.u.simple.size[i] = size[i];
for (u=0; u<space->extent.u.simple.rank; u++) {
if (space->extent.u.simple.size[u]<size[u]) {
space->extent.u.simple.size[u] = size[u];
}
}
}
@ -1884,7 +1887,7 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset)
/* Allocate space for new offset */
if(space->select.offset==NULL) {
if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,space->extent.u.simple.rank,0))) {
if (NULL==(space->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)space->extent.u.simple.rank,0))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}

View File

@ -24,28 +24,28 @@ static intn interface_initialize_g = 0;
static herr_t H5S_all_init (const struct H5O_layout_t *layout,
const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
static size_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
size_t max);
static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
static hsize_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts,
H5S_sel_iter_t *file_iter, hsize_t nelmts,
hid_t dxpl_id, void *buf/*out*/);
static herr_t H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts,
H5S_sel_iter_t *file_iter, hsize_t nelmts,
hid_t dxpl_id, const void *buf);
static size_t H5S_all_mgath (const void *_buf, size_t elmt_size,
static hsize_t H5S_all_mgath (const void *_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_tconv_buf/*out*/);
hsize_t nelmts, void *_tconv_buf/*out*/);
static herr_t H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_buf/*out*/);
hsize_t nelmts, void *_buf/*out*/);
static herr_t H5S_select_all(H5S_t *space);
const H5S_fconv_t H5S_ALL_FCONV[1] = {{
@ -123,7 +123,7 @@ H5S_all_init (const struct H5O_layout_t UNUSED *layout,
* Purpose: Figure out the optimal number of elements to transfer to/from
* the file.
*
* Return: non-negative number of elements on success, negative on
* Return: non-negative number of elements on success, zero on
* failure.
*
* Programmer: Quincey Koziol
@ -133,8 +133,8 @@ H5S_all_init (const struct H5O_layout_t UNUSED *layout,
*
*-------------------------------------------------------------------------
*/
static size_t
H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max)
static hsize_t
H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, hsize_t max)
{
hsize_t nelmts;
int m_ndims; /* file dimensionality */
@ -142,7 +142,7 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max)
hsize_t acc;
int i;
FUNC_ENTER (H5S_all_favail, FAIL);
FUNC_ENTER (H5S_all_favail, 0);
/* Check args */
assert (space && H5S_SEL_ALL==space->select.type);
@ -158,7 +158,7 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max)
acc *= size[i];
nelmts = (max/acc) * acc;
if (nelmts<=0) {
HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL,
HRETURN_ERROR (H5E_IO, H5E_UNSUPPORTED, 0,
"strip mine buffer is too small");
}
@ -191,12 +191,12 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max)
* what the virtual file layer needs.
*-------------------------------------------------------------------------
*/
static size_t
static hsize_t
H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts, hid_t dxpl_id,
H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id,
void *_buf/*out*/)
{
hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/
@ -252,11 +252,11 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
*/
if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize, hsize,
zero, file_offset, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
}
/* Advance iterator */
file_iter->all.elmt_left--;
file_iter->all.elmt_left-=nelmts;
file_iter->all.offset+=nelmts;
FUNC_LEAVE (nelmts);
@ -287,7 +287,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline, const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, H5S_sel_iter_t *file_iter,
size_t nelmts, hid_t dxpl_id, const void *_buf)
hsize_t nelmts, hid_t dxpl_id, const void *_buf)
{
hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
@ -342,7 +342,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
}
/* Advance iterator */
file_iter->all.elmt_left--;
file_iter->all.elmt_left-=nelmts;
file_iter->all.offset+=nelmts;
FUNC_LEAVE (SUCCEED);
@ -368,10 +368,10 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout,
*
*-------------------------------------------------------------------------
*/
static size_t
static hsize_t
H5S_all_mgath (const void *_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_tconv_buf/*out*/)
hsize_t nelmts, void *_tconv_buf/*out*/)
{
hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
@ -426,14 +426,15 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
/*
* Scatter from conversion buffer to application memory.
*/
if (H5V_hyper_copy (space_ndims+1, hsize, hsize, zero, tconv_buf,
H5_CHECK_OVERFLOW(space_ndims+1,intn,uintn);
if (H5V_hyper_copy ((uintn)(space_ndims+1), hsize, hsize, zero, tconv_buf,
mem_size, mem_offset, buf)<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0,
"unable to scatter data to memory");
}
/* Advance iterator */
mem_iter->all.elmt_left--;
mem_iter->all.elmt_left-=nelmts;
mem_iter->all.offset+=nelmts;
FUNC_LEAVE (nelmts);
@ -459,7 +460,7 @@ H5S_all_mgath (const void *_buf, size_t elmt_size,
static herr_t
H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_buf/*out*/)
hsize_t nelmts, void *_buf/*out*/)
{
hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /*slab offset in app buf*/
hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
@ -516,14 +517,15 @@ H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
/*
* Scatter from conversion buffer to application memory.
*/
if (H5V_hyper_copy (space_ndims+1, hsize, mem_size, mem_offset, buf,
H5_CHECK_OVERFLOW(space_ndims+1,intn,uintn);
if (H5V_hyper_copy ((uintn)(space_ndims+1), hsize, mem_size, mem_offset, buf,
hsize, zero, tconv_buf)<0) {
HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
"unable to scatter data to memory");
}
/* Advance iterator */
mem_iter->all.elmt_left--;
mem_iter->all.elmt_left-=nelmts;
mem_iter->all.offset+=nelmts;
FUNC_LEAVE (SUCCEED);
@ -567,7 +569,7 @@ H5S_all_read(H5F_t *f, const H5O_layout_t *layout, const H5O_pline_t *pline,
hsize_t size[H5O_LAYOUT_NDIMS];
hssize_t file_offset[H5O_LAYOUT_NDIMS];
hssize_t mem_offset[H5O_LAYOUT_NDIMS];
int i;
uintn u;
FUNC_ENTER(H5S_all_read, FAIL);
*must_convert = TRUE;
@ -588,8 +590,8 @@ printf("%s: check 1.0\n",FUNC);
/* Check for a "regular" hyperslab selection */
if(mem_space->select.sel_info.hslab.diminfo != NULL) {
/* Check each dimension */
for(count=1,i=0; i<mem_space->extent.u.simple.rank; i++)
count*=mem_space->select.sel_info.hslab.diminfo[i].count;
for(count=1,u=0; u<mem_space->extent.u.simple.rank; u++)
count*=mem_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
goto fall_through;
@ -609,8 +611,8 @@ printf("%s: check 1.0\n",FUNC);
/* Check for a "regular" hyperslab selection */
if(file_space->select.sel_info.hslab.diminfo != NULL) {
/* Check each dimension */
for(count=1,i=0; i<file_space->extent.u.simple.rank; i++)
count*=file_space->select.sel_info.hslab.diminfo[i].count;
for(count=1,u=0; u<file_space->extent.u.simple.rank; u++)
count*=file_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
goto fall_through;
@ -626,56 +628,56 @@ printf("%s: check 1.0\n",FUNC);
goto fall_through;
/* Get information about memory and file */
for (i=0; i<mem_space->extent.u.simple.rank; i++) {
for (u=0; u<mem_space->extent.u.simple.rank; u++) {
if (mem_space->extent.u.simple.max &&
mem_space->extent.u.simple.size[i]!=mem_space->extent.u.simple.max[i])
mem_space->extent.u.simple.size[u]!=mem_space->extent.u.simple.max[u])
goto fall_through;
if (file_space->extent.u.simple.max &&
file_space->extent.u.simple.size[i]!=file_space->extent.u.simple.max[i])
file_space->extent.u.simple.size[u]!=file_space->extent.u.simple.max[u])
goto fall_through;
if(mem_space->select.type==H5S_SEL_HYPERSLABS) {
/* Check for a "regular" hyperslab selection */
if(mem_space->select.sel_info.hslab.diminfo != NULL) {
mem_size=mem_space->select.sel_info.hslab.diminfo[i].block;
mem_off=mem_space->select.sel_info.hslab.diminfo[i].start;
mem_size=mem_space->select.sel_info.hslab.diminfo[u].block;
mem_off=mem_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
mem_size=(mem_node->end[i]-mem_node->start[i])+1;
mem_off=mem_node->start[i];
mem_size=(mem_node->end[u]-mem_node->start[u])+1;
mem_off=mem_node->start[u];
} /* end else */
} /* end if */
else {
mem_size=mem_space->extent.u.simple.size[i];
mem_size=mem_space->extent.u.simple.size[u];
mem_off=0;
} /* end else */
if(file_space->select.type==H5S_SEL_HYPERSLABS) {
/* Check for a "regular" hyperslab selection */
if(file_space->select.sel_info.hslab.diminfo != NULL) {
file_size=file_space->select.sel_info.hslab.diminfo[i].block;
file_off=file_space->select.sel_info.hslab.diminfo[i].start;
file_size=file_space->select.sel_info.hslab.diminfo[u].block;
file_off=file_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
file_size=(file_node->end[i]-file_node->start[i])+1;
file_off=file_node->start[i];
file_size=(file_node->end[u]-file_node->start[u])+1;
file_off=file_node->start[u];
} /* end else */
} /* end if */
else {
file_size=file_space->extent.u.simple.size[i];
file_size=file_space->extent.u.simple.size[u];
file_off=0;
} /* end else */
if (mem_size!=file_size)
goto fall_through;
size[i] = file_size;
file_offset[i] = file_off;
mem_offset[i] = mem_off;
size[u] = file_size;
file_offset[u] = file_off;
mem_offset[u] = mem_off;
}
size[i] = elmt_size;
file_offset[i] = 0;
mem_offset[i] = 0;
size[u] = elmt_size;
file_offset[u] = 0;
mem_offset[u] = 0;
#ifdef QAK
printf("%s: check 2.0\n",FUNC);
@ -731,7 +733,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
hsize_t size[H5O_LAYOUT_NDIMS];
hssize_t file_offset[H5O_LAYOUT_NDIMS];
hssize_t mem_offset[H5O_LAYOUT_NDIMS];
int i;
uintn u;
FUNC_ENTER(H5S_all_write, FAIL);
*must_convert = TRUE;
@ -749,8 +751,8 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
/* Check for a "regular" hyperslab selection */
if(mem_space->select.sel_info.hslab.diminfo != NULL) {
/* Check each dimension */
for(count=1,i=0; i<mem_space->extent.u.simple.rank; i++)
count*=mem_space->select.sel_info.hslab.diminfo[i].count;
for(count=1,u=0; u<mem_space->extent.u.simple.rank; u++)
count*=mem_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
goto fall_through;
@ -770,8 +772,8 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
/* Check for a "regular" hyperslab selection */
if(file_space->select.sel_info.hslab.diminfo != NULL) {
/* Check each dimension */
for(count=1,i=0; i<file_space->extent.u.simple.rank; i++)
count*=file_space->select.sel_info.hslab.diminfo[i].count;
for(count=1,u=0; u<file_space->extent.u.simple.rank; u++)
count*=file_space->select.sel_info.hslab.diminfo[u].count;
/* If the regular hyperslab definition creates more than one hyperslab, fall through */
if(count>1)
goto fall_through;
@ -787,56 +789,56 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
goto fall_through;
/* Get information about memory and file */
for (i=0; i<mem_space->extent.u.simple.rank; i++) {
for (u=0; u<mem_space->extent.u.simple.rank; u++) {
if (mem_space->extent.u.simple.max &&
mem_space->extent.u.simple.size[i]!=mem_space->extent.u.simple.max[i])
mem_space->extent.u.simple.size[u]!=mem_space->extent.u.simple.max[u])
goto fall_through;
if (file_space->extent.u.simple.max &&
file_space->extent.u.simple.size[i]!=file_space->extent.u.simple.max[i])
file_space->extent.u.simple.size[u]!=file_space->extent.u.simple.max[u])
goto fall_through;
if(mem_space->select.type==H5S_SEL_HYPERSLABS) {
/* Check for a "regular" hyperslab selection */
if(mem_space->select.sel_info.hslab.diminfo != NULL) {
mem_size=mem_space->select.sel_info.hslab.diminfo[i].block;
mem_off=mem_space->select.sel_info.hslab.diminfo[i].start;
mem_size=mem_space->select.sel_info.hslab.diminfo[u].block;
mem_off=mem_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
mem_size=(mem_node->end[i]-mem_node->start[i])+1;
mem_off=mem_node->start[i];
mem_size=(mem_node->end[u]-mem_node->start[u])+1;
mem_off=mem_node->start[u];
} /* end else */
} /* end if */
else {
mem_size=mem_space->extent.u.simple.size[i];
mem_size=mem_space->extent.u.simple.size[u];
mem_off=0;
} /* end else */
if(file_space->select.type==H5S_SEL_HYPERSLABS) {
/* Check for a "regular" hyperslab selection */
if(file_space->select.sel_info.hslab.diminfo != NULL) {
file_size=file_space->select.sel_info.hslab.diminfo[i].block;
file_off=file_space->select.sel_info.hslab.diminfo[i].start;
file_size=file_space->select.sel_info.hslab.diminfo[u].block;
file_off=file_space->select.sel_info.hslab.diminfo[u].start;
} /* end if */
else {
file_size=(file_node->end[i]-file_node->start[i])+1;
file_off=file_node->start[i];
file_size=(file_node->end[u]-file_node->start[u])+1;
file_off=file_node->start[u];
} /* end else */
} /* end if */
else {
file_size=file_space->extent.u.simple.size[i];
file_size=file_space->extent.u.simple.size[u];
file_off=0;
} /* end else */
if (mem_size!=file_size)
goto fall_through;
size[i] = file_size;
file_offset[i] = file_off;
mem_offset[i] = mem_off;
size[u] = file_size;
file_offset[u] = file_off;
mem_offset[u] = mem_off;
}
size[i] = elmt_size;
file_offset[i] = 0;
mem_offset[i] = 0;
size[u] = elmt_size;
file_offset[u] = 0;
mem_offset[u] = 0;
/* Write data to the file */
if (H5F_arr_write(f, dxpl_id, layout, pline, NULL, efl, size,
@ -879,6 +881,7 @@ H5S_all_release (H5S_t UNUSED *space)
FUNC_LEAVE (SUCCEED);
} /* H5S_all_release() */
/*--------------------------------------------------------------------------
NAME
@ -901,7 +904,7 @@ H5S_all_release (H5S_t UNUSED *space)
hsize_t
H5S_all_npoints (const H5S_t *space)
{
intn i; /* Counters */
uintn u; /* Counters */
hsize_t ret_value;
FUNC_ENTER (H5S_all_npoints, 0);
@ -909,11 +912,12 @@ H5S_all_npoints (const H5S_t *space)
/* Check args */
assert (space);
for(i=0, ret_value=1; i<space->extent.u.simple.rank; i++)
ret_value*=space->extent.u.simple.size[i];
for(u=0, ret_value=1; u<space->extent.u.simple.rank; u++)
ret_value*=space->extent.u.simple.size[u];
FUNC_LEAVE (ret_value);
} /* H5S_all_npoints() */
/*--------------------------------------------------------------------------
NAME
@ -954,6 +958,7 @@ H5S_all_select_serialize (const H5S_t *space, uint8_t *buf)
FUNC_LEAVE (ret_value);
} /* H5S_all_select_serialize() */
/*--------------------------------------------------------------------------
NAME
@ -991,6 +996,7 @@ H5S_all_select_deserialize (H5S_t *space, const uint8_t UNUSED *buf)
done:
FUNC_LEAVE (ret_value);
} /* H5S_all_select_deserialize() */
/*--------------------------------------------------------------------------
NAME
@ -1163,7 +1169,7 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op
hsize_t offset; /* offset of region in buffer */
hsize_t nelemts; /* Number of elements to iterate through */
void *tmp_buf; /* temporary location of the element in the buffer */
intn rank; /* Dataspace rank */
uintn rank; /* Dataspace rank */
intn indx; /* Index to increment */
herr_t ret_value=0; /* return value */
@ -1193,7 +1199,7 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op
offset=H5V_array_offset(rank+1,mem_size,(const hssize_t *)mem_offset);
tmp_buf=((char *)buf+offset);
ret_value=(*op)(tmp_buf,type_id,rank,(hssize_t *)mem_offset,operator_data);
ret_value=(*op)(tmp_buf,type_id,(hsize_t)rank,(hssize_t *)mem_offset,operator_data);
/* Decrement the number of elements to iterate through */
nelemts--;

File diff suppressed because it is too large Load Diff

View File

@ -208,7 +208,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5S_none_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op,
H5S_none_select_iterate(void UNUSED *buf, hid_t UNUSED type_id, H5S_t UNUSED *space, H5D_operator_t UNUSED op,
void UNUSED *operator_data)
{
herr_t ret_value=SUCCEED; /* return value */

View File

@ -23,7 +23,7 @@
*/
/* Simple extent container */
typedef struct H5S_simple_t {
intn rank; /* Number of dimensions */
uintn rank; /* Number of dimensions */
hsize_t *size; /* Current size of the dimensions */
hsize_t *max; /* Maximum size of the dimensions */
#ifdef LATER
@ -185,7 +185,7 @@ __DLL__ herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src);
__DLL__ htri_t H5S_hyper_select_valid(const H5S_t *space);
__DLL__ intn H5S_hyper_bound_comp(const void *_b1, const void *_b2);
__DLL__ herr_t H5S_hyper_node_add(H5S_hyper_node_t **head, intn endflag,
intn rank, const hssize_t *start,
uintn rank, const hssize_t *start,
const hsize_t *size);
__DLL__ herr_t H5S_hyper_clip(H5S_t *space, H5S_hyper_node_t *nodes,
H5S_hyper_node_t **uniq,

View File

@ -25,29 +25,29 @@ static intn interface_initialize_g = 0;
static herr_t H5S_point_init (const struct H5O_layout_t *layout,
const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
static size_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
size_t max);
static size_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
static hsize_t H5S_point_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
hsize_t max);
static hsize_t H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts,
H5S_sel_iter_t *file_iter, hsize_t nelmts,
hid_t dxpl_id, void *buf/*out*/);
static herr_t H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts,
H5S_sel_iter_t *file_iter, hsize_t nelmts,
hid_t dxpl_id, const void *buf);
static size_t H5S_point_mgath (const void *_buf, size_t elmt_size,
static hsize_t H5S_point_mgath (const void *_buf, size_t elmt_size,
const H5S_t *mem_space,
H5S_sel_iter_t *mem_iter, size_t nelmts,
H5S_sel_iter_t *mem_iter, hsize_t nelmts,
void *_tconv_buf/*out*/);
static herr_t H5S_point_mscat (const void *_tconv_buf, size_t elmt_size,
const H5S_t *mem_space,
H5S_sel_iter_t *mem_iter, size_t nelmts,
H5S_sel_iter_t *mem_iter, hsize_t nelmts,
void *_buf/*out*/);
static herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op,
size_t num_elem, const hssize_t **coord);
@ -228,7 +228,7 @@ done:
*
* Purpose: Figure out the optimal number of elements to transfer to/from the file
*
* Return: non-negative number of elements on success, negative on failure
* Return: non-negative number of elements on success, zero on failure
*
* Programmer: Quincey Koziol
* Tuesday, June 16, 1998
@ -237,19 +237,18 @@ done:
*
*-------------------------------------------------------------------------
*/
static size_t
static hsize_t
H5S_point_favail (const H5S_t UNUSED *space,
const H5S_sel_iter_t *sel_iter, size_t max)
const H5S_sel_iter_t *sel_iter, hsize_t max)
{
FUNC_ENTER (H5S_point_favail, FAIL);
FUNC_ENTER (H5S_point_favail, 0);
/* Check args */
assert (space && H5S_SEL_POINTS==space->select.type);
assert (sel_iter);
#ifdef QAK
printf("%s: check 1.0, ret=%d\n",
FUNC,(int)MIN(sel_iter->pnt.elmt_left,max));
printf("%s: check 1.0, ret=%d\n", FUNC,(int)MIN(sel_iter->pnt.elmt_left,max));
#endif /* QAK */
FUNC_LEAVE (MIN(sel_iter->pnt.elmt_left,max));
} /* H5S_point_favail() */
@ -284,12 +283,12 @@ H5S_point_favail (const H5S_t UNUSED *space,
* what the virtual file layer needs.
*-------------------------------------------------------------------------
*/
static size_t
static hsize_t
H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts, hid_t dxpl_id,
H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id,
void *_buf/*out*/)
{
hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/
@ -297,8 +296,8 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero */
uint8_t *buf=(uint8_t *)_buf; /* Alias for pointer arithmetic */
uintn ndims; /* Number of dimensions of dataset */
intn i; /*counters */
size_t num_read; /* number of elements read into buffer */
uintn u; /*counters */
hsize_t num_read; /* number of elements read into buffer */
FUNC_ENTER (H5S_point_fgath, 0);
@ -316,9 +315,9 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
#endif /* QAK */
ndims=file_space->extent.u.simple.rank;
/* initialize hyperslab size and offset in memory buffer */
for(i=0; i<(int)(ndims+1); i++) {
hsize[i]=1; /* hyperslab size is 1, except for last element */
zero[i]=0; /* memory offset is 0 */
for(u=0; u<ndims+1; u++) {
hsize[u]=1; /* hyperslab size is 1, except for last element */
zero[u]=0; /* memory offset is 0 */
} /* end for */
hsize[ndims] = elmt_size;
@ -330,31 +329,25 @@ H5S_point_fgath (H5F_t *f, const struct H5O_layout_t *layout,
while(num_read<nelmts) {
if(file_iter->pnt.elmt_left>0) {
/* Copy the location of the point to get */
HDmemcpy(file_offset, file_iter->pnt.curr->pnt,
ndims*sizeof(hssize_t));
HDmemcpy(file_offset, file_iter->pnt.curr->pnt, ndims*sizeof(hssize_t));
file_offset[ndims] = 0;
/* Add in the offset */
for(i=0; i<file_space->extent.u.simple.rank; i++)
file_offset[i] += file_space->select.offset[i];
for(u=0; u<file_space->extent.u.simple.rank; u++)
file_offset[u] += file_space->select.offset[u];
/* Go read the point */
if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize,
hsize, zero, file_offset, buf/*out*/)<0) {
if (H5F_arr_read(f, dxpl_id, layout, pline, fill, efl, hsize, hsize, zero, file_offset, buf/*out*/)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error");
}
#ifdef QAK
printf("%s: check 3.0\n",FUNC);
{
for(i=0; i<ndims; i++) {
printf("%s: %d - pnt=%d\n",
FUNC, (int)i, (int)file_iter->pnt.curr->pnt[i]);
printf("%s: %d - file_offset=%d\n",
FUNC, (int)i, (int)file_offset[i]);
for(u=0; u<ndims; u++) {
printf("%s: %u - pnt=%d\n", FUNC, (unsigned)u, (int)file_iter->pnt.curr->pnt[u]);
printf("%s: %u - file_offset=%d\n", FUNC, (unsigned)u, (int)file_offset[u]);
}
printf("%s: *buf=%u\n",FUNC,(unsigned)*buf);
}
#endif /* QAK */
/* Increment the offset of the buffer */
buf+=elmt_size;
@ -398,7 +391,7 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill, const struct H5O_efl_t *efl,
size_t elmt_size, const H5S_t *file_space,
H5S_sel_iter_t *file_iter, size_t nelmts, hid_t dxpl_id,
H5S_sel_iter_t *file_iter, hsize_t nelmts, hid_t dxpl_id,
const void *_buf)
{
hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of hyperslab */
@ -406,8 +399,8 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
hssize_t zero[H5O_LAYOUT_NDIMS]; /*zero vector */
const uint8_t *buf=(const uint8_t *)_buf; /* Alias for pointer arithmetic */
uintn ndims; /* Number of dimensions of dataset */
intn i; /*counters */
size_t num_written; /* number of elements written from buffer */
uintn u; /*counters */
hsize_t num_written; /* number of elements written from buffer */
FUNC_ENTER (H5S_point_fscat, FAIL);
@ -425,9 +418,9 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
#endif /* QAK */
ndims=file_space->extent.u.simple.rank;
/* initialize hyperslab size and offset in memory buffer */
for(i=0; i<(int)(ndims+1); i++) {
hsize[i]=1; /* hyperslab size is 1, except for last element */
zero[i]=0; /* memory offset is 0 */
for(u=0; u<ndims+1; u++) {
hsize[u]=1; /* hyperslab size is 1, except for last element */
zero[u]=0; /* memory offset is 0 */
} /* end for */
hsize[ndims] = elmt_size;
@ -440,9 +433,8 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
#ifdef QAK
printf("%s: check 2.0\n",FUNC);
{
for(i=0; i<ndims; i++) {
printf("%s: %d - pnt=%d\n",
FUNC, (int)i, (int)file_iter->pnt.curr->pnt[i]);
for(u=0; u<ndims; u++) {
printf("%s: %u - pnt=%d\n", FUNC, (unsigned)u, (int)file_iter->pnt.curr->pnt[u]);
}
}
#endif /* QAK */
@ -451,24 +443,19 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
file_offset[ndims] = 0;
/* Add in the offset, if there is one */
for(i=0; i<file_space->extent.u.simple.rank; i++)
file_offset[i] += file_space->select.offset[i];
for(u=0; u<file_space->extent.u.simple.rank; u++)
file_offset[u] += file_space->select.offset[u];
#ifdef QAK
printf("%s: check 3.0\n",FUNC);
{
for(i=0; i<ndims; i++) {
printf("%s: %d - pnt=%d\n",
FUNC,(int)i,(int)file_iter->pnt.curr->pnt[i]);
printf("%s: %d - file_offset=%d\n",
FUNC,(int)i,(int)file_offset[i]);
}
printf("%s: *buf=%u\n",FUNC,(unsigned)*buf);
}
for(u=0; u<ndims; u++) {
printf("%s: %u - pnt=%d\n", FUNC,(unsigned)u,(int)file_iter->pnt.curr->pnt[u]);
printf("%s: %u - file_offset=%d\n", FUNC,(unsigned)u,(int)file_offset[u]);
}
printf("%s: *buf=%u\n",FUNC,(unsigned)*buf);
#endif /* QAK */
/* Go write the point */
if (H5F_arr_write(f, dxpl_id, layout, pline, fill, efl, hsize,
hsize, zero, file_offset, buf)<0) {
if (H5F_arr_write(f, dxpl_id, layout, pline, fill, efl, hsize, hsize, zero, file_offset, buf)<0) {
HRETURN_ERROR(H5E_DATASPACE, H5E_WRITEERROR, 0, "write error");
}
@ -482,8 +469,7 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
file_iter->pnt.elmt_left--;
file_iter->pnt.curr=file_iter->pnt.curr->next;
#ifdef QAK
printf("%s: check 5.0, file_iter->pnt.curr=%p\n",
FUNC,file_iter->pnt.curr);
printf("%s: check 5.0, file_iter->pnt.curr=%p\n", FUNC,file_iter->pnt.curr);
#endif
} /* end while */
@ -510,10 +496,10 @@ H5S_point_fscat (H5F_t *f, const struct H5O_layout_t *layout,
*
*-------------------------------------------------------------------------
*/
static size_t
static hsize_t
H5S_point_mgath (const void *_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_tconv_buf/*out*/)
hsize_t nelmts, void *_tconv_buf/*out*/)
{
hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
const uint8_t *buf=(const uint8_t *)_buf; /* Get local copies for address arithmetic */
@ -522,7 +508,7 @@ H5S_point_mgath (const void *_buf, size_t elmt_size,
hsize_t off; /* coordinate offset */
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
size_t num_gath; /* number of elements gathered */
hsize_t num_gath; /* number of elements gathered */
FUNC_ENTER (H5S_point_mgath, 0);
@ -589,7 +575,7 @@ H5S_point_mgath (const void *_buf, size_t elmt_size,
static herr_t
H5S_point_mscat (const void *_tconv_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *_buf/*out*/)
hsize_t nelmts, void *_buf/*out*/)
{
hsize_t mem_size[H5O_LAYOUT_NDIMS]; /*total size of app buf */
uint8_t *buf=(uint8_t *)_buf; /* Get local copies for address arithmetic */
@ -598,7 +584,7 @@ H5S_point_mscat (const void *_tconv_buf, size_t elmt_size,
hsize_t off; /* coordinate offset */
intn space_ndims; /*dimensionality of space*/
intn i; /*counters */
size_t num_scat; /* Number of elements scattered */
hsize_t num_scat; /* Number of elements scattered */
FUNC_ENTER (H5S_point_mscat, FAIL);
@ -826,8 +812,8 @@ done:
htri_t
H5S_point_select_valid (const H5S_t *space)
{
H5S_pnt_node_t *curr; /* Point information nodes */
intn i; /* Counter */
H5S_pnt_node_t *curr; /* Point information nodes */
uintn u; /* Counter */
htri_t ret_value=TRUE; /* return value */
FUNC_ENTER (H5S_point_select_valid, FAIL);
@ -841,17 +827,17 @@ printf("%s: check 1.0\n",FUNC);
curr=space->select.sel_info.pnt_lst->head;
while(curr!=NULL) {
/* Check each dimension */
for(i=0; i<space->extent.u.simple.rank; i++) {
for(u=0; u<space->extent.u.simple.rank; u++) {
#ifdef QAK
printf("%s: check 2.0\n",FUNC);
printf("%s: curr->pnt[%d]=%d\n",FUNC,(int)i,(int)curr->pnt[i]);
printf("%s: space->select.offset[%d]=%d\n",FUNC,(int)i,(int)space->select.offset[i]);
printf("%s: space->extent.u.simple.size[%d]=%d\n",FUNC,(int)i,(int)space->extent.u.simple.size[i]);
printf("%s: curr->pnt[%u]=%d\n",FUNC,(unsigned)u,(int)curr->pnt[u]);
printf("%s: space->select.offset[%u]=%d\n",FUNC,(unsigned)u,(int)space->select.offset[u]);
printf("%s: space->extent.u.simple.size[%u]=%d\n",FUNC,(unsigned)u,(int)space->extent.u.simple.size[u]);
#endif /* QAK */
/* Check if an offset has been defined */
/* Bounds check the selected point + offset against the extent */
if(((curr->pnt[i]+space->select.offset[i])>(hssize_t)space->extent.u.simple.size[i])
|| ((curr->pnt[i]+space->select.offset[i])<0)) {
if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.u.simple.size[u])
|| ((curr->pnt[u]+space->select.offset[u])<0)) {
ret_value=FALSE;
break;
} /* end if */
@ -934,10 +920,10 @@ H5S_point_select_serial_size (const H5S_t *space)
herr_t
H5S_point_select_serialize (const H5S_t *space, uint8_t *buf)
{
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
intn i; /* local counting variable */
H5S_pnt_node_t *curr; /* Point information nodes */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
uintn u; /* local counting variable */
herr_t ret_value=FAIL; /* return value */
FUNC_ENTER (H5S_point_select_serialize, FAIL);
@ -952,7 +938,7 @@ H5S_point_select_serialize (const H5S_t *space, uint8_t *buf)
buf+=4; /* skip over space for length */
/* Encode number of dimensions */
INT32ENCODE(buf, (uint32_t)space->extent.u.simple.rank);
UINT32ENCODE(buf, (uint32_t)space->extent.u.simple.rank);
len+=4;
/* Encode number of elements */
@ -966,8 +952,8 @@ H5S_point_select_serialize (const H5S_t *space, uint8_t *buf)
len+=4*space->extent.u.simple.rank;
/* Encode each point */
for(i=0; i<space->extent.u.simple.rank; i++)
UINT32ENCODE(buf, (uint32_t)curr->pnt[i]);
for(u=0; u<space->extent.u.simple.rank; u++)
UINT32ENCODE(buf, (uint32_t)curr->pnt[u]);
curr=curr->next;
} /* end while */
@ -1004,7 +990,7 @@ herr_t
H5S_point_select_deserialize (H5S_t *space, const uint8_t *buf)
{
H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */
int32_t rank; /* Rank of points */
uint32_t rank; /* Rank of points */
size_t num_elem=0; /* Number of elements in selection */
hssize_t *coord=NULL, *tcoord; /* Pointer to array of elements */
uintn i,j; /* local counting variables */
@ -1018,7 +1004,7 @@ H5S_point_select_deserialize (H5S_t *space, const uint8_t *buf)
/* Deserialize points to select */
buf+=16; /* Skip over selection header */
INT32DECODE(buf,rank); /* decode the rank of the point selection */
UINT32DECODE(buf,rank); /* decode the rank of the point selection */
if(rank!=space->extent.u.simple.rank)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "rank of pointer does not match dataspace");
UINT32DECODE(buf,num_elem); /* decode the number of points */
@ -1330,7 +1316,7 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
hsize_t offset; /* offset of region in buffer */
void *tmp_buf; /* temporary location of the element in the buffer */
H5S_pnt_node_t *node; /* Point node */
intn rank; /* Dataspace rank */
uintn rank; /* Dataspace rank */
herr_t ret_value=0; /* return value */
FUNC_ENTER (H5S_point_select_iterate, 0);
@ -1358,7 +1344,7 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
offset=H5V_array_offset(rank+1,mem_size,(const hssize_t *)mem_offset);
tmp_buf=((char *)buf+offset);
ret_value=(*op)(tmp_buf,type_id,rank,node->pnt,operator_data);
ret_value=(*op)(tmp_buf,type_id,(hsize_t)rank,node->pnt,operator_data);
node=node->next;
} /* end while */

View File

@ -85,16 +85,16 @@ typedef struct H5S_fconv_t {
H5S_sel_iter_t *iter, size_t *min_elem_out);
/* Determine optimal number of elements to transfer */
size_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter,
size_t max);
hsize_t (*avail)(const H5S_t *file_space, const H5S_sel_iter_t *file_iter,
hsize_t max);
/* Gather elements from disk to type conversion buffer */
size_t (*gath)(H5F_t *f, const struct H5O_layout_t *layout,
hsize_t (*gath)(H5F_t *f, const struct H5O_layout_t *layout,
const struct H5O_pline_t *pline,
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, H5S_sel_iter_t *file_iter,
size_t nelmts, hid_t dxpl_id, void *tconv_buf/*out*/);
hsize_t nelmts, hid_t dxpl_id, void *tconv_buf/*out*/);
/* Scatter elements from type conversion buffer to disk */
herr_t (*scat)(H5F_t *f, const struct H5O_layout_t *layout,
@ -102,7 +102,7 @@ typedef struct H5S_fconv_t {
const struct H5O_fill_t *fill,
const struct H5O_efl_t *efl, size_t elmt_size,
const H5S_t *file_space, H5S_sel_iter_t *file_iter,
size_t nelmts, hid_t dxpl_id, const void *tconv_buf);
hsize_t nelmts, hid_t dxpl_id, const void *tconv_buf);
} H5S_fconv_t;
typedef struct H5S_mconv_t {
@ -115,14 +115,14 @@ typedef struct H5S_mconv_t {
H5S_sel_iter_t *iter, size_t *min_elem_out);
/* Gather elements from app buffer to type conversion buffer */
size_t (*gath)(const void *buf, size_t elmt_size,
hsize_t (*gath)(const void *buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *tconv_buf/*out*/);
hsize_t nelmts, void *tconv_buf/*out*/);
/* Scatter elements from type conversion buffer to application buffer */
herr_t (*scat)(const void *tconv_buf, size_t elmt_size,
const H5S_t *mem_space, H5S_sel_iter_t *mem_iter,
size_t nelmts, void *buf/*out*/);
hsize_t nelmts, void *buf/*out*/);
} H5S_mconv_t;
typedef struct H5S_conv_t {

View File

@ -69,7 +69,7 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src)
/* Need to copy order information still */
/* Copy offset information */
if (NULL==(dst->select.offset = H5FL_ARR_ALLOC(hssize_t, src->extent.u.simple.rank,1))) {
if (NULL==(dst->select.offset = H5FL_ARR_ALLOC(hssize_t,(hsize_t)src->extent.u.simple.rank,1))) {
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL,
"memory allocation failed");
}
@ -563,8 +563,7 @@ H5S_select_deserialize (H5S_t *space, const uint8_t *buf)
ret_value=H5S_none_select_deserialize(space,buf);
break;
case H5S_SEL_ERROR:
case H5S_SEL_N:
default:
break;
}
@ -592,7 +591,7 @@ static hssize_t
H5S_get_select_hyper_nblocks(H5S_t *space)
{
hssize_t ret_value=FAIL; /* return value */
intn i; /* Counter */
uintn u; /* Counter */
FUNC_ENTER (H5S_get_select_hyper_nblocks, FAIL);
@ -604,13 +603,13 @@ H5S_get_select_hyper_nblocks(H5S_t *space)
#ifdef QAK
{
H5S_hyper_dim_t *diminfo=space->select.sel_info.hslab.diminfo;
for(i=0; i<space->extent.u.simple.rank; i++)
printf("%s: (%d) start=%d, stride=%d, count=%d, block=%d\n",FUNC,i,(int)diminfo[i].start,(int)diminfo[i].stride,(int)diminfo[i].count,(int)diminfo[i].block);
for(u=0; u<space->extent.u.simple.rank; u++)
printf("%s: (%u) start=%d, stride=%d, count=%d, block=%d\n",FUNC,u,(int)diminfo[u].start,(int)diminfo[u].stride,(int)diminfo[u].count,(int)diminfo[u].block);
}
#endif /*QAK */
/* Check each dimension */
for(ret_value=1,i=0; i<space->extent.u.simple.rank; i++)
ret_value*=space->select.sel_info.hslab.app_diminfo[i].count;
for(ret_value=1,u=0; u<space->extent.u.simple.rank; u++)
ret_value*=space->select.sel_info.hslab.app_diminfo[u].count;
} /* end if */
else
ret_value = (hssize_t)space->select.sel_info.hslab.hyper_lst->count;

View File

@ -1380,7 +1380,7 @@ H5T_term_interface(void)
H5T_print_stats(path, &nprint/*in,out*/);
path->cdata.command = H5T_CONV_FREE;
if ((path->func)(FAIL, FAIL, &(path->cdata),
0, 0, 0, NULL, NULL,H5P_DEFAULT)<0) {
(hsize_t)0, 0, 0, NULL, NULL,H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf (H5DEBUG(T), "H5T: conversion function "
@ -4337,7 +4337,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
}
HDmemset(&cdata, 0, sizeof cdata);
cdata.command = H5T_CONV_INIT;
if ((func)(tmp_sid, tmp_did, &cdata, 0, 0, 0, NULL, NULL,
if ((func)(tmp_sid, tmp_did, &cdata, (hsize_t)0, 0, 0, NULL, NULL,
H5P_DEFAULT)<0) {
H5I_dec_ref(tmp_sid);
H5I_dec_ref(tmp_did);
@ -4370,7 +4370,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
H5T_print_stats(old_path, &nprint);
old_path->cdata.command = H5T_CONV_FREE;
if ((old_path->func)(tmp_sid, tmp_did, &(old_path->cdata),
0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
(hsize_t)0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
fprintf (H5DEBUG(T), "H5T: conversion function 0x%08lx "
@ -4473,7 +4473,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
/* Shut down path */
H5T_print_stats(path, &nprint);
path->cdata.command = H5T_CONV_FREE;
if ((path->func)(FAIL, FAIL, &(path->cdata), 0, 0, 0, NULL, NULL,
if ((path->func)(FAIL, FAIL, &(path->cdata), (hsize_t)0, 0, 0, NULL, NULL,
H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
@ -4619,7 +4619,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
*-------------------------------------------------------------------------
*/
herr_t
H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
H5Tconvert(hid_t src_id, hid_t dst_id, hsize_t nelmts, void *buf,
void *background, hid_t plist_id)
{
H5T_path_t *tpath=NULL; /*type conversion info */
@ -6751,7 +6751,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
HDstrcpy(H5T_g.path[0]->name, "no-op");
H5T_g.path[0]->func = H5T_conv_noop;
H5T_g.path[0]->cdata.command = H5T_CONV_INIT;
if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), 0, 0, 0,
if (H5T_conv_noop(FAIL, FAIL, &(H5T_g.path[0]->cdata), (hsize_t)0, 0, 0,
NULL, NULL, H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
@ -6843,7 +6843,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
"query");
}
path->cdata.command = H5T_CONV_INIT;
if ((func)(src_id, dst_id, &(path->cdata), 0, 0, 0, NULL, NULL,
if ((func)(src_id, dst_id, &(path->cdata), (hsize_t)0, 0, 0, NULL, NULL,
H5P_DEFAULT)<0) {
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
"unable to initialize conversion function");
@ -6876,7 +6876,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
}
path->cdata.command = H5T_CONV_INIT;
if ((H5T_g.soft[i].func) (src_id, dst_id, &(path->cdata),
0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
(hsize_t)0, 0, 0, NULL, NULL, H5P_DEFAULT)<0) {
HDmemset (&(path->cdata), 0, sizeof(H5T_cdata_t));
H5E_clear(); /*ignore the error*/
} else {
@ -6898,7 +6898,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
assert(table==H5T_g.path[md]);
H5T_print_stats(table, &nprint/*in,out*/);
table->cdata.command = H5T_CONV_FREE;
if ((table->func)(FAIL, FAIL, &(table->cdata), 0, 0, 0, NULL, NULL,
if ((table->func)(FAIL, FAIL, &(table->cdata), (hsize_t)0, 0, 0, NULL, NULL,
H5P_DEFAULT)<0) {
#ifdef H5T_DEBUG
if (H5DEBUG(T)) {
@ -6991,7 +6991,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
*-------------------------------------------------------------------------
*/
herr_t
H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts,
H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist)
{

View File

@ -69,7 +69,7 @@ static char RcsId[] = "@(#)$Revision$";
#include <H5TBprivate.h> /*Threaded, balanced, binary trees */
# define KEYcmp(k1,k2,a) ((NULL!=compar) ? (*compar)( k1, k2, a) \
: HDmemcmp( k1, k2, 0<(a) ? (a) : (intn)HDstrlen(k1) ) )
: HDmemcmp( k1, k2, 0<(a) ? (a) : HDstrlen(k1) ) )
/* Return maximum of two scalar values (use arguments w/o side effects): */
#define Max(a,b) ( (a) > (b) ? (a) : (b) )

View File

@ -216,19 +216,19 @@ H5T_bit_set_d (uint8_t *buf, size_t offset, size_t size, hsize_t val)
assert (8*sizeof(val)>=size);
switch (((H5T_t*)(H5I_object(H5T_NATIVE_INT_g)))->u.atomic.order) {
case H5T_ORDER_LE:
break;
case H5T_ORDER_LE:
break;
case H5T_ORDER_BE:
for (i=0, hs=sizeof(val)/2; i<hs; i++) {
uint8_t tmp = ((uint8_t*)&val)[i];
((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val)-(i+1)];
((uint8_t*)&val)[sizeof(val)-(i+1)] = tmp;
}
break;
case H5T_ORDER_BE:
for (i=0, hs=sizeof(val)/2; i<hs; i++) {
uint8_t tmp = ((uint8_t*)&val)[i];
((uint8_t*)&val)[i] = ((uint8_t*)&val)[sizeof(val)-(i+1)];
((uint8_t*)&val)[sizeof(val)-(i+1)] = tmp;
}
break;
default:
HDabort ();
default:
HDabort ();
}
H5T_bit_copy (buf, offset, (uint8_t*)&val, 0, size);

File diff suppressed because it is too large Load Diff

View File

@ -219,519 +219,519 @@ __DLLVAR__ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g;
/* Conversion functions */
__DLL__ herr_t H5T_conv_noop(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_struct_opt(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
hsize_t nelmts, size_t buf_stride,
size_t bkg_stride, void *_buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_schar_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uchar_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_short_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ushort_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_int_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_uint_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_long_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ulong_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_schar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_uchar(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_short(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_ushort(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_int(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_uint(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_long(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_ulong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_llong_ullong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_ullong_llong(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_float_double(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_double_float(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg,
hid_t dset_xfer_plist);
__DLL__ herr_t H5T_conv_i32le_f64le(hid_t src_id, hid_t dst_id,
H5T_cdata_t *cdata, size_t nelmts,
H5T_cdata_t *cdata, hsize_t nelmts,
size_t buf_stride, size_t bkg_stride,
void *_buf, void *bkg,
hid_t dset_xfer_plist);
@ -763,7 +763,4 @@ __DLL__ herr_t H5T_vlen_disk_write(const H5D_xfer_t *xfer_parms, H5F_t *f, void
__DLL__ H5T_t * H5T_array_create(H5T_t *base, int ndims,
const hsize_t dim[/* ndims */], const int perm[/* ndims */]);
/* Reference specific functions */
__DLL__ H5R_type_t H5T_get_ref_type(const H5T_t *dt);
#endif

View File

@ -121,7 +121,7 @@ __DLL__ H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst,
__DLL__ herr_t H5T_sort_value(H5T_t *dt, int *map);
__DLL__ herr_t H5T_sort_name(H5T_t *dt, int *map);
__DLL__ herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
size_t nelmts, size_t buf_stride, size_t bkg_stride,
hsize_t nelmts, size_t buf_stride, size_t bkg_stride,
void *buf, void *bkg, hid_t dset_xfer_plist);
__DLL__ herr_t H5T_set_size(H5T_t *dt, size_t size);
__DLL__ herr_t H5T_set_precision(H5T_t *dt, size_t prec);
@ -132,6 +132,8 @@ __DLL__ herr_t H5T_enum_valueof(H5T_t *dt, const char *name,
void *value/*out*/);
__DLL__ herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void UNUSED *_op_data);
__DLL__ htri_t H5T_vlen_mark(H5T_t *dt, H5F_t *f, H5T_vlen_loc_t loc);
/* Reference specific functions */
__DLL__ H5R_type_t H5T_get_ref_type(const H5T_t *dt);
#endif

View File

@ -163,9 +163,8 @@ typedef struct {
/* All data type conversion functions are... */
typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata,
size_t nelmts, size_t buf_stride,
size_t bkg_stride, void *buf, void *bkg,
hid_t dset_xfer_plist);
hsize_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf,
void *bkg, hid_t dset_xfer_plist);
/*
* If an error occurs during a data type conversion then the function
@ -538,7 +537,7 @@ __DLL__ herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id,
__DLL__ herr_t H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id,
hid_t dst_id, H5T_conv_t func);
__DLL__ H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata);
__DLL__ herr_t H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts,
__DLL__ herr_t H5Tconvert(hid_t src_id, hid_t dst_id, hsize_t nelmts,
void *buf, void *background, hid_t plist_id);
__DLL__ H5T_overflow_t H5Tget_overflow(void);
__DLL__ herr_t H5Tset_overflow(H5T_overflow_t func);

View File

@ -219,12 +219,13 @@ herr_t H5T_vlen_seq_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi
if(seq_len!=0) {
/* Use the user's memory allocation routine is one is defined */
assert((seq_len*base_size)==(hsize_t)((size_t)(seq_len*base_size))); /*check for overflow*/
if(xfer_parms->vlen_alloc!=NULL) {
if(NULL==(vl->p=(xfer_parms->vlen_alloc)(seq_len*base_size,xfer_parms->alloc_info)))
if(NULL==(vl->p=(xfer_parms->vlen_alloc)((size_t)(seq_len*base_size),xfer_parms->alloc_info)))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end if */
else { /* Default to system malloc */
if(NULL==(vl->p=H5MM_malloc(seq_len*base_size)))
if(NULL==(vl->p=H5MM_malloc((size_t)(seq_len*base_size))))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end else */
@ -327,12 +328,13 @@ herr_t H5T_vlen_str_mem_write(const H5D_xfer_t *xfer_parms, H5F_t UNUSED *f, voi
assert(buf);
/* Use the user's memory allocation routine is one is defined */
assert(((seq_len+1)*base_size)==(hsize_t)((size_t)((seq_len+1)*base_size))); /*check for overflow*/
if(xfer_parms->vlen_alloc!=NULL) {
if(NULL==(*s=(xfer_parms->vlen_alloc)((seq_len+1)*base_size,xfer_parms->alloc_info)))
if(NULL==(*s=(xfer_parms->vlen_alloc)((size_t)((seq_len+1)*base_size),xfer_parms->alloc_info)))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end if */
else { /* Default to system malloc */
if(NULL==(*s=H5MM_malloc((seq_len+1)*base_size)))
if(NULL==(*s=H5MM_malloc((size_t)((seq_len+1)*base_size))))
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data");
} /* end else */

148
src/H5V.c
View File

@ -38,7 +38,7 @@ static intn interface_initialize_g = 0;
*-------------------------------------------------------------------------
*/
herr_t
H5V_stride_optimize1(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
H5V_stride_optimize1(uintn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
hsize_t *size, hssize_t *stride1)
{
FUNC_ENTER(H5V_stride_optimize1, FAIL);
@ -52,13 +52,12 @@ H5V_stride_optimize1(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
/*
* Combine adjacent memory accesses
*/
while (*np &&
stride1[*np-1]>0 &&
(hsize_t)(stride1[*np-1])==*elmt_size) {
*elmt_size *= size[*np-1];
if (--*np) {
stride1[*np-1] += size[*np] * stride1[*np];
}
while (*np && stride1[*np-1]>0 &&
(hsize_t)(stride1[*np-1])==*elmt_size) {
*elmt_size *= size[*np-1];
if (--*np) {
stride1[*np-1] += size[*np] * stride1[*np];
}
}
FUNC_LEAVE(SUCCEED);
@ -85,7 +84,7 @@ H5V_stride_optimize1(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
*-------------------------------------------------------------------------
*/
herr_t
H5V_stride_optimize2(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
H5V_stride_optimize2(uintn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
hsize_t *size, hssize_t *stride1, hssize_t *stride2)
{
FUNC_ENTER(H5V_stride_optimize2, FAIL);
@ -196,7 +195,6 @@ H5V_stride_optimize2(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
break;
} /* end switch */
FUNC_LEAVE(SUCCEED);
}
@ -230,18 +228,18 @@ H5V_stride_optimize2(intn *np/*in,out*/, hsize_t *elmt_size/*in,out*/,
*-------------------------------------------------------------------------
*/
hsize_t
H5V_hyper_stride(intn n, const hsize_t *size,
H5V_hyper_stride(uintn n, const hsize_t *size,
const hsize_t *total_size, const hssize_t *offset,
hssize_t *stride/*out*/)
{
hsize_t skip; /*starting point byte offset */
hsize_t acc; /*accumulator */
hsize_t tmp;
int i; /*counter */
intn i; /*counter */
FUNC_ENTER(H5V_hyper_stride, (HDabort(), 0));
assert(n >= 0 && n <= H5V_HYPER_NDIMS);
assert(n <= H5V_HYPER_NDIMS);
assert(size);
assert(total_size);
assert(stride);
@ -295,7 +293,7 @@ H5V_hyper_stride(intn n, const hsize_t *size,
default:
/* others */
for (i=n-2, acc=1; i>=0; --i) {
for (i=(intn)(n-2), acc=1; i>=0; --i) {
hsize_t tmp = acc * (total_size[i+1] - size[i+1]);
assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
stride[i] = (hssize_t)tmp; /*overflow checked*/
@ -374,27 +372,28 @@ H5V_hyper_eq(intn n,
*-------------------------------------------------------------------------
*/
htri_t
H5V_hyper_disjointp(intn n,
H5V_hyper_disjointp(uintn n,
const hssize_t *offset1, const hsize_t *size1,
const hssize_t *offset2, const hsize_t *size2)
{
intn i;
uintn u;
if (!n || !size1 || !size2) return TRUE;
for (i=0; i<n; i++) {
assert (size1[i]<HSSIZET_MAX);
assert (size2[i]<HSSIZET_MAX);
for (u=0; u<n; u++) {
assert (size1[u]<HSSIZET_MAX);
assert (size2[u]<HSSIZET_MAX);
if (0==size1[i] || 0==size2[i]) return TRUE;
if (((offset1?offset1[i]:0) < (offset2?offset2[i]:0) &&
((offset1?offset1[i]:0) + (hssize_t)size1[i] <=
(offset2?offset2[i]:0))) ||
((offset2?offset2[i]:0) < (offset1?offset1[i]:0) &&
((offset2?offset2[i]:0) + (hssize_t)size2[i] <=
(offset1?offset1[i]:0)))) {
return TRUE;
}
if (0==size1[u] || 0==size2[u])
return TRUE;
if (((offset1?offset1[u]:0) < (offset2?offset2[u]:0) &&
((offset1?offset1[u]:0) + (hssize_t)size1[u] <=
(offset2?offset2[u]:0))) ||
((offset2?offset2[u]:0) < (offset1?offset1[u]:0) &&
((offset2?offset2[u]:0) + (hssize_t)size2[u] <=
(offset1?offset1[u]:0)))) {
return TRUE;
}
}
return FALSE;
}
@ -421,7 +420,7 @@ H5V_hyper_disjointp(intn n,
*-------------------------------------------------------------------------
*/
herr_t
H5V_hyper_fill(intn n, const hsize_t *_size,
H5V_hyper_fill(uintn n, const hsize_t *_size,
const hsize_t *total_size, const hssize_t *offset, void *_dst,
uintn fill_value)
{
@ -432,7 +431,7 @@ H5V_hyper_fill(intn n, const hsize_t *_size,
hsize_t elmt_size = 1; /*bytes per element */
herr_t status; /*function return status */
#ifndef NDEBUG
int i;
uintn u;
#endif
FUNC_ENTER(H5V_hyper_fill, FAIL);
@ -443,9 +442,9 @@ H5V_hyper_fill(intn n, const hsize_t *_size,
assert(total_size);
assert(dst);
#ifndef NDEBUG
for (i = 0; i < n; i++) {
assert(_size[i] > 0);
assert(total_size[i] > 0);
for (u = 0; u < n; u++) {
assert(_size[u] > 0);
assert(total_size[u] > 0);
}
#endif
@ -496,7 +495,7 @@ H5V_hyper_fill(intn n, const hsize_t *_size,
*-------------------------------------------------------------------------
*/
herr_t
H5V_hyper_copy(intn n, const hsize_t *_size,
H5V_hyper_copy(uintn n, const hsize_t *_size,
/*destination*/
const hsize_t *dst_size, const hssize_t *dst_offset,
@ -517,7 +516,7 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
hsize_t tmp2;
herr_t status; /*return status */
#ifndef NDEBUG
intn i;
uintn u;
#endif
FUNC_ENTER(H5V_hyper_copy, FAIL);
@ -530,10 +529,10 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
assert(dst);
assert(src);
#ifndef NDEBUG
for (i = 0; i < n; i++) {
assert(_size[i] > 0);
assert(dst_size[i] > 0);
assert(src_size[i] > 0);
for (u = 0; u < n; u++) {
assert(_size[u] > 0);
assert(dst_size[u] > 0);
assert(src_size[u] > 0);
}
#endif
@ -549,7 +548,7 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
{
hsize_t dst_acc; /*accumulator */
hsize_t src_acc; /*accumulator */
int ii; /*counter */
intn ii; /*counter */
/* init */
dst_stride[n-1] = 1;
@ -633,7 +632,7 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
default:
/* others */
for (ii=n-2, dst_acc=1, src_acc=1; ii>=0; --ii) {
for (ii=(intn)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) {
hsize_t tmp1 = dst_acc * (dst_size[ii+1] - size[ii+1]);
hsize_t tmp2 = src_acc * (src_size[ii+1] - size[ii+1]);
assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1)));
@ -655,8 +654,7 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
/* Perform the copy in terms of stride */
status = H5V_stride_copy(n, elmt_size, size,
dst_stride, dst+dst_start,
src_stride, src+src_start);
dst_stride, dst+dst_start, src_stride, src+src_start);
FUNC_LEAVE(status);
}
@ -677,7 +675,7 @@ H5V_hyper_copy(intn n, const hsize_t *_size,
*-------------------------------------------------------------------------
*/
herr_t
H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
H5V_stride_fill(uintn n, hsize_t elmt_size, const hsize_t *size,
const hssize_t *stride, void *_dst, uintn fill_value)
{
uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */
@ -693,17 +691,18 @@ H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
for (i=0; i<nelmts; i++) {
/* Copy an element */
HDmemset(dst, (signed)fill_value, (size_t)elmt_size);
/* Copy an element */
HDmemset(dst, (signed)fill_value, (size_t)elmt_size);
/* Decrement indices and advance pointer */
for (j=(intn)(n-1), carry=TRUE; j>=0 && carry; --j) {
dst += stride[j];
/* Decrement indices and advance pointer */
for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
dst += stride[j];
if (--idx[j]) carry = FALSE;
else idx[j] = size[j];
}
if (--idx[j])
carry = FALSE;
else
idx[j] = size[j];
}
}
FUNC_LEAVE(SUCCEED);
@ -731,7 +730,7 @@ H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
*-------------------------------------------------------------------------
*/
herr_t
H5V_stride_copy(int n, hsize_t elmt_size, const hsize_t *size,
H5V_stride_copy(uintn n, hsize_t elmt_size, const hsize_t *size,
const hssize_t *dst_stride, void *_dst,
const hssize_t *src_stride, const void *_src)
{
@ -747,25 +746,28 @@ H5V_stride_copy(int n, hsize_t elmt_size, const hsize_t *size,
assert (elmt_size<SIZET_MAX);
if (n) {
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
for (i=0; i<nelmts; i++) {
H5V_vector_cpy(n, idx, size);
nelmts = H5V_vector_reduce_product(n, size);
for (i=0; i<nelmts; i++) {
/* Copy an element */
HDmemcpy(dst, src, (size_t)elmt_size);
/* Copy an element */
HDmemcpy(dst, src, (size_t)elmt_size);
/* Decrement indices and advance pointers */
for (j=n-1, carry=TRUE; j>=0 && carry; --j) {
src += src_stride[j];
dst += dst_stride[j];
/* Decrement indices and advance pointers */
for (j=(intn)(n-1), carry=TRUE; j>=0 && carry; --j) {
src += src_stride[j];
dst += dst_stride[j];
if (--idx[j]) carry = FALSE;
else idx[j] = size[j];
}
}
if (--idx[j])
carry = FALSE;
else
idx[j] = size[j];
}
}
} else {
HDmemcpy (dst, src, (size_t)elmt_size);
HRETURN (SUCCEED);
assert(elmt_size==(hsize_t)((size_t)elmt_size)); /*check for overflow*/
HDmemcpy (dst, src, (size_t)elmt_size);
HRETURN (SUCCEED);
}
@ -915,20 +917,20 @@ H5V_array_fill(void *_dst, const void *src, size_t size, size_t count)
*-------------------------------------------------------------------------
*/
hsize_t
H5V_array_offset(intn n, const hsize_t *total_size, const hssize_t *offset)
H5V_array_offset(uintn n, const hsize_t *total_size, const hssize_t *offset)
{
hsize_t skip; /*starting point byte offset */
hsize_t acc; /*accumulator */
int i; /*counter */
intn i; /*counter */
FUNC_ENTER(H5V_array_stride, (HDabort(), 0));
assert(n >= 0 && n <= H5V_HYPER_NDIMS);
assert(n <= H5V_HYPER_NDIMS);
assert(total_size);
assert(offset);
/* others */
for (i=n-1, acc=1, skip=0; i>=0; --i) {
for (i=(intn)(n-1), acc=1, skip=0; i>=0; --i) {
skip += acc * offset[i];
acc *= total_size[i];
}

View File

@ -24,7 +24,7 @@
/* Other functions */
#define H5V_vector_cpy(N,DST,SRC) { \
assert (sizeof(*(DST))==sizeof(*(SRC))); \
assert (sizeof(*(DST))==sizeof(*(SRC))); \
if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \
else HDmemset (DST, 0, (N)*sizeof(*(DST))); \
}
@ -34,30 +34,30 @@
/* A null pointer is equivalent to a zero vector */
#define H5V_ZERO NULL
__DLL__ hsize_t H5V_hyper_stride(intn n, const hsize_t *size,
__DLL__ hsize_t H5V_hyper_stride(uintn n, const hsize_t *size,
const hsize_t *total_size,
const hssize_t *offset,
hssize_t *stride);
__DLL__ htri_t H5V_hyper_disjointp(intn n, const hssize_t *offset1,
__DLL__ htri_t H5V_hyper_disjointp(uintn n, const hssize_t *offset1,
const hsize_t *size1,
const hssize_t *offset2,
const hsize_t *size2);
__DLL__ htri_t H5V_hyper_eq(intn n, const hssize_t *offset1,
const hsize_t *size1, const hssize_t *offset2,
const hsize_t *size2);
__DLL__ herr_t H5V_hyper_fill(intn n, const hsize_t *_size,
__DLL__ herr_t H5V_hyper_fill(uintn n, const hsize_t *_size,
const hsize_t *total_size,
const hssize_t *offset, void *_dst,
uintn fill_value);
__DLL__ herr_t H5V_hyper_copy(intn n, const hsize_t *size,
__DLL__ herr_t H5V_hyper_copy(uintn n, const hsize_t *size,
const hsize_t *dst_total_size,
const hssize_t *dst_offset, void *_dst,
const hsize_t *src_total_size,
const hssize_t *src_offset, const void *_src);
__DLL__ herr_t H5V_stride_fill(intn n, hsize_t elmt_size, const hsize_t *size,
__DLL__ herr_t H5V_stride_fill(uintn n, hsize_t elmt_size, const hsize_t *size,
const hssize_t *stride, void *_dst,
uintn fill_value);
__DLL__ herr_t H5V_stride_copy(intn n, hsize_t elmt_size, const hsize_t *_size,
__DLL__ herr_t H5V_stride_copy(uintn n, hsize_t elmt_size, const hsize_t *_size,
const hssize_t *dst_stride, void *_dst,
const hssize_t *src_stride, const void *_src);
__DLL__ herr_t H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, intn dst_n,
@ -65,14 +65,14 @@ __DLL__ herr_t H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, intn dst_n,
const hssize_t *dst_stride, void *_dst,
intn src_n, const hsize_t *src_size,
const hssize_t *src_stride, const void *_src);
__DLL__ herr_t H5V_stride_optimize1(intn *np, hsize_t *elmt_size,
__DLL__ herr_t H5V_stride_optimize1(uintn *np, hsize_t *elmt_size,
hsize_t *size, hssize_t *stride1);
__DLL__ herr_t H5V_stride_optimize2(intn *np, hsize_t *elmt_size,
__DLL__ herr_t H5V_stride_optimize2(uintn *np, hsize_t *elmt_size,
hsize_t *size, hssize_t *stride1,
hssize_t *stride2);
__DLL__ herr_t H5V_array_fill(void *_dst, const void *src, size_t size,
size_t count);
__DLL__ hsize_t H5V_array_offset(intn n, const hsize_t *total_size,
__DLL__ hsize_t H5V_array_offset(uintn n, const hsize_t *total_size,
const hssize_t *offset);
@ -96,7 +96,7 @@ __DLL__ hsize_t H5V_array_offset(intn n, const hsize_t *total_size,
*-------------------------------------------------------------------------
*/
static inline hsize_t UNUSED
H5V_vector_reduce_product(intn n, const hsize_t *v)
H5V_vector_reduce_product(uintn n, const hsize_t *v)
{
size_t ans = 1;
@ -212,7 +212,7 @@ H5V_vector_cmp_u (intn n, const hsize_t *v1, const hsize_t *v2)
*-------------------------------------------------------------------------
*/
static inline intn UNUSED
H5V_vector_cmp_s (intn n, const hssize_t *v1, const hssize_t *v2)
H5V_vector_cmp_s (uintn n, const hssize_t *v1, const hssize_t *v2)
{
if (v1 == v2) return 0;
while (n--) {

View File

@ -260,7 +260,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, uintn flags,
FUNC_ENTER(H5Z_append, FAIL);
assert(pline);
assert(filter>=0 && filter<=H5Z_FILTER_MAX);
assert(0==(flags & ~H5Z_FLAG_DEFMASK));
assert(0==(flags & ~((uintn)H5Z_FLAG_DEFMASK)));
assert(0==cd_nelmts || cd_values);
/*
@ -386,7 +386,7 @@ H5Z_pipeline(H5F_t UNUSED *f, const H5O_pline_t *pline, uintn flags,
FUNC_ENTER(H5Z_pipeline, FAIL);
assert(f);
assert(0==(flags & ~H5Z_FLAG_INVMASK));
assert(0==(flags & ~((uintn)H5Z_FLAG_INVMASK)));
assert(filter_mask);
assert(nbytes && *nbytes>0);
assert(buf_size && *buf_size>0);

View File

@ -99,7 +99,7 @@ H5Z_filter_deflate (unsigned UNUSED flags, size_t cd_nelmts,
"memory allocation failed for deflate "
"uncompression");
}
z_strm.next_out = (char*)outbuf + z_strm.total_out;
z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out;
z_strm.avail_out = nalloc - z_strm.total_out;
}
}

View File

@ -239,6 +239,9 @@
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the ioctl function. */
#undef HAVE_IOCTL

View File

@ -426,6 +426,19 @@ typedef unsigned uintn;
# define CONSTR(VAR,STR) static const char VAR[]=STR
#endif
/*
* A macro for detecting over/under-flow when casting between types
*/
#ifndef NDEBUG
#define H5_CHECK_OVERFLOW(var,vartype,casttype) \
{ \
casttype _tmp_overflow=(casttype)(var); \
assert((var)==(vartype)_tmp_overflow); \
}
#else /* NDEBUG */
#define H5_CHECK_OVERFLOW(var,vartype,casttype)
#endif /* NDEBUG */
/*
* Data types and functions for timing certain parts of the library.
*/
@ -708,7 +721,7 @@ __DLL__ int64_t HDstrtoll (const char *s, const char **rest, int base);
* And now for a couple non-Posix functions... Watch out for systems that
* define these in terms of macros.
*/
#ifndef strdup
#if !defined strdup && !defined HAVE_STRDUP
char *strdup(const char *s);
#endif
#define HDstrdup(S) strdup(S)

View File

@ -77,7 +77,7 @@ is_sparse(void)
struct stat sb;
if ((fd=open("x.h5", O_RDWR|O_TRUNC|O_CREAT, 0666))<0) return 0;
if (lseek(fd, 1024*1024, SEEK_SET)!=1024*1024) return 0;
if (lseek(fd, (off_t)(1024*1024), SEEK_SET)!=1024*1024) return 0;
if (5!=write(fd, "hello", 5)) return 0;
if (close(fd)<0) return 0;
if (stat("x.h5", &sb)<0) return 0;
@ -377,13 +377,13 @@ main (void)
#endif /* H5_WANT_H5_V1_2_COMPAT */
printf("Changing file drivers to the family driver, %lu bytes each\n",
(unsigned long)FAMILY_SIZE);
if (H5Pset_fapl_family(fapl, FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
} else if (H5Pget_fapl_family(fapl, &family_size, NULL)<0) {
goto error;
} else if (family_size!=FAMILY_SIZE) {
printf("Changing family member size from %lu to %lu\n",
(unsigned long)family_size, (unsigned long)FAMILY_SIZE);
if (H5Pset_fapl_family(fapl, FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
if (H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0) goto error;
}
/*

View File

@ -182,7 +182,7 @@ test_simple_io(hid_t file)
tconv_buf = malloc (1000);
xfer = H5Pcreate (H5P_DATASET_XFER);
assert (xfer>=0);
if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error;
if (H5Pset_buffer (xfer, (hsize_t)1000, tconv_buf, NULL)<0) goto error;
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_SIMPLE_IO_NAME, H5T_NATIVE_INT, space,
@ -368,7 +368,7 @@ test_compression(hid_t file)
*/
if ((xfer = H5Pcreate (H5P_DATASET_XFER))<0) goto error;
tconv_buf = malloc (1000);
if (H5Pset_buffer (xfer, 1000, tconv_buf, NULL)<0) goto error;
if (H5Pset_buffer (xfer, (hsize_t)1000, tconv_buf, NULL)<0) goto error;
/* Use chunked storage with compression */
if ((dc = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;

View File

@ -487,7 +487,7 @@ test_compound_2(void)
H5Tclose(array_dt);
/* Perform the conversion */
if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(st, dt, (hsize_t)nelmts, buf, bkg, H5P_DEFAULT)<0) goto error;
/* Compare results */
for (i=0; i<nelmts; i++) {
@ -602,7 +602,7 @@ test_compound_3(void)
H5Tclose(array_dt);
/* Perform the conversion */
if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0)
if (H5Tconvert(st, dt, (hsize_t)nelmts, buf, bkg, H5P_DEFAULT)<0)
goto error;
/* Compare results */
@ -722,7 +722,7 @@ test_compound_4(void)
H5Tclose(array_dt);
/* Perform the conversion */
if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0)
if (H5Tconvert(st, dt, (hsize_t)nelmts, buf, bkg, H5P_DEFAULT)<0)
goto error;
/* Compare results */
@ -843,7 +843,7 @@ test_compound_5(void)
/* Convert data */
memcpy(buf, src, sizeof(src));
H5Tconvert(src_type, dst_type, 2, buf, bkg, H5P_DEFAULT);
H5Tconvert(src_type, dst_type, (hsize_t)2, buf, bkg, H5P_DEFAULT);
dst = (dst_type_t*)buf;
/* Cleanup */
@ -935,7 +935,7 @@ test_compound_6(void)
goto error;
/* Perform the conversion */
if (H5Tconvert(st, dt, nelmts, buf, bkg, H5P_DEFAULT)<0)
if (H5Tconvert(st, dt, (hsize_t)nelmts, buf, bkg, H5P_DEFAULT)<0)
goto error;
/* Compare results */
@ -1342,13 +1342,13 @@ test_conv_str_1(void)
dst_type = mkstr(5, H5T_STR_NULLTERM);
buf = calloc(2, 10);
memcpy(buf, "abcdefghi\0abcdefghi\0", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd\0abcd\0abcdefghi\0", 20)) {
FAILED();
puts(" Truncated C-string test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", 20)) {
FAILED();
puts(" Extended C-string test failed");
@ -1365,13 +1365,13 @@ test_conv_str_1(void)
dst_type = mkstr(5, H5T_STR_NULLPAD);
buf = calloc(2, 10);
memcpy(buf, "abcdefghijabcdefghij", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdeabcdeabcdefghij", 20)) {
FAILED();
puts(" Truncated C buffer test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
FAILED();
puts(" Extended C buffer test failed");
@ -1388,13 +1388,13 @@ test_conv_str_1(void)
dst_type = mkstr(5, H5T_STR_SPACEPAD);
buf = calloc(2, 10);
memcpy(buf, "abcdefghijabcdefghij", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdeabcdeabcdefghij", 20)) {
FAILED();
puts(" Truncated Fortran-string test failed");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcde abcde ", 20)) {
FAILED();
puts(" Extended Fortran-string test failed");
@ -1414,7 +1414,7 @@ test_conv_str_1(void)
dst_type = mkstr(10, H5T_STR_NULLTERM);
buf = calloc(2, 10);
memcpy(buf, "abcdefghijabcdefghij", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdefghijabcdefghij", 20)) {
FAILED();
puts(" Non-terminated string test 1");
@ -1423,14 +1423,14 @@ test_conv_str_1(void)
H5Tclose(dst_type);
dst_type = mkstr(5, H5T_STR_NULLTERM);
memcpy(buf, "abcdefghijabcdefghij", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd\0abcd\0abcdefghij", 20)) {
FAILED();
puts(" Non-terminated string test 2");
goto error;
}
memcpy(buf, "abcdeabcdexxxxxxxxxx", 20);
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
FAILED();
puts(" Non-terminated string test 2");
@ -1447,13 +1447,13 @@ test_conv_str_1(void)
dst_type = mkstr(10, H5T_STR_SPACEPAD);
buf = calloc(2, 10);
memcpy(buf, "abcdefghi\0abcdefghi\0", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdefghi abcdefghi ", 20)) {
FAILED();
puts(" C string to Fortran test 1");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdefghi\0abcdefghi\0", 20)) {
FAILED();
puts(" Fortran to C string test 1");
@ -1462,13 +1462,13 @@ test_conv_str_1(void)
if (H5Tclose(dst_type)<0) goto error;
dst_type = mkstr(5, H5T_STR_SPACEPAD);
memcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
FAILED();
puts(" C string to Fortran test 2");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
FAILED();
puts(" Fortran to C string test 2");
@ -1479,13 +1479,13 @@ test_conv_str_1(void)
src_type = mkstr(5, H5T_STR_NULLTERM);
dst_type = mkstr(10, H5T_STR_SPACEPAD);
memcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd abcd ", 20)) {
FAILED();
puts(" C string to Fortran test 3");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd\0abcd\0abcd ", 20)) {
FAILED();
puts(" Fortran to C string test 3");
@ -1502,13 +1502,13 @@ test_conv_str_1(void)
dst_type = mkstr(10, H5T_STR_SPACEPAD);
buf = calloc(2, 10);
memcpy(buf, "abcdefghijabcdefghij", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdefghijabcdefghij", 20)) {
FAILED();
puts(" C buffer to Fortran test 1");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdefghijabcdefghij", 20)) {
FAILED();
puts(" Fortran to C buffer test 1");
@ -1517,13 +1517,13 @@ test_conv_str_1(void)
if (H5Tclose(dst_type)<0) goto error;
dst_type = mkstr(5, H5T_STR_SPACEPAD);
memcpy(buf, "abcdefgh\0\0abcdefgh\0\0", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcdeabcdeabcdefgh\0\0", 20)) {
FAILED();
puts(" C buffer to Fortran test 2");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", 20)) {
FAILED();
puts(" Fortran to C buffer test 2");
@ -1534,13 +1534,13 @@ test_conv_str_1(void)
src_type = mkstr(5, H5T_STR_NULLPAD);
dst_type = mkstr(10, H5T_STR_SPACEPAD);
memcpy(buf, "abcd\0abcd\0xxxxxxxxxx", 20);
if (H5Tconvert(src_type, dst_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src_type, dst_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd abcd ", 20)) {
FAILED();
puts(" C buffer to Fortran test 3");
goto error;
}
if (H5Tconvert(dst_type, src_type, 2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(dst_type, src_type, (hsize_t)2, buf, NULL, H5P_DEFAULT)<0) goto error;
if (memcmp(buf, "abcd\0abcd\0abcd ", 20)) {
FAILED();
puts(" Fortran to C buffer test 3");
@ -1609,8 +1609,8 @@ test_conv_str_2(void)
}
printf("%-70s", s);
fflush(stdout);
if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(f_type, c_type, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(c_type, f_type, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(f_type, c_type, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
PASSED();
}
ret_value = 0;
@ -1671,7 +1671,7 @@ test_conv_enum_1(void)
}
printf("%-70s", s);
fflush(stdout);
if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(t1, t2, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
PASSED();
}
@ -1684,7 +1684,7 @@ test_conv_enum_1(void)
}
printf("%-70s", s);
fflush(stdout);
if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(t2, t1, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
PASSED();
}
ret_value = 0;
@ -1731,7 +1731,7 @@ test_conv_bitfield(void)
dt = H5Tcopy(H5T_STD_B32LE);
buf[0] = buf[1] = 0xAA;
buf[2] = buf[3] = 0x55; /*irrelevant*/
if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(st, dt, (hsize_t)1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
FAILED();
printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n",
@ -1750,7 +1750,7 @@ test_conv_bitfield(void)
H5Tset_precision(dt, 12);
H5Tset_offset(dt, 10);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(st, dt, (hsize_t)1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n",
@ -1764,7 +1764,7 @@ test_conv_bitfield(void)
*/
H5Tset_pad(dt, H5T_PAD_ONE, H5T_PAD_ONE);
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, 1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(st, dt, (hsize_t)1, buf, NULL, H5P_DEFAULT)<0) goto error;
if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
FAILED();
printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n",
@ -1804,7 +1804,7 @@ test_conv_bitfield(void)
*/
static herr_t
convert_opaque(hid_t UNUSED st, hid_t UNUSED dt, H5T_cdata_t *cdata,
size_t UNUSED nelmts, size_t UNUSED buf_stride,
hsize_t UNUSED nelmts, size_t UNUSED buf_stride,
size_t UNUSED bkg_stride, void UNUSED *_buf,
void UNUSED *bkg, hid_t UNUSED dset_xfer_plid)
{
@ -1848,7 +1848,7 @@ test_opaque(void)
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
status = H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
status = H5Tconvert(st, dt, (hsize_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
FAILED();
@ -1861,7 +1861,7 @@ test_opaque(void)
goto error;
/* Try the conversion again, this time it should work */
if (H5Tconvert(st, dt, OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(st, dt, (hsize_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT)<0) goto error;
if (saved+1 != num_opaque_conversions_g) {
FAILED();
printf(" unexpected number of opaque conversions\n");
@ -1911,7 +1911,7 @@ test_conv_int (void)
/* (unsigned)0x80000000 -> (unsigned)0xffff */
byte[0] = byte[1] = byte[2] = 0;
byte[3] = 0x80;
if (H5Tconvert (H5T_STD_U32LE, H5T_STD_U16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_U32LE, H5T_STD_U16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0xff) {
@ -1924,7 +1924,7 @@ test_conv_int (void)
/* (unsigned)0xffffffff -> (signed)0x7fff */
byte[0] = byte[1] = byte[2] = byte[3] = 0xff;
if (H5Tconvert (H5T_STD_U32LE, H5T_STD_I16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_U32LE, H5T_STD_I16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
@ -1937,7 +1937,7 @@ test_conv_int (void)
/* (signed)0xffffffff -> (unsigned)0x0000 */
byte[0] = byte[1] = byte[2] = byte[3] = 0xff;
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_U16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_U16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0x00 || byte[1]!=0x00) {
@ -1951,7 +1951,7 @@ test_conv_int (void)
/* (signed)0x7fffffff -> (unsigned)0xffff */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0x7f;
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_U16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_U16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0xff) {
@ -1965,7 +1965,7 @@ test_conv_int (void)
/* (signed)0x7fffffff -> (signed)0x7fff */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0x7f;
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_I16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_I16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0xff || byte[1]!=0x7f) {
@ -1979,7 +1979,7 @@ test_conv_int (void)
/* (signed)0xbfffffff -> (signed)0x8000 */
byte[0] = byte[1] = byte[2] = 0xff;
byte[3] = 0xbf;
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_I16LE, 1, byte, NULL, H5P_DEFAULT)<0) {
if (H5Tconvert (H5T_STD_I32LE, H5T_STD_I16LE, (hsize_t)1, byte, NULL, H5P_DEFAULT)<0) {
goto error;
}
if (byte[0]!=0x00 || byte[1]!=0x80) {
@ -2174,7 +2174,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst)
for (j=0; j<nelmts*src_size; j++) buf[j] = saved[j] = rand();
/* Perform the conversion */
if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src, dst, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
/* Check the results from the library against hardware */
for (j=0; j<nelmts; j++) {
@ -3067,17 +3067,17 @@ test_conv_int_2(void)
/* Source type */
src_type = H5Tcopy(H5T_NATIVE_CHAR);
H5Tset_size(src_type, i);
H5Tset_size(src_type, (size_t)i);
/* Destination type */
dst_type = H5Tcopy(H5T_NATIVE_CHAR);
H5Tset_size(dst_type, j);
H5Tset_size(dst_type, (size_t)j);
/*
* Conversion. If overlap calculations aren't right then an
* assertion will fail in H5T_conv_i_i()
*/
H5Tconvert(src_type, dst_type, 100, buf, NULL, H5P_DEFAULT);
H5Tconvert(src_type, dst_type, (hsize_t)100, buf, NULL, H5P_DEFAULT);
H5Tclose(src_type);
H5Tclose(dst_type);
}
@ -3345,7 +3345,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst)
}
/* Perform the conversion in software */
if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
if (H5Tconvert(src, dst, (hsize_t)nelmts, buf, NULL, H5P_DEFAULT)<0) goto error;
/* Check the software results against the hardware */
for (j=0; j<nelmts; j++) {

View File

@ -98,7 +98,7 @@ test_1a(hid_t file)
/* Create the dataset */
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", 0,
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)))<0) goto error;
if ((space = H5Screate_simple (1, cur_size, max_size))<0) goto error;
if ((dset = H5Dcreate (file, "dset1", H5T_NATIVE_INT, space, dcpl))<0)
@ -177,7 +177,7 @@ test_1b(hid_t file)
TESTING("external storage is too small");
if ((dcpl = H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", 0,
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)-1))<0) goto error;
if ((space = H5Screate_simple (1, cur_size, max_size))<0) goto error;
H5E_BEGIN_TRY {
@ -234,7 +234,7 @@ test_1c(hid_t file)
if ((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = 100;
max_size[0] = 200;
if (H5Pset_external(dcpl, "ext1.data", 0,
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)))<0) goto error;
if ((space = H5Screate_simple (1, cur_size, max_size))<0) goto error;
if ((dset = H5Dcreate (file, "dset3", H5T_NATIVE_INT, space, dcpl))<0)
@ -285,7 +285,7 @@ test_1d(hid_t file)
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = 100;
max_size[0] = 200;
if (H5Pset_external(dcpl, "ext1.data", 0,
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)-1))<0) goto error;
if ((space=H5Screate_simple(1, cur_size, max_size))<0) goto error;
H5E_BEGIN_TRY {
@ -345,7 +345,7 @@ test_1e(hid_t file)
/* Create dataset */
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED)<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED)<0) goto error;
cur_size[0] = 100;
max_size[0] = H5S_UNLIMITED;
if ((space=H5Screate_simple(1, cur_size, max_size))<0) goto error;
@ -423,13 +423,13 @@ test_1f(hid_t file)
TESTING("multiple external files");
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
cur_size[0] = max_size[0] = 100;
if (H5Pset_external(dcpl, "ext1.data", 0,
if (H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4))<0) goto error;
if (H5Pset_external(dcpl, "ext2.data", 0,
if (H5Pset_external(dcpl, "ext2.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4))<0) goto error;
if (H5Pset_external(dcpl, "ext3.data", 0,
if (H5Pset_external(dcpl, "ext3.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4))<0) goto error;
if (H5Pset_external(dcpl, "ext4.data", 0,
if (H5Pset_external(dcpl, "ext4.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4))<0) goto error;
if ((space=H5Screate_simple(1, cur_size, max_size))<0) goto error;
if ((dset=H5Dcreate(file, "dset6", H5T_NATIVE_INT, space, dcpl))<0)
@ -476,9 +476,9 @@ test_1g(void)
TESTING("external file following unlimited file");
if ((dcpl=H5Pcreate (H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED)<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED)<0) goto error;
H5E_BEGIN_TRY {
status = H5Pset_external(dcpl, "ext2.data", 0, (hsize_t)100);
status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
} H5E_END_TRY;
if (status>=0) {
FAILED();
@ -528,9 +528,9 @@ test_1h(void)
TESTING("address overflow in external files");
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", 0, H5F_UNLIMITED-1)<0) goto error;
if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1)<0) goto error;
H5E_BEGIN_TRY {
status = H5Pset_external(dcpl, "ext2.data", 0, (hsize_t)100);
status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
} H5E_END_TRY;
if (status>=0) {
FAILED();
@ -596,7 +596,7 @@ test_2 (hid_t fapl)
assert (fd>=0);
/* n = lseek (fd, (off_t)(i*10), SEEK_SET);
*/
n = write(fd,temparray,i*10);
n = write(fd,temparray,(size_t)i*10);
assert (n>=0 && (size_t)n==i*10);
n = write (fd, part, sizeof(part));
assert (n==sizeof(part));
@ -617,10 +617,10 @@ test_2 (hid_t fapl)
/* Create the dataset */
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external (dcpl, "extern_1a.raw", 0, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_2a.raw", 10, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_3a.raw", 20, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_4a.raw", 30, (hsize_t)sizeof part)<0)
if (H5Pset_external (dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part)<0 ||
H5Pset_external (dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part)<0)
goto error;
cur_size = 100;
if ((space=H5Screate_simple (1, &cur_size, NULL))<0) goto error;
@ -721,10 +721,10 @@ test_3 (hid_t fapl)
/* Create the external file list */
if ((dcpl=H5Pcreate(H5P_DATASET_CREATE))<0) goto error;
if (H5Pset_external(dcpl, "extern_1b.raw", 0, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_2b.raw", 10, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_3b.raw", 20, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_4b.raw", 30, H5F_UNLIMITED)<0)
if (H5Pset_external(dcpl, "extern_1b.raw", (off_t)0, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_2b.raw", (off_t)10, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_3b.raw", (off_t)20, (hsize_t)sizeof part)<0 ||
H5Pset_external(dcpl, "extern_4b.raw", (off_t)30, H5F_UNLIMITED)<0)
goto error;
/* Make sure the output files are fresh*/

View File

@ -380,7 +380,8 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
nelmts *= hs_size[i];
}
if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error;
buf = malloc(nelmts*sizeof(int));
assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/
buf = malloc((size_t)(nelmts*sizeof(int)));
for (i=0; i<nelmts; i++) buf[i] = 9999;
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride,
hs_size, NULL)<0) goto error;
@ -519,7 +520,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4];
if ((fd=open(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, 0666))<0 ||
close(fd)<0) goto error;
if (H5Pset_external(dcpl, FILE_NAME_RAW, 0, nelmts*sizeof(int))<0)
if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int))<0)
goto error;
}
#endif
@ -577,7 +578,8 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
nelmts *= hs_size[i];
}
if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error;
buf = malloc(nelmts*sizeof(int));
assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/
buf = malloc((size_t)(nelmts*sizeof(int)));
for (i=0; i<nelmts; i++) buf[i] = 9999;
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride,
hs_size, NULL)<0) goto error;

View File

@ -272,7 +272,38 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
if (!base_name || !fullname || size<1) return NULL;
#ifndef H5_WANT_H5_V1_2_COMPAT
#ifdef H5_WANT_H5_V1_2_COMPAT
/* figure out the suffix */
if (H5P_DEFAULT!=fapl){
if ((driver=H5Pget_driver(fapl))<0)
return NULL;
if (H5F_LOW_FAMILY==driver) {
suffix = "%05d.h5";
} else if (H5F_LOW_CORE==driver) {
suffix = NULL;
}
}
/* Use different ones depending on parallel or serial driver used. */
if (H5P_DEFAULT!=fapl && H5F_LOW_MPIO==driver){
/* For parallel:
* First use command line option, then the environment variable,
* then try the constant
*/
prefix = (paraprefix ? paraprefix : getenv("HDF5_PARAPREFIX"));
#ifdef HDF5_PARAPREFIX
if (!prefix) prefix = HDF5_PARAPREFIX;
#endif
}else{
/* For serial:
* First use the environment variable, then try the constant
*/
prefix = getenv("HDF5_PREFIX");
#ifdef HDF5_PREFIX
if (!prefix) prefix = HDF5_PREFIX;
#endif
}
#else /* H5_WANT_H5_V1_2_COMPAT */
/* figure out the suffix */
if (H5P_DEFAULT!=fapl){
if ((driver=H5Pget_driver(fapl))<0) return NULL;
@ -307,7 +338,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size)
/* Prepend the prefix value to the base name */
if (prefix && *prefix) {
if (HDsnprintf(fullname, (long)size, "%s/%s", prefix, base_name)==(int)size) {
if (HDsnprintf(fullname, size, "%s/%s", prefix, base_name)==(int)size) {
return NULL; /*buffer is too small*/
}
} else if (strlen(base_name)>=size) {

View File

@ -156,7 +156,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
uintn acc; /*accumulator */
size_t i, j, k, dx, dy, dz; /*counters */
size_t u, v, w;
int ndims; /*hyperslab dimensionality */
uintn ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
uintn fill_value; /*fill value */
@ -330,7 +330,7 @@ test_copy(int mode,
uintn acc; /*accumulator */
hsize_t i, j, k, dx, dy, dz; /*counters */
hsize_t u, v, w;
int ndims; /*hyperslab dimensionality */
uintn ndims; /*hyperslab dimensionality */
char dim[64], s[256]; /*temp string */
const char *sub;

View File

@ -92,10 +92,10 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz)
*-------------------------------------------------------------------------
*/
static int
new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
new_object(H5F_t *f, const char *name, uintn ndims, H5G_entry_t *ent/*out*/)
{
H5O_layout_t layout;
intn i;
uintn u;
/* Create the object header */
if (H5O_create(f, 64, ent)) {
@ -107,11 +107,11 @@ new_object(H5F_t *f, const char *name, intn ndims, H5G_entry_t *ent/*out*/)
/* create chunked storage */
layout.type = H5D_CHUNKED;
layout.ndims = ndims;
for (i = 0; i < ndims; i++) {
if (i < (int)NELMTS(align_g)) {
layout.dim[i] = align_g[i];
for (u = 0; u < ndims; u++) {
if (u < (int)NELMTS(align_g)) {
layout.dim[u] = align_g[u];
} else {
layout.dim[i] = 2;
layout.dim[u] = 2;
}
}
H5F_arr_create(f, &layout/*in,out*/);
@ -158,14 +158,14 @@ static herr_t
test_create(H5F_t *f, const char *prefix)
{
H5G_entry_t handle;
intn i;
uintn u;
char name[256];
TESTING("istore create");
for (i = 1; i <= H5O_LAYOUT_NDIMS; i++) {
HDsnprintf(name, sizeof name, "%s_%02d", prefix, i);
if (new_object(f, name, i, &handle) < 0)
for (u = 1; u <= H5O_LAYOUT_NDIMS; u++) {
HDsnprintf(name, sizeof name, "%s_%02u", prefix, u);
if (new_object(f, name, u, &handle) < 0)
return FAIL;
}
@ -198,7 +198,7 @@ test_extend(H5F_t *f, const char *prefix,
{
H5G_entry_t handle;
hsize_t i, j, k, ctr;
int ndims;
uintn ndims;
uint8_t *buf = NULL, *check = NULL, *whole = NULL;
char dims[64], s[256], name[256];
hssize_t offset[3];
@ -233,7 +233,7 @@ test_extend(H5F_t *f, const char *prefix,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
printf(" Cannot create %d-d object `%s'\n", ndims, name);
printf(" Cannot create %u-d object `%s'\n", ndims, name);
goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {
@ -402,7 +402,7 @@ static herr_t
test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
size_t nx, size_t ny, size_t nz)
{
intn ndims;
uintn ndims;
hsize_t ctr;
char dims[64], s[256], name[256];
hssize_t offset[3];
@ -434,7 +434,7 @@ test_sparse(H5F_t *f, const char *prefix, size_t nblocks,
/* Build the new empty object */
sprintf(name, "%s_%s", prefix, dims);
if (new_object(f, name, ndims, &handle) < 0) {
printf(" Cannot create %d-d object `%s'\n", ndims, name);
printf(" Cannot create %u-d object `%s'\n", ndims, name);
goto error;
}
if (NULL == H5O_read(&handle, H5O_LAYOUT, 0, &layout)) {

View File

@ -291,7 +291,7 @@ static int receiver (void)
/*
* Read dataset from file into memory.
*/
data = (int *) malloc (nelems * sizeof (int));
data = (int *) malloc ((size_t)(nelems * sizeof (int)));
status = H5Dread (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data);
H5Dclose (dataset);

View File

@ -1527,7 +1527,7 @@ typedef struct
{
int nsubfields;
char *name[NMAX];
off_t offset[NMAX];
size_t offset[NMAX];
hid_t datatype[NMAX];
} CmpDTSinfo;

View File

@ -26,8 +26,10 @@
#include <H5private.h>
#include <H5Eprivate.h>
#ifndef HDF5_TEST_MASTER
extern int num_errs;
extern int Verbosity;
#endif /* HDF5_TEST_MASTER */
/* Use %ld to print the value because long should cover most cases. */
/* Used to make certain a return value _is_not_ a value */

View File

@ -96,7 +96,7 @@ test_reference_obj(void)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a group */
group=H5Gcreate(fid1,"Group1",-1);
group=H5Gcreate(fid1,"Group1",(size_t)-1);
CHECK(group, FAIL, "H5Gcreate");
/* Set group's comment */
@ -455,7 +455,7 @@ test_reference_region(void)
ret = H5Sget_select_hyper_nblocks(sid2);
VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)*2); /* allocate space for the hyperslab blocks */
ret = H5Sget_select_hyper_blocklist(sid2,0,ret,coords);
ret = H5Sget_select_hyper_blocklist(sid2,(hsize_t)0,(hsize_t)ret,coords);
CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
VERIFY(coords[0], 2, "Hyperslab Coordinates");
VERIFY(coords[1], 2, "Hyperslab Coordinates");
@ -483,7 +483,7 @@ test_reference_region(void)
ret = H5Sget_select_elem_npoints(sid2);
VERIFY(ret, 10, "H5Sget_select_elem_npoints");
coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)); /* allocate space for the element points */
ret = H5Sget_select_elem_pointlist(sid2,0,ret,coords);
ret = H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)ret,coords);
CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
VERIFY((hssize_t)coords[0], coord1[0][0], "Element Coordinates");
VERIFY((hssize_t)coords[1], coord1[0][1], "Element Coordinates");

View File

@ -326,7 +326,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid1,0,POINT1_NPOINTS,(hsize_t *)temp_coord1);
H5Sget_select_elem_pointlist(sid1,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord1);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord1[i][0],coord1[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord1[i][1],coord1[i][1],"H5Sget_select_elem_pointlist");
@ -351,7 +351,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid1,POINT1_NPOINTS,POINT1_NPOINTS,(hsize_t *)temp_coord1);
H5Sget_select_elem_pointlist(sid1,(hsize_t)POINT1_NPOINTS,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord1);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord1[i][0],coord1[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord1[i][1],coord1[i][1],"H5Sget_select_elem_pointlist");
@ -376,7 +376,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid2,0,POINT1_NPOINTS,(hsize_t *)temp_coord2);
H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord2);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord2[i][0],coord2[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord2[i][1],coord2[i][1],"H5Sget_select_elem_pointlist");
@ -405,7 +405,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid2,0,POINT1_NPOINTS,(hsize_t *)temp_coord2);
H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord2);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord2[i][0],coord2[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord2[i][1],coord2[i][1],"H5Sget_select_elem_pointlist");
@ -447,7 +447,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid2,0,POINT1_NPOINTS,(hsize_t *)temp_coord3);
H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord3);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord3[i][0],coord3[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord3[i][1],coord3[i][1],"H5Sget_select_elem_pointlist");
@ -471,7 +471,7 @@ test_select_point(void)
CHECK(ret, FAIL, "H5Sselect_elements");
/* Verify correct elements selected */
H5Sget_select_elem_pointlist(sid2,POINT1_NPOINTS,POINT1_NPOINTS,(hsize_t *)temp_coord3);
H5Sget_select_elem_pointlist(sid2,(hsize_t)POINT1_NPOINTS,(hsize_t)POINT1_NPOINTS,(hsize_t *)temp_coord3);
for(i=0; i<POINT1_NPOINTS; i++) {
VERIFY(temp_coord3[i][0],coord3[i][0],"H5Sget_select_elem_pointlist");
VERIFY(temp_coord3[i][1],coord3[i][1],"H5Sget_select_elem_pointlist");

View File

@ -104,7 +104,7 @@ int Annofil_h4_to_h5(int32 file_id,hid_t h5group){
return FAIL;
}
ann_buf = malloc(ann_length + 1);
ann_buf = malloc((size_t)ann_length + 1);
if(ann_buf == NULL) {
printf("error in allocating memory. \n");
return FAIL;
@ -199,7 +199,7 @@ int Annofil_h4_to_h5(int32 file_id,hid_t h5group){
return FAIL;
}
ann_buf = malloc(ann_length+1);
ann_buf = malloc((size_t)ann_length+1);
if(ann_buf == NULL) {
printf("error in allocating memory. \n");
ANend(an_id);
@ -317,8 +317,8 @@ int Annoobj_h4_to_h5(int32 file_id,int32 obj_ref, int32 obj_tag,
int num_lab_anno;
int num_des_anno;
int32 istat;
int32* des_anno_list;
int32* lab_anno_list;
int32* des_anno_list=NULL;
int32* lab_anno_list=NULL;
char* ann_buf;
char* ann_obj_name;
@ -380,7 +380,7 @@ int Annoobj_h4_to_h5(int32 file_id,int32 obj_ref, int32 obj_tag,
return FAIL;
}
ann_buf = malloc(ann_length+1);
ann_buf = malloc((size_t)ann_length+1);
if(ann_buf == NULL) {
printf("error in allocating annotation memory.\n");
ANendaccess(ann_id);
@ -487,7 +487,7 @@ int Annoobj_h4_to_h5(int32 file_id,int32 obj_ref, int32 obj_tag,
return FAIL;
}
ann_buf = malloc(ann_length+1);
ann_buf = malloc((size_t)ann_length+1);
if(ann_buf == NULL) {
printf("error in allocating annotation memory.\n");

View File

@ -522,7 +522,7 @@ int gr_palette(int32 file_id,int32 ri_id,hid_t h5dset,hid_t h5_palgroup) {
int check_pal;
int check_palname;
int pal_stat;
char* h5pal_name;
char* h5pal_name=NULL;
/* get palette id */

View File

@ -560,7 +560,7 @@ int get_numof_hdf4obj(char*filename,int32 file_id) {
int set_helpgroups(hid_t h5root,hid_t* h5dimgptr,hid_t* h5palgptr){
hid_t h5_dimg;/* hdf5 dimensional scale group identifier. */
hid_t h5_dimg=(-1);/* hdf5 dimensional scale group identifier. */
hid_t h5_palg;/* hdf5 palette group identifier. */
/*1. dimensional scale group.*/
@ -581,7 +581,7 @@ int set_helpgroups(hid_t h5root,hid_t* h5dimgptr,hid_t* h5palgptr){
h5_palg = H5Gcreate(h5root,HDF4_PALG,0);
if(h5_palg <0) {
printf("error in creating hdf5 palette group. \n");
H5Gclose(h5_dimg);
if(h5_dimg>0) H5Gclose(h5_dimg);
return FAIL;
}

View File

@ -973,7 +973,7 @@ int sdsdim_to_h5dataset(int32 sds_id,int32 sds_rank,hid_t sh5dset,
attr_refDims[0] = count_h5objref;
attr_refSpace = H5Screate_simple(1,attr_refDims,NULL);
attr_refType = H5Tcopy(H5T_STD_REF_OBJ);
alldim_refdat = calloc(count_h5objref,sizeof(hobj_ref_t));
alldim_refdat = calloc((size_t)count_h5objref,sizeof(hobj_ref_t));
if(alldim_refdat == NULL) {
printf("error in allocating memory. \n");

View File

@ -933,7 +933,7 @@ hid_t mkstr(int size, H5T_str_t pad) {
hid_t type;
if((type=H5Tcopy(H5T_C_S1))<0) return -1;
if((H5Tset_size(type,size))<0) return -1;
if((H5Tset_size(type,(size_t)size))<0) return -1;
if((H5Tset_strpad(type,pad))<0) return -1;
return type;
@ -955,7 +955,7 @@ hid_t mkstr(int size, H5T_str_t pad) {
*/
int h4_transnumattr(hid_t h5g,const char *refname,uint16 group_ref) {
hid_t h5memtype;
hid_t h5memtype=(-1);
hid_t h5a_id;
hid_t h5a_sid;
herr_t ret;

View File

@ -28,6 +28,7 @@ Author: Kent Yang(ymuqun@ncsa.uiuc.edu)
*****************************************************************************/
#include "h4toh5main.h"
#include <assert.h>
/*-------------------------------------------------------------------------
* Function: Vdata_h4_to_h5
@ -152,10 +153,11 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id) {
return FAIL;
}
h5memtype = calloc(nfields,sizeof(hid_t));
h5type = calloc(nfields,sizeof(hid_t));
h4memsize = calloc(nfields,sizeof(size_t));
h4size = calloc(nfields,sizeof(size_t));
assert(nfields>0);
h5memtype = calloc((size_t)nfields,sizeof(hid_t));
h5type = calloc((size_t)nfields,sizeof(hid_t));
h4memsize = calloc((size_t)nfields,sizeof(size_t));
h4size = calloc((size_t)nfields,sizeof(size_t));
for (i=0;i<nfields;i++) {
@ -199,7 +201,7 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id) {
}
vd_data = malloc(vdatamem_size*n_records);
vd_data = malloc((size_t)(vdatamem_size*n_records));
istat = VSsetfields(vdata_id,field_name_list);

View File

@ -71,7 +71,7 @@ main(int argc, char *argv[])
*/
if (strchr (argv[1], '%')) {
plist = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_fapl_family (plist, 0, H5P_DEFAULT);
H5Pset_fapl_family (plist, (hsize_t)0, H5P_DEFAULT);
}
if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) {
fprintf(stderr, "cannot open file\n");

View File

@ -761,7 +761,7 @@ dump_selected_attr(hid_t loc_id, char *name)
H5G_stat_t statbuf;
j = (int)strlen(name) - 1;
obj_name = malloc(j + 2);
obj_name = malloc((size_t)j + 2);
/* find the last / */
while (name[j] != '/' && j >=0)
@ -771,7 +771,7 @@ dump_selected_attr(hid_t loc_id, char *name)
if (j == -1) {
strcpy(obj_name, "/");
} else {
strncpy(obj_name, name, j+1);
strncpy(obj_name, name, (size_t)j+1);
obj_name[j+1] = '\0';
}
@ -1245,7 +1245,7 @@ dump_data(hid_t obj_id, int obj_data)
void *buf;
hid_t space, type, p_type;
int ndims, i;
hsize_t size[64], nelmts = 1;
hsize_t size[64], nelmts = 1, alloc_size;
int depth;
int stdindent = COL; /* should be 3*/
@ -1276,7 +1276,9 @@ dump_data(hid_t obj_id, int obj_data)
for (i = 0; i < ndims; i++)
nelmts *= size[i];
buf = malloc(nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)));
alloc_size= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
assert(alloc_size==(hsize_t)((size_t)alloc_size)); /*check for overflow*/
buf = malloc((size_t)alloc_size);
assert(buf);
if (H5Aread(obj_id, p_type, buf) >= 0)
@ -1754,7 +1756,7 @@ main(int argc, const char *argv[])
/* init the find_objs_t */
info.threshold = 0;
info.prefix_len = prefix_len;
info.prefix = malloc(info.prefix_len);
info.prefix = malloc((size_t)info.prefix_len);
info.prefix[0] = '\0';
info.group_table = group_table;
info.type_table = type_table;
@ -1876,8 +1878,9 @@ print_enum(hid_t type)
}
/* Get the names and raw values of all members */
name = calloc(nmembs, sizeof(char *));
value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
assert(nmembs>0);
name = calloc((size_t)nmembs, sizeof(char *));
value = calloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@ -1886,7 +1889,7 @@ print_enum(hid_t type)
/* Convert values to native data type */
if (native > 0)
H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
H5Tconvert(super, native, (hsize_t)nmembs, value, NULL, H5P_DEFAULT);
/* Sort members by increasing value */
/*not implemented yet*/

View File

@ -1090,7 +1090,7 @@ static hid_t mkstr(int size, H5T_str_t pad) {
hid_t type;
if ((type=H5Tcopy(H5T_C_S1))<0) return -1;
if (H5Tset_size(type, size)<0) return -1;
if (H5Tset_size(type, (size_t)size)<0) return -1;
if (H5Tset_strpad(type, pad)<0) return -1;
return type;
@ -1452,7 +1452,7 @@ static void test_objref(void)
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
/* Create a group */
group=H5Gcreate(fid1,"Group1",-1);
group=H5Gcreate(fid1,"Group1",(size_t)-1);
/* Set group's comment */
H5Gset_comment(group,".",write_comment);

View File

@ -833,15 +833,16 @@ display_enum_type(hid_t type, int ind)
}
/* Get the names and raw values of all members */
name = calloc(nmembs, sizeof(char*));
value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
assert(nmembs>0);
name = calloc((size_t)nmembs, sizeof(char*));
value = calloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size));
for (i=0; i<nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
H5Tget_member_value(type, i, value+i*H5Tget_size(type));
}
/* Convert values to native data type */
if (native>0) H5Tconvert(super, native, nmembs, value, NULL, H5P_DEFAULT);
if (native>0) H5Tconvert(super, native, (hsize_t)nmembs, value, NULL, H5P_DEFAULT);
/* Sort members by increasing value */
/*not implemented yet*/

View File

@ -18,7 +18,7 @@
#include <h5tools.h>
#if WIN32
#ifdef WIN32
typedef unsigned int mode_t;
#endif
@ -41,11 +41,8 @@ extern herr_t convert_dataset_string(hid_t, char *, op_data_t *);
extern int32 h5type_to_h4type(hid_t);
extern hid_t h4type_to_memtype(int32);
extern void init_table(table_t **temp);
extern void free_table(table_t **temp);
extern void init_prefix(char **prefix, int length);
extern void dump_tables(char* name, table_t* table);
extern herr_t find_objs(hid_t , const char *, void *);
extern int get_table_idx(table_t*, unsigned long *);
extern int get_tableflag(table_t*, int);
extern int set_tableflag(table_t*, int);
@ -129,7 +126,7 @@ main(int argc, char *argv[])
break;
}
#ifndef WIN32
if (test_file(h5_filename,O_EXCL,292) != 0 ) { /* 292 Decimal - 0444 Octal, a+r */
if (test_file(h5_filename,O_EXCL,(mode_t)(S_IRUSR|S_IRGRP|S_IROTH)) != 0 ) { /* 292 Decimal - 0444 Octal, a+r */
DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "main", __FILE__, __LINE__);
status = -1;
break;
@ -150,7 +147,7 @@ main(int argc, char *argv[])
break;
}
#ifndef WIN32
if (test_file(h4_filename,O_CREAT|O_EXCL,436) != 0) { /* 436 Decimal - 0664 Octal, ug+rw,o+r */
if (test_file(h4_filename,O_CREAT|O_EXCL,(mode_t)(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH)) != 0) { /* 436 Decimal - 0664 Octal, ug+rw,o+r */
DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "main", __FILE__, __LINE__);
status = -1;
break;

View File

@ -1,13 +1,3 @@
#ifndef _H5TOH4_H
#define _H5TOH4_H
#include <mfhdf.h>
#include <hdf5.h>
#ifdef H5_HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
/*
* Copyright © 1998 NCSA
* All rights reserved.
@ -18,6 +8,16 @@
* Purpose: Convert H5 files to H4 files.
*/
#ifndef _H5TOH4_H
#define _H5TOH4_H
#include "hdf.h"
#include "mfhdf.h"
#include "hdf5.h"
#ifdef H5_HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
typedef struct op_data_t {
/*

View File

@ -52,11 +52,10 @@
#define H5DUMP_BUFSIZE (1024)
#endif
#define OPT(X,S) ((X) ? (X) : (S))
#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
#define START_OF_DATA 0x0001
#define END_OF_DATA 0x0002
#define OPT(X,S) ((X) ? (X) : (S))
#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
#define START_OF_DATA 0x0001
#define END_OF_DATA 0x0002
/* Special strings embedded in the output */
#define OPTIONAL_LINE_BREAK "\001"
@ -105,13 +104,8 @@ typedef struct h5dump_context_t {
typedef herr_t (*H5G_operator_t)(hid_t, const char*, void*);
extern int print_data(hid_t oid, hid_t _p_type, int obj_data);
extern void init_prefix(char **temp, int length);
extern void init_table(table_t **table);
extern void free_table(table_t **table);
extern void dump_table(char *name, table_t* table);
extern herr_t find_objs(hid_t group, const char *name, void *op_data);
extern int search_obj (table_t *temp, unsigned long *);
extern int get_table_idx(table_t *table, unsigned long *);
extern int get_tableflag(table_t*, int);
extern int set_tableflag(table_t*, int);
@ -720,6 +714,7 @@ static int
h5dump_region(hid_t region, h5dump_str_t *str/*in,out*/, const h5dump_t *info)
{
hssize_t nblocks, npoints;
hsize_t alloc_size;
hsize_t *ptdata;
int ndims = H5Sget_simple_extent_ndims(region);
@ -729,62 +724,68 @@ h5dump_region(hid_t region, h5dump_str_t *str/*in,out*/, const h5dump_t *info)
* the other.
*/
H5E_BEGIN_TRY {
nblocks = H5Sget_select_hyper_nblocks(region);
npoints = H5Sget_select_elem_npoints(region);
nblocks = H5Sget_select_hyper_nblocks(region);
npoints = H5Sget_select_elem_npoints(region);
} H5E_END_TRY;
h5dump_str_append(str, "{");
/* Print block information */
if (nblocks > 0) {
int i;
int i;
ptdata = malloc(nblocks * ndims * 2 * sizeof(ptdata[0]));
H5Sget_select_hyper_blocklist(region, 0, nblocks, ptdata);
alloc_size=nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size==(hsize_t)((size_t)alloc_size)); /*check for overflow*/
ptdata = malloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(nblocks,hssize_t,hsize_t);
H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
for (i = 0; i < nblocks; i++) {
int j;
for (i = 0; i < nblocks; i++) {
int j;
h5dump_str_append(str, info->dset_blockformat_pre,
i ? "," OPTIONAL_LINE_BREAK " " : "",
(unsigned long)i);
/* Start coordinates and opposite corner */
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : "(",
(unsigned long)ptdata[i * 2 * ndims + j]);
h5dump_str_append(str, info->dset_blockformat_pre,
i ? "," OPTIONAL_LINE_BREAK " " : "",
(unsigned long)i);
/* Start coordinates and opposite corner */
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : "(",
(unsigned long)ptdata[i * 2 * ndims + j]);
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : ")-(",
(unsigned long)ptdata[i * 2 * ndims + j + ndims]);
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : ")-(",
(unsigned long)ptdata[i * 2 * ndims + j + ndims]);
h5dump_str_append(str, ")");
}
free(ptdata);
h5dump_str_append(str, ")");
}
free(ptdata);
}
/* Print point information */
if (npoints > 0) {
int i;
int i;
ptdata = malloc(npoints * ndims * sizeof(ptdata[0]));
H5Sget_select_elem_pointlist(region, 0, npoints, ptdata);
alloc_size=npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size==(hsize_t)((size_t)alloc_size)); /*check for overflow*/
ptdata = malloc((size_t)alloc_size);
H5_CHECK_OVERFLOW(npoints,hssize_t,hsize_t);
H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
for (i = 0; i < npoints; i++) {
int j;
for (i = 0; i < npoints; i++) {
int j;
h5dump_str_append(str, info->dset_ptformat_pre ,
i ? "," OPTIONAL_LINE_BREAK " " : "",
(unsigned long)i);
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : "(",
(unsigned long)(ptdata[i * ndims + j]));
h5dump_str_append(str, info->dset_ptformat_pre ,
i ? "," OPTIONAL_LINE_BREAK " " : "",
(unsigned long)i);
for (j = 0; j < ndims; j++)
h5dump_str_append(str, "%s%lu", j ? "," : "(",
(unsigned long)(ptdata[i * ndims + j]));
h5dump_str_append(str, ")");
}
h5dump_str_append(str, ")");
}
free(ptdata);
free(ptdata);
}
h5dump_str_append(str, "}");
@ -1459,7 +1460,7 @@ h5dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container,
if (info->line_ncols > 0)
ncols = info->line_ncols;
h5dump_simple_prefix(stream, info, ctx, 0, 0);
h5dump_simple_prefix(stream, info, ctx, (hsize_t)0, 0);
for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) {
/* Render the element */
@ -1688,7 +1689,8 @@ h5dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset,
else
sm_nbytes = p_type_nbytes;
sm_buf = malloc(sm_nbytes);
assert(sm_nbytes==(hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
sm_buf = malloc((size_t)sm_nbytes);
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@ -1920,8 +1922,9 @@ h5dump_fixtype(hid_t f_type)
* and add the members.
*/
nmembs = H5Tget_nmembers(f_type);
memb = calloc(nmembs, sizeof(hid_t));
name = calloc(nmembs, sizeof(char *));
assert(nmembs>0);
memb = calloc((size_t)nmembs, sizeof(hid_t));
name = calloc((size_t)nmembs, sizeof(char *));
for (i = 0, size = 0; i < nmembs; i++) {
@ -2268,7 +2271,10 @@ init_table(table_t** temp)
void
init_prefix(char **prefix, int prefix_len)
{
char *temp = malloc(prefix_len);
char *temp;
assert(prefix_len>0);
temp = malloc((size_t)prefix_len);
*temp = '\0';
*prefix = temp;
@ -2621,7 +2627,10 @@ h5dump_fopen(const char *fname, char *drivername, size_t drivername_size)
hid_t fapl;
} driver[16];
static int ndrivers = 0;
hid_t fid=(-1), fapl = H5P_DEFAULT;
hid_t fid=(-1);
#ifdef VERSION13
hid_t fapl = H5P_DEFAULT;
#endif
int drivernum;
if (!ndrivers) {