From 072a30dbeb2775d1cdb9c4afeea1ce42cb680fc8 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 2 Mar 2023 12:25:23 +0000 Subject: Ensure explicit that we get 64 bit arithmetic. --- vespalib/src/vespa/fastos/unix_file.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vespalib/src/vespa/fastos/unix_file.cpp b/vespalib/src/vespa/fastos/unix_file.cpp index e8c30468a34..af4dc98820e 100644 --- a/vespalib/src/vespa/fastos/unix_file.cpp +++ b/vespalib/src/vespa/fastos/unix_file.cpp @@ -29,6 +29,10 @@ using fastos::File_RW_Ops; +namespace { + constexpr uint64_t ONE_G = 1000 * 1000 * 1000; +} + int FastOS_UNIX_File::GetLastOSError() { return errno; } @@ -61,8 +65,7 @@ FastOS_UNIX_File::GetPosition() return lseek(_filedes, 0, SEEK_CUR); } -void FastOS_UNIX_File::ReadBuf(void *buffer, size_t length, - int64_t readOffset) +void FastOS_UNIX_File::ReadBuf(void *buffer, size_t length, int64_t readOffset) { ssize_t readResult; @@ -94,7 +97,7 @@ FastOS_UNIX_File::Stat(const char *filename, FastOS_StatInfo *statInfo) statInfo->_isRegular = S_ISREG(stbuf.st_mode); statInfo->_isDirectory = S_ISDIR(stbuf.st_mode); statInfo->_size = static_cast(stbuf.st_size); - uint64_t modTimeNS = stbuf.st_mtime * 1000 * 1000 * 1000lu; + uint64_t modTimeNS = stbuf.st_mtime * ONE_G; #ifdef __linux__ modTimeNS += stbuf.st_mtim.tv_nsec; #elif defined(__APPLE__) -- cgit v1.2.3