diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Adense.c | 3 | ||||
-rw-r--r-- | src/H5C.c | 25 | ||||
-rw-r--r-- | src/H5Cdbg.c | 4 | ||||
-rw-r--r-- | src/H5Cmpio.c | 59 | ||||
-rw-r--r-- | src/H5Dchunk.c | 6 | ||||
-rw-r--r-- | src/H5Dint.c | 2 | ||||
-rw-r--r-- | src/H5Dprivate.h | 2 | ||||
-rw-r--r-- | src/H5FDmpio.c | 34 | ||||
-rw-r--r-- | src/H5Fprivate.h | 9 | ||||
-rw-r--r-- | src/H5Fsuper.c | 9 | ||||
-rw-r--r-- | src/H5HL.c | 2 | ||||
-rw-r--r-- | src/H5O.c | 10 | ||||
-rw-r--r-- | src/H5Odeprec.c | 10 | ||||
-rw-r--r-- | src/H5Odrvinfo.c | 2 | ||||
-rw-r--r-- | src/H5Ofill.c | 2 | ||||
-rw-r--r-- | src/H5Oint.c | 10 | ||||
-rw-r--r-- | src/H5Pfapl.c | 8 | ||||
-rw-r--r-- | src/H5R.c | 2 | ||||
-rw-r--r-- | src/H5Rint.c | 4 | ||||
-rw-r--r-- | src/H5Rpkg.h | 3 | ||||
-rw-r--r-- | src/H5SL.c | 32 | ||||
-rw-r--r-- | src/H5Shyper.c | 33 | ||||
-rw-r--r-- | src/H5Tvlen.c | 36 | ||||
-rw-r--r-- | src/H5mpi.c | 2 | ||||
-rw-r--r-- | src/H5trace.c | 2 |
25 files changed, 129 insertions, 182 deletions
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) @@ -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; @@ -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; @@ -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) @@ -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 */ @@ -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; |