summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debsrcrecords.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-21 19:31:03 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-21 19:31:03 +0200
commit39fb1e241ebb76c7e51c8d8f2f76ce5f1e680859 (patch)
tree3549b524b4b078e9b56d4dac7d61cf5f678a1ec6 /apt-pkg/deb/debsrcrecords.cc
parent87da74517a0defa3450d0f3d8c3275f6963d0f5e (diff)
* apt-pkg/deb/debsrcrecords.cc:
- remove the limit of 400 Binaries for a source package (Closes: #622110)
Diffstat (limited to 'apt-pkg/deb/debsrcrecords.cc')
-rw-r--r--apt-pkg/deb/debsrcrecords.cc41
1 files changed, 24 insertions, 17 deletions
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 38389e624..ce55ccd1f 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -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 /*{{{*/