forked from fmtlib/fmt
Fix a warning.
This commit is contained in:
@@ -537,7 +537,7 @@ void fmt::BasicWriter<Char>::FormatDouble(T value, const FormatSpec &spec) {
|
|||||||
template <typename Char>
|
template <typename Char>
|
||||||
template <typename StringChar>
|
template <typename StringChar>
|
||||||
void fmt::BasicWriter<Char>::write_str(
|
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')
|
if (spec.type_ && spec.type_ != 's')
|
||||||
internal::ReportUnknownType(spec.type_, "string");
|
internal::ReportUnknownType(spec.type_, "string");
|
||||||
const StringChar *s = str.value;
|
const StringChar *s = str.value;
|
||||||
@@ -1064,7 +1064,7 @@ void fmt::BasicWriter<Char>::FormatParser::Format(
|
|||||||
writer.write_str(arg.string, spec);
|
writer.write_str(arg.string, spec);
|
||||||
break;
|
break;
|
||||||
case Arg::WSTRING:
|
case Arg::WSTRING:
|
||||||
writer.write_str(arg.wstring, spec);
|
writer.write_str(internal::CharTraits<Char>::convert(arg.wstring), spec);
|
||||||
break;
|
break;
|
||||||
case Arg::POINTER:
|
case Arg::POINTER:
|
||||||
if (spec.type_ && spec.type_ != 'p')
|
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;
|
size_ += num_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Char>
|
||||||
|
struct StringValue {
|
||||||
|
const Char *value;
|
||||||
|
std::size_t size;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
class CharTraits;
|
class CharTraits;
|
||||||
|
|
||||||
@@ -379,6 +385,11 @@ class CharTraits<char> : public BasicCharTraits<char> {
|
|||||||
|
|
||||||
static char ConvertChar(char value) { return value; }
|
static char ConvertChar(char value) { return value; }
|
||||||
|
|
||||||
|
static StringValue<char> convert(StringValue<wchar_t>) {
|
||||||
|
StringValue<char> s = {"", 0};
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static int FormatFloat(char *buffer, std::size_t size,
|
static int FormatFloat(char *buffer, std::size_t size,
|
||||||
const char *format, unsigned width, int precision, T value);
|
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(char value) { return value; }
|
||||||
static wchar_t ConvertChar(wchar_t 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>
|
template <typename T>
|
||||||
static int FormatFloat(wchar_t *buffer, std::size_t size,
|
static int FormatFloat(wchar_t *buffer, std::size_t size,
|
||||||
const wchar_t *format, unsigned width, int precision, T value);
|
const wchar_t *format, unsigned width, int precision, T value);
|
||||||
@@ -605,12 +618,6 @@ struct ArgInfo {
|
|||||||
};
|
};
|
||||||
Type type;
|
Type type;
|
||||||
|
|
||||||
template <typename Char>
|
|
||||||
struct StringValue {
|
|
||||||
const Char *value;
|
|
||||||
std::size_t size;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef void (*FormatFunc)(
|
typedef void (*FormatFunc)(
|
||||||
void *writer, const void *arg, const FormatSpec &spec);
|
void *writer, const void *arg, const FormatSpec &spec);
|
||||||
|
|
||||||
@@ -1251,7 +1258,7 @@ class BasicWriter {
|
|||||||
|
|
||||||
template <typename StringChar>
|
template <typename StringChar>
|
||||||
void write_str(
|
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
|
// 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
|
// char stream and vice versa. If you want to print a wide string
|
||||||
|
Reference in New Issue
Block a user