From 0a4b41dc20d56024c63cb30b13241a2be5dfc1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Sch=C3=B6nle?= Date: Sun, 30 Apr 2017 17:41:02 +0200 Subject: [PATCH] did requested changes and added one change to allow all tests to succeed in windows DLL --- fmt/format.h | 3 ++- fmt/printf.h | 18 ++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index a8b5c479..7da44b8a 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -732,7 +732,8 @@ class Buffer { template template void Buffer::append(const U *begin, const U *end) { - std::size_t new_size = size_ + internal::to_unsigned(end - begin); + FMT_ASSERT(end >= begin, "negative value"); + std::size_t new_size = size_ + (end - begin); if (new_size > capacity_) grow(new_size); std::uninitialized_copy(begin, end, diff --git a/fmt/printf.h b/fmt/printf.h index 2d83c2fe..30cbc49b 100644 --- a/fmt/printf.h +++ b/fmt/printf.h @@ -62,21 +62,21 @@ class IsZeroInt : public ArgVisitor { }; // returns the default type for format specific "%s" -class DefaultType : public ArgVisitor { +class DefaultType : public ArgVisitor { public: - wchar_t visit_char(int) { return 'c'; } + char visit_char(int) { return 'c'; } - wchar_t visit_bool(bool) { return 's'; } + char visit_bool(bool) { return 's'; } - wchar_t visit_pointer(const void *) { return 'p'; } + char visit_pointer(const void *) { return 'p'; } template - wchar_t visit_any_int(T) { return 'd'; } + char visit_any_int(T) { return 'd'; } template - wchar_t visit_any_double(T) { return 'g'; } + char visit_any_double(T) { return 'g'; } - wchar_t visit_unhandled_arg() { return 's'; } + char visit_unhandled_arg() { return 's'; } }; template @@ -495,9 +495,7 @@ void PrintfFormatter::format(BasicCStringRef format_str) { if (spec.type_ == 's') { // set the format type to the default if 's' is specified - - // Avoid warning for wchar_t - spec.type_ = char(internal::DefaultType().visit(arg)); + spec.type_ = internal::DefaultType().visit(arg); } if (arg.type <= Arg::LAST_INTEGER_TYPE) {