From f0285577d78cf3adcfdf13b2f1caeaa18922bbfe Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 4 Oct 2016 10:36:05 +0200 Subject: [PATCH] rgw: ONLY replace std::size_t with size_t. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_asio_client.cc | 20 ++++----- src/rgw/rgw_asio_client.h | 22 +++++----- src/rgw/rgw_civetweb.cc | 24 +++++------ src/rgw/rgw_civetweb.h | 22 +++++----- src/rgw/rgw_civetweb_frontend.cc | 4 +- src/rgw/rgw_client_io.cc | 2 +- src/rgw/rgw_client_io.h | 48 +++++++++++----------- src/rgw/rgw_client_io_decoimpl.h | 70 ++++++++++++++++---------------- src/rgw/rgw_fcgi.cc | 16 ++++---- src/rgw/rgw_fcgi.h | 22 +++++----- src/rgw/rgw_loadgen.cc | 24 +++++------ src/rgw/rgw_loadgen.h | 20 ++++----- src/rgw/rgw_rest.cc | 12 +++--- src/rgw/rgw_rest.h | 6 +-- src/rgw/rgw_rest_swift.cc | 2 +- src/rgw/rgw_swift_auth.cc | 2 +- 16 files changed, 158 insertions(+), 158 deletions(-) diff --git a/src/rgw/rgw_asio_client.cc b/src/rgw/rgw_asio_client.cc index a274000e7738..06627b660c9f 100644 --- a/src/rgw/rgw_asio_client.cc +++ b/src/rgw/rgw_asio_client.cc @@ -78,8 +78,8 @@ void RGWAsioClientIO::init_env(CephContext *cct) // TODO: set REMOTE_USER if authenticated } -std::size_t RGWAsioClientIO::write_data(const char* const buf, - const std::size_t len) +size_t RGWAsioClientIO::write_data(const char* const buf, + const size_t len) { boost::system::error_code ec; auto bytes = boost::asio::write(socket, boost::asio::buffer(buf, len), ec); @@ -90,7 +90,7 @@ std::size_t RGWAsioClientIO::write_data(const char* const buf, return bytes; } -std::size_t RGWAsioClientIO::read_data(char* const buf, const std::size_t max) +size_t RGWAsioClientIO::read_data(char* const buf, const size_t max) { // read data from the body's bufferlist auto bytes = std::min(max, body_iter.get_remaining()); @@ -108,8 +108,8 @@ void RGWAsioClientIO::flush() return; } -std::size_t RGWAsioClientIO::send_status(const int status, - const char* const status_name) +size_t RGWAsioClientIO::send_status(const int status, + const char* const status_name) { static constexpr size_t STATUS_BUF_SIZE = 128; @@ -120,7 +120,7 @@ std::size_t RGWAsioClientIO::send_status(const int status, return write_data(statusbuf, statuslen); } -std::size_t RGWAsioClientIO::send_100_continue() +size_t RGWAsioClientIO::send_100_continue() { const char HTTTP_100_CONTINUE[] = "HTTP/1.1 100 CONTINUE\r\n\r\n"; return write_data(HTTTP_100_CONTINUE, sizeof(HTTTP_100_CONTINUE) - 1); @@ -139,7 +139,7 @@ static size_t dump_date_header(char (×tr)[TIME_BUF_SIZE]) "Date: %a, %d %b %Y %H:%M:%S %Z\r\n", tmp); } -std::size_t RGWAsioClientIO::complete_header() +size_t RGWAsioClientIO::complete_header() { size_t sent = 0; @@ -160,8 +160,8 @@ std::size_t RGWAsioClientIO::complete_header() return sent + write_data(HEADER_END, sizeof(HEADER_END) - 1); } -std::size_t RGWAsioClientIO::send_header(const boost::string_ref& name, - const boost::string_ref& value) +size_t RGWAsioClientIO::send_header(const boost::string_ref& name, + const boost::string_ref& value) { char hdrbuf[name.size() + 2 + value.size() + 2 + 1]; const auto hdrlen = snprintf(hdrbuf, sizeof(hdrbuf), "%.*s: %.*s\r\n", @@ -172,7 +172,7 @@ std::size_t RGWAsioClientIO::send_header(const boost::string_ref& name, return write_data(hdrbuf, hdrlen); } -std::size_t RGWAsioClientIO::send_content_length(const uint64_t len) +size_t RGWAsioClientIO::send_content_length(const uint64_t len) { static constexpr size_t CONLEN_BUF_SIZE = 128; diff --git a/src/rgw/rgw_asio_client.h b/src/rgw/rgw_asio_client.h index fc3d3577c22e..afbfa0fcee9c 100644 --- a/src/rgw/rgw_asio_client.h +++ b/src/rgw/rgw_asio_client.h @@ -39,8 +39,8 @@ class RGWAsioClientIO : public RGWRestfulIOEngine { RGWEnv env; void init_env(CephContext *cct) override; - std::size_t write_data(const char *buf, std::size_t len); - std::size_t read_data(char *buf, std::size_t max); + size_t write_data(const char *buf, size_t len); + size_t read_data(char *buf, size_t max); public: RGWAsioClientIO(tcp::socket&& socket, request_type&& request); @@ -48,18 +48,18 @@ class RGWAsioClientIO : public RGWRestfulIOEngine { int complete_request() override; void flush() override; - std::size_t send_status(int status, const char *status_name) override; - std::size_t send_100_continue() override; - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override; - std::size_t send_content_length(uint64_t len) override; - std::size_t complete_header() override; - - std::size_t recv_body(char* buf, std::size_t max) override { + size_t send_status(int status, const char *status_name) override; + size_t send_100_continue() override; + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override; + size_t send_content_length(uint64_t len) override; + size_t complete_header() override; + + size_t recv_body(char* buf, size_t max) override { return read_data(buf, max); } - std::size_t send_body(const char* buf, std::size_t len) override { + size_t send_body(const char* buf, size_t len) override { return write_data(buf, len); } diff --git a/src/rgw/rgw_civetweb.cc b/src/rgw/rgw_civetweb.cc index 025ae04ad3a7..518739331342 100644 --- a/src/rgw/rgw_civetweb.cc +++ b/src/rgw/rgw_civetweb.cc @@ -12,7 +12,7 @@ #define dout_subsys ceph_subsys_rgw -std::size_t RGWCivetWeb::write_data(const char *buf, std::size_t len) +size_t RGWCivetWeb::write_data(const char *buf, size_t len) { const int ret = mg_write(conn, buf, len); if (ret == 0) { @@ -32,7 +32,7 @@ RGWCivetWeb::RGWCivetWeb(mg_connection* const conn, const int port) { } -std::size_t RGWCivetWeb::read_data(char *buf, std::size_t len) +size_t RGWCivetWeb::read_data(char *buf, size_t len) { const int ret = mg_read(conn, buf, len); if (ret < 0) { @@ -116,7 +116,7 @@ void RGWCivetWeb::init_env(CephContext *cct) } template -static inline std::size_t safe_mg_printf(Args&&... args) +static inline size_t safe_mg_printf(Args&&... args) { const int ret = mg_printf(std::forward(args)...); if (ret == 0) { @@ -125,10 +125,10 @@ static inline std::size_t safe_mg_printf(Args&&... args) } else if (ret < 0) { throw RGWRestfulIOEngine::Exception(-ret, std::system_category()); } - return static_cast(ret); + return static_cast(ret); } -std::size_t RGWCivetWeb::send_status(int status, const char *status_name) +size_t RGWCivetWeb::send_status(int status, const char *status_name) { mg_set_http_status(conn, status); @@ -136,20 +136,20 @@ std::size_t RGWCivetWeb::send_status(int status, const char *status_name) status_name ? status_name : ""); } -std::size_t RGWCivetWeb::send_100_continue() +size_t RGWCivetWeb::send_100_continue() { const char HTTTP_100_CONTINUE[] = "HTTP/1.1 100 CONTINUE\r\n\r\n"; return write_data(HTTTP_100_CONTINUE, sizeof(HTTTP_100_CONTINUE) - 1); } -std::size_t RGWCivetWeb::send_header(const boost::string_ref& name, - const boost::string_ref& value) +size_t RGWCivetWeb::send_header(const boost::string_ref& name, + const boost::string_ref& value) { return safe_mg_printf(conn, "%.*s: %.*s\r\n", name.length(), name.data(), value.length(), value.data()); } -std::size_t RGWCivetWeb::dump_date_header() +size_t RGWCivetWeb::dump_date_header() { char timestr[TIME_BUF_SIZE]; @@ -169,9 +169,9 @@ std::size_t RGWCivetWeb::dump_date_header() return write_data(timestr, strlen(timestr)); } -std::size_t RGWCivetWeb::complete_header() +size_t RGWCivetWeb::complete_header() { - std::size_t sent = dump_date_header(); + size_t sent = dump_date_header(); if (explicit_keepalive) { constexpr char CONN_KEEP_ALIVE[] = "Connection: Keep-Alive\r\n"; @@ -185,7 +185,7 @@ std::size_t RGWCivetWeb::complete_header() return sent + write_data(HEADER_END, sizeof(HEADER_END) - 1); } -std::size_t RGWCivetWeb::send_content_length(uint64_t len) +size_t RGWCivetWeb::send_content_length(uint64_t len) { return safe_mg_printf(conn, "Content-Length: %" PRIu64 "\r\n", len); } diff --git a/src/rgw/rgw_civetweb.h b/src/rgw/rgw_civetweb.h index 86a60263cf31..5f91e311965c 100644 --- a/src/rgw/rgw_civetweb.h +++ b/src/rgw/rgw_civetweb.h @@ -20,25 +20,25 @@ class RGWCivetWeb : public RGWRestfulIOEngine bool explicit_keepalive; bool explicit_conn_close; - std::size_t write_data(const char *buf, std::size_t len); - std::size_t read_data(char *buf, std::size_t len); - std::size_t dump_date_header(); + size_t write_data(const char *buf, size_t len); + size_t read_data(char *buf, size_t len); + size_t dump_date_header(); public: void init_env(CephContext *cct); - std::size_t send_status(int status, const char *status_name) override; - std::size_t send_100_continue() override; - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override; - std::size_t send_content_length(uint64_t len) override; - std::size_t complete_header() override; + size_t send_status(int status, const char *status_name) override; + size_t send_100_continue() override; + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override; + size_t send_content_length(uint64_t len) override; + size_t complete_header() override; - std::size_t recv_body(char* buf, std::size_t max) override { + size_t recv_body(char* buf, size_t max) override { return read_data(buf, max); } - std::size_t send_body(const char* buf, std::size_t len) override { + size_t send_body(const char* buf, size_t len) override { return write_data(buf, len); } diff --git a/src/rgw/rgw_civetweb_frontend.cc b/src/rgw/rgw_civetweb_frontend.cc index 4de32b4cd197..802294264128 100644 --- a/src/rgw/rgw_civetweb_frontend.cc +++ b/src/rgw/rgw_civetweb_frontend.cc @@ -59,9 +59,9 @@ int RGWCivetWebFrontend::run() /* Prepare options for CivetWeb. */ const std::set rgw_opts = { "port", "prefix" }; - const std::size_t CW_NUM_OPTS = 2 * (conf_map.size() - rgw_opts.size()) + 1; + const size_t CW_NUM_OPTS = 2 * (conf_map.size() - rgw_opts.size()) + 1; const char *options[CW_NUM_OPTS]; - std::size_t i = 0; + size_t i = 0; for (const auto& pair : conf_map) { if (! rgw_opts.count(pair.first)) { diff --git a/src/rgw/rgw_client_io.cc b/src/rgw/rgw_client_io.cc index 745cfc03f143..9c572a96c76b 100644 --- a/src/rgw/rgw_client_io.cc +++ b/src/rgw/rgw_client_io.cc @@ -23,7 +23,7 @@ void RGWClientIO::init(CephContext *cct) { } -int RGWRestfulIO::recv_body(char *buf, std::size_t max, bool calculate_hash) +int RGWRestfulIO::recv_body(char *buf, size_t max, bool calculate_hash) { try { const auto sent = recv_body(buf, max); diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h index 09ae4acc5068..61de21dbcab2 100644 --- a/src/rgw/rgw_client_io.h +++ b/src/rgw/rgw_client_io.h @@ -46,14 +46,14 @@ class RGWRestfulIOEngine : public RGWClientIO { public: typedef std::system_error Exception; - virtual std::size_t send_status(int status, const char *status_name) = 0; - virtual std::size_t send_100_continue() = 0; + virtual size_t send_status(int status, const char *status_name) = 0; + virtual size_t send_100_continue() = 0; /* Send header to client. On success returns number of bytes sent to the direct * client of RadosGW. On failure throws int containing errno. boost::string_ref * is being used because of length it internally carries. */ - virtual std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) = 0; + virtual size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) = 0; /* Inform a client about a content length. Takes number of bytes supplied in * @len XOR one of the alternative modes for dealing with it passed as @mode. @@ -64,21 +64,21 @@ public: * - The method must be called EXACTLY ONE time. * - The method must be preceeded with a call to send_status(). * - The method must not be called after complete_header(). */ - virtual std::size_t send_content_length(uint64_t len) = 0; + virtual size_t send_content_length(uint64_t len) = 0; - virtual std::size_t send_chunked_transfer_encoding() { + virtual size_t send_chunked_transfer_encoding() { /* This is a null implementation. We don't send anything here, even the HTTP * header. The intended behaviour should be provided through a decorator or * directly by a given front-end. */ return 0; } - virtual std::size_t complete_header() = 0; + virtual size_t complete_header() = 0; /* Receive body. On success Returns number of bytes sent to the direct * client of RadosGW. On failure throws int containing errno. */ - virtual std::size_t recv_body(char* buf, std::size_t max) = 0; - virtual std::size_t send_body(const char* buf, std::size_t len) = 0; + virtual size_t recv_body(char* buf, size_t max) = 0; + virtual size_t send_body(const char* buf, size_t len) = 0; virtual void flush() = 0; }; @@ -124,38 +124,38 @@ public: : decoratee(std::move(decoratee)) { } - std::size_t send_status(const int status, - const char* const status_name) override { + size_t send_status(const int status, + const char* const status_name) override { return get_decoratee().send_status(status, status_name); } - std::size_t send_100_continue() override { + size_t send_100_continue() override { return get_decoratee().send_100_continue(); } - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override { + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override { return get_decoratee().send_header(name, value); } - std::size_t send_content_length(const uint64_t len) override { + size_t send_content_length(const uint64_t len) override { return get_decoratee().send_content_length(len); } - std::size_t send_chunked_transfer_encoding() override { + size_t send_chunked_transfer_encoding() override { return get_decoratee().send_chunked_transfer_encoding(); } - std::size_t complete_header() override { + size_t complete_header() override { return get_decoratee().complete_header(); } - std::size_t recv_body(char* const buf, const std::size_t max) override { + size_t recv_body(char* const buf, const size_t max) override { return get_decoratee().recv_body(buf, max); } - std::size_t send_body(const char* const buf, - const std::size_t len) override { + size_t send_body(const char* const buf, + const size_t len) override { return get_decoratee().send_body(buf, len); } @@ -199,7 +199,7 @@ public: } using RGWDecoratedRestfulIO::recv_body; - virtual int recv_body(char* buf, std::size_t max, bool calculate_hash); + virtual int recv_body(char* buf, size_t max, bool calculate_hash); std::string grab_aws4_sha256_hash(); }; /* RGWRestfulIO */ @@ -218,12 +218,12 @@ static inline RGWClientIOAccounter* ACCOUNTING_IO(struct req_state* s) { class RGWClientIOStreamBuf : public std::streambuf { protected: RGWRestfulIO &rio; - std::size_t const window_size; - std::size_t const putback_size; + size_t const window_size; + size_t const putback_size; std::vector buffer; public: - RGWClientIOStreamBuf(RGWRestfulIO &rio, std::size_t ws, std::size_t ps = 1) + RGWClientIOStreamBuf(RGWRestfulIO &rio, size_t ws, size_t ps = 1) : rio(rio), window_size(ws), putback_size(ps), diff --git a/src/rgw/rgw_client_io_decoimpl.h b/src/rgw/rgw_client_io_decoimpl.h index 66f2d563892a..cfecacfc8df0 100644 --- a/src/rgw/rgw_client_io_decoimpl.h +++ b/src/rgw/rgw_client_io_decoimpl.h @@ -27,8 +27,8 @@ public: total_received(0) { } - std::size_t send_status(const int status, - const char* const status_name) override { + size_t send_status(const int status, + const char* const status_name) override { const auto sent = RGWDecoratedRestfulIO::send_status(status, status_name); if (enabled) { total_sent += sent; @@ -36,7 +36,7 @@ public: return sent; } - std::size_t send_100_continue() override { + size_t send_100_continue() override { const auto sent = RGWDecoratedRestfulIO::send_100_continue(); if (enabled) { total_sent += sent; @@ -44,8 +44,8 @@ public: return sent; } - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override { + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override { const auto sent = RGWDecoratedRestfulIO::send_header(name, value); if (enabled) { total_sent += sent; @@ -53,7 +53,7 @@ public: return sent; } - std::size_t send_content_length(const uint64_t len) override { + size_t send_content_length(const uint64_t len) override { const auto sent = RGWDecoratedRestfulIO::send_content_length(len); if (enabled) { total_sent += sent; @@ -61,7 +61,7 @@ public: return sent; } - std::size_t send_chunked_transfer_encoding() override { + size_t send_chunked_transfer_encoding() override { const auto sent = RGWDecoratedRestfulIO::send_chunked_transfer_encoding(); if (enabled) { total_sent += sent; @@ -69,7 +69,7 @@ public: return sent; } - std::size_t complete_header() override { + size_t complete_header() override { const auto sent = RGWDecoratedRestfulIO::complete_header(); if (enabled) { total_sent += sent; @@ -77,7 +77,7 @@ public: return sent; } - std::size_t recv_body(char* buf, std::size_t max) override { + size_t recv_body(char* buf, size_t max) override { const auto received = RGWDecoratedRestfulIO::recv_body(buf, max); if (enabled) { total_received += received; @@ -85,8 +85,8 @@ public: return received; } - std::size_t send_body(const char* const buf, - const std::size_t len) override { + size_t send_body(const char* const buf, + const size_t len) override { const auto sent = RGWDecoratedRestfulIO::send_body(buf, len); if (enabled) { total_sent += sent; @@ -127,16 +127,16 @@ public: buffer_data(false) { } - std::size_t send_content_length(const uint64_t len) override; - std::size_t send_chunked_transfer_encoding() override; - std::size_t complete_header() override; - std::size_t send_body(const char* buf, std::size_t len) override; + size_t send_content_length(const uint64_t len) override; + size_t send_chunked_transfer_encoding() override; + size_t complete_header() override; + size_t send_body(const char* buf, size_t len) override; int complete_request() override; }; template -std::size_t RGWRestfulIOBufferingEngine::send_body(const char* const buf, - const std::size_t len) +size_t RGWRestfulIOBufferingEngine::send_body(const char* const buf, + const size_t len) { if (buffer_data) { data.append(buf, len); @@ -147,21 +147,21 @@ std::size_t RGWRestfulIOBufferingEngine::send_body(const char* const buf, } template -std::size_t RGWRestfulIOBufferingEngine::send_content_length(const uint64_t len) +size_t RGWRestfulIOBufferingEngine::send_content_length(const uint64_t len) { has_content_length = true; return RGWDecoratedRestfulIO::send_content_length(len); } template -std::size_t RGWRestfulIOBufferingEngine::send_chunked_transfer_encoding() +size_t RGWRestfulIOBufferingEngine::send_chunked_transfer_encoding() { has_content_length = true; return RGWDecoratedRestfulIO::send_chunked_transfer_encoding(); } template -std::size_t RGWRestfulIOBufferingEngine::complete_header() +size_t RGWRestfulIOBufferingEngine::complete_header() { if (! has_content_length) { /* We will dump everything in complete_request(). */ @@ -217,26 +217,26 @@ public: chunking_enabled(false) { } - std::size_t send_content_length(const uint64_t len) override { + size_t send_content_length(const uint64_t len) override { has_content_length = true; return RGWDecoratedRestfulIO::send_content_length(len); } - std::size_t send_chunked_transfer_encoding() override { + size_t send_chunked_transfer_encoding() override { has_content_length = false; chunking_enabled = true; return RGWDecoratedRestfulIO::send_header("Transfer-Encoding", "chunked"); } - std::size_t send_body(const char* buf, - const std::size_t len) override { + size_t send_body(const char* buf, + const size_t len) override { if (! chunking_enabled) { return RGWDecoratedRestfulIO::send_body(buf, len); } else { static constexpr char HEADER_END[] = "\r\n"; char sizebuf[32]; const auto slen = snprintf(sizebuf, sizeof(buf), "%" PRIx64 "\r\n", len); - std::size_t sent = 0; + size_t sent = 0; sent += RGWDecoratedRestfulIO::send_body(sizebuf, slen); sent += RGWDecoratedRestfulIO::send_body(buf, len); @@ -247,7 +247,7 @@ public: } int complete_request() override { - std::size_t sent = 0; + size_t sent = 0; if (chunking_enabled) { static constexpr char CHUNKED_RESP_END[] = "0\r\n\r\n"; @@ -284,8 +284,8 @@ public: action(ContentLengthAction::UNKNOWN) { } - std::size_t send_status(const int status, - const char* const status_name) override { + size_t send_status(const int status, + const char* const status_name) override { if (204 == status || 304 == status) { action = ContentLengthAction::INHIBIT; } else { @@ -295,7 +295,7 @@ public: return RGWDecoratedRestfulIO::send_status(status, status_name); } - std::size_t send_content_length(const uint64_t len) override { + size_t send_content_length(const uint64_t len) override { switch(action) { case ContentLengthAction::FORWARD: return RGWDecoratedRestfulIO::send_content_length(len); @@ -329,8 +329,8 @@ protected: std::vector> headers; - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override { + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override { switch (phase) { case ReorderState::RGW_EARLY_HEADERS: case ReorderState::RGW_STATUS_SEEN: @@ -351,14 +351,14 @@ public: phase(ReorderState::RGW_EARLY_HEADERS) { } - std::size_t send_status(const int status, - const char* const status_name) override { + size_t send_status(const int status, + const char* const status_name) override { phase = ReorderState::RGW_STATUS_SEEN; return RGWDecoratedRestfulIO::send_status(status, status_name); } - std::size_t send_content_length(const uint64_t len) override { + size_t send_content_length(const uint64_t len) override { if (ReorderState::RGW_EARLY_HEADERS == phase) { /* Oh great, someone tries to send content length before status. */ content_length = len; @@ -368,7 +368,7 @@ public: } } - std::size_t complete_header() override { + size_t complete_header() override { size_t sent = 0; /* Change state in order to immediately send everything we get. */ diff --git a/src/rgw/rgw_fcgi.cc b/src/rgw/rgw_fcgi.cc index 78b36686f953..de090be4c6b3 100644 --- a/src/rgw/rgw_fcgi.cc +++ b/src/rgw/rgw_fcgi.cc @@ -4,7 +4,7 @@ #include "rgw_fcgi.h" #include "acconfig.h" -std::size_t RGWFCGX::write_data(const char* const buf, const std::size_t len) +size_t RGWFCGX::write_data(const char* const buf, const size_t len) { const auto ret = FCGX_PutStr(buf, len, fcgx->out); if (ret < 0) { @@ -13,7 +13,7 @@ std::size_t RGWFCGX::write_data(const char* const buf, const std::size_t len) return ret; } -std::size_t RGWFCGX::read_data(char* const buf, const std::size_t len) +size_t RGWFCGX::read_data(char* const buf, const size_t len) { const auto ret = FCGX_GetStr(buf, len, fcgx->in); if (ret < 0) { @@ -32,7 +32,7 @@ void RGWFCGX::init_env(CephContext* const cct) env.init(cct, (char **)fcgx->envp); } -std::size_t RGWFCGX::send_status(const int status, const char* const status_name) +size_t RGWFCGX::send_status(const int status, const char* const status_name) { static constexpr size_t STATUS_BUF_SIZE = 128; @@ -43,15 +43,15 @@ std::size_t RGWFCGX::send_status(const int status, const char* const status_name return write_data(statusbuf, statuslen); } -std::size_t RGWFCGX::send_100_continue() +size_t RGWFCGX::send_100_continue() { const auto sent = send_status(100, "Continue"); flush(); return sent; } -std::size_t RGWFCGX::send_header(const boost::string_ref& name, - const boost::string_ref& value) +size_t RGWFCGX::send_header(const boost::string_ref& name, + const boost::string_ref& value) { char hdrbuf[name.size() + 2 + value.size() + 2 + 1]; const auto hdrlen = snprintf(hdrbuf, sizeof(hdrbuf), @@ -64,7 +64,7 @@ std::size_t RGWFCGX::send_header(const boost::string_ref& name, return write_data(hdrbuf, hdrlen); } -std::size_t RGWFCGX::send_content_length(const uint64_t len) +size_t RGWFCGX::send_content_length(const uint64_t len) { static constexpr size_t CONLEN_BUF_SIZE = 128; @@ -75,7 +75,7 @@ std::size_t RGWFCGX::send_content_length(const uint64_t len) return write_data(sizebuf, sizelen); } -std::size_t RGWFCGX::complete_header() +size_t RGWFCGX::complete_header() { static constexpr char HEADER_END[] = "\r\n"; return write_data(HEADER_END, sizeof(HEADER_END) - 1); diff --git a/src/rgw/rgw_fcgi.h b/src/rgw/rgw_fcgi.h index c0d9d4ad7725..2fb0582ab444 100644 --- a/src/rgw/rgw_fcgi.h +++ b/src/rgw/rgw_fcgi.h @@ -16,8 +16,8 @@ class RGWFCGX : public RGWRestfulIOEngine FCGX_Request *fcgx; RGWEnv env; - std::size_t read_data(char* buf, std::size_t len); - std::size_t write_data(const char* buf, std::size_t len); + size_t read_data(char* buf, size_t len); + size_t write_data(const char* buf, size_t len); public: explicit RGWFCGX(FCGX_Request* const fcgx) @@ -25,18 +25,18 @@ public: } void init_env(CephContext* cct) override; - std::size_t send_status(int status, const char* status_name) override; - std::size_t send_100_continue() override; - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override; - std::size_t send_content_length(uint64_t len) override; - std::size_t complete_header() override; - - std::size_t recv_body(char* buf, std::size_t max) override { + size_t send_status(int status, const char* status_name) override; + size_t send_100_continue() override; + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override; + size_t send_content_length(uint64_t len) override; + size_t complete_header() override; + + size_t recv_body(char* buf, size_t max) override { return read_data(buf, max); } - std::size_t send_body(const char* buf, std::size_t len) override { + size_t send_body(const char* buf, size_t len) override { return write_data(buf, len); } diff --git a/src/rgw/rgw_loadgen.cc b/src/rgw/rgw_loadgen.cc index 4c5f0ebc2143..451df92b2d21 100644 --- a/src/rgw/rgw_loadgen.cc +++ b/src/rgw/rgw_loadgen.cc @@ -46,16 +46,16 @@ int RGWLoadGenRequestEnv::sign(RGWAccessKey& access_key) return 0; } -std::size_t RGWLoadGenIO::write_data(const char* const buf, - const std::size_t len) +size_t RGWLoadGenIO::write_data(const char* const buf, + const size_t len) { return len; } -std::size_t RGWLoadGenIO::read_data(char* const buf, const std::size_t len) +size_t RGWLoadGenIO::read_data(char* const buf, const size_t len) { - const std::size_t read_len = std::min(left_to_read, - static_cast(len)); + const size_t read_len = std::min(left_to_read, + static_cast(len)); left_to_read -= read_len; return read_len; } @@ -96,29 +96,29 @@ void RGWLoadGenIO::init_env(CephContext *cct) env.set("SERVER_PORT", port_buf); } -std::size_t RGWLoadGenIO::send_status(const int status, - const char* const status_name) +size_t RGWLoadGenIO::send_status(const int status, + const char* const status_name) { return 0; } -std::size_t RGWLoadGenIO::send_100_continue() +size_t RGWLoadGenIO::send_100_continue() { return 0; } -std::size_t RGWLoadGenIO::send_header(const boost::string_ref& name, - const boost::string_ref& value) +size_t RGWLoadGenIO::send_header(const boost::string_ref& name, + const boost::string_ref& value) { return 0; } -std::size_t RGWLoadGenIO::complete_header() +size_t RGWLoadGenIO::complete_header() { return 0; } -std::size_t RGWLoadGenIO::send_content_length(const uint64_t len) +size_t RGWLoadGenIO::send_content_length(const uint64_t len) { return 0; } diff --git a/src/rgw/rgw_loadgen.h b/src/rgw/rgw_loadgen.h index 329d121cbf28..862fe270bc00 100644 --- a/src/rgw/rgw_loadgen.h +++ b/src/rgw/rgw_loadgen.h @@ -39,8 +39,8 @@ class RGWLoadGenIO : public RGWRestfulIOEngine RGWEnv env; void init_env(CephContext *cct) override; - std::size_t read_data(char *buf, std::size_t len); - std::size_t write_data(const char *buf, std::size_t len); + size_t read_data(char *buf, size_t len); + size_t write_data(const char *buf, size_t len); public: explicit RGWLoadGenIO(RGWLoadGenRequestEnv* const req) @@ -48,18 +48,18 @@ public: req(req) { } - std::size_t send_status(int status, const char *status_name) override; - std::size_t send_100_continue() override; - std::size_t send_header(const boost::string_ref& name, - const boost::string_ref& value) override; - std::size_t complete_header() override; - std::size_t send_content_length(uint64_t len) override; + size_t send_status(int status, const char *status_name) override; + size_t send_100_continue() override; + size_t send_header(const boost::string_ref& name, + const boost::string_ref& value) override; + size_t complete_header() override; + size_t send_content_length(uint64_t len) override; - std::size_t recv_body(char* buf, std::size_t max) override { + size_t recv_body(char* buf, size_t max) override { return read_data(buf, max); } - std::size_t send_body(const char* buf, std::size_t len) override { + size_t send_body(const char* buf, size_t len) override { return write_data(buf, len); } diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index bc76e79f5d1d..1ee068429ccb 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -497,8 +497,8 @@ void dump_redirect(struct req_state * const s, const std::string& redirect) return dump_header_if_nonempty(s, "Location", redirect); } -static std::size_t dump_time_header_impl(char (×tr)[TIME_BUF_SIZE], - const real_time t) +static size_t dump_time_header_impl(char (×tr)[TIME_BUF_SIZE], + const real_time t) { const utime_t ut(t); time_t secs = static_cast(ut.sec()); @@ -517,7 +517,7 @@ void dump_time_header(struct req_state *s, const char *name, real_time t) { char timestr[TIME_BUF_SIZE]; - const std::size_t len = dump_time_header_impl(timestr, t); + const size_t len = dump_time_header_impl(timestr, t); if (len == 0) { return; } @@ -812,7 +812,7 @@ void dump_range(struct req_state* const s, /* dumping range into temp buffer first, as libfcgi will fail to digest * %lld */ char range_buf[128]; - std::size_t len; + size_t len; if (! total) { len = snprintf(range_buf, sizeof(range_buf), "bytes */%lld", @@ -830,7 +830,7 @@ void dump_range(struct req_state* const s, int dump_body(struct req_state* const s, const char* const buf, - const std::size_t len) + const size_t len) { try { return RESTFUL_IO(s)->send_body(buf, len); @@ -851,7 +851,7 @@ int dump_body(struct req_state* const s, const std::string& str) int recv_body(struct req_state* const s, char* const buf, - const std::size_t max) + const size_t max) { try { return RESTFUL_IO(s)->recv_body(buf, max, s->aws4_auth_needs_complete); diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 37e70724072c..95766eb3a9a2 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -441,7 +441,7 @@ class RGWRESTMgr { bool should_log; protected: std::map resource_mgrs; - std::multimap resources_by_size; + std::multimap resources_by_size; RGWRESTMgr* default_mgr; public: @@ -601,10 +601,10 @@ extern void dump_access_control(struct req_state *s, const char *origin, uint32_t max_age); extern void dump_access_control(req_state *s, RGWOp *op); -extern int dump_body(struct req_state* s, const char* buf, std::size_t len); +extern int dump_body(struct req_state* s, const char* buf, size_t len); extern int dump_body(struct req_state* s, /* const */ ceph::buffer::list& bl); extern int dump_body(struct req_state* s, const std::string& str); -extern int recv_body(struct req_state* s, char* buf, std::size_t max); +extern int recv_body(struct req_state* s, char* buf, size_t max); #endif /* CEPH_RGW_REST_H */ diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 5745b7a723d1..17bb13de5934 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -1336,7 +1336,7 @@ int RGWBulkDelete_ObjStore_SWIFT::get_data( constexpr size_t MAX_LINE_SIZE = 2048; RGWClientIOStreamBuf ciosb(static_cast(*(s->cio)), - std::size_t(s->cct->_conf->rgw_max_chunk_size)); + size_t(s->cct->_conf->rgw_max_chunk_size)); istream cioin(&ciosb); char buf[MAX_LINE_SIZE]; diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index 1ddbc4f8a0f2..cbd5c8f35a1c 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -591,7 +591,7 @@ void RGW_SWIFT_Auth_Get::execute() goto done; { - static constexpr std::size_t PREFIX_LEN = strlen("AUTH_rgwtk"); + static constexpr size_t PREFIX_LEN = strlen("AUTH_rgwtk"); char token_val[PREFIX_LEN + bl.length() * 2 + 1]; snprintf(token_val, PREFIX_LEN + 1, "AUTH_rgwtk"); -- 2.47.3