From 9f9ac60c9257da2eb18afa370d78fd34730c1a1f Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 3 Jan 2024 08:53:02 -0700 Subject: [PATCH] IOSS: Address coverity concerns --- packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C | 10 +++++----- packages/seacas/libraries/ioss/src/Ioss_Utils.C | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C index 334aa2f9dd..66e86628a5 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C +++ b/packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C @@ -1,4 +1,4 @@ -// Copyright(C) 2021, 2022, 2023 National Technology & Engineering Solutions +// Copyright(C) 2021, 2022, 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. // @@ -482,8 +482,8 @@ namespace { // really matter. const auto &blocks = region.get_element_blocks(); const auto *topo = blocks[0]->topology(); - auto elem_topo = topo->name(); - auto face_topo = topo->boundary_type(0)->name(); + const auto &elem_topo = topo->name(); + const auto &face_topo = topo->boundary_type(0)->name(); auto *ss = new Ioss::SideSet(output_region.get_database(), "boundary"); output_region.add(ss); @@ -1021,8 +1021,8 @@ namespace { const auto &fbs = ss->get_side_blocks(); for (const auto &ifb : fbs) { if (ifb->parent_block() != nullptr) { - auto fb_name = ifb->parent_block()->name(); - auto *parent = dynamic_cast( + const auto &fb_name = ifb->parent_block()->name(); + auto *parent = dynamic_cast( output_region.get_entity(fb_name, Ioss::ELEMENTBLOCK)); if (parent == nullptr) { parent = dynamic_cast( diff --git a/packages/seacas/libraries/ioss/src/Ioss_Utils.C b/packages/seacas/libraries/ioss/src/Ioss_Utils.C index 6e98057473..d42b91e482 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_Utils.C +++ b/packages/seacas/libraries/ioss/src/Ioss_Utils.C @@ -1,4 +1,4 @@ -// 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. // @@ -1333,7 +1333,7 @@ std::string Ioss::Utils::get_type_from_file(const std::string &filename) if (all_dig) { auto tokens = Ioss::tokenize(filename, "."); if (tokens.size() >= 4) { - auto proc_count = tokens[tokens.size() - 2]; + const auto &proc_count = tokens[tokens.size() - 2]; if (proc_count.find_first_not_of("0123456789") == std::string::npos) { extension = tokens[tokens.size() - 3]; }