From cbb26fea840d6d2430c3f495de792d53160c5ba5 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 26 Jul 2016 12:17:58 +0200 Subject: [PATCH] rgw: improve const-correctness in the front-end infrastructure. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_client_io.cc | 2 ++ src/rgw/rgw_client_io.h | 16 ++++++++++------ src/rgw/rgw_lib.h | 8 ++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/rgw/rgw_client_io.cc b/src/rgw/rgw_client_io.cc index 090636bbf90..659d31c0ae6 100644 --- a/src/rgw/rgw_client_io.cc +++ b/src/rgw/rgw_client_io.cc @@ -22,6 +22,7 @@ void RGWClientIO::init(CephContext *cct) { } } + int RGWStreamIOBase::print(const char *format, ...) { #define LARGE_ENOUGH 128 @@ -76,6 +77,7 @@ int RGWStreamIOBase::read(char *buf, int max, int *actual, bool hash /* = false return 0; } + int RGWStreamIO::write(const char* const buf, const int len) { const auto ret = RGWStreamIOBase::write(buf, len); diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h index 98234f65d03..f3fc1e245d4 100644 --- a/src/rgw/rgw_client_io.h +++ b/src/rgw/rgw_client_io.h @@ -23,12 +23,14 @@ public: virtual ~RGWClientIO() {} void init(CephContext *cct); - RGWEnv& get_env() { return env; } + RGWEnv& get_env() { + return env; + } virtual int complete_request() = 0; /* XXX signature likely changing */ - virtual uint64_t get_bytes_sent() = 0; - virtual uint64_t get_bytes_received() = 0; + virtual uint64_t get_bytes_sent() const = 0; + virtual uint64_t get_bytes_received() const = 0; }; /* RGWClient IO */ class RGWStreamIOBase : public RGWClientIO { @@ -57,7 +59,9 @@ class RGWStreamIO : public RGWStreamIOBase { SHA256 *sha256_hash; - bool account() { return _account; } + bool account() const { + return _account; + } public: virtual ~RGWStreamIO() {} @@ -77,11 +81,11 @@ public: _account = _accnt; } - uint64_t get_bytes_sent() override { + uint64_t get_bytes_sent() const override { return bytes_sent; } - uint64_t get_bytes_received() override { + uint64_t get_bytes_received() const override { return bytes_received; } }; /* RGWStreamIO */ diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h index 1689d67e4df..5c66c2b26df 100644 --- a/src/rgw/rgw_lib.h +++ b/src/rgw/rgw_lib.h @@ -60,7 +60,7 @@ namespace rgw { RGWLibIO(const RGWUserInfo &_user_info) : user_info(_user_info) {} - virtual void init_env(CephContext *cct) {} + virtual void init_env(CephContext *cct) override {} const RGWUserInfo& get_user() { return user_info; @@ -75,15 +75,15 @@ namespace rgw { int complete_header(); int send_content_length(uint64_t len); - int complete_request() { /* XXX */ + int complete_request() override { /* XXX */ return 0; }; - uint64_t get_bytes_sent() override { + uint64_t get_bytes_sent() const override { return 0; } - uint64_t get_bytes_received() override { + uint64_t get_bytes_received() const override { return 0; } -- 2.47.3