summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-07-11 17:27:40 (GMT)
committerGitHub <noreply@github.com>2022-07-11 17:27:40 (GMT)
commit0412d3f292b255da700d865fd1eb990e05c038bb (patch)
tree1d4ad4ab8d32b0452a30abae4c52ebd9fed17f43 /src
parentfa7caf843508b250f085e88cf5edfc2606da1205 (diff)
downloadhdf5-0412d3f292b255da700d865fd1eb990e05c038bb.zip
hdf5-0412d3f292b255da700d865fd1eb990e05c038bb.tar.gz
hdf5-0412d3f292b255da700d865fd1eb990e05c038bb.tar.bz2
Fixes for production mode gcc warnings (#1873)
* Fixes for production mode gcc warnings With the strict-overflow changes, this brings the number of warnings in the C library w/ gcc 12 to zero. * Fix typo * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5Dchunk.c5
-rw-r--r--src/H5FL.c3
-rw-r--r--src/H5HLcache.c2
-rw-r--r--src/H5L.c17
-rw-r--r--src/H5Shyper.c16
5 files changed, 28 insertions, 15 deletions
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 2075498..6a89a99 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -6527,8 +6527,11 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
} /* end if */
if (udata->chunk_in_cache) {
+
+ if (NULL == ent)
+ HGOTO_ERROR(H5E_IO, H5E_BADVALUE, H5_ITER_ERROR, "NULL chunk entry pointer")
+
HDassert(H5F_addr_defined(chunk_rec->chunk_addr));
- HDassert(ent);
HDassert(H5F_addr_defined(ent->chunk_block.offset));
H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t);
diff --git a/src/H5FL.c b/src/H5FL.c
index 403b389..285729c 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -1047,7 +1047,8 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
if (NULL == (free_list = H5FL__blk_find_list(&(head->head), free_size)))
/* No free list available, create a new list node and insert it to the queue */
free_list = H5FL__blk_create_list(&(head->head), free_size);
- HDassert(free_list);
+ if (NULL == free_list)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't create new list node")
/* Prepend the free'd native block to the front of the free list */
temp->next = free_list->list; /* Note: Overwrites the size field in union */
diff --git a/src/H5HLcache.c b/src/H5HLcache.c
index 7f4fba7..c625088 100644
--- a/src/H5HLcache.c
+++ b/src/H5HLcache.c
@@ -361,6 +361,8 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG
HDassert(actual_len);
HDassert(*actual_len == image_len);
+ HDmemset(&heap, 0, sizeof(H5HL_t));
+
/* Deserialize the heap's header */
if (H5HL__hdr_deserialize(&heap, (const uint8_t *)image, udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode local heap header")
diff --git a/src/H5L.c b/src/H5L.c
index a6a73a5..41f2dbb 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -95,8 +95,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
hid_t lapl_id)
{
H5VL_object_t * vol_obj1 = NULL; /* Object of src_id */
- H5VL_loc_params_t loc_params1;
H5VL_object_t * vol_obj2 = NULL; /* Object of dst_id */
+ H5VL_loc_params_t loc_params1;
H5VL_loc_params_t loc_params2;
H5VL_object_t tmp_vol_obj; /* Temporary object */
herr_t ret_value = SUCCEED; /* Return value */
@@ -157,19 +157,20 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
- } /* end if */
+ }
/* Construct a temporary source VOL object */
if (vol_obj1) {
tmp_vol_obj.connector = vol_obj1->connector;
tmp_vol_obj.data = vol_obj1->data;
- } /* end if */
+ }
else {
- HDassert(vol_obj2);
+ if (NULL == vol_obj2)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object")
tmp_vol_obj.connector = vol_obj2->connector;
tmp_vol_obj.data = NULL;
- } /* end else */
+ }
/* Move the link */
if (H5VL_link_move(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id,
@@ -269,7 +270,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
tmp_vol_obj.data = vol_obj1->data;
} /* end if */
else {
- HDassert(vol_obj2);
+ if (NULL == vol_obj2)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer")
tmp_vol_obj.connector = vol_obj2->connector;
tmp_vol_obj.data = NULL;
@@ -505,7 +507,8 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l
if (curr_vol_obj)
(*tmp_vol_obj_ptr_ptr)->connector = curr_vol_obj->connector;
else {
- HDassert(link_vol_obj);
+ if (NULL == link_vol_obj)
+ HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer")
(*tmp_vol_obj_ptr_ptr)->connector = link_vol_obj->connector;
} /* end else */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index f27b57a..52ca0dd 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -6610,10 +6610,11 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset)
static herr_t
H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
{
- H5S_hyper_span_info_t *down; /* Pointer to list of spans */
- unsigned curr_dim; /* Current dimension being operated on */
+ H5S_hyper_span_info_t *down; /* Pointer to list of spans */
+ unsigned curr_dim; /* Current dimension being operated on */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_NOERR
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space));
@@ -6631,13 +6632,15 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space)
down = down->head->down;
curr_dim++;
} /* end while */
- HDassert(down);
+ if (NULL == down)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer")
/* Share the underlying hyperslab span information */
new_space->select.sel_info.hslab->span_lst = down;
new_space->select.sel_info.hslab->span_lst->count++;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S__hyper_project_simple_lower() */
/*-------------------------------------------------------------------------
@@ -6723,7 +6726,8 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space)
/* Advance to next dimension */
curr_dim++;
} /* end while */
- HDassert(new_space->select.sel_info.hslab->span_lst);
+ if (NULL == new_space->select.sel_info.hslab->span_lst)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer")
HDassert(prev_span);
/* Share the underlying hyperslab span information */