diff --git a/format.cc b/format.cc index 125893fb..a599cabf 100644 --- a/format.cc +++ b/format.cc @@ -537,7 +537,7 @@ void fmt::BasicWriter::FormatDouble(T value, const FormatSpec &spec) { template template void fmt::BasicWriter::write_str( - const Arg::StringValue &str, const FormatSpec &spec) { + const internal::StringValue &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::FormatParser::Format( writer.write_str(arg.string, spec); break; case Arg::WSTRING: - writer.write_str(arg.wstring, spec); + writer.write_str(internal::CharTraits::convert(arg.wstring), spec); break; case Arg::POINTER: if (spec.type_ && spec.type_ != 'p') diff --git a/format.h b/format.h index afa1e6aa..c4182588 100644 --- a/format.h +++ b/format.h @@ -355,6 +355,12 @@ void Array::append(const T *begin, const T *end) { size_ += num_elements; } +template +struct StringValue { + const Char *value; + std::size_t size; +}; + template class CharTraits; @@ -379,6 +385,11 @@ class CharTraits : public BasicCharTraits { static char ConvertChar(char value) { return value; } + static StringValue convert(StringValue) { + StringValue s = {"", 0}; + return s; + } + template static int FormatFloat(char *buffer, std::size_t size, const char *format, unsigned width, int precision, T value); @@ -392,6 +403,8 @@ class CharTraits : public BasicCharTraits { static wchar_t ConvertChar(char value) { return value; } static wchar_t ConvertChar(wchar_t value) { return value; } + static StringValue convert(StringValue s) { return s; } + template 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 - 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 void write_str( - const Arg::StringValue &str, const FormatSpec &spec); + const internal::StringValue &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