Skip to content

Commit

Permalink
Address coverity concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Oct 15, 2023
1 parent 76e0b77 commit e17fcee
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions packages/seacas/applications/ejoin/EJoin.C
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ namespace {
for (const auto &field_name : fields) {
if (valid_variable(field_name, 0, variable_list)) {
Ioss::Field field = nb->get_field(field_name);
ons->field_add(field);
ons->field_add(std::move(field));
}
}
}
Expand Down Expand Up @@ -1335,7 +1335,7 @@ namespace {
for (const auto &field_name : fields) {
if (valid_variable(field_name, 0, variable_list)) {
Ioss::Field field = pm->get_field(field_name);
output_region.field_add(field);
output_region.field_add(std::move(field));
}
}
}
Expand All @@ -1360,7 +1360,7 @@ namespace {
if (valid_variable(field_name, 0, variable_list)) {
Ioss::Field field = nb->get_field(field_name);
field.reset_count(node_count);
onb->field_add(field);
onb->field_add(std::move(field));
}
}
}
Expand Down Expand Up @@ -1390,7 +1390,7 @@ namespace {
for (const auto &field_name : fields) {
if (valid_variable(field_name, id, variable_list)) {
Ioss::Field field = ieb->get_field(field_name);
oeb->field_add(field);
oeb->field_add(std::move(field));
}
}
}
Expand Down Expand Up @@ -1424,7 +1424,7 @@ namespace {
for (const auto &field_name : fields) {
if (valid_variable(field_name, id, variable_list)) {
Ioss::Field field = in->get_field(field_name);
ons->field_add(field);
ons->field_add(std::move(field));
}
}
}
Expand Down Expand Up @@ -1464,7 +1464,7 @@ namespace {
for (const auto &field_name : fields) {
if (valid_variable(field_name, id, variable_list)) {
Ioss::Field field = eb->get_field(field_name);
(*II)->field_add(field);
(*II)->field_add(std::move(field));
}
}
++II;
Expand All @@ -1488,7 +1488,7 @@ namespace {
Ioss::Utils::substr_equal(prefix, field_name)) {
// If the field does not already exist, add it to the output node block
Ioss::Field field = ige->get_field(field_name);
oge->field_add(field);
oge->field_add(std::move(field));
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/seacas/applications/slice/Slice.C
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace {
for (const auto &block : blocks) {
auto field =
Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::MAP).set_index(1);
block->field_add(field);
block->field_add(std::move(field));
}
}

Expand Down Expand Up @@ -188,11 +188,11 @@ namespace {
auto field =
Ioss::Field(decomp_variable_name, Ioss::Field::INT32, IOSS_SCALAR(), Ioss::Field::MAP)
.set_index(1);
block->field_add(field);
block->field_add(std::move(field));
if (add_chain_info) {
auto ch_field =
Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::MAP).set_index(2);
block->field_add(ch_field);
block->field_add(std::move(ch_field));
}
}
}
Expand Down Expand Up @@ -243,10 +243,10 @@ namespace {
const auto &blocks = region.get_element_blocks();
for (const auto &block : blocks) {
block->field_add(Ioss::Field(decomp_variable_name, region.field_int_type(), IOSS_SCALAR(),
Ioss::Field::TRANSIENT));
Ioss::Field::TRANSIENT));
if (add_chain_info) {
block->field_add(
Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::TRANSIENT));
Ioss::Field("chain", region.field_int_type(), "Real[2]", Ioss::Field::TRANSIENT));
}
}
region.end_mode(Ioss::STATE_DEFINE_TRANSIENT);
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ namespace {
if (field_name != "ids" && !oge->field_exists(field_name) &&
Ioss::Utils::substr_equal(prefix, field_name)) {
// If the field does not already exist, add it to the output node block
oge->field_add(field);
oge->field_add(std::move(field));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/seacas/libraries/ioss/src/cgns/Iocgns_DatabaseIO.C
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ namespace {
for (int ii = 0; ii < nconn; ii++) {
char connectname[CGNS_MAX_NAME_LENGTH + 1];
char donorname[CGNS_MAX_NAME_LENGTH + 1];
std::array<cgsize_t, 6> range;
std::array<cgsize_t, 6> donor_range;
Ioss::IJK_t transform;
std::array<cgsize_t, 6> range{};
std::array<cgsize_t, 6> donor_range{};
Ioss::IJK_t transform{};

CGCHECK(cg_1to1_read(cgns_file_ptr, base, db_zone, ii + 1, connectname, donorname,
range.data(), donor_range.data(), transform.data()));
Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ namespace Ioex {
auto field = Ioss::Field(name, block->field_int_type(), IOSS_SCALAR(), Ioss::Field::MAP,
my_element_count)
.set_index(i + 1);
block->field_add(field);
block->field_add(std::move(field));
continue;
}

Expand All @@ -569,7 +569,7 @@ namespace Ioex {
auto field =
Ioss::Field(base, block->field_int_type(), storage, Ioss::Field::MAP, my_element_count)
.set_index(i + 1);
block->field_add(field);
block->field_add(std::move(field));

i = ii - 1;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/seacas/libraries/ioss/src/main/cth_pressure_map.C
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ namespace {
Ioss::Utils::substr_equal(prefix, field_name)) {
// If the field does not already exist, add it to the output node block
Ioss::Field field = ige->get_field(field_name);
oge->field_add(field);
oge->field_add(std::move(field));
}
}
}
Expand Down Expand Up @@ -1217,15 +1217,15 @@ namespace {
int num_nodes = nb->entity_count();
Ioss::Field node_normal("node_normal", Ioss::Field::REAL, v3d, Ioss::Field::TRANSIENT,
num_nodes);
nb->field_add(node_normal);
nb->field_add(std::move(node_normal));

// Iterate over the element blocks and calculate both node normals and face normals...
const auto &ebs = output_region.get_element_blocks();
for (auto *eb : ebs) {
int num_elem = eb->entity_count();
Ioss::Field face_normal("face_normal", Ioss::Field::REAL, v3d, Ioss::Field::TRANSIENT,
num_elem);
eb->field_add(face_normal);
eb->field_add(std::move(face_normal));
}
output_region.end_mode(Ioss::STATE_DEFINE_TRANSIENT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void write_blob()

blob1->field_add(x);
blob1->field_add(dx);
blob1->field_add(ddx);
blob1->field_add(std::move(ddx));

// Blobs can have different fields
blob2->field_add(x);
Expand Down

0 comments on commit e17fcee

Please sign in to comment.