Skip to content

Commit 19000cd

Browse files
nehebhassec
authored andcommitted
con/destructor fixes
Added = delete to make it explicit. Also made them public. Signed-off-by: Rosen Penev <[email protected]>
1 parent 7a2b05e commit 19000cd

24 files changed

+134
-151
lines changed

include/exiv2/basicio.hpp

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,9 @@ namespace Exiv2 {
243243
/*!
244244
@brief this is allocated and populated by mmap()
245245
*/
246-
byte* bigBlock_;
246+
byte* bigBlock_{};
247247

248248
//@}
249-
250-
protected:
251-
//! @name Creators
252-
//@{
253-
//! Default Constructor
254-
BasicIo() : bigBlock_(NULL) {};
255-
//@}
256249
}; // class BasicIo
257250

258251
/*!
@@ -281,12 +274,11 @@ namespace Exiv2 {
281274
//! The BasicIo reference
282275
BasicIo& bio_;
283276

284-
private:
285277
// Not implemented
286278
//! Copy constructor
287-
IoCloser(const IoCloser&);
279+
IoCloser(const IoCloser&) = delete;
288280
//! Assignment operator
289-
IoCloser& operator=(const IoCloser&);
281+
IoCloser& operator=(const IoCloser&) = delete;
290282
}; // class IoCloser
291283

292284
/*!
@@ -512,13 +504,13 @@ namespace Exiv2 {
512504
virtual void populateFakeData();
513505
//@}
514506

515-
private:
516507
// NOT IMPLEMENTED
517508
//! Copy constructor
518-
FileIo(FileIo& rhs);
509+
FileIo(FileIo& rhs) = delete;
519510
//! Assignment operator
520-
FileIo& operator=(const FileIo& rhs);
511+
FileIo& operator=(const FileIo& rhs) = delete;
521512

513+
private:
522514
// Pimpl idiom
523515
class Impl;
524516
std::unique_ptr<Impl> p_;
@@ -712,13 +704,13 @@ namespace Exiv2 {
712704

713705
//@}
714706

715-
private:
716707
// NOT IMPLEMENTED
717708
//! Copy constructor
718-
MemIo(MemIo& rhs);
709+
MemIo(MemIo& rhs) = delete;
719710
//! Assignment operator
720-
MemIo& operator=(const MemIo& rhs);
711+
MemIo& operator=(const MemIo& rhs) = delete;
721712

713+
private:
722714
// Pimpl idiom
723715
class Impl;
724716
std::unique_ptr<Impl> p_;
@@ -1029,13 +1021,13 @@ namespace Exiv2 {
10291021
*/
10301022
HttpIo(const std::wstring& wurl, size_t blockSize = 1024);
10311023
#endif
1032-
//@}
1033-
protected:
10341024
// NOT IMPLEMENTED
10351025
//! Copy constructor
1036-
HttpIo(HttpIo& rhs);
1026+
HttpIo(HttpIo& rhs) = delete;
10371027
//! Assignment operator
1038-
HttpIo& operator=(const HttpIo& rhs);
1028+
HttpIo& operator=(const HttpIo& rhs) = delete;
1029+
1030+
private:
10391031
// Pimpl idiom
10401032
class HttpImpl;
10411033
};
@@ -1079,12 +1071,14 @@ namespace Exiv2 {
10791071
for the protocol. Otherwise, it throws the Error.
10801072
*/
10811073
long write(BasicIo& src);
1082-
protected:
1074+
10831075
// NOT IMPLEMENTED
10841076
//! Copy constructor
1085-
CurlIo(CurlIo& rhs);
1077+
CurlIo(CurlIo& rhs) = delete;
10861078
//! Assignment operator
1087-
CurlIo& operator=(const CurlIo& rhs);
1079+
CurlIo& operator=(const CurlIo& rhs) = delete;
1080+
1081+
protected:
10881082
// Pimpl idiom
10891083
class CurlImpl;
10901084
};

include/exiv2/bmpimage.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ namespace Exiv2 {
5050
read width and height.
5151
*/
5252
class EXIV2API BmpImage : public Image {
53+
public:
5354
//! @name NOT Implemented
5455
//@{
5556
//! Copy constructor
56-
BmpImage(const BmpImage& rhs);
57+
BmpImage(const BmpImage& rhs) = delete;
5758
//! Assignment operator
58-
BmpImage& operator=(const BmpImage& rhs);
59+
BmpImage& operator=(const BmpImage& rhs) = delete;
5960
//@}
6061

61-
public:
6262
//! @name Creators
6363
//@{
6464
/*!

include/exiv2/cr2image.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ namespace Exiv2 {
9696
int pixelHeight() const;
9797
//@}
9898

99-
private:
10099
//! @name NOT implemented
101100
//@{
102101
//! Copy constructor
103-
Cr2Image(const Cr2Image& rhs);
102+
Cr2Image(const Cr2Image& rhs) = delete;
104103
//! Assignment operator
105-
Cr2Image& operator=(const Cr2Image& rhs);
104+
Cr2Image& operator=(const Cr2Image& rhs) = delete;
106105
//@}
107106

108107
}; // class Cr2Image

include/exiv2/crwimage.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,12 @@ namespace Exiv2 {
9696
int pixelHeight() const;
9797
//@}
9898

99-
private:
10099
//! @name NOT Implemented
101100
//@{
102101
//! Copy constructor
103-
CrwImage(const CrwImage& rhs);
102+
CrwImage(const CrwImage& rhs) = delete;
104103
//! Assignment operator
105-
CrwImage& operator=(const CrwImage& rhs);
104+
CrwImage& operator=(const CrwImage& rhs) = delete;
106105
//@}
107106

108107
}; // class CrwImage

include/exiv2/datasets.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,13 @@ namespace Exiv2 {
156156
static constexpr uint16_t Preview = 202;
157157
//@}
158158

159-
private:
160159
//! Prevent construction: not implemented.
161-
IptcDataSets() {}
160+
IptcDataSets() = delete;
162161
//! Prevent copy-construction: not implemented.
163-
IptcDataSets(const IptcDataSets& rhs);
162+
IptcDataSets(const IptcDataSets& rhs) = delete;
164163
//! Prevent assignment: not implemented.
165-
IptcDataSets& operator=(const IptcDataSets& rhs);
164+
IptcDataSets& operator=(const IptcDataSets& rhs) = delete;
166165

167-
public:
168166
/*!
169167
@brief Return the name of the dataset.
170168
@param number The dataset number

include/exiv2/epsimage.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,12 @@ namespace Exiv2
9393
std::string mimeType() const;
9494
//@}
9595

96-
private:
9796
//! @name NOT Implemented
9897
//@{
9998
//! Copy constructor
100-
EpsImage(const EpsImage& rhs);
99+
EpsImage(const EpsImage& rhs) = delete;
101100
//! Assignment operator
102-
EpsImage& operator=(const EpsImage& rhs);
101+
EpsImage& operator=(const EpsImage& rhs) = delete;
103102
//@}
104103

105104
}; // class EpsImage

include/exiv2/error.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ namespace Exiv2 {
7373
make that call any logic that always needs to be executed.
7474
*/
7575
class EXIV2API LogMsg {
76+
public:
7677
//! Prevent copy-construction: not implemented.
77-
LogMsg(const LogMsg&);
78+
LogMsg(const LogMsg&) = delete;
7879
//! Prevent assignment: not implemented.
79-
LogMsg& operator=(const LogMsg&);
80-
public:
80+
LogMsg& operator=(const LogMsg&) = delete;
8181
/*!
8282
@brief Defined log levels. To suppress all log messages, either set the
8383
log level to \c mute or set the log message handler to 0.

include/exiv2/gifimage.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ namespace Exiv2 {
4343
directly.
4444
*/
4545
class EXIV2API GifImage : public Image {
46+
public:
4647
//! @name NOT Implemented
4748
//@{
4849
//! Copy constructor
49-
GifImage(const GifImage& rhs);
50+
GifImage(const GifImage& rhs) = delete;
5051
//! Assignment operator
51-
GifImage& operator=(const GifImage& rhs);
52+
GifImage& operator=(const GifImage& rhs) = delete;
5253
//@}
5354

54-
public:
5555
//! @name Creators
5656
//@{
5757
/*!

include/exiv2/image.hpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ namespace Exiv2 {
482482
//! set type support for this image format
483483
int imageType() const { return imageType_; }
484484

485+
//! @name NOT implemented
486+
//@{
487+
//! Copy constructor
488+
Image(const Image& rhs) = delete;
489+
//! Assignment operator
490+
Image& operator=(const Image& rhs) = delete;
491+
//@}
492+
485493
protected:
486494
// DATA
487495
BasicIo::UniquePtr io_; //!< Image data IO pointer
@@ -502,14 +510,6 @@ namespace Exiv2 {
502510
static const char* typeName(uint16_t tag);
503511

504512
private:
505-
//! @name NOT implemented
506-
//@{
507-
//! Copy constructor
508-
Image(const Image& rhs);
509-
//! Assignment operator
510-
Image& operator=(const Image& rhs);
511-
//@}
512-
513513
// DATA
514514
int imageType_; //!< Image type
515515
uint16_t supportedMetadata_; //!< Bitmap with all supported metadata types
@@ -709,13 +709,12 @@ namespace Exiv2 {
709709
*/
710710
static bool checkType(int type, BasicIo& io, bool advance);
711711

712-
private:
713712
//! @name Creators
714713
//@{
715714
//! Prevent construction: not implemented.
716-
ImageFactory();
715+
ImageFactory() = delete;
717716
//! Prevent copy construction: not implemented.
718-
ImageFactory(const ImageFactory& rhs);
717+
ImageFactory(const ImageFactory& rhs) = delete;
719718
//@}
720719

721720
}; // class ImageFactory

include/exiv2/jp2image.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,14 @@ namespace Exiv2
9494
std::string mimeType() const;
9595
//@}
9696

97-
private:
9897
//! @name NOT Implemented
9998
//@{
10099
//! Copy constructor
101-
Jp2Image(const Jp2Image& rhs);
100+
Jp2Image(const Jp2Image& rhs) = delete;
102101
//! Assignment operator
103-
Jp2Image& operator=(const Jp2Image& rhs);
102+
Jp2Image& operator=(const Jp2Image& rhs) = delete;
103+
104+
private:
104105
/*!
105106
@brief Provides the main implementation of writeMetadata() by
106107
writing all buffered metadata to the provided BasicIo.

0 commit comments

Comments
 (0)