Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence warnings on Windows #114

Merged
merged 1 commit into from
Feb 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,10 @@ FMT_FUNC int fmt::internal::UTF16ToUTF8::convert(fmt::WStringRef s) {
}

FMT_FUNC void fmt::WindowsError::init(
int error_code, StringRef format_str, ArgList args) {
error_code_ = error_code;
int err_code, StringRef format_str, ArgList args) {
error_code_ = err_code;
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;
base = std::runtime_error(w.str());
}
Expand Down
10 changes: 5 additions & 5 deletions posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ void fmt::File::close() {

fmt::LongLong fmt::File::size() const {
#ifdef _WIN32
LARGE_INTEGER size = {};
LARGE_INTEGER filesize = {};
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");
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 size.QuadPart;
return filesize.QuadPart;
#else
typedef struct stat Stat;
Stat file_stat = Stat();
Expand Down Expand Up @@ -228,7 +228,7 @@ fmt::BufferedFile fmt::File::fdopen(const char *mode) {

long fmt::getpagesize() {
#ifdef _WIN32
SYSTEM_INFO si = {};
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
#else
Expand Down
5 changes: 2 additions & 3 deletions test/util-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -699,9 +699,8 @@ void test_count_digits() {
}

TEST(UtilTest, StringRef) {
char space[100];
std::strcpy(space, "some string");
EXPECT_EQ(sizeof("some string") - 1, StringRef(space).size());
char space[100] = "some string";
EXPECT_EQ(std::strlen(space), StringRef(space).size());
}

TEST(UtilTest, CountDigits) {
Expand Down