From db76b3b85631e2bdceda4f5c099b84f52b82b54f Mon Sep 17 00:00:00 2001 From: Ben RUBSON Date: Tue, 23 Jan 2018 08:45:30 +0100 Subject: [PATCH] Add missing special member functions --- encfs/DirNode.cpp | 8 ++++++-- encfs/NullCipher.cpp | 20 ++++++++++++++++++-- encfs/SSL_Cipher.cpp | 7 +++++++ encfs/XmlReader.cpp | 6 ++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp index 2c6271b..ecbdf43 100644 --- a/encfs/DirNode.cpp +++ b/encfs/DirNode.cpp @@ -142,10 +142,14 @@ class RenameOp { last = renameList->begin(); } - RenameOp(const RenameOp &src) = default; - + // destructor ~RenameOp(); + RenameOp(const RenameOp &src) = delete; // copy contructor + RenameOp(RenameOp&& other) = delete; // move constructor + RenameOp& operator=(const RenameOp& other) = delete; // copy assignment + RenameOp& operator=(RenameOp&& other) = delete; // move assignment + explicit operator bool() const { return renameList != nullptr; } bool apply(); diff --git a/encfs/NullCipher.cpp b/encfs/NullCipher.cpp index 4e916ca..50dadff 100644 --- a/encfs/NullCipher.cpp +++ b/encfs/NullCipher.cpp @@ -50,16 +50,32 @@ static bool NullCipher_registered = Cipher::Register( class NullKey : public AbstractCipherKey { public: NullKey() = default; + + // destructor ~NullKey() override = default; + + NullKey(const NullKey &src) = delete; // copy constructor + NullKey(NullKey&& other) = delete; // move constructor + NullKey& operator=(const NullKey& other) = delete; // copy assignment + NullKey& operator=(NullKey&& other) = delete; // move assignment }; class NullDestructor { public: NullDestructor() = default; - NullDestructor(const NullDestructor &) = default; + + // destructor ~NullDestructor() = default; - NullDestructor &operator=(const NullDestructor &) = default; + // copy contructor + NullDestructor(const NullDestructor &) = default; + + // move constructor + NullDestructor(NullDestructor &&) = default; + + NullDestructor &operator=(const NullDestructor &) = delete; // copy assignment + NullDestructor& operator=(NullDestructor&& other) = delete; // move assignment + void operator()(NullKey *&) {} }; std::shared_ptr gNullKey(new NullKey(), NullDestructor()); diff --git a/encfs/SSL_Cipher.cpp b/encfs/SSL_Cipher.cpp index 384fba8..d39a39c 100644 --- a/encfs/SSL_Cipher.cpp +++ b/encfs/SSL_Cipher.cpp @@ -293,7 +293,14 @@ class SSLKey : public AbstractCipherKey { HMAC_CTX *mac_ctx; SSLKey(int keySize, int ivLength); + + // destructor ~SSLKey() override; + + SSLKey(const SSLKey &src) = delete; // copy constructor + SSLKey(SSLKey&& other) = delete; // move constructor + SSLKey& operator=(const SSLKey& other) = delete; // copy assignment + SSLKey& operator=(SSLKey&& other) = delete; // move assignment }; SSLKey::SSLKey(int keySize_, int ivLength_) { diff --git a/encfs/XmlReader.cpp b/encfs/XmlReader.cpp index 770cc96..89dc995 100644 --- a/encfs/XmlReader.cpp +++ b/encfs/XmlReader.cpp @@ -169,8 +169,14 @@ class XmlNode : virtual public XmlValue { explicit XmlNode(const tinyxml2::XMLElement *element_) : XmlValue(safeValueForNode(element_)), element(element_) {} + // destructor ~XmlNode() override = default; + XmlNode(const XmlNode &src) = delete; // copy constructor + XmlNode(XmlNode&& other) = delete; // move constructor + XmlNode& operator=(const XmlNode& other) = delete; // copy assignment + XmlNode& operator=(XmlNode&& other) = delete; // move assignment + XmlValuePtr find(const char *name) const override { if (name[0] == '@') { const char *value = element->Attribute(name + 1);