diff options
| author | David Kalnischkies <david@kalnischkies.de> | 2022-04-01 13:45:09 +0200 |
|---|---|---|
| committer | David Kalnischkies <david@kalnischkies.de> | 2022-04-01 14:16:19 +0200 |
| commit | 472376be6818b5ea43250abcbecfcab53b4a729a (patch) | |
| tree | 892879ac883236b867e058a82b7ca153b3c56fc4 /apt-pkg/indexcopy.cc | |
| parent | 0b156cd1711a5e27643b941f5a321a62e5a9b628 (diff) | |
Use pkgTagSection::Key in more places in src:apt
The speed critical paths were converted earlier, but the remaining
could benefit a tiny bit from this as well especially as we have the
facility now available and can therefore brush up the code in various
places in the process as well.
Also takes the time to add the hidden Exists method advertised in
the headers, but previously not implemented.
Diffstat (limited to 'apt-pkg/indexcopy.cc')
| -rw-r--r-- | apt-pkg/indexcopy.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 88c2150ff..82baba337 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -22,6 +22,7 @@ #include <apt-pkg/metaindex.h> #include <apt-pkg/progress.h> #include <apt-pkg/strutl.h> +#include <apt-pkg/tagfile-keys.h> #include <apt-pkg/tagfile.h> #include <iostream> @@ -413,8 +414,8 @@ bool IndexCopy::GrabFirst(string Path,string &To,unsigned int Depth) /* */ bool PackageCopy::GetFile(string &File,unsigned long long &Size) { - File = Section->FindS("Filename"); - Size = Section->FindULL("Size"); + File = Section->Find(pkgTagSection::Key::Filename).to_string(); + Size = Section->FindULL(pkgTagSection::Key::Size); if (File.empty() || Size == 0) return _error->Error("Cannot find filename or size tag"); return true; @@ -447,18 +448,13 @@ bool SourceCopy::GetFile(string &File,unsigned long long &Size) else checksumField.append(*type); - Files = Section->FindS(checksumField.c_str()); + Files = Section->FindS(checksumField); if (Files.empty() == false) break; } if (Files.empty() == true) return false; - // Stash the / terminated directory prefix - string Base = Section->FindS("Directory"); - if (Base.empty() == false && Base[Base.length()-1] != '/') - Base += '/'; - // Read the first file triplet const char *C = Files.c_str(); string sSize; @@ -472,7 +468,8 @@ bool SourceCopy::GetFile(string &File,unsigned long long &Size) // Parse the size and append the directory Size = strtoull(sSize.c_str(), NULL, 10); - File = Base + File; + auto const Base = Section->Find(pkgTagSection::Key::Directory); + File = flCombine(Base.to_string(), File); return true; } /*}}}*/ |
