diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 14 | ||||
-rw-r--r-- | src/H5A.c | 17 | ||||
-rw-r--r-- | src/H5AC.c | 8 | ||||
-rw-r--r-- | src/H5ACpkg.h | 9 | ||||
-rw-r--r-- | src/H5Adense.c | 9 | ||||
-rw-r--r-- | src/H5Aint.c | 13 | ||||
-rw-r--r-- | src/H5B2.c | 4 | ||||
-rw-r--r-- | src/H5B2cache.c | 6 | ||||
-rw-r--r-- | src/H5B2int.c | 38 | ||||
-rw-r--r-- | src/H5D.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5Tcompound.c | 6 | ||||
-rw-r--r-- | src/H5Tnative.c | 2 | ||||
-rw-r--r-- | src/H5Tpkg.h | 6 | ||||
-rw-r--r-- | src/H5Tprivate.h | 2 | ||||
-rw-r--r-- | src/H5Vprivate.h | 10 | ||||
-rw-r--r-- | src/H5Znbit.c | 4 | ||||
-rw-r--r-- | src/H5checksum.c | 10 | ||||
-rw-r--r-- | src/H5public.h | 4 | ||||
-rw-r--r-- | src/H5system.c | 8 | ||||
-rw-r--r-- | src/H5trace.c | 44 | ||||
-rw-r--r-- | src/Makefile.in | 2 |
22 files changed, 146 insertions, 74 deletions
@@ -207,7 +207,7 @@ void H5_term_library(void) { int pending, ntries = 0, n; - unsigned at = 0; + size_t at = 0; char loop[1024]; H5E_auto2_t func; @@ -477,7 +477,7 @@ H5_debug_mask(const char *s) FILE *stream = stderr; char pkg_name[32], *rest; size_t i; - int clear; + hbool_t clear; while (s && *s) { if (HDisalpha(*s) || '-'==*s || '+'==*s) { @@ -500,20 +500,20 @@ H5_debug_mask(const char *s) /* Trace, all, or one? */ if (!HDstrcmp(pkg_name, "trace")) { - H5_debug_g.trace = clear?NULL:stream; + H5_debug_g.trace = clear ? NULL : stream; } else if (!HDstrcmp(pkg_name, "ttop")) { H5_debug_g.trace = stream; - H5_debug_g.ttop = !clear; + H5_debug_g.ttop = (hbool_t)!clear; } else if (!HDstrcmp(pkg_name, "ttimes")) { H5_debug_g.trace = stream; - H5_debug_g.ttimes = !clear; + H5_debug_g.ttimes = (hbool_t)!clear; } else if (!HDstrcmp(pkg_name, "all")) { for (i=0; i<(size_t)H5_NPKGS; i++) - H5_debug_g.pkg[i].stream = clear?NULL:stream; + H5_debug_g.pkg[i].stream = clear ? NULL : stream; } else { for (i=0; i<(size_t)H5_NPKGS; i++) { if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { - H5_debug_g.pkg[i].stream = clear?NULL:stream; + H5_debug_g.pkg[i].stream = clear ? NULL : stream; break; } } @@ -361,9 +361,11 @@ hid_t H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, const H5S_t *space, hid_t acpl_id, hid_t dxpl_id) { - H5A_t *attr = NULL; - htri_t tri_ret; /* htri_t return value */ - hid_t ret_value; /* Return value */ + H5A_t *attr = NULL; + hssize_t snelmts; /* elements in attribute */ + size_t nelmts; /* elements in attribute */ + htri_t tri_ret; /* htri_t return value */ + hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5A_create) @@ -464,9 +466,14 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, FALSE, attr->dt); attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->ds); + /* Get # of elements for attribute's dataspace */ + if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->ds)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, size_t); + HDassert(attr->dt_size > 0); HDassert(attr->ds_size > 0); - H5_ASSIGN_OVERFLOW(attr->data_size, H5S_GET_EXTENT_NPOINTS(attr->ds) * H5T_get_size(attr->dt), hssize_t, size_t); + attr->data_size = nelmts * H5T_get_size(attr->dt); /* Hold the symbol table entry (and file) open */ if(H5O_open(&(attr->oloc)) < 0) @@ -1271,6 +1278,8 @@ H5Aget_type(hid_t attr_id) /* Mark any datatypes as being in memory now */ if(H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + + /* Lock copied type */ if(H5T_lock(dt, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") @@ -43,8 +43,8 @@ *------------------------------------------------------------------------- */ -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5AC_PACKAGE /*suppress error about including H5ACpkg */ +#define H5C_PACKAGE /*suppress error about including H5Cpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Interface initialization */ @@ -2319,7 +2319,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } #endif /* H5AC__TRACE_FILE_ENABLED */ - dirtied = ( ( (flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG ) || + dirtied = (hbool_t)( ( (flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG ) || ( ((H5AC_info_t *)thing)->dirtied ) ); if ( dirtied ) { @@ -3064,7 +3064,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) { herr_t result; herr_t ret_value = SUCCEED; /* Return value */ - int name_len; + size_t name_len; H5C_auto_size_ctl_t internal_config; FUNC_ENTER_NOAPI(H5AC_validate_config, FAIL) @@ -3109,7 +3109,7 @@ H5AC_validate_config(H5AC_cache_config_t * config_ptr) */ name_len = HDstrlen(config_ptr->trace_file_name); - if ( name_len <= 0 ) { + if ( name_len == 0 ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ "config_ptr->trace_file_name is empty.") diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h index 973f988..5f226ed 100644 --- a/src/H5ACpkg.h +++ b/src/H5ACpkg.h @@ -34,14 +34,12 @@ #ifndef _H5ACpkg_H #define _H5ACpkg_H -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ - /* Get package's private header */ -#include "H5Cprivate.h" +#include "H5ACprivate.h" /* Get needed headers */ -#include "H5Cpkg.h" /* Cache */ +#include "H5Cprivate.h" /* Cache */ #include "H5SLprivate.h" /* Skip lists */ @@ -323,4 +321,5 @@ typedef struct H5AC_aux_t #endif /* H5_HAVE_PARALLEL */ -#endif /* _H5Cpkg_H */ +#endif /* _H5ACpkg_H */ + diff --git a/src/H5Adense.c b/src/H5Adense.c index de6bc8c..45537be 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -504,7 +504,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr) udata.common.shared_fheap = shared_fheap; udata.common.name = attr->name; udata.common.name_hash = H5_checksum_lookup3(attr->name, HDstrlen(attr->name), 0); - udata.common.flags = mesg_flags; + H5_ASSIGN_OVERFLOW(udata.common.flags, mesg_flags, unsigned, uint8_t); udata.common.corder = attr->crt_idx; udata.common.found_op = NULL; udata.common.found_op_data = NULL; @@ -1034,6 +1034,13 @@ H5A_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) case H5A_ATTR_OP_LIB: /* Call the library's callback */ ret_value = (bt2_udata->attr_op->u.lib_op)(fh_udata.attr, bt2_udata->op_data); + break; + + default: + HDassert("unknown attribute op type" && 0); +#ifdef NDEBUG + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") +#endif /* NDEBUG */ } /* end switch */ /* Release the space allocated for the attribute */ diff --git a/src/H5Aint.c b/src/H5Aint.c index c08c6cf..71b6689 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -197,8 +197,8 @@ H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type, udata.dxpl_id = dxpl_id; udata.atable = atable; udata.curr_attr = 0; - udata.bogus_crt_idx = (oh->version == H5O_VERSION_1 || - !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE; + udata.bogus_crt_idx = (hbool_t)((oh->version == H5O_VERSION_1 || + !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) ? TRUE : FALSE); /* Iterate over existing attributes, checking for attribute with same name */ op.op_type = H5O_MESG_OP_LIB; @@ -564,6 +564,13 @@ H5A_attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, case H5A_ATTR_OP_LIB: /* Call the library's callback */ ret_value = (attr_op->u.lib_op)(&(atable->attrs[u]), op_data); + break; + + default: + HDassert("unknown attribute op type" && 0); +#ifdef NDEBUG + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") +#endif /* NDEBUG */ } /* end switch */ /* Increment the number of entries passed through */ @@ -649,7 +656,7 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo) HDassert(oh); /* Retrieve the "attribute info" structure */ - if((ret_value = H5O_msg_read_real(f, dxpl_id, oh, H5O_AINFO_ID, ainfo))) { + if((ret_value = (H5O_ainfo_t *)H5O_msg_read_real(f, dxpl_id, oh, H5O_AINFO_ID, ainfo))) { /* Check if we don't know how many attributes there are */ if(ret_value->nattrs == HSIZET_MAX) { /* Check if we are using "dense" attribute storage */ @@ -1282,7 +1282,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add cache_udata.type = type; /* Look up the B-tree header */ - if(NULL == (bt2 = H5AC2_protect(f, dxpl_id, H5AC2_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC2_READ))) + if(NULL == (bt2 = (H5B2_t *)H5AC2_protect(f, dxpl_id, H5AC2_BT2_HDR, addr, (size_t)H5B2_HEADER_SIZE(f), &cache_udata, H5AC2_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header") /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */ @@ -1291,7 +1291,7 @@ H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t add incr_rc = TRUE; /* Get the pointer to the shared B-tree info */ - shared = H5RC_GET_OBJ(bt2->shared); + shared = (H5B2_shared_t *)H5RC_GET_OBJ(bt2->shared); HDassert(shared); /* Add size of header to B-tree metadata total */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index fc24f00..ca73b3f 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -322,8 +322,10 @@ H5B2_cache_hdr_serialize(const H5F_t *f, haddr_t UNUSED addr, size_t UNUSED len, UINT16ENCODE(p, shared->depth); /* Split & merge %s */ - *p++ = shared->split_percent; - *p++ = shared->merge_percent; + H5_CHECK_OVERFLOW(shared->split_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)shared->split_percent; + H5_CHECK_OVERFLOW(shared->merge_percent, /* From: */ unsigned, /* To: */ uint8_t); + *p++ = (uint8_t)shared->merge_percent; /* Root node pointer */ H5F_addr_encode(f, &p, bt2->root.addr); diff --git a/src/H5B2int.c b/src/H5B2int.c index 90e687a..6b0b911 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -149,6 +149,8 @@ H5B2_shared_init (H5F_t *f, H5B2_t *bt2, const H5B2_class_t *type, unsigned split_percent, unsigned merge_percent) { H5B2_shared_t *shared = NULL; /* Shared B-tree information */ + size_t sz_max_nrec; /* Temporary variable for range checking */ + unsigned u_max_nrec_size; /* Temporary variable for range checking */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -182,7 +184,8 @@ HDmemset(shared->page, 0, shared->node_size); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Initialize leaf node info */ - shared->node_info[0].max_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size); + sz_max_nrec = H5B2_NUM_LEAF_REC(shared->node_size, shared->rrec_size); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[0].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned) shared->node_info[0].split_nrec = (shared->node_info[0].max_nrec * shared->split_percent) / 100; shared->node_info[0].merge_nrec = (shared->node_info[0].max_nrec * shared->merge_percent) / 100; shared->node_info[0].cum_max_nrec = shared->node_info[0].max_nrec; @@ -203,13 +206,15 @@ HDmemset(shared->page, 0, shared->node_size); /* Compute size to store # of records in each node */ /* (uses leaf # of records because its the largest) */ - shared->max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[0].max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[0].max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ unsigned char) HDassert(shared->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE); /* Initialize internal node info */ if(depth > 0) { for(u = 1; u < (depth + 1); u++) { - shared->node_info[u].max_nrec = H5B2_NUM_INT_REC(f, shared, u); + sz_max_nrec = H5B2_NUM_INT_REC(f, shared, u); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[u].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned) HDassert(shared->node_info[u].max_nrec <= shared->node_info[u - 1].max_nrec); shared->node_info[u].split_nrec = (shared->node_info[u].max_nrec * shared->split_percent) / 100; @@ -217,7 +222,8 @@ HDmemset(shared->page, 0, shared->node_size); shared->node_info[u].cum_max_nrec = ((shared->node_info[u].max_nrec + 1) * shared->node_info[u - 1].cum_max_nrec) + shared->node_info[u].max_nrec; - shared->node_info[u].cum_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[u].cum_max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[u].cum_max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[u].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ unsigned char) if((shared->node_info[u].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[u].max_nrec)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") @@ -559,6 +565,8 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr) H5B2_shared_t *shared; /* Pointer to B-tree's shared information */ unsigned new_root_flags = H5AC2__NO_FLAGS_SET; /* Cache flags for new root node */ H5B2_node_ptr_t old_root_ptr; /* Old node pointer to root node in B-tree */ + size_t sz_max_nrec; /* Temporary variable for range checking */ + unsigned u_max_nrec_size; /* Temporary variable for range checking */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5B2_split_root) @@ -579,12 +587,14 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, unsigned *bt2_flags_ptr) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Update node info for new depth of tree */ - shared->node_info[shared->depth].max_nrec = H5B2_NUM_INT_REC(f, shared, shared->depth); + sz_max_nrec = H5B2_NUM_INT_REC(f, shared, shared->depth); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned) shared->node_info[shared->depth].split_nrec = (shared->node_info[shared->depth].max_nrec * shared->split_percent) / 100; shared->node_info[shared->depth].merge_nrec = (shared->node_info[shared->depth].max_nrec * shared->merge_percent) / 100; shared->node_info[shared->depth].cum_max_nrec = ((shared->node_info[shared->depth].max_nrec + 1) * shared->node_info[shared->depth - 1].cum_max_nrec) + shared->node_info[shared->depth].max_nrec; - shared->node_info[shared->depth].cum_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[shared->depth].cum_max_nrec); + u_max_nrec_size = H5V_limit_enc_size((uint64_t)shared->node_info[shared->depth].cum_max_nrec); + H5_ASSIGN_OVERFLOW(/* To: */ shared->node_info[shared->depth].cum_max_nrec_size, /* From: */ u_max_nrec_size, /* From: */ unsigned, /* To: */ unsigned char) if((shared->node_info[shared->depth].nat_rec_fac = H5FL_fac_init(shared->type->nrec_size * shared->node_info[shared->depth].max_nrec)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") if((shared->node_info[shared->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (shared->node_info[shared->depth].max_nrec + 1))) == NULL) @@ -747,20 +757,20 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int /* Handle node pointers, if we have an internal node */ if(depth>1) { - hsize_t moved_nrec=move_nrec; /* Total number of records moved, for internal redistrib */ + hsize_t moved_nrec = move_nrec; /* Total number of records moved, for internal redistrib */ unsigned u; /* Local index variable */ /* Count the number of records being moved */ - for(u=0; u<move_nrec; u++) + for(u = 0; u < move_nrec; u++) moved_nrec += right_node_ptrs[u].all_nrec; - left_moved_nrec = moved_nrec; - right_moved_nrec -= moved_nrec; + H5_ASSIGN_OVERFLOW(/* To: */ left_moved_nrec, /* From: */ moved_nrec, /* From: */ hsize_t, /* To: */ hssize_t) + right_moved_nrec -= (hssize_t)moved_nrec; /* Copy node pointers from right node to left */ - HDmemcpy(&(left_node_ptrs[*left_nrec+1]),&(right_node_ptrs[0]),sizeof(H5B2_node_ptr_t)*move_nrec); + HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec); /* Slide node pointers in right node down */ - HDmemmove(&(right_node_ptrs[0]),&(right_node_ptrs[move_nrec]),sizeof(H5B2_node_ptr_t)*(new_right_nrec+1)); + HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + 1)); } /* end if */ /* Update number of records in child nodes */ @@ -802,8 +812,8 @@ H5B2_redistribute2(H5F_t *f, hid_t dxpl_id, unsigned depth, H5B2_internal_t *int /* Count the number of records being moved */ for(u=0; u<move_nrec; u++) moved_nrec += right_node_ptrs[u].all_nrec; - left_moved_nrec -= moved_nrec; - right_moved_nrec = moved_nrec; + left_moved_nrec -= (hssize_t)moved_nrec; + H5_ASSIGN_OVERFLOW(/* To: */ right_moved_nrec, /* From: */ moved_nrec, /* From: */ hsize_t, /* To: */ hssize_t) } /* end if */ /* Update number of records in child nodes */ @@ -517,7 +517,7 @@ H5Dget_type(hid_t dset_id) if(H5T_set_loc(copied_type, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") - /* Unlock copied type */ + /* Lock copied type */ if(H5T_lock (copied_type, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cd97758..c6706a4 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -309,6 +309,7 @@ typedef struct H5F_t H5F_t; case 4: UINT32ENCODE(p,l); break; \ case 8: UINT64ENCODE(p,l); break; \ case 2: UINT16ENCODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_ENCODE_LENGTH(f,p,l) H5F_ENCODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) @@ -317,6 +318,7 @@ typedef struct H5F_t H5F_t; case 4: UINT32DECODE(p,l); break; \ case 8: UINT64DECODE(p,l); break; \ case 2: UINT16DECODE(p,l); break; \ + default: HDassert("bad sizeof size" && 0); \ } #define H5F_DECODE_LENGTH(f,p,l) H5F_DECODE_LENGTH_LEN(p,l,H5F_SIZEOF_SIZE(f)) diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 660a76d..9942ea1 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -215,7 +215,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") if (membno >= dt->shared->u.compnd.nmembs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number") - if ((memb_dt=H5T_get_member_type(dt, membno))==NULL) + if ((memb_dt=H5T_get_member_type(dt, membno, H5T_COPY_REOPEN))==NULL) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to retrieve member type") if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom") @@ -251,7 +251,7 @@ done: *------------------------------------------------------------------------- */ H5T_t * -H5T_get_member_type(const H5T_t *dt, unsigned membno) +H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method) { H5T_t *ret_value = NULL; @@ -261,7 +261,7 @@ H5T_get_member_type(const H5T_t *dt, unsigned membno) assert(membno < dt->shared->u.compnd.nmembs); /* Copy datatype into an atom */ - if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_REOPEN))) + if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, method))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy member datatype") done: diff --git a/src/H5Tnative.c b/src/H5Tnative.c index da478c4..0deba66 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -277,7 +277,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig /* Construct child compound type and retrieve a list of their IDs, offsets, total size, and alignment for compound type. */ for(i=0; i<nmemb; i++) { - if((memb_type = H5T_get_member_type(dtype, i))==NULL) + if((memb_type = H5T_get_member_type(dtype, i, H5T_COPY_TRANSIENT))==NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed") if((comp_mname[i] = H5T_get_member_name(dtype, i))==NULL) diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 5cb668d..b0abb9a 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -340,9 +340,9 @@ typedef struct H5T_array_t { } H5T_array_t; typedef enum H5T_state_t { - H5T_STATE_TRANSIENT, /*type is a modifiable transient */ - H5T_STATE_RDONLY, /*transient, not modifiable, closable*/ - H5T_STATE_IMMUTABLE, /*constant, not closable */ + H5T_STATE_TRANSIENT, /*type is a modifiable, closable transient */ + H5T_STATE_RDONLY, /*transient, not modifiable, closable */ + H5T_STATE_IMMUTABLE, /*transient, not modifiable, not closable */ H5T_STATE_NAMED, /*named constant, not open */ H5T_STATE_OPEN /*named constant, open object header */ } H5T_state_t; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 2fe4c3a..36f8006 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -129,7 +129,7 @@ H5_DLL herr_t H5T_update_shared(H5T_t *type); /* Field functions (for both compound & enumerated types) */ H5_DLL int H5T_get_nmembers(const H5T_t *dt); -H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno); +H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method); H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); /* Atomic functions */ diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index e562880..2390584 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -302,7 +302,7 @@ H5V_vector_inc(int n, hsize_t *v1, const hsize_t *v2) } /* Lookup table for general log2(n) routine */ -static const char LogTable256[] = +static const unsigned char LogTable256[] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, @@ -356,15 +356,15 @@ H5V_log2_gen(uint64_t n) #endif /* H5_BAD_LOG2_CODE_GENERATED */ if((ttt = (unsigned)(n >> 32))) if((tt = (unsigned)(n >> 48))) - r = (t = (unsigned)(n >> 56)) ? 56 + LogTable256[t] : 48 + LogTable256[tt & 0xFF]; + r = (t = (unsigned)(n >> 56)) ? 56 + (unsigned)LogTable256[t] : 48 + (unsigned)LogTable256[tt & 0xFF]; else - r = (t = (unsigned)(n >> 40)) ? 40 + LogTable256[t] : 32 + LogTable256[ttt & 0xFF]; + r = (t = (unsigned)(n >> 40)) ? 40 + (unsigned)LogTable256[t] : 32 + (unsigned)LogTable256[ttt & 0xFF]; else if((tt = (unsigned)(n >> 16))) - r = (t = (unsigned)(n >> 24)) ? 24 + LogTable256[t] : 16 + LogTable256[tt & 0xFF]; + r = (t = (unsigned)(n >> 24)) ? 24 + (unsigned)LogTable256[t] : 16 + (unsigned)LogTable256[tt & 0xFF]; else /* Added 'uint8_t' cast to pacify PGCC compiler */ - r = (t = (unsigned)(n >> 8)) ? 8 + LogTable256[t] : LogTable256[(uint8_t)n]; + r = (t = (unsigned)(n >> 8)) ? 8 + (unsigned)LogTable256[t] : (unsigned)LogTable256[(uint8_t)n]; #ifdef H5_BAD_LOG2_CODE_GENERATED } /* end else */ #endif /* H5_BAD_LOG2_CODE_GENERATED */ diff --git a/src/H5Znbit.c b/src/H5Znbit.c index 2423654..fabc7f0 100644 --- a/src/H5Znbit.c +++ b/src/H5Znbit.c @@ -326,7 +326,7 @@ H5Z_calc_parms_compound(const H5T_t *type) /* For each member, calculate parameters */ for(u = 0; u < (unsigned)nmembers; u++) { /* Get member datatype */ - if(NULL == (dtype_member = H5T_get_member_type(type, u))) + if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") /* Get member datatype's class */ @@ -637,7 +637,7 @@ H5Z_set_parms_compound(const H5T_t *type, unsigned cd_values[]) /* For each member, set parameters */ for(u = 0; u < (unsigned)nmembers; u++) { /* Get member datatype */ - if(NULL == (dtype_member = H5T_get_member_type(type, u))) + if(NULL == (dtype_member = H5T_get_member_type(type, u, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") /* Get member datatype's class */ diff --git a/src/H5checksum.c b/src/H5checksum.c index e42f152..3359722 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -126,10 +126,10 @@ H5_checksum_fletcher32(const void *_data, size_t _len) * performed without numeric overflow) */ while (len) { - unsigned tlen = len > 360 ? 360 : len; + size_t tlen = len > 360 ? 360 : len; len -= tlen; do { - sum1 += (((uint16_t)data[0]) << 8) | ((uint16_t)data[1]); + sum1 += (uint32_t)(((uint16_t)data[0]) << 8) | ((uint16_t)data[1]); data += 2; sum2 += sum1; } while (--tlen); @@ -139,7 +139,7 @@ H5_checksum_fletcher32(const void *_data, size_t _len) /* Check for odd # of bytes */ if(_len % 2) { - sum1 += ((uint16_t)*data) << 8; + sum1 += (uint32_t)(((uint16_t)*data) << 8); sum2 += sum1; sum1 = (sum1 & 0xffff) + (sum1 >> 16); sum2 = (sum2 & 0xffff) + (sum2 >> 16); @@ -486,8 +486,8 @@ H5_hash_string(const char *str) /* Sanity check */ HDassert(str); - while(c = *str++) - hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + while((c = *str++)) + hash = ((hash << 5) + hash) + (uint32_t)c; /* hash * 33 + c */ FUNC_LEAVE_NOAPI(hash) } /* end H5_hash_string() */ diff --git a/src/H5public.h b/src/H5public.h index a78e186..8b04f38 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -71,10 +71,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 7 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 8 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.7" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.8" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index 4a49d71..6a8a91a 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -497,7 +497,7 @@ HDstrtoll(const char *s, const char **rest, int base) if (sign>0) { acc = ((uint64_t)1<<(8*sizeof(int64_t)-1))-1; } else { - acc = (uint64_t)1<<(8*sizeof(int64_t)-1); + acc = (int64_t)((uint64_t)1<<(8*sizeof(int64_t)-1)); } errno = ERANGE; } @@ -622,9 +622,9 @@ H5_build_extpath(const char *name, char **extpath/*out*/) if ((full_path=H5MM_strdup(name)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } else { /* relative pathname */ - if ((cwdpath=H5MM_malloc(MAX_PATH_LEN)) == NULL) + if (NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if ((new_name=H5MM_strdup(name)) == NULL) + if (NULL == (new_name = (char *)H5MM_strdup(name))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* @@ -652,7 +652,7 @@ H5_build_extpath(const char *name, char **extpath/*out*/) cwdlen = HDstrlen(cwdpath); HDassert(cwdlen); path_len = cwdlen + HDstrlen(new_name) + 2; - if ((full_path=H5MM_malloc(path_len)) == NULL) + if (NULL == (full_path = (char *)H5MM_malloc(path_len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDstrcpy(full_path, cwdpath); diff --git a/src/H5trace.c b/src/H5trace.c index 926a590..4a42f0b 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -319,6 +319,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_ALLOC_TIME_INCR: fprintf (out, "H5D_ALLOC_TIME_INCR"); break; + default: + fprintf (out, "%ld", (long)alloc_time); + break; } } break; @@ -368,6 +371,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_FILL_TIME_IFSET: fprintf (out, "H5D_FILL_TIME_IFSET"); break; + default: + fprintf (out, "%ld", (long)fill_time); + break; } } break; @@ -394,6 +400,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_FILL_VALUE_USER_DEFINED: fprintf (out, "H5D_FILL_VALUE_USER_DEFINED"); break; + default: + fprintf (out, "%ld", (long)fill_value); + break; } } break; @@ -619,6 +628,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5F_CLOSE_STRONG: fprintf(out, "H5F_CLOSE_STRONG"); break; + default: + fprintf(out, "%ld", (long)degree); + break; } } break; @@ -643,6 +655,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "H5F_SCOPE_DOWN " "/*FOR INTERNAL USE ONLY!*/"); break; + default: + fprintf(out, "%ld", (long)scope); + break; } } break; @@ -663,6 +678,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5F_LIBVER_LATEST: fprintf(out, "H5F_LIBVER_LATEST"); break; + default: + fprintf(out, "%ld", (long)libver_vers); + break; } } break; @@ -928,7 +946,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) /* Save the rank of simple data spaces for arrays */ /* This may generate recursive call to the library... -QAK */ { - H5S_t *space = H5I_object(obj); + H5S_t *space = (H5S_t *)H5I_object(obj); if (H5S_SIMPLE==H5S_GET_EXTENT_TYPE(space)) { asize[argno] = H5S_GET_EXTENT_NDIMS(space); } @@ -997,6 +1015,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5_INDEX_N: fprintf(out, "H5_INDEX_N"); break; + default: + fprintf(out, "%ld", (long)idx_type); + break; } /* end switch */ } /* end else */ break; @@ -1026,6 +1047,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5_ITER_N: fprintf(out, "H5_ITER_N"); break; + default: + fprintf(out, "%ld", (long)order); + break; } /* end switch */ } /* end else */ break; @@ -1169,6 +1193,12 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5L_TYPE_SOFT: fprintf(out, "H5L_TYPE_SOFT"); break; + case H5L_TYPE_EXTERNAL: + fprintf(out, "H5L_TYPE_EXTERNAL"); + break; + case H5L_TYPE_MAX: + fprintf(out, "H5L_TYPE_MAX"); + break; default: fprintf(out, "%ld", (long)link_type); break; @@ -1286,6 +1316,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) else { H5O_type_t objtype = va_arg(ap, H5O_type_t); /*lint !e64 Type mismatch not really occuring */ switch(objtype) { + case H5O_TYPE_UNKNOWN: + fprintf(out, "H5O_TYPE_UNKNOWN"); + break; case H5O_TYPE_GROUP: fprintf(out, "H5O_TYPE_GROUP"); break; @@ -1295,6 +1328,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5O_TYPE_NAMED_DATATYPE: fprintf(out, "H5O_TYPE_NAMED_DATATYPE"); break; + case H5O_TYPE_NTYPES: + fprintf(out, "H5O_TYPE_TYPES"); + break; default: fprintf(out, "BADTYPE(%ld)", (long)objtype); break; @@ -1317,13 +1353,13 @@ H5_trace (const double *returning, const char *func, const char *type, ...) } } else { hid_t pclass_id = va_arg (ap, hid_t); - char *class_name=NULL; + char *class_name = NULL; H5P_genclass_t *pclass; /* Get the class name and print it */ /* This may generate recursive call to the library... -QAK */ - if(NULL != (pclass = H5I_object(pclass_id)) && - (class_name=H5P_get_class_name(pclass))!=NULL) { + if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) && + (class_name = H5P_get_class_name(pclass))!=NULL) { fprintf (out, class_name); H5MM_xfree(class_name); } /* end if */ diff --git a/src/Makefile.in b/src/Makefile.in index f11df74..8554d49 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -404,7 +404,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 5 -LT_VERS_REVISION = 8 +LT_VERS_REVISION = 9 LT_VERS_AGE = 0 H5detect_CFLAGS = -g |