diff options
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r-- | lib/Support/Windows/Path.inc | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 9936343..f3460e4 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -269,6 +269,14 @@ std::string getMainExecutable(const char *argv0, void *MainExecAddr) { return ret != MAX_PATH ? pathname : ""; } +UniqueID file_status::getUniqueID() { + // The file is uniquely identified by the volume serial number along + // with the 64-bit file identifier. + uint64_t FileID = (static_cast<uint64_t>(FileIndexHigh) << 32ULL) | + static_cast<uint64_t>(FileIndexLow); + + return UniqueID(VolumeSerialNumber, FileID); +} TimeValue file_status::getLastModificationTime() const { ULARGE_INTEGER UI; @@ -533,25 +541,6 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) { return error_code::success(); } -error_code getUniqueID(const Twine Path, uint64_t &Result) { - file_status Status; - if (error_code E = status(Path, Status)) - return E; - - // The file is uniquely identified by the volume serial number along - // with the 64-bit file identifier. - Result = (static_cast<uint64_t>(Status.FileIndexHigh) << 32ULL) | - static_cast<uint64_t>(Status.FileIndexLow); - - // Because the serial number is 32-bits, but we've already used up all 64 - // bits for the file index, XOR the serial number into the high 32 bits of - // the resulting value. We could potentially get collisons from this, but - // the likelihood is low. - Result ^= (static_cast<uint64_t>(Status.VolumeSerialNumber) << 32ULL); - - return error_code::success(); -} - static bool isReservedName(StringRef path) { // This list of reserved names comes from MSDN, at: // http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx |