From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 From: Aleksei Nikiforov To: devel@lists.altlinux.org Date: Tue, 10 Dec 2019 18:23:06 +0300 Message-Id: <20191210152343.33867-2-darktemplar@altlinux.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210152343.33867-1-darktemplar@altlinux.org> References: <20191210152343.33867-1-darktemplar@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Aleksei Nikiforov Subject: [devel] [PATCH for apt 01/38] Replace post-increments with pre-increments X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 15:24:37 -0000 X-List-Received-Date: Tue, 10 Dec 2019 15:24:37 -0000 X-List-Received-Date: Tue, 10 Dec 2019 15:24:37 -0000 Archived-At: List-Archive: List-Post: Found via cppcheck --- apt/apt-pkg/acquire-item.cc | 4 ++-- apt/apt-pkg/contrib/configuration.cc | 2 +- apt/apt-pkg/orderlist.cc | 8 ++++---- apt/apt-pkg/packagemanager.cc | 12 ++++++------ apt/apt-pkg/pkgcachegen.cc | 8 ++++---- apt/apt-pkg/policy.cc | 6 +++--- apt/apt-pkg/rpm/rpmindexfile.cc | 2 +- apt/apt-pkg/rpm/rpmpackagedata.cc | 8 ++++---- apt/apt-pkg/rpm/rpmpm.cc | 6 +++--- apt/apt-pkg/sourcelist.cc | 22 +++++++++++----------- apt/apt-pkg/srcrecords.cc | 4 ++-- apt/apt-pkg/versionmatch.cc | 2 +- apt/cmdline/apt-cdrom.cc | 20 ++++++++++---------- apt/cmdline/apt-get.cc | 20 +++++++++----------- apt/cmdline/apt-shell.cc | 6 +++--- apt/cmdline/indexcopy.cc | 4 ++-- apt/cmdline/rpmindexcopy.cc | 4 ++-- apt/methods/ftp.cc | 2 +- apt/methods/http.cc | 10 +++++----- 19 files changed, 74 insertions(+), 76 deletions(-) diff --git a/apt/apt-pkg/acquire-item.cc b/apt/apt-pkg/acquire-item.cc index 9325c53..61592c8 100644 --- a/apt/apt-pkg/acquire-item.cc +++ b/apt/apt-pkg/acquire-item.cc @@ -486,7 +486,7 @@ void pkgAcqIndexRel::Done(const string &Message,unsigned long long Size,const st bool found = false; for (vector::const_iterator I = Repository->FingerPrint.begin(); - I != Repository->FingerPrint.end(); I++) + I != Repository->FingerPrint.end(); ++I) { // Match fingerprint of Release file if ((*I) == FingerPrint) @@ -501,7 +501,7 @@ void pkgAcqIndexRel::Done(const string &Message,unsigned long long Size,const st Status = StatError; ErrorText = _("Signature fingerprint of Release file does not match (expected "); for (vector::const_iterator I = Repository->FingerPrint.begin(); - I != Repository->FingerPrint.end(); I++) + I != Repository->FingerPrint.end(); ++I) ErrorText += "\n"+(*I); ErrorText += _(", got ")+FingerPrint+")"; return; diff --git a/apt/apt-pkg/contrib/configuration.cc b/apt/apt-pkg/contrib/configuration.cc index 59ee122..214babc 100644 --- a/apt/apt-pkg/contrib/configuration.cc +++ b/apt/apt-pkg/contrib/configuration.cc @@ -809,7 +809,7 @@ bool ReadConfigDir(Configuration &Conf,const string &Dir,bool AsSectional, sort(List.begin(),List.end()); // Read the files - for (vector::const_iterator I = List.begin(); I != List.end(); I++) + for (vector::const_iterator I = List.begin(); I != List.end(); ++I) if (ReadConfigFile(Conf,*I,AsSectional,Depth) == false) return false; return true; diff --git a/apt/apt-pkg/orderlist.cc b/apt/apt-pkg/orderlist.cc index f6081b3..d96a263 100644 --- a/apt/apt-pkg/orderlist.cc +++ b/apt/apt-pkg/orderlist.cc @@ -148,13 +148,13 @@ bool pkgOrderList::DoRun() Depth = 0; WipeFlags(Added | AddPending | Loop | InList); - for (iterator I = List; I != End; I++) + for (iterator I = List; I != End; ++I) Flag(*I,InList); // Rebuild the main list into the temp list. iterator OldEnd = End; End = NList; - for (iterator I = List; I != OldEnd; I++) + for (iterator I = List; I != OldEnd; ++I) if (VisitNode(PkgIterator(Cache,*I)) == false) { End = OldEnd; @@ -212,7 +212,7 @@ bool pkgOrderList::OrderUnpack(string *FileList) WipeFlags(After); // Set the inlist flag - for (iterator I = List; I != End; I++) + for (iterator I = List; I != End; ++I) { PkgIterator P(Cache,*I); if (IsMissing(P) == true && IsNow(P) == true) @@ -260,7 +260,7 @@ bool pkgOrderList::OrderUnpack(string *FileList) { clog << "** Unpack ordering done" << endl; - for (iterator I = List; I != End; I++) + for (iterator I = List; I != End; ++I) { PkgIterator P(Cache,*I); if (IsNow(P) == true) diff --git a/apt/apt-pkg/packagemanager.cc b/apt/apt-pkg/packagemanager.cc index c269d0c..0bcd902 100644 --- a/apt/apt-pkg/packagemanager.cc +++ b/apt/apt-pkg/packagemanager.cc @@ -65,7 +65,7 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, if (List->OrderUnpack() == false) return _error->Error("Internal ordering error"); - for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) + for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { PkgIterator Pkg(Cache,*I); FileNames[Pkg->ID] = string(); @@ -236,7 +236,7 @@ bool pkgPackageManager::ConfigureAll() pkgOrderList OList(&Cache); // Populate the order list - for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) + for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) if (List->IsFlag(pkgCache::PkgIterator(Cache,*I), pkgOrderList::UnPacked) == true) OList.push_back(*I); @@ -245,7 +245,7 @@ bool pkgPackageManager::ConfigureAll() return false; // Perform the configuring - for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) + for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I) { PkgIterator Pkg(Cache,*I); @@ -273,7 +273,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) return false; // Perform the configuring - for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++) + for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); ++I) { PkgIterator Pkg(Cache,*I); @@ -593,7 +593,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() clog << "Done ordering" << endl; bool DoneSomething = false; - for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) + for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { PkgIterator Pkg(Cache,*I); @@ -648,7 +648,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() return Failed; // Sanity check - for (pkgOrderList::iterator I = List->begin(); I != List->end(); I++) + for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { if (List->IsFlag(*I,pkgOrderList::Configured) == false) { diff --git a/apt/apt-pkg/pkgcachegen.cc b/apt/apt-pkg/pkgcachegen.cc index 56716b5..654c81c 100644 --- a/apt/apt-pkg/pkgcachegen.cc +++ b/apt/apt-pkg/pkgcachegen.cc @@ -802,7 +802,7 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start, verify the IMS data and check that it is on the disk too.. */ SPtrArray Visited = new bool[Cache.HeaderP->PackageFileCount]; memset(Visited,0,sizeof(*Visited)*Cache.HeaderP->PackageFileCount); - for (; Start != End; Start++) + for (; Start != End; ++Start) { if ((*Start)->HasPackages() == false) continue; @@ -845,7 +845,7 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start, static unsigned long long ComputeSize(FileIterator Start,FileIterator End) { unsigned long long TotalSize = 0; - for (; Start != End; Start++) + for (; Start != End; ++Start) { if ((*Start)->HasPackages() == false) continue; @@ -863,7 +863,7 @@ static bool BuildCache(pkgCacheGenerator &Gen, FileIterator Start, FileIterator End) { FileIterator I; - for (I = Start; I != End; I++) + for (I = Start; I != End; ++I) { if ((*I)->HasPackages() == false) continue; @@ -913,7 +913,7 @@ static bool CollectFileProvides(pkgCacheGenerator &Gen, unsigned long long &CurrentSize,unsigned long long TotalSize, FileIterator Start, FileIterator End) { - for (FileIterator I = Start; I != End; I++) + for (FileIterator I = Start; I != End; ++I) { if ((*I)->HasPackages() == false || (*I)->Exists() == false) continue; diff --git a/apt/apt-pkg/policy.cc b/apt/apt-pkg/policy.cc index 80722ae..ed0938a 100644 --- a/apt/apt-pkg/policy.cc +++ b/apt/apt-pkg/policy.cc @@ -86,7 +86,7 @@ bool pkgPolicy::InitDefaults() signed Cur = 989; StatusOverride = false; for (vector::const_iterator I = Defaults.begin(); I != Defaults.end(); - I++, Cur--) + ++I, --Cur) { pkgVersionMatch Match(I->Data,I->Type); for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); F++) @@ -197,7 +197,7 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type, const string &Name, { // Check the unmatched table for (vector::iterator I = Unmatched.begin(); - I != Unmatched.end() && P == 0; I++) + I != Unmatched.end() && P == 0; ++I) if (I->Pkg == Name) P = &*I; @@ -343,7 +343,7 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir) sort(List.begin(),List.end()); // Read the files - for (vector::const_iterator I = List.begin(); I != List.end(); I++) + for (vector::const_iterator I = List.begin(); I != List.end(); ++I) if (ReadPinFile(Plcy, *I) == false) return false; return true; diff --git a/apt/apt-pkg/rpm/rpmindexfile.cc b/apt/apt-pkg/rpm/rpmindexfile.cc index 5ccd5fe..b4523b9 100644 --- a/apt/apt-pkg/rpm/rpmindexfile.cc +++ b/apt/apt-pkg/rpm/rpmindexfile.cc @@ -648,7 +648,7 @@ class rpmSLTypeGen : public pkgSourceList::Type const pkgSourceList::Vendor *Vendor) const { for (vector::const_iterator iter = RepList.begin(); - iter != RepList.end(); iter++) + iter != RepList.end(); ++iter) { if ((*iter)->URI == URI && (*iter)->Dist == Dist) { diff --git a/apt/apt-pkg/rpm/rpmpackagedata.cc b/apt/apt-pkg/rpm/rpmpackagedata.cc index 98eb5e3..186a146 100644 --- a/apt/apt-pkg/rpm/rpmpackagedata.cc +++ b/apt/apt-pkg/rpm/rpmpackagedata.cc @@ -222,7 +222,7 @@ RPMPackageData::RPMPackageData() bool RPMPackageData::HoldPackage(const char *name) { for (vector::iterator I = HoldPackages.begin(); - I != HoldPackages.end(); I++) + I != HoldPackages.end(); ++I) if (regexec(*I,name,0,0,0) == 0) return true; return false; @@ -237,7 +237,7 @@ bool RPMPackageData::IgnoreDep(pkgVersioningSystem &VS, if (VerList == NULL) return true; for (vector::iterator I = VerList->begin(); - I != VerList->end(); I++) + I != VerList->end(); ++I) { if (VS.CheckDep(I->c_str(),Dep->CompareOp,Dep.TargetVer()) == true) return true; @@ -276,7 +276,7 @@ void RPMPackageData::GenericTranslate(vector &TList, map &Dict) { const char *fulluri = FullURI.c_str(); - for (vector::iterator I = TList.begin(); I != TList.end(); I++) + for (vector::iterator I = TList.begin(); I != TList.end(); ++I) { if (regexec(&(*I)->Pattern,fulluri,0,0,0) == 0) { @@ -323,7 +323,7 @@ bool RPMPackageData::IsDupPackage(const string &Name) return true; const char *name = Name.c_str(); for (vector::iterator I = DuplicatedPatterns.begin(); - I != DuplicatedPatterns.end(); I++) { + I != DuplicatedPatterns.end(); ++I) { if (regexec(*I,name,0,0,0) == 0) { SetDupPackage(Name); return true; diff --git a/apt/apt-pkg/rpm/rpmpm.cc b/apt/apt-pkg/rpm/rpmpm.cc index e00630f..eb14363 100644 --- a/apt/apt-pkg/rpm/rpmpm.cc +++ b/apt/apt-pkg/rpm/rpmpm.cc @@ -241,7 +241,7 @@ bool pkgRPMPM::RunScriptsWithPkgs(const char *Cnf) FileFd Fd(Pipes[1]); // Feed it the filenames. - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { // Only deal with packages to be installed from .rpm if (I->Op != Item::Install) @@ -298,7 +298,7 @@ bool pkgRPMPM::Go() vector unalloc; - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string Name = I->Pkg.Name(); string::size_type loc; @@ -391,7 +391,7 @@ bool pkgRPMPM::Go() Ret = RunScripts("RPM::Post-Invoke"); exit: - for (vector::iterator I = unalloc.begin(); I != unalloc.end(); I++) + for (vector::iterator I = unalloc.begin(); I != unalloc.end(); ++I) free(*I); return Ret; diff --git a/apt/apt-pkg/sourcelist.cc b/apt/apt-pkg/sourcelist.cc index 7e2eb36..f2fbe21 100644 --- a/apt/apt-pkg/sourcelist.cc +++ b/apt/apt-pkg/sourcelist.cc @@ -149,10 +149,10 @@ pkgSourceList::pkgSourceList(const string &File) /* */ pkgSourceList::~pkgSourceList() { - for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++) + for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) delete *I; for (vector::iterator I = VendorList.begin(); - I != VendorList.end(); I++) + I != VendorList.end(); ++I) delete *I; } /*}}}*/ @@ -176,7 +176,7 @@ bool pkgSourceList::ReadVendors() return false; for (vector::iterator I = VendorList.begin(); - I != VendorList.end(); I++) + I != VendorList.end(); ++I) delete *I; VendorList.erase(VendorList.begin(),VendorList.end()); @@ -190,7 +190,7 @@ bool pkgSourceList::ReadVendors() bool New = true; for (vector::iterator I = VendorList.begin(); - I != VendorList.end(); I++) + I != VendorList.end(); ++I) { if ((*I)->VendorID == Group) { @@ -213,7 +213,7 @@ bool pkgSourceList::ReadVendors() char *buffer = new char[FingerPrint.length()+1]; char *p = buffer;; for (string::const_iterator I = FingerPrint.begin(); - I != FingerPrint.end(); I++) + I != FingerPrint.end(); ++I) { if (*I != ' ' && *I != '\t') *p++ = *I; @@ -292,7 +292,7 @@ bool pkgSourceList::ReadMainList() /* */ void pkgSourceList::Reset() { - for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++) + for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) delete *I; SrcList.erase(SrcList.begin(),SrcList.end()); // CNC:2003-11-21 @@ -374,7 +374,7 @@ bool pkgSourceList::ReadAppend(const string &File) VendorID = string(VendorID,1,VendorID.size()-2); for (vector::iterator iter = VendorList.begin(); - iter != VendorList.end(); iter++) + iter != VendorList.end(); ++iter) { if ((*iter)->VendorID == VendorID) { @@ -400,7 +400,7 @@ bool pkgSourceList::ReadAppend(const string &File) bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File, pkgIndexFile *&Found) const { - for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++) + for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) { if ((*I)->FindInCache(*File.Cache()) == File) { @@ -417,7 +417,7 @@ bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File, /* */ bool pkgSourceList::GetIndexes(pkgAcquire *Owner) const { - for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++) + for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) if ((*I)->GetIndexes(Owner) == false) return false; return true; @@ -429,7 +429,7 @@ bool pkgSourceList::GetIndexes(pkgAcquire *Owner) const /* */ bool pkgSourceList::GetReleases(pkgAcquire *Owner) const { - for (const_iterator I = SrcList.begin(); I != SrcList.end(); I++) + for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I) if ((*I)->GetReleases(Owner) == false) return false; return true; @@ -479,7 +479,7 @@ bool pkgSourceList::ReadSourceDir(const string &Dir) sort(List.begin(),List.end()); // Read the files - for (vector::const_iterator I = List.begin(); I != List.end(); I++) + for (vector::const_iterator I = List.begin(); I != List.end(); ++I) if (ReadAppend(*I) == false) return false; return true; diff --git a/apt/apt-pkg/srcrecords.cc b/apt/apt-pkg/srcrecords.cc index 0a5483a..00e4f3c 100644 --- a/apt/apt-pkg/srcrecords.cc +++ b/apt/apt-pkg/srcrecords.cc @@ -34,7 +34,7 @@ pkgSrcRecords::pkgSrcRecords(pkgSourceList &List) : Files(0), Current(0) unsigned int Count = 0; pkgSourceList::const_iterator I = List.begin(); - for (; I != List.end(); I++) + for (; I != List.end(); ++I) { Files[Count] = (*I)->CreateSrcParser(); if (_error->PendingError() == true) @@ -119,7 +119,7 @@ pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool SrcOnly) vector Files; if ((*Current)->Files(Files) == true) { vector::const_iterator I = Files.begin(); - for (; I != Files.end(); I++) { + for (; I != Files.end(); ++I) { if (flNotDir(I->Path) == flNotDir(Package)) return *Current; } diff --git a/apt/apt-pkg/versionmatch.cc b/apt/apt-pkg/versionmatch.cc index 6a6f4f6..360e0f3 100644 --- a/apt/apt-pkg/versionmatch.cc +++ b/apt/apt-pkg/versionmatch.cc @@ -63,7 +63,7 @@ pkgVersionMatch::pkgVersionMatch(const string &Data,MatchType Type,int Op) : Ver // Are we a simple specification? string::const_iterator I = Data.begin(); - for (; I != Data.end() && *I != '='; I++); + for (; I != Data.end() && *I != '='; ++I); if (I == Data.end()) { // Temporary diff --git a/apt/cmdline/apt-cdrom.cc b/apt/cmdline/apt-cdrom.cc index 8ba9174..eded525 100644 --- a/apt/cmdline/apt-cdrom.cc +++ b/apt/cmdline/apt-cdrom.cc @@ -317,7 +317,7 @@ void ReduceSourcelist(const string &CD,vector &List) sort(List.begin(),List.end()); // Collect similar entries - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { // Find a space.. string::size_type Space = (*I).find(' '); @@ -329,7 +329,7 @@ void ReduceSourcelist(const string &CD,vector &List) string Word1 = string(*I,Space,SSpace-Space); string Prefix = string(*I,0,Space); - for (vector::iterator J = List.begin(); J != I; J++) + for (vector::iterator J = List.begin(); J != I; ++J) { // Find a space.. string::size_type Space2 = (*J).find(' '); @@ -467,7 +467,7 @@ bool WriteSourceList(const string &Name,vector &List,bool Source) if (First == true) { - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -501,7 +501,7 @@ bool WriteSourceList(const string &Name,vector &List,bool Source) // Just in case the file was empty if (First == true) { - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -641,10 +641,10 @@ bool DoAdd(CommandLine &) if (_config->FindB("Debug::aptcdrom",false) == true) { cout << _("I found (binary):") << endl; - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) cout << *I << endl; cout << _("I found (source):") << endl; - for (vector::iterator I = sList.begin(); I != sList.end(); I++) + for (vector::iterator I = sList.begin(); I != sList.end(); ++I) cout << *I << endl; } @@ -686,7 +686,7 @@ bool DoAdd(CommandLine &) { // Escape special characters string::iterator J = Name.begin(); - for (; J != Name.end(); J++) + for (; J != Name.end(); ++J) if (*J == '"' || *J == ']' || *J == '[') *J = '_'; @@ -717,7 +717,7 @@ bool DoAdd(CommandLine &) // Escape special characters string::iterator J = Name.begin(); - for (; J != Name.end(); J++) + for (; J != Name.end(); ++J) if (*J == '"' || *J == ']' || *J == '[') *J = '_'; @@ -756,7 +756,7 @@ bool DoAdd(CommandLine &) // Print the sourcelist entries cout << _("Source List entries for this Media are:") << endl; - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) @@ -772,7 +772,7 @@ bool DoAdd(CommandLine &) #endif } - for (vector::iterator I = sList.begin(); I != sList.end(); I++) + for (vector::iterator I = sList.begin(); I != sList.end(); ++I) { string::size_type Space = (*I).find(' '); if (Space == string::npos) diff --git a/apt/cmdline/apt-get.cc b/apt/cmdline/apt-get.cc index a26c93c..3858752 100644 --- a/apt/cmdline/apt-get.cc +++ b/apt/cmdline/apt-get.cc @@ -541,8 +541,7 @@ bool DownloadPackages(vector &URLLst) pkgAcquire Fetcher(&Stat); // Load the requestd sources into the fetcher - vector::const_iterator I = URLLst.begin(); - for (; I != URLLst.end(); I++) + for (auto I = URLLst.begin(); I != URLLst.end(); ++I) new pkgAcqFile(&Fetcher,*I,"",0,*I,flNotDir(*I)); // Run it @@ -551,7 +550,7 @@ bool DownloadPackages(vector &URLLst) // Print error messages bool Failed = false; - for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++) + for (auto I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I) { if ((*I)->Status == pkgAcquire::Item::StatDone && (*I)->Complete == true) @@ -1407,7 +1406,7 @@ bool DoInstall(CommandLine &CmdL) // Run over the matches bool Hit = false; for (vector::const_iterator I = VS.begin(); - I != VS.end(); I++) { + I != VS.end(); ++I) { Pkg = Cache->FindPkg(*I); if (Pkg.end() == true) @@ -1721,8 +1720,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) return false; // Install everything with the install flag set - pkgCache::PkgIterator I = Cache->PkgBegin(); - for (;I.end() != true; I++) + for (auto I = Cache->PkgBegin(); not I.end(); ++I) { /* Install the package only if it is a new install, the autoupgrader will deal with the rest */ @@ -1732,7 +1730,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) /* Now install their deps too, if we do this above then order of the status file is significant for | groups */ - for (I = Cache->PkgBegin();I.end() != true; I++) + for (auto I = Cache->PkgBegin(); not I.end(); ++I) { /* Install the package only if it is a new install, the autoupgrader will deal with the rest */ @@ -1741,7 +1739,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) } // Apply erasures now, they override everything else. - for (I = Cache->PkgBegin();I.end() != true; I++) + for (auto I = Cache->PkgBegin(); not I.end(); ++I) { // Remove packages if (I->SelectedState == pkgCache::State::DeInstall || @@ -1758,7 +1756,7 @@ bool DoDSelectUpgrade(CommandLine &CmdL) // Hold back held packages. if (_config->FindB("APT::Ignore-Hold",false) == false) { - for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++) + for (auto I = Cache->PkgBegin(); not I.end(); ++I) { if (I->SelectedState == pkgCache::State::Hold) { @@ -1949,7 +1947,7 @@ bool DoSource(CommandLine &CmdL) // Load them into the fetcher for (vector::const_iterator I = Lst.begin(); - I != Lst.end(); I++) + I != Lst.end(); ++I) { // Try to guess what sort of file it is we are getting. // CNC:2002-07-06 @@ -2225,7 +2223,7 @@ bool DoBuildDep(CommandLine &CmdL) vector ::iterator D; pkgProblemResolver Fix(Cache); bool skipAlternatives = false; // skip remaining alternatives in an or group - for (D = BuildDeps.begin(); D != BuildDeps.end(); D++) + for (D = BuildDeps.begin(); D != BuildDeps.end(); ++D) { bool hasAlternatives = (((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or); diff --git a/apt/cmdline/apt-shell.cc b/apt/cmdline/apt-shell.cc index 9582291..0aa5da5 100644 --- a/apt/cmdline/apt-shell.cc +++ b/apt/cmdline/apt-shell.cc @@ -1318,7 +1318,7 @@ bool DoInstall(CommandLine &CmdL) // Run over the matches bool Hit = false; for (vector::const_iterator I = VS.begin(); - I != VS.end(); I++) { + I != VS.end(); ++I) { Pkg = Cache->FindPkg(*I); if (Pkg.end() == true) @@ -1776,7 +1776,7 @@ bool DoBuildDep(CommandLine &CmdL) vector ::iterator D; pkgProblemResolver Fix(Cache); bool skipAlternatives = false; // skip remaining alternatives in an or group - for (D = BuildDeps.begin(); D != BuildDeps.end(); D++) + for (D = BuildDeps.begin(); D != BuildDeps.end(); ++D) { bool hasAlternatives = (((*D).Op & pkgCache::Dep::Or) == pkgCache::Dep::Or); @@ -3034,7 +3034,7 @@ bool DoList(CommandLine &CmdL) string status = "available"; if (Pkg->CurrentVer != 0) status = "installed"; if (Pkg->CurrentVer != 0) - for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++) + for (pkgCache::DepIterator D = Pkg.RevDependsList(); not D.end(); ++D) { pkgCache::PkgIterator P = D.ParentPkg(); if ((P->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential && diff --git a/apt/cmdline/indexcopy.cc b/apt/cmdline/indexcopy.cc index fb2c7ef..64a9c1d 100644 --- a/apt/cmdline/indexcopy.cc +++ b/apt/cmdline/indexcopy.cc @@ -43,7 +43,7 @@ bool IndexCopy::CopyPackages(const string &CDROM,const string &Name,vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { struct stat Buf; if (stat(string(*I + GetFileName()).c_str(),&Buf) != 0 && @@ -57,7 +57,7 @@ bool IndexCopy::CopyPackages(const string &CDROM,const string &Name,vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string OrigPath = string(*I,CDROM.length()); unsigned long FileSize = 0; diff --git a/apt/cmdline/rpmindexcopy.cc b/apt/cmdline/rpmindexcopy.cc index 744af1f..9604d4b 100644 --- a/apt/cmdline/rpmindexcopy.cc +++ b/apt/cmdline/rpmindexcopy.cc @@ -53,7 +53,7 @@ bool RPMIndexCopy::CopyPackages(const string &CDROM,const string &Name,vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { struct stat Buf; if (stat((*I).c_str(),&Buf) != 0) @@ -67,7 +67,7 @@ bool RPMIndexCopy::CopyPackages(const string &CDROM,const string &Name,vector GlobalReleases; - for (vector::iterator I = List.begin(); I != List.end(); I++) + for (vector::iterator I = List.begin(); I != List.end(); ++I) { string OrigPath = string(*I,CDROM.length()); unsigned long long FileSize = 0; diff --git a/apt/methods/ftp.cc b/apt/methods/ftp.cc index 97d81d5..953febf 100644 --- a/apt/methods/ftp.cc +++ b/apt/methods/ftp.cc @@ -560,7 +560,7 @@ bool FTPConn::ExtGoPasv() string::const_iterator List[4]; unsigned Count = 0; Pos++; - for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++) + for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I) { if (*I != Msg[Pos]) continue; diff --git a/apt/methods/http.cc b/apt/methods/http.cc index dcdd651..da3e646 100644 --- a/apt/methods/http.cc +++ b/apt/methods/http.cc @@ -383,10 +383,10 @@ int ServerState::RunHeaders() if (Debug == true) clog << Data; - for (string::const_iterator I = Data.begin(); I < Data.end(); I++) + for (string::const_iterator I = Data.begin(); I != Data.end(); ++I) { string::const_iterator J = I; - for (; J != Data.end() && *J != '\n' && *J != '\r';J++); + for (; J != Data.end() && *J != '\n' && *J != '\r';++J); if (HeaderLine(string(I,J)) == false) return 2; I = J; @@ -937,7 +937,7 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv) if (ParsedURI.User.empty()) { for (CurrentAuth = AuthList.begin(); CurrentAuth != AuthList.end(); - CurrentAuth++) + ++CurrentAuth) if (CurrentAuth->Host == Srv->ServerName.Host) { AuthUser = CurrentAuth->User; @@ -968,7 +968,7 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv) NewAuthInfo.Password = AuthPass; for (CurrentAuth = AuthList.begin(); CurrentAuth != AuthList.end(); - CurrentAuth++) + ++CurrentAuth) if (CurrentAuth->Host == Srv->ServerName.Host) { *CurrentAuth = NewAuthInfo; @@ -1345,7 +1345,7 @@ int HttpMethod::Loop() StopRedirects = true; else { - for (StringVectorIterator I = R.begin(); I != R.end(); I++) + for (StringVectorIterator I = R.begin(); I != R.end(); ++I) if (Queue->Uri == *I) { R[0] = "STOP"; -- 2.24.0