summaryrefslogtreecommitdiff
path: root/zen/file_id_def.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:25 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:25 +0200
commit94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70 (patch)
tree338d2ab72f79901f5d32c96d63cec36f30bcf44e /zen/file_id_def.h
parent4.4 (diff)
downloadFreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.tar.gz
FreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.tar.bz2
FreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.zip
4.5
Diffstat (limited to 'zen/file_id_def.h')
-rw-r--r--zen/file_id_def.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/zen/file_id_def.h b/zen/file_id_def.h
index b2029879..7e729eb1 100644
--- a/zen/file_id_def.h
+++ b/zen/file_id_def.h
@@ -29,13 +29,16 @@ FileId extractFileID(const BY_HANDLE_FILE_INFORMATION& fileInfo)
ULARGE_INTEGER uint = {};
uint.HighPart = fileInfo.nFileIndexHigh;
uint.LowPart = fileInfo.nFileIndexLow;
- return std::make_pair(fileInfo.dwVolumeSerialNumber, uint.QuadPart);
+
+ return fileInfo.dwVolumeSerialNumber != 0 && uint.QuadPart != 0 ?
+ FileId(fileInfo.dwVolumeSerialNumber, uint.QuadPart) : FileId();
}
inline
FileId extractFileID(DWORD dwVolumeSerialNumber, ULARGE_INTEGER fileId)
{
- return std::make_pair(dwVolumeSerialNumber, fileId.QuadPart);
+ return dwVolumeSerialNumber != 0 && fileId.QuadPart != 0 ?
+ FileId(dwVolumeSerialNumber, fileId.QuadPart) : FileId();
}
namespace impl
@@ -57,7 +60,8 @@ typedef std::pair<decltype(impl::StatDummy::st_dev), decltype(impl::StatDummy::s
inline
FileId extractFileID(const struct stat& fileInfo)
{
- return std::make_pair(fileInfo.st_dev, fileInfo.st_ino);
+ return fileInfo.st_dev != 0 && fileInfo.st_ino != 0 ?
+ FileId(fileInfo.st_dev, fileInfo.st_ino) : FileId();
}
#endif
}
bgstack15