From 77a7df0e00b10252abb2fe52a083d53d5878ab11 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 May 2005 09:09:12 +0000 Subject: * another bug in QueueNextDiff fixed --- apt-pkg/acquire-item.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index fff55f7b5..79e0b1898 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -290,10 +290,9 @@ bool pkgAcqIndexDiffs::QueueNextDiff() // remove all patches until the next matching patch is found // this requires the Index file to be ordered for(vector::iterator I=available_patches.begin(); - (*I).sha1 == local_sha1 || I != available_patches.end(); + I != available_patches.end() && (*I).sha1 != local_sha1; I++) available_patches.erase(I); - // error checking and falling back if no patch was found if(available_patches.size() == 0) { @@ -356,14 +355,17 @@ bool pkgAcqIndexDiffs::ParseIndexDiff(string IndexDiffFile) bool found = false; while(hist >> d.sha1 >> size >> d.file) { d.size = atoi(size.c_str()); + // read until the first match is found if(d.sha1 == local_sha1) found=true; + // from that point on, we probably need all diffs if(found) { if(Debug) std::clog << "Need to get diff: " << d.file << std::endl; available_patches.push_back(d); } } + // no information how to get the patches, bail out if(!found) { if(Debug) -- cgit v1.2.3