mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 05:42:19 +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_;
|
buffer<Char>& buffer_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
formatbuf(buffer<Char>& buffer) : buffer_(buffer) {}
|
formatbuf(buffer<Char>& buf) : buffer_(buf) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// The put-area is actually always empty. This makes the implementation
|
// 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.
|
// Write the content of buf to os.
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
void write(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
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;
|
typedef std::make_unsigned<std::streamsize>::type UnsignedStreamSize;
|
||||||
UnsignedStreamSize size = buf.size();
|
UnsignedStreamSize size = buf.size();
|
||||||
UnsignedStreamSize max_size =
|
UnsignedStreamSize max_size =
|
||||||
internal::to_unsigned((std::numeric_limits<std::streamsize>::max)());
|
internal::to_unsigned((std::numeric_limits<std::streamsize>::max)());
|
||||||
do {
|
do {
|
||||||
UnsignedStreamSize n = size <= max_size ? size : max_size;
|
UnsignedStreamSize n = size <= max_size ? size : max_size;
|
||||||
os.write(data, static_cast<std::streamsize>(n));
|
os.write(buf_data, static_cast<std::streamsize>(n));
|
||||||
data += n;
|
buf_data += n;
|
||||||
size -= n;
|
size -= n;
|
||||||
} while (size != 0);
|
} while (size != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Char, typename T>
|
template <typename Char, typename T>
|
||||||
void format_value(buffer<Char>& buffer, const T& value) {
|
void format_value(buffer<Char>& buf, const T& value) {
|
||||||
internal::formatbuf<Char> format_buf(buffer);
|
internal::formatbuf<Char> format_buf(buf);
|
||||||
std::basic_ostream<Char> output(&format_buf);
|
std::basic_ostream<Char> output(&format_buf);
|
||||||
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||||
output << value;
|
output << value;
|
||||||
buffer.resize(buffer.size());
|
buf.resize(buf.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formats an object of type T that has an overloaded ostream operator<<.
|
// Formats an object of type T that has an overloaded ostream operator<<.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user