]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/versionmatch.cc
releasing version 0.9.7.8~exp2
[apt.git] / apt-pkg / versionmatch.cc
index 17a54bc4c5a3dd9582cafe28c2d64fde8d161860..e4fa0ea65f10fd2be0a3d4c737db3e5eefc89673 100644 (file)
@@ -11,8 +11,9 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include <apt-pkg/versionmatch.h>
+#include<config.h>
 
 
+#include <apt-pkg/versionmatch.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 
 #include <fnmatch.h>
 #include <sys/types.h>
 #include <regex.h>
 #include <fnmatch.h>
 #include <sys/types.h>
 #include <regex.h>
-
                                                                        /*}}}*/
 
                                                                        /*}}}*/
 
+using std::string;
+
 // VersionMatch::pkgVersionMatch - Constructor                         /*{{{*/
 // ---------------------------------------------------------------------
 /* Break up the data string according to the selected type */
 // VersionMatch::pkgVersionMatch - Constructor                         /*{{{*/
 // ---------------------------------------------------------------------
 /* Break up the data string according to the selected type */
@@ -60,7 +62,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
       
       // Are we a simple specification?
       string::const_iterator I = Data.begin();
       
       // Are we a simple specification?
       string::const_iterator I = Data.begin();
-      for (; I != Data.end() && *I != '='; I++);
+      for (; I != Data.end() && *I != '='; ++I);
       if (I == Data.end())
       {
         // Temporary
       if (I == Data.end())
       {
         // Temporary
@@ -118,7 +120,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
    
    if (Type == Origin)
    {
    
    if (Type == Origin)
    {
-      if (Data[0] == '"' && Data.end()[-1] == '"')
+      if (Data[0] == '"' && Data.length() >= 2 && Data.end()[-1] == '"')
         OrSite = Data.substr(1, Data.length() - 2);
       else
         OrSite = Data;
         OrSite = Data.substr(1, Data.length() - 2);
       else
         OrSite = Data;
@@ -152,7 +154,7 @@ bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix)
 pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
 {
    pkgCache::VerIterator Ver = Pkg.VersionList();
 pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
 {
    pkgCache::VerIterator Ver = Pkg.VersionList();
-   for (; Ver.end() == false; Ver++)
+   for (; Ver.end() == false; ++Ver)
    {
       if (Type == Version)
       {
    {
       if (Type == Version)
       {
@@ -163,7 +165,7 @@ pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
         continue;
       }
       
         continue;
       }
       
-      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++)
+      for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; ++VF)
         if (FileMatch(VF.File()) == true)
            return Ver;
    }
         if (FileMatch(VF.File()) == true)
            return Ver;
    }