Fix -Weffc++ warnings

This commit is contained in:
Sebastian Meßmer 2015-10-17 21:33:41 +02:00
parent 490936d29d
commit 03ad5cbe45
12 changed files with 34 additions and 4 deletions

View File

@ -11,6 +11,8 @@ namespace cryfs {
class CryCipher { class CryCipher {
public: public:
virtual ~CryCipher() {}
virtual const std::string &cipherName() const = 0; virtual const std::string &cipherName() const = 0;
virtual const boost::optional<std::string> &warning() const = 0; virtual const boost::optional<std::string> &warning() const = 0;
virtual cpputils::unique_ref<blockstore::BlockStore> createEncryptedBlockstore(cpputils::unique_ref<blockstore::BlockStore> baseBlockStore, const std::string &encKey) const = 0; virtual cpputils::unique_ref<blockstore::BlockStore> createEncryptedBlockstore(cpputils::unique_ref<blockstore::BlockStore> baseBlockStore, const std::string &encKey) const = 0;

View File

@ -12,7 +12,7 @@ using std::string;
namespace cryfs { namespace cryfs {
CryConfig::CryConfig(const bf::path &configfile) CryConfig::CryConfig(const bf::path &configfile)
:_configfile(configfile), _rootBlob(""), _encKey("") { :_configfile(configfile), _rootBlob(""), _encKey(""), _cipher("") {
if (bf::exists(_configfile)) { if (bf::exists(_configfile)) {
load(); load();
} }

View File

@ -20,7 +20,7 @@ namespace cryfs {
namespace cachingfsblobstore { namespace cachingfsblobstore {
CachingFsBlobStore::CachingFsBlobStore(unique_ref<FsBlobStore> baseBlobStore) CachingFsBlobStore::CachingFsBlobStore(unique_ref<FsBlobStore> baseBlobStore)
: _baseBlobStore(std::move(baseBlobStore)) { : _baseBlobStore(std::move(baseBlobStore)), _cache() {
} }
CachingFsBlobStore::~CachingFsBlobStore() { CachingFsBlobStore::~CachingFsBlobStore() {

View File

@ -80,7 +80,10 @@ public:
} }
private: private:
fsblobstore::DirBlob *_base; fsblobstore::DirBlob *_base;
DISALLOW_COPY_AND_ASSIGN(DirBlobRef);
}; };
} }

View File

@ -45,7 +45,10 @@ public:
} }
private: private:
fsblobstore::FileBlob *_base; fsblobstore::FileBlob *_base;
DISALLOW_COPY_AND_ASSIGN(FileBlobRef);
}; };
} }

View File

@ -29,7 +29,10 @@ public:
} }
private: private:
fsblobstore::SymlinkBlob *_base; fsblobstore::SymlinkBlob *_base;
DISALLOW_COPY_AND_ASSIGN(SymlinkBlobRef);
}; };
} }

View File

@ -27,7 +27,7 @@ namespace cryfs {
namespace fsblobstore { namespace fsblobstore {
DirBlob::DirBlob(unique_ref<Blob> blob, std::function<off_t (const blockstore::Key&)> getLstatSize) : DirBlob::DirBlob(unique_ref<Blob> blob, std::function<off_t (const blockstore::Key&)> getLstatSize) :
FsBlob(std::move(blob)), _getLstatSize(getLstatSize), _entries(), _changed(false) { FsBlob(std::move(blob)), _getLstatSize(getLstatSize), _entries(), _mutex(), _changed(false) {
ASSERT(magicNumber() == MagicNumbers::DIR, "Loaded blob is not a directory"); ASSERT(magicNumber() == MagicNumbers::DIR, "Loaded blob is not a directory");
_readEntriesFromBlob(); _readEntriesFromBlob();
} }

View File

@ -73,6 +73,8 @@ public:
private: private:
cachingfsblobstore::DirBlobRef *_base; cachingfsblobstore::DirBlobRef *_base;
DISALLOW_COPY_AND_ASSIGN(DirBlobRef);
}; };
} }

View File

@ -42,6 +42,8 @@ public:
private: private:
cachingfsblobstore::FileBlobRef *_base; cachingfsblobstore::FileBlobRef *_base;
DISALLOW_COPY_AND_ASSIGN(FileBlobRef);
}; };
} }

View File

@ -26,6 +26,8 @@ public:
private: private:
cachingfsblobstore::SymlinkBlobRef *_base; cachingfsblobstore::SymlinkBlobRef *_base;
DISALLOW_COPY_AND_ASSIGN(SymlinkBlobRef);
}; };
} }

View File

@ -17,8 +17,17 @@ ProgramOptions::ProgramOptions(const string &baseDir, const string &mountDir, co
_fuseOptions.insert(_fuseOptions.begin()+1, _mountDir); _fuseOptions.insert(_fuseOptions.begin()+1, _mountDir);
} }
ProgramOptions::ProgramOptions(ProgramOptions &&rhs)
:_baseDir(std::move(rhs._baseDir)), _mountDir(std::move(rhs._mountDir)), _configFile(std::move(rhs._configFile)),
_foreground(std::move(rhs._foreground)), _logFile(std::move(rhs._logFile)),
_fuseOptions(std::move(rhs._fuseOptions)) {
rhs._mountDir = nullptr;
}
ProgramOptions::~ProgramOptions() { ProgramOptions::~ProgramOptions() {
if (_mountDir != nullptr) {
delete[] _mountDir; delete[] _mountDir;
}
} }
const string &ProgramOptions::baseDir() const { const string &ProgramOptions::baseDir() const {

View File

@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <messmer/cpp-utils/macros.h>
namespace cryfs { namespace cryfs {
namespace program_options { namespace program_options {
@ -13,6 +14,7 @@ namespace cryfs {
ProgramOptions(const std::string &baseDir, const std::string &mountDir, const std::string &configFile, ProgramOptions(const std::string &baseDir, const std::string &mountDir, const std::string &configFile,
bool foreground, const boost::optional<std::string> &logFile, bool foreground, const boost::optional<std::string> &logFile,
const std::vector<char *> &fuseOptions); const std::vector<char *> &fuseOptions);
ProgramOptions(ProgramOptions &&rhs);
~ProgramOptions(); ~ProgramOptions();
const std::string &baseDir() const; const std::string &baseDir() const;
@ -29,6 +31,8 @@ namespace cryfs {
bool _foreground; bool _foreground;
boost::optional<std::string> _logFile; boost::optional<std::string> _logFile;
std::vector<char *> _fuseOptions; std::vector<char *> _fuseOptions;
DISALLOW_COPY_AND_ASSIGN(ProgramOptions);
}; };
} }
} }