]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debversion.cc
Merge remote-tracking branch 'mvo/bugfix/update-progress-reporting' into debian/exper...
[apt.git] / apt-pkg / deb / debversion.cc
index 340403721a7337f0fecd0b82e1153abe13a25dcd..a5eacb7f50f2a9f0ae1876906b598d743f1d33c3 100644 (file)
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#define APT_COMPATIBILITY 986
+#include <config.h>
 
 #include <apt-pkg/debversion.h>
 #include <apt-pkg/pkgcache.h>
 
+#include <string.h>
+#include <string>
 #include <stdlib.h>
 #include <ctype.h>
                                                                        /*}}}*/
@@ -116,7 +118,7 @@ int debVersioningSystem::CmpFragment(const char *A,const char *AEnd,
       return 1;
    }
 
-   // Shouldnt happen
+   // Shouldn't happen
    return 1;
 }
                                                                        /*}}}*/
@@ -215,10 +217,15 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
       return true;
    if (PkgVer == 0 || PkgVer[0] == 0)
       return false;
-   
-   // Perform the actual comparision.
-   int Res = CmpVersion(PkgVer,DepVer);
-   switch (Op & 0x0F)
+   Op &= 0x0F;
+
+   // fast track for (equal) strings [by location] which are by definition equal versions
+   if (PkgVer == DepVer)
+      return Op == pkgCache::Dep::Equals || Op == pkgCache::Dep::LessEq || Op == pkgCache::Dep::GreaterEq;
+
+   // Perform the actual comparison.
+   int const Res = CmpVersion(PkgVer, DepVer);
+   switch (Op)
    {
       case pkgCache::Dep::LessEq:
       if (Res <= 0)
@@ -257,7 +264,7 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
 // debVS::UpstreamVersion - Return the upstream version string         /*{{{*/
 // ---------------------------------------------------------------------
 /* This strips all the debian specific information from the version number */
-string debVersioningSystem::UpstreamVersion(const char *Ver)
+std::string debVersioningSystem::UpstreamVersion(const char *Ver)
 {
    // Strip off the bit before the first colon
    const char *I = Ver;
@@ -272,6 +279,6 @@ string debVersioningSystem::UpstreamVersion(const char *Ver)
       if (*I == '-')
         Last = I - Ver;
    
-   return string(Ver,Last);
+   return std::string(Ver,Last);
 }
                                                                        /*}}}*/