]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/policy.cc
apt-pkg/tagfile.h: Include stdint.h, fixes rdep build failures
[apt.git] / apt-pkg / policy.cc
index 76c36b71bfde8745933f4bc5ff7a18478c288a66..a1e903178a65ea831df6aae9d3901be4958765ec 100644 (file)
@@ -22,7 +22,6 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
-#include <apt-pkg/sptr.h>
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/versionmatch.h>
@@ -100,8 +99,8 @@ bool pkgPolicy::InitDefaults()
    }
 
    // Apply the defaults..
-   SPtrArray<bool> Fixed = new bool[Cache->HeaderP->PackageFileCount];
-   memset(Fixed,0,sizeof(*Fixed)*Cache->HeaderP->PackageFileCount);
+   std::unique_ptr<bool[]> Fixed(new bool[Cache->HeaderP->PackageFileCount]);
+   memset(Fixed.get(),0,sizeof(Fixed[0])*Cache->HeaderP->PackageFileCount);
    StatusOverride = false;
    for (vector<Pin>::const_iterator I = Defaults.begin(); I != Defaults.end(); ++I)
    {
@@ -237,15 +236,15 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVerNew(pkgCache::PkgIterator const
    pkgVersioningSystem *vs = Cache->VS;
 
    for (pkgCache::VerIterator ver = Pkg.VersionList(); ver.end() == false; ver++) {
-      int priority = GetPriority(ver);
+      int priority = GetPriority(ver, true);
 
-        if (priority == 0 || priority <= candPriority)
-           continue;
+      if (priority == 0 || priority <= candPriority)
+        continue;
 
-        // TODO: Maybe optimize to not compare versions
-        if (!cur.end() && priority < 1000
-           && (vs->CmpVersion(ver.VerStr(), cur.VerStr()) < 0))
-           continue;
+      // TODO: Maybe optimize to not compare versions
+      if (!cur.end() && priority < 1000
+         && (vs->CmpVersion(ver.VerStr(), cur.VerStr()) < 0))
+        continue;
 
       candPriority = priority;
       cand = ver;
@@ -368,11 +367,11 @@ APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg)
       return Pins[Pkg->ID].Priority;
    return 0;
 }
-APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, bool considerFiles)
+APT_PURE signed short pkgPolicy::GetPriority(pkgCache::VerIterator const &Ver, bool ConsiderFiles)
 {
    if (VerPins[Ver->ID].Type != pkgVersionMatch::None)
       return VerPins[Ver->ID].Priority;
-   if (!considerFiles)
+   if (!ConsiderFiles)
       return 0;
 
    int priority = std::numeric_limits<int>::min();