From ea27e1380cf02e5f92d61cf9509596914c14e4df Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Sun, 8 May 2022 04:38:32 -0500 Subject: Fixes for various warnings/alignment with develop branch (#1755) --- examples/h5_extlink.c | 5 +-- src/H5Adense.c | 3 +- src/H5C.c | 25 ++++++++------ src/H5Cdbg.c | 4 +-- src/H5Cmpio.c | 59 ++++++++++++++++---------------- src/H5Dchunk.c | 6 ++-- src/H5Dint.c | 2 +- src/H5Dprivate.h | 2 +- src/H5FDmpio.c | 34 ++----------------- src/H5Fprivate.h | 9 +++-- src/H5Fsuper.c | 9 ++--- src/H5HL.c | 2 +- src/H5O.c | 10 +++--- src/H5Odeprec.c | 10 +++--- src/H5Odrvinfo.c | 2 +- src/H5Ofill.c | 2 +- src/H5Oint.c | 10 ++---- src/H5Pfapl.c | 8 +++-- src/H5R.c | 2 +- src/H5Rint.c | 4 +-- src/H5Rpkg.h | 3 +- src/H5SL.c | 32 +++++++++++++++--- src/H5Shyper.c | 33 ------------------ src/H5Tvlen.c | 36 ++++++++++---------- src/H5mpi.c | 2 +- src/H5trace.c | 2 +- test/chunk_info.c | 17 +++++----- test/enc_dec_plist.c | 46 ++++++++++++------------- test/h5test.c | 21 +----------- test/objcopy.c | 4 +-- test/tvltypes.c | 14 ++++---- testpar/t_cache.c | 55 +++++++++++++++--------------- testpar/t_dset.c | 12 +++---- testpar/t_file.c | 9 +++-- testpar/t_mdset.c | 8 ++--- testpar/t_shapesame.c | 27 +++------------ testpar/t_span_tree.c | 87 +++++++++++++++++++++++++----------------------- tools/lib/h5tools_dump.c | 2 +- 38 files changed, 265 insertions(+), 353 deletions(-) diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index a7bb355..4508fb6 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -207,7 +207,7 @@ extlink_prefix_example(void) * that a path was supplied in the udata. */ static hid_t UD_soft_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, - hid_t lapl_id); + hid_t lapl_id, hid_t dxpl_id); static void soft_link_example(void) @@ -276,7 +276,8 @@ soft_link_example(void) */ static hid_t -UD_soft_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id) +UD_soft_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, + hid_t dxpl_id) { const char *target = (const char *)udata; hid_t ret_value; diff --git a/src/H5Adense.c b/src/H5Adense.c index f4e09ea..fd8b839 100644 --- a/src/H5Adense.c +++ b/src/H5Adense.c @@ -300,7 +300,8 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) * allocated spaces for the intermediate decoded attribute. */ if (*user_attr != NULL) { - H5A_t *old_attr = *user_attr; + H5A_t *old_attr = *(H5A_t **)_user_attr; + if (old_attr->shared) { /* Free any dynamically allocated items */ if (H5A__free(old_attr) < 0) diff --git a/src/H5C.c b/src/H5C.c index 43c88b7..a9db343 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -103,6 +103,9 @@ /* Local Typedefs */ /******************/ +/* Alias for pointer to cache entry, for use when allocating sequences of them */ +typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t; + /********************/ /* Local Prototypes */ /********************/ @@ -188,8 +191,8 @@ H5FL_DEFINE(H5C_tag_info_t); /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); -/* Declare a free list to manage flush dependency arrays */ -H5FL_BLK_DEFINE_STATIC(parent); +/* Declare a free list to manage arrays of cache entries */ +H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); /*------------------------------------------------------------------------- * Function: H5C_create @@ -3939,8 +3942,8 @@ done: /* Array does not exist yet, allocate it */ HDassert(!child_entry->flush_dep_parent); - if (NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_MALLOC( - parent, H5C_FLUSH_DEP_PARENT_INIT * sizeof(H5C_cache_entry_t *)))) + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; @@ -3949,9 +3952,9 @@ done: /* Resize existing array */ HDassert(child_entry->flush_dep_parent); - if (NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC( - parent, child_entry->flush_dep_parent, - 2 * child_entry->flush_dep_parent_nalloc * sizeof(H5C_cache_entry_t *)))) + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + 2 * child_entry->flush_dep_parent_nalloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc *= 2; @@ -4115,14 +4118,14 @@ done: /* Shrink or free the parent array if apporpriate */ if (child_entry->flush_dep_nparents == 0) { child_entry->flush_dep_parent = - (H5C_cache_entry_t **)H5FL_BLK_FREE(parent, child_entry->flush_dep_parent); + H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); child_entry->flush_dep_parent_nalloc = 0; } /* end if */ else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { - if (NULL == (child_entry->flush_dep_parent = (H5C_cache_entry_t **)H5FL_BLK_REALLOC( - parent, child_entry->flush_dep_parent, - (child_entry->flush_dep_parent_nalloc / 4) * sizeof(H5C_cache_entry_t *)))) + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + child_entry->flush_dep_parent_nalloc / 4))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for flush dependency parent list") child_entry->flush_dep_parent_nalloc /= 4; diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index c52c8d5..34ef154 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -893,8 +893,8 @@ H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, hbool_t du HDassert(cache_ptr); HDassert(entry_ptr); - HDfprintf(stderr, "%*s%s: entry_ptr = (%a, '%s', %a, %t, %u, %u/%u)\n", indent, "", prefix, - entry_ptr->addr, entry_ptr->type->name, + HDfprintf(stderr, "%*s%s: entry_ptr = (%" PRIdHADDR ", '%s', %" PRIdHADDR ", %d, %u, %u/%u)\n", indent, + "", prefix, entry_ptr->addr, entry_ptr->type->name, entry_ptr->tag_info ? entry_ptr->tag_info->tag : HADDR_UNDEF, entry_ptr->is_dirty, entry_ptr->flush_dep_nparents, entry_ptr->flush_dep_nchildren, entry_ptr->flush_dep_ndirty_children); diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index b7df352..a14bd46 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -160,14 +160,11 @@ herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank, int mpi_size) { - int i; - int m; - int n; unsigned first_entry_to_flush; unsigned last_entry_to_flush; unsigned total_entries_to_clear = 0; unsigned total_entries_to_flush = 0; - int * candidate_assignment_table = NULL; + unsigned * candidate_assignment_table = NULL; unsigned entries_to_flush[H5C_RING_NTYPES]; unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; @@ -179,6 +176,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha char tbl_buf[1024]; #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ + unsigned m, n; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -219,10 +217,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") } /* end if */ - n = num_candidates / mpi_size; - m = num_candidates % mpi_size; - HDassert(n >= 0); - if (NULL == (candidate_assignment_table = (int *)H5MM_malloc(sizeof(int) * (size_t)(mpi_size + 1)))) + n = num_candidates / (unsigned)mpi_size; + m = num_candidates % (unsigned)mpi_size; + + if (NULL == + (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table") @@ -231,31 +230,31 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha if (m == 0) { /* mpi_size is an even divisor of num_candidates */ HDassert(n > 0); - for (i = 1; i < mpi_size; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n; + for (u = 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n; } /* end if */ else { - for (i = 1; i <= m; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n + 1; + for (u = 1; u <= m; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n + 1; - if (num_candidates < mpi_size) { - for (i = m + 1; i < mpi_size; i++) - candidate_assignment_table[i] = num_candidates; + if (num_candidates < (unsigned)mpi_size) { + for (u = m + 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = num_candidates; } /* end if */ else { - for (i = m + 1; i < mpi_size; i++) - candidate_assignment_table[i] = candidate_assignment_table[i - 1] + n; + for (u = m + 1; u < (unsigned)mpi_size; u++) + candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n; } /* end else */ } /* end else */ HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); #if H5C_DO_SANITY_CHECKS /* Verify that the candidate assignment table has the expected form */ - for (i = 1; i < mpi_size - 1; i++) { - int a, b; + for (u = 1; u < (unsigned)(mpi_size - 1); u++) { + unsigned a, b; - a = candidate_assignment_table[i] - candidate_assignment_table[i - 1]; - b = candidate_assignment_table[i + 1] - candidate_assignment_table[i]; + a = candidate_assignment_table[u] - candidate_assignment_table[u - 1]; + b = candidate_assignment_table[u + 1] - candidate_assignment_table[u]; HDassert(n + 1 >= a); HDassert(a >= b); @@ -267,11 +266,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha last_entry_to_flush = candidate_assignment_table[mpi_rank + 1] - 1; #if H5C_APPLY_CANDIDATE_LIST__DEBUG - for (i = 0; i < 1024; i++) - tbl_buf[i] = '\0'; + for (u = 0; u < 1024; u++) + tbl_buf[u] = '\0'; HDsprintf(&(tbl_buf[0]), "candidate assignment table = "); - for (i = 0; i <= mpi_size; i++) - HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[i]); + for (u = 0; u <= (unsigned)mpi_size; u++) + HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %d", candidate_assignment_table[u]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); @@ -346,13 +345,13 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #if H5C_DO_SANITY_CHECKS m = 0; n = 0; - for (i = 0; i < H5C_RING_NTYPES; i++) { - m += (int)entries_to_flush[i]; - n += (int)entries_to_clear[i]; + for (u = 0; u < H5C_RING_NTYPES; u++) { + m += entries_to_flush[u]; + n += entries_to_clear[u]; } /* end if */ HDassert((unsigned)m == total_entries_to_flush); - HDassert((unsigned)n == total_entries_to_clear); + HDassert(n == total_entries_to_clear); #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG @@ -385,7 +384,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha done: if (candidate_assignment_table != NULL) - candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); + candidate_assignment_table = (unsigned *)H5MM_xfree((void *)candidate_assignment_table); if (cache_ptr->coll_write_list) { if (H5SL_close(cache_ptr->coll_write_list) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index e6a53f4..43236e9 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4321,9 +4321,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const of each dimension */ hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */ - unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */ - const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); - herr_t ret_value = SUCCEED; /* Return value */ + unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */ + H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) diff --git a/src/H5Dint.c b/src/H5Dint.c index 91d814b..c08a329 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3303,7 +3303,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush_all(const H5F_t *f) +H5D_flush_all(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index c61604d..a74023e 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -165,7 +165,7 @@ H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); -H5_DLL herr_t H5D_flush_all(const H5F_t *f); +H5_DLL herr_t H5D_flush_all(H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 8ffdefb..3ef4d09 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1318,36 +1318,6 @@ done: } /* end H5FD__mpio_get_handle() */ /*------------------------------------------------------------------------- - * Function: H5FD__mpio_get_info - * - * Purpose: Returns the file info of MPIO file driver. - * - * Returns: Non-negative if succeed or negative if fails. - * - * Programmer: John Mainzer - * April 4, 2017 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD_mpio__get_info(H5FD_t *_file, void **mpi_info) -{ - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - if (!mpi_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid") - - *mpi_info = &(file->info); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD__mpio_get_info() */ - -/*------------------------------------------------------------------------- * Function: H5FD__mpio_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR @@ -1802,8 +1772,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h * potentially be wrong.) */ file->eof = HADDR_UNDEF; - if (bytes_written && ((bytes_written + addr) > file->local_eof)) - file->local_eof = addr + bytes_written; + if (bytes_written && (((haddr_t)bytes_written + addr) > file->local_eof)) + file->local_eof = addr + (haddr_t)bytes_written; done: #ifdef H5FDmpio_DEBUG diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 5e9299a..75f1e20 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -188,14 +188,13 @@ typedef struct H5F_t H5F_t; #define INT32DECODE(p, i) \ { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); \ + (i) = ((int32_t)(*(p)&0xff)); \ (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); \ + (i) |= ((int32_t)(*(p)&0xff) << 8); \ (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); \ + (i) |= ((int32_t)(*(p)&0xff) << 16); \ (p)++; \ - (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ - ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | ((*(p)&0x80) ? ~0xffffffffULL : 0x0ULL))); \ (p)++; \ } diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index d3c267d..b485ecc 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -518,12 +518,9 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * base address and "end of file" address if so. */ if (!H5F_addr_eq(super_addr, sblock->base_addr)) { - /* Check if the superblock moved earlier in the file */ - if (H5F_addr_lt(super_addr, sblock->base_addr)) - udata.stored_eof -= (sblock->base_addr - super_addr); - else - /* The superblock moved later in the file */ - udata.stored_eof += (super_addr - sblock->base_addr); + /* If the superblock moved in the file, adjust the EOF */ + /* (Handles moving earlier & later) */ + udata.stored_eof -= (sblock->base_addr - super_addr); /* Adjust base address for offsets of the HDF5 data in the file */ sblock->base_addr = super_addr; diff --git a/src/H5HL.c b/src/H5HL.c index 2ea6619..1f2369a 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -543,7 +543,7 @@ done: * *------------------------------------------------------------------------- */ - +herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out) { H5HL_free_t *fl = NULL, *last_fl = NULL; diff --git a/src/H5O.c b/src/H5O.c index 2e1f692..4664de7 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1129,12 +1129,10 @@ herr_t H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Location of group */ + H5G_loc_t obj_loc; /* Location used to open group */ + hbool_t loc_found = FALSE; /* Entry at 'name' found */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo, lapl_id); diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 10a9c2e..e08eee1 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -158,12 +158,10 @@ herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id) { - H5G_loc_t loc; /* Location of group */ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'name' found */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Location of group */ + H5G_loc_t obj_loc; /* Location used to open group */ + hbool_t loc_found = FALSE; /* Entry at 'name' found */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo, lapl_id); diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 80d0a1a..1910282 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -294,7 +294,7 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int HDassert(fwidth >= 0); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Buffer size:", mesg->len); + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_debug() */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 8b22939..ee00afc 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -351,7 +351,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags if (NULL == (dt = H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") /* Verify size */ - if (fill->size != H5T_GET_SIZE(dt)) + if (fill->size != (ssize_t)H5T_GET_SIZE(dt)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") } diff --git a/src/H5Oint.c b/src/H5Oint.c index 4207b9f..19d809a 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -261,14 +261,8 @@ done: herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc_t *loc /*out*/) { - H5P_genplist_t *oc_plist; /* Object creation property list */ - H5O_t * oh = NULL; /* Object header created */ - herr_t ret_value = SUCCEED; /* return value */ - haddr_t oh_addr; /* Address of initial object header */ - size_t oh_size; /* Size of initial object header */ - uint8_t oh_flags; /* Object header's initial status flags */ - unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting objec t header into cache */ - hbool_t store_msg_crt_idx; /* Whether to always store message crea tion indices for this file */ + H5O_t *oh = NULL; /* Object header created */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index e0cbe62..5a5c8c9 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1187,12 +1187,14 @@ H5P__file_driver_free(void *value) /* Allow driver to free info or do it ourselves */ if (driver->fapl_free) { - if ((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ + /* Free the const pointer */ + /* Cast through uintptr_t to de-const memory */ + if ((driver->fapl_free)((void *)(uintptr_t)info->driver_info) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") } /* end if */ else - H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ - } /* end if */ + H5MM_xfree_const(info->driver_info); + } /* end if */ /* Decrement reference count for driver */ if (H5I_dec_ref(info->driver_id) < 0) diff --git a/src/H5R.c b/src/H5R.c index c1a4128..a7d2342 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -336,7 +336,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t file = loc.oloc->file; /* Get name */ - if ((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0) + if ((ret_value = H5R__get_name(file, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: diff --git a/src/H5Rint.c b/src/H5Rint.c index f0b2b3d..578151e 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -670,8 +670,6 @@ done: ssize_t H5R__get_name(f, ref_type, ref, name, size) H5F_t *f; IN: Pointer to the file that the reference is pointing into - hid_t lapl_id; IN: LAPL to use for operation - hid_t id; IN: Location ID given for reference H5R_type_t ref_type; IN: Type of reference void *_ref; IN: Reference to query. char *name; OUT: Buffer to place name of object referenced @@ -689,7 +687,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, size_t size) +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) { hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 3fa2cb5..b274efd 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -50,7 +50,6 @@ H5_DLL herr_t H5R__create(void *ref, H5G_loc_t *loc, const char *name, H5R_type_ H5_DLL hid_t H5R__dereference(H5F_t *file, hid_t dapl_id, H5R_type_t ref_type, const void *_ref); H5_DLL H5S_t * H5R__get_region(H5F_t *file, const void *_ref); H5_DLL herr_t H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref, H5O_type_t *obj_type); -H5_DLL ssize_t H5R__get_name(H5F_t *file, hid_t id, H5R_type_t ref_type, const void *_ref, char *name, - size_t size); +H5_DLL ssize_t H5R__get_name(H5F_t *file, H5R_type_t ref_type, const void *_ref, char *name, size_t size); #endif /* H5Rpkg_H */ diff --git a/src/H5SL.c b/src/H5SL.c index 4d4c458..b3a91f2 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -880,10 +880,18 @@ H5SL_release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) while (node) { next_node = node->forward[0]; - /* Call callback, if one is given */ + /* Call callback, if one is given. + * + * Ignoring const here is fine as we only need the value to be const + * with respect to the list code, which should never modify the + * elements. The library code that is making use of the skip list + * container can do what it likes with the elements. + */ + H5_GCC_DIAG_OFF("cast-qual") if (op) /* Casting away const OK -QAK */ (void)(op)(node->item, (void *)node->key, op_data); + H5_GCC_DIAG_ON("cast-qual") node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward); node = H5FL_FREE(H5SL_node_t, node); @@ -2179,11 +2187,18 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) /* Protect against the node being deleted by the callback */ next = node->forward[0]; - /* Call the iterator callback */ - /* Casting away const OK -QAK */ + /* Call the iterator callback + * + * Ignoring const here is fine as we only need the value to be const + * with respect to the list code, which should never modify the + * elements. The library code that is making use of the skip list + * container can do what it likes with the elements. + */ + H5_GCC_DIAG_OFF("cast-qual") if (!node->removed) if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0) break; + H5_GCC_DIAG_ON("cast-qual") /* Advance to next node */ node = next; @@ -2336,10 +2351,17 @@ H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data) while (node) { /* Check if the node was already removed */ if (!node->removed) { - /* Call callback */ - /* Casting away const OK -NAF */ + /* Call callback, if one is given. + * + * Ignoring const here is fine as we only need the value to be const + * with respect to the list code, which should never modify the + * elements. The library code that is making use of the skip list + * container can do what it likes with the elements. + */ + H5_GCC_DIAG_OFF("cast-qual") if ((op_ret = (op)(node->item, (void *)node->key, op_data)) < 0) HGOTO_ERROR(H5E_SLIST, H5E_CALLBACK, FAIL, "callback operation failed") + H5_GCC_DIAG_ON("cast-qual") /* Check if op indicated that the node should be removed */ if (op_ret) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 438afef..6bc5115 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -3499,39 +3499,6 @@ done: /*-------------------------------------------------------------------------- NAME - H5S__hyper_get_enc_size_real - PURPOSE - Determine the size to encode the hyperslab selection info - USAGE - hssize_t H5S__hyper_get_enc_size_real(max_size, enc_size) - hsize_t max_size: IN: The maximum size of the hyperslab selection info - unint8_t *enc_size: OUT:The encoding size - RETURNS - The size to encode hyperslab selection info - DESCRIPTION - Determine the size by comparing "max_size" with (2^32 - 1) and (2^16 - 1). - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static uint8_t -H5S__hyper_get_enc_size_real(hsize_t max_size) -{ - uint8_t ret_value; - - FUNC_ENTER_STATIC_NOERR - - if (max_size > H5S_UINT32_MAX) - ret_value = H5S_SELECT_INFO_ENC_SIZE_8; - else - ret_value = H5S_SELECT_INFO_ENC_SIZE_4; - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5S__hyper_get_enc_size_real() */ - -/*-------------------------------------------------------------------------- - NAME H5S__hyper_get_version_enc_size PURPOSE Determine the version and encoded size to use for encoding hyperslab selection info diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index abc6d0f..2f15c4a 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -817,8 +817,8 @@ H5T_vlen_disk_getptr(void H5_ATTR_UNUSED *vl) static htri_t H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) { - uint8_t *vl = (uint8_t *)_vl; /* Pointer to the disk VL information */ - haddr_t addr; /* Sequence's heap address */ + const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the disk VL information */ + haddr_t addr; /* Sequence's heap address */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -829,7 +829,7 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) vl += 4; /* Get the heap address */ - H5F_addr_decode(f, (const uint8_t **)&vl, &addr); + H5F_addr_decode(f, &vl, &addr); FUNC_LEAVE_NOAPI(addr == 0 ? TRUE : FALSE) } /* end H5T_vlen_disk_isnull() */ @@ -849,9 +849,9 @@ H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) static herr_t H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) { - uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ - H5HG_t hobjid; - herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ + H5HG_t hobjid; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -864,7 +864,7 @@ H5T_vlen_disk_read(H5F_t *f, void *_vl, void *buf, size_t H5_ATTR_UNUSED len) vl += 4; /* Get the heap information */ - H5F_addr_decode(f, (const uint8_t **)&vl, &(hobjid.addr)); + H5F_addr_decode(f, &vl, &(hobjid.addr)); UINT32DECODE(vl, hobjid.idx); /* Check if this sequence actually has any data */ @@ -893,11 +893,11 @@ static herr_t H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) { - uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/ - uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */ - H5HG_t hobjid; /* New VL sequence's heap ID */ - size_t len; /* Size of new sequence on disk (in bytes) */ - herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *bg = (const uint8_t *)_bg; /*Pointer to the old data hvl_t */ + uint8_t * vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/ + H5HG_t hobjid; /* New VL sequence's heap ID */ + size_t len; /* Size of new sequence on disk (in bytes) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -914,7 +914,7 @@ H5T_vlen_disk_write(H5F_t *f, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_all bg += 4; /* Get heap information */ - H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); + H5F_addr_decode(f, &bg, &(bg_hobjid.addr)); UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ @@ -955,10 +955,10 @@ done: static herr_t H5T_vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg) { - uint8_t *vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/ - uint8_t *bg = (uint8_t *)_bg; /*Pointer to the old data hvl_t */ - uint32_t seq_len = 0; /* Sequence length */ - herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *bg = (const uint8_t *)_bg; /*Pointer to the old data hvl_t */ + uint8_t * vl = (uint8_t *)_vl; /*Pointer to the user's hvl_t information*/ + uint32_t seq_len = 0; /* Sequence length */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -974,7 +974,7 @@ H5T_vlen_disk_setnull(H5F_t *f, void *_vl, void *_bg) bg += 4; /* Get heap information */ - H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); + H5F_addr_decode(f, &bg, &(bg_hobjid.addr)); UINT32DECODE(bg, bg_hobjid.idx); /* Free heap object for old data */ diff --git a/src/H5mpi.c b/src/H5mpi.c index 647c190..7497ae9 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -25,7 +25,7 @@ /****************/ /* Local Macros */ /****************/ -#define TWO_GIG_LIMIT (1 << 31) +#define TWO_GIG_LIMIT INT32_MAX #ifndef H5_MAX_MPI_COUNT #define H5_MAX_MPI_COUNT (1 << 30) #endif diff --git a/src/H5trace.c b/src/H5trace.c index 6eff40c..336ae74 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1823,7 +1823,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { hobj_ref_t ref = HDva_arg(ap, hobj_ref_t); - HDfprintf(out, "Reference Object=%a", ref); + HDfprintf(out, "Reference Object=%" PRIdHADDR, ref); } /* end else */ break; diff --git a/test/chunk_info.c b/test/chunk_info.c index 76132c6..a0fdac5 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -99,7 +99,8 @@ read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, void *direct_bu /* Verify that read chunk is the same as the corresponding written one */ if (HDmemcmp(direct_buf, read_buf, CHUNK_NX * CHUNK_NY) != 0) { - HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset1, offset2); + HDfprintf(stderr, "Read chunk differs from written chunk at offset (%" PRIdHSIZE ",%" PRIdHSIZE ")\n", + offset1, offset2); return (FAIL); } @@ -1205,7 +1206,6 @@ test_chunk_info_extensible_array(char *filename, hid_t fapl) hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ @@ -1450,7 +1450,6 @@ test_chunk_info_version2_btrees(char *filename, hid_t fapl) hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX * CHUNK_NY * sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ @@ -1774,12 +1773,12 @@ error: static int create_4x4_dset(hid_t fapl) { - hid_t fid; /* file ID */ - hid_t did; /* dataset ID */ - hid_t f_sid; /* file space ID */ - hid_t m_sid; /* memory space ID */ - hid_t pid; /* property list ID */ - hsize_t start[2]; /* chunk location to start writing */ + hid_t fid = H5I_INVALID_HID; /* file ID */ + hid_t did = H5I_INVALID_HID; /* dataset ID */ + hid_t f_sid = H5I_INVALID_HID; /* file space ID */ + hid_t m_sid = H5I_INVALID_HID; /* memory space ID */ + hid_t pid = H5I_INVALID_HID; /* property list ID */ + hsize_t start[2]; /* chunk location to start writing */ hsize_t dims[2] = {4, 4}; hsize_t chunk_dims[2] = {2, 2}; int chunk_data[2][2] = {{1, 1}, {1, 1}}; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 5879e38..d34f500 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -66,31 +66,27 @@ error: int main(void) { - hid_t dcpl; /* dataset create prop. list */ - hid_t dapl; /* dataset access prop. list */ - hid_t dxpl; /* dataset xfer prop. list */ - hid_t gcpl; /* group create prop. list */ - hid_t ocpypl; /* object copy prop. list */ - hid_t ocpl; /* object create prop. list */ - hid_t lcpl; /* link create prop. list */ - hid_t lapl; /* link access prop. list */ - hid_t fapl; /* file access prop. list */ - hid_t fcpl; /* file create prop. list */ - hid_t strcpl; /* string create prop. list */ - hid_t acpl; /* attribute create prop. list */ - hid_t srcspace = -1; /* Source dataspaces */ - hid_t vspace = -1; /* Virtual dset dataspaces */ - hsize_t dims[1] = {3}; /* Data space current size */ - hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ - double fill = 2.7; /* Fill value */ - hsize_t max_size[1]; /* data space maximum size */ - size_t nslots = 521 * 2; - size_t nbytes = 1048576 * 10; - double w0 = 0.5; - unsigned max_compact; - unsigned min_dense; - const char * c_to_f = "x+32"; - H5F_libver_t low, high; /* Low and high bounds */ + hid_t dcpl; /* dataset create prop. list */ + hid_t dapl; /* dataset access prop. list */ + hid_t dxpl; /* dataset xfer prop. list */ + hid_t gcpl; /* group create prop. list */ + hid_t ocpypl; /* object copy prop. list */ + hid_t ocpl; /* object create prop. list */ + hid_t lcpl; /* link create prop. list */ + hid_t lapl; /* link access prop. list */ + hid_t fapl; /* file access prop. list */ + hid_t fcpl; /* file create prop. list */ + hid_t strcpl; /* string create prop. list */ + hid_t acpl; /* attribute create prop. list */ + hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ + double fill = 2.7; /* Fill value */ + hsize_t max_size[1]; /* data space maximum size */ + size_t nslots = 521 * 2; + size_t nbytes = 1048576 * 10; + double w0 = 0.5; + unsigned max_compact; + unsigned min_dense; + const char *c_to_f = "x+32"; H5AC_cache_config_t my_cache_config = {H5AC__CURR_CACHE_CONFIG_VERSION, TRUE, diff --git a/test/h5test.c b/test/h5test.c index 8d0960e..9169f29 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -539,7 +539,6 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu hbool_t nest_printf) { const char *prefix = NULL; - const char *env = NULL; /* HDF5_DRIVER environment variable */ char * ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -561,25 +560,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; } else if (H5FD_MULTI == driver) { - - /* Get the environment variable, if it exists, in case - * we are using the split driver since both of those - * use the multi VFD under the hood. - */ - env = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - /* Use the environment variable, then the compile-time constant */ - if (!env) - env = HDF5_DRIVER; -#endif - if (env && !HDstrcmp(env, "split")) { - /* split VFD */ - suffix = NULL; - } - else { - /* multi VFD */ - suffix = NULL; - } + suffix = NULL; } } } diff --git a/test/objcopy.c b/test/objcopy.c index e3310ca..2743ccd 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -6881,8 +6881,8 @@ attach_attribute_compound_vlstr(hid_t loc_id) hid_t cmpd_tid = -1; /* Compound datatype ID */ hsize_t dim1 = 1; /* Dimension size */ typedef struct { /* Compound structure for the attribute */ - int i; - char *v; + int i; + const char *v; } s1; s1 buf; /* Buffer */ int ret_value = -1; /* Return value */ diff --git a/test/tvltypes.c b/test/tvltypes.c index 61d58cf..e70f96b 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2487,17 +2487,17 @@ test_vltypes_fill_value(void) typedef struct dtype1_struct { unsigned int gui; unsigned int pgui; - char * str_id; - char * str_name; - char * str_desc; - char * str_orig; - char * str_stat; + const char * str_id; + const char * str_name; + const char * str_desc; + const char * str_orig; + const char * str_stat; unsigned int ver; double val; double ma; double mi; - char * str_form; - char * str_unit; + const char * str_form; + const char * str_unit; } dtype1_struct; herr_t ret; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index ca3d467..9cbe429 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1501,10 +1501,10 @@ serve_read_request(struct mssg_t *mssg_ptr) reply.dest = mssg_ptr->src; reply.mssg_num = -1; /* set by send function */ reply.base_addr = data[target_index].base_addr; - reply.len = data[target_index].len; - reply.ver = data[target_index].ver; - reply.count = 0; - reply.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(reply.len, unsigned, data[target_index].len, size_t); + reply.ver = data[target_index].ver; + reply.count = 0; + reply.magic = MSSG_MAGIC; /* and update the counters */ total_reads++; @@ -1707,10 +1707,10 @@ serve_write_request(struct mssg_t *mssg_ptr) reply.dest = mssg_ptr->src; reply.mssg_num = -1; /* set by send function */ reply.base_addr = data[target_index].base_addr; - reply.len = data[target_index].len; - reply.ver = data[target_index].ver; - reply.count = 0; - reply.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(reply.len, unsigned, data[target_index].len, size_t); + reply.ver = data[target_index].ver; + reply.count = 0; + reply.magic = MSSG_MAGIC; /* and send it */ success = send_mssg(&reply, TRUE); @@ -2431,10 +2431,10 @@ datum_notify(H5C_notify_action_t action, void *thing) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; - mssg.ver = 0; /* bogus -- should be corrected by server */ - mssg.count = 0; /* not used */ - mssg.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(mssg.len, unsigned, entry_ptr->len, size_t); + mssg.ver = 0; /* bogus -- should be corrected by server */ + mssg.count = 0; /* not used */ + mssg.magic = MSSG_MAGIC; if (!send_mssg(&mssg, FALSE)) { @@ -2576,10 +2576,10 @@ datum_notify(H5C_notify_action_t action, void *thing) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = entry_ptr->base_addr; - mssg.len = entry_ptr->len; - mssg.ver = entry_ptr->ver; - mssg.count = 0; - mssg.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(mssg.len, unsigned, entry_ptr->len, size_t); + mssg.ver = entry_ptr->ver; + mssg.count = 0; + mssg.magic = MSSG_MAGIC; if (!send_mssg(&mssg, FALSE)) { @@ -4296,7 +4296,7 @@ verify_entry_reads(haddr_t addr, int expected_entry_reads) } else { - reported_entry_reads = mssg.count; + H5_CHECKED_ASSIGN(reported_entry_reads, int, mssg.count, unsigned); } } @@ -4393,7 +4393,7 @@ verify_entry_writes(haddr_t addr, int expected_entry_writes) } else { - reported_entry_writes = mssg.count; + H5_CHECKED_ASSIGN(reported_entry_writes, int, mssg.count, unsigned); } } @@ -4808,10 +4808,10 @@ server_smoke_check(void) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = data[world_mpi_rank].base_addr; - mssg.len = data[world_mpi_rank].len; - mssg.ver = ++(data[world_mpi_rank].ver); - mssg.count = 0; - mssg.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(mssg.len, unsigned, data[world_mpi_rank].len, size_t); + mssg.ver = ++(data[world_mpi_rank].ver); + mssg.count = 0; + mssg.magic = MSSG_MAGIC; if (!(success = send_mssg(&mssg, FALSE))) { @@ -4905,10 +4905,10 @@ server_smoke_check(void) mssg.dest = world_server_mpi_rank; mssg.mssg_num = -1; /* set by send function */ mssg.base_addr = data[world_mpi_rank].base_addr; - mssg.len = data[world_mpi_rank].len; - mssg.ver = 0; /* bogus -- should be corrected by server */ - mssg.count = 0; - mssg.magic = MSSG_MAGIC; + H5_CHECKED_ASSIGN(mssg.len, unsigned, data[world_mpi_rank].len, size_t); + mssg.ver = 0; /* bogus -- should be corrected by server */ + mssg.count = 0; + mssg.magic = MSSG_MAGIC; if (success) { @@ -6704,7 +6704,8 @@ smoke_check_6(int metadata_write_strategy) } /* Make sure coll entries do not cross the 80% threshold */ - HDassert(cache_ptr->max_cache_size * 0.8 > cache_ptr->coll_list_size); + H5_CHECK_OVERFLOW(cache_ptr->max_cache_size, size_t, double); + HDassert((double)cache_ptr->max_cache_size * 0.8 > cache_ptr->coll_list_size); } /* Restore collective metadata reads state */ H5F_set_coll_metadata_reads(file_ptr, &md_reads_file_flag, &md_reads_context_flag); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 03213db..8a0694e 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3437,9 +3437,9 @@ test_no_collective_cause_mode(int selection_mode) const char *test_name; hbool_t is_chunked = 1; hbool_t is_independent = 0; - int mpi_size = -1; - int mpi_rank = -1; - int length; + size_t length; + int mpi_size = -1; + int mpi_rank = -1; int * buffer; int i; MPI_Comm mpi_comm; @@ -3594,12 +3594,12 @@ test_no_collective_cause_mode(int selection_mode) } /* Get the number of elements in the selection */ - length = dims[0] * dims[1]; + length = (size_t)(dims[0] * dims[1]); /* Allocate and initialize the buffer */ - buffer = (int *)HDmalloc(sizeof(int) * (size_t)length); + buffer = (int *)HDmalloc(sizeof(int) * length); VRFY((buffer != NULL), "HDmalloc of buffer succeeded"); - for (i = 0; i < length; i++) + for (i = 0; (size_t)i < length; i++) buffer[i] = i; /* Set up the dxpl for the write */ diff --git a/testpar/t_file.c b/testpar/t_file.c index 7807052..695e6d0 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -106,7 +106,7 @@ test_split_comm_access(void) /* delete the test file */ if (sub_mpi_rank == 0) { - mrc = MPI_File_delete((char *)filename, info); + mrc = MPI_File_delete(filename, info); /*VRFY((mrc==MPI_SUCCESS), ""); */ } } @@ -119,8 +119,11 @@ test_split_comm_access(void) void test_page_buffer_access(void) { - hid_t file_id = -1; /* File ID */ - hid_t fcpl, fapl, fapl_self; + hid_t file_id = -1; /* File ID */ + hid_t fcpl, fapl; +#if 0 + hid_t fapl_self; +#endif size_t page_count = 0; int i, num_elements = 200; haddr_t raw_addr, meta_addr; diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index aecd76b..b773bdf 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -323,7 +323,7 @@ compact_dataset(void) /* Verify data value */ for (i = 0; i < size; i++) for (j = 0; j < size; j++) - if (inme[(i * size) + j] != outme[(i * size) + j]) + if (!H5_DBL_ABS_EQUAL(inme[(i * size) + j], outme[(i * size) + j])) if (err_num++ < MAX_ERR_REPORT || VERBOSE_MED) HDprintf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j, outme[(i * size) + j], inme[(i * size) + j]); @@ -2326,7 +2326,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* compare read data with expected data */ for (j = 0; j < LOCAL_DATA_SIZE; j++) - if (data_read[j] != data[j]) { + if (!H5_DBL_ABS_EQUAL(data_read[j], data[j])) { HDfprintf(stdout, "%0d:%s: Reading datasets value failed in " "Dataset %d, at position %d: expect %f, got %f.\n", @@ -2388,7 +2388,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) VRFY((err >= 0), "H5Aread failed.\n"); /* compare read attribute data with expected data */ for (j = 0; j < LOCAL_DATA_SIZE; j++) - if (att_read[j] != att[j]) { + if (!H5_DBL_ABS_EQUAL(att_read[j], att[j])) { HDfprintf(stdout, "%0d:%s: Mismatched attribute data read in Dataset %d, at position " "%d: expect %f, got %f.\n", @@ -2439,7 +2439,7 @@ rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) VRFY((err >= 0), "H5Aread failed.\n"); /* compare read attribute data with expected data */ for (j = 0; j < LARGE_ATTR_SIZE; j++) - if (lg_att_read[j] != lg_att[j]) { + if (!H5_DBL_ABS_EQUAL(lg_att_read[j], lg_att[j])) { HDfprintf(stdout, "%0d:%s: Mismatched large attribute data read in Dataset %d, at " "position %d: expect %f, got %f.\n", diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9d450f5..a87ad73 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -352,14 +352,9 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker * * JRM -- 9/16/10 */ - if (express_test == 0) { - tv_ptr->chunk_dims[0] = 1; - } - else { + tv_ptr->chunk_dims[0] = 1; - tv_ptr->chunk_dims[0] = 1; - } tv_ptr->chunk_dims[1] = tv_ptr->chunk_dims[2] = tv_ptr->chunk_dims[3] = tv_ptr->chunk_dims[4] = (hsize_t)(tv_ptr->chunk_edge_size); @@ -1705,7 +1700,6 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i #if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG const char *fcnName = "contig_hs_dr_pio_test__run_test()"; #endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ - int mpi_rank; struct hs_dr_pio_test_vars_t test_vars = { /* int mpi_size = */ -1, /* int mpi_rank = */ -1, @@ -1770,9 +1764,6 @@ contig_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i hs_dr_pio_test__setup(test_num, edge_size, -1, chunk_edge_size, small_rank, large_rank, use_collective_io, dset_type, express_test, tv_ptr); - /* initialize the local copy of mpi_rank */ - mpi_rank = tv_ptr->mpi_rank; - /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; tv_ptr->max_skips = max_skips; @@ -3059,8 +3050,7 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t *tv_ptr) #if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_l2s()"; #endif /* CHECKER_BOARD_HS_DR_PIO_TEST__M2D_L2S__DEBUG */ - hbool_t data_ok = FALSE; - hbool_t mis_match = FALSE; + hbool_t data_ok = FALSE; int i, j, k, l; size_t u; size_t start_index; @@ -3266,8 +3256,6 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t *tv_ptr) /* verify that expected data is retrieved */ - mis_match = FALSE; - expected_value = (uint32_t)( (i * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) + (j * tv_ptr->edge_size * tv_ptr->edge_size * tv_ptr->edge_size) + @@ -3358,8 +3346,7 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) #if CHECKER_BOARD_HS_DR_PIO_TEST__M2D_S2L__DEBUG const char *fcnName = "ckrbrd_hs_dr_pio_test__m2d_s2l()"; #endif /* CONTIG_HS_DR_PIO_TEST__M2D_S2L__DEBUG */ - hbool_t data_ok = FALSE; - hbool_t mis_match = FALSE; + hbool_t data_ok = FALSE; int i, j, k, l; size_t u; size_t start_index; @@ -3575,8 +3562,6 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t *tv_ptr) HDassert(start_index < stop_index); HDassert(stop_index < tv_ptr->large_ds_size); - mis_match = FALSE; - data_ok = TRUE; ptr_1 = tv_ptr->large_ds_buf_1; @@ -3647,8 +3632,7 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i { #if CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG const char *fcnName = "ckrbrd_hs_dr_pio_test__run_test()"; -#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ - int mpi_rank; /* needed by VRFY */ +#endif /* CKRBRD_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ struct hs_dr_pio_test_vars_t test_vars = { /* int mpi_size = */ -1, /* int mpi_rank = */ -1, @@ -3713,9 +3697,6 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, const int edge_size, const i hs_dr_pio_test__setup(test_num, edge_size, checker_edge_size, chunk_edge_size, small_rank, large_rank, use_collective_io, dset_type, express_test, tv_ptr); - /* initialize the local copy of mpi_rank */ - mpi_rank = tv_ptr->mpi_rank; - /* initialize skips & max_skips */ tv_ptr->skips = *skips_ptr; tv_ptr->max_skips = max_skips; diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index e6fc9aa..6f0efa3 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -45,7 +45,7 @@ #define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0 static void coll_write_test(int chunk_factor); -static void coll_read_test(int chunk_factor); +static void coll_read_test(void); /*------------------------------------------------------------------------- * Function: coll_irregular_cont_write @@ -88,7 +88,7 @@ void coll_irregular_cont_read(void) { - coll_read_test(0); + coll_read_test(); } /*------------------------------------------------------------------------- @@ -132,7 +132,7 @@ void coll_irregular_simple_chunk_read(void) { - coll_read_test(1); + coll_read_test(); } /*------------------------------------------------------------------------- @@ -176,7 +176,7 @@ void coll_irregular_complex_chunk_read(void) { - coll_read_test(4); + coll_read_test(); } /*------------------------------------------------------------------------- @@ -216,9 +216,9 @@ coll_write_test(int chunk_factor) hsize_t block[2]; /* Block sizes */ hsize_t chunk_dims[2]; - herr_t ret; - unsigned i; - int fillvalue = 0; /* Fill value for the dataset */ + herr_t ret; + int i; + int fillvalue = 0; /* Fill value for the dataset */ int *matrix_out = NULL; int *matrix_out1 = NULL; /* Buffer to read from the dataset */ @@ -653,7 +653,7 @@ coll_write_test(int chunk_factor) *------------------------------------------------------------------------- */ static void -coll_read_test(int chunk_factor) +coll_read_test(void) { const char *filename; @@ -672,7 +672,7 @@ coll_read_test(int chunk_factor) hsize_t block[2]; /* Block sizes */ herr_t ret; - unsigned i; + int i; int *matrix_out; int *matrix_out1; /* Buffer to read from the dataset */ @@ -1461,38 +1461,40 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_ size_t small_ds_size; size_t small_ds_slice_size; size_t large_ds_size; - size_t large_ds_slice_size; - uint32_t expected_value; - uint32_t * small_ds_buf_0 = NULL; - uint32_t * small_ds_buf_1 = NULL; - uint32_t * large_ds_buf_0 = NULL; - uint32_t * large_ds_buf_1 = NULL; - uint32_t * ptr_0; - uint32_t * ptr_1; - hsize_t small_chunk_dims[LDSCT_DS_RANK]; - hsize_t large_chunk_dims[LDSCT_DS_RANK]; - hsize_t small_dims[LDSCT_DS_RANK]; - hsize_t large_dims[LDSCT_DS_RANK]; - hsize_t start[LDSCT_DS_RANK]; - hsize_t stride[LDSCT_DS_RANK]; - hsize_t count[LDSCT_DS_RANK]; - hsize_t block[LDSCT_DS_RANK]; - hsize_t small_sel_start[LDSCT_DS_RANK]; - hsize_t large_sel_start[LDSCT_DS_RANK]; - hid_t full_mem_small_ds_sid; - hid_t full_file_small_ds_sid; - hid_t mem_small_ds_sid; - hid_t file_small_ds_sid; - hid_t full_mem_large_ds_sid; - hid_t full_file_large_ds_sid; - hid_t mem_large_ds_sid; - hid_t file_large_ds_sid; - hid_t small_ds_dcpl_id = H5P_DEFAULT; - hid_t large_ds_dcpl_id = H5P_DEFAULT; - hid_t small_dataset; /* Dataset ID */ - hid_t large_dataset; /* Dataset ID */ - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ +#if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG + size_t large_ds_slice_size; +#endif + uint32_t expected_value; + uint32_t *small_ds_buf_0 = NULL; + uint32_t *small_ds_buf_1 = NULL; + uint32_t *large_ds_buf_0 = NULL; + uint32_t *large_ds_buf_1 = NULL; + uint32_t *ptr_0; + uint32_t *ptr_1; + hsize_t small_chunk_dims[LDSCT_DS_RANK]; + hsize_t large_chunk_dims[LDSCT_DS_RANK]; + hsize_t small_dims[LDSCT_DS_RANK]; + hsize_t large_dims[LDSCT_DS_RANK]; + hsize_t start[LDSCT_DS_RANK]; + hsize_t stride[LDSCT_DS_RANK]; + hsize_t count[LDSCT_DS_RANK]; + hsize_t block[LDSCT_DS_RANK]; + hsize_t small_sel_start[LDSCT_DS_RANK]; + hsize_t large_sel_start[LDSCT_DS_RANK]; + hid_t full_mem_small_ds_sid; + hid_t full_file_small_ds_sid; + hid_t mem_small_ds_sid; + hid_t file_small_ds_sid; + hid_t full_mem_large_ds_sid; + hid_t full_file_large_ds_sid; + hid_t mem_large_ds_sid; + hid_t file_large_ds_sid; + hid_t small_ds_dcpl_id = H5P_DEFAULT; + hid_t large_ds_dcpl_id = H5P_DEFAULT; + hid_t small_dataset; /* Dataset ID */ + hid_t large_dataset; /* Dataset ID */ + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1512,9 +1514,10 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_ small_ds_size = (size_t)((mpi_size + 1) * 1 * 1 * 10 * 10); small_ds_slice_size = (size_t)(1 * 1 * 10 * 10); large_ds_size = (size_t)((mpi_size + 1) * 10 * 10 * 10 * 10); - large_ds_slice_size = (size_t)(10 * 10 * 10 * 10); #if LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG + large_ds_slice_size = (size_t)(10 * 10 * 10 * 10); + if (mpi_rank == LOWER_DIM_SIZE_COMP_TEST_DEBUG_TARGET_RANK) { HDfprintf(stdout, "%s:%d: small ds size / slice size = %d / %d.\n", fcnName, mpi_rank, (int)small_ds_size, (int)small_ds_slice_size); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 4ca995e..d6b4611 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -4053,7 +4053,7 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex HDmemset(&buffer, 0, sizeof(h5tools_str_t)); for (i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { - void *memref = region_buf + i * nsize; + void *memref = region_buf + (size_t)i * nsize; H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); -- cgit v0.12