mirror of
https://github.com/fmtlib/fmt.git
synced 2025-08-05 21:54:44 +02:00
Remove IntTraits<uint32_t> because uint32_t is a typedef, not a built-in type. Rename ULLONG to ULONG_LONG for consistency with ulong_long_value. Remove extra whitespace.
This commit is contained in:
10
format.cc
10
format.cc
@@ -400,7 +400,7 @@ void fmt::BasicFormatter<Char>::CheckSign(const Char *&s, const Arg &arg) {
|
|||||||
ReportError(s,
|
ReportError(s,
|
||||||
Format("format specifier '{0}' requires numeric argument") << *s);
|
Format("format specifier '{0}' requires numeric argument") << *s);
|
||||||
}
|
}
|
||||||
if (arg.type == UINT || arg.type == ULONG || arg.type == ULLONG) {
|
if (arg.type == UINT || arg.type == ULONG || arg.type == ULONG_LONG) {
|
||||||
ReportError(s,
|
ReportError(s,
|
||||||
Format("format specifier '{0}' requires signed argument") << *s);
|
Format("format specifier '{0}' requires signed argument") << *s);
|
||||||
}
|
}
|
||||||
@@ -537,9 +537,9 @@ void fmt::BasicFormatter<Char>::DoFormat() {
|
|||||||
case ULONG:
|
case ULONG:
|
||||||
value = precision_arg.ulong_value;
|
value = precision_arg.ulong_value;
|
||||||
break;
|
break;
|
||||||
case ULLONG:
|
case ULONG_LONG:
|
||||||
value = precision_arg.ulong_long_value;
|
value = precision_arg.ulong_long_value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ReportError(s, "precision is not integer");
|
ReportError(s, "precision is not integer");
|
||||||
}
|
}
|
||||||
@@ -581,9 +581,9 @@ void fmt::BasicFormatter<Char>::DoFormat() {
|
|||||||
case ULONG:
|
case ULONG:
|
||||||
writer.FormatInt(arg.ulong_value, spec);
|
writer.FormatInt(arg.ulong_value, spec);
|
||||||
break;
|
break;
|
||||||
case ULLONG:
|
case ULONG_LONG:
|
||||||
writer.FormatInt(arg.ulong_long_value, spec);
|
writer.FormatInt(arg.ulong_long_value, spec);
|
||||||
break;
|
break;
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
writer.FormatDouble(arg.double_value, spec, precision);
|
writer.FormatDouble(arg.double_value, spec, precision);
|
||||||
break;
|
break;
|
||||||
|
10
format.h
10
format.h
@@ -189,9 +189,6 @@ struct SignedIntTraits {
|
|||||||
template <>
|
template <>
|
||||||
struct IntTraits<int> : SignedIntTraits<int, unsigned> {};
|
struct IntTraits<int> : SignedIntTraits<int, unsigned> {};
|
||||||
|
|
||||||
template <>
|
|
||||||
struct IntTraits<uint32_t> : SignedIntTraits<uint32_t, unsigned> {};
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct IntTraits<long> : SignedIntTraits<long, unsigned long> {};
|
struct IntTraits<long> : SignedIntTraits<long, unsigned long> {};
|
||||||
|
|
||||||
@@ -815,7 +812,7 @@ class BasicFormatter {
|
|||||||
|
|
||||||
enum Type {
|
enum Type {
|
||||||
// Numeric types should go first.
|
// Numeric types should go first.
|
||||||
INT, UINT, LONG, ULONG, ULLONG, DOUBLE, LONG_DOUBLE,
|
INT, UINT, LONG, ULONG, ULONG_LONG, DOUBLE, LONG_DOUBLE,
|
||||||
LAST_NUMERIC_TYPE = LONG_DOUBLE,
|
LAST_NUMERIC_TYPE = LONG_DOUBLE,
|
||||||
CHAR, STRING, WSTRING, POINTER, CUSTOM
|
CHAR, STRING, WSTRING, POINTER, CUSTOM
|
||||||
};
|
};
|
||||||
@@ -870,7 +867,8 @@ class BasicFormatter {
|
|||||||
Arg(unsigned value) : type(UINT), uint_value(value), formatter(0) {}
|
Arg(unsigned value) : type(UINT), uint_value(value), formatter(0) {}
|
||||||
Arg(long value) : type(LONG), long_value(value), formatter(0) {}
|
Arg(long value) : type(LONG), long_value(value), formatter(0) {}
|
||||||
Arg(unsigned long value) : type(ULONG), ulong_value(value), formatter(0) {}
|
Arg(unsigned long value) : type(ULONG), ulong_value(value), formatter(0) {}
|
||||||
Arg(unsigned long long value) : type(ULLONG), ulong_long_value(value), formatter(0) {}
|
Arg(unsigned long long value)
|
||||||
|
: type(ULONG_LONG), ulong_long_value(value), formatter(0) {}
|
||||||
Arg(float value) : type(DOUBLE), double_value(value), formatter(0) {}
|
Arg(float value) : type(DOUBLE), double_value(value), formatter(0) {}
|
||||||
Arg(double value) : type(DOUBLE), double_value(value), formatter(0) {}
|
Arg(double value) : type(DOUBLE), double_value(value), formatter(0) {}
|
||||||
Arg(long double value)
|
Arg(long double value)
|
||||||
@@ -1154,7 +1152,7 @@ class FormatInt {
|
|||||||
enum {BUFFER_SIZE = std::numeric_limits<uint64_t>::digits10 + 3};
|
enum {BUFFER_SIZE = std::numeric_limits<uint64_t>::digits10 + 3};
|
||||||
char buffer_[BUFFER_SIZE];
|
char buffer_[BUFFER_SIZE];
|
||||||
char *str_;
|
char *str_;
|
||||||
|
|
||||||
// Formats value in reverse and returns the number of digits.
|
// Formats value in reverse and returns the number of digits.
|
||||||
char *FormatDecimal(uint64_t value) {
|
char *FormatDecimal(uint64_t value) {
|
||||||
char *buffer_end = buffer_ + BUFFER_SIZE;
|
char *buffer_end = buffer_ + BUFFER_SIZE;
|
||||||
|
Reference in New Issue
Block a user