summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-01-26 23:18:05 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-01-26 23:18:05 +0100
commit8efd5947bf7de0fc3db51b4871bcf3522018761d (patch)
tree698e9f3468b85227ca9a0fa7969a0b412baec361 /apt-pkg/deb/deblistparser.cc
parent02ceb810fe0de9b267a8b6a302505967afce6b5a (diff)
convert Version() and Architecture() to APT::StringView
Part of hidden classes, so conversion is abi-free. Git-Dch: Ignore
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 86fd5dc54..860aa3bc2 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -72,9 +72,9 @@ string debListParser::Package() {
// ListParser::Architecture - Return the package arch /*{{{*/
// ---------------------------------------------------------------------
/* This will return the Architecture of the package this section describes */
-string debListParser::Architecture() {
+APT::StringView debListParser::Architecture() {
auto const Arch = Section.Find("Architecture");
- return Arch.empty() ? "none" : Arch.to_string();
+ return Arch.empty() ? "none" : Arch;
}
/*}}}*/
// ListParser::ArchitectureAll /*{{{*/
@@ -89,9 +89,9 @@ bool debListParser::ArchitectureAll() {
/* This is to return the string describing the version in debian form,
epoch:upstream-release. If this returns the blank string then the
entry is assumed to only describe package properties */
-string debListParser::Version()
+APT::StringView debListParser::Version()
{
- return Section.Find("Version").to_string();
+ return Section.Find("Version");
}
/*}}}*/
unsigned char debListParser::ParseMultiArch(bool const showErrors) /*{{{*/
@@ -160,7 +160,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
const char * const Close = (const char * const) memchr(Open, ')', Stop - Open);
if (likely(Close != NULL))
{
- std::string const version(Open + 1, (Close - Open) - 1);
+ APT::StringView const version(Open + 1, (Close - Open) - 1);
if (version != Ver.VerStr())
{
map_stringitem_t const idx = StoreString(pkgCacheGenerator::VERSIONNUMBER, version);
@@ -171,7 +171,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
Stop = Space;
}
- std::string const pkgname(Start, Stop - Start);
+ APT::StringView const pkgname(Start, Stop - Start);
if (pkgname != G.Name())
{
for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P))
@@ -651,7 +651,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
++I;
}
- std::string arch(I, End);
+ std::string const arch(I, End);
if (arch.empty() == false && matchesArch(arch.c_str()) == true)
{
Found = true;
@@ -733,8 +733,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
++I;
}
- std::string restriction(I, End);
-
+ std::string const restriction(I, End);
if (restriction.empty() == false && profiles.empty() == false &&
std::find(profiles.begin(), profiles.end(), restriction) != profiles.end())
{
@@ -825,12 +824,13 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
{
// Such dependencies are not supposed to be accepted …
// … but this is probably the best thing to do anyway
- std::string Pkg;
if (Package.substr(found + 1) == "native")
- Pkg = Package.substr(0, found).to_string() + ':' + Ver.Cache()->NativeArch();
- else
- Pkg = Package.to_string();
- if (NewDepends(Ver, Pkg, "any", Version, Op | pkgCache::Dep::ArchSpecific, Type) == false)
+ {
+ std::string const Pkg = Package.substr(0, found).to_string() + ':' + Ver.Cache()->NativeArch();
+ if (NewDepends(Ver, Pkg, "any", Version, Op | pkgCache::Dep::ArchSpecific, Type) == false)
+ return false;
+ }
+ else if (NewDepends(Ver, Package, "any", Version, Op | pkgCache::Dep::ArchSpecific, Type) == false)
return false;
}