Skip to content

Commit

Permalink
EXODUS: Clean up some analyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Oct 14, 2024
1 parent 98fa15e commit c7329fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
5 changes: 2 additions & 3 deletions packages/seacas/libraries/exodus/src/ex_get_block_params.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2020 National Technology & Engineering Solutions
* Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
* NTESS, the U.S. Government retains certain rights in this software.
*
Expand All @@ -22,9 +22,8 @@

int ex_get_block_params(int exoid, size_t block_count, struct ex_block **blocks)
{
size_t i;
EX_FUNC_ENTER();
for (i = 0; i < block_count; i++) {
for (size_t i = 0; i < block_count; i++) {
int status = ex_get_block_param(exoid, blocks[i]);
if (status != EX_NOERR) {
EX_FUNC_LEAVE(status);
Expand Down
21 changes: 9 additions & 12 deletions packages/seacas/libraries/exodus/src/ex_get_concat_sets.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2022 National Technology & Engineering Solutions
* Copyright(C) 1999-2022, 2024 National Technology & Engineering Solutions
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
* NTESS, the U.S. Government retains certain rights in this software.
*
Expand Down Expand Up @@ -39,11 +39,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *

void *sets_dist_fact = set_specs->sets_dist_fact;

int num_sets, i;
float *flt_dist_fact;
double *dbl_dist_fact;
char errmsg[MAX_ERR_LENGTH];
ex_inquiry ex_inq_val;
char errmsg[MAX_ERR_LENGTH];

EX_FUNC_ENTER();
if (exi_check_valid_file_id(exoid, __func__) == EX_FATAL) {
Expand All @@ -53,6 +49,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *
/* setup pointers based on set_type
NOTE: there is another block that sets more stuff later ... */

ex_inquiry ex_inq_val;
if (set_type == EX_NODE_SET) {
ex_inq_val = EX_INQ_NODE_SETS;
}
Expand Down Expand Up @@ -91,7 +88,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *

/* inquire how many sets have been stored */

num_sets = ex_inquire_int(exoid, ex_inq_val);
int num_sets = ex_inquire_int(exoid, ex_inq_val);
if (num_sets < 0) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get number of %ss defined for file id %d",
ex_name_of_object(set_type), exoid);
Expand All @@ -117,7 +114,7 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *
((int *)sets_dist_index)[0] = 0;
}

for (i = 0; i < num_sets; i++) {
for (int i = 0; i < num_sets; i++) {
int64_t set_id;
if (ex_int64_status(exoid) & EX_IDS_INT64_API) {
set_id = ((int64_t *)set_specs->sets_ids)[i];
Expand Down Expand Up @@ -200,12 +197,12 @@ int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *
}
if (num_dist > 0) { /* only get df if they exist */
if (exi_comp_ws(exoid) == sizeof(float)) {
flt_dist_fact = sets_dist_fact;
status = ex_get_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_idx]));
float *flt_dist_fact = sets_dist_fact;
status = ex_get_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_idx]));
}
else {
dbl_dist_fact = sets_dist_fact;
status = ex_get_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_idx]));
double *dbl_dist_fact = sets_dist_fact;
status = ex_get_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_idx]));
}
if (status != NC_NOERR) {
EX_FUNC_LEAVE(EX_FATAL); /* error will be reported by subroutine */
Expand Down

0 comments on commit c7329fe

Please sign in to comment.