Fix/suppress MSVC warnings

This commit is contained in:
vitaut 2016-03-19 06:39:33 -07:00
parent 63d7f3d116
commit 9ffe98c00e
4 changed files with 7 additions and 3 deletions

View File

@ -171,7 +171,7 @@ TEST(FormatTest, WriteToOStreamMaxSize) {
EXPECT_CALL(buffer, xsputn(data, static_cast<std::streamsize>(n)))
.WillOnce(testing::Return(max_streamsize));
data += n;
size -= n;
size -= static_cast<std::size_t>(n);
} while (size != 0);
fmt::write(os, w);
}

View File

@ -46,7 +46,7 @@ namespace {
std::string sanitize(const std::string &s) {
std::string result;
for (std::string::const_iterator i = s.begin(), end = s.end(); i != end; ++i)
result.push_back(*i & static_cast<char>(0xff));
result.push_back(static_cast<char>(*i & 0xff));
return result;
}

View File

@ -487,6 +487,9 @@ struct LocaleMock {
} *LocaleMock::instance;
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4273)
_locale_t _create_locale(int category, const char *locale) {
return LocaleMock::instance->newlocale(category, locale, 0);
}
@ -498,6 +501,7 @@ void _free_locale(_locale_t locale) {
double _strtod_l(const char *nptr, char **endptr, _locale_t locale) {
return LocaleMock::instance->strtod_l(nptr, endptr, locale);
}
# pragma warning(pop)
#endif
LocaleType newlocale(int category_mask, const char *locale, LocaleType base) {

View File

@ -379,7 +379,7 @@ TEST(PrintfTest, Bool) {
TEST(PrintfTest, Int) {
EXPECT_PRINTF("-42", "%d", -42);
EXPECT_PRINTF("-42", "%i", -42);
unsigned u = -42u;
unsigned u = 0 - 42u;
EXPECT_PRINTF(fmt::format("{}", u), "%u", -42);
EXPECT_PRINTF(fmt::format("{:o}", u), "%o", -42);
EXPECT_PRINTF(fmt::format("{:x}", u), "%x", -42);