Skip to content

Commit

Permalink
SonarCloud-inspired fixes
Browse files Browse the repository at this point in the history
- removed const from operator= =delete
- added move-assign/move-constructor = delete

Signed-off-by: Cary Phillips <[email protected]>
  • Loading branch information
cary-ilm committed Nov 14, 2019
1 parent 19cd101 commit fa2e458
Show file tree
Hide file tree
Showing 51 changed files with 199 additions and 66 deletions.
3 changes: 2 additions & 1 deletion IlmBase/Iex/IexBaseExc.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class BaseExc: public std::exception
IEX_EXPORT BaseExc (const BaseExc &be) throw();
IEX_EXPORT virtual ~BaseExc () throw ();

IEX_EXPORT const BaseExc & operator = (const BaseExc& be) throw () = delete;
IEX_EXPORT BaseExc & operator = (const BaseExc& be) throw () = delete;
IEX_EXPORT BaseExc & operator = (const BaseExc&& be) throw () = delete;

//---------------------------------------------------
// what() method -- e.what() returns _message.c_str()
Expand Down
2 changes: 2 additions & 0 deletions IlmBase/IlmThread/IlmThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ class Thread
std::thread _thread;

Thread &operator= (const Thread& t) = delete;
Thread &operator= (const Thread&& t) = delete;
Thread (const Thread& t) = delete;
Thread (const Thread&& t) = delete;
#endif
};

Expand Down
2 changes: 2 additions & 0 deletions IlmBase/IlmThread/IlmThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ struct ThreadPool::Data
~Data();
Data (const Data&) = delete;
Data &operator= (const Data&) = delete;
Data (const Data&&) = delete;
Data &operator= (const Data&&) = delete;

struct SafeProvider
{
Expand Down
4 changes: 3 additions & 1 deletion IlmBase/IlmThread/IlmThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ class ILMTHREAD_EXPORT TaskGroup
~TaskGroup();

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

// marks one task as finished
// should be used by the thread pool provider to notify
Expand Down
8 changes: 6 additions & 2 deletions OpenEXR/IlmImf/ImfAcesFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class AcesOutputFile::Data
~Data();

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

RgbaOutputFile * rgbaFile;
};
Expand Down Expand Up @@ -342,7 +344,9 @@ class AcesInputFile::Data
~Data();

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

void initColorConversion ();

Expand Down
8 changes: 6 additions & 2 deletions OpenEXR/IlmImf/ImfAcesFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class AcesOutputFile
private:

AcesOutputFile (const AcesOutputFile &) = delete;
const AcesOutputFile & operator = (const AcesOutputFile &) = delete;
AcesOutputFile & operator = (const AcesOutputFile &) = delete;
AcesOutputFile (const AcesOutputFile &&) = delete;
AcesOutputFile & operator = (const AcesOutputFile &&) = delete;

class Data;

Expand Down Expand Up @@ -344,7 +346,9 @@ class AcesInputFile
private:

AcesInputFile (const AcesInputFile &) = delete;
const AcesInputFile & operator = (const AcesInputFile &) = delete;
AcesInputFile & operator = (const AcesInputFile &) = delete;
AcesInputFile (const AcesInputFile &&) = delete;
AcesInputFile & operator = (const AcesInputFile &&) = delete;

class Data;

Expand Down
8 changes: 6 additions & 2 deletions OpenEXR/IlmImf/ImfArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ class Array
private:

Array (const Array &) = delete;
const Array & operator = (const Array &) = delete;
Array & operator = (const Array &) = delete;
Array (const Array &&) = delete;
Array & operator = (const Array &&) = delete;

long _size;
T * _data;
Expand Down Expand Up @@ -177,7 +179,9 @@ class Array2D
private:

Array2D (const Array2D &) = delete;
const Array2D & operator = (const Array2D &) = delete;
Array2D & operator = (const Array2D &) = delete;
Array2D (const Array2D &&) = delete;
Array2D & operator = (const Array2D &&) = delete;

long _sizeX;
long _sizeY;
Expand Down
6 changes: 4 additions & 2 deletions OpenEXR/IlmImf/ImfAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ class TypedAttribute: public Attribute
TypedAttribute (const TypedAttribute<T> &other);
virtual ~TypedAttribute ();

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

TypedAttribute& operator = (const TypedAttribute& other) = delete;
TypedAttribute (const TypedAttribute<T> &&other);
TypedAttribute& operator = (const TypedAttribute&& other) = delete;

//--------------------------------
// Access to the attribute's value
//--------------------------------
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfAutoArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
~AutoArray () {delete [] _data;}

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

operator T * () {return _data;}
operator const T * () const {return _data;}
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfB44Compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class B44Compressor: public Compressor
virtual ~B44Compressor ();

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

IMF_EXPORT
virtual int numScanLines () const;
Expand Down
6 changes: 4 additions & 2 deletions OpenEXR/IlmImf/ImfCompositeDeepScanLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ class CompositeDeepScanLine
private :
struct Data *_Data;

CompositeDeepScanLine(const CompositeDeepScanLine &) = delete;
const CompositeDeepScanLine & operator=(const CompositeDeepScanLine &) = delete;
CompositeDeepScanLine(const CompositeDeepScanLine &) = delete;
CompositeDeepScanLine & operator=(const CompositeDeepScanLine &) = delete;
CompositeDeepScanLine(const CompositeDeepScanLine &&) = delete;
CompositeDeepScanLine & operator=(const CompositeDeepScanLine &&) = delete;
};

OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ struct DeepScanLineInputFile::Data: public Mutex
~Data ();

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

inline LineBuffer * getLineBuffer (int number); // hash function from line
// buffer indices into our
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepScanLineInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class DeepScanLineInputFile : public GenericInputFile
int numThreads = globalThreadCount());

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

//-----------------------------------------
// Destructor -- deallocates internal data
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ struct DeepScanLineOutputFile::Data
~Data ();

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

inline LineBuffer * getLineBuffer (int number);// hash function from line
// buffer indices into our
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ class DeepScanLineOutputFile : public GenericOutputFile
DeepScanLineOutputFile (const OutputPartData* part);

DeepScanLineOutputFile (const DeepScanLineOutputFile &) = delete;
const DeepScanLineOutputFile & operator = (const DeepScanLineOutputFile &) = delete;
DeepScanLineOutputFile & operator = (const DeepScanLineOutputFile &) = delete;
DeepScanLineOutputFile (const DeepScanLineOutputFile &&) = delete;
DeepScanLineOutputFile & operator = (const DeepScanLineOutputFile &&) = delete;

void initialize (const Header &header);
void initializeLineBuffer();
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepTiledInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ struct DeepTiledInputFile::Data: public Mutex
~Data ();

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

inline TileBuffer * getTileBuffer (int number);
// hash function from tile indices
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepTiledInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ class DeepTiledInputFile : public GenericInputFile
DeepTiledInputFile (InputPartData* part);

DeepTiledInputFile (const DeepTiledInputFile &) = delete;
const DeepTiledInputFile & operator = (const DeepTiledInputFile &) = delete;
DeepTiledInputFile & operator = (const DeepTiledInputFile &) = delete;
DeepTiledInputFile (const DeepTiledInputFile &&) = delete;
DeepTiledInputFile & operator = (const DeepTiledInputFile &&) = delete;

DeepTiledInputFile (const Header &header, OPENEXR_IMF_INTERNAL_NAMESPACE::IStream *is, int version,
int numThreads);
Expand Down
8 changes: 6 additions & 2 deletions OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ struct BufferedTile
}

BufferedTile (const BufferedTile& other) = delete;
const BufferedTile& operator = (const BufferedTile& other) = delete;
BufferedTile& operator = (const BufferedTile& other) = delete;
BufferedTile (const BufferedTile&& other) = delete;
BufferedTile& operator = (const BufferedTile&& other) = delete;
};


Expand Down Expand Up @@ -315,7 +317,9 @@ struct DeepTiledOutputFile::Data
~Data ();

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

inline TileBuffer * getTileBuffer (int number);
// hash function from tile
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDeepTiledOutputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ class DeepTiledOutputFile : public GenericOutputFile
DeepTiledOutputFile (const OutputPartData* part);

DeepTiledOutputFile (const DeepTiledOutputFile &) = delete;
const DeepTiledOutputFile & operator = (const DeepTiledOutputFile &) = delete;
DeepTiledOutputFile & operator = (const DeepTiledOutputFile &) = delete;
DeepTiledOutputFile (const DeepTiledOutputFile &&) = delete;
DeepTiledOutputFile & operator = (const DeepTiledOutputFile &&) = delete;

void initialize (const Header &header);

Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfDwaCompressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class DwaCompressor: public Compressor
virtual ~DwaCompressor ();

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

IMF_EXPORT
virtual int numScanLines () const;
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfFastHuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ class FastHufDecoder
~FastHufDecoder ();

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

IMF_EXPORT
static bool enabled ();
Expand Down
8 changes: 6 additions & 2 deletions OpenEXR/IlmImf/ImfIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ class IStream
private:

IStream (const IStream &) = delete;
const IStream & operator = (const IStream &) = delete;
IStream & operator = (const IStream &) = delete;
IStream (const IStream &&) = delete;
IStream & operator = (const IStream &&) = delete;

std::string _fileName;
};
Expand Down Expand Up @@ -214,7 +216,9 @@ class OStream
private:

OStream (const OStream &) = delete;
const OStream & operator = (const OStream &) = delete;
OStream & operator = (const OStream &) = delete;
OStream (const OStream &&) = delete;
OStream & operator = (const OStream &&) = delete;

std::string _fileName;
};
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ struct InputFile::Data : public Mutex
~Data ();

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

void deleteCachedBuffer();
};
Expand Down
5 changes: 4 additions & 1 deletion OpenEXR/IlmImf/ImfInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,11 @@ class InputFile : public GenericInputFile
private:

InputFile (InputPartData* part);

InputFile (const InputFile &) = delete;
const InputFile & operator = (const InputFile &) = delete;
InputFile & operator = (const InputFile &) = delete;
InputFile (const InputFile &&) = delete;
InputFile & operator = (const InputFile &&) = delete;

void initialize ();
void multiPartInitialize(InputPartData* part);
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfMultiPartInputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ struct MultiPartInputFile::Data: public InputStreamMutex
}

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

template <class T>
T* createInputPartT(int partNumber)
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfMultiPartInputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class MultiPartInputFile : public GenericInputFile
Data* _data;

MultiPartInputFile(const MultiPartInputFile &) = delete;
const MultiPartInputFile& operator = (const MultiPartInputFile &) = delete;
MultiPartInputFile& operator = (const MultiPartInputFile &) = delete;
MultiPartInputFile(const MultiPartInputFile &&) = delete;
MultiPartInputFile& operator = (const MultiPartInputFile &&) = delete;


//
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ struct MultiPartOutputFile::Data: public OutputStreamMutex
}

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

};

Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfMultiPartOutputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ class MultiPartOutputFile : public GenericOutputFile
~MultiPartOutputFile();

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

struct Data;

Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ struct OutputFile::Data
~Data ();

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

inline LineBuffer * getLineBuffer (int number); // hash function from line
// buffer indices into our
Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfOutputFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ class OutputFile : public GenericOutputFile
OutputFile (const OutputPartData* part);

OutputFile (const OutputFile &) = delete;
const OutputFile & operator = (const OutputFile &) = delete;
OutputFile & operator = (const OutputFile &) = delete;
OutputFile (const OutputFile &&) = delete;
OutputFile & operator = (const OutputFile &&) = delete;

void initialize (const Header &header);

Expand Down
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfPizCompressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ class PizCompressor: public Compressor
virtual ~PizCompressor ();

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

IMF_EXPORT
virtual int numScanLines () const;
Expand Down
Loading

0 comments on commit fa2e458

Please sign in to comment.