From d3e8fbb395f57954acd7a2095f02ce530a05ec6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Feb 2014 01:20:53 +0100 Subject: =?UTF-8?q?warning:=20extra=20=E2=80=98;=E2=80=99=20[-Wpedantic]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git-Dch: Ignore Reported-By: gcc -Wpedantic --- apt-inst/filelist.h | 152 +++++++++++++------------- apt-pkg/acquire.cc | 2 +- apt-pkg/cacheiterators.h | 226 +++++++++++++++++++-------------------- apt-pkg/cacheset.h | 176 +++++++++++++++--------------- apt-pkg/cdrom.cc | 6 +- apt-pkg/contrib/configuration.cc | 3 +- apt-pkg/contrib/error.cc | 2 +- apt-pkg/contrib/gpgv.h | 2 +- apt-pkg/contrib/progress.cc | 12 +-- apt-pkg/contrib/strutl.cc | 2 +- apt-pkg/contrib/strutl.h | 38 +++---- apt-pkg/depcache.cc | 4 +- apt-pkg/indexcopy.cc | 4 +- apt-pkg/install-progress.cc | 4 +- apt-pkg/install-progress.h | 32 +++--- apt-pkg/pkgcache.cc | 20 ++-- apt-pkg/pkgcache.h | 42 ++++---- apt-pkg/upgrade.h | 2 +- apt-private/acqprogress.cc | 62 +++++------ cmdline/apt-cdrom.cc | 26 ++--- ftparchive/override.cc | 8 +- methods/cdrom.cc | 2 +- methods/http.cc | 6 +- methods/https.cc | 2 +- methods/mirror.cc | 28 ++--- methods/rsh.cc | 2 +- methods/server.cc | 20 ++-- methods/server.h | 2 +- 28 files changed, 443 insertions(+), 444 deletions(-) diff --git a/apt-inst/filelist.h b/apt-inst/filelist.h index 0405d61df..8c4891bcf 100644 --- a/apt-inst/filelist.h +++ b/apt-inst/filelist.h @@ -42,25 +42,25 @@ class pkgFLCache struct Package; struct Diversion; struct ConfFile; - + class NodeIterator; class DirIterator; class PkgIterator; class DiverIterator; - + protected: std::string CacheFile; DynamicMMap ⤅ map_ptrloc LastTreeLookup; unsigned long LastLookupSize; - + // Helpers for the addition algorithms map_ptrloc TreeLookup(map_ptrloc *Base,const char *Text,const char *TextEnd, unsigned long Size,unsigned int *Count = 0, bool Insert = false); - + public: - + // Pointers to the arrays of items Header *HeaderP; Node *NodeP; @@ -70,10 +70,10 @@ class pkgFLCache ConfFile *ConfP; char *StrP; unsigned char *AnyP; - + // Quick accessors Node *FileHash; - + // Accessors Header &Head() {return *HeaderP;}; void PrintTree(map_ptrloc Base,unsigned long Size); @@ -89,7 +89,7 @@ class pkgFLCache void DropNode(map_ptrloc Node); inline DiverIterator DiverBegin(); - + // Diversion control void BeginDiverLoad(); void FinishDiverLoad(); @@ -97,7 +97,7 @@ class pkgFLCache const char *To); bool AddConfFile(const char *Name,const char *NameEnd, PkgIterator const &Owner,const unsigned char *Sum); - + pkgFLCache(DynamicMMap &Map); // ~pkgFLCache(); }; @@ -109,7 +109,7 @@ struct pkgFLCache::Header short MajorVersion; short MinorVersion; bool Dirty; - + // Size of structure values unsigned HeaderSz; unsigned NodeSz; @@ -117,7 +117,7 @@ struct pkgFLCache::Header unsigned PackageSz; unsigned DiversionSz; unsigned ConfFileSz; - + // Structure Counts; unsigned int NodeCount; unsigned int DirCount; @@ -126,13 +126,13 @@ struct pkgFLCache::Header unsigned int ConfFileCount; unsigned int HashSize; unsigned long UniqNodes; - + // Offsets map_ptrloc FileHash; map_ptrloc DirTree; map_ptrloc Packages; map_ptrloc Diversions; - + /* Allocation pools, there should be one of these for each structure excluding the header */ DynamicMMap::Pool Pools[5]; @@ -177,7 +177,7 @@ struct pkgFLCache::Diversion map_ptrloc OwnerPkg; // Package map_ptrloc DivertFrom; // Node map_ptrloc DivertTo; // String - + map_ptrloc Next; // Diversion unsigned long Flags; @@ -194,120 +194,120 @@ class pkgFLCache::PkgIterator { Package *Pkg; pkgFLCache *Owner; - + public: - + inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;} - + // Accessors - inline Package *operator ->() {return Pkg;}; - inline Package const *operator ->() const {return Pkg;}; - inline Package const &operator *() const {return *Pkg;}; - inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}; - inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}; - - inline unsigned long Offset() const {return Pkg - Owner->PkgP;}; - inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}; + inline Package *operator ->() {return Pkg;} + inline Package const *operator ->() const {return Pkg;} + inline Package const &operator *() const {return *Pkg;} + inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;} + inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;} + + inline unsigned long Offset() const {return Pkg - Owner->PkgP;} + inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;} inline pkgFLCache::NodeIterator Files() const; - PkgIterator() : Pkg(0), Owner(0) {}; - PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {}; + PkgIterator() : Pkg(0), Owner(0) {} + PkgIterator(pkgFLCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner) {} }; class pkgFLCache::DirIterator { Directory *Dir; pkgFLCache *Owner; - + public: - + // Accessors - inline Directory *operator ->() {return Dir;}; - inline Directory const *operator ->() const {return Dir;}; - inline Directory const &operator *() const {return *Dir;}; - inline operator Directory *() {return Dir == Owner->DirP?0:Dir;}; - inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;}; + inline Directory *operator ->() {return Dir;} + inline Directory const *operator ->() const {return Dir;} + inline Directory const &operator *() const {return *Dir;} + inline operator Directory *() {return Dir == Owner->DirP?0:Dir;} + inline operator Directory const *() const {return Dir == Owner->DirP?0:Dir;} - inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;}; + inline const char *Name() const {return Dir->Name == 0?0:Owner->StrP + Dir->Name;} - DirIterator() : Dir(0), Owner(0) {}; - DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {}; + DirIterator() : Dir(0), Owner(0) {} + DirIterator(pkgFLCache &Owner,Directory *Trg) : Dir(Trg), Owner(&Owner) {} }; class pkgFLCache::DiverIterator { Diversion *Diver; pkgFLCache *Owner; - + public: // Iteration - void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;}; + void operator ++(int) {if (Diver != Owner->DiverP) Diver = Owner->DiverP + Diver->Next;} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Diver == Owner->DiverP;} // Accessors - inline Diversion *operator ->() {return Diver;}; - inline Diversion const *operator ->() const {return Diver;}; - inline Diversion const &operator *() const {return *Diver;}; - inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;}; - inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;}; + inline Diversion *operator ->() {return Diver;} + inline Diversion const *operator ->() const {return Diver;} + inline Diversion const &operator *() const {return *Diver;} + inline operator Diversion *() {return Diver == Owner->DiverP?0:Diver;} + inline operator Diversion const *() const {return Diver == Owner->DiverP?0:Diver;} - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);}; + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Diver->OwnerPkg);} inline NodeIterator DivertFrom() const; inline NodeIterator DivertTo() const; DiverIterator() : Diver(0), Owner(0) {}; - DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {}; + DiverIterator(pkgFLCache &Owner,Diversion *Trg) : Diver(Trg), Owner(&Owner) {} }; class pkgFLCache::NodeIterator { Node *Nde; - enum {NdePkg, NdeHash} Type; + enum {NdePkg, NdeHash} Type; pkgFLCache *Owner; - + public: - + // Iteration - void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + - (Type == NdePkg?Nde->NextPkg:Nde->Next);}; - inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;}; + void operator ++(int) {if (Nde != Owner->NodeP) Nde = Owner->NodeP + + (Type == NdePkg?Nde->NextPkg:Nde->Next);} + inline void operator ++() {operator ++(0);} + inline bool end() const {return Owner == 0 || Nde == Owner->NodeP;} // Accessors - inline Node *operator ->() {return Nde;}; - inline Node const *operator ->() const {return Nde;}; - inline Node const &operator *() const {return *Nde;}; - inline operator Node *() {return Nde == Owner->NodeP?0:Nde;}; - inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;}; - inline unsigned long Offset() const {return Nde - Owner->NodeP;}; - inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);}; - inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);}; - inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;}; - inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;}; + inline Node *operator ->() {return Nde;} + inline Node const *operator ->() const {return Nde;} + inline Node const &operator *() const {return *Nde;} + inline operator Node *() {return Nde == Owner->NodeP?0:Nde;} + inline operator Node const *() const {return Nde == Owner->NodeP?0:Nde;} + inline unsigned long Offset() const {return Nde - Owner->NodeP;} + inline DirIterator Dir() const {return DirIterator(*Owner,Owner->DirP + Nde->Dir);} + inline DiverIterator Diversion() const {return DiverIterator(*Owner,Owner->DiverP + Nde->Pointer);} + inline const char *File() const {return Nde->File == 0?0:Owner->StrP + Nde->File;} + inline const char *DirN() const {return Owner->StrP + Owner->DirP[Nde->Dir].Name;} Package *RealPackage() const; - + NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {}; - NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}; - NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}; + NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {} + NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {} }; /* Inlines with forward references that cannot be included directly in their respsective classes */ -inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);}; +inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertFrom() const + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertFrom);} inline pkgFLCache::NodeIterator pkgFLCache::DiverIterator::DivertTo() const - {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);}; + {return NodeIterator(*Owner,Owner->NodeP + Diver->DivertTo);} inline pkgFLCache::NodeIterator pkgFLCache::PkgIterator::Files() const - {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);}; + {return NodeIterator(*Owner,Owner->NodeP + Pkg->Files,Pkg);} inline pkgFLCache::DiverIterator pkgFLCache::DiverBegin() - {return DiverIterator(*this,DiverP + HeaderP->Diversions);}; + {return DiverIterator(*this,DiverP + HeaderP->Diversions);} -inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) - {return GetPkg(Name,Name+strlen(Name),Insert);}; +inline pkgFLCache::PkgIterator pkgFLCache::GetPkg(const char *Name,bool Insert) + {return GetPkg(Name,Name+strlen(Name),Insert);} #endif diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 120e809e1..e8fa68338 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -468,7 +468,7 @@ void pkgAcquire::Bump() pkgAcquire::Worker *pkgAcquire::WorkerStep(Worker *I) { return I->NextAcquire; -}; +} /*}}}*/ // Acquire::Clean - Cleans a directory /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index ea6a4afba..ca8bc5ca0 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -55,26 +55,26 @@ template class pkgCache::Iterator : public: // Iteration virtual void operator ++(int) = 0; - virtual void operator ++() = 0; // Should be {operator ++(0);}; - inline bool end() const {return Owner == 0 || S == OwnerPointer();}; + virtual void operator ++() = 0; // Should be {operator ++(0);} + inline bool end() const {return Owner == 0 || S == OwnerPointer();} // Comparison - inline bool operator ==(const Itr &B) const {return S == B.S;}; - inline bool operator !=(const Itr &B) const {return S != B.S;}; + inline bool operator ==(const Itr &B) const {return S == B.S;} + inline bool operator !=(const Itr &B) const {return S != B.S;} // Accessors - inline Str *operator ->() {return S;}; - inline Str const *operator ->() const {return S;}; - inline operator Str *() {return S == OwnerPointer() ? 0 : S;}; - inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;}; - inline Str &operator *() {return *S;}; - inline Str const &operator *() const {return *S;}; - inline pkgCache *Cache() const {return Owner;}; + inline Str *operator ->() {return S;} + inline Str const *operator ->() const {return S;} + inline operator Str *() {return S == OwnerPointer() ? 0 : S;} + inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;} + inline Str &operator *() {return *S;} + inline Str const &operator *() const {return *S;} + inline pkgCache *Cache() const {return Owner;} // Mixed stuff - inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;}; - inline bool IsGood() const { return S && Owner && ! end();}; - inline unsigned long Index() const {return S - OwnerPointer();}; + inline void operator =(const Itr &B) {S = B.S; Owner = B.Owner;} + inline bool IsGood() const { return S && Owner && ! end();} + inline unsigned long Index() const {return S - OwnerPointer();} void ReMap(void const * const oldMap, void const * const newMap) { if (Owner == 0 || S == 0) @@ -83,8 +83,8 @@ template class pkgCache::Iterator : } // Constructors - look out for the variable assigning - inline Iterator() : S(0), Owner(0) {}; - inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}; + inline Iterator() : S(0), Owner(0) {} + inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {} }; /*}}}*/ // Group Iterator /*{{{*/ @@ -98,19 +98,19 @@ class pkgCache::GrpIterator: public Iterator { protected: inline Group* OwnerPointer() const { return (Owner != 0) ? Owner->GrpP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline GrpIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} inline PkgIterator PackageList() const; PkgIterator FindPkg(std::string Arch = "any") const; /** \brief find the package with the "best" architecture @@ -127,8 +127,8 @@ class pkgCache::GrpIterator: public Iterator { inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline GrpIterator() : Iterator(), HashIndex(0) {}; + } + inline GrpIterator() : Iterator(), HashIndex(0) {} }; /*}}}*/ @@ -139,27 +139,27 @@ class pkgCache::PkgIterator: public Iterator { protected: inline Package* OwnerPointer() const { return (Owner != 0) ? Owner->PkgP : 0; - }; + } public: // This constructor is the 'begin' constructor, never use it. inline PkgIterator(pkgCache &Owner) : Iterator(Owner), HashIndex(-1) { S = OwnerPointer(); operator ++(0); - }; + } virtual void operator ++(int); - virtual void operator ++() {operator ++(0);}; + virtual void operator ++() {operator ++(0);} enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure}; // Accessors - inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || - (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}; - inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}; - inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}; + (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} + inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} + inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} inline VerIterator VersionList() const; inline VerIterator CurrentVer() const; @@ -177,8 +177,8 @@ class pkgCache::PkgIterator: public Iterator { inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator(Owner, Trg), HashIndex(0) { if (S == 0) S = OwnerPointer(); - }; - inline PkgIterator() : Iterator(), HashIndex(0) {}; + } + inline PkgIterator() : Iterator(), HashIndex(0) {} }; /*}}}*/ // Version Iterator /*{{{*/ @@ -186,12 +186,12 @@ class pkgCache::VerIterator : public Iterator { protected: inline Version* OwnerPointer() const { return (Owner != 0) ? Owner->VerP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerP) S = Owner->VerP + S->NextVer;} + inline void operator ++() {operator ++(0);} // Comparison int CompareVer(const VerIterator &B) const; @@ -201,17 +201,17 @@ class pkgCache::VerIterator : public Iterator { referring to the same "real" version */ inline bool SimilarVer(const VerIterator &B) const { return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0); - }; + } // Accessors - inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; - inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; + inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;} + inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;} inline const char *Arch() const { if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All) return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; - }; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; + } + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} inline DescIterator DescriptionList() const; DescIterator TranslatedDescription() const; @@ -219,7 +219,7 @@ class pkgCache::VerIterator : public Iterator { inline PrvIterator ProvidesList() const; inline VerFileIterator FileList() const; bool Downloadable() const; - inline const char *PriorityType() const {return Owner->Priority(S->Priority);}; + inline const char *PriorityType() const {return Owner->Priority(S->Priority);} const char *MultiArchType() const; std::string RelStr() const; @@ -229,8 +229,8 @@ class pkgCache::VerIterator : public Iterator { inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator(Owner, Trg) { if (S == 0) S = OwnerPointer(); - }; - inline VerIterator() : Iterator() {}; + } + inline VerIterator() : Iterator() {} }; /*}}}*/ // Description Iterator /*{{{*/ @@ -238,26 +238,26 @@ class pkgCache::DescIterator : public Iterator { protected: inline Description* OwnerPointer() const { return (Owner != 0) ? Owner->DescP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc;} + inline void operator ++() {operator ++(0);} // Comparison int CompareDesc(const DescIterator &B) const; // Accessors - inline const char *LanguageCode() const {return Owner->StrP + S->language_code;}; - inline const char *md5() const {return Owner->StrP + S->md5sum;}; + inline const char *LanguageCode() const {return Owner->StrP + S->language_code;} + inline const char *md5() const {return Owner->StrP + S->md5sum;} inline DescFileIterator FileList() const; - inline DescIterator() : Iterator() {}; + inline DescIterator() : Iterator() {} inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator(Owner, Trg) { if (S == 0) S = Owner.DescP; - }; + } }; /*}}}*/ // Dependency iterator /*{{{*/ @@ -267,21 +267,21 @@ class pkgCache::DepIterator : public Iterator { protected: inline Dependency* OwnerPointer() const { return (Owner != 0) ? Owner->DepP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->DepP) S = Owner->DepP + - (Type == DepVer ? S->NextDepends : S->NextRevDepends);}; - inline void operator ++() {operator ++(0);}; + (Type == DepVer ? S->NextDepends : S->NextRevDepends);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);}; - inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}; - inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);}; - inline bool Reverse() const {return Type == DepRev;}; + inline const char *TargetVer() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->Package);} + inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;} + inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);} + inline bool Reverse() const {return Type == DepRev;} bool IsCritical() const; bool IsNegative() const; bool IsIgnorable(PrvIterator const &Prv) const; @@ -292,8 +292,8 @@ class pkgCache::DepIterator : public Iterator { void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; - inline const char *CompType() const {return Owner->CompType(S->CompareOp);}; - inline const char *DepType() const {return Owner->DepType(S->Type);}; + inline const char *CompType() const {return Owner->CompType(S->CompareOp);} + inline const char *DepType() const {return Owner->DepType(S->Type);} //Nice printable representation friend std::ostream& operator <<(std::ostream& out, DepIterator D); @@ -302,13 +302,13 @@ class pkgCache::DepIterator : public Iterator { Iterator(Owner, Trg), Type(DepVer) { if (S == 0) S = Owner.DepP; - }; + } inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) : Iterator(Owner, Trg), Type(DepRev) { if (S == 0) S = Owner.DepP; - }; - inline DepIterator() : Iterator(), Type(DepVer) {}; + } + inline DepIterator() : Iterator(), Type(DepVer) {} }; /*}}}*/ // Provides iterator /*{{{*/ @@ -318,34 +318,34 @@ class pkgCache::PrvIterator : public Iterator { protected: inline Provides* OwnerPointer() const { return (Owner != 0) ? Owner->ProvideP : 0; - }; + } public: // Iteration void operator ++(int) {if (S != Owner->ProvideP) S = Owner->ProvideP + - (Type == PrvVer?S->NextPkgProv:S->NextProvides);}; - inline void operator ++() {operator ++(0);}; + (Type == PrvVer?S->NextPkgProv:S->NextProvides);} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;}; - inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;}; - inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}; - inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}; - inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);}; + inline const char *Name() const {return Owner->StrP + Owner->PkgP[S->ParentPkg].Name;} + inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;} + inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);} + inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);} + inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);} bool IsMultiArchImplicit() const; - inline PrvIterator() : Iterator(), Type(PrvVer) {}; + inline PrvIterator() : Iterator(), Type(PrvVer) {} inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : Iterator(Owner, Trg), Type(PrvVer) { if (S == 0) S = Owner.ProvideP; - }; + } inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) : Iterator(Owner, Trg), Type(PrvPkg) { if (S == 0) S = Owner.ProvideP; - }; + } }; /*}}}*/ // Package file /*{{{*/ @@ -353,32 +353,32 @@ class pkgCache::PkgFileIterator : public Iterator protected: inline PackageFile* OwnerPointer() const { return (Owner != 0) ? Owner->PkgFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}; - inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;}; - inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;}; - inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;}; - inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;}; - inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;}; - inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;}; - inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;}; - inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;}; - inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;}; + inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;} + inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;} + inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;} + inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;} + inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;} + inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;} + inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;} + inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;} + inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;} + inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;} bool IsOk(); std::string RelStr(); // Constructors - inline PkgFileIterator() : Iterator() {}; - inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {}; - inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {}; + inline PkgFileIterator() : Iterator() {} + inline PkgFileIterator(pkgCache &Owner) : Iterator(Owner, Owner.PkgFileP) {} + inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Version File /*{{{*/ @@ -386,18 +386,18 @@ class pkgCache::VerFileIterator : public pkgCache::IteratorVerFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline VerFileIterator() : Iterator() {}; - inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {}; + inline VerFileIterator() : Iterator() {} + inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Description File /*{{{*/ @@ -405,40 +405,40 @@ class pkgCache::DescFileIterator : public Iterator { protected: inline DescFile* OwnerPointer() const { return (Owner != 0) ? Owner->DescFileP : 0; - }; + } public: // Iteration - void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;}; - inline void operator ++() {operator ++(0);}; + void operator ++(int) {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile;} + inline void operator ++() {operator ++(0);} // Accessors - inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);}; + inline PkgFileIterator File() const {return PkgFileIterator(*Owner,S->File + Owner->PkgFileP);} - inline DescFileIterator() : Iterator() {}; - inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {}; + inline DescFileIterator() : Iterator() {} + inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator(Owner, Trg) {} }; /*}}}*/ // Inlined Begin functions can't be in the class because of order problems /*{{{*/ inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const - {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}; + {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);} inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const - {return VerIterator(*Owner,Owner->VerP + S->VersionList);}; + {return VerIterator(*Owner,Owner->VerP + S->VersionList);} inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const - {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);}; + {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);} inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const - {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);}; + {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);} inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const - {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);}; + {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);} inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const - {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}; + {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);} inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const - {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);}; + {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);} inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const - {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}; + {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);} inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const - {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}; + {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);} /*}}}*/ #endif diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index ce502d8ca..ef28bbc34 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -43,8 +43,8 @@ class CacheSetHelper { /*{{{*/ public: /*{{{*/ CacheSetHelper(bool const ShowError = true, GlobalError::MsgType ErrorType = GlobalError::ERROR) : - ShowError(ShowError), ErrorType(ErrorType) {}; - virtual ~CacheSetHelper() {}; + ShowError(ShowError), ErrorType(ErrorType) {} + virtual ~CacheSetHelper() {} virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern); @@ -76,9 +76,9 @@ public: /*{{{*/ virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg); - bool showErrors() const { return ShowError; }; - bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }; - GlobalError::MsgType errorType() const { return ErrorType; }; + bool showErrors() const { return ShowError; } + bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); } + GlobalError::MsgType errorType() const { return ErrorType; } GlobalError::MsgType errorType(GlobalError::MsgType const &newValue) { if (ErrorType == newValue) return ErrorType; @@ -87,7 +87,7 @@ public: /*{{{*/ ErrorType = newValue; return oldValue; } - }; + } /*}}}*/ protected: @@ -124,12 +124,12 @@ public: inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); } inline const char *CandVersion() const { return getPkg().CandVersion(); } inline const char *CurVersion() const { return getPkg().CurVersion(); } - inline pkgCache *Cache() const { return getPkg().Cache(); }; - inline unsigned long Index() const {return getPkg().Index();}; + inline pkgCache *Cache() const { return getPkg().Cache(); } + inline unsigned long Index() const {return getPkg().Index();} // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Package const * operator->() const {return &*getPkg();}; + inline pkgCache::Package const * operator->() const {return &*getPkg();} }; /*}}}*/ @@ -154,7 +154,7 @@ public: unsigned short ID; const char * const Alias; Position Pos; - Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {}; + Modifier (unsigned short const &id, const char * const alias, Position const &pos) : ID(id), Alias(alias), Pos(pos) {} }; static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci, @@ -177,12 +177,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public PackageContainerInterface::const_iterator, @@ -191,43 +191,43 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::PkgIterator getPkg(void) const { return *_iter; } - inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; + inline pkgCache::PkgIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename PackageContainer::const_iterator() { return typename PackageContainer::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; }; - template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; + bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; } + template void insert(PackageContainer const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }; + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); } - void setConstructor(Constructor const &by) { ConstructedBy = by; }; - Constructor getConstructor() const { return ConstructedBy; }; + void setConstructor(Constructor const &by) { ConstructedBy = by; } + Constructor getConstructor() const { return ConstructedBy; } - PackageContainer() : ConstructedBy(UNKNOWN) {}; - PackageContainer(Constructor const &by) : ConstructedBy(by) {}; + PackageContainer() : ConstructedBy(UNKNOWN) {} + PackageContainer(Constructor const &by) : ConstructedBy(by) {} /** \brief returns all packages in the cache who belong to the given task @@ -365,7 +365,7 @@ private: /*{{{*/ template<> template void PackageContainer >::insert(PackageContainer const &pkgcont) { for (typename PackageContainer::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p) _cont.push_back(*p); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool PackageContainer >::insert(pkgCache::PkgIterator const &P) { @@ -373,11 +373,11 @@ template<> inline bool PackageContainer >::inse return false; _cont.push_back(P); return true; -}; +} template<> inline void PackageContainer >::insert(const_iterator begin, const_iterator end) { for (const_iterator p = begin; p != end; ++p) _cont.push_back(*p); -}; +} typedef PackageContainer > PackageSet; typedef PackageContainer > PackageList; @@ -392,27 +392,27 @@ public: virtual pkgCache::VerIterator getVer() const = 0; operator pkgCache::VerIterator(void) { return getVer(); } - inline pkgCache *Cache() const { return getVer().Cache(); }; - inline unsigned long Index() const {return getVer().Index();}; - inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); }; - inline const char *VerStr() const { return getVer().VerStr(); }; - inline const char *Section() const { return getVer().Section(); }; - inline const char *Arch() const { return getVer().Arch(); }; - inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); }; - inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); }; - inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); }; - inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); }; - inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); }; - inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); }; - inline bool Downloadable() const { return getVer().Downloadable(); }; - inline const char *PriorityType() const { return getVer().PriorityType(); }; - inline std::string RelStr() const { return getVer().RelStr(); }; - inline bool Automatic() const { return getVer().Automatic(); }; - inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); }; + inline pkgCache *Cache() const { return getVer().Cache(); } + inline unsigned long Index() const {return getVer().Index();} + inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); } + inline const char *VerStr() const { return getVer().VerStr(); } + inline const char *Section() const { return getVer().Section(); } + inline const char *Arch() const { return getVer().Arch(); } + inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); } + inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); } + inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); } + inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); } + inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); } + inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); } + inline bool Downloadable() const { return getVer().Downloadable(); } + inline const char *PriorityType() const { return getVer().PriorityType(); } + inline std::string RelStr() const { return getVer().RelStr(); } + inline bool Automatic() const { return getVer().Automatic(); } + inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); } // we have only valid iterators here - inline bool end() const { return false; }; + inline bool end() const { return false; } - inline pkgCache::Version const * operator->() const { return &*getVer(); }; + inline pkgCache::Version const * operator->() const { return &*getVer(); } }; /*}}}*/ @@ -446,7 +446,7 @@ public: Version SelectVersion; Modifier (unsigned short const &id, const char * const alias, Position const &pos, Version const &select) : ID(id), Alias(alias), Pos(pos), - SelectVersion(select) {}; + SelectVersion(select) {} }; static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache, @@ -509,12 +509,12 @@ public: /*{{{*/ public: const_iterator(typename Container::const_iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::const_iterator(void) const { return _iter; } inline const_iterator& operator++() { ++_iter; return *this; } inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }; + inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; } + inline bool operator==(const_iterator const &i) const { return _iter == i._iter; } friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); } }; class iterator : public VersionContainerInterface::const_iterator, @@ -523,36 +523,36 @@ public: /*{{{*/ public: iterator(typename Container::iterator i) : _iter(i) {} pkgCache::VerIterator getVer(void) const { return *_iter; } - inline pkgCache::VerIterator operator*(void) const { return *_iter; }; + inline pkgCache::VerIterator operator*(void) const { return *_iter; } operator typename Container::iterator(void) const { return _iter; } operator typename VersionContainer::const_iterator() { return typename VersionContainer::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } - inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; - inline bool operator==(iterator const &i) const { return _iter == i._iter; }; - inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }; - inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }; + inline bool operator!=(iterator const &i) const { return _iter != i._iter; } + inline bool operator==(iterator const &i) const { return _iter == i._iter; } + inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; } + inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; } friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); } }; /*}}}*/ - bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; }; - template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }; - void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }; - bool empty() const { return _cont.empty(); }; - void clear() { return _cont.clear(); }; + bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; } + template void insert(VersionContainer const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); } + void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); } + bool empty() const { return _cont.empty(); } + void clear() { return _cont.clear(); } //FIXME: on ABI break, replace the first with the second without bool - void erase(iterator position) { _cont.erase((typename Container::iterator)position); }; - iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }; - size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }; - void erase(iterator first, iterator last) { _cont.erase(first, last); }; - size_t size() const { return _cont.size(); }; - - const_iterator begin() const { return const_iterator(_cont.begin()); }; - const_iterator end() const { return const_iterator(_cont.end()); }; - iterator begin() { return iterator(_cont.begin()); }; - iterator end() { return iterator(_cont.end()); }; - const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }; + void erase(iterator position) { _cont.erase((typename Container::iterator)position); } + iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); } + size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); } + void erase(iterator first, iterator last) { _cont.erase(first, last); } + size_t size() const { return _cont.size(); } + + const_iterator begin() const { return const_iterator(_cont.begin()); } + const_iterator end() const { return const_iterator(_cont.end()); } + iterator begin() { return iterator(_cont.begin()); } + iterator end() { return iterator(_cont.end()); } + const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); } /** \brief returns all versions specified on the commandline @@ -659,7 +659,7 @@ public: /*{{{*/ template<> template void VersionContainer >::insert(VersionContainer const &vercont) { for (typename VersionContainer::const_iterator v = vercont.begin(); v != vercont.end(); ++v) _cont.push_back(*v); -}; +} // these two are 'inline' as otherwise the linker has problems with seeing these untemplated // specializations again and again - but we need to see them, so that library users can use them template<> inline bool VersionContainer >::insert(pkgCache::VerIterator const &V) { @@ -667,11 +667,11 @@ template<> inline bool VersionContainer >::inse return false; _cont.push_back(V); return true; -}; +} template<> inline void VersionContainer >::insert(const_iterator begin, const_iterator end) { for (const_iterator v = begin; v != end; ++v) _cont.push_back(*v); -}; +} typedef VersionContainer > VersionSet; typedef VersionContainer > VersionList; } diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 3ae1e8b1d..838c8887a 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -933,10 +933,10 @@ pkgUdevCdromDevices::Dlopen() /*{{{*/ // convenience interface, this will just call ScanForRemovable vector pkgUdevCdromDevices::Scan() -{ +{ bool CdromOnly = _config->FindB("APT::cdrom::CdromOnly", true); - return ScanForRemovable(CdromOnly); -}; + return ScanForRemovable(CdromOnly); +} /*}}}*/ /*{{{*/ vector diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 8eddd56d4..003fd01d8 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -43,8 +43,7 @@ Configuration::Configuration() : ToFree(true) } Configuration::Configuration(const Item *Root) : Root((Item *)Root), ToFree(false) { -}; - +} /*}}}*/ // Configuration::~Configuration - Destructor /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index d457781c3..2d25f5ed9 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -223,7 +223,7 @@ void GlobalError::DumpErrors(std::ostream &out, MsgType const &threshold, void GlobalError::Discard() { Messages.clear(); PendingFlag = false; -}; +} /*}}}*/ // GlobalError::empty - does our error list include anything? /*{{{*/ bool GlobalError::empty(MsgType const &trashhold) const { diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index 1d79a52ac..d9712d6a8 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -45,7 +45,7 @@ inline void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); -}; +} #undef APT_noreturn diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 916e1d730..9d74ed495 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -125,14 +125,14 @@ bool OpProgress::CheckChange(float Interval) // OpTextProgress::OpTextProgress - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -OpTextProgress::OpTextProgress(Configuration &Config) : - NoUpdate(false), NoDisplay(false), LastLen(0) +OpTextProgress::OpTextProgress(Configuration &Config) : + NoUpdate(false), NoDisplay(false), LastLen(0) { if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true) NoUpdate = true; if (Config.FindI("quiet",0) >= 2) NoDisplay = true; -}; +} /*}}}*/ // OpTextProgress::Done - Clean up the display /*{{{*/ // --------------------------------------------------------------------- @@ -150,12 +150,12 @@ void OpTextProgress::Done() cout << endl; OldOp = string(); } - + if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false) { OldOp = string(); - cout << endl; - } + cout << endl; + } } /*}}}*/ // OpTextProgress::Update - Simple text spinner /*{{{*/ diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index f8bb3890d..0d85b4fd3 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -153,7 +153,7 @@ char *_strrstrip(char *String) End++; *End = 0; return String; -}; +} /*}}}*/ // strtabexpand - Converts tabs into 8 spaces /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 8d746f10e..3a6d38b75 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -37,8 +37,8 @@ namespace APT { namespace String { std::string Strip(const std::string &s); bool Endswith(const std::string &s, const std::string &ending); - }; -}; + } +} bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest); @@ -104,17 +104,17 @@ int tolower_ascii(int const c) __attrib_const __hot; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ -inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);}; +inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ +inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ +inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ +inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} #define APT_MKSTRCMP2(name,func) \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \ -inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \ -inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);}; +inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ +inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ +inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); @@ -132,18 +132,18 @@ int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));}; -inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));}; +inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} +inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} #endif -APT_MKSTRCMP2(stringcmp,stringcmp); -APT_MKSTRCMP2(stringcasecmp,stringcasecmp); +APT_MKSTRCMP2(stringcmp,stringcmp) +APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array size_t strv_length(const char **str_array); -inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);}; +inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} class URI { @@ -159,13 +159,13 @@ class URI unsigned int Port; operator std::string(); - inline void operator =(const std::string &From) {CopyFrom(From);}; + inline void operator =(const std::string &From) {CopyFrom(From);} inline bool empty() {return Access.empty();}; static std::string SiteOnly(const std::string &URI); static std::string NoUserPassword(const std::string &URI); - URI(std::string Path) {CopyFrom(Path);}; - URI() : Port(0) {}; + URI(std::string Path) {CopyFrom(Path);} + URI() : Port(0) {} }; struct SubstVar diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index a12e6963d..90d0c9314 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1686,9 +1686,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) /*}}}*/ // Policy::GetPriority - Get the priority of the package pin /*{{{*/ signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &Pkg) -{ return 0; }; +{ return 0; } signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &File) -{ return 0; }; +{ return 0; } /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ { diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 9ea244139..89c9d531f 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -646,12 +646,12 @@ bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]) { ExecGPGV(File, FileOut, statusfd, fd); return false; -}; +} bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd) { ExecGPGV(File, FileOut, statusfd); return false; -}; +} /*}}}*/ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ vector &List, pkgCdromStatus *log) diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index a3a4cc0e1..aec744360 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -371,5 +371,5 @@ bool PackageManagerText::StatusChanged(std::string PackageName, -}; // namespace progress -}; // namespace apt +} // namespace progress +} // namespace apt diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h index 8a5b68a8f..8bcc32927 100644 --- a/apt-pkg/install-progress.h +++ b/apt-pkg/install-progress.h @@ -24,7 +24,7 @@ namespace Progress { int last_reported_progress; public: - PackageManager() + PackageManager() : percentage(0.0), last_reported_progress(-1) {}; virtual ~PackageManager() {}; @@ -32,8 +32,8 @@ namespace Progress { virtual void Start(int child_pty=-1) {}; virtual void Stop() {}; - /* When dpkg is invoked (may happen multiple times for each - * install/remove block + /* When dpkg is invoked (may happen multiple times for each + * install/remove block */ virtual void StartDpkg() {}; @@ -44,18 +44,18 @@ namespace Progress { return 500000; }; - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string HumanReadableAction) ; - virtual void Error(std::string PackageName, + std::string HumanReadableAction); + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ErrorMessage) {}; + std::string ErrorMessage) {} virtual void ConffilePrompt(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, - std::string ConfMessage) {}; + std::string ConfMessage) {} }; class PackageManagerProgressFd : public PackageManager @@ -72,11 +72,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -101,11 +101,11 @@ namespace Progress { virtual void StartDpkg(); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); - virtual void Error(std::string PackageName, + virtual void Error(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string ErrorMessage); @@ -134,7 +134,7 @@ namespace Progress { ~PackageManagerFancy(); virtual void Start(int child_pty=-1); virtual void Stop(); - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); @@ -143,14 +143,14 @@ namespace Progress { class PackageManagerText : public PackageManager { public: - virtual bool StatusChanged(std::string PackageName, + virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, unsigned int TotalSteps, std::string HumanReadableAction); }; -}; // namespace Progress -}; // namespace APT +} // namespace Progress +} // namespace APT #endif diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 67a2a709d..7d57640c5 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -414,7 +414,7 @@ pkgCache::PkgIterator pkgCache::GrpIterator::NextPkg(pkgCache::PkgIterator const // GrpIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical group in the hash table. */ -void pkgCache::GrpIterator::operator ++(int) +void pkgCache::GrpIterator::operator ++(int) { // Follow the current links if (S != Owner->GrpP) @@ -426,12 +426,12 @@ void pkgCache::GrpIterator::operator ++(int) HashIndex++; S = Owner->GrpP + Owner->HeaderP->GrpHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::operator ++ - Postfix incr /*{{{*/ // --------------------------------------------------------------------- /* This will advance to the next logical package in the hash table. */ -void pkgCache::PkgIterator::operator ++(int) +void pkgCache::PkgIterator::operator ++(int) { // Follow the current links if (S != Owner->PkgP) @@ -443,7 +443,7 @@ void pkgCache::PkgIterator::operator ++(int) HashIndex++; S = Owner->PkgP + Owner->HeaderP->PkgHashTable[HashIndex]; } -}; +} /*}}}*/ // PkgIterator::State - Check the State of the package /*{{{*/ // --------------------------------------------------------------------- @@ -475,26 +475,26 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const // --------------------------------------------------------------------- /* Return string representing of the candidate version. */ const char * -pkgCache::PkgIterator::CandVersion() const +pkgCache::PkgIterator::CandVersion() const { //TargetVer is empty, so don't use it. VerIterator version = pkgPolicy(Owner).GetCandidateVer(*this); if (version.IsGood()) return version.VerStr(); return 0; -}; +} /*}}}*/ // PkgIterator::CurVersion - Returns the current version string /*{{{*/ // --------------------------------------------------------------------- /* Return string representing of the current version. */ const char * -pkgCache::PkgIterator::CurVersion() const +pkgCache::PkgIterator::CurVersion() const { VerIterator version = CurrentVer(); if (version.IsGood()) return CurrentVer().VerStr(); return 0; -}; +} /*}}}*/ // ostream operator to handle string representation of a package /*{{{*/ // --------------------------------------------------------------------- @@ -978,7 +978,7 @@ string pkgCache::PkgFileIterator::RelStr() /*}}}*/ // VerIterator::TranslatedDescription - Return the a DescIter for locale/*{{{*/ // --------------------------------------------------------------------- -/* return a DescIter for the current locale or the default if none is +/* return a DescIter for the current locale or the default if none is * found */ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const @@ -1012,7 +1012,7 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const if (strcmp(Desc.LanguageCode(), "") == 0) return Desc; return DescriptionList(); -}; +} /*}}}*/ // PrvIterator::IsMultiArchImplicit - added by the cache generation /*{{{*/ diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 669904c84..9a88246a1 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -176,13 +176,13 @@ class pkgCache /*{{{*/ char *StrP; virtual bool ReMap(bool const &Errorchecks = true); - inline bool Sync() {return Map.Sync();}; - inline MMap &GetMap() {return Map;}; - inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; + inline bool Sync() {return Map.Sync();} + inline MMap &GetMap() {return Map;} + inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();} // String hashing function (512 range) - inline unsigned long Hash(const std::string &S) const {return sHash(S);}; - inline unsigned long Hash(const char *S) const {return sHash(S);}; + inline unsigned long Hash(const std::string &S) const {return sHash(S);} + inline unsigned long Hash(const char *S) const {return sHash(S);} // Useful transformation things const char *Priority(unsigned char Priority); @@ -192,7 +192,7 @@ class pkgCache /*{{{*/ PkgIterator FindPkg(const std::string &Name); PkgIterator FindPkg(const std::string &Name, const std::string &Arch); - Header &Head() {return *HeaderP;}; + Header &Head() {return *HeaderP;} inline GrpIterator GrpBegin(); inline GrpIterator GrpEnd(); inline PkgIterator PkgBegin(); @@ -200,7 +200,7 @@ class pkgCache /*{{{*/ inline PkgFileIterator FileBegin(); inline PkgFileIterator FileEnd(); - inline bool MultiArchCache() const { return MultiArchEnabled; }; + inline bool MultiArchCache() const { return MultiArchEnabled; } inline char const * const NativeArch() const; // Make me a function @@ -212,7 +212,7 @@ class pkgCache /*{{{*/ static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); - virtual ~pkgCache() {}; + virtual ~pkgCache() {} private: bool MultiArchEnabled; @@ -662,26 +662,26 @@ struct pkgCache::StringItem inline char const * const pkgCache::NativeArch() const - { return StrP + HeaderP->Architecture; }; + { return StrP + HeaderP->Architecture; } #include -inline pkgCache::GrpIterator pkgCache::GrpBegin() - {return GrpIterator(*this);}; -inline pkgCache::GrpIterator pkgCache::GrpEnd() - {return GrpIterator(*this,GrpP);}; -inline pkgCache::PkgIterator pkgCache::PkgBegin() - {return PkgIterator(*this);}; -inline pkgCache::PkgIterator pkgCache::PkgEnd() - {return PkgIterator(*this,PkgP);}; +inline pkgCache::GrpIterator pkgCache::GrpBegin() + {return GrpIterator(*this);} +inline pkgCache::GrpIterator pkgCache::GrpEnd() + {return GrpIterator(*this,GrpP);} +inline pkgCache::PkgIterator pkgCache::PkgBegin() + {return PkgIterator(*this);} +inline pkgCache::PkgIterator pkgCache::PkgEnd() + {return PkgIterator(*this,PkgP);} inline pkgCache::PkgFileIterator pkgCache::FileBegin() - {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}; + {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);} inline pkgCache::PkgFileIterator pkgCache::FileEnd() - {return PkgFileIterator(*this,PkgFileP);}; + {return PkgFileIterator(*this,PkgFileP);} // Oh I wish for Real Name Space Support class pkgCache::Namespace /*{{{*/ -{ +{ public: typedef pkgCache::GrpIterator GrpIterator; typedef pkgCache::PkgIterator PkgIterator; @@ -690,7 +690,7 @@ class pkgCache::Namespace /*{{{*/ typedef pkgCache::DepIterator DepIterator; typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PkgFileIterator PkgFileIterator; - typedef pkgCache::VerFileIterator VerFileIterator; + typedef pkgCache::VerFileIterator VerFileIterator; typedef pkgCache::Version Version; typedef pkgCache::Description Description; typedef pkgCache::Package Package; diff --git a/apt-pkg/upgrade.h b/apt-pkg/upgrade.h index c4973472f..436d38300 100644 --- a/apt-pkg/upgrade.h +++ b/apt-pkg/upgrade.h @@ -15,7 +15,7 @@ namespace APT { // FIXME: make this "enum class UpgradeMode {" once we enable c++11 enum UpgradeMode { FORBID_REMOVE_PACKAGES = 1, - FORBID_INSTALL_NEW_PACKAGES = 2, + FORBID_INSTALL_NEW_PACKAGES = 2 }; bool Upgrade(pkgDepCache &Cache, int UpgradeMode); } diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index d25ffef75..66e1600f1 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -42,12 +42,12 @@ AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int const Quiet) // AcqTextStatus::Start - Downloading has started /*{{{*/ // --------------------------------------------------------------------- /* */ -void AcqTextStatus::Start() +void AcqTextStatus::Start() { - pkgAcquireStatus::Start(); + pkgAcquireStatus::Start(); BlankLine[0] = 0; ID = 1; -}; +} /*}}}*/ // AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/ // --------------------------------------------------------------------- @@ -58,14 +58,14 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm) return; if (Quiet <= 0) - cout << '\r' << BlankLine << '\r'; - + cout << '\r' << BlankLine << '\r'; + cout << _("Hit ") << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fetch - An item has started to download /*{{{*/ // --------------------------------------------------------------------- @@ -75,20 +75,20 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) Update = true; if (Itm.Owner->Complete == true) return; - + Itm.Owner->ID = ID++; - + if (Quiet > 1) return; if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description; if (Itm.Owner->FileSize != 0) cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; cout << endl; -}; +} /*}}}*/ // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- @@ -96,7 +96,7 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) { Update = true; -}; +} /*}}}*/ // AcqTextStatus::Fail - Called when an item fails to download /*{{{*/ // --------------------------------------------------------------------- @@ -109,10 +109,10 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) // Ignore certain kinds of transient failures (bad code) if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) return; - + if (Quiet <= 0) cout << '\r' << BlankLine << '\r'; - + if (Itm.Owner->Status == pkgAcquire::Item::StatDone) { cout << _("Ign ") << Itm.Description << endl; @@ -122,9 +122,9 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) cout << _("Err ") << Itm.Description << endl; cout << " " << Itm.Owner->ErrorText << endl; } - + Update = true; -}; +} /*}}}*/ // AcqTextStatus::Stop - Finished downloading /*{{{*/ // --------------------------------------------------------------------- @@ -154,12 +154,12 @@ void AcqTextStatus::Stop() bool AcqTextStatus::Pulse(pkgAcquire *Owner) { pkgAcquireStatus::Pulse(Owner); - + if (Quiet > 0) return true; - + enum {Long = 0,Medium,Short} Mode = Medium; - + char Buffer[sizeof(BlankLine)]; char *End = Buffer + sizeof(Buffer); char *S = Buffer; @@ -174,8 +174,8 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) I = Owner->WorkerStep(I)) { S += strlen(S); - - // There is no item running + + // There is no item running if (I->CurrentItem == 0) { if (I->Status.empty() == false) @@ -183,12 +183,12 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," [%s]",I->Status.c_str()); Shown = true; } - + continue; } Shown = true; - + // Add in the short description if (I->CurrentItem->Owner->ID != 0) snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID, @@ -203,7 +203,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode); S += strlen(S); } - + // Add the current progress if (Mode == Long) snprintf(S,End-S," %llu",I->CurrentSize); @@ -213,7 +213,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str()); } S += strlen(S); - + // Add the total size and percent if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false) { @@ -223,7 +223,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) else snprintf(S,End-S,"/%sB %.0f%%",SizeToStr(I->TotalSize).c_str(), (I->CurrentSize*100.0)/I->TotalSize); - } + } S += strlen(S); snprintf(S,End-S,"]"); } @@ -231,26 +231,26 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) // Show something.. if (Shown == false) snprintf(S,End-S,_(" [Working]")); - + /* Put in the ETA and cps meter, block off signals to prevent strangeness during resizing */ sigset_t Sigs,OldSigs; sigemptyset(&Sigs); sigaddset(&Sigs,SIGWINCH); sigprocmask(SIG_BLOCK,&Sigs,&OldSigs); - + if (CurrentCPS != 0) - { + { char Tmp[300]; unsigned long long ETA = (TotalBytes - CurrentBytes)/CurrentCPS; sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str()); unsigned int Len = strlen(Buffer); unsigned int LenT = strlen(Tmp); if (Len + LenT < ScreenWidth) - { + { memset(Buffer + Len,' ',ScreenWidth - Len); strcpy(Buffer + ScreenWidth - LenT,Tmp); - } + } } Buffer[ScreenWidth] = 0; BlankLine[ScreenWidth] = 0; @@ -268,7 +268,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) memset(BlankLine,' ',strlen(Buffer)); BlankLine[strlen(Buffer)] = 0; - + Update = false; return true; diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index 20c6e8892..9aaebefd7 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -54,7 +54,7 @@ class pkgCdromTextStatus : public pkgCdromStatus /*{{{*/ { protected: OpTextProgress Progress; - void Prompt(const char *Text); + void Prompt(const char *Text); string PromptLine(const char *Text); bool AskCdromName(string &name); @@ -64,12 +64,12 @@ public: virtual OpProgress* GetOpProgress(); }; -void pkgCdromTextStatus::Prompt(const char *Text) +void pkgCdromTextStatus::Prompt(const char *Text) { char C; cout << Text << ' ' << flush; if (read(STDIN_FILENO,&C,1) < 0) - _error->Errno("pkgCdromTextStatus::Prompt", + _error->Errno("pkgCdromTextStatus::Prompt", "Failed to read from standard input (not a terminal?)"); if (C != '\n') cout << endl; @@ -78,37 +78,37 @@ void pkgCdromTextStatus::Prompt(const char *Text) string pkgCdromTextStatus::PromptLine(const char *Text) { cout << Text << ':' << endl; - + string Res; getline(cin,Res); return Res; } -bool pkgCdromTextStatus::AskCdromName(string &name) +bool pkgCdromTextStatus::AskCdromName(string &name) { cout << _("Please provide a name for this Disc, such as 'Debian 5.0.3 Disk 1'") << flush; name = PromptLine(""); - + return true; } - -void pkgCdromTextStatus::Update(string text, int current) + +void pkgCdromTextStatus::Update(string text, int current) { if(text.size() > 0) cout << text << flush; } -bool pkgCdromTextStatus::ChangeCdrom() +bool pkgCdromTextStatus::ChangeCdrom() { Prompt(_("Please insert a Disc in the drive and press enter")); return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() -{ - return &Progress; -}; +OpProgress* pkgCdromTextStatus::GetOpProgress() +{ + return &Progress; +} /*}}}*/ // SetupAutoDetect /*{{{*/ bool AutoDetectCdrom(pkgUdevCdromDevices &UdevCdroms, unsigned int &i, bool &automounted) diff --git a/ftparchive/override.cc b/ftparchive/override.cc index d2130db8a..82cbc4c19 100644 --- a/ftparchive/override.cc +++ b/ftparchive/override.cc @@ -201,7 +201,7 @@ bool Override::ReadExtraOverride(string const &File,bool const &Source) } /*}}}*/ -// Override::GetItem - Get a architecture specific item /*{{{*/ +// Override::GetItem - Get a architecture specific item /*{{{*/ // --------------------------------------------------------------------- /* Returns a override item for the given package and the given architecture. * Treats "all" special @@ -232,10 +232,10 @@ Override::Item* Override::GetItem(string const &Package, string const &Architect { result->FieldOverride[foI->first] = foI->second; } - } - } + } + } return result; -}; +} // Override::Item::SwapMaint - Swap the maintainer field if necessary /*{{{*/ diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 22d4b9164..3c14d9dfb 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -62,7 +62,7 @@ CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly | MountedByApt(false) { UdevCdroms.Dlopen(); -}; +} /*}}}*/ // CDROMMethod::Exit - Unmount the disc if necessary /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/http.cc b/methods/http.cc index 42b31beeb..16c6d19e1 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -61,7 +61,7 @@ unsigned long long CircleBuf::BwReadLimit=0; unsigned long long CircleBuf::BwTickReadData=0; struct timeval CircleBuf::BwReadTick={0,0}; const unsigned int CircleBuf::BW_HZ=10; - + // CircleBuf::CircleBuf - Circular input buffer /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -87,8 +87,8 @@ void CircleBuf::Reset() { delete Hash; Hash = new Hashes; - } -}; + } +} /*}}}*/ // CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/https.cc b/methods/https.cc index febe6a0f0..b0c7ee71d 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -432,7 +432,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) delete File; return true; -}; +} int main() { diff --git a/methods/mirror.cc b/methods/mirror.cc index 085f3717b..977eddcf5 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -60,7 +60,7 @@ using namespace std; MirrorMethod::MirrorMethod() : HttpMethod(), DownloadedMirrorFile(false), Debug(false) { -}; +} // HttpMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- @@ -90,17 +90,17 @@ bool MirrorMethod::Clean(string Dir) pkgSourceList list; list.ReadMainList(); - DIR *D = opendir(Dir.c_str()); + DIR *D = opendir(Dir.c_str()); if (D == 0) return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); - + string StartDir = SafeGetCWD(); if (chdir(Dir.c_str()) != 0) { closedir(D); return _error->Errno("chdir",_("Unable to change to %s"),Dir.c_str()); } - + for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D)) { // Skip some files.. @@ -123,23 +123,23 @@ bool MirrorMethod::Clean(string Dir) // nothing found, nuke it if (I == list.end()) unlink(Dir->d_name); - }; + } closedir(D); if (chdir(StartDir.c_str()) != 0) return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str()); - return true; + return true; } bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) { - // not that great to use pkgAcquire here, but we do not have + // not that great to use pkgAcquire here, but we do not have // any other way right now string fetch = BaseUri; fetch.replace(0,strlen("mirror://"),"http://"); -#if 0 // no need for this, the getArchitectures() will also include the main +#if 0 // no need for this, the getArchitectures() will also include the main // arch // append main architecture fetch += "?arch=" + _config->Find("Apt::Architecture"); @@ -173,7 +173,7 @@ bool MirrorMethod::DownloadMirrorFile(string mirror_uri_str) if(Debug) clog << "MirrorMethod::DownloadMirrorFile() success: " << res << endl; - + return res; } @@ -187,13 +187,13 @@ bool MirrorMethod::RandomizeMirrorFile(string mirror_file) if (!FileExists(mirror_file)) return false; - // read + // read ifstream in(mirror_file.c_str()); while ( !in.eof() ) { getline(in, line); content.push_back(line); } - + // we want the file to be random for each different machine, but also // "stable" on the same machine. this is to avoid running into out-of-sync // issues (i.e. Release/Release.gpg different on each mirror) @@ -422,10 +422,10 @@ bool MirrorMethod::Fetch(FetchItem *Itm) if(Debug) clog << "Fetch: " << Itm->Uri << endl << endl; - + // now run the real fetcher return HttpMethod::Fetch(Itm); -}; +} void MirrorMethod::Fail(string Err,bool Transient) { @@ -437,7 +437,7 @@ void MirrorMethod::Fail(string Err,bool Transient) // try the next mirror on fail (if its not a expected failure, // e.g. translations are ok to ignore) - if (!Queue->FailIgnore && TryNextMirror()) + if (!Queue->FailIgnore && TryNextMirror()) return; // all mirrors failed, so bail out diff --git a/methods/rsh.cc b/methods/rsh.cc index 550f77eca..f065f6b89 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -368,7 +368,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig) signal(SIGINT,SigTerm); Server = 0; FailFd = -1; -}; +} /*}}}*/ // RSHMethod::Configuration - Handle a configuration message /*{{{*/ // --------------------------------------------------------------------- diff --git a/methods/server.cc b/methods/server.cc index ef90c809c..90e83d1af 100644 --- a/methods/server.cc +++ b/methods/server.cc @@ -119,10 +119,10 @@ bool ServerState::HeaderLine(string Line) string::size_type Pos2 = Pos; while (Pos2 < Line.length() && isspace(Line[Pos2]) != 0) Pos2++; - + string Tag = string(Line,0,Pos); string Val = string(Line,Pos2); - + if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0) { // Evil servers return no version @@ -159,14 +159,14 @@ bool ServerState::HeaderLine(string Line) } return true; - } - + } + if (stringcasecmp(Tag,"Content-Length:") == 0) { if (Encoding == Closes) Encoding = Stream; HaveContent = true; - + // The length is already set from the Content-Range header if (StartPos != 0) return true; @@ -184,7 +184,7 @@ bool ServerState::HeaderLine(string Line) HaveContent = true; return true; } - + if (stringcasecmp(Tag,"Content-Range:") == 0) { HaveContent = true; @@ -201,12 +201,12 @@ bool ServerState::HeaderLine(string Line) return _error->Error(_("This HTTP server has broken range support")); return true; } - + if (stringcasecmp(Tag,"Transfer-Encoding:") == 0) { HaveContent = true; if (stringcasecmp(Val,"chunked") == 0) - Encoding = Chunked; + Encoding = Chunked; return true; } @@ -218,7 +218,7 @@ bool ServerState::HeaderLine(string Line) Persistent = true; return true; } - + if (stringcasecmp(Tag,"Last-Modified:") == 0) { if (RFC1123StrToTime(Val.c_str(), Date) == false) @@ -413,7 +413,7 @@ bool ServerMethod::Fetch(FetchItem *) } return true; -}; +} /*}}}*/ // ServerMethod::Loop - Main loop /*{{{*/ int ServerMethod::Loop() diff --git a/methods/server.h b/methods/server.h index 2b81e6173..f1db9adf7 100644 --- a/methods/server.h +++ b/methods/server.h @@ -62,7 +62,7 @@ struct ServerState /** \brief IO error while retrieving */ RUN_HEADERS_IO_ERROR, /** \brief Parse error after retrieving */ - RUN_HEADERS_PARSE_ERROR, + RUN_HEADERS_PARSE_ERROR }; /** \brief Get the headers before the data */ RunHeadersResult RunHeaders(FileFd * const File); -- cgit v1.2.3