From a311fb96b84757ef8628e6a754232614a53b7891 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Apr 2014 18:23:20 +0200 Subject: 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. --- ftparchive/cachedb.h | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'ftparchive/cachedb.h') 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 #include #include @@ -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(); -- cgit v1.2.3