mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-27 06:35:37 +00:00
Fix a warning.
This commit is contained in:
parent
8e451911c9
commit
537c6c4e18
@ -537,7 +537,7 @@ void fmt::BasicWriter<Char>::FormatDouble(T value, const FormatSpec &spec) {
|
||||
template <typename Char>
|
||||
template <typename StringChar>
|
||||
void fmt::BasicWriter<Char>::write_str(
|
||||
const Arg::StringValue<StringChar> &str, const FormatSpec &spec) {
|
||||
const internal::StringValue<StringChar> &str, const FormatSpec &spec) {
|
||||
if (spec.type_ && spec.type_ != 's')
|
||||
internal::ReportUnknownType(spec.type_, "string");
|
||||
const StringChar *s = str.value;
|
||||
@ -1064,7 +1064,7 @@ void fmt::BasicWriter<Char>::FormatParser::Format(
|
||||
writer.write_str(arg.string, spec);
|
||||
break;
|
||||
case Arg::WSTRING:
|
||||
writer.write_str(arg.wstring, spec);
|
||||
writer.write_str(internal::CharTraits<Char>::convert(arg.wstring), spec);
|
||||
break;
|
||||
case Arg::POINTER:
|
||||
if (spec.type_ && spec.type_ != 'p')
|
||||
|
21
format.h
21
format.h
@ -355,6 +355,12 @@ void Array<T, SIZE>::append(const T *begin, const T *end) {
|
||||
size_ += num_elements;
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
struct StringValue {
|
||||
const Char *value;
|
||||
std::size_t size;
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
class CharTraits;
|
||||
|
||||
@ -379,6 +385,11 @@ class CharTraits<char> : public BasicCharTraits<char> {
|
||||
|
||||
static char ConvertChar(char value) { return value; }
|
||||
|
||||
static StringValue<char> convert(StringValue<wchar_t>) {
|
||||
StringValue<char> s = {"", 0};
|
||||
return s;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static int FormatFloat(char *buffer, std::size_t size,
|
||||
const char *format, unsigned width, int precision, T value);
|
||||
@ -392,6 +403,8 @@ class CharTraits<wchar_t> : public BasicCharTraits<wchar_t> {
|
||||
static wchar_t ConvertChar(char value) { return value; }
|
||||
static wchar_t ConvertChar(wchar_t value) { return value; }
|
||||
|
||||
static StringValue<wchar_t> convert(StringValue<wchar_t> s) { return s; }
|
||||
|
||||
template <typename T>
|
||||
static int FormatFloat(wchar_t *buffer, std::size_t size,
|
||||
const wchar_t *format, unsigned width, int precision, T value);
|
||||
@ -605,12 +618,6 @@ struct ArgInfo {
|
||||
};
|
||||
Type type;
|
||||
|
||||
template <typename Char>
|
||||
struct StringValue {
|
||||
const Char *value;
|
||||
std::size_t size;
|
||||
};
|
||||
|
||||
typedef void (*FormatFunc)(
|
||||
void *writer, const void *arg, const FormatSpec &spec);
|
||||
|
||||
@ -1251,7 +1258,7 @@ class BasicWriter {
|
||||
|
||||
template <typename StringChar>
|
||||
void write_str(
|
||||
const Arg::StringValue<StringChar> &str, const FormatSpec &spec);
|
||||
const internal::StringValue<StringChar> &str, const FormatSpec &spec);
|
||||
|
||||
// This method is private to disallow writing a wide string to a
|
||||
// char stream and vice versa. If you want to print a wide string
|
||||
|
Loading…
x
Reference in New Issue
Block a user