summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-06-20 17:12:41 +0200
committerJulian Andres Klode <jak@debian.org>2016-06-20 17:12:41 +0200
commit49ee5fa71d7df209a411db228a7532c4c56a28d0 (patch)
tree9667e3807014bce04407592007053e29d1dec59f
parent9515ed7bcdb32c7985ca83d309beda7155d02136 (diff)
parent51018e947ab1df3ddba5d7a84ed2284d599d8a12 (diff)
Merge pull request Debian/apt#16 from dombenson/master
Reinstate caching of file hashes in apt-ftparchive
-rw-r--r--ftparchive/cachedb.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc
index 17df9c1f1..868029abd 100644
--- a/ftparchive/cachedb.cc
+++ b/ftparchive/cachedb.cc
@@ -434,7 +434,24 @@ static void hex2bytes(uint8_t *bytes, const char *hex, int length) {
}
bool CacheDB::GetHashes(bool const GenOnly, unsigned int const DoHashes)
{
- unsigned int FlHashes = DoHashes & (Hashes::MD5SUM | Hashes::SHA1SUM | Hashes::SHA256SUM | Hashes::SHA512SUM);
+ unsigned int notCachedHashes = 0;
+ if ((CurStat.Flags & FlMD5) != FlMD5)
+ {
+ notCachedHashes = notCachedHashes | Hashes::MD5SUM;
+ }
+ if ((CurStat.Flags & FlSHA1) != FlSHA1)
+ {
+ notCachedHashes = notCachedHashes | Hashes::SHA1SUM;
+ }
+ if ((CurStat.Flags & FlSHA256) != FlSHA256)
+ {
+ notCachedHashes = notCachedHashes | Hashes::SHA256SUM;
+ }
+ if ((CurStat.Flags & FlSHA512) != FlSHA512)
+ {
+ notCachedHashes = notCachedHashes | Hashes::SHA512SUM;
+ }
+ unsigned int FlHashes = DoHashes & notCachedHashes;
HashesList.clear();
if (FlHashes != 0)