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

« back to all changes in this revision

Viewing changes to ftparchive/override.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 "override.h"
14
14
    
15
15
#include <apti18n.h>
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
    
24
24
// Override::ReadOverride - Read the override file                      /*{{{*/
25
25
// ---------------------------------------------------------------------
26
26
/* This parses the override file and reads it into the map */
27
 
bool Override::ReadOverride(string File,bool Source)
 
27
bool Override::ReadOverride(string const &File,bool const &Source)
28
28
{
29
29
   if (File.empty() == true)
30
30
      return true;
132
132
// Override::ReadExtraOverride - Read the extra override file           /*{{{*/
133
133
// ---------------------------------------------------------------------
134
134
/* This parses the extra override file and reads it into the map */
135
 
bool Override::ReadExtraOverride(string File,bool Source)
 
135
bool Override::ReadExtraOverride(string const &File,bool const &Source)
136
136
{
137
137
   if (File.empty() == true)
138
138
      return true;
209
209
/* Returns a override item for the given package and the given architecture.
210
210
 * Treats "all" special
211
211
 */
212
 
Override::Item* Override::GetItem(string Package, string Architecture)
 
212
Override::Item* Override::GetItem(string const &Package, string const &Architecture)
213
213
{
214
 
   map<string,Item>::iterator I = Mapping.find(Package);
 
214
   map<string,Item>::const_iterator I = Mapping.find(Package);
215
215
   map<string,Item>::iterator J = Mapping.find(Package + "/" + Architecture);
216
216
 
217
217
   if (I == Mapping.end() && J == Mapping.end())
230
230
         if (R->Priority != "") result->Priority = R->Priority;
231
231
         if (R->OldMaint != "") result->OldMaint = R->OldMaint;
232
232
         if (R->NewMaint != "") result->NewMaint = R->NewMaint;
233
 
         for (map<string,string>::iterator foI = R->FieldOverride.begin();
 
233
         for (map<string,string>::const_iterator foI = R->FieldOverride.begin();
234
234
              foI != R->FieldOverride.end(); foI++)
235
235
         {
236
236
            result->FieldOverride[foI->first] = foI->second;
247
247
   there is a rule but it does not match then the empty string is returned,
248
248
   also if there was no rewrite rule the empty string is returned. Failed
249
249
   indicates if there was some kind of problem while rewriting. */
250
 
string Override::Item::SwapMaint(string Orig,bool &Failed)
 
250
string Override::Item::SwapMaint(string const &Orig,bool &Failed)
251
251
{
252
252
   Failed = false;
253
253
   
262
262
      override file. Thus it persists.*/
263
263
#if 1
264
264
   // Break OldMaint up into little bits on double slash boundaries.
265
 
   string::iterator End = OldMaint.begin();
 
265
   string::const_iterator End = OldMaint.begin();
266
266
   while (1)
267
267
   {
268
 
      string::iterator Start = End;      
 
268
      string::const_iterator Start = End;      
269
269
      for (; End < OldMaint.end() &&
270
270
           (End + 3 >= OldMaint.end() || End[0] != ' ' || 
271
271
            End[1] != '/' || End[2] != '/'); End++);