Skip to content

Commit

Permalink
Fix warnings by Coverity Scan
Browse files Browse the repository at this point in the history
Use move instead of copy.
  • Loading branch information
WeiqunZhang committed Aug 14, 2024
1 parent b7083f0 commit 7068585
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Src/Base/AMReX_BoxArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,10 @@ BoxArray::maxSize (const IntVect& block_size)
blst.maxSize(block_size);
const int N = static_cast<int>(blst.size());
if (size() != N) { // If size doesn't change, do nothing.
auto bak = m_simplified_list;
std::shared_ptr<BoxList> bak;
bak.swap(m_simplified_list);
define(std::move(blst));
m_simplified_list = bak;
m_simplified_list = std::move(bak);
}
return *this;
}
Expand All @@ -569,12 +570,12 @@ BoxArray::minmaxSize (const IntVect& min_size, const IntVect& max_size)
(max_size/min_size)*min_size == max_size);
std::shared_ptr<BoxList> bak;
if (m_bat.is_simple() && crseRatio() == IntVect::TheUnitVector()) {
bak = m_simplified_list;
bak.swap(m_simplified_list);
}
this->coarsen(min_size);
this->maxSize(max_size/min_size);
this->refine(min_size);
m_simplified_list = bak;
m_simplified_list = std::move(bak);
return *this;
}

Expand Down

0 comments on commit 7068585

Please sign in to comment.