From 32d9baeab02d2399eb8bd2dfa53bb4f679eebd88 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Aug 2011 11:13:50 +0200 Subject: * apt-pkg/packagemanager.cc, apt-pkg/pkgcache.cc: - ignore "self"-conflicts for all architectures of a package instead of just for the architecture of the package locked at in the ordering of installations too (Closes: #802901) --- apt-pkg/packagemanager.cc | 3 ++- apt-pkg/pkgcache.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 060cd3248..6601d9f6b 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -598,7 +598,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate) for (PrvIterator P = instVer.ProvidesList(); P.end() == false; ++P) - CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); + if (Pkg->Group != P.OwnerPkg()->Group) + CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index ed24d9ea8..6db025bd0 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -632,7 +632,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const continue; if (IsNegative() == true && - ParentPkg() == I.OwnerPkg()) + ParentPkg()->Group == I.OwnerPkg()->Group) continue; Size++; -- cgit v1.2.3 From 1207cf3f9bd77664d6b7de9b8a7fdd33c0bed23a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Aug 2011 22:52:25 +0200 Subject: * apt-pkg/acquire-item.cc: - if no Release.gpg file is found try to verify with hashes, but do not fail if a hash can't be found --- apt-pkg/acquire-item.cc | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 566f51606..39ce90dda 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1258,9 +1258,9 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, /*{{{* if (SigFile == "") { // There was no signature file, so we are finished. Download - // the indexes and do only hashsum verification + // the indexes and do only hashsum verification if possible MetaIndexParser->Load(DestFile); - QueueIndexes(true); + QueueIndexes(false); } else { @@ -1378,33 +1378,30 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/ ++Target) { HashString ExpectedIndexHash; - if (verify) + const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey); + if (Record == NULL) { - const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey); - if (Record == NULL) + if (verify == true && (*Target)->IsOptional() == false) { - if ((*Target)->IsOptional() == false) - { - Status = StatAuthError; - strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str()); - return; - } + Status = StatAuthError; + strprintf(ErrorText, _("Unable to find expected entry '%s' in Release file (Wrong sources.list entry or malformed file)"), (*Target)->MetaKey.c_str()); + return; } - else + } + else + { + ExpectedIndexHash = Record->Hash; + if (_config->FindB("Debug::pkgAcquire::Auth", false)) { - ExpectedIndexHash = Record->Hash; - if (_config->FindB("Debug::pkgAcquire::Auth", false)) - { - std::cerr << "Queueing: " << (*Target)->URI << std::endl; - std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl; - std::cerr << "For: " << Record->MetaKeyFilename << std::endl; - } - if (ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false) - { - Status = StatAuthError; - strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str()); - return; - } + std::cerr << "Queueing: " << (*Target)->URI << std::endl; + std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl; + std::cerr << "For: " << Record->MetaKeyFilename << std::endl; + } + if (verify == true && ExpectedIndexHash.empty() == true && (*Target)->IsOptional() == false) + { + Status = StatAuthError; + strprintf(ErrorText, _("Unable to find hash sum for '%s' in Release file"), (*Target)->MetaKey.c_str()); + return; } } -- cgit v1.2.3 From 95b5f6c19d361745c4e11b214f0f07ad10c9b5b3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Aug 2011 23:08:16 +0200 Subject: * apt-pkg/acquire.cc: - non-existing directories are by definition clean --- apt-pkg/acquire.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index a2da196be..ef120d8e9 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -445,6 +445,10 @@ pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I) if it is part of the download set. */ bool pkgAcquire::Clean(string Dir) { + // non-existing directories are by definition clean… + if (DirectoryExists(Dir) == false) + return true; + DIR *D = opendir(Dir.c_str()); if (D == 0) return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); -- cgit v1.2.3 From 8de79b68a834a6cc7abb8976e96ed19374fc02a2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 22 Aug 2011 23:10:15 +0200 Subject: remove the caches in 'apt-get update', too, as they will be invalid in most cases anyway --- apt-pkg/cachefile.cc | 14 ++++++++++++++ apt-pkg/cachefile.h | 1 + 2 files changed, 15 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 964c5bd8b..a76cfc08e 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -163,6 +163,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock) return true; } /*}}}*/ +// CacheFile::RemoveCaches - remove all cache files from disk /*{{{*/ +// --------------------------------------------------------------------- +/* */ +void pkgCacheFile::RemoveCaches() +{ + std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache"); + std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache"); + + if (pkgcache.empty() == false && RealFileExists(pkgcache) == true) + unlink(pkgcache.c_str()); + if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true) + unlink(srcpkgcache.c_str()); +} + /*}}}*/ // CacheFile::Close - close the cache files /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 09d3ec267..b4f41c6f4 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -57,6 +57,7 @@ class pkgCacheFile bool Open(OpProgress *Progress = NULL, bool WithLock = true); inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); }; __deprecated bool Open(OpProgress &Progress,bool const &WithLock = true) { return Open(&Progress, WithLock); }; + static void RemoveCaches(); void Close(); inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; }; -- cgit v1.2.3 From 3b8d17737d840f48a60f1d4d1af3c285047ad61e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 23 Aug 2011 20:17:19 +0200 Subject: print from their the visit came from --- apt-pkg/orderlist.cc | 22 +++++++++++----------- apt-pkg/orderlist.h | 4 +++- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index a58efa987..2fc0b6927 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -152,7 +152,7 @@ bool pkgOrderList::DoRun() iterator OldEnd = End; End = NList; for (iterator I = List; I != OldEnd; ++I) - if (VisitNode(PkgIterator(Cache,*I)) == false) + if (VisitNode(PkgIterator(Cache,*I), "DoRun") == false) { End = OldEnd; return false; @@ -519,7 +519,7 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical) if (Critical == false && IsMissing(D.ParentPkg()) == true) continue; - if (VisitNode(Pkg) == false) + if (VisitNode(Pkg, "Provides") == false) return false; } return true; @@ -530,7 +530,7 @@ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical) /* This is the core ordering routine. It calls the set dependency consideration functions which then potentialy call this again. Finite depth is achived through the colouring mechinism. */ -bool pkgOrderList::VisitNode(PkgIterator Pkg) +bool pkgOrderList::VisitNode(PkgIterator Pkg, char const* from) { // Looping or irrelevent. // This should probably trancend not installed packages @@ -541,7 +541,7 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg) if (Debug == true) { for (int j = 0; j != Depth; j++) clog << ' '; - clog << "Visit " << Pkg.FullName() << endl; + clog << "Visit " << Pkg.FullName() << " from " << from << endl; } Depth++; @@ -636,7 +636,7 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D) if (CheckDep(D) == true) continue; - if (VisitNode(D.ParentPkg()) == false) + if (VisitNode(D.ParentPkg(), "UnPackCrit") == false) return false; } else @@ -811,7 +811,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D) if (IsMissing(D.ParentPkg()) == true) continue; - if (VisitNode(D.ParentPkg()) == false) + if (VisitNode(D.ParentPkg(), "UnPackDep-Parent") == false) return false; } else @@ -825,7 +825,7 @@ bool pkgOrderList::DepUnPackDep(DepIterator D) if (CheckDep(D) == true) continue; - if (VisitNode(D.TargetPkg()) == false) + if (VisitNode(D.TargetPkg(), "UnPackDep-Target") == false) return false; } } @@ -924,7 +924,7 @@ bool pkgOrderList::DepRemove(DepIterator D) if (IsFlag(P, InList) == true && IsFlag(P, AddPending) == false && Cache[P].InstallVer != 0 && - VisitNode(P) == true) + VisitNode(P, "Remove-P") == true) { Flag(P, Immediate); tryFixDeps = false; @@ -960,7 +960,7 @@ bool pkgOrderList::DepRemove(DepIterator D) if (IsFlag(F.TargetPkg(), InList) == true && IsFlag(F.TargetPkg(), AddPending) == false && Cache[F.TargetPkg()].InstallVer != 0 && - VisitNode(F.TargetPkg()) == true) + VisitNode(F.TargetPkg(), "Remove-Target") == true) { Flag(F.TargetPkg(), Immediate); tryFixDeps = false; @@ -974,7 +974,7 @@ bool pkgOrderList::DepRemove(DepIterator D) if (IsFlag(Prv.OwnerPkg(), InList) == true && IsFlag(Prv.OwnerPkg(), AddPending) == false && Cache[Prv.OwnerPkg()].InstallVer != 0 && - VisitNode(Prv.OwnerPkg()) == true) + VisitNode(Prv.OwnerPkg(), "Remove-Owner") == true) { Flag(Prv.OwnerPkg(), Immediate); tryFixDeps = false; @@ -994,7 +994,7 @@ bool pkgOrderList::DepRemove(DepIterator D) if (IsMissing(D.ParentPkg()) == true) continue; - if (VisitNode(D.ParentPkg()) == false) + if (VisitNode(D.ParentPkg(), "Remove-Parent") == false) return false; } diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index bbceb3879..264f7ba03 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -18,6 +18,7 @@ #include +#include class pkgDepCache; class pkgOrderList : protected pkgCache::Namespace @@ -45,7 +46,8 @@ class pkgOrderList : protected pkgCache::Namespace bool Debug; // Main visit function - bool VisitNode(PkgIterator Pkg); + __deprecated bool VisitNode(PkgIterator Pkg) { return VisitNode(Pkg, "UNKNOWN"); }; + bool VisitNode(PkgIterator Pkg, char const* from); bool VisitDeps(DepFunc F,PkgIterator Pkg); bool VisitRDeps(DepFunc F,PkgIterator Pkg); bool VisitRProvides(DepFunc F,VerIterator Ver); -- cgit v1.2.3 From 05b64a6f78e3bf39142808a3dae41a2c4618f6b0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 24 Aug 2011 00:41:30 +0200 Subject: * apt-pkg/orderlist.cc: - prefer visiting packages marked for deletion in VisitProvides if we are operating on a negative dependency so that we can deal early with the fallout of this remove --- apt-pkg/orderlist.cc | 50 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 7 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 2fc0b6927..cae5b0a48 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -495,33 +495,69 @@ bool pkgOrderList::VisitRProvides(DepFunc F,VerIterator Ver) /*}}}*/ // OrderList::VisitProvides - Visit all of the providing packages /*{{{*/ // --------------------------------------------------------------------- -/* This routine calls visit on all providing packages. */ +/* This routine calls visit on all providing packages. + + If the dependency is negative it first visits packages which are + intended to be removed and after that all other packages. + It does so to avoid situations in which this package is used to + satisfy a (or-group/provides) dependency of another package which + could have been satisfied also by upgrading another package - + otherwise we have more broken packages dpkg needs to auto- + deconfigure and in very complicated situations it even decides + against it! */ bool pkgOrderList::VisitProvides(DepIterator D,bool Critical) -{ +{ SPtrArray List = D.AllTargets(); - for (Version **I = List; *I != 0; I++) + for (Version **I = List; *I != 0; ++I) { VerIterator Ver(Cache,*I); PkgIterator Pkg = Ver.ParentPkg(); + if (D.IsNegative() == true && Cache[Pkg].Delete() == false) + continue; + if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing) continue; - + if (D.IsNegative() == false && Cache[Pkg].InstallVer != *I) continue; - + if (D.IsNegative() == true && (Version *)Pkg.CurrentVer() != *I) continue; - + + // Skip over missing files + if (Critical == false && IsMissing(D.ParentPkg()) == true) + continue; + + if (VisitNode(Pkg, "Provides-1") == false) + return false; + } + if (D.IsNegative() == false) + return true; + for (Version **I = List; *I != 0; ++I) + { + VerIterator Ver(Cache,*I); + PkgIterator Pkg = Ver.ParentPkg(); + + if (Cache[Pkg].Delete() == true) + continue; + + if (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing) + continue; + + if ((Version *)Pkg.CurrentVer() != *I) + continue; + // Skip over missing files if (Critical == false && IsMissing(D.ParentPkg()) == true) continue; - if (VisitNode(Pkg, "Provides") == false) + if (VisitNode(Pkg, "Provides-2") == false) return false; } + return true; } /*}}}*/ -- cgit v1.2.3 From 884a4c0a3a6cba654e77478a086f26539bc5bd32 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 5 Sep 2011 14:50:30 +0200 Subject: * apt-pkg/indexrecords.cc: - fix Acquire::Max-ValidTime option by interpreting it really as seconds as specified in the manpage and not as days --- apt-pkg/indexrecords.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 10e154ad2..7852b99f0 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -113,7 +113,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/ } // get the user settings for this archive and use what expires earlier int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0); - if (Label.empty() == true) + if (Label.empty() == false) MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); if(MaxAge == 0) // No user settings, use the one from the Release file @@ -125,7 +125,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/ strprintf(ErrorText, _("Invalid 'Date' entry in Release file %s"), Filename.c_str()); return false; } - date += 24*60*60*MaxAge; + date += MaxAge; if (ValidUntil == 0 || ValidUntil > date) ValidUntil = date; -- cgit v1.2.3 From 89500a25b30d53ea0f5ae213c4207e13f35d1d61 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 5 Sep 2011 15:58:19 +0200 Subject: - add an Acquire::Min-ValidTime option (Closes: #640122) * doc/apt.conf.5.xml: - reword Acquire::Max-ValidTime documentation to make clear that it doesn't provide the new Min-ValidTime functionality --- apt-pkg/indexrecords.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 7852b99f0..ba5b7c846 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -115,8 +115,12 @@ bool indexRecords::Load(const string Filename) /*{{{*/ int MaxAge = _config->FindI("Acquire::Max-ValidTime", 0); if (Label.empty() == false) MaxAge = _config->FindI(string("Acquire::Max-ValidTime::" + Label).c_str(), MaxAge); + int MinAge = _config->FindI("Acquire::Min-ValidTime", 0); + if (Label.empty() == false) + MinAge = _config->FindI(string("Acquire::Min-ValidTime::" + Label).c_str(), MinAge); - if(MaxAge == 0) // No user settings, use the one from the Release file + if(MaxAge == 0 && + (MinAge == 0 || ValidUntil == 0)) // No user settings, use the one from the Release file return true; time_t date; @@ -125,10 +129,17 @@ bool indexRecords::Load(const string Filename) /*{{{*/ strprintf(ErrorText, _("Invalid 'Date' entry in Release file %s"), Filename.c_str()); return false; } - date += MaxAge; - if (ValidUntil == 0 || ValidUntil > date) - ValidUntil = date; + if (MinAge != 0 && ValidUntil != 0) { + time_t const min_date = date + MinAge; + if (ValidUntil < min_date) + ValidUntil = min_date; + } + if (MaxAge != 0) { + time_t const max_date = date + MaxAge; + if (ValidUntil == 0 || ValidUntil > max_date) + ValidUntil = max_date; + } return true; } -- cgit v1.2.3 From 30426f4822516bdd26528aa2e6d8d69c1291c8d3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 Sep 2011 12:35:22 +0200 Subject: M-A:same lockstep unpack should operate on installed packages first (LP: #835625) --- apt-pkg/packagemanager.cc | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 6601d9f6b..8b73b9980 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -603,18 +603,39 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate) List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - if (instVer->MultiArch == pkgCache::Version::Same) + if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same) + { + /* Do lockstep M-A:same unpacking in two phases: + First unpack all installed architectures, then the not installed. + This way we avoid that M-A: enabled packages are installed before + their older non-M-A enabled packages are replaced by newer versions */ + bool const installed = Pkg->CurrentVer != 0; + if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false) + return false; for (PkgIterator P = Pkg.Group().PackageList(); P.end() == false; P = Pkg.Group().NextPkg(P)) { - if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true || + if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true || Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) continue; - SmartUnPack(P, false); + if (SmartUnPack(P, false) == false) + return false; } - - if(Install(Pkg,FileNames[Pkg->ID]) == false) + if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false) + return false; + for (PkgIterator P = Pkg.Group().PackageList(); + P.end() == false; P = Pkg.Group().NextPkg(P)) + { + if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true || + Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) + continue; + if (SmartUnPack(P, false) == false) + return false; + } + } + else if (Install(Pkg,FileNames[Pkg->ID]) == false) return false; // Perform immedate configuration of the package. -- cgit v1.2.3 From ea54214002c09eeb4dd498d97a564471ec9993c5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Sep 2011 10:09:00 +0200 Subject: reorder includes: add if needed and include it at first --- apt-pkg/acquire-item.cc | 6 ++++-- apt-pkg/acquire-method.cc | 2 ++ apt-pkg/acquire-worker.cc | 8 +++++--- apt-pkg/acquire.cc | 6 ++++-- apt-pkg/algorithms.cc | 6 ++++-- apt-pkg/aptconfiguration.cc | 2 ++ apt-pkg/cachefile.cc | 4 +++- apt-pkg/cachefilter.cc | 2 ++ apt-pkg/cacheset.cc | 6 ++++-- apt-pkg/cdrom.cc | 5 +++-- apt-pkg/clean.cc | 6 ++++-- apt-pkg/contrib/cdromutl.cc | 6 ++++-- apt-pkg/contrib/cmndline.cc | 4 +++- apt-pkg/contrib/configuration.cc | 5 ++++- apt-pkg/contrib/crc-16.cc | 2 ++ apt-pkg/contrib/error.cc | 5 +++-- apt-pkg/contrib/fileutl.cc | 7 ++++--- apt-pkg/contrib/hashes.cc | 4 +++- apt-pkg/contrib/hashsum.cc | 1 + apt-pkg/contrib/md5.cc | 3 ++- apt-pkg/contrib/mmap.cc | 9 +++++---- apt-pkg/contrib/netrc.cc | 1 + apt-pkg/contrib/progress.cc | 6 ++++-- apt-pkg/contrib/sha1.cc | 3 ++- apt-pkg/contrib/sha2_internal.cc | 1 + apt-pkg/contrib/strutl.cc | 6 +++--- apt-pkg/deb/debindexfile.cc | 2 ++ apt-pkg/deb/deblistparser.cc | 2 ++ apt-pkg/deb/debmetaindex.cc | 1 + apt-pkg/deb/debrecords.cc | 2 ++ apt-pkg/deb/debsrcrecords.cc | 2 ++ apt-pkg/deb/debsystem.cc | 5 ++++- apt-pkg/deb/debversion.cc | 1 + apt-pkg/deb/dpkgpm.cc | 3 ++- apt-pkg/depcache.cc | 6 ++++-- apt-pkg/edsp.cc | 6 ++++-- apt-pkg/edsp/edspindexfile.cc | 2 ++ apt-pkg/edsp/edsplistparser.cc | 2 ++ apt-pkg/edsp/edspsystem.cc | 5 ++++- apt-pkg/indexcopy.cc | 6 ++++-- apt-pkg/indexfile.cc | 2 ++ apt-pkg/indexrecords.cc | 4 +++- apt-pkg/init.cc | 6 ++++-- apt-pkg/orderlist.cc | 2 ++ apt-pkg/packagemanager.cc | 8 +++++--- apt-pkg/pkgcache.cc | 7 ++++--- apt-pkg/pkgcachegen.cc | 7 +++---- apt-pkg/pkgrecords.cc | 6 ++++-- apt-pkg/pkgsystem.cc | 2 ++ apt-pkg/policy.cc | 6 ++++-- apt-pkg/sourcelist.cc | 6 ++++-- apt-pkg/srcrecords.cc | 6 ++++-- apt-pkg/tagfile.cc | 6 ++++-- apt-pkg/vendor.cc | 2 ++ apt-pkg/vendorlist.cc | 2 ++ apt-pkg/version.cc | 2 ++ apt-pkg/versionmatch.cc | 4 ++-- 57 files changed, 168 insertions(+), 71 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index aa77824f8..d798c7107 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -13,6 +13,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -24,8 +26,6 @@ #include #include -#include - #include #include #include @@ -33,6 +33,8 @@ #include #include #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 8c353beb2..69f7b1c57 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -15,6 +15,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 3e1fd98db..366879a57 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -12,6 +12,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -19,18 +21,18 @@ #include #include -#include - #include #include #include - + #include #include #include #include #include #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 2064abc50..e33dbb5d5 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -13,6 +13,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -21,8 +23,6 @@ #include #include -#include - #include #include #include @@ -30,6 +30,8 @@ #include #include #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 8737c5334..d5652791c 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -14,6 +14,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -22,13 +24,13 @@ #include #include -#include #include #include #include #include - #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index e8c8e73d0..71e0b8e73 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 964c5bd8b..b60b1cc0f 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -12,6 +12,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -21,7 +23,7 @@ #include #include #include - + #include /*}}}*/ // CacheFile::CacheFile - Constructor /*{{{*/ diff --git a/apt-pkg/cachefilter.cc b/apt-pkg/cachefilter.cc index 8f0725ea3..210a9a9ab 100644 --- a/apt-pkg/cachefilter.cc +++ b/apt-pkg/cachefilter.cc @@ -4,6 +4,8 @@ Collection of functor classes */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index a1de613e2..386ecfb5f 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -9,6 +9,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -16,11 +18,11 @@ #include #include -#include - #include #include + +#include /*}}}*/ namespace APT { // FromTask - Return all packages in the cache from a specific task /*{{{*/ diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 2a914c665..c432cf509 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -1,5 +1,6 @@ /* */ +#include #include #include @@ -10,8 +11,6 @@ #include #include -#include -#include #include #include #include @@ -22,6 +21,8 @@ #include "indexcopy.h" +#include + using namespace std; // FindPackages - Find the package files on the CDROM /*{{{*/ diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 629afd7cf..2e5fd675a 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -8,17 +8,19 @@ ##################################################################### */ /*}}}*/ // Includes /*{{{*/ +#include + #include #include #include #include #include -#include - #include #include #include + +#include /*}}}*/ // ArchiveCleaner::Go - Perform smart cleanup of the archive /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 821e6d688..7f30f132d 100644 --- a/apt-pkg/contrib/cdromutl.cc +++ b/apt-pkg/contrib/cdromutl.cc @@ -10,6 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -17,8 +19,6 @@ #include #include -#include - #include #include #include @@ -26,6 +26,8 @@ #include #include #include + +#include /*}}}*/ // IsMounted - Returns true if the mount point is mounted /*{{{*/ diff --git a/apt-pkg/contrib/cmndline.cc b/apt-pkg/contrib/cmndline.cc index 5a9944096..34e90da20 100644 --- a/apt-pkg/contrib/cmndline.cc +++ b/apt-pkg/contrib/cmndline.cc @@ -11,11 +11,13 @@ ##################################################################### */ /*}}}*/ // Include files /*{{{*/ +#include + #include #include #include -#include +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 0664e3704..b3e9d8863 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -15,16 +15,19 @@ ##################################################################### */ /*}}}*/ // Include files /*{{{*/ +#include + #include #include #include #include -#include #include #include #include +#include + using namespace std; /*}}}*/ diff --git a/apt-pkg/contrib/crc-16.cc b/apt-pkg/contrib/crc-16.cc index b300ed67e..26ea1ba28 100644 --- a/apt-pkg/contrib/crc-16.cc +++ b/apt-pkg/contrib/crc-16.cc @@ -15,6 +15,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include /*}}}*/ diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 18810d2a4..56bbd1c60 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -13,6 +13,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include @@ -24,8 +26,7 @@ #include #include -#include "config.h" - /*}}}*/ + /*}}}*/ // Global Error Object /*{{{*/ /* If the implementation supports posix threads then the accessor function diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 50019872e..690e2403c 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -18,14 +18,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include #include -#include - #include #include #include @@ -43,10 +43,11 @@ #include #include -#include #ifdef WORDS_BIGENDIAN #include #endif + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 4407574fa..9c251e89f 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -11,12 +11,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include -#include +#include #include #include /*}}}*/ diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc index 728747d7a..28f711176 100644 --- a/apt-pkg/contrib/hashsum.cc +++ b/apt-pkg/contrib/hashsum.cc @@ -1,4 +1,5 @@ // Cryptographic API Base +#include #include #include "hashsum_template.h" diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index 65e20e9bb..b53c4fbd2 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -35,6 +35,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -43,7 +45,6 @@ #include #include // For htonl #include -#include /*}}}*/ // byteSwap - Swap bytes in a buffer /*{{{*/ diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 19381ae47..3cd87eda4 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -17,20 +17,21 @@ /*}}}*/ // Include Files /*{{{*/ #define _BSD_SOURCE +#include + #include #include -#include - #include #include #include #include #include #include - #include - /*}}}*/ + +#include + /*}}}*/ // MMap::MMap - Constructor /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc index 34f472ee1..456ada950 100644 --- a/apt-pkg/contrib/netrc.cc +++ b/apt-pkg/contrib/netrc.cc @@ -11,6 +11,7 @@ ##################################################################### */ /*}}}*/ +#include #include #include diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 84ee4c124..6cd6134d3 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -8,15 +8,17 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include -#include - #include #include #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index 4b0552102..9416895ac 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -29,6 +29,8 @@ */ /*}}} */ // Include Files /*{{{*/ +#include + #include #include #include @@ -36,7 +38,6 @@ #include #include #include -#include /*}}}*/ // SHA1Transform - Alters an existing SHA-1 hash /*{{{*/ diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc index 565db2f91..ff995cdf2 100644 --- a/apt-pkg/contrib/sha2_internal.cc +++ b/apt-pkg/contrib/sha2_internal.cc @@ -31,6 +31,7 @@ * * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ */ +#include #include /* memcpy()/memset() or bcopy()/bzero() */ #include /* assert() */ diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 072dda3ac..6586ef17b 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -15,12 +15,12 @@ ##################################################################### */ /*}}}*/ // Includes /*{{{*/ +#include + #include #include #include -#include - #include #include #include @@ -31,7 +31,7 @@ #include #include -#include "config.h" +#include using namespace std; /*}}}*/ diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index c9e7f1176..303dab796 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -9,6 +9,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b708296d3..6b8fbce99 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -10,6 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 81afb22b6..aaae906dd 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1,4 +1,5 @@ // ijones, walters +#include #include #include diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 1ca9ae1d2..db62d6c45 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 749305005..c9c20267b 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -9,6 +9,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 7644bc66b..080af5659 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -10,6 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -17,11 +19,12 @@ #include #include #include -#include #include #include #include #include + +#include /*}}}*/ debSystem debSys; diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc index 755ffbe96..ba32b2dd4 100644 --- a/apt-pkg/deb/debversion.cc +++ b/apt-pkg/deb/debversion.cc @@ -11,6 +11,7 @@ /*}}}*/ // Include Files /*{{{*/ #define APT_COMPATIBILITY 986 +#include #include #include diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 019b72bb8..7733390c0 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Includes /*{{{*/ +#include + #include #include #include @@ -40,7 +42,6 @@ #include #include -#include #include /*}}}*/ diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 72a0bb542..0fbd77fd8 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -23,12 +25,12 @@ #include #include -#include +#include #include #include -#include +#include /*}}}*/ // helper for Install-Recommends-Sections and Never-MarkAuto-Sections /*{{{*/ static bool diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 4d2230613..44f7dbfd6 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -5,6 +5,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -12,10 +14,10 @@ #include #include -#include #include - #include + +#include /*}}}*/ // we could use pkgCache::DepType and ::Priority, but these would be localized strings… diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index f5881e663..b417a7562 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -6,6 +6,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 3349e8cce..e00abdbcc 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -9,6 +9,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index ac0bb8beb..10d75771a 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -9,17 +9,20 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include #include #include -#include #include #include #include #include + +#include /*}}}*/ edspSystem edspSys; diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 31c577705..dcba78dce 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -10,7 +10,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include "indexcopy.h" +#include #include #include @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -30,6 +29,9 @@ #include #include #include + +#include "indexcopy.h" +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index 37be87055..b56d9dc6c 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 10e154ad2..00f520c4f 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -3,15 +3,17 @@ // $Id: indexrecords.cc,v 1.1.2.4 2003/12/30 02:11:43 mdz Exp $ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include #include -#include #include #include +#include /*}}}*/ string indexRecords::GetDist() const { diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 8f20c31df..97a39e96e 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -8,14 +8,16 @@ ##################################################################### */ /*}}}*/ // Include files /*{{{*/ +#include + #include #include #include -#include -#include #include #include + +#include /*}}}*/ #define Stringfy_(x) # x diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc index 19661fc2d..4dcb31b7e 100644 --- a/apt-pkg/orderlist.cc +++ b/apt-pkg/orderlist.cc @@ -63,6 +63,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 1ae09347a..6f9f4748f 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -13,6 +13,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -22,10 +24,10 @@ #include #include #include - -#include + +#include #include -#include +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 951caeb78..0a81cb791 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -20,6 +20,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -29,13 +31,12 @@ #include #include -#include - #include #include #include - #include + +#include /*}}}*/ using std::string; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index b89c8c0d3..1cae23134 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -11,6 +11,7 @@ /*}}}*/ // Include Files /*{{{*/ #define APT_COMPATIBILITY 986 +#include #include #include @@ -23,17 +24,15 @@ #include #include #include - #include -#include - #include - #include #include #include #include + +#include /*}}}*/ typedef vector::iterator FileIterator; template std::vector pkgCacheGenerator::Dynamic::toReMap; diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc index e506de73a..9459f7def 100644 --- a/apt-pkg/pkgrecords.cc +++ b/apt-pkg/pkgrecords.cc @@ -9,12 +9,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include - -#include + +#include /*}}}*/ // Records::pkgRecords - Constructor /*{{{*/ diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc index 6dd2d3ee4..f61c140fa 100644 --- a/apt-pkg/pkgsystem.cc +++ b/apt-pkg/pkgsystem.cc @@ -10,6 +10,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index be96d4c84..372b58a7c 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -23,6 +23,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include @@ -31,10 +33,10 @@ #include #include -#include - #include #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 851eefdfe..d4eec5c8d 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -8,15 +8,17 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include #include -#include - #include + +#include /*}}}*/ using namespace std; diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc index 46a02b55c..b368322f5 100644 --- a/apt-pkg/srcrecords.cc +++ b/apt-pkg/srcrecords.cc @@ -11,12 +11,14 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include #include - -#include + +#include /*}}}*/ // SrcRecords::pkgSrcRecords - Constructor /*{{{*/ diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index a8f04b23a..3b491fcd2 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -11,15 +11,17 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include #include -#include - #include #include #include + +#include /*}}}*/ using std::string; diff --git a/apt-pkg/vendor.cc b/apt-pkg/vendor.cc index 2350afe69..eab6d448f 100644 --- a/apt-pkg/vendor.cc +++ b/apt-pkg/vendor.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc index 48ac12cee..8432091e8 100644 --- a/apt-pkg/vendorlist.cc +++ b/apt-pkg/vendorlist.cc @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/apt-pkg/version.cc b/apt-pkg/version.cc index 42e449d36..a9d4fb763 100644 --- a/apt-pkg/version.cc +++ b/apt-pkg/version.cc @@ -8,6 +8,8 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include #include diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index c40b1fdbc..c23b4c3bf 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -11,8 +11,9 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#include +#include +#include #include #include @@ -21,7 +22,6 @@ #include #include #include - /*}}}*/ // VersionMatch::pkgVersionMatch - Constructor /*{{{*/ -- cgit v1.2.3 From 650faab01603caac04494d54cf6b10a65c00ea13 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Sep 2011 17:46:48 +0200 Subject: Support large files in the complete toolset. Indexes of this size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895) --- apt-pkg/acquire-worker.cc | 8 ++++---- apt-pkg/contrib/crc-16.cc | 2 +- apt-pkg/contrib/crc-16.h | 2 +- apt-pkg/contrib/fileutl.cc | 33 +++++++++++++++++---------------- apt-pkg/contrib/fileutl.h | 35 +++++++++++++++++++++++++---------- apt-pkg/contrib/hashes.cc | 10 +++++----- apt-pkg/contrib/hashes.h | 6 +++--- apt-pkg/contrib/hashsum.cc | 10 +++++----- apt-pkg/contrib/hashsum_template.h | 6 +++--- apt-pkg/contrib/md5.cc | 2 +- apt-pkg/contrib/md5.h | 2 +- apt-pkg/contrib/mmap.cc | 16 ++++++++-------- apt-pkg/contrib/mmap.h | 8 ++++---- apt-pkg/contrib/progress.cc | 8 ++++---- apt-pkg/contrib/progress.h | 16 ++++++++-------- apt-pkg/contrib/sha1.cc | 2 +- apt-pkg/contrib/sha1.h | 2 +- apt-pkg/contrib/sha2.h | 6 +++--- apt-pkg/contrib/strutl.cc | 28 ++++++++++++++++++++++++++++ apt-pkg/contrib/strutl.h | 1 + apt-pkg/depcache.cc | 4 ++-- apt-pkg/indexcopy.cc | 23 ++++++++++++----------- apt-pkg/indexcopy.h | 6 +++--- apt-pkg/indexrecords.cc | 6 +++--- apt-pkg/indexrecords.h | 4 ++-- apt-pkg/pkgrecords.h | 1 - apt-pkg/tagfile.cc | 18 +++++++++--------- apt-pkg/tagfile.h | 4 ++-- 28 files changed, 157 insertions(+), 112 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 366879a57..3bb977e14 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -258,9 +258,9 @@ bool pkgAcquire::Worker::RunMessages() CurrentItem = Itm; CurrentSize = 0; - TotalSize = atoi(LookupTag(Message,"Size","0").c_str()); - ResumePoint = atoi(LookupTag(Message,"Resume-Point","0").c_str()); - Itm->Owner->Start(Message,atoi(LookupTag(Message,"Size","0").c_str())); + TotalSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10); + ResumePoint = strtoull(LookupTag(Message,"Resume-Point","0").c_str(), NULL, 10); + Itm->Owner->Start(Message,strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10)); // Display update before completion if (Log != 0 && Log->MorePulses == true) @@ -289,7 +289,7 @@ bool pkgAcquire::Worker::RunMessages() Log->Pulse(Owner->GetOwner()); OwnerQ->ItemDone(Itm); - unsigned long long const ServerSize = atoll(LookupTag(Message,"Size","0").c_str()); + unsigned long long const ServerSize = strtoull(LookupTag(Message,"Size","0").c_str(), NULL, 10); if (TotalSize != 0 && ServerSize != TotalSize) _error->Warning("Size of file %s is not what the server reported %s %llu", Owner->DestFile.c_str(), LookupTag(Message,"Size","0").c_str(),TotalSize); diff --git a/apt-pkg/contrib/crc-16.cc b/apt-pkg/contrib/crc-16.cc index 26ea1ba28..4058821f9 100644 --- a/apt-pkg/contrib/crc-16.cc +++ b/apt-pkg/contrib/crc-16.cc @@ -65,7 +65,7 @@ static unsigned short const crc16_table[256] = /* Recompute the FCS with one more character appended. */ #define CalcFCS(fcs, c) (((fcs) >> 8) ^ crc16_table[((fcs) ^ (c)) & 0xff]) unsigned short AddCRC16(unsigned short fcs, void const *Buf, - unsigned long len) + unsigned long long len) { unsigned char const *buf = (unsigned char const *)Buf; while (len--) diff --git a/apt-pkg/contrib/crc-16.h b/apt-pkg/contrib/crc-16.h index f30678bac..702de40b2 100644 --- a/apt-pkg/contrib/crc-16.h +++ b/apt-pkg/contrib/crc-16.h @@ -12,6 +12,6 @@ #define INIT_FCS 0xffff unsigned short AddCRC16(unsigned short fcs, void const *buf, - unsigned long len); + unsigned long long len); #endif diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 690e2403c..2e62846d9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -133,10 +133,10 @@ bool CopyFile(FileFd &From,FileFd &To) // Buffered copy between fds SPtrArray Buf = new unsigned char[64000]; - unsigned long Size = From.Size(); + unsigned long long Size = From.Size(); while (Size != 0) { - unsigned long ToRead = Size; + unsigned long long ToRead = Size; if (Size > 64000) ToRead = 64000; @@ -800,7 +800,7 @@ FileFd::~FileFd() // --------------------------------------------------------------------- /* We are carefull to handle interruption by a signal while reading gracefully. */ -bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual) +bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual) { int Res; errno = 0; @@ -839,13 +839,13 @@ bool FileFd::Read(void *To,unsigned long Size,unsigned long *Actual) } Flags |= Fail; - return _error->Error(_("read, still have %lu to read but none left"),Size); + return _error->Error(_("read, still have %llu to read but none left"), Size); } /*}}}*/ // FileFd::Write - Write to the file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool FileFd::Write(const void *From,unsigned long Size) +bool FileFd::Write(const void *From,unsigned long long Size) { int Res; errno = 0; @@ -872,13 +872,13 @@ bool FileFd::Write(const void *From,unsigned long Size) return true; Flags |= Fail; - return _error->Error(_("write, still have %lu to write but couldn't"),Size); + return _error->Error(_("write, still have %llu to write but couldn't"), Size); } /*}}}*/ // FileFd::Seek - Seek in the file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool FileFd::Seek(unsigned long To) +bool FileFd::Seek(unsigned long long To) { int res; if (gz) @@ -888,7 +888,7 @@ bool FileFd::Seek(unsigned long To) if (res != (signed)To) { Flags |= Fail; - return _error->Error("Unable to seek to %lu",To); + return _error->Error("Unable to seek to %llu", To); } return true; @@ -897,7 +897,7 @@ bool FileFd::Seek(unsigned long To) // FileFd::Skip - Seek in the file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool FileFd::Skip(unsigned long Over) +bool FileFd::Skip(unsigned long long Over) { int res; if (gz) @@ -907,7 +907,7 @@ bool FileFd::Skip(unsigned long Over) if (res < 0) { Flags |= Fail; - return _error->Error("Unable to seek ahead %lu",Over); + return _error->Error("Unable to seek ahead %llu",Over); } return true; @@ -916,7 +916,7 @@ bool FileFd::Skip(unsigned long Over) // FileFd::Truncate - Truncate the file /*{{{*/ // --------------------------------------------------------------------- /* */ -bool FileFd::Truncate(unsigned long To) +bool FileFd::Truncate(unsigned long long To) { if (gz) { @@ -926,7 +926,7 @@ bool FileFd::Truncate(unsigned long To) if (ftruncate(iFd,To) != 0) { Flags |= Fail; - return _error->Error("Unable to truncate to %lu",To); + return _error->Error("Unable to truncate to %llu",To); } return true; @@ -935,7 +935,7 @@ bool FileFd::Truncate(unsigned long To) // FileFd::Tell - Current seek position /*{{{*/ // --------------------------------------------------------------------- /* */ -unsigned long FileFd::Tell() +unsigned long long FileFd::Tell() { off_t Res; if (gz) @@ -950,7 +950,7 @@ unsigned long FileFd::Tell() // FileFd::FileSize - Return the size of the file /*{{{*/ // --------------------------------------------------------------------- /* */ -unsigned long FileFd::FileSize() +unsigned long long FileFd::FileSize() { struct stat Buf; @@ -962,9 +962,9 @@ unsigned long FileFd::FileSize() // FileFd::Size - Return the size of the content in the file /*{{{*/ // --------------------------------------------------------------------- /* */ -unsigned long FileFd::Size() +unsigned long long FileFd::Size() { - unsigned long size = FileSize(); + unsigned long long size = FileSize(); // only check gzsize if we are actually a gzip file, just checking for // "gz" is not sufficient as uncompressed files will be opened with @@ -974,6 +974,7 @@ unsigned long FileFd::Size() /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do * this ourselves; the original (uncompressed) file size is the last 32 * bits of the file */ + // FIXME: Size for gz-files is limited by 32bit… no largefile support off_t orig_pos = lseek(iFd, 0, SEEK_CUR); if (lseek(iFd, -4, SEEK_END) < 0) return _error->Errno("lseek","Unable to seek to end of gzipped file"); diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index cde288ad2..0f2dd4194 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -49,21 +49,36 @@ class FileFd enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip, WriteAtomic}; - inline bool Read(void *To,unsigned long Size,bool AllowEof) + inline bool Read(void *To,unsigned long long Size,bool AllowEof) { - unsigned long Jnk; + unsigned long long Jnk; if (AllowEof) return Read(To,Size,&Jnk); return Read(To,Size); } - bool Read(void *To,unsigned long Size,unsigned long *Actual = 0); - bool Write(const void *From,unsigned long Size); - bool Seek(unsigned long To); - bool Skip(unsigned long To); - bool Truncate(unsigned long To); - unsigned long Tell(); - unsigned long Size(); - unsigned long FileSize(); + bool Read(void *To,unsigned long long Size,unsigned long long *Actual = 0); + bool Write(const void *From,unsigned long long Size); + bool Seek(unsigned long long To); + bool Skip(unsigned long long To); + bool Truncate(unsigned long long To); + unsigned long long Tell(); + unsigned long long Size(); + unsigned long long FileSize(); + + /* You want to use 'unsigned long long' if you are talking about a file + to be able to support large files (>2 or >4 GB) properly. + This shouldn't happen all to often for the indexes, but deb's might be… + And as the auto-conversation converts a 'unsigned long *' to a 'bool' + instead of 'unsigned long long *' we need to provide this explicitely - + otherwise applications magically start to fail… */ + __deprecated bool Read(void *To,unsigned long long Size,unsigned long *Actual) + { + unsigned long long R; + bool const T = Read(To, Size, &R); + *Actual = R; + return T; + } + bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666); bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false); bool Close(); diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 9c251e89f..fd76bf229 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -108,18 +108,18 @@ string HashString::toStr() const // Hashes::AddFD - Add the contents of the FD /*{{{*/ // --------------------------------------------------------------------- /* */ -bool Hashes::AddFD(int const Fd,unsigned long Size, bool const addMD5, +bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512) { unsigned char Buf[64*64]; - int Res = 0; + ssize_t Res = 0; int ToEOF = (Size == 0); while (Size != 0 || ToEOF) { - unsigned n = sizeof(Buf); - if (!ToEOF) n = min(Size,(unsigned long)n); + unsigned long long n = sizeof(Buf); + if (!ToEOF) n = min(Size, n); Res = read(Fd,Buf,n); - if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read + if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read return false; if (ToEOF && Res == 0) // EOF break; diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index e702fcca2..40c2ad064 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -62,14 +62,14 @@ class Hashes SHA256Summation SHA256; SHA512Summation SHA512; - inline bool Add(const unsigned char *Data,unsigned long Size) + inline bool Add(const unsigned char *Data,unsigned long long Size) { return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size); }; inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));}; - inline bool AddFD(int const Fd,unsigned long Size = 0) + inline bool AddFD(int const Fd,unsigned long long Size = 0) { return AddFD(Fd, Size, true, true, true, true); }; - bool AddFD(int const Fd, unsigned long Size, bool const addMD5, + bool AddFD(int const Fd, unsigned long long Size, bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512); inline bool Add(const unsigned char *Beg,const unsigned char *End) {return Add(Beg,End-Beg);}; diff --git a/apt-pkg/contrib/hashsum.cc b/apt-pkg/contrib/hashsum.cc index 28f711176..0edcbb364 100644 --- a/apt-pkg/contrib/hashsum.cc +++ b/apt-pkg/contrib/hashsum.cc @@ -7,16 +7,16 @@ // Summation::AddFD - Add content of file into the checksum /*{{{*/ // --------------------------------------------------------------------- /* */ -bool SummationImplementation::AddFD(int const Fd, unsigned long Size) { +bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) { unsigned char Buf[64 * 64]; - int Res = 0; + ssize_t Res = 0; int ToEOF = (Size == 0); while (Size != 0 || ToEOF) { - unsigned n = sizeof(Buf); - if (!ToEOF) n = min(Size,(unsigned long)n); + unsigned long long n = sizeof(Buf); + if (!ToEOF) n = min(Size, n); Res = read(Fd, Buf, n); - if (Res < 0 || (!ToEOF && (unsigned) Res != n)) // error, or short read + if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read return false; if (ToEOF && Res == 0) // EOF break; diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 85d94c2af..9157754e3 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -87,8 +87,8 @@ class HashSumValue class SummationImplementation { public: - virtual bool Add(const unsigned char *inbuf, unsigned long inlen) = 0; - inline bool Add(const char *inbuf, unsigned long const inlen) + virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0; + inline bool Add(const char *inbuf, unsigned long long const inlen) { return Add((unsigned char *)inbuf, inlen); }; inline bool Add(const unsigned char *Data) @@ -101,7 +101,7 @@ class SummationImplementation inline bool Add(const char *Beg, const char *End) { return Add((const unsigned char *)Beg, End - Beg); }; - bool AddFD(int Fd, unsigned long Size = 0); + bool AddFD(int Fd, unsigned long long Size = 0); }; #endif diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index b53c4fbd2..4351aeb22 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -187,7 +187,7 @@ MD5Summation::MD5Summation() // MD5Summation::Add - 'Add' a data set to the hash /*{{{*/ // --------------------------------------------------------------------- /* */ -bool MD5Summation::Add(const unsigned char *data,unsigned long len) +bool MD5Summation::Add(const unsigned char *data,unsigned long long len) { if (Done == true) return false; diff --git a/apt-pkg/contrib/md5.h b/apt-pkg/contrib/md5.h index e76428325..305cdb20d 100644 --- a/apt-pkg/contrib/md5.h +++ b/apt-pkg/contrib/md5.h @@ -45,7 +45,7 @@ class MD5Summation : public SummationImplementation public: - bool Add(const unsigned char *inbuf, unsigned long inlen); + bool Add(const unsigned char *inbuf, unsigned long long inlen); using SummationImplementation::Add; MD5SumValue Result(); diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 3cd87eda4..a110a7019 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -95,7 +95,7 @@ bool MMap::Map(FileFd &Fd) return false; } else - return _error->Errno("mmap",_("Couldn't make mmap of %lu bytes"), + return _error->Errno("mmap",_("Couldn't make mmap of %llu bytes"), iSize); } @@ -166,7 +166,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) return true; #ifdef _POSIX_SYNCHRONIZED_IO - unsigned long PSize = sysconf(_SC_PAGESIZE); + unsigned long long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) { if (SyncToFd != 0) @@ -177,7 +177,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) } else { - if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) + if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) return _error->Errno("msync", _("Unable to synchronize mmap")); } } @@ -197,7 +197,7 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &Work if (_error->PendingError() == true) return; - unsigned long EndOfFile = Fd->Size(); + unsigned long long EndOfFile = Fd->Size(); if (EndOfFile > WorkSpace) WorkSpace = EndOfFile; else if(WorkSpace > 0) @@ -285,7 +285,7 @@ DynamicMMap::~DynamicMMap() return; } - unsigned long EndOfFile = iSize; + unsigned long long EndOfFile = iSize; iSize = WorkSpace; Close(false); if(ftruncate(Fd->Fd(),EndOfFile) < 0) @@ -295,9 +295,9 @@ DynamicMMap::~DynamicMMap() // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space /*{{{*/ // --------------------------------------------------------------------- /* This allocates a block of memory aligned to the given size */ -unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln) +unsigned long DynamicMMap::RawAllocate(unsigned long long Size,unsigned long Aln) { - unsigned long Result = iSize; + unsigned long long Result = iSize; if (Aln != 0) Result += Aln - (iSize%Aln); @@ -412,7 +412,7 @@ bool DynamicMMap::Grow() { if (GrowFactor <= 0) return _error->Error(_("Unable to increase size of the MMap as automatic growing is disabled by user.")); - unsigned long const newSize = WorkSpace + GrowFactor; + unsigned long long const newSize = WorkSpace + GrowFactor; if(Fd != 0) { Fd->Seek(newSize - 1); diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index 2bf2c1540..e0ff8db95 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -41,7 +41,7 @@ class MMap protected: unsigned long Flags; - unsigned long iSize; + unsigned long long iSize; void *Base; // In case mmap can not be used, we keep a dup of the file @@ -60,8 +60,8 @@ class MMap // Simple accessors inline operator void *() {return Base;}; inline void *Data() {return Base;}; - inline unsigned long Size() {return iSize;}; - inline void AddSize(unsigned long const size) {iSize += size;}; + inline unsigned long long Size() {return iSize;}; + inline void AddSize(unsigned long long const size) {iSize += size;}; inline bool validData() const { return Base != (void *)-1 && Base != 0; }; // File manipulators @@ -99,7 +99,7 @@ class DynamicMMap : public MMap public: // Allocation - unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0); + unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0); unsigned long Allocate(unsigned long ItemSize); unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1); inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());}; diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 6cd6134d3..317048845 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -37,7 +37,7 @@ OpProgress::OpProgress() : Current(0), Total(0), Size(0), SubTotal(1), /* Current is the Base Overall progress in units of Total. Cur is the sub progress in units of SubTotal. Size is a scaling factor that says what percent of Total SubTotal is. */ -void OpProgress::Progress(unsigned long Cur) +void OpProgress::Progress(unsigned long long Cur) { if (Total == 0 || Size == 0 || SubTotal == 0) Percent = 0; @@ -49,8 +49,8 @@ void OpProgress::Progress(unsigned long Cur) // OpProgress::OverallProgress - Set the overall progress /*{{{*/ // --------------------------------------------------------------------- /* */ -void OpProgress::OverallProgress(unsigned long Current, unsigned long Total, - unsigned long Size,const string &Op) +void OpProgress::OverallProgress(unsigned long long Current, unsigned long long Total, + unsigned long long Size,const string &Op) { this->Current = Current; this->Total = Total; @@ -67,7 +67,7 @@ void OpProgress::OverallProgress(unsigned long Current, unsigned long Total, // OpProgress::SubProgress - Set the sub progress state /*{{{*/ // --------------------------------------------------------------------- /* */ -void OpProgress::SubProgress(unsigned long SubTotal,const string &Op, +void OpProgress::SubProgress(unsigned long long SubTotal,const string &Op, float const Percent) { this->SubTotal = SubTotal; diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h index 3a914d17f..5344323f6 100644 --- a/apt-pkg/contrib/progress.h +++ b/apt-pkg/contrib/progress.h @@ -30,10 +30,10 @@ using std::string; class Configuration; class OpProgress { - unsigned long Current; - unsigned long Total; - unsigned long Size; - unsigned long SubTotal; + unsigned long long Current; + unsigned long long Total; + unsigned long long Size; + unsigned long long SubTotal; float LastPercent; // Change reduction code @@ -54,10 +54,10 @@ class OpProgress public: - void Progress(unsigned long Current); - void SubProgress(unsigned long SubTotal, const string &Op = "", float const Percent = -1); - void OverallProgress(unsigned long Current,unsigned long Total, - unsigned long Size,const string &Op); + void Progress(unsigned long long Current); + void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1); + void OverallProgress(unsigned long long Current,unsigned long long Total, + unsigned long long Size,const string &Op); virtual void Done() {}; OpProgress(); diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index 9416895ac..31c576611 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -243,7 +243,7 @@ SHA1SumValue SHA1Summation::Result() // SHA1Summation::Add - Adds content of buffer into the checksum /*{{{*/ // --------------------------------------------------------------------- /* May not be called after Result() is called */ -bool SHA1Summation::Add(const unsigned char *data,unsigned long len) +bool SHA1Summation::Add(const unsigned char *data,unsigned long long len) { if (Done) return false; diff --git a/apt-pkg/contrib/sha1.h b/apt-pkg/contrib/sha1.h index 2701fc67e..916faec1b 100644 --- a/apt-pkg/contrib/sha1.h +++ b/apt-pkg/contrib/sha1.h @@ -34,7 +34,7 @@ class SHA1Summation : public SummationImplementation bool Done; public: - bool Add(const unsigned char *inbuf, unsigned long inlen); + bool Add(const unsigned char *inbuf, unsigned long long inlen); using SummationImplementation::Add; SHA1SumValue Result(); diff --git a/apt-pkg/contrib/sha2.h b/apt-pkg/contrib/sha2.h index 386225889..51c921dbd 100644 --- a/apt-pkg/contrib/sha2.h +++ b/apt-pkg/contrib/sha2.h @@ -30,7 +30,7 @@ class SHA2SummationBase : public SummationImplementation protected: bool Done; public: - bool Add(const unsigned char *inbuf, unsigned long len) = 0; + bool Add(const unsigned char *inbuf, unsigned long long len) = 0; void Result(); }; @@ -41,7 +41,7 @@ class SHA256Summation : public SHA2SummationBase unsigned char Sum[32]; public: - bool Add(const unsigned char *inbuf, unsigned long len) + bool Add(const unsigned char *inbuf, unsigned long long len) { if (Done) return false; @@ -73,7 +73,7 @@ class SHA512Summation : public SHA2SummationBase unsigned char Sum[64]; public: - bool Add(const unsigned char *inbuf, unsigned long len) + bool Add(const unsigned char *inbuf, unsigned long long len) { if (Done) return false; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 6586ef17b..04226f1b4 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -970,6 +970,34 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base) return true; } /*}}}*/ +// StrToNum - Convert a fixed length string to a number /*{{{*/ +// --------------------------------------------------------------------- +/* This is used in decoding the crazy fixed length string headers in + tar and ar files. */ +bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base) +{ + char S[30]; + if (Len >= sizeof(S)) + return false; + memcpy(S,Str,Len); + S[Len] = 0; + + // All spaces is a zero + Res = 0; + unsigned I; + for (I = 0; S[I] == ' '; I++); + if (S[I] == 0) + return true; + + char *End; + Res = strtoull(S,&End,Base); + if (End == S) + return false; + + return true; +} + /*}}}*/ + // Base256ToNum - Convert a fixed length binary to a number /*{{{*/ // --------------------------------------------------------------------- /* This is used in decoding the 256bit encoded fixed length fields in diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 89cbf0370..b32198f25 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -52,6 +52,7 @@ string LookupTag(const string &Message,const char *Tag,const char *Default = 0); int StringToBool(const string &Text,int Default = -1); bool ReadMessages(int Fd, vector &List); bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0); +bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0); bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len); bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length); bool TokSplitString(char Tok,char *Input,char **List, diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 0fbd77fd8..8dde7c173 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -171,14 +171,14 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ string const state = _config->FindFile("Dir::State::extended_states"); if(RealFileExists(state)) { state_file.Open(state, FileFd::ReadOnly); - int const file_size = state_file.Size(); + off_t const file_size = state_file.Size(); if(Prog != NULL) Prog->OverallProgress(0, file_size, 1, _("Reading state information")); pkgTagFile tagfile(&state_file); pkgTagSection section; - int amt = 0; + off_t amt = 0; bool const debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false); while(tagfile.Step(section)) { string const pkgname = section.FindS("Package"); diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index dcba78dce..f52ecbbcb 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -29,6 +29,7 @@ #include #include #include +#include #include "indexcopy.h" #include @@ -55,7 +56,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, bool Debug = _config->FindB("Debug::aptcdrom",false); // Prepare the progress indicator - unsigned long TotalSize = 0; + off_t TotalSize = 0; for (vector::iterator I = List.begin(); I != List.end(); I++) { struct stat Buf; @@ -66,14 +67,14 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, TotalSize += Buf.st_size; } - unsigned long CurrentSize = 0; + off_t CurrentSize = 0; unsigned int NotFound = 0; unsigned int WrongSize = 0; unsigned int Packages = 0; for (vector::iterator I = List.begin(); I != List.end(); I++) { string OrigPath = string(*I,CDROM.length()); - unsigned long FileSize = 0; + off_t FileSize = 0; // Open the package file FileFd Pkg; @@ -166,7 +167,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, if(Progress) Progress->Progress(Parser.Offset()); string File; - unsigned long Size; + unsigned long long Size; if (GetFile(File,Size) == false) { fclose(TargetFl); @@ -221,7 +222,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector &List, } // Size match - if ((unsigned)Buf.st_size != Size) + if ((unsigned long long)Buf.st_size != Size) { if (Debug == true) clog << "Wrong Size: " << File << endl; @@ -455,7 +456,7 @@ bool IndexCopy::GrabFirst(string Path,string &To,unsigned int Depth) // PackageCopy::GetFile - Get the file information from the section /*{{{*/ // --------------------------------------------------------------------- /* */ -bool PackageCopy::GetFile(string &File,unsigned long &Size) +bool PackageCopy::GetFile(string &File,unsigned long long &Size) { File = Section->FindS("Filename"); Size = Section->FindI("Size"); @@ -481,7 +482,7 @@ bool PackageCopy::RewriteEntry(FILE *Target,string File) // SourceCopy::GetFile - Get the file information from the section /*{{{*/ // --------------------------------------------------------------------- /* */ -bool SourceCopy::GetFile(string &File,unsigned long &Size) +bool SourceCopy::GetFile(string &File,unsigned long long &Size) { string Files = Section->FindS("Files"); if (Files.empty() == true) @@ -504,7 +505,7 @@ bool SourceCopy::GetFile(string &File,unsigned long &Size) return _error->Error("Error parsing file record"); // Parse the size and append the directory - Size = atoi(sSize.c_str()); + Size = strtoull(sSize.c_str(), NULL, 10); File = Base + File; return true; } @@ -787,7 +788,7 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ bool Debug = _config->FindB("Debug::aptcdrom",false); // Prepare the progress indicator - unsigned long TotalSize = 0; + off_t TotalSize = 0; for (vector::iterator I = List.begin(); I != List.end(); I++) { struct stat Buf; @@ -798,14 +799,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ TotalSize += Buf.st_size; } - unsigned long CurrentSize = 0; + off_t CurrentSize = 0; unsigned int NotFound = 0; unsigned int WrongSize = 0; unsigned int Packages = 0; for (vector::iterator I = List.begin(); I != List.end(); I++) { string OrigPath = string(*I,CDROM.length()); - unsigned long FileSize = 0; + off_t FileSize = 0; // Open the package file FileFd Pkg; diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 277fb561c..60c90dd4a 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -37,7 +37,7 @@ class IndexCopy /*{{{*/ bool ReconstructChop(unsigned long &Chop,string Dir,string File); void ConvertToSourceList(string CD,string &Path); bool GrabFirst(string Path,string &To,unsigned int Depth); - virtual bool GetFile(string &Filename,unsigned long &Size) = 0; + virtual bool GetFile(string &Filename,unsigned long long &Size) = 0; virtual bool RewriteEntry(FILE *Target,string File) = 0; virtual const char *GetFileName() = 0; virtual const char *Type() = 0; @@ -53,7 +53,7 @@ class PackageCopy : public IndexCopy /*{{{*/ { protected: - virtual bool GetFile(string &Filename,unsigned long &Size); + virtual bool GetFile(string &Filename,unsigned long long &Size); virtual bool RewriteEntry(FILE *Target,string File); virtual const char *GetFileName() {return "Packages";}; virtual const char *Type() {return "Package";}; @@ -64,7 +64,7 @@ class SourceCopy : public IndexCopy /*{{{*/ { protected: - virtual bool GetFile(string &Filename,unsigned long &Size); + virtual bool GetFile(string &Filename,unsigned long long &Size); virtual bool RewriteEntry(FILE *Target,string File); virtual const char *GetFileName() {return "Sources";}; virtual const char *Type() {return "Source";}; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 00f520c4f..932640764 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -80,7 +80,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/ string Name; string Hash; - size_t Size; + unsigned long long Size; while (Start < End) { if (!parseSumData(Start, End, Name, Hash, Size)) @@ -147,7 +147,7 @@ vector indexRecords::MetaKeys() /*{{{*/ } /*}}}*/ bool indexRecords::parseSumData(const char *&Start, const char *End, /*{{{*/ - string &Name, string &Hash, size_t &Size) + string &Name, string &Hash, unsigned long long &Size) { Name = ""; Hash = ""; @@ -184,7 +184,7 @@ bool indexRecords::parseSumData(const char *&Start, const char *End, /*{{{*/ if (EntryEnd == End) return false; - Size = strtol (Start, NULL, 10); + Size = strtoull (Start, NULL, 10); /* Skip over intermediate blanks */ Start = EntryEnd; diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index 5b532c1a5..0f933b93c 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -17,7 +17,7 @@ class indexRecords { bool parseSumData(const char *&Start, const char *End, string &Name, - string &Hash, size_t &Size); + string &Hash, unsigned long long &Size); public: struct checkSum; string ErrorText; @@ -53,7 +53,7 @@ struct indexRecords::checkSum { string MetaKeyFilename; HashString Hash; - size_t Size; + unsigned long long Size; }; #endif diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index 78e39e577..840454e18 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -19,7 +19,6 @@ #include -#include #include class pkgRecords /*{{{*/ diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 3b491fcd2..418e6bed8 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -29,7 +29,7 @@ using std::string; class pkgTagFilePrivate { public: - pkgTagFilePrivate(FileFd *pFd, unsigned long Size) : Fd(*pFd), Size(Size) + pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Size(Size) { } FileFd &Fd; @@ -37,14 +37,14 @@ public: char *Start; char *End; bool Done; - unsigned long iOffset; - unsigned long Size; + unsigned long long iOffset; + unsigned long long Size; }; // TagFile::pkgTagFile - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) +pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size) { d = new pkgTagFilePrivate(pFd, Size); @@ -86,7 +86,7 @@ unsigned long pkgTagFile::Offset() bool pkgTagFile::Resize() { char *tmp; - unsigned long EndSize = d->End - d->Start; + unsigned long long EndSize = d->End - d->Start; // fail is the buffer grows too big if(d->Size > 1024*1024+1) @@ -138,8 +138,8 @@ bool pkgTagFile::Step(pkgTagSection &Tag) then fills the rest from the file */ bool pkgTagFile::Fill() { - unsigned long EndSize = d->End - d->Start; - unsigned long Actual = 0; + unsigned long long EndSize = d->End - d->Start; + unsigned long long Actual = 0; memmove(d->Buffer,d->Start,EndSize); d->Start = d->Buffer; @@ -180,12 +180,12 @@ bool pkgTagFile::Fill() // --------------------------------------------------------------------- /* This jumps to a pre-recorded file location and reads the record that is there */ -bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset) +bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset) { // We are within a buffer space of the next hit.. if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset) { - unsigned long Dist = Offset - d->iOffset; + unsigned long long Dist = Offset - d->iOffset; d->Start += Dist; d->iOffset += Dist; return Step(Tag); diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 23f5c57e6..87d070d28 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -94,9 +94,9 @@ class pkgTagFile bool Step(pkgTagSection &Section); unsigned long Offset(); - bool Jump(pkgTagSection &Tag,unsigned long Offset); + bool Jump(pkgTagSection &Tag,unsigned long long Offset); - pkgTagFile(FileFd *F,unsigned long Size = 32*1024); + pkgTagFile(FileFd *F,unsigned long long Size = 32*1024); virtual ~pkgTagFile(); }; -- cgit v1.2.3