[clang-tidy] replace long long with uint64_t

Found with google-runtime-int

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-05-07 19:02:35 -07:00
parent 2fab5a8586
commit d4bf5fdecb
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
2 changed files with 4 additions and 4 deletions

View File

@ -310,7 +310,7 @@ class file {
// Returns the file size. The size has signed type for consistency with
// stat::st_size.
FMT_API long long size() const;
FMT_API int64_t size() const;
// Attempts to read count bytes from the file into the specified buffer.
FMT_API size_t read(void* buffer, size_t count) const;

View File

@ -201,7 +201,7 @@ void file::close() {
if (result != 0) FMT_THROW(system_error(errno, "cannot close file"));
}
auto file::size() const -> long long {
auto file::size() const -> int64_t {
# ifdef _WIN32
// Use GetFileSize instead of GetFileSizeEx for the case when _WIN32_WINNT
// is less than 0x0500 as is the case with some default MinGW builds.
@ -214,14 +214,14 @@ auto file::size() const -> long long {
if (error != NO_ERROR)
FMT_THROW(windows_error(GetLastError(), "cannot get file size"));
}
unsigned long long long_size = size_upper;
uint64_t long_size = size_upper;
return (long_size << sizeof(DWORD) * CHAR_BIT) | size_lower;
# else
using Stat = struct stat;
Stat file_stat = Stat();
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
FMT_THROW(system_error(errno, "cannot get file attributes"));
static_assert(sizeof(long long) >= sizeof(file_stat.st_size),
static_assert(sizeof(int64_t) >= sizeof(file_stat.st_size),
"return type of file::size is not large enough");
return file_stat.st_size;
# endif