summaryrefslogtreecommitdiff
path: root/ftparchive/cachedb.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-04-27 18:23:20 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-05-09 13:06:27 +0200
commita311fb96b84757ef8628e6a754232614a53b7891 (patch)
tree1d76304ca36064edf4e33a27c2af0b3456d3505d /ftparchive/cachedb.h
parentb3501edb7091ca3aa6c2d6d96dc667b8161dd2b9 (diff)
deal with hashes in ftparchive more dynamic as well
Now that libapts acquire system happily passes around hashes and can be made to support new ones without an ABI break in the future, we can free ftparchive from all the deprecation warnings the last commit introduced for it. The goal here isn't to preserve ABI as we have none to keep here, but to help avoiding introduction problems of 'new' hashes later as bugs creep into the copy&paste parts, so short/less of them is good.
Diffstat (limited to 'ftparchive/cachedb.h')
-rw-r--r--ftparchive/cachedb.h31
1 files changed, 11 insertions, 20 deletions
diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h
index 54a274944..14dba5578 100644
--- a/ftparchive/cachedb.h
+++ b/ftparchive/cachedb.h
@@ -12,6 +12,7 @@
#ifndef CACHEDB_H
#define CACHEDB_H
+#include <apt-pkg/hashes.h>
#include <apt-pkg/debfile.h>
#include <db.h>
@@ -90,11 +91,8 @@ class CacheDB
bool LoadControl();
bool LoadContents(bool const &GenOnly);
bool LoadSource();
- bool GetMD5(bool const &GenOnly);
- bool GetSHA1(bool const &GenOnly);
- bool GetSHA256(bool const &GenOnly);
- bool GetSHA512(bool const &GenOnly);
-
+ bool GetHashes(bool const GenOnly, unsigned int const DoHashes);
+
// Stat info stored in the DB, Fixed types since it is written to disk.
enum FlagList {FlControl = (1<<0),FlMD5=(1<<1),FlContents=(1<<2),
FlSize=(1<<3), FlSHA1=(1<<4), FlSHA256=(1<<5),
@@ -124,12 +122,8 @@ class CacheDB
debDebFile::MemControlExtract Control;
ContentsExtract Contents;
DscExtract Dsc;
+ HashStringList HashesList;
- std::string MD5Res;
- std::string SHA1Res;
- std::string SHA256Res;
- std::string SHA512Res;
-
// Runtime statistics
struct Stats
{
@@ -165,16 +159,13 @@ class CacheDB
bool SetFile(std::string const &FileName,struct stat St,FileFd *Fd);
// terrible old overloaded interface
- bool GetFileInfo(std::string const &FileName,
- bool const &DoControl,
- bool const &DoContents,
- bool const &GenContentsOnly,
- bool const &DoSource,
- bool const &DoMD5,
- bool const &DoSHA1,
- bool const &DoSHA256,
- bool const &DoSHA512,
- bool const &checkMtime = false);
+ bool GetFileInfo(std::string const &FileName,
+ bool const &DoControl,
+ bool const &DoContents,
+ bool const &GenContentsOnly,
+ bool const DoSource,
+ unsigned int const DoHashes,
+ bool const &checkMtime = false);
bool Finish();