mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
Silence warnings on Windows
This commit is contained in:
parent
8d07db0e0e
commit
3f574c1611
@ -488,10 +488,10 @@ FMT_FUNC int fmt::internal::UTF16ToUTF8::convert(fmt::WStringRef s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FMT_FUNC void fmt::WindowsError::init(
|
FMT_FUNC void fmt::WindowsError::init(
|
||||||
int error_code, StringRef format_str, ArgList args) {
|
int err_code, StringRef format_str, ArgList args) {
|
||||||
error_code_ = error_code;
|
error_code_ = err_code;
|
||||||
MemoryWriter w;
|
MemoryWriter w;
|
||||||
internal::format_windows_error(w, error_code, format(format_str, args));
|
internal::format_windows_error(w, err_code, format(format_str, args));
|
||||||
std::runtime_error &base = *this;
|
std::runtime_error &base = *this;
|
||||||
base = std::runtime_error(w.str());
|
base = std::runtime_error(w.str());
|
||||||
}
|
}
|
||||||
|
10
posix.cc
10
posix.cc
@ -134,13 +134,13 @@ void fmt::File::close() {
|
|||||||
|
|
||||||
fmt::LongLong fmt::File::size() const {
|
fmt::LongLong fmt::File::size() const {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER size = {};
|
LARGE_INTEGER filesize = {};
|
||||||
HANDLE handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd_));
|
HANDLE handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd_));
|
||||||
if (!FMT_SYSTEM(GetFileSizeEx(handle, &size)))
|
if (!FMT_SYSTEM(GetFileSizeEx(handle, &filesize)))
|
||||||
throw WindowsError(GetLastError(), "cannot get file size");
|
throw WindowsError(GetLastError(), "cannot get file size");
|
||||||
FMT_STATIC_ASSERT(sizeof(fmt::LongLong) >= sizeof(size.QuadPart),
|
FMT_STATIC_ASSERT(sizeof(fmt::LongLong) >= sizeof(filesize.QuadPart),
|
||||||
"return type of File::size is not large enough");
|
"return type of File::size is not large enough");
|
||||||
return size.QuadPart;
|
return filesize.QuadPart;
|
||||||
#else
|
#else
|
||||||
typedef struct stat Stat;
|
typedef struct stat Stat;
|
||||||
Stat file_stat = Stat();
|
Stat file_stat = Stat();
|
||||||
@ -228,7 +228,7 @@ fmt::BufferedFile fmt::File::fdopen(const char *mode) {
|
|||||||
|
|
||||||
long fmt::getpagesize() {
|
long fmt::getpagesize() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SYSTEM_INFO si = {};
|
SYSTEM_INFO si;
|
||||||
GetSystemInfo(&si);
|
GetSystemInfo(&si);
|
||||||
return si.dwPageSize;
|
return si.dwPageSize;
|
||||||
#else
|
#else
|
||||||
|
@ -699,9 +699,8 @@ void test_count_digits() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(UtilTest, StringRef) {
|
TEST(UtilTest, StringRef) {
|
||||||
char space[100];
|
char space[100] = "some string";
|
||||||
std::strcpy(space, "some string");
|
EXPECT_EQ(std::strlen(space), StringRef(space).size());
|
||||||
EXPECT_EQ(sizeof("some string") - 1, StringRef(space).size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UtilTest, CountDigits) {
|
TEST(UtilTest, CountDigits) {
|
||||||
|
Loading…
Reference in New Issue
Block a user