mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-04 17:26:42 +00:00
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.
This commit is contained in:
parent
29c10fbf6e
commit
241414028d
@ -22,7 +22,7 @@ template <class Char> class formatbuf : public std::basic_streambuf<Char> {
|
||||
buffer<Char>& buffer_;
|
||||
|
||||
public:
|
||||
formatbuf(buffer<Char>& buffer) : buffer_(buffer) {}
|
||||
formatbuf(buffer<Char>& buf) : buffer_(buf) {}
|
||||
|
||||
protected:
|
||||
// The put-area is actually always empty. This makes the implementation
|
||||
@ -72,26 +72,26 @@ template <typename T, typename Char> class is_streamable {
|
||||
// Write the content of buf to os.
|
||||
template <typename Char>
|
||||
void write(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
||||
const Char* data = buf.data();
|
||||
const Char* buf_data = buf.data();
|
||||
typedef std::make_unsigned<std::streamsize>::type UnsignedStreamSize;
|
||||
UnsignedStreamSize size = buf.size();
|
||||
UnsignedStreamSize max_size =
|
||||
internal::to_unsigned((std::numeric_limits<std::streamsize>::max)());
|
||||
do {
|
||||
UnsignedStreamSize n = size <= max_size ? size : max_size;
|
||||
os.write(data, static_cast<std::streamsize>(n));
|
||||
data += n;
|
||||
os.write(buf_data, static_cast<std::streamsize>(n));
|
||||
buf_data += n;
|
||||
size -= n;
|
||||
} while (size != 0);
|
||||
}
|
||||
|
||||
template <typename Char, typename T>
|
||||
void format_value(buffer<Char>& buffer, const T& value) {
|
||||
internal::formatbuf<Char> format_buf(buffer);
|
||||
void format_value(buffer<Char>& buf, const T& value) {
|
||||
internal::formatbuf<Char> format_buf(buf);
|
||||
std::basic_ostream<Char> 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<<.
|
||||
|
Loading…
Reference in New Issue
Block a user