X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/4e0680f913218a9c4b52ccc842924e223b403df6..b43b5a7d67cdf706afbb30ff470f1a8d7d810986:/apt-pkg/versionmatch.cc diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc index e7d8e4dc7..5c25c2f7b 100644 --- a/apt-pkg/versionmatch.cc +++ b/apt-pkg/versionmatch.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: versionmatch.cc,v 1.6 2001/06/10 01:57:45 jgg Exp $ +// $Id: versionmatch.cc,v 1.9 2003/05/19 17:58:26 doogie Exp $ /* ###################################################################### Version Matching @@ -11,9 +11,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/versionmatch.h" -#endif #include #include @@ -68,7 +65,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type) else RelArchive = Data; - if (RelVerStr.end()[-1] == '*') + if (RelVerStr.length() > 0 && RelVerStr.end()[-1] == '*') { RelVerPrefixMatch = true; RelVerStr = string(RelVerStr.begin(),RelVerStr.end()-1); @@ -127,7 +124,7 @@ bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix) const char *Ae = Ab + strlen(A); // Strings are not a compatible size. - if ((unsigned)(Ae - Ab) != B.length() && Prefix == false || + if (((unsigned)(Ae - Ab) != B.length() && Prefix == false) || (unsigned)(Ae - Ab) < B.length()) return false; @@ -208,11 +205,13 @@ bool pkgVersionMatch::FileMatch(pkgCache::PkgFileIterator File) if (Type == Origin) { - if (OrSite.empty() == false) - if (File->Site == 0 || - OrSite != File.Site()) + if (OrSite.empty() == false) { + if (File->Site == 0 || OrSite != File.Site()) return false; - return true; + } else // so we are talking about file:// or status file + if (strcmp(File.Site(),"") == 0 && File->Archive != 0) // skip the status file + return false; + return (OrSite == File.Site()); /* both strings match */ } return false;