Fix/suppress MSVC warnings
This commit is contained in:
parent
63d7f3d116
commit
9ffe98c00e
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user