Browse Source

apt-pkg: URI: Add 'explicit' to single argument constructor

This needs a fair amount of changes elsewhere in the code,
hence this is separate from the previous commits.
tags/devuan/2.0.1+devuan1
Julian Andres Klode 1 year ago
parent
commit
af74a9e2d5
12 changed files with 21 additions and 21 deletions
  1. +1
    -1
      apt-pkg/acquire-worker.cc
  2. +1
    -1
      apt-pkg/acquire.cc
  3. +2
    -2
      apt-pkg/contrib/strutl.h
  4. +7
    -7
      methods/basehttp.cc
  5. +1
    -1
      methods/cdrom.cc
  6. +1
    -1
      methods/file.cc
  7. +3
    -3
      methods/ftp.cc
  8. +1
    -1
      methods/gpgv.cc
  9. +1
    -1
      methods/http.cc
  10. +1
    -1
      methods/rred.cc
  11. +1
    -1
      methods/rsh.cc
  12. +1
    -1
      methods/store.cc

+ 1
- 1
apt-pkg/acquire-worker.cc View File

@@ -766,7 +766,7 @@ bool pkgAcquire::Worker::QueueItem(pkgAcquire::Queue::QItem *Item)
Message += "URI: " + Item->URI;
Message += "\nFilename: " + Item->Owner->DestFile;

URI URL = Item->URI;
URI URL(Item->URI);
// FIXME: We should not hard code proxy protocols here.
if (URL.Access == "http" || URL.Access == "https")
{


+ 1
- 1
apt-pkg/acquire.cc View File

@@ -637,7 +637,7 @@ static void CheckDropPrivsMustBeDisabled(pkgAcquire const &Fetcher)

// if its the source file (e.g. local sources) we might be lucky
// by dropping the dropping only for some methods.
URI const source = (*I)->DescURI();
URI const source((*I)->DescURI());
if (source.Access == "file" || source.Access == "copy")
{
std::string const conf = "Binary::" + source.Access + "::APT::Sandbox::User";


+ 2
- 2
apt-pkg/contrib/strutl.h View File

@@ -218,8 +218,8 @@ class URI
static std::string SiteOnly(const std::string &URI);
static std::string ArchiveOnly(const std::string &URI);
static std::string NoUserPassword(const std::string &URI);
URI(std::string Path) {CopyFrom(Path);}
explicit URI(std::string Path) { CopyFrom(Path); }
URI() : Port(0) {}
};



+ 7
- 7
methods/basehttp.cc View File

@@ -313,7 +313,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
;
else if (Req.Location[0] == '/' && Queue->Uri.empty() == false)
{
URI Uri = Queue->Uri;
URI Uri(Queue->Uri);
if (Uri.Host.empty() == false)
NextURI = URI::SiteOnly(Uri);
else
@@ -332,7 +332,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
else
{
NextURI = DeQuoteString(Req.Location);
URI tmpURI = NextURI;
URI tmpURI(NextURI);
if (tmpURI.Access.find('+') != std::string::npos)
{
_error->Error("Server tried to trick us into using a specific implementation: %s", tmpURI.Access.c_str());
@@ -340,7 +340,7 @@ BaseHttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)
return ERROR_WITH_CONTENT_PAGE;
return ERROR_UNRECOVERABLE;
}
URI Uri = Queue->Uri;
URI Uri(Queue->Uri);
if (Binary.find('+') != std::string::npos)
{
auto base = Binary.substr(0, Binary.find('+'));
@@ -493,7 +493,7 @@ bool BaseHttpMethod::Fetch(FetchItem *)

do {
// Make sure we stick with the same server
if (Server->Comp(QueueBack->Uri) == false)
if (Server->Comp(URI(QueueBack->Uri)) == false)
break;

bool const UsableHashes = QueueBack->ExpectedHashes.usable();
@@ -578,14 +578,14 @@ int BaseHttpMethod::Loop()
continue;
// Connect to the server
if (Server == 0 || Server->Comp(Queue->Uri) == false)
if (Server == 0 || Server->Comp(URI(Queue->Uri)) == false)
{
if (!Queue->Proxy().empty())
{
URI uri = Queue->Uri;
URI uri(Queue->Uri);
_config->Set("Acquire::" + uri.Access + "::proxy::" + uri.Host, Queue->Proxy());
}
Server = CreateServerState(Queue->Uri);
Server = CreateServerState(URI(Queue->Uri));
setPostfixForMethodNames(::URI(Queue->Uri).Host.c_str());
AllowRedirect = ConfigFindB("AllowRedirect", true);
PipelineDepth = ConfigFindI("Pipeline-Depth", 10);


+ 1
- 1
methods/cdrom.cc View File

@@ -175,7 +175,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
{
FetchResult Res;

URI Get = Itm->Uri;
URI Get(Itm->Uri);
string File = Get.Path;
Debug = DebugEnabled();



+ 1
- 1
methods/file.cc View File

@@ -43,7 +43,7 @@ class FileMethod : public aptMethod
/* */
bool FileMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
URI Get(Itm->Uri);
std::string File = Get.Path;
FetchResult Res;
if (Get.Host.empty() == false)


+ 3
- 3
methods/ftp.cc View File

@@ -1037,7 +1037,7 @@ bool FtpMethod::Configuration(string Message)
/* Fetch a single file, called by the base class.. */
bool FtpMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
URI Get(Itm->Uri);
const char *File = Get.Path.c_str();
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -1166,8 +1166,8 @@ int main(int, const char *argv[])
proxy urls */
if (getenv("ftp_proxy") != 0)
{
URI Proxy = string(getenv("ftp_proxy"));
URI Proxy(string(getenv("ftp_proxy")));
// Run the HTTP method
if (Proxy.Access == "http")
{


+ 1
- 1
methods/gpgv.cc View File

@@ -419,7 +419,7 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,

bool GPGVMethod::URIAcquire(std::string const &Message, FetchItem *Itm)
{
URI const Get = Itm->Uri;
URI const Get(Itm->Uri);
string const Path = Get.Host + Get.Path; // To account for relative paths
SignersStorage Signers;



+ 1
- 1
methods/http.cc View File

@@ -892,7 +892,7 @@ ResultState HttpServerState::Go(bool ToFile, RequestState &Req)
/* This places the http request in the outbound buffer */
void HttpMethod::SendReq(FetchItem *Itm)
{
URI Uri = Itm->Uri;
URI Uri(Itm->Uri);
{
auto const plus = Binary.find('+');
if (plus != std::string::npos)


+ 1
- 1
methods/rred.cc View File

@@ -574,7 +574,7 @@ class RredMethod : public aptMethod {
protected:
virtual bool URIAcquire(std::string const &Message, FetchItem *Itm) APT_OVERRIDE {
Debug = DebugEnabled();
URI Get = Itm->Uri;
URI Get(Itm->Uri);
std::string Path = Get.Host + Get.Path; // rred:/path - no host

FetchResult Res;


+ 1
- 1
methods/rsh.cc View File

@@ -433,7 +433,7 @@ void RSHMethod::SigTerm(int)
/* */
bool RSHMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
URI Get(Itm->Uri);
const char *File = Get.Path.c_str();
FetchResult Res;
Res.Filename = Itm->DestFile;


+ 1
- 1
methods/store.cc View File

@@ -63,7 +63,7 @@ static bool OpenFileWithCompressorByName(FileFd &fileFd, std::string const &File
/*}}}*/
bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/
{
URI Get = Itm->Uri;
URI Get(Itm->Uri);
std::string Path = Get.Host + Get.Path; // To account for relative paths
FetchResult Res;


Loading…
Cancel
Save