From 393830a33a02d2f7163fcd4b27b7e5d6a46d8bac Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Thu, 8 Jun 2006 17:00:08 +0000 Subject: [PATCH] For PR804: Change the file size field of StatusInfo to be uint64_t instead of size_t so that we know it is always 64 bits. This prevents some overflow on systems where size_t is 32 bits when it ought to be 64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28726 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/System/Path.h | 2 +- lib/System/Win32/Path.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h index 5cbca9b31a9..bd3a5dffae5 100644 --- a/include/llvm/System/Path.h +++ b/include/llvm/System/Path.h @@ -67,7 +67,7 @@ namespace sys { struct StatusInfo { StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999), group(999), isDir(false) { } - size_t fileSize; ///< Size of the file in bytes + uint64_t fileSize; ///< Size of the file in bytes TimeValue modTime; ///< Time of file's modification uint32_t mode; ///< Mode of the file, if applicable uint32_t user; ///< User ID of owner, if applicable diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index f7be77f8c90..4aab2765488 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -340,7 +340,7 @@ Path::getStatusInfo(StatusInfo& info) const { ThrowError("getStatusInfo():" + std::string(path) + ": Can't get status: "); info.fileSize = fi.nFileSizeHigh; - info.fileSize <<= 32; + info.fileSize <<= sizeof(fi.nFileSizeHigh)*8; info.fileSize += fi.nFileSizeLow; info.mode = fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0555 : 0777; -- 2.34.1