* apt-pkg/deb/debsrcrecords.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 21 Sep 2011 17:31:03 +0000 (19:31 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 21 Sep 2011 17:31:03 +0000 (19:31 +0200)
  - remove the limit of 400 Binaries for a source package (Closes: #622110)

apt-pkg/deb/debsrcrecords.cc
apt-pkg/deb/debsrcrecords.h
debian/changelog

index 38389e6..ce55ccd 100644 (file)
@@ -32,25 +32,32 @@ using std::string;
    used during scanning to find the right package */
 const char **debSrcRecordParser::Binaries()
 {
-   // This should use Start/Stop too, it is supposed to be efficient after all.
-   string Bins = Sect.FindS("Binary");
-   if (Bins.empty() == true || Bins.length() >= 102400)
-      return 0;
-   
-   if (Bins.length() >= BufSize)
-   {
-      delete [] Buffer;
-      // allocate new size based on buffer (but never smaller than 4000)
-      BufSize = max((unsigned int)4000, max((unsigned int)Bins.length()+1,2*BufSize));
-      Buffer = new char[BufSize];
-   }
+   const char *Start, *End;
+   if (Sect.Find("Binary", Start, End) == false)
+      return NULL;
+   for (; isspace(*Start) != 0; ++Start);
+   if (Start >= End)
+      return NULL;
 
-   strcpy(Buffer,Bins.c_str());
-   if (TokSplitString(',',Buffer,StaticBinList,
-                     sizeof(StaticBinList)/sizeof(StaticBinList[0])) == false)
-      return 0;
+   StaticBinList.clear();
+   free(Buffer);
+   Buffer = strndup(Start, End - Start);
+
+   char* bin = Buffer;
+   do {
+      char* binStartNext = strchrnul(bin, ',');
+      char* binEnd = binStartNext - 1;
+      for (; isspace(*binEnd) != 0; --binEnd)
+        binEnd = '\0';
+      StaticBinList.push_back(bin);
+      if (*binStartNext != ',')
+        break;
+      *binStartNext = '\0';
+      for (bin = binStartNext + 1; isspace(*bin) != 0; ++bin);
+   } while (*bin != '\0');
+   StaticBinList.push_back(NULL);
 
-   return (const char **)StaticBinList;
+   return (const char **) &StaticBinList[0];
 }
                                                                        /*}}}*/
 // SrcRecordParser::BuildDepends - Return the Build-Depends information        /*{{{*/
index bb588e3..4c8d032 100644 (file)
@@ -24,10 +24,9 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    FileFd Fd;
    pkgTagFile Tags;
    pkgTagSection Sect;
-   char *StaticBinList[400];
+   std::vector<const char*> StaticBinList;
    unsigned long iOffset;
    char *Buffer;
-   unsigned int BufSize;
    
    public:
 
@@ -52,7 +51,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
 
    debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) 
       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
-        Buffer(0), BufSize(0) {}
+        Buffer(NULL) {}
    virtual ~debSrcRecordParser();
 };
 
index a3018e4..0e7ffb8 100644 (file)
@@ -13,8 +13,10 @@ apt (0.8.16~exp7) experimental; urgency=low
       statisfying garbage package dependencies (Closes: #640590)
   * apt-pkg/algorithms.cc:
     - if a package is garbage, don't try to save it with FixByInstall
+  * apt-pkg/deb/debsrcrecords.cc:
+    - remove the limit of 400 Binaries for a source package (Closes: #622110)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 20 Sep 2011 14:19:38 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 21 Sep 2011 19:29:55 +0200
 
 apt (0.8.16~exp6) experimental; urgency=low