Skip to content

Commit

Permalink
SonarCloud-inspired bug fixes:
Browse files Browse the repository at this point in the history
- copy constructor and assignment operator declared = delete
- compare this==&other in assignment operator

Signed-off-by: Cary Phillips <cary@ilm.com>
  • Loading branch information
cary-ilm committed Nov 14, 2019
1 parent 64f145a commit 19cd101
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions OpenEXR/IlmImf/ImfScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ struct ScanLineInputFile::Data: public Mutex

Data (int numThreads);
~Data ();

Data (const Data& other) = delete;
const Data operator = (const Data& other) = delete;

inline LineBuffer * getLineBuffer (int number); // hash function from line
// buffer indices into our
Expand Down
6 changes: 4 additions & 2 deletions PyIlmBase/PyImath/PyImathStringTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ struct StringTableIndex

const StringTableIndex & operator = (const StringTableIndex &si)
{
_index = si._index; // NOSONAR - suppress SonarCloud warning
if (&si != this)
_index = si._index;

return *this;
}

Expand Down Expand Up @@ -133,7 +135,7 @@ class StringTableDetailT {
> StringTableContainer;
};

} // namespace PyImath
} // namespace

typedef StringTableDetailT<std::string> StringTableDetail;
typedef StringTableDetailT<std::wstring> WStringTableDetail;
Expand Down

0 comments on commit 19cd101

Please sign in to comment.