From b31680990e40fb31ffcae0981216cb4a26f7792c Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 5 Dec 2018 07:11:06 -0800 Subject: [PATCH] Fix a warning --- test/format-test.cc | 5 +++-- test/ostream-test.cc | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/format-test.cc b/test/format-test.cc index 21ed824e..aa69a1a2 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -718,7 +718,7 @@ TEST(FormatToTest, WideString) { TEST(FormatToTest, FormatToNonbackInsertIteratorWithSignAndNumericAlignment) { char buffer[16] = {}; - fmt::format_to(buffer, "{: =+}", 42.0); + fmt::format_to(fmt::internal::make_checked(buffer, 16), "{: =+}", 42.0); EXPECT_STREQ("+42", buffer); } @@ -1633,7 +1633,8 @@ TEST(FormatterTest, CustomFormat) { TEST(FormatterTest, CustomFormatTo) { char buf[10] = {}; - auto end = fmt::format_to(buf, "{}", Answer()); + auto end = &*fmt::format_to( + fmt::internal::make_checked(buf, 10), "{}", Answer()); EXPECT_EQ(end, buf + 2); EXPECT_STREQ(buf, "42"); } diff --git a/test/ostream-test.cc b/test/ostream-test.cc index 76db8b3a..b93fedc6 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -147,11 +147,10 @@ TEST(OStreamTest, WriteToOStreamMaxSize) { testing::InSequence sequence; const char *data = FMT_NULL; - std::size_t size = max_size; + typedef std::make_unsigned::type ustreamsize; + ustreamsize size = max_size; do { - typedef std::make_unsigned::type ustreamsize; - ustreamsize n = std::min( - size, fmt::internal::to_unsigned(max_streamsize)); + auto n = std::min(size, fmt::internal::to_unsigned(max_streamsize)); EXPECT_CALL(streambuf, xsputn(data, static_cast(n))) .WillOnce(testing::Return(max_streamsize)); data += n;