From 241414028d97c74fc627d9b77a4b373b901d624e Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Fri, 3 May 2019 08:03:14 -0600 Subject: [PATCH] Eliminate shadowed variable warnings from gcc-7.2 The gcc-7.2.0 compiler (and others) were giving shadowed variable warnings for this include file. A simple renaming of a couple local variables eliminates the warnings. --- include/fmt/ostream.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 659cbaf3..4d7fd4b1 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -22,7 +22,7 @@ template class formatbuf : public std::basic_streambuf { buffer& buffer_; public: - formatbuf(buffer& buffer) : buffer_(buffer) {} + formatbuf(buffer& buf) : buffer_(buf) {} protected: // The put-area is actually always empty. This makes the implementation @@ -72,26 +72,26 @@ template class is_streamable { // Write the content of buf to os. template void write(std::basic_ostream& os, buffer& buf) { - const Char* data = buf.data(); + const Char* buf_data = buf.data(); typedef std::make_unsigned::type UnsignedStreamSize; UnsignedStreamSize size = buf.size(); UnsignedStreamSize max_size = internal::to_unsigned((std::numeric_limits::max)()); do { UnsignedStreamSize n = size <= max_size ? size : max_size; - os.write(data, static_cast(n)); - data += n; + os.write(buf_data, static_cast(n)); + buf_data += n; size -= n; } while (size != 0); } template -void format_value(buffer& buffer, const T& value) { - internal::formatbuf format_buf(buffer); +void format_value(buffer& buf, const T& value) { + internal::formatbuf format_buf(buf); std::basic_ostream output(&format_buf); output.exceptions(std::ios_base::failbit | std::ios_base::badbit); output << value; - buffer.resize(buffer.size()); + buf.resize(buf.size()); } // Formats an object of type T that has an overloaded ostream operator<<.