Add some asserts
This commit is contained in:
parent
f1a992d187
commit
354de197ff
@ -28,7 +28,9 @@ CryFile::~CryFile() {
|
||||
}
|
||||
|
||||
unique_ptr<fspp::OpenFile> CryFile::open(int flags) const {
|
||||
return make_unique<CryOpenFile>(make_unique<FileBlob>(_device->LoadBlob(_key)));
|
||||
auto blob = _device->LoadBlob(_key);
|
||||
assert(blob.get() != nullptr);
|
||||
return make_unique<CryOpenFile>(make_unique<FileBlob>(std::move(blob)));
|
||||
}
|
||||
|
||||
void CryFile::stat(struct ::stat *result) const {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "MagicNumbers.h"
|
||||
#include <messmer/blockstore/utils/Key.h>
|
||||
#include <cassert>
|
||||
|
||||
using std::unique_ptr;
|
||||
using std::make_unique;
|
||||
@ -17,6 +18,7 @@ FileBlob::~FileBlob() {
|
||||
}
|
||||
|
||||
unique_ptr<FileBlob> FileBlob::InitializeEmptyFile(unique_ptr<Blob> blob) {
|
||||
assert(blob.get() != nullptr);
|
||||
blob->resize(1);
|
||||
unsigned char magicNumber = MagicNumbers::FILE;
|
||||
blob->write(&magicNumber, 0, 1);
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include <messmer/blockstore/implementations/ondisk/OnDiskBlockStore.h>
|
||||
#include <messmer/blockstore/implementations/inmemory/InMemoryBlockStore.h>
|
||||
#include <messmer/blockstore/implementations/inmemory/InMemoryBlock.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@ -10,6 +12,7 @@
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
using blockstore::ondisk::OnDiskBlockStore;
|
||||
using blockstore::inmemory::InMemoryBlockStore;
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user