From: J. Eric Ivancich Date: Tue, 24 Mar 2020 16:02:00 +0000 (-0400) Subject: rgw: add const-correctness to rgw_obj_manifest and svc_tier_rados X-Git-Tag: v16.1.0~2428^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eaa8f66ec0e045df161b219506906568345a0b83;p=ceph.git 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 --- diff --git a/src/rgw/rgw_obj_manifest.h b/src/rgw/rgw_obj_manifest.h index c2b6157ed060..4b3e66e9fd64 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 925a2d25e069..a86b0a45111d 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;