summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2024-11-12 17:59:26 +0100
committerнаб <nabijaczleweli@nabijaczleweli.xyz>2024-11-12 20:36:18 +0100
commit70b02c17f3cec9f98fbffa9c560b06bb6e01c13f (patch)
treedf94de617a97bc3bffb3686a04cb4af550b28e07
parente33add3c2afa33a6f81b2eaed1fdcd29dc28790f (diff)
cmdline/apt-sortpkgs.cc: prepare for APT::StringView -> std::string_view
-rw-r--r--cmdline/apt-sortpkgs.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/cmdline/apt-sortpkgs.cc b/cmdline/apt-sortpkgs.cc
index acbb2832e..8442a959d 100644
--- a/cmdline/apt-sortpkgs.cc
+++ b/cmdline/apt-sortpkgs.cc
@@ -1,13 +1,13 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
/* ######################################################################
-
+
APT Sort Packages - Program to sort Package and Source files
This program is quite simple, it just sorts the package files by
package and sorts the fields inside by the internal APT sort order.
Input is taken from a named file and sent to stdout.
-
+
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
@@ -46,7 +46,7 @@ struct PkgName /*{{{*/
string Arch;
unsigned long Offset;
unsigned long Length;
-
+
inline int Compare3(const PkgName &x) const
{
int A = stringcasecmp(Name,x.Name);
@@ -58,7 +58,7 @@ struct PkgName /*{{{*/
}
return A;
}
-
+
bool operator <(const PkgName &x) const {return Compare3(x) < 0;};
bool operator >(const PkgName &x) const {return Compare3(x) > 0;};
bool operator ==(const PkgName &x) const {return Compare3(x) == 0;};
@@ -73,7 +73,7 @@ static bool DoIt(string InFile)
pkgTagFile Tags(&Fd);
if (_error->PendingError() == true)
return false;
-
+
// Parse.
vector<PkgName> List;
pkgTagSection Section;
@@ -83,28 +83,28 @@ static bool DoIt(string InFile)
while (Tags.Step(Section) == true)
{
PkgName Tmp;
-
- /* Fetch the name, auto-detecting if this is a source file or a
+
+ /* Fetch the name, auto-detecting if this is a source file or a
package file */
- Tmp.Name = Section.Find(pkgTagSection::Key::Package).to_string();
- Tmp.Ver = Section.Find(pkgTagSection::Key::Version).to_string();
- Tmp.Arch = Section.Find(pkgTagSection::Key::Architecture).to_string();
-
+ Tmp.Name = Section.Find(pkgTagSection::Key::Package);
+ Tmp.Ver = Section.Find(pkgTagSection::Key::Version);
+ Tmp.Arch = Section.Find(pkgTagSection::Key::Architecture);
+
if (Tmp.Name.empty() == true)
return _error->Error(_("Unknown package record!"));
-
+
Tmp.Offset = Offset;
Tmp.Length = Section.size();
if (Largest < Tmp.Length)
Largest = Tmp.Length;
-
+
List.push_back(Tmp);
-
+
Offset = Tags.Offset();
}
if (_error->PendingError() == true)
return false;
-
+
// Sort it
sort(List.begin(),List.end());