diff options
| author | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:26:06 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:26:06 +0000 |
| commit | a6873075dcac5115706e001bc9640c8da0805e35 (patch) | |
| tree | e5d3d569e51d24207eb0228615f5eedd37e08296 | |
| parent | 04dcfd52355ca06143a8aaca4afd718a22fb0ded (diff) | |
| parent | af5b9453a1908021cf75c348522c1a12eeb0dee4 (diff) | |
Merge branch 'str-to-chars' into 'main'
apt: funcs called with a string literal consisting of a single character
See merge request apt-team/apt!563
| -rw-r--r-- | apt-pkg/acquire-item.cc | 6 | ||||
| -rw-r--r-- | apt-pkg/acquire-worker.cc | 6 | ||||
| -rw-r--r-- | apt-pkg/aptconfiguration.cc | 6 | ||||
| -rw-r--r-- | apt-pkg/cdrom.cc | 2 | ||||
| -rw-r--r-- | apt-pkg/contrib/strutl.cc | 4 | ||||
| -rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 2 | ||||
| -rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 4 | ||||
| -rw-r--r-- | apt-pkg/indexcopy.cc | 2 | ||||
| -rw-r--r-- | apt-private/private-install.cc | 4 | ||||
| -rw-r--r-- | apt-private/private-source.cc | 12 | ||||
| -rw-r--r-- | cmdline/apt-helper.cc | 2 | ||||
| -rw-r--r-- | ftparchive/byhash.cc | 2 | ||||
| -rw-r--r-- | methods/basehttp.cc | 2 | ||||
| -rw-r--r-- | methods/mirror.cc | 2 |
14 files changed, 28 insertions, 28 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 8bd77c052..21ed7b242 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -477,7 +477,7 @@ bool pkgAcqTransactionItem::QueueURI(pkgAcquire::ItemDesc &Item) if (unlikely(TargetHash == nullptr)) return false; ::URI uri{U}; - auto const trailing_slash = uri.Path.find_last_of("/"); + auto const trailing_slash = uri.Path.find_last_of('/'); if (unlikely(trailing_slash == std::string::npos)) return false; auto altPath = uri.Path.substr(0, trailing_slash) + "/by-hash/" + TargetHash->HashType() + "/" + TargetHash->HashValue(); @@ -495,8 +495,8 @@ bool pkgAcqTransactionItem::QueueURI(pkgAcquire::ItemDesc &Item) if (SameMirrorURI.empty() == false) { UsedMirror = TransactionManager->UsedMirror; - if (Item.Description.find(" ") != string::npos) - Item.Description.replace(0, Item.Description.find(" "), UsedMirror); + if (Item.Description.find(' ') != string::npos) + Item.Description.replace(0, Item.Description.find(' '), UsedMirror); } return pkgAcquire::Item::QueueURI(Item); } diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 55897945c..d712f3e30 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -231,7 +231,7 @@ static void APT_NONNULL(3) ChangeSiteIsMirrorChange(std::string const &NewURI, p if (URI::SiteOnly(NewURI) == URI::SiteOnly(desc.URI)) return; - auto const firstSpace = desc.Description.find(" "); + auto const firstSpace = desc.Description.find(' '); if (firstSpace != std::string::npos) { std::string const OldSite = desc.Description.substr(0, firstSpace); @@ -277,8 +277,8 @@ bool pkgAcquire::Worker::RunMessages() for (pkgAcquire::Queue::QItem::owner_iterator O = Itm->Owners.begin(); O != Itm->Owners.end(); ++O) (*O)->UsedMirror = UsedMirror; - if (Itm->Description.find(" ") != string::npos) - Itm->Description.replace(0, Itm->Description.find(" "), UsedMirror); + if (Itm->Description.find(' ') != string::npos) + Itm->Description.replace(0, Itm->Description.find(' '), UsedMirror); } } diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index a0164c6c3..fb6bcdb6d 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -175,8 +175,8 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All, builtin.push_back("none"); for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) { string const name = SubstVar(Ent->d_name, "%5f", "_"); - size_t const foundDash = name.rfind("-"); - size_t const foundUnderscore = name.rfind("_", foundDash); + size_t const foundDash = name.rfind('-'); + size_t const foundUnderscore = name.rfind('_', foundDash); if (foundDash == string::npos || foundUnderscore == string::npos || foundDash <= foundUnderscore || name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation") @@ -692,7 +692,7 @@ std::string Configuration::color(std::string const &colorName, std::string const // | \\x1B<word> ; color escaped. // | <word> ; a simple color name // | <color> <color> ; a sequence of colors - if (color.find(" ") != color.npos) + if (color.find(' ') != color.npos) { std::string res; for (auto &&colorPart : VectorizeString(color, ' ')) diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc index 4da2b738d..6d7613100 100644 --- a/apt-pkg/cdrom.cc +++ b/apt-pkg/cdrom.cc @@ -262,7 +262,7 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List) // Between Start and End is the architecture Start += 8; - if ((End = strstr(Start,"/")) != 0 && Start != End && + if ((End = strchr(Start,'/')) != 0 && Start != End && APT::Configuration::checkArchitecture(string(Start, End)) == true) continue; // okay, architecture is accepted diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index b5200831a..4363ab818 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -840,7 +840,7 @@ std::string LookupTag(const std::string &Message, const char *TagC, const char * // skip the space leading a multiline (Keep all other whitespaces in the value) valuestart = std::next(valuestart); } - auto const valueend = result.find_last_not_of("\n"); + auto const valueend = result.find_last_not_of('\n'); if (valueend == std::string::npos) result.clear(); else @@ -1506,7 +1506,7 @@ char *safe_snprintf(char *Buffer,char *End,const char *Format,...) // --------------------------------------------------------------------- string StripEpoch(const string &VerStr) { - size_t i = VerStr.find(":"); + size_t i = VerStr.find(':'); if (i == string::npos) return VerStr; return VerStr.substr(i+1); diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index b85163654..8fcb83678 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1318,7 +1318,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ /// allows you to match a.b.c against itself, .b.c, and .c, but not b.c static inline std::string NextLevelDomain(std::string Host) { - auto nextDot = Host.find(".", 1); + auto nextDot = Host.find('.', 1); if (nextDot == Host.npos) return ""; return Host.substr(nextDot); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 0f2467607..395227f50 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -646,7 +646,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) } // At this point we have a pkgname, but it might not be arch-qualified ! - if (pkgname.find(":") == std::string::npos) + if (pkgname.find(':') == std::string::npos) { pkgCache::GrpIterator const Grp = Cache.FindGrp(pkgname); if (unlikely(Grp.end()== true)) @@ -779,7 +779,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line) } std::string arch = ""; - if (pkgname.find(":") != string::npos) + if (pkgname.find(':') != string::npos) arch = StringSplit(pkgname, ":")[1]; std::string i18n_pkgname = pkgname; if (arch.size() != 0) diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 139b10316..089bfd2ce 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -161,7 +161,7 @@ bool IndexCopy::CopyPackages(string CDROM,string Name,vector<string> &List, // Attempt to fix busted symlink support for one instance string OrigFile = File; string::size_type Start = File.find("binary-"); - string::size_type End = File.find("/",Start+3); + string::size_type End = File.find('/',Start+3); if (Start != string::npos && End != string::npos) { File.replace(Start,End-Start,"binary-all"); diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index c619aa45a..33c529712 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1114,8 +1114,8 @@ static bool AddIfVolatile(pkgSourceList *const SL, std::vector<PseudoPkg> &Volat } else { - auto const found = pkg.name.rfind("/"); - if (found == pkg.name.find("/")) + auto const found = pkg.name.rfind('/'); + if (found == pkg.name.find('/')) _error->Error(_("Unsupported file %s given on commandline"), I); else { diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index ebd3a980c..eb7eee931 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -86,21 +86,21 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, TmpSrc = TmpSrc.substr(4); } // extract release - size_t found = TmpSrc.find_last_of("/"); + size_t found = TmpSrc.find_last_of('/'); if (found != std::string::npos) { RelTag = TmpSrc.substr(found+1); TmpSrc = TmpSrc.substr(0,found); } // extract the version - found = TmpSrc.find_last_of("="); + found = TmpSrc.find_last_of('='); if (found != std::string::npos) { VerTag = UserRequestedVerTag = TmpSrc.substr(found+1); TmpSrc = TmpSrc.substr(0,found); } // extract arch - found = TmpSrc.find_last_of(":"); + found = TmpSrc.find_last_of(':'); if (found != std::string::npos) { ArchTag = TmpSrc.substr(found+1); @@ -359,14 +359,14 @@ bool DoSource(CommandLine &CmdL) while (pos != std::string::npos) { pos += strlen("\nVcs-"); - std::string vcs = srec.substr(pos,srec.find(":",pos)-pos); + std::string vcs = srec.substr(pos,srec.find(':',pos)-pos); if(vcs == "Browser") { pos = srec.find("\nVcs-", pos); continue; } pos += vcs.length()+2; - std::string::size_type epos = srec.find("\n", pos); + std::string::size_type epos = srec.find('\n', pos); std::string const uri = srec.substr(pos,epos-pos); ioprintf(c1out, _("NOTICE: '%s' packaging is maintained in " "the '%s' version control system at:\n" @@ -806,7 +806,7 @@ bool DoBuildDep(CommandLine &CmdL) WriteBuildDependencyPackage(buildDepsPkgFile, pseudo, pseudoArch, GetBuildDeps(Last, Src.c_str(), hostArch)); std::string reltag = *I; - size_t found = reltag.find_last_of("/"); + size_t found = reltag.find_last_of('/'); if (found == std::string::npos) reltag.clear(); else diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc index 4404259d8..0700de0f6 100644 --- a/cmdline/apt-helper.cc +++ b/cmdline/apt-helper.cc @@ -117,7 +117,7 @@ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/ std::vector<SrvRec> srv_records; std::string const name = CmdL.FileList[i]; c0out << "# Target\tPriority\tWeight\tPort # for " << name << std::endl; - size_t const found = name.find(":"); + size_t const found = name.find(':'); if (found != std::string::npos) { std::string const host = name.substr(0, found); diff --git a/ftparchive/byhash.cc b/ftparchive/byhash.cc index b24f6158e..8013bd7a6 100644 --- a/ftparchive/byhash.cc +++ b/ftparchive/byhash.cc @@ -50,7 +50,7 @@ void DeleteAllButMostRecent(std::string dir, int KeepFiles) std::string GenByHashFilename(std::string ByHashOutputFile, HashString const &h) { std::string const ByHash = "/by-hash/" + h.HashType() + "/" + h.HashValue(); - size_t trailing_slash = ByHashOutputFile.find_last_of("/"); + size_t trailing_slash = ByHashOutputFile.find_last_of('/'); if (trailing_slash == std::string::npos) trailing_slash = 0; ByHashOutputFile = ByHashOutputFile.replace( diff --git a/methods/basehttp.cc b/methods/basehttp.cc index d335e6fa0..db0ed228f 100644 --- a/methods/basehttp.cc +++ b/methods/basehttp.cc @@ -330,7 +330,7 @@ static std::string fixURIEncoding(std::string const &part) { // if the server sends a space this is not an encoded URI // so other clients seem to encode it and we do it as well - if (part.find_first_of(" ") != std::string::npos) + if (part.find_first_of(' ') != std::string::npos) return aptMethod::URIEncode(part); return part; } diff --git a/methods/mirror.cc b/methods/mirror.cc index 6da0b4258..6fbaa40e6 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -334,7 +334,7 @@ std::string MirrorMethod::GetMirrorFileURI(std::string const &Message, FetchItem auto const colon = uristr.find(':'); if (unlikely(colon == std::string::npos)) continue; - auto const plus = uristr.find("+"); + auto const plus = uristr.find('+'); if (plus < colon) { // started as tor+mirror+http we want to get the file via tor+http |
