From 4c026458d508d0df184453bea72cf2e755e4f29a Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Tue, 2 Sep 2014 10:13:26 +0100 Subject: [PATCH] Squash a couple of annoying compiler warnings --- caching/cache_metadata_size.cc | 9 +++++++++ era/era_invalidate.cc | 15 ++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/caching/cache_metadata_size.cc b/caching/cache_metadata_size.cc index 3fb1bf1..dd806c8 100644 --- a/caching/cache_metadata_size.cc +++ b/caching/cache_metadata_size.cc @@ -17,6 +17,15 @@ namespace { struct flags { flags() : 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 device_size; diff --git a/era/era_invalidate.cc b/era/era_invalidate.cc index 45ae784..c81b5af 100644 --- a/era/era_invalidate.cc +++ b/era/era_invalidate.cc @@ -88,9 +88,14 @@ namespace { walk_writeset_tree(md.tm_, *md.writeset_tree_, v, dv); } - void mark_blocks_since(metadata const &md, uint32_t threshold, set &result) { - walk_array(*md.era_array_, md.sb_.nr_blocks, threshold, result); - walk_writesets(md, threshold, result); + void mark_blocks_since(metadata const &md, optional const &threshold, set &result) { + if (!threshold) + // 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."); 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 { 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))