Просмотр исходного кода

Merge pull request Debian/apt#16 from dombenson/master

Reinstate caching of file hashes in apt-ftparchive
Julian Andres Klode лет назад: 10
Родитель
Сommit
49ee5fa71d
1 измененных файлов с 18 добавлено и 1 удалено
  1. 18 1
      ftparchive/cachedb.cc

+ 18 - 1
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)