]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/versionmatch.cc
Fixed possible segv if there are no packages
[apt.git] / apt-pkg / versionmatch.cc
index d4ae21d565fb87c377975ce1775cc993eba218c1..e7d8e4dc7661369927431cb3a0f235f1fceda214 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: versionmatch.cc,v 1.4 2001/05/22 06:20:06 jgg Exp $
+// $Id: versionmatch.cc,v 1.6 2001/06/10 01:57:45 jgg Exp $
 /* ######################################################################
 
    Version Matching 
 /* Break up the data string according to the selected type */
 pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
 {
+   MatchAll = false;
+   VerPrefixMatch = false;
+   RelVerPrefixMatch = false;
+   
    if (Type == None || Data.length() < 1)
       return;
    
@@ -48,7 +52,10 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
    {
       // All empty = match all
       if (Data == "*")
+      {
+        MatchAll = true;
         return;
+      }
       
       // Are we a simple specification?
       string::const_iterator I = Data.begin();
@@ -163,6 +170,9 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File)
 {
    if (Type == Release)
    {
+      if (MatchAll == true)
+        return true;
+      
 /*      cout << RelVerStr << ',' << RelOrigin << ',' << RelArchive << ',' << RelLabel << endl;
       cout << File.Version() << ',' << File.Origin() << ',' << File.Archive() << ',' << File.Label() << endl;*/