[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:
parent
2fab5a8586
commit
d4bf5fdecb
@ -310,7 +310,7 @@ class file {
|
|||||||
|
|
||||||
// Returns the file size. The size has signed type for consistency with
|
// Returns the file size. The size has signed type for consistency with
|
||||||
// stat::st_size.
|
// 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.
|
// Attempts to read count bytes from the file into the specified buffer.
|
||||||
FMT_API size_t read(void* buffer, size_t count) const;
|
FMT_API size_t read(void* buffer, size_t count) const;
|
||||||
|
|||||||
@ -201,7 +201,7 @@ void file::close() {
|
|||||||
if (result != 0) FMT_THROW(system_error(errno, "cannot close file"));
|
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
|
# ifdef _WIN32
|
||||||
// Use GetFileSize instead of GetFileSizeEx for the case when _WIN32_WINNT
|
// Use GetFileSize instead of GetFileSizeEx for the case when _WIN32_WINNT
|
||||||
// is less than 0x0500 as is the case with some default MinGW builds.
|
// 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)
|
if (error != NO_ERROR)
|
||||||
FMT_THROW(windows_error(GetLastError(), "cannot get file size"));
|
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;
|
return (long_size << sizeof(DWORD) * CHAR_BIT) | size_lower;
|
||||||
# else
|
# else
|
||||||
using Stat = struct stat;
|
using Stat = struct stat;
|
||||||
Stat file_stat = Stat();
|
Stat file_stat = Stat();
|
||||||
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
|
if (FMT_POSIX_CALL(fstat(fd_, &file_stat)) == -1)
|
||||||
FMT_THROW(system_error(errno, "cannot get file attributes"));
|
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 type of file::size is not large enough");
|
||||||
return file_stat.st_size;
|
return file_stat.st_size;
|
||||||
# endif
|
# endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user