diff options
| author | Herman Semenoff <GermanAizek@yandex.ru> | 2026-04-08 11:11:41 +0300 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:26:20 +0000 |
| commit | df63b982447f1a8f699e6547352cd04d00242c9b (patch) | |
| tree | 42e82e842dafa0dd9f4fcaab2d23968200f10062 | |
| parent | a6873075dcac5115706e001bc9640c8da0805e35 (diff) | |
apt-pkg/acquire: use range based for loop C++17
| -rw-r--r-- | apt-pkg/acquire.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 17caa42b6..7a60c4476 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -795,8 +795,8 @@ stop: I->Shutdown(false); // Shut down the items - for (ItemIterator I = Items.begin(); I != Items.end(); ++I) - (*I)->Finished(); + for (auto &Item : Items) + Item->Finished(); bool const newError = _error->PendingError(); _error->MergeWithStack(); @@ -1191,10 +1191,10 @@ pkgAcquire::Queue::QItem *pkgAcquire::Queue::FindItem(string URI,pkgAcquire::Wor bool pkgAcquire::Queue::ItemDone(QItem *Itm) { PipeDepth--; - for (QItem::owner_iterator O = Itm->Owners.begin(); O != Itm->Owners.end(); ++O) + for (auto Owner : Itm->Owners) { - if ((*O)->Status == pkgAcquire::Item::StatFetching) - (*O)->Status = pkgAcquire::Item::StatDone; + if (Owner->Status == pkgAcquire::Item::StatFetching) + Owner->Status = pkgAcquire::Item::StatDone; } if (Itm->Owner->QueueCounter <= 1) @@ -1273,9 +1273,9 @@ HashStringList pkgAcquire::Queue::QItem::GetExpectedHashes() const /*{{{*/ failure and still needs this handling: Two owners who expect the same file, but one owner only knows the SHA1 while the other only knows SHA256. */ HashStringList superhsl; - for (pkgAcquire::Queue::QItem::owner_iterator O = Owners.begin(); O != Owners.end(); ++O) + for (auto Owner : Owners) { - HashStringList const hsl = (*O)->GetExpectedHashes(); + HashStringList const hsl = Owner->GetExpectedHashes(); // we merge both lists - if we find disagreement send no hashes HashStringList::const_iterator hs = hsl.begin(); for (; hs != hsl.end(); ++hs) @@ -1329,24 +1329,24 @@ void pkgAcquire::Queue::QItem::SyncDestinationFiles() const /*{{{*/ everything (like progress reporting) finds it easily */ std::string superfile = Owner->DestFile; off_t supersize = 0; - for (pkgAcquire::Queue::QItem::owner_iterator O = Owners.begin(); O != Owners.end(); ++O) + for (auto Owner : Owners) { - if ((*O)->DestFile == superfile) + if (Owner->DestFile == superfile) continue; struct stat file; - if (lstat((*O)->DestFile.c_str(),&file) == 0) + if (lstat(Owner->DestFile.c_str(),&file) == 0) { if ((file.st_mode & S_IFREG) == 0) - RemoveFile("SyncDestinationFiles", (*O)->DestFile); + RemoveFile("SyncDestinationFiles", Owner->DestFile); else if (supersize < file.st_size) { supersize = file.st_size; RemoveFile("SyncDestinationFiles", superfile); - rename((*O)->DestFile.c_str(), superfile.c_str()); + rename(Owner->DestFile.c_str(), superfile.c_str()); } else - RemoveFile("SyncDestinationFiles", (*O)->DestFile); - if (symlink(superfile.c_str(), (*O)->DestFile.c_str()) != 0) + RemoveFile("SyncDestinationFiles", Owner->DestFile); + if (symlink(superfile.c_str(), Owner->DestFile.c_str()) != 0) { ; // not a problem per-se and no real alternative } |
