Skip to content

Commit

Permalink
EXODUS: Eliminate sign mismatch compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Aug 27, 2024
1 parent 682e948 commit a28082d
Show file tree
Hide file tree
Showing 28 changed files with 138 additions and 130 deletions.
13 changes: 7 additions & 6 deletions packages/seacas/libraries/exodus/include/exodusII.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
#endif

/* EXODUS version number */
#define EXODUS_VERSION "9.01"
#define EXODUS_VERSION "9.02"
#define EXODUS_VERSION_MAJOR 9
#define EXODUS_VERSION_MINOR 1
#define EXODUS_RELEASE_DATE "July 17, 2024"
#define EXODUS_VERSION_MINOR 2
#define EXODUS_RELEASE_DATE "August 27, 2024"

#define EX_API_VERS 9.01f
#define EX_API_VERS 9.02f
#define EX_API_VERS_NODOT (100 * EXODUS_VERSION_MAJOR + EXODUS_VERSION_MINOR)
#define EX_VERS EX_API_VERS

Expand Down Expand Up @@ -1955,8 +1955,9 @@ enum ex_error_return_code {
EX_LASTERR = -1003, /**< in ex_err, use existing err_num value */
EX_NULLENTITY = -1006, /**< null entity found */
EX_NOENTITY = -1007, /**< no entities of that type on database */
EX_INTSIZEMISMATCH = -1008, /**< integer sizes do not match on input/output databases in ex_copy */
EX_NOTFOUND = -1008, /**< could not find requested variable on database */
EX_INTSIZEMISMATCH =
-1008, /**< integer sizes do not match on input/output databases in ex_copy */
EX_NOTFOUND = -1008, /**< could not find requested variable on database */

EX_FATAL = -1, /**< fatal error flag def */
EX_NOERR = 0, /**< no error flag def */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2023 National Technology & Engineering Solutions
* Copyright(C) 1999-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 @@ -375,7 +375,7 @@ int exi_put_homogenous_block_params(int exoid, size_t block_count, const struct
start[1] = 0;
count[1] = strlen(text) + 1;

for (size_t j = 0; j < blocks[i].num_attribute; j++) {
for (int64_t j = 0; j < blocks[i].num_attribute; j++) {
start[0] = j;
nc_put_vara_text(exoid, att_name_varid, start, count, text);
}
Expand Down
42 changes: 24 additions & 18 deletions packages/seacas/libraries/exodus/src/ex_cvt_nodes_to_sides.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2020, 2023 National Technology & Engineering Solutions
* Copyright(C) 1999-2020, 2023, 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 @@ -171,15 +171,14 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
void_int *side_sets_elem_list, void_int *side_sets_node_list,
void_int *side_sets_side_list)
{
size_t i, j, k, n;
int num_side_sets, num_elem_blks;
int64_t tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0, ndim;
void_int *elem_blk_ids = NULL;
void_int *connect = NULL;
void_int *ss_elem_ndx = NULL;
void_int *ss_elem_node_ndx = NULL;
void_int *ss_parm_ndx = NULL;
size_t elem_ctr, node_ctr, elem_num_pos;
int64_t elem_ctr, node_ctr, elem_num_pos;
int num_nodes_per_elem, num_node_per_side;

int *same_elem_type = NULL;
Expand Down Expand Up @@ -255,12 +254,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n

/* First count up # of elements in the side sets*/
if (ints_64) {
for (i = 0; i < num_side_sets; i++) {
for (int i = 0; i < num_side_sets; i++) {
tot_num_ss_elem += ((int64_t *)num_elem_per_set)[i];
}
}
else {
for (i = 0; i < num_side_sets; i++) {
for (int i = 0; i < num_side_sets; i++) {
tot_num_ss_elem += ((int *)num_elem_per_set)[i];
}
}
Expand All @@ -279,15 +278,15 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
if (int_size == sizeof(int64_t)) {
/* Sort side set element list into index array - non-destructive */
int64_t *elems = (int64_t *)ss_elem_ndx;
for (i = 0; i < tot_num_ss_elem; i++) {
for (int i = 0; i < tot_num_ss_elem; i++) {
elems[i] = i; /* init index array to current position */
}
exi_iqsort64(side_sets_elem_list, elems, tot_num_ss_elem);
}
else {
/* Sort side set element list into index array - non-destructive */
int *elems = (int *)ss_elem_ndx;
for (i = 0; i < tot_num_ss_elem; i++) {
for (int i = 0; i < tot_num_ss_elem; i++) {
elems[i] = i; /* init index array to current position */
}
exi_iqsort(side_sets_elem_list, elems, tot_num_ss_elem);
Expand Down Expand Up @@ -325,7 +324,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
goto cleanup;
}
elem_ctr = 0;
for (i = 0; i < num_elem_blks; i++) {
for (int i = 0; i < num_elem_blks; i++) {
ex_entity_id id;
if (ints_64) {
id = ((int64_t *)elem_blk_ids)[i];
Expand Down Expand Up @@ -383,9 +382,10 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
same_elem_type[0] = true;
if (ints_64) {
elem_ctr = ((int64_t *)num_elem_per_set)[0];
for (i = 0, k = 0; i < tot_num_ss_elem; i++) {
for (int64_t i = 0, k = 0; i < tot_num_ss_elem; i++) {
int64_t elem = ((int64_t *)side_sets_elem_list)[i];
for (j = 0; j < num_elem_blks; j++) {
int j = 0;
for (; j < num_elem_blks; j++) {
if (elem <= elem_blk_parms[j].elem_ctr) {
break;
}
Expand Down Expand Up @@ -420,10 +420,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
*/
node_ctr = 0;
elem_ctr = ((int64_t *)num_elem_per_set)[0];
for (i = 0, k = 0; i < tot_num_ss_elem; i++) {
int i = 0;
for (int k = 0; i < tot_num_ss_elem; i++) {
int64_t elem = ((int64_t *)side_sets_elem_list)[i];

for (j = 0; j < num_elem_blks; j++) {
int j = 0;
for (; j < num_elem_blks; j++) {
if (elem <= elem_blk_parms[j].elem_ctr) {
break;
}
Expand Down Expand Up @@ -460,10 +462,11 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
}
else {
elem_ctr = ((int *)num_elem_per_set)[0];
for (i = 0, k = 0; i < tot_num_ss_elem; i++) {
for (int i = 0, k = 0; i < tot_num_ss_elem; i++) {
int elem = ((int *)side_sets_elem_list)[i];

for (j = 0; j < num_elem_blks; j++) {
int j = 0;
for (; j < num_elem_blks; j++) {
if (elem <= elem_blk_parms[j].elem_ctr) {
break;
}
Expand Down Expand Up @@ -498,10 +501,12 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n
*/
node_ctr = 0;
elem_ctr = ((int *)num_elem_per_set)[0];
for (i = 0, k = 0; i < tot_num_ss_elem; i++) {
int i = 0;
for (int k = 0; i < tot_num_ss_elem; i++) {
int elem = ((int *)side_sets_elem_list)[i];

for (j = 0; j < num_elem_blks; j++) {
int j = 0;
for (; j < num_elem_blks; j++) {
if (elem <= elem_blk_parms[j].elem_ctr) {
break;
}
Expand Down Expand Up @@ -541,7 +546,7 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n

elem_ctr = 0;

for (j = 0; j < tot_num_ss_elem; j++) {
for (int j = 0; j < tot_num_ss_elem; j++) {
int64_t elem;
int64_t idx;
int64_t ss_node0, ss_node1;
Expand Down Expand Up @@ -617,7 +622,8 @@ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_n

num_nodes_per_elem = elem_blk_parms[p_ndx].num_nodes_per_elem;

for (n = 0; n < num_nodes_per_elem; n++) {
int n = 0;
for (; n < num_nodes_per_elem; n++) {
/* find node in connectivity array that matches first node in side set */
if (((int_size == sizeof(int64_t)) &&
(ss_node0 == ((int64_t *)connect)[num_nodes_per_elem * (elem_num_pos) + n])) ||
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/libraries/exodus/src/ex_field_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int number_width(size_t number)
static void verify_valid_component(int component, size_t cardinality, size_t suffix_size)
{
assert(cardinality == suffix_size);
assert(component - 1 < suffix_size);
assert(component - 1 < (int)suffix_size);
}

const char *ex_component_field_name(ex_field *field, int component[EX_MAX_FIELD_NESTING])
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_get_partial_attr.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 Down Expand Up @@ -150,7 +150,7 @@ int ex_get_partial_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id,
EX_FUNC_LEAVE(EX_FATAL);
}

if (start_num + num_ent - 1 > num_entries_this_obj) {
if (start_num + num_ent - 1 > (int64_t)num_entries_this_obj) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start index (%" PRId64 ") + count (%" PRId64
") is larger than total number of entities (%zu) in file id %d",
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_get_partial_coord.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 Down Expand Up @@ -81,7 +81,7 @@ int ex_get_partial_coord(int exoid, int64_t start_node_num, int64_t num_nodes, v
}

--start_node_num;
if (start_node_num + num_nodes > num_nod) {
if (start_node_num + num_nodes > (int64_t)num_nod) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start index (%" PRId64 ") + node count (%" PRId64
") is larger than total number of nodes (%zu) in file id %d",
Expand Down
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 Down Expand Up @@ -57,7 +57,7 @@ int ex_get_partial_coord_component(int exoid, int64_t start_node_num, int64_t nu
}

--start_node_num;
if (start_node_num + num_nodes > num_nod) {
if (start_node_num + num_nodes > (int64_t)num_nod) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start index (%" PRId64 ") + node count (%" PRId64
") is larger than total number of nodes (%zu) in file id %d",
Expand All @@ -71,7 +71,7 @@ int ex_get_partial_coord_component(int exoid, int64_t start_node_num, int64_t nu
EX_FUNC_LEAVE(EX_FATAL);
}

if (component > num_dim) {
if (component > (int64_t)num_dim) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: Component (%d) is larger than number of dimensions (%zu) in file id %d",
component, num_dim, exoid);
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_get_partial_id_map.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2021 National Technology & Engineering Solutions
* Copyright(C) 1999-2021, 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 @@ -90,7 +90,7 @@ int ex_get_partial_id_map(int exoid, ex_entity_type map_type, int64_t start_enti
EX_FUNC_LEAVE(EX_FATAL);
}

if (start_entity_num + num_entities - 1 > num_entries) {
if (start_entity_num + num_entities - 1 > (int64_t)num_entries) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start index (%" PRId64 ") + entity count (%" PRId64
") is larger than total number of entities (%zu) in file id %d",
Expand Down
6 changes: 3 additions & 3 deletions packages/seacas/libraries/exodus/src/ex_get_partial_num_map.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 Down Expand Up @@ -81,7 +81,7 @@ int ex_get_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_
}

/* Check input parameters for a valid range of numbers */
if (ent_start <= 0 || ent_start > num_mobj) {
if (ent_start <= 0 || ent_start > (int64_t)num_mobj) {
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start count is invalid in file id %d", exoid);
ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);
EX_FUNC_LEAVE(EX_FATAL);
Expand All @@ -93,7 +93,7 @@ int ex_get_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_
EX_FUNC_LEAVE(EX_FATAL);
}

if (ent_start + ent_count - 1 > num_mobj) {
if (ent_start + ent_count - 1 > (int64_t)num_mobj) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start+count-1 is larger than element count in file id %d", exoid);
ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);
Expand Down
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 Down Expand Up @@ -152,7 +152,7 @@ int ex_get_partial_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj
EX_FUNC_LEAVE(EX_FATAL);
}

if (start_num + num_ent - 1 > num_entries_this_obj && num_ent > 0) {
if (start_num + num_ent - 1 > (int64_t)num_entries_this_obj && num_ent > 0) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: start index (%" PRId64 ") + count (%" PRId64
") is larger than total number of entities (%zu) in file id %d",
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_get_prop_names.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2021 National Technology & Engineering Solutions
* Copyright(C) 1999-2021, 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 @@ -128,7 +128,7 @@ int ex_get_prop_names(int exoid, ex_entity_type obj_type, char **prop_names)
EX_FUNC_LEAVE(EX_FATAL);
}

int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH);
size_t api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH);
if (att_len - 1 <= api_name_size) {
/* Client has large enough char string to hold text... */
if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, prop_names[i])) != NC_NOERR) {
Expand Down
Loading

0 comments on commit a28082d

Please sign in to comment.