From eaa8f66ec0e045df161b219506906568345a0b83 Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Tue, 24 Mar 2020 12:02:00 -0400 Subject: [PATCH] rgw: add const-correctness to rgw_obj_manifest and svc_tier_rados Mark functions as "const" or function parameters as "const" in order to make those functions more widely callable. Signed-off-by: J. Eric Ivancich --- src/rgw/rgw_obj_manifest.h | 7 +++---- src/rgw/services/svc_tier_rados.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_obj_manifest.h b/src/rgw/rgw_obj_manifest.h index c2b6157ed06..4b3e66e9fd6 100644 --- a/src/rgw/rgw_obj_manifest.h +++ b/src/rgw/rgw_obj_manifest.h @@ -456,10 +456,10 @@ public: void seek(uint64_t ofs); void operator++(); - bool operator==(const obj_iterator& rhs) { + bool operator==(const obj_iterator& rhs) const { return (ofs == rhs.ofs); } - bool operator!=(const obj_iterator& rhs) { + bool operator!=(const obj_iterator& rhs) const { return (ofs != rhs.ofs); } const rgw_obj_select& get_location() { @@ -504,7 +504,7 @@ public: friend class RGWObjManifest; void dump(Formatter *f) const; - }; + }; // class obj_iterator const obj_iterator& obj_begin(); const obj_iterator& obj_end(); @@ -552,4 +552,3 @@ public: }; }; WRITE_CLASS_ENCODER(RGWObjManifest) - diff --git a/src/rgw/services/svc_tier_rados.h b/src/rgw/services/svc_tier_rados.h index 925a2d25e06..a86b0a45111 100644 --- a/src/rgw/services/svc_tier_rados.h +++ b/src/rgw/services/svc_tier_rados.h @@ -54,7 +54,7 @@ public: s.append(buf); return s; } - string get_part(string& part) const { + string get_part(const string& part) const { string s = prefix; s.append("."); s.append(part); @@ -66,7 +66,7 @@ public: const string& get_key() const { return oid; } - bool from_meta(string& meta) { + bool from_meta(const string& meta) { int end_pos = meta.rfind('.'); // search for ".meta" if (end_pos < 0) return false; -- 2.47.3