[llvm-commits] CVS: llvm/lib/System/Win32/Path.inc
Reid Spencer
reid at x10sys.com
Sat Apr 7 11:52:37 PDT 2007
Changes in directory llvm/lib/System/Win32:
Path.inc updated: 1.63 -> 1.64
---
Log message:
For PR1291: http://llvm.org/PR1291 :
Implement the PathWithStatus class and its use throughout lib/System.
---
Diffs of the changes: (+15 -17)
Path.inc | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.63 llvm/lib/System/Win32/Path.inc:1.64
--- llvm/lib/System/Win32/Path.inc:1.63 Thu Mar 29 14:05:44 2007
+++ llvm/lib/System/Win32/Path.inc Sat Apr 7 13:52:17 2007
@@ -307,8 +307,8 @@
}
const FileStatus *
-Path::getFileStatus(bool update, std::string *ErrStr) const {
- if (status == 0 || update) {
+PathWithStatus::getFileStatus(bool update, std::string *ErrStr) const {
+ if (!fsIsValid || update) {
WIN32_FILE_ATTRIBUTE_DATA fi;
if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
MakeErrMsg(ErrStr, "getStatusInfo():" + std::string(path) +
@@ -316,30 +316,28 @@
return 0;
}
- if (status == 0)
- status = new FileStatus;
-
- status->fileSize = fi.nFileSizeHigh;
- status->fileSize <<= sizeof(fi.nFileSizeHigh)*8;
- status->fileSize += fi.nFileSizeLow;
-
- status->mode = fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0555 : 0777;
- status->user = 9999; // Not applicable to Windows, so...
- status->group = 9999; // Not applicable to Windows, so...
+ status.fileSize = fi.nFileSizeHigh;
+ status.fileSize <<= sizeof(fi.nFileSizeHigh)*8;
+ status.fileSize += fi.nFileSizeLow;
+
+ status.mode = fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0555 : 0777;
+ status.user = 9999; // Not applicable to Windows, so...
+ status.group = 9999; // Not applicable to Windows, so...
// FIXME: this is only unique if the file is accessed by the same file path.
// How do we do this for C:\dir\file and ..\dir\file ? Unix has inode
// numbers, but the concept doesn't exist in Windows.
- status->uniqueID = 0;
+ status.uniqueID = 0;
for (unsigned i = 0; i < path.length(); ++i)
- status->uniqueID += path[i];
+ status.uniqueID += path[i];
__int64 ft = *reinterpret_cast<__int64*>(&fi.ftLastWriteTime);
- status->modTime.fromWin32Time(ft);
+ status.modTime.fromWin32Time(ft);
- status->isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+ status.isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+ fsIsValid = true;
}
- return status;
+ return &status;
}
bool Path::makeReadableOnDisk(std::string* ErrMsg) {
More information about the llvm-commits
mailing list