diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-03-02 12:25:23 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-03-02 12:25:23 +0000 |
commit | 072a30dbeb2775d1cdb9c4afeea1ce42cb680fc8 (patch) | |
tree | c39683a526d901852579ee3243f356b744e071a9 | |
parent | e7ace51bcec8b95f77d8208369e391c3dd9b3792 (diff) |
Ensure explicit that we get 64 bit arithmetic.
-rw-r--r-- | vespalib/src/vespa/fastos/unix_file.cpp | 9 |
1 files 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<int64_t>(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__) |