Skip to content

Commit

Permalink
Add missing special member functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben RUBSON committed Jan 23, 2018
1 parent 2af7c56 commit db76b3b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
8 changes: 6 additions & 2 deletions encfs/DirNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
20 changes: 18 additions & 2 deletions encfs/NullCipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbstractCipherKey> gNullKey(new NullKey(), NullDestructor());
Expand Down
7 changes: 7 additions & 0 deletions encfs/SSL_Cipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down
6 changes: 6 additions & 0 deletions encfs/XmlReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit db76b3b

Please sign in to comment.