diff options
author | Michael Vogt <mvo@debian.org> | 2014-06-18 08:32:47 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-06-18 08:32:47 +0200 |
commit | aa0bd601ea3db281187275bbbece760d85ff29d9 (patch) | |
tree | c84bebb3966255cdae36562024592c6b4eb6a2f2 /ftparchive/cachedb.h | |
parent | 80624be7c54aec6ed98ee254366155024fca1a71 (diff) | |
parent | 6074bc9ba4ecdd08674a828bdb46323b5d8bf957 (diff) |
Merge branch 'debian/sid' into debian/experimental
Conflicts:
debian/changelog
Diffstat (limited to 'ftparchive/cachedb.h')
-rw-r--r-- | ftparchive/cachedb.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h index 14dba5578..b40fd7df7 100644 --- a/ftparchive/cachedb.h +++ b/ftparchive/cachedb.h @@ -86,8 +86,12 @@ class CacheDB bool OpenDebFile(); void CloseDebFile(); - bool GetFileStat(bool const &doStat = false); + // GetCurStat needs some compat code, see lp #1274466) + bool GetCurStatCompatOldFormat(); + bool GetCurStatCompatNewFormat(); bool GetCurStat(); + + bool GetFileStat(bool const &doStat = false); bool LoadControl(); bool LoadContents(bool const &GenOnly); bool LoadSource(); @@ -99,6 +103,20 @@ class CacheDB FlSHA512=(1<<6), FlSource=(1<<7), }; + // the on-disk format changed (FileSize increased to 64bit) in + // commit 650faab0 which will lead to corruption with old caches + struct StatStoreOldFormat + { + uint32_t Flags; + uint32_t mtime; + uint32_t FileSize; + uint8_t MD5[16]; + uint8_t SHA1[20]; + uint8_t SHA256[32]; + } CurStatOldFormat; + + // WARNING: this struct is read/written to the DB so do not change the + // layout of the fields (see lp #1274466), only append to it struct StatStore { uint32_t Flags; @@ -150,7 +168,7 @@ class CacheDB SHA512Bytes(0),Packages(0), Misses(0), DeLinkBytes(0) {}; } Stats; - bool ReadyDB(std::string const &DB); + bool ReadyDB(std::string const &DB = ""); inline bool DBFailed() {return Dbp != 0 && DBLoaded == false;}; inline bool Loaded() {return DBLoaded == true;}; @@ -171,8 +189,8 @@ class CacheDB bool Clean(); - CacheDB(std::string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {TmpKey[0]='\0'; ReadyDB(DB);}; - ~CacheDB() {ReadyDB(std::string()); delete DebFile;}; + CacheDB(std::string const &DB); + ~CacheDB(); }; #endif |