Skip to content

Commit

Permalink
More SonarCloud-inspired fixes:
Browse files Browse the repository at this point in the history
- copy constructors and assignment operators declared = delete
- use of ## is macro definition

Signed-off-by: Cary Phillips <[email protected]>
  • Loading branch information
cary-ilm committed Nov 14, 2019
1 parent 5c985fc commit 64f145a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
12 changes: 6 additions & 6 deletions OpenEXR/IlmImf/ImfStandardAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,27 @@
#define IMF_STD_ATTRIBUTE_IMP(name,suffix,type) \
\
void \
add##suffix (Header &header, const type &value) \
IMF_ADD_SUFFIX(suffix) (Header &header, const type &value) \
{ \
header.insert (IMF_STRING (name), TypedAttribute<type> (value)); \
} \
\
bool \
has##suffix (const Header &header) \
IMF_HAS_SUFFIX(suffix) (const Header &header) \
{ \
return header.findTypedAttribute <TypedAttribute <type> > \
(IMF_STRING (name)) != 0; \
} \
\
const TypedAttribute<type> & \
name##Attribute (const Header &header) \
IMF_NAME_ATTRIBUTE(name) (const Header &header) \
{ \
return header.typedAttribute <TypedAttribute <type> > \
(IMF_STRING (name)); \
} \
\
TypedAttribute<type> & \
name##Attribute (Header &header) \
IMF_NAME_ATTRIBUTE(name) (Header &header) \
{ \
return header.typedAttribute <TypedAttribute <type> > \
(IMF_STRING (name)); \
Expand All @@ -76,13 +76,13 @@
const type & \
name (const Header &header) \
{ \
return name##Attribute(header).value(); \
return IMF_NAME_ATTRIBUTE(name) (header).value(); \
} \
\
type & \
name (Header &header) \
{ \
return name##Attribute(header).value(); \
return IMF_NAME_ATTRIBUTE(name) (header).value(); \
}

#include "ImfNamespace.h"
Expand Down
12 changes: 8 additions & 4 deletions OpenEXR/IlmImf/ImfStandardAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,19 @@
#include "ImfNamespace.h"
#include "ImfExport.h"

#define IMF_ADD_SUFFIX(suffix) add##suffix
#define IMF_HAS_SUFFIX(suffix) has##suffix
#define IMF_NAME_ATTRIBUTE(name) name##Attribute

#define IMF_STD_ATTRIBUTE_DEF(name,suffix,object) \
\
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER \
IMF_EXPORT void add##suffix (Header &header, const object &v); \
IMF_EXPORT bool has##suffix (const Header &header); \
IMF_EXPORT void IMF_ADD_SUFFIX(suffix) (Header &header, const object &v); \
IMF_EXPORT bool IMF_HAS_SUFFIX(suffix) (const Header &header); \
IMF_EXPORT const TypedAttribute<object> & \
name##Attribute (const Header &header); \
IMF_NAME_ATTRIBUTE(name) (const Header &header); \
IMF_EXPORT TypedAttribute<object> & \
name##Attribute (Header &header); \
IMF_NAME_ATTRIBUTE(name) (Header &header); \
IMF_EXPORT const object & \
name (const Header &header); \
IMF_EXPORT object & name (Header &header); \
Expand Down
6 changes: 6 additions & 0 deletions OpenEXR/IlmImf/ImfTiledOutputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ struct BufferedTile
{
delete [] pixelData;
}

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


Expand Down Expand Up @@ -278,6 +281,9 @@ struct TiledOutputFile::Data
Data (int numThreads);
~Data ();

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

inline TileBuffer * getTileBuffer (int number);
// hash function from tile
// buffer coords into our
Expand Down
3 changes: 3 additions & 0 deletions OpenEXR/IlmImfUtil/ImfDeepImageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ class TypedDeepImageChannel: public DeepImageChannel
TypedDeepImageChannel (DeepImageLevel &level, bool pLinear);
virtual ~TypedDeepImageChannel ();

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

virtual void setSamplesToZero
(size_t i,
unsigned int oldNumSamples,
Expand Down
3 changes: 3 additions & 0 deletions OpenEXR/IlmImfUtil/ImfFlatImageChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ class TypedFlatImageChannel: public FlatImageChannel

virtual ~TypedFlatImageChannel ();

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

virtual void resize ();

virtual void resetBasePointer ();
Expand Down

0 comments on commit 64f145a

Please sign in to comment.