Fix warnings.

This commit is contained in:
Victor Zverovich 2014-08-18 07:03:12 -07:00
parent 61857356ea
commit 186734cf8b
2 changed files with 7 additions and 4 deletions

View File

@ -253,8 +253,8 @@ class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
arg_.int_value = static_cast<int>(static_cast<T>(value)); arg_.int_value = static_cast<int>(static_cast<T>(value));
} else { } else {
arg_.type = Arg::UINT; arg_.type = Arg::UINT;
arg_.uint_value = arg_.uint_value = static_cast<unsigned>(
static_cast<typename fmt::internal::MakeUnsigned<T>::Type>(value); static_cast<typename fmt::internal::MakeUnsigned<T>::Type>(value));
} }
} else { } else {
if (is_signed) { if (is_signed) {

View File

@ -296,7 +296,8 @@ void TestLength(const char *length_spec, U value) {
if (max <= std::numeric_limits<int>::max()) { if (max <= std::numeric_limits<int>::max()) {
signed_value = static_cast<int>(value); signed_value = static_cast<int>(value);
unsigned_value = static_cast<int>(value); unsigned_value = static_cast<int>(value);
} else if (max <= std::numeric_limits<unsigned>::max()) { } else if (static_cast<fmt::ULongLong>(max) <=
std::numeric_limits<unsigned>::max()) {
signed_value = static_cast<unsigned>(value); signed_value = static_cast<unsigned>(value);
unsigned_value = static_cast<unsigned>(value); unsigned_value = static_cast<unsigned>(value);
} }
@ -333,8 +334,10 @@ void TestLength(const char *length_spec) {
TestLength<T>(length_spec, -42); TestLength<T>(length_spec, -42);
TestLength<T>(length_spec, min); TestLength<T>(length_spec, min);
TestLength<T>(length_spec, max); TestLength<T>(length_spec, max);
if (min > std::numeric_limits<fmt::LongLong>::min()) if (min >= 0 || static_cast<fmt::LongLong>(min) >
std::numeric_limits<fmt::LongLong>::min()) {
TestLength<T>(length_spec, fmt::LongLong(min) - 1); TestLength<T>(length_spec, fmt::LongLong(min) - 1);
}
if (max < std::numeric_limits<fmt::LongLong>::max()) if (max < std::numeric_limits<fmt::LongLong>::max())
TestLength<T>(length_spec, fmt::LongLong(max) + 1); TestLength<T>(length_spec, fmt::LongLong(max) + 1);
TestLength<T>(length_spec, std::numeric_limits<short>::min()); TestLength<T>(length_spec, std::numeric_limits<short>::min());