ostream c1out(0);
ostream c2out(0);
ofstream devnull("/dev/null");
-unsigned int ScreenWidth = 80;
+unsigned int ScreenWidth = 80 - 1; /* - 1 for the cursor */
// class CacheFile - Cover class for some dependency cache functions /*{{{*/
// ---------------------------------------------------------------------
string TmpSrc = Name;
string::size_type Slash = TmpSrc.rfind('=');
- // honor pining and default release
+ // honor default release
string DefRel = _config->Find("APT::Default-Release");
-
pkgCache::PkgIterator Pkg = Cache.FindPkg(TmpSrc);
- pkgCache::VerIterator CandVer = Cache.GetCandidateVer(Pkg);
- if(Pkg.end() == false)
- {
- VerTag = CandVer.VerStr();
- }
if (Slash != string::npos)
{
VerTag = string(TmpSrc.begin() + Slash + 1,TmpSrc.end());
TmpSrc = string(TmpSrc.begin(),TmpSrc.begin() + Slash);
}
- else if(DefRel.empty() == false)
+ else if(!Pkg.end() && DefRel.empty() == false)
{
// we have a default release, try to locate the pkg. we do it like
// this because GetCandidateVer() will not "downgrade", that means
continue;
//std::cout << VF.File().Archive() << std::endl;
- if(VF.File().Archive() == DefRel)
+ if(VF.File().Archive() && (VF.File().Archive() == DefRel))
{
VerTag = Ver.VerStr();
break;
{
if (Pkg.end() == false)
{
- if (CandVer.end() == false)
+ pkgCache::VerIterator Ver = Cache.GetCandidateVer(Pkg);
+ if (Ver.end() == false)
{
- pkgRecords::Parser &Parse = Recs.Lookup(CandVer.FileList());
+ pkgRecords::Parser &Parse = Recs.Lookup(Ver.FileList());
Src = Parse.SourcePkg();
}
}
}
}
- if (Last == 0)
- return 0;
-
- if (Last->Jump(Offset) == false)
+ if (Last == 0 || Last->Jump(Offset) == false)
return 0;
return Last;