]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/pkgcache.cc
Configuration fixes
[apt.git] / apt-pkg / pkgcache.cc
index 2b52a9977eb19a85ed3b7f957f59164f893053bb..3e01e771de19e9edbdb1d7e9faadaff2aff98cdb 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.16 1998/11/14 07:20:09 jgg Exp $
+// $Id: pkgcache.cc,v 1.20 1998/12/07 07:26:19 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
@@ -159,7 +159,8 @@ pkgCache::PkgIterator pkgCache::FindPkg(string Name)
    Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
    for (; Pkg != PkgP; Pkg = PkgP + Pkg->NextPackage)
    {
-      if (Pkg->Name != 0 && StrP + Pkg->Name == Name)
+      if (Pkg->Name != 0 && StrP[Pkg->Name] == Name[0] &&
+         StrP + Pkg->Name == Name)
         return PkgIterator(*this,Pkg);
    }
    return PkgIterator(*this,0);
@@ -203,7 +204,7 @@ void pkgCache::PkgIterator::operator ++(int)
 // ---------------------------------------------------------------------
 /* By this we mean if it is either cleanly installed or cleanly removed. */
 pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
-{
+{  
    if (Pkg->InstState == pkgCache::State::ReInstReq ||
        Pkg->InstState == pkgCache::State::HoldReInstReq)
       return NeedsUnpack;
@@ -379,9 +380,10 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
    // Compute a single dependency element (glob or)
    Start = *this;
    End = *this;
-   for (bool LastOR = true; end() == false && LastOR == true; (*this)++)
+   for (bool LastOR = true; end() == false && LastOR == true;)
    {
       LastOR = (Dep->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
+      (*this)++;
       if (LastOR == true)
         End = (*this);
    }
@@ -422,6 +424,18 @@ bool pkgCache::VerIterator::Downloadable() const
    return false;
 }
                                                                        /*}}}*/
+// VerIterator::PriorityType - Return a string describing the priority /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+const char *pkgCache::VerIterator::PriorityType()
+{
+   const char *Types[] = {"","Important","Required","Standard",
+                          "Optional","Extra"};
+   if (Ver->Priority < 6)
+      return Types[Ver->Priority];
+   return "";
+}
+                                                                       /*}}}*/
 // PkgFileIterator::IsOk - Checks if the cache is in sync with the file        /*{{{*/
 // ---------------------------------------------------------------------
 /* This stats the file and compares its stats with the ones that were