X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/8c782efd93342c6119e8ba2ff6989b7a164b7f3d..6cfadda161ce19e6c8076d0aa118f8f436805a6a:/ftparchive/cachedb.cc diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index 7770a3244..ce6c865f3 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -34,18 +34,19 @@ #include /*}}}*/ -CacheDB::CacheDB(std::string const &DB) +CacheDB::CacheDB(std::string const &DB) : Dbp(0), Fd(NULL), DebFile(0) { TmpKey[0]='\0'; ReadyDB(DB); -}; +} CacheDB::~CacheDB() { ReadyDB(); delete DebFile; -}; + CloseFile(); +} // CacheDB::ReadyDB - Ready the DB2 /*{{{*/ // --------------------------------------------------------------------- @@ -322,12 +323,12 @@ bool CacheDB::LoadSource() /*{{{*/ if (Dsc.Read(FileName) == false) return false; - if (Dsc.Data == 0) + if (Dsc.Length == 0) return _error->Error(_("Failed to read .dsc")); - + // Write back the control information InitQuerySource(); - if (Put(Dsc.Data, Dsc.Length) == true) + if (Put(Dsc.Data.c_str(), Dsc.Length) == true) CurStat.Flags |= FlSource; return true; @@ -441,8 +442,8 @@ bool CacheDB::GetHashes(bool const GenOnly, unsigned int const DoHashes) if (OpenFile() == false) return false; - Hashes hashes; - if (Fd->Seek(0) == false || hashes.AddFD(*Fd, CurStat.FileSize, FlHashes) == false) + Hashes hashes(FlHashes); + if (Fd->Seek(0) == false || hashes.AddFD(*Fd, CurStat.FileSize) == false) return false; HashStringList hl = hashes.GetHashStringList(); @@ -473,6 +474,10 @@ bool CacheDB::GetHashes(bool const GenOnly, unsigned int const DoHashes) hex2bytes(CurStat.MD5, hs->HashValue().data(), sizeof(CurStat.MD5)); CurStat.Flags |= FlMD5; } + else if (strcasecmp(hs->HashType().c_str(), "Checksum-FileSize") == 0) + { + // we store it in a different field already + } else return _error->Error("Got unknown unrequested hashtype %s", hs->HashType().c_str()); }