Skip to content

Commit

Permalink
Warning fix on gcc 9.3.0 with logging disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
King_DuckZ committed Aug 15, 2020
1 parent 48bc608 commit 08b511c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/restc-cpp/restc-cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Request {
class Properties {
public:
using ptr_t = std::shared_ptr<Properties>;
using redirect_fn_t = std::function<void (int code, std::string& url,
using redirect_fn_t = std::function<void (int code, std::string& url,
const Reply& reply)>;

int maxRedirects = 3;
Expand Down Expand Up @@ -382,7 +382,7 @@ class RestClient {
done_handler.reset();
});

return move(future);
return future;
}


Expand Down
7 changes: 7 additions & 0 deletions src/ChunkedReaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ class ChunkedReaderImpl : public DataReader {
}

void Log(const boost::asio::const_buffers_1 buffers, const char *tag) {
#if __cplusplus >= 201703L
[[maybe_unused]]
#endif
const auto buf_len = boost::asio::buffer_size(*buffers.begin());

#if __cplusplus < 201703L
static_cast<void>(buf_len);
#endif

// At the time of the implementation, there are never multiple buffers.
RESTC_CPP_LOG_TRACE_(tag << ' ' << "# " << buf_len
<< " bytes: "
Expand Down
8 changes: 2 additions & 6 deletions src/IoWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class IoWriterImpl : public DataWriter {
connection_->GetSocket().AsyncWrite(buffers, ctx_.GetYield());
}

const auto bytes = boost::asio::buffer_size(buffers);

RESTC_CPP_LOG_TRACE_("Wrote #" << bytes
RESTC_CPP_LOG_TRACE_("Wrote #" << boost::asio::buffer_size(buffers)
<< " bytes to " << connection_);
}

Expand All @@ -49,9 +47,7 @@ class IoWriterImpl : public DataWriter {
connection_->GetSocket().AsyncWrite(buffers, ctx_.GetYield());
}

const auto bytes = boost::asio::buffer_size(buffers);

RESTC_CPP_LOG_TRACE_("Wrote #" << bytes
RESTC_CPP_LOG_TRACE_("Wrote #" << boost::asio::buffer_size(buffers)
<< " bytes to " << connection_);
}

Expand Down

0 comments on commit 08b511c

Please sign in to comment.