diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2021-01-25 01:43:16 +0100 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2021-01-25 01:47:14 +0100 |
commit | 2a1b43cab59734a5f903d2357a7e36a42c8976fe (patch) | |
tree | 01d7eab96bfa953c1c2da8ba7d35e9f711229427 | |
parent | 99b7bf15d034944f505649211b961234096124ff (diff) |
LibraryScanner: Fix incomplete migration to wider cache keys
lp1912945: The bug is caused by returning -1 if the directory is not
yet hashed. But -1 is now also a valid cache key!
Use mixxx::invalidCacheKey() instead of the number literals 0 and -1
that are not suitable anymore.
-rw-r--r-- | src/library/scanner/recursivescandirectorytask.cpp | 1 | ||||
-rw-r--r-- | src/library/scanner/scannerglobal.h | 6 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/library/scanner/recursivescandirectorytask.cpp b/src/library/scanner/recursivescandirectorytask.cpp index 243a552a6d..bf72cf2e04 100644 --- a/src/library/scanner/recursivescandirectorytask.cpp +++ b/src/library/scanner/recursivescandirectorytask.cpp @@ -74,7 +74,6 @@ void RecursiveScanDirectoryTask::run() { } } - // Note: A hash of "0" is a real hash if the directory contains no files! // Calculate a hash of the directory's file list. const mixxx::cache_key_t newHash = mixxx::cacheKeyFromMessageDigest(hasher.result()); diff --git a/src/library/scanner/scannerglobal.h b/src/library/scanner/scannerglobal.h index e97d0e19cc..d33c83eb9e 100644 --- a/src/library/scanner/scannerglobal.h +++ b/src/library/scanner/scannerglobal.h @@ -63,9 +63,9 @@ class ScannerGlobal { return m_trackLocations.contains(trackLocation); } - // Returns the directory hash if it exists or -1 if it doesn't. - inline mixxx::cache_key_t directoryHashInDatabase(const QString& directoryPath) const { - return m_directoryHashes.value(directoryPath, -1); + // Returns the directory hash if it exists or mixxx::invalidCacheKey() if it doesn't. + mixxx::cache_key_t directoryHashInDatabase(const QString& directoryPath) const { + return m_directoryHashes.value(directoryPath, mixxx::invalidCacheKey()); } inline bool directoryBlacklisted(const QString& directoryPath) const { |