did requested changes and added one change to allow all tests to succeed

in windows DLL
This commit is contained in:
Andreas Schönle 2017-04-30 17:41:02 +02:00
parent f0683ecbc9
commit 0a4b41dc20
2 changed files with 10 additions and 11 deletions

View File

@ -732,7 +732,8 @@ class Buffer {
template <typename T> template <typename T>
template <typename U> template <typename U>
void Buffer<T>::append(const U *begin, const U *end) { void Buffer<T>::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_) if (new_size > capacity_)
grow(new_size); grow(new_size);
std::uninitialized_copy(begin, end, std::uninitialized_copy(begin, end,

View File

@ -62,21 +62,21 @@ class IsZeroInt : public ArgVisitor<IsZeroInt, bool> {
}; };
// returns the default type for format specific "%s" // returns the default type for format specific "%s"
class DefaultType : public ArgVisitor<DefaultType, wchar_t> { class DefaultType : public ArgVisitor<DefaultType, char> {
public: 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 <typename T> template <typename T>
wchar_t visit_any_int(T) { return 'd'; } char visit_any_int(T) { return 'd'; }
template <typename T> template <typename T>
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 <typename T, typename U> template <typename T, typename U>
@ -495,9 +495,7 @@ void PrintfFormatter<Char, AF>::format(BasicCStringRef<Char> format_str) {
if (spec.type_ == 's') { if (spec.type_ == 's') {
// set the format type to the default if 's' is specified // set the format type to the default if 's' is specified
spec.type_ = internal::DefaultType().visit(arg);
// Avoid warning for wchar_t
spec.type_ = char(internal::DefaultType().visit(arg));
} }
if (arg.type <= Arg::LAST_INTEGER_TYPE) { if (arg.type <= Arg::LAST_INTEGER_TYPE) {