merged from the debian-wheezy branch
[ntk/apt.git] / apt-pkg / sourcelist.cc
index e20ec47..0fd237c 100644 (file)
@@ -15,6 +15,8 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/indexfile.h>
 
 #include <fstream>
 
@@ -31,7 +33,7 @@ unsigned long pkgSourceList::Type::GlobalListLen = 0;
 // Type::Type - Constructor                                            /*{{{*/
 // ---------------------------------------------------------------------
 /* Link this to the global list of items*/
-pkgSourceList::Type::Type()
+pkgSourceList::Type::Type() : Name(NULL), Label(NULL)
 {
    ItmList[GlobalListLen] = this;
    GlobalListLen++;
@@ -268,7 +270,11 @@ bool pkgSourceList::ReadAppend(string File)
       // CNC:2003-02-20 - Do not break if '#' is inside [].
       for (I = Buffer; *I != 0 && *I != '#'; I++)
          if (*I == '[')
-           for (I++; *I != 0 && *I != ']'; I++);
+         {
+           char *b_end = strchr(I + 1, ']');
+            if (b_end != NULL)
+               I = b_end;
+         }
       *I = 0;
       
       const char *C = _strstrip(Buffer);