diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-03-04 22:06:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 22:06:47 (GMT) |
commit | 583e9d5c323996ffdcf9534302e865d30f871da4 (patch) | |
tree | 9b1188a9b1784b488aa105748505aeba9f405177 /src | |
parent | 7b23ce1686cf3383bb8666f133cf5fa4f6282096 (diff) | |
download | hdf5-583e9d5c323996ffdcf9534302e865d30f871da4.zip hdf5-583e9d5c323996ffdcf9534302e865d30f871da4.tar.gz hdf5-583e9d5c323996ffdcf9534302e865d30f871da4.tar.bz2 |
1 10 Merges from develop (#424)
* HDFFV-10865 - merge from dev, HDFArray perf fix.
* Remove duplicate setting
* Whitespace changes after clang format
* Undo version 11 clang format changes
* Merge CMake changes from develop
* test testing script merge from develop
* Update supported platforms
* PR#3 merge from develop
* Merge gcc 10 diagnostics option from develop
* Merge #318 OSX changes from develop
* Merge small changes from develop
* Minor non-space formatting changes
* #386 copyright corrections for java folder
* Merges from develop
#358 patches from vtk
#361 fix header guard spelling
* Merge updates
#358 patches from vtk
#361 fix header guard spelling
* format fix
* Fix missing underscore and make H5public.h closer to dev
* Merges from develop
#340 clang -Wformat-security warnings
#360 Fixed uninitialized warnings
header guard underscore cleanup
JNI cleanup
* format alignment
* Add missing test ref file
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B2int.c | 108 | ||||
-rw-r--r-- | src/H5B2leaf.c | 10 | ||||
-rw-r--r-- | src/H5C.c | 6 | ||||
-rw-r--r-- | src/H5Clog_json.c | 2 | ||||
-rw-r--r-- | src/H5Clog_trace.c | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 6 | ||||
-rw-r--r-- | src/H5Dvirtual.c | 8 | ||||
-rw-r--r-- | src/H5EA.c | 3 | ||||
-rw-r--r-- | src/H5FDlog.c | 34 | ||||
-rw-r--r-- | src/H5FDmulti.c | 6 | ||||
-rw-r--r-- | src/H5FDs3comms.c | 6 | ||||
-rw-r--r-- | src/H5FDsplitter.c | 2 | ||||
-rw-r--r-- | src/H5FDstdio.c | 2 | ||||
-rw-r--r-- | src/H5FSsection.c | 4 | ||||
-rw-r--r-- | src/H5HFdbg.c | 8 | ||||
-rw-r--r-- | src/H5HFman.c | 10 | ||||
-rw-r--r-- | src/H5HFsection.c | 2 | ||||
-rw-r--r-- | src/H5HL.c | 4 | ||||
-rw-r--r-- | src/H5MF.c | 416 | ||||
-rw-r--r-- | src/H5Oalloc.c | 4 | ||||
-rw-r--r-- | src/H5Obtreek.c | 2 | ||||
-rw-r--r-- | src/H5Oprivate.h | 14 | ||||
-rw-r--r-- | src/H5Opublic.h | 2 | ||||
-rw-r--r-- | src/H5PB.c | 8 | ||||
-rw-r--r-- | src/H5Pdapl.c | 8 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 2 | ||||
-rw-r--r-- | src/H5Pfapl.c | 6 | ||||
-rw-r--r-- | src/H5SL.c | 20 | ||||
-rw-r--r-- | src/H5Shyper.c | 16 | ||||
-rw-r--r-- | src/H5system.c | 6 | ||||
-rw-r--r-- | src/H5timer.c | 8 | ||||
-rw-r--r-- | src/H5trace.c | 2 |
32 files changed, 369 insertions, 368 deletions
diff --git a/src/H5B2int.c b/src/H5B2int.c index ef90bbf..610da6c 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -138,15 +138,15 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - uint16_t mid_record; /* Index of "middle" record in current node */ - uint16_t old_node_nrec; /* Number of records in internal node split */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + uint16_t mid_record; /* Index of "middle" record in current node */ + uint16_t old_node_nrec; /* Number of records in internal node split */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ @@ -423,13 +423,13 @@ done: herr_t H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ @@ -696,20 +696,20 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned idx) { H5B2_node_ptr_t *left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - haddr_t middle_addr; /* Address of middle child node */ - void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ - void * middle_child = NULL; /* Pointers to middle child node */ - uint16_t * left_nrec, *right_nrec; /* Pointers to child # of records */ - uint16_t * middle_nrec; /* Pointers to middle child # of records */ - uint8_t * left_native, *right_native; /* Pointers to childs' native records */ - uint8_t * middle_native; /* Pointers to middle child's native records */ - hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */ - hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */ - unsigned left_child_flags = H5AC__NO_FLAGS_SET, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + H5B2_node_ptr_t * middle_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */ + void * left_child = NULL, *right_child = NULL; /* Pointers to child nodes */ + void * middle_child = NULL; /* Pointers to middle child node */ + uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */ + uint16_t *middle_nrec; /* Pointers to middle child # of records */ + uint8_t * left_native, *right_native; /* Pointers to childs' native records */ + uint8_t * middle_native; /* Pointers to middle child's native records */ + hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal split */ + hssize_t middle_moved_nrec = 0; /* Number of records moved, for internal split */ + unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1122,16 +1122,16 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ - uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */ - uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - unsigned left_child_flags = H5AC__NO_FLAGS_SET, - right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ + uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */ + uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + unsigned left_child_flags = H5AC__NO_FLAGS_SET, + right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -1297,19 +1297,19 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned *parent_cache_info_flags_ptr, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */ - haddr_t middle_addr; /* Address of middle child node */ - void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ - void * middle_child = NULL; /* Pointer to middle child node */ - uint16_t * left_nrec, *right_nrec; /* Pointers to left & right child # of records */ - uint16_t * middle_nrec; /* Pointer to middle child # of records */ - uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ - uint8_t * middle_native; /* Pointer to middle child's native records */ - H5B2_node_ptr_t * left_node_ptrs = NULL, - *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ - H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */ - hsize_t middle_moved_nrec; /* Number of records moved, for internal split */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t left_addr = HADDR_UNDEF, right_addr = HADDR_UNDEF; /* Addresses of left & right child nodes */ + haddr_t middle_addr = HADDR_UNDEF; /* Address of middle child node */ + void * left_child = NULL, *right_child = NULL; /* Pointers to left & right child nodes */ + void * middle_child = NULL; /* Pointer to middle child node */ + uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */ + uint16_t *middle_nrec; /* Pointer to middle child # of records */ + uint8_t * left_native, *right_native; /* Pointers to left & right children's native records */ + uint8_t * middle_native; /* Pointer to middle child's native records */ + H5B2_node_ptr_t *left_node_ptrs = NULL, + *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */ + H5B2_node_ptr_t *middle_node_ptrs = NULL; /* Pointer to child's node pointer info */ + hsize_t middle_moved_nrec; /* Number of records moved, for internal split */ unsigned left_child_flags = H5AC__NO_FLAGS_SET, right_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ unsigned middle_child_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting child nodes */ @@ -1933,7 +1933,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t /* If the node is in the cache, check for retargeting its parent */ if (node_status & H5AC_ES__IN_CACHE) { - void ** parent_ptr; /* Pointer to child node's parent */ + void ** parent_ptr = NULL; /* Pointer to child node's parent */ hbool_t update_deps = FALSE; /* Whether to update flush dependencies */ /* Get child node pointer */ diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index 199e011..20ace84 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -607,11 +607,11 @@ herr_t H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned *internal_flags_ptr, unsigned idx, void *swap_loc) { - const H5AC_class_t *child_class; /* Pointer to child node's class info */ - haddr_t child_addr; /* Address of child node */ - void * child = NULL; /* Pointer to child node */ - uint8_t * child_native; /* Pointer to child's native records */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5AC_class_t *child_class; /* Pointer to child node's class info */ + haddr_t child_addr = HADDR_UNDEF; /* Address of child node */ + void * child = NULL; /* Pointer to child node */ + uint8_t * child_native; /* Pointer to child's native records */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2140,7 +2140,7 @@ done: * Function: H5C_pin_protected_entry() * * Purpose: Pin a protected cache entry. The entry must be protected - * at the time of call, and must be unpinned. + * at the time of call, and must be unpinned. * * Return: Non-negative on success/Negative on failure * @@ -2226,8 +2226,8 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign #ifdef H5_HAVE_PARALLEL hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ - hbool_t write_permitted; - hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ + hbool_t write_permitted = FALSE; + hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ size_t empty_space; void * thing; H5C_cache_entry_t *entry_ptr; diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 6d048f1..731d741 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -173,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) /* Write the log message and flush */ n_chars = HDstrlen(json_udata->message); - if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message)) + if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 8c79d7b..c30f79e 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -168,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) /* Write the log message and flush */ n_chars = HDstrlen(trace_udata->message); - if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message)) + if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 24cbbc0..c9dad0b 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3146,9 +3146,9 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata) { - H5D_rdcc_ent_t * ent = NULL; /* Cache entry */ - H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); - unsigned idx; /* Index of chunk in cache, if present */ + H5D_rdcc_ent_t * ent = NULL; /* Cache entry */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); + unsigned idx = 0; /* Index of chunk in cache, if present */ hbool_t found = FALSE; /* In cache? */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index c824edf..4519dd7 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -394,8 +394,8 @@ done: * Purpose: Store virtual dataset layout information, for new dataset * * Note: We assume here that the contents of the heap block cannot - * change! If this ever stops being the case we must change - * this code to allow overwrites of the heap block. -NAF + * change! If this ever stops being the case we must change + * this code to allow overwrites of the heap block. -NAF * * Return: Success: SUCCEED * Failure: FAIL @@ -2298,7 +2298,7 @@ done: hbool_t H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) { - hbool_t ret_value; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -2382,7 +2382,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, cons hssize_t select_nelmts; /* Number of elements in selection */ hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */ hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */ - int rank; + int rank = 0; hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */ size_t i, j, k; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ @@ -722,7 +722,8 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5EA_get(const H5EA_t *ea, hsize_t /* Local variables */ H5EA_hdr_t *hdr = ea->hdr; /* Header for EA */ void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ + H5EA__unprotect_func_t thing_unprot_func = + NULL; /* Function pointer for unprotecting the array metadata */ /* * Check arguments. diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 07bd794..4032d3b 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -484,8 +484,8 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_WIN32_API struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - H5_timer_t open_timer; /* Timer for open() call */ - H5_timer_t stat_timer; /* Timer for stat() call */ + H5_timer_t open_timer = {{0}, {0}, {0}, FALSE}; /* Timer for open() call */ + H5_timer_t stat_timer = {{0}, {0}, {0}, FALSE}; /* Timer for stat() call */ h5_stat_t sb; H5FD_t * ret_value = NULL; /* Return value */ @@ -677,9 +677,9 @@ done: static herr_t H5FD__log_close(H5FD_t *_file) { - H5FD_log_t *file = (H5FD_log_t *)_file; - H5_timer_t close_timer; /* Timer for close() call */ - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_log_t *file = (H5FD_log_t *)_file; + H5_timer_t close_timer = {{0}, {0}, {0}, FALSE}; /* Timer for close() call */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -1166,11 +1166,11 @@ static herr_t H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf /*out*/) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t read_timer; /* Timer for read operation */ - H5_timevals_t read_times; /* Elapsed time for read operation */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t read_timer = {{0}, {0}, {0}, FALSE}; /* Timer for read operation */ + H5_timevals_t read_times; /* Elapsed time for read operation */ #ifndef H5_HAVE_PREADWRITE H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ @@ -1380,11 +1380,11 @@ static herr_t H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_log_t * file = (H5FD_log_t *)_file; - size_t orig_size = size; /* Save the original size for later */ - haddr_t orig_addr = addr; - H5_timer_t write_timer; /* Timer for write operation */ - H5_timevals_t write_times; /* Elapsed time for write operation */ + H5FD_log_t * file = (H5FD_log_t *)_file; + size_t orig_size = size; /* Save the original size for later */ + haddr_t orig_addr = addr; + H5_timer_t write_timer = {{0}, {0}, {0}, FALSE}; /* Timer for write operation */ + H5_timevals_t write_times; /* Elapsed time for write operation */ #ifndef H5_HAVE_PREADWRITE H5_timer_t seek_timer; /* Timer for seek operation */ H5_timevals_t seek_times; /* Elapsed time for seek operation */ @@ -1604,8 +1604,8 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Extend the file to make sure it's large enough */ if (!H5F_addr_eq(file->eoa, file->eof)) { - H5_timer_t trunc_timer; /* Timer for truncate operation */ - H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ + H5_timer_t trunc_timer = {{0}, {0}, {0}, FALSE}; /* Timer for truncate operation */ + H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ /* Start timer for truncate operation */ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) { diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index c96b595..68440d0 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1822,8 +1822,8 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) { H5FD_multi_t * file = (H5FD_multi_t *)_file; int nerrors = 0; - H5FD_mem_t out_mt; - static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */ + H5FD_mem_t out_mt = H5FD_MEM_DEFAULT; + static const char *func = "H5FD_multi_unlock"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -2002,7 +2002,7 @@ open_members(H5FD_multi_t *file) } H5_GCC_DIAG_ON("format-nonliteral") -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 1f23a68..4b39365 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1964,7 +1964,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha buffer[buffer_i] = 0; /* collect a line from file */ - line_buffer = fgets(line_buffer, 128, file); + line_buffer = HDfgets(line_buffer, 128, file); if (line_buffer == NULL) goto done; /* end of file */ @@ -2063,9 +2063,9 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * #endif #ifdef H5_HAVE_WIN32_API - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE")); #else - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); #endif if (ret < 0 || (size_t)ret >= 117) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index f093262..84edc13 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -210,7 +210,7 @@ H5FD_splitter_init(void) { hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) H5FD_SPLITTER_LOG_CALL(FUNC); diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index efc1802..b395127 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -1201,7 +1201,7 @@ H5FD_stdio_unlock(H5FD_t *_file) return 0; } /* end H5FD_stdio_unlock() */ -#ifdef _H5private_H +#ifdef H5private_H /* * This is not related to the functionality of the driver code. * It is added here to trigger warning if HDF5 private definitions are included diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 2af0baa..f18f0f9 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -1115,8 +1115,8 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) /* Loop until no more merging */ if (fspace->sinfo->merge_list) { do { - H5SL_node_t * less_sect_node; /* Skip list node for section less than new section */ - H5SL_node_t * greater_sect_node; /* Skip list node for section greater than new section */ + H5SL_node_t *less_sect_node; /* Skip list node for section less than new section */ + H5SL_node_t *greater_sect_node = NULL; /* Skip list node for section greater than new section */ H5FS_section_info_t * tmp_sect; /* Temporary free space section */ H5FS_section_class_t *tmp_sect_cls; /* Temporary section's class */ hbool_t greater_sect_node_valid = FALSE; /* Indicate if 'greater than' section node is valid */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index f7fde6f..60fff22 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -684,10 +684,10 @@ herr_t H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, haddr_t hdr_addr, unsigned nrows) { - H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */ - H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ - hbool_t did_protect; /* Whether we protected the indirect block or not */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HF_hdr_t * hdr = NULL; /* Fractal heap header info */ + H5HF_indirect_t *iblock = NULL; /* Fractal heap direct block info */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5HFman.c b/src/H5HFman.c index f978d7c..d26c145 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -297,9 +297,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * * H5AC__NO_FLAGS_SET or * H5AC__READ_ONLY_FLAG */ - haddr_t dblock_addr; /* Direct block address */ + haddr_t dblock_addr = HADDR_UNDEF; /* Direct block address */ size_t dblock_size; /* Direct block size */ - unsigned dblock_cache_flags; /* Flags for unprotecting direct block */ + unsigned dblock_cache_flags = 0; /* Flags for unprotecting direct block */ hsize_t obj_off; /* Object's offset in heap */ size_t obj_len; /* Object's length in heap */ size_t blk_off; /* Offset of object in block */ @@ -545,9 +545,9 @@ done: herr_t H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) { - H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */ - H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */ - hbool_t did_protect; /* Whether we protected the indirect block or not */ + H5HF_free_section_t *sec_node = NULL; /* Pointer to free space section for block */ + H5HF_indirect_t * iblock = NULL; /* Pointer to indirect block */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ hsize_t obj_off; /* Object's offset in heap */ size_t obj_len; /* Object's length in heap */ size_t dblock_size; /* Direct block size */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index c33f09f..ffd3a18 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -2474,7 +2474,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* Add an indirect section for each indirect block in the row */ for (v = 0; v < row_entries; v++) { - hbool_t did_protect; /* Whether we protected the indirect block or not */ + hbool_t did_protect = FALSE; /* Whether we protected the indirect block or not */ /* Try to get the child section's indirect block, if it's available */ if (sect->sect_info.state == H5FS_SECT_LIVE) { @@ -930,7 +930,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_get_size(H5F_t *f, haddr_t add H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap; /* Heap data structure */ + H5HL_t * heap = NULL; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -977,7 +977,7 @@ BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL, H5HL_heapsize(H5F_t *f, haddr_t add H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */ H5HL_prfx_t * prfx = NULL; /* Local heap prefix */ - H5HL_t * heap; /* Heap data structure */ + H5HL_t * heap = NULL; /* Heap data structure */ /* check arguments */ HDassert(f); @@ -26,20 +26,20 @@ /* Module Setup */ /****************/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ -#define H5FS_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5FS_FRIEND /*suppress error about including H5Fpkg */ #include "H5MFmodule.h" /* This source code file is part of the H5MF module */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ #include "H5FSpkg.h" /* File free space */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MFpkg.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFpkg.h" /* File memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ @@ -122,7 +122,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * Purpose: Initialize the free space section+aggregator merge flags * for the file. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Friday, February 1, 2008 @@ -274,17 +274,17 @@ H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_pa } /* end H5MF__alloc_to_fs_type() */ /*------------------------------------------------------------------------- - * Function: H5MF__open_fstype + * Function: H5MF__open_fstype * - * Purpose: Open an existing free space manager of TYPE for file by + * Purpose: Open an existing free space manager of TYPE for file by * creating a free-space structure. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -351,17 +351,17 @@ done: } /* end H5MF__open_fstype() */ /*------------------------------------------------------------------------- - * Function: H5MF__create_fstype + * Function: H5MF__create_fstype * - * Purpose: Create free space manager of TYPE for the file by creating + * Purpose: Create free space manager of TYPE for the file by creating * a free-space structure * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -435,16 +435,16 @@ done: } /* end H5MF__create_fstype() */ /*------------------------------------------------------------------------- - * Function: H5MF__start_fstype + * Function: H5MF__start_fstype * - * Purpose: Open or create a free space manager of a given TYPE. + * Purpose: Open or create a free space manager of a given TYPE. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 + * Programmer: Quincey Koziol + * Jan 8 2008 * *------------------------------------------------------------------------- */ @@ -492,7 +492,7 @@ done: * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; April 2013 + * Programmer: Vailin Choi; April 2013 * *------------------------------------------------------------------------- */ @@ -603,7 +603,7 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__add_sect * - * Purpose: To add a section to the specified free-space manager. + * Purpose: To add a section to the specified free-space manager. * * Return: Success: non-negative * Failure: negative @@ -661,11 +661,11 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__find_sect * - * Purpose: To find a section from the specified free-space manager to fulfill the request. - * If found, re-add the left-over space back to the manager. + * Purpose: To find a section from the specified free-space manager to fulfill the request. + * If found, re-add the left-over space back to the manager. * - * Return: TRUE if a section is found to fulfill the request - * FALSE if not + * Return: TRUE if a section is found to fulfill the request + * FALSE if not * * Programmer: Vailin Choi; April 2013 * @@ -745,9 +745,9 @@ done: * Function: H5MF_alloc * * Purpose: Allocate SIZE bytes of file memory and return the relative - * address where that contiguous chunk of file memory exists. - * The TYPE argument describes the purpose for which the storage - * is being requested. + * address where that contiguous chunk of file memory exists. + * The TYPE argument describes the purpose for which the storage + * is being requested. * * Return: Success: The file address of new chunk. * Failure: HADDR_UNDEF @@ -1002,15 +1002,15 @@ done: * * Purpose: Allocate temporary space in the file * - * Note: The address returned is non-overlapping with any other address - * in the file and suitable for insertion into the metadata - * cache. + * Note: The address returned is non-overlapping with any other address + * in the file and suitable for insertion into the metadata + * cache. * - * The address is _not_ suitable for actual file I/O and will - * cause an error if it is so used. + * The address is _not_ suitable for actual file I/O and will + * cause an error if it is so used. * - * The space allocated with this routine should _not_ be freed, - * it should just be abandoned. Calling H5MF_xfree() with space + * The space allocated with this routine should _not_ be freed, + * it should just be abandoned. Calling H5MF_xfree() with space * from this routine will cause an error. * * Return: Success: Temporary file address @@ -1244,9 +1244,9 @@ done: } /* end H5MF_xfree() */ /*------------------------------------------------------------------------- - * Function: H5MF_try_extend + * Function: H5MF_try_extend * - * Purpose: Extend a block in the file if possible. + * Purpose: Extend a block in the file if possible. * For non-paged aggregation: * --try to extend at EOA * --try to extend into the aggregators @@ -1256,11 +1256,11 @@ done: * --try to extend into a free-space section if adjoined * --try to extend into the page end threshold if a metadata block * - * Return: Success: TRUE(1) - Block was extended + * Return: Success: TRUE(1) - Block was extended * FALSE(0) - Block could not be extended - * Failure: FAIL + * Failure: FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 11, 2004 * *------------------------------------------------------------------------- @@ -1528,7 +1528,7 @@ done: * Purpose: Close the free space tracker(s) for a file: * paged or non-paged aggregation * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; Dec 2012 * @@ -1571,9 +1571,9 @@ done: * of TYPE for file. * Note that TYPE can be H5F_mem_page_t or H5FD_mem_t enum types. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Jan 2016 * *------------------------------------------------------------------------- @@ -1630,9 +1630,9 @@ done: * free-space managers when downgrading persistent free-space * to non-persistent. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Jan 2016 * *------------------------------------------------------------------------- @@ -2087,7 +2087,7 @@ done: * * Purpose: Shrink the EOA while closing * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Saturday, July 7, 2012 @@ -2338,7 +2338,7 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_get_free_sections() * - * Purpose: To retrieve free-space section information for + * Purpose: To retrieve free-space section information for * paged or non-paged aggregation * * Return: Success: Number of free sections @@ -2468,10 +2468,10 @@ done: /*------------------------------------------------------------------------- * Function: H5MF__sects_cb() * - * Purpose: Iterator callback for each free-space section + * Purpose: Iterator callback for each free-space section * Retrieve address and size into user data * - * Return: Always succeed + * Return: Always succeed * * Programmer: Vailin Choi * July 1st, 2009 @@ -2498,7 +2498,7 @@ H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata) /*------------------------------------------------------------------------- * Function: H5MF__get_free_sects * - * Purpose: Retrieve section information for the specified free-space manager. + * Purpose: Retrieve section information for the specified free-space manager. * * Return: Success: non-negative * Failure: negative @@ -2539,10 +2539,10 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_settle_raw_data_fsm() * - * Purpose: Handle any tasks required before the metadata cache - * can serialize or flush the raw data free space manager - * and any metadata free space managers that reside in the - * raw data free space manager ring. + * Purpose: Handle any tasks required before the metadata cache + * can serialize or flush the raw data free space manager + * and any metadata free space managers that reside in the + * raw data free space manager ring. * * Specifically, this means any metadata managers that DON'T * handle space allocation for free space manager header or @@ -2550,25 +2550,25 @@ done: * ring. * * In the absence of page allocation, there is at most one - * free space manager per memory type defined in H5F_mem_t. - * Of these, the one that allocates H5FD_MEM_DRAW will - * always reside in the raw data free space manager ring. - * If there is more than one metadata free space manager, - * all that don't handle H5FD_MEM_FSPACE_HDR or + * free space manager per memory type defined in H5F_mem_t. + * Of these, the one that allocates H5FD_MEM_DRAW will + * always reside in the raw data free space manager ring. + * If there is more than one metadata free space manager, + * all that don't handle H5FD_MEM_FSPACE_HDR or * H5FD_MEM_FSPACE_SINFO (which map to H5FD_MEM_OHDR and * H5FD_MEM_LHEAP respectively) will reside in the raw - * data free space manager ring as well + * data free space manager ring as well * - * With page allocation, the situation is conceptually - * identical, but more complex in practice. + * With page allocation, the situation is conceptually + * identical, but more complex in practice. * * In the worst case (multi file driver) page allocation - * can result in two free space managers for each memory - * type -- one for small (less than on equal to one page) + * can result in two free space managers for each memory + * type -- one for small (less than on equal to one page) * allocations, and one for large (greater than one page) * allocations. * - * In the more common one file case, page allocation will + * In the more common one file case, page allocation will * result in a total of three free space managers -- one for * small (<= one page) raw data allocations, one for small * metadata allocations (i.e, all memory types other than @@ -2576,64 +2576,64 @@ done: * allocations. * * Despite these complications, the solution is the same in - * the page allocation case -- free space managers (be they + * the page allocation case -- free space managers (be they * small data or large) are assigned to the raw data free * space manager ring if they don't allocate file space for * free space managers. Note that in the one file case, the - * large free space manager must be assigned to the metadata - * free space manager ring, as it both allocates pages for - * the metadata free space manager, and allocates space for - * large (> 1 page) metadata cache entries. + * large free space manager must be assigned to the metadata + * free space manager ring, as it both allocates pages for + * the metadata free space manager, and allocates space for + * large (> 1 page) metadata cache entries. * * At present, the task list for this routine is: * - * 1) Reduce the EOA to the extent possible. To do this: + * 1) Reduce the EOA to the extent possible. To do this: * - * a) Free both aggregators. Space not at EOA will be - * added to the appropriate free space manager. + * a) Free both aggregators. Space not at EOA will be + * added to the appropriate free space manager. * - * The raw data aggregator should not be restarted - * after this point. It is possible that the metadata - * aggregator will be. + * The raw data aggregator should not be restarted + * after this point. It is possible that the metadata + * aggregator will be. * - * b) Free all file space currently allocated to free - * space managers. + * b) Free all file space currently allocated to free + * space managers. * - * c) Delete the free space manager superblock - * extension message if allocated. + * c) Delete the free space manager superblock + * extension message if allocated. * - * This done, reduce the EOA by moving it to just before - * the last piece of free memory in the file. + * This done, reduce the EOA by moving it to just before + * the last piece of free memory in the file. * - * 2) Ensure that space is allocated for the free space + * 2) Ensure that space is allocated for the free space * manager superblock extension message. Must do this * now, before reallocating file space for free space - * managers, as it is possible that this allocation may - * grab the last section in a FSM -- making it unnecessary - * to re-allocate file space for it. - * - * 3) Scan all free space managers not involved in allocating - * space for free space managers. For each such free space - * manager, test to see if it contains free space. If - * it does, allocate file space for its header and section - * data. If it contains no free space, leave it without - * allocated file space as there is no need to save it to - * file. - * - * Note that all free space managers in this class should - * see no further space allocations / deallocations as - * at this point, all raw data allocations should be - * finalized, as should all metadata allocations not - * involving free space managers. - * - * We will allocate space for free space managers involved - * in the allocation of file space for free space managers - * in H5MF_settle_meta_data_fsm() - * - * Return: SUCCEED/FAIL + * managers, as it is possible that this allocation may + * grab the last section in a FSM -- making it unnecessary + * to re-allocate file space for it. + * + * 3) Scan all free space managers not involved in allocating + * space for free space managers. For each such free space + * manager, test to see if it contains free space. If + * it does, allocate file space for its header and section + * data. If it contains no free space, leave it without + * allocated file space as there is no need to save it to + * file. + * + * Note that all free space managers in this class should + * see no further space allocations / deallocations as + * at this point, all raw data allocations should be + * finalized, as should all metadata allocations not + * involving free space managers. + * + * We will allocate space for free space managers involved + * in the allocation of file space for free space managers + * in H5MF_settle_meta_data_fsm() + * + * Return: SUCCEED/FAIL * * Programmer: John Mainzer - * 5/25/16 + * 5/25/16 * *------------------------------------------------------------------------- */ @@ -3012,122 +3012,122 @@ done: /*------------------------------------------------------------------------- * Function: H5MF_settle_meta_data_fsm() * - * Purpose: If the free space manager is persistent, handle any tasks - * required before the metadata cache can serialize or flush - * the metadata free space manager(s) that handle file space - * allocation for free space managers. + * Purpose: If the free space manager is persistent, handle any tasks + * required before the metadata cache can serialize or flush + * the metadata free space manager(s) that handle file space + * allocation for free space managers. * - * In most cases, there will be only one manager assigned - * to this role. However, since for reasons unknown, - * free space manager headers and section info blocks are - * different classes of memory, it is possible that two free - * space managers will be involved. + * In most cases, there will be only one manager assigned + * to this role. However, since for reasons unknown, + * free space manager headers and section info blocks are + * different classes of memory, it is possible that two free + * space managers will be involved. * - * On entry to this function, the raw data settle routine - * (H5MF_settle_raw_data_fsm()) should have: + * On entry to this function, the raw data settle routine + * (H5MF_settle_raw_data_fsm()) should have: * - * 1) Freed the aggregators. + * 1) Freed the aggregators. * - * 2) Freed all file space allocated to the free space managers. + * 2) Freed all file space allocated to the free space managers. * - * 3) Deleted the free space manager superblock extension message + * 3) Deleted the free space manager superblock extension message * - * 4) Reduced the EOA to the extent possible. + * 4) Reduced the EOA to the extent possible. * - * 5) Re-created the free space manager superblock extension - * message. + * 5) Re-created the free space manager superblock extension + * message. * - * 6) Reallocated file space for all non-empty free space - * managers NOT involved in allocation of space for free - * space managers. + * 6) Reallocated file space for all non-empty free space + * managers NOT involved in allocation of space for free + * space managers. * - * Note that these free space managers (if not empty) should - * have been written to file by this point, and that no - * further space allocations involving them should take - * place during file close. + * Note that these free space managers (if not empty) should + * have been written to file by this point, and that no + * further space allocations involving them should take + * place during file close. * - * On entry to this routine, the free space manager(s) involved - * in allocation of file space for free space managers should - * still be floating. (i.e. should not have any file space - * allocated to them.) + * On entry to this routine, the free space manager(s) involved + * in allocation of file space for free space managers should + * still be floating. (i.e. should not have any file space + * allocated to them.) * - * Similarly, the raw data aggregator should not have been - * restarted. Note that it is probable that reallocation of - * space in 5) and 6) above will have re-started the metadata - * aggregator. + * Similarly, the raw data aggregator should not have been + * restarted. Note that it is probable that reallocation of + * space in 5) and 6) above will have re-started the metadata + * aggregator. * * - * In this routine, we proceed as follows: + * In this routine, we proceed as follows: * - * 1) Verify that the free space manager(s) involved in file - * space allocation for free space managers are still floating. + * 1) Verify that the free space manager(s) involved in file + * space allocation for free space managers are still floating. * - * 2) Free the aggregators. + * 2) Free the aggregators. * - * 3) Reduce the EOA to the extent possible, and make note - * of the resulting value. This value will be stored - * in the fsinfo superblock extension message and be used - * in the subsequent file open. + * 3) Reduce the EOA to the extent possible, and make note + * of the resulting value. This value will be stored + * in the fsinfo superblock extension message and be used + * in the subsequent file open. * - * 4) Re-allocate space for any free space manager(s) that: + * 4) Re-allocate space for any free space manager(s) that: * - * a) are involved in allocation of space for free space - * managers, and + * a) are involved in allocation of space for free space + * managers, and * - * b) contain free space. + * b) contain free space. * - * It is possible that we could allocate space for one - * of these free space manager(s) only to have the allocation - * result in the free space manager being empty and thus - * obliging us to free the space again. Thus there is the - * potential for an infinite loop if we want to avoid saving - * empty free space managers. + * It is possible that we could allocate space for one + * of these free space manager(s) only to have the allocation + * result in the free space manager being empty and thus + * obliging us to free the space again. Thus there is the + * potential for an infinite loop if we want to avoid saving + * empty free space managers. * - * Similarly, it is possible that we could allocate space - * for a section info block, only to discover that this - * allocation has changed the size of the section info -- - * forcing us to deallocate and start the loop over again. + * Similarly, it is possible that we could allocate space + * for a section info block, only to discover that this + * allocation has changed the size of the section info -- + * forcing us to deallocate and start the loop over again. * - * To avoid this, simply allocate file space for these - * FSM(s) directly from the VFD layer if allocation is - * indicated. This avoids the issue by bypassing the FSMs - * in this case. + * To avoid this, simply allocate file space for these + * FSM(s) directly from the VFD layer if allocation is + * indicated. This avoids the issue by bypassing the FSMs + * in this case. * - * Note that this may increase the size of the file needlessly. - * A better solution would be to modify the FSM code to - * save empty FSMs to file, and to allow section info blocks - * to be oversized. However, given that the FSM code is - * also used by the fractal heaps, and that we are under - * severe time pressure at the moment, the above brute - * force solution is attractive. + * Note that this may increase the size of the file needlessly. + * A better solution would be to modify the FSM code to + * save empty FSMs to file, and to allow section info blocks + * to be oversized. However, given that the FSM code is + * also used by the fractal heaps, and that we are under + * severe time pressure at the moment, the above brute + * force solution is attractive. * - * 5) Make note of the EOA -- used for sanity checking on - * FSM shutdown. + * 5) Make note of the EOA -- used for sanity checking on + * FSM shutdown. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * * Programmer: John Mainzer - * 5/25/16 + * 5/25/16 * *------------------------------------------------------------------------- */ herr_t H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) { - H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */ - H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */ - H5F_mem_page_t lg_fshdr_fs_type; /* large fs hdr fsm */ - H5F_mem_page_t lg_fssinfo_fs_type; /* large fs sinfo fsm */ - H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */ - H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */ - H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */ - H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */ - haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ - /* for self referential FSMs */ - haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ - /* for self referential FSMs */ - H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - herr_t ret_value = SUCCEED; /* Return value */ + H5F_mem_page_t sm_fshdr_fs_type; /* small fs hdr fsm */ + H5F_mem_page_t sm_fssinfo_fs_type; /* small fs sinfo fsm */ + H5F_mem_page_t lg_fshdr_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs hdr fsm */ + H5F_mem_page_t lg_fssinfo_fs_type = H5F_MEM_PAGE_DEFAULT; /* large fs sinfo fsm */ + H5FS_t * sm_hdr_fspace = NULL; /* ptr to sm FSM hdr alloc FSM */ + H5FS_t * sm_sinfo_fspace = NULL; /* ptr to sm FSM sinfo alloc FSM */ + H5FS_t * lg_hdr_fspace = NULL; /* ptr to lg FSM hdr alloc FSM */ + H5FS_t * lg_sinfo_fspace = NULL; /* ptr to lg FSM sinfo alloc FSM */ + haddr_t eoa_pre_fsm_fsalloc; /* eoa pre file space allocation */ + /* for self referential FSMs */ + haddr_t eoa_post_fsm_fsalloc; /* eoa post file space allocation */ + /* for self referential FSMs */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -3393,7 +3393,7 @@ done: * Function: H5MF__fsm_type_is_self_referential() * * Purpose: Return TRUE if the indicated free space manager allocates - * file space for free space managers. Return FALSE otherwise. + * file space for free space managers. Return FALSE otherwise. * * Return: TRUE/FALSE * @@ -3449,7 +3449,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) * Function: H5MF__fsm_is_self_referential() * * Purpose: Return TRUE if the indicated free space manager allocates - * file space for free space managers. Return FALSE otherwise. + * file space for free space managers. Return FALSE otherwise. * * Return: TRUE/FALSE * @@ -3496,15 +3496,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) * Function: H5MF_tidy_self_referential_fsm_hack * * Purpose: As discussed in the comments of the settle routines above, - * the existence of self referential free space managers - * as currently implemented creates the possibility of - * infinite loops at file close. + * the existence of self referential free space managers + * as currently implemented creates the possibility of + * infinite loops at file close. * - * As a hack to avoid this, we have added code to settle - * self referential free space managers, and then allocate - * space for them directly from the file driver. + * As a hack to avoid this, we have added code to settle + * self referential free space managers, and then allocate + * space for them directly from the file driver. * - * To avoid dropping ever increasing amounts of file space + * To avoid dropping ever increasing amounts of file space * on the floor with each subsequent file close/open cycle, * we need to clean this up on file open. To avoid this, * this function is called on the first file space allocation @@ -3541,7 +3541,7 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) * and then set f->shared->eoa_pre_fsm_fsalloc to * HADDR_UNDEF. * - * If page buffering, verify that the new EOA is + * If page buffering, verify that the new EOA is * on a page boundary, and expunge any pages in the * page buffer after the new EOA. * diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index a93506a..f7da32a 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -2005,8 +2005,8 @@ H5O_merge_null(H5F_t *f, H5O_t *oh) for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) { if (u != v && H5O_NULL_ID == curr_msg2->type->id && curr_msg->chunkno == curr_msg2->chunkno) { - ssize_t adj_raw; /* Amount to adjust raw message pointer */ - size_t adj_raw_size; /* Amount to adjust raw message size */ + ssize_t adj_raw = 0; /* Amount to adjust raw message pointer */ + size_t adj_raw_size = 0; /* Amount to adjust raw message size */ /* Check for second message after first message */ if ((curr_msg->raw + curr_msg->raw_size) == diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c index c8e0365..4eee322 100644 --- a/src/H5Obtreek.c +++ b/src/H5Obtreek.c @@ -198,7 +198,7 @@ static size_t H5O_btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value; + size_t ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a0b7763..3367231 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -29,21 +29,21 @@ typedef struct H5O_t H5O_t; typedef struct H5O_fill_t H5O_fill_t; /* Include the public header file for this API */ -#include "H5Opublic.h" /* Object header functions */ +#include "H5Opublic.h" /* Object header functions */ /* Public headers needed by this file */ -#include "H5Dpublic.h" /* Dataset functions */ -#include "H5Lpublic.h" /* Link functions */ +#include "H5Dpublic.h" /* Dataset functions */ +#include "H5Lpublic.h" /* Link functions */ #include "H5Spublic.h" /* Dataspace functions */ /* Private headers needed by this file */ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ -#include "H5HGprivate.h" /* Global Heaps */ +#include "H5HGprivate.h" /* Global Heaps */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatype functions */ -#include "H5Zprivate.h" /* I/O pipeline filters */ +#include "H5Zprivate.h" /* I/O pipeline filters */ /* Forward references of package typedefs */ typedef struct H5O_msg_class_t H5O_msg_class_t; diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 249479b..b8cd940 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -95,7 +95,7 @@ /* Types of objects in file */ typedef enum H5O_type_t { H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ - H5O_TYPE_GROUP, /* Object is a group */ + H5O_TYPE_GROUP, /* Object is a group */ H5O_TYPE_DATASET, /* Object is a dataset */ H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ @@ -682,8 +682,8 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * haddr_t offset; haddr_t search_addr; /* Address of current page */ hsize_t num_touched_pages; /* Number of pages accessed */ - size_t access_size; - hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ + size_t access_size = 0; + hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ hsize_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -983,8 +983,8 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const haddr_t offset; haddr_t search_addr; /* Address of current page */ hsize_t num_touched_pages; /* Number of pages accessed */ - size_t access_size; - hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ + size_t access_size = 0; + hbool_t bypass_pb = FALSE; /* Whether to bypass page buffering */ hsize_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 7333ddf..0ef1519 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -865,8 +865,8 @@ done: static herr_t H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ FUNC_ENTER_STATIC_NOERR @@ -965,8 +965,8 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) static herr_t H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) { - uint64_t enc_value; /* Property value to encode */ - uint8_t **pp = (uint8_t **)_pp; + uint64_t enc_value = 0; /* Property value to encode */ + uint8_t **pp = (uint8_t **)_pp; unsigned enc_size; /* Size of encoded property */ FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 51a311c..e07d6e7 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2215,7 +2215,7 @@ herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const char *src_dset_name, hid_t src_space_id) { - H5P_genplist_t * plist; /* Property list pointer */ + H5P_genplist_t * plist = NULL; /* Property list pointer */ H5O_layout_t virtual_layout; /* Layout information for setting virtual info */ H5S_t * vspace; /* Virtual dataset space selection */ H5S_t * src_space; /* Source dataset space selection */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7268647..1a69c10 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -4304,9 +4304,9 @@ herr_t H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, size_t *location_size, hbool_t *start_on_access) { - H5P_genplist_t *plist; /* Property list pointer */ - char * location_ptr; /* Pointer to location string */ - herr_t ret_value = SUCCEED; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + char * location_ptr = NULL; /* Pointer to location string */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE5("e", "i*b*s*z*b", plist_id, is_enabled, location, location_size, start_on_access); @@ -746,10 +746,10 @@ done: static H5SL_node_t * H5SL_insert_common(H5SL_t *slist, void *item, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - H5SL_node_t *prev; /* Node before the new node */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + H5SL_node_t *prev; /* Node before the new node */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1378,9 +1378,9 @@ done: void * H5SL_search(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - void * ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1676,9 +1676,9 @@ done: H5SL_node_t * H5SL_find(H5SL_t *slist, const void *key) { - H5SL_node_t *x; /* Current node to examine */ - uint32_t hashval = 0; /* Hash value for key */ - H5SL_node_t *ret_value; /* Return value */ + H5SL_node_t *x; /* Current node to examine */ + uint32_t hashval = 0; /* Hash value for key */ + H5SL_node_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 5450408..d9afff7 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1102,10 +1102,10 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; @@ -1294,10 +1294,10 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) } /* end if */ /* Must be an irregular hyperslab selection */ else { - H5S_hyper_span_t * curr_span; /* Current hyperslab span node */ - H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hsize_t * abs_arr; /* Absolute hyperslab span position */ - int curr_dim; /* Temporary rank holder */ + H5S_hyper_span_t * curr_span = NULL; /* Current hyperslab span node */ + H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ + hsize_t * abs_arr; /* Absolute hyperslab span position */ + int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ ndims = iter->rank; diff --git a/src/H5system.c b/src/H5system.c index 9780428..38a6930 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -698,8 +698,8 @@ H5_make_time(struct tm *tm) * VS 2015 is removed, with _get_timezone replacing it. */ long timezone = 0; -#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ - time_t ret_value; /* Return value */ +#endif /* defined(H5_HAVE_VISUAL_STUDIO) && (_MSC_VER >= 1900) */ + time_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1337,7 +1337,7 @@ done: herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) { - size_t path1_len; /* length of path1 */ + size_t path1_len = 0; /* length of path1 */ size_t path2_len; /* length of path2 */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5timer.c b/src/H5timer.c index 08e4404..ac3a01e 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -582,10 +582,10 @@ H5_timer_get_time_string(double seconds) char *s; /* output string */ /* Used when the time is greater than 59 seconds */ - double days; - double hours; - double minutes; - double remainder_sec; + double days = 0.0; + double hours = 0.0; + double minutes = 0.0; + double remainder_sec = 0.0; /* Extract larger time units from count of seconds */ if (seconds > (double)60.0F) { diff --git a/src/H5trace.c b/src/H5trace.c index bfc1b52..83455d9 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -117,7 +117,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) void * vp = NULL; FILE * out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer; + H5_timer_t function_timer = {{0}, {0}, {0}, FALSE}; H5_timevals_t function_times; static H5_timer_t running_timer; H5_timevals_t running_times; |