Squash a couple of annoying compiler warnings

This commit is contained in:
Joe Thornber 2014-09-02 10:13:26 +01:00
parent 23735a0253
commit 4c026458d5
2 changed files with 19 additions and 5 deletions

View File

@ -17,6 +17,15 @@ namespace {
struct flags { struct flags {
flags() flags()
: max_hint_width(4) { : max_hint_width(4) {
// Dance around some spurious compiler warnings
device_size = 0;
block_size = 0;
nr_blocks = 0;
device_size.reset();
block_size.reset();
nr_blocks.reset();
} }
boost::optional<uint64_t> device_size; boost::optional<uint64_t> device_size;

View File

@ -88,9 +88,14 @@ namespace {
walk_writeset_tree(md.tm_, *md.writeset_tree_, v, dv); walk_writeset_tree(md.tm_, *md.writeset_tree_, v, dv);
} }
void mark_blocks_since(metadata const &md, uint32_t threshold, set<uint32_t> &result) { void mark_blocks_since(metadata const &md, optional<uint32_t> const &threshold, set<uint32_t> &result) {
walk_array(*md.era_array_, md.sb_.nr_blocks, threshold, result); if (!threshold)
walk_writesets(md, threshold, result); // Can't get here, just putting in to pacify the compiler
throw std::runtime_error("threshold not set");
else {
walk_array(*md.era_array_, md.sb_.nr_blocks, *threshold, result);
walk_writesets(md, *threshold, result);
}
} }
//-------------------------------- //--------------------------------
@ -155,11 +160,11 @@ namespace {
throw runtime_error("no metadata snapshot taken."); throw runtime_error("no metadata snapshot taken.");
metadata::ptr md(new metadata(bm, *sb.metadata_snap)); metadata::ptr md(new metadata(bm, *sb.metadata_snap));
mark_blocks_since(*md, *fs.era_threshold_, blocks); mark_blocks_since(*md, fs.era_threshold_, blocks);
} else { } else {
metadata::ptr md(new metadata(bm, metadata::OPEN)); metadata::ptr md(new metadata(bm, metadata::OPEN));
mark_blocks_since(*md, *fs.era_threshold_, blocks); mark_blocks_since(*md, fs.era_threshold_, blocks);
} }
if (want_stdout(output)) if (want_stdout(output))