~ubuntu-branches/ubuntu/trusty/apt/trusty

« back to all changes in this revision

Viewing changes to ftparchive/override.cc

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2014-02-07 21:03:22 UTC
  • mfrom: (1.4.80 sid)
  • Revision ID: package-import@ubuntu.com-20140207210322-s7f833aga98ibdkm
Tags: 0.9.15.1ubuntu1
mergedĀ fromĀ debian/sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
      if (*Pkg == 0)
53
53
         continue;
54
54
 
 
55
#define APT_FIND_NEXT_FIELD \
 
56
      for (End++; isspace(*End) != 0 && *End != 0; ++End) \
 
57
         /* skip spaces */ ; \
 
58
      Start = End; \
 
59
      for (; isspace(*End) == 0 && *End != 0; ++End) \
 
60
         /* find end of word */ ;
 
61
 
 
62
#define APT_WARNING_MALFORMED_LINE(FIELD) \
 
63
      if (*End == 0) \
 
64
      { \
 
65
         _error->Warning(_("Malformed override %s line %llu (%s)"),File.c_str(), \
 
66
                         Counter, FIELD ); \
 
67
         continue; \
 
68
      } \
 
69
      *End = 0;
 
70
 
55
71
      // Find the package and zero..
56
 
      char *Start = Pkg;
 
72
      char *Start;
57
73
      char *End = Pkg;
58
74
      for (; isspace(*End) == 0 && *End != 0; End++);
59
 
      if (*End == 0)
60
 
      {
61
 
         _error->Warning(_("Malformed override %s line %llu #1"),File.c_str(),
62
 
                         Counter);
63
 
         continue;
64
 
      }      
65
 
      *End = 0;
 
75
      APT_WARNING_MALFORMED_LINE("pkgname");
 
76
 
 
77
      APT_FIND_NEXT_FIELD;
66
78
 
67
79
      // Find the priority
68
80
      if (Source == false)
69
81
      {
70
 
         for (End++; isspace(*End) != 0 && *End != 0; End++);
71
 
         Start = End;
72
 
         for (; isspace(*End) == 0 && *End != 0; End++);
73
 
         if (*End == 0)
74
 
         {
75
 
            _error->Warning(_("Malformed override %s line %llu #2"),File.c_str(),
76
 
                            Counter);
77
 
            continue;
78
 
         }
79
 
         *End = 0;
 
82
         APT_WARNING_MALFORMED_LINE("priority");
80
83
         Itm.Priority = Start;
 
84
 
 
85
         APT_FIND_NEXT_FIELD;
81
86
      }
82
 
      
 
87
 
83
88
      // Find the Section
84
 
      for (End++; isspace(*End) != 0 && *End != 0; End++);
85
 
      Start = End;
86
 
      for (; isspace(*End) == 0 && *End != 0; End++);
87
 
      if (*End == 0)
88
 
      {
89
 
         _error->Warning(_("Malformed override %s line %llu #3"),File.c_str(),
90
 
                         Counter);
91
 
         continue;
92
 
      }      
93
 
      *End = 0;
 
89
      APT_WARNING_MALFORMED_LINE("section");
94
90
      Itm.FieldOverride["Section"] = Start;
95
91
 
96
92
      // Source override files only have the two columns
99
95
         Mapping[Pkg] = Itm;
100
96
         continue;
101
97
      }
102
 
      
 
98
 
103
99
      // Find the =>
104
100
      for (End++; isspace(*End) != 0 && *End != 0; End++);
105
101
      if (*End != 0)