~ubuntu-branches/debian/experimental/apt/experimental

« back to all changes in this revision

Viewing changes to apt-pkg/versionmatch.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2010-02-18 22:07:23 UTC
  • mfrom: (9.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100218220723-zb7zdh6fmsmp30tr
Tags: 0.7.26~exp2
fix crash when LANGUAGE is not set

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
// Include Files                                                        /*{{{*/
14
14
#include <apt-pkg/versionmatch.h>
15
15
 
16
 
#include <apt-pkg/contrib/strutl.h>
17
 
#include <apt-pkg/contrib/error.h>
 
16
#include <apt-pkg/strutl.h>
 
17
#include <apt-pkg/error.h>
18
18
 
19
19
#include <stdio.h>
20
20
#include <ctype.h>
63
63
         if (isdigit(Data[0]))
64
64
            RelVerStr = Data;
65
65
         else
66
 
            RelArchive = Data;
67
 
         
 
66
            RelRelease = Data;
 
67
 
68
68
         if (RelVerStr.length() > 0 && RelVerStr.end()[-1] == '*')
69
69
         {
70
70
            RelVerPrefixMatch = true;
87
87
      {
88
88
         if (strlen(Fragments[J]) < 3)
89
89
            continue;
90
 
            
 
90
 
91
91
         if (stringcasecmp(Fragments[J],Fragments[J]+2,"v=") == 0)
92
92
            RelVerStr = Fragments[J]+2;
93
93
         else if (stringcasecmp(Fragments[J],Fragments[J]+2,"o=") == 0)
94
94
            RelOrigin = Fragments[J]+2;
95
95
         else if (stringcasecmp(Fragments[J],Fragments[J]+2,"a=") == 0)
96
96
            RelArchive = Fragments[J]+2;
 
97
         else if (stringcasecmp(Fragments[J],Fragments[J]+2,"n=") == 0)
 
98
            RelCodename = Fragments[J]+2;
97
99
         else if (stringcasecmp(Fragments[J],Fragments[J]+2,"l=") == 0)
98
100
            RelLabel = Fragments[J]+2;
99
101
         else if (stringcasecmp(Fragments[J],Fragments[J]+2,"c=") == 0)
100
102
            RelComponent = Fragments[J]+2;
101
103
      }
102
 
      
 
104
 
103
105
      if (RelVerStr.end()[-1] == '*')
104
106
      {
105
107
         RelVerPrefixMatch = true;
169
171
   {
170
172
      if (MatchAll == true)
171
173
         return true;
172
 
      
 
174
 
173
175
/*      cout << RelVerStr << ',' << RelOrigin << ',' << RelArchive << ',' << RelLabel << endl;
174
176
      cout << File.Version() << ',' << File.Origin() << ',' << File.Archive() << ',' << File.Label() << endl;*/
175
 
      
 
177
 
176
178
      if (RelVerStr.empty() == true && RelOrigin.empty() == true &&
177
179
          RelArchive.empty() == true && RelLabel.empty() == true &&
 
180
          RelRelease.empty() == true && RelCodename.empty() == true &&
178
181
          RelComponent.empty() == true)
179
182
         return false;
180
 
      
 
183
 
181
184
      if (RelVerStr.empty() == false)
182
185
         if (File->Version == 0 ||
183
186
             MatchVer(File.Version(),RelVerStr,RelVerPrefixMatch) == false)
187
190
             stringcasecmp(RelOrigin,File.Origin()) != 0)
188
191
            return false;
189
192
      if (RelArchive.empty() == false)
190
 
      {
191
 
         if (File->Archive == 0 || 
 
193
         if (File->Archive == 0 ||
192
194
             stringcasecmp(RelArchive,File.Archive()) != 0)
193
 
            return false;
194
 
      }      
 
195
            return false;
 
196
      if (RelCodename.empty() == false)
 
197
         if (File->Codename == 0 ||
 
198
             stringcasecmp(RelCodename,File.Codename()) != 0)
 
199
            return false;
 
200
      if (RelRelease.empty() == false)
 
201
         if ((File->Archive == 0 ||
 
202
             stringcasecmp(RelRelease,File.Archive()) != 0) &&
 
203
             (File->Codename == 0 ||
 
204
              stringcasecmp(RelRelease,File.Codename()) != 0))
 
205
               return false;
195
206
      if (RelLabel.empty() == false)
196
207
         if (File->Label == 0 ||
197
208
             stringcasecmp(RelLabel,File.Label()) != 0)
202
213
            return false;
203
214
      return true;
204
215
   }
205
 
   
 
216
 
206
217
   if (Type == Origin)
207
218
   {
208
219
      if (OrSite.empty() == false) {
213
224
            return false;
214
225
      return (OrSite == File.Site());           /* both strings match */
215
226
   }
216
 
   
 
227
 
217
228
   return false;
218
229
}
219
230
                                                                        /*}}}*/