From a162073291604f6cb3bb1c450631cbc83fff20b8 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 16 Nov 2011 13:17:23 +0000 Subject: [PATCH] make root_size() and copy_root() const --- space_map.h | 5 ++--- space_map_disk.cc | 4 ++-- space_map_recursive.cc | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/space_map.h b/space_map.h index 05c709e..a0a5549 100644 --- a/space_map.h +++ b/space_map.h @@ -54,9 +54,8 @@ namespace persistent_data { public: typedef boost::shared_ptr ptr; - // FIXME: these two should be const - virtual size_t root_size() = 0; - virtual void copy_root(void *dest, size_t len) = 0; + virtual size_t root_size() const = 0; + virtual void copy_root(void *dest, size_t len) const = 0; }; class checked_space_map : public persistent_space_map { diff --git a/space_map_disk.cc b/space_map_disk.cc index ff349fd..287a97c 100644 --- a/space_map_disk.cc +++ b/space_map_disk.cc @@ -381,11 +381,11 @@ namespace { } } - virtual size_t root_size() { + virtual size_t root_size() const { return sizeof(sm_root_disk); } - virtual void copy_root(void *dest, size_t len) { + virtual void copy_root(void *dest, size_t len) const { sm_root_disk d; sm_root v; diff --git a/space_map_recursive.cc b/space_map_recursive.cc index b757f95..7973a42 100644 --- a/space_map_recursive.cc +++ b/space_map_recursive.cc @@ -120,13 +120,13 @@ namespace { sm_->iterate(it); } - virtual size_t root_size() { + virtual size_t root_size() const { cant_recurse("root_size"); recursing_const_lock lock(*this); return sm_->root_size(); } - virtual void copy_root(void *dest, size_t len) { + virtual void copy_root(void *dest, size_t len) const { cant_recurse("copy_root"); recursing_const_lock lock(*this); return sm_->copy_root(dest, len);