diff --git a/src/CryFile.cpp b/src/CryFile.cpp index 8cb5b580..2b202f44 100644 --- a/src/CryFile.cpp +++ b/src/CryFile.cpp @@ -28,7 +28,9 @@ CryFile::~CryFile() { } unique_ptr CryFile::open(int flags) const { - return make_unique(make_unique(_device->LoadBlob(_key))); + auto blob = _device->LoadBlob(_key); + assert(blob.get() != nullptr); + return make_unique(make_unique(std::move(blob))); } void CryFile::stat(struct ::stat *result) const { diff --git a/src/impl/FileBlob.cpp b/src/impl/FileBlob.cpp index aaa20e36..8a253cd8 100644 --- a/src/impl/FileBlob.cpp +++ b/src/impl/FileBlob.cpp @@ -2,6 +2,7 @@ #include "MagicNumbers.h" #include +#include using std::unique_ptr; using std::make_unique; @@ -17,6 +18,7 @@ FileBlob::~FileBlob() { } unique_ptr FileBlob::InitializeEmptyFile(unique_ptr blob) { + assert(blob.get() != nullptr); blob->resize(1); unsigned char magicNumber = MagicNumbers::FILE; blob->write(&magicNumber, 0, 1); diff --git a/src/main.cpp b/src/main.cpp index 629911d6..27415309 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include #include @@ -10,6 +12,7 @@ namespace bf = boost::filesystem; using blockstore::ondisk::OnDiskBlockStore; +using blockstore::inmemory::InMemoryBlockStore; using std::make_unique;