// ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
// ---------------------------------------------------------------------
/* */
+unsigned long debListParser::FindTagWrite(const char *Tag)
+{
+ const char *Start;
+ const char *Stop;
+ if (Section.Find(Tag,Start,Stop) == false)
+ return 0;
+ return WriteString(Start,Stop - Start);
+}
+ /*}}}*/
+// ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
+// ---------------------------------------------------------------------
+/* */
unsigned long debListParser::UniqFindTagWrite(const char *Tag)
{
const char *Start;
/* */
bool debListParser::NewVersion(pkgCache::VerIterator Ver)
{
- Ver->Display = UniqFindTagWrite("Name");
+ Ver->Display = FindTagWrite("Name");
if (Ver->Display == 0)
- Ver->Display = UniqFindTagWrite("Maemo-Display-Name");
+ Ver->Display = FindTagWrite("Maemo-Display-Name");
// Parse the section
Ver->Section = UniqFindTagWrite("Section");
const char *Stop;
if (Section.Find("Priority",Start,Stop) == true)
{
- if (GrabWord(string(Start,Stop-Start),PrioList,Ver->Priority) == false)
+ if (GrabWord(srkString(Start,Stop-Start),PrioList,Ver->Priority) == false)
Ver->Priority = pkgCache::State::Extra;
}
only describe package properties */
string debListParser::Description()
{
- if (DescriptionLanguage().empty())
- return Section.FindS("Description");
- else
- return Section.FindS(("Description-" + pkgIndexFile::LanguageCode()).c_str());
+ srkString description;
+ Description(description);
+ return description;
+}
+
+void debListParser::Description(srkString &Str) {
+ const char *Start, *Stop;
+ if (!Section.Find("Description", Start, Stop))
+ if (!Section.Find(("Description-" + pkgIndexFile::LanguageCode()).c_str(), Start, Stop)) {
+ Start = NULL;
+ Stop = NULL;
+ }
+ Str.assign(Start, Stop);
}
/*}}}*/
// ListParser::DescriptionLanguage - Return the description lang string /*{{{*/
assumed to describe original description. */
string debListParser::DescriptionLanguage()
{
- return Section.FindS("Description").empty() ? pkgIndexFile::LanguageCode() : "";
+ const char *Start, *Stop;
+ return Section.Find("Description", Start, Stop) ? std::string() : pkgIndexFile::LanguageCode();
}
/*}}}*/
// ListParser::Description - Return the description_md5 MD5SumValue /*{{{*/
*/
MD5SumValue debListParser::Description_md5()
{
- string value = Section.FindS("Description-md5");
-
- if (value.empty())
+ const char *Start;
+ const char *Stop;
+ if (!Section.Find("Description-md5", Start, Stop))
{
MD5Summation md5;
- md5.Add((Description() + "\n").c_str());
+ srkString description;
+ Description(description);
+ md5.Add((const unsigned char *) description.Start, description.Size);
+ md5.Add("\n");
return md5.Result();
} else
- return MD5SumValue(value);
+ return MD5SumValue(srkString(Start, Stop));
}
/*}}}*/
// ListParser::UsePackage - Update a package structure /*{{{*/
pkgCache::VerIterator Ver)
{
if (Pkg->Display == 0)
- Pkg->Display = UniqFindTagWrite("Name");
+ Pkg->Display = FindTagWrite("Name");
if (Pkg->Display == 0)
- Pkg->Display = UniqFindTagWrite("Maemo-Display-Name");
+ Pkg->Display = FindTagWrite("Maemo-Display-Name");
if (Pkg->Section == 0)
Pkg->Section = UniqFindTagWrite("Section");
if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
{"deinstall",pkgCache::State::DeInstall},
{"purge",pkgCache::State::Purge},
{}};
- if (GrabWord(string(Start,I-Start),WantList,Pkg->SelectedState) == false)
+ if (GrabWord(srkString(Start,I-Start),WantList,Pkg->SelectedState) == false)
return _error->Error("Malformed 1st word in the Status line");
// Isloate the next word
{"hold",pkgCache::State::HoldInst},
{"hold-reinstreq",pkgCache::State::HoldReInstReq},
{}};
- if (GrabWord(string(Start,I-Start),FlagList,Pkg->InstState) == false)
+ if (GrabWord(srkString(Start,I-Start),FlagList,Pkg->InstState) == false)
return _error->Error("Malformed 2nd word in the Status line");
// Isloate the last word
{"post-inst-failed",pkgCache::State::HalfConfigured},
{"removal-failed",pkgCache::State::HalfInstalled},
{}};
- if (GrabWord(string(Start,I-Start),StatusList,Pkg->CurrentState) == false)
+ if (GrabWord(srkString(Start,I-Start),StatusList,Pkg->CurrentState) == false)
return _error->Error("Malformed 3rd word in the Status line");
/* A Status line marks the package as indicating the current
const char *debListParser::ParseDepends(const char *Start,const char *Stop,
string &Package,string &Ver,
unsigned int &Op, bool ParseArchFlags)
+{
+ srkString cPackage, cVer;
+ const char *Value = ParseDepends(Start, Stop, cPackage, cVer, Op, ParseArchFlags);
+ Package = cPackage;
+ Ver = cVer;
+ return Value;
+}
+
+const char *debListParser::ParseDepends(const char *Start,const char *Stop,
+ srkString &Package,srkString &Ver,
+ unsigned int &Op, bool ParseArchFlags)
{
// Strip off leading space
for (;Start != Stop && isspace(*Start) != 0; Start++);
Found = !Found;
if (Found == false)
- Package = ""; /* not for this arch */
+ Package.clear(); /* not for this arch */
}
// Skip whitespace
if (Section.Find(Tag,Start,Stop) == false)
return true;
- string Package;
- string Version;
+ srkString Package;
+ srkString Version;
unsigned int Op;
while (1)
if (Section.Find("Provides",Start,Stop) == false)
return true;
- string Package;
- string Version;
+ srkString Package;
+ srkString Version;
unsigned int Op;
while (1)
if (Start == 0)
return _error->Error("Problem parsing Provides line");
if (Op != pkgCache::Dep::NoOp) {
- _error->Warning("Ignoring Provides line with DepCompareOp for package %s", Package.c_str());
+ _error->Warning("Ignoring Provides line with DepCompareOp for package %s", std::string(Package).c_str());
} else {
if (NewProvides(Ver,Package,Version) == false)
return false;
// ---------------------------------------------------------------------
/* Looks for a word in a list of words - for ParseStatus */
bool debListParser::GrabWord(string Word,WordList *List,unsigned char &Out)
+{
+ return GrabWord(srkString(Word), List, Out);
+}
+
+bool debListParser::GrabWord(const srkString &Word,WordList *List,unsigned char &Out)
{
for (unsigned int C = 0; List[C].Str != 0; C++)
{
- if (strcasecmp(Word.c_str(),List[C].Str) == 0)
+ if (strncasecmp(Word.Start,List[C].Str,Word.Size) == 0)
{
Out = List[C].Val;
return true;
if (stringcmp(Start,Stop,"all") == 0)
return true;
+ if (stringcmp(Start,Stop,"cydia") == 0)
+ return true;
+
iOffset = Tags.Offset();
}
return false;