Browse Source

Merge branch 'pu/explicit-constructors' into 'master'

Use explicit constructors

See merge request apt-team/apt!61
tags/devuan/2.0.1+devuan1
Julian Andres Klode 1 year ago
parent
commit
e547a73892
32 changed files with 60 additions and 58 deletions
  1. +1
    -1
      apt-inst/contrib/arfile.h
  2. +2
    -2
      apt-inst/deb/debfile.h
  3. +2
    -2
      apt-inst/filelist.h
  4. +1
    -1
      apt-pkg/acquire-worker.cc
  5. +1
    -1
      apt-pkg/acquire.cc
  6. +2
    -2
      apt-pkg/contrib/configuration.h
  7. +1
    -1
      apt-pkg/contrib/fileutl.cc
  8. +5
    -5
      apt-pkg/contrib/hashes.h
  9. +1
    -1
      apt-pkg/contrib/mmap.h
  10. +2
    -2
      apt-pkg/contrib/progress.h
  11. +2
    -2
      apt-pkg/contrib/strutl.h
  12. +5
    -5
      apt-pkg/deb/debindexfile.h
  13. +3
    -3
      apt-pkg/deb/deblistparser.h
  14. +1
    -1
      apt-pkg/deb/debmetaindex.cc
  15. +1
    -1
      apt-pkg/deb/debrecords.h
  16. +1
    -1
      apt-pkg/deb/dpkgpm.h
  17. +3
    -3
      apt-pkg/edsp/edspindexfile.h
  18. +3
    -3
      apt-pkg/edsp/edsplistparser.h
  19. +1
    -1
      apt-pkg/edsp/edspsystem.h
  20. +2
    -0
      apt-private/private-cacheset.h
  21. +1
    -1
      apt-private/private-json-hooks.cc
  22. +1
    -1
      apt-private/private-sources.cc
  23. +7
    -7
      methods/basehttp.cc
  24. +1
    -1
      methods/cdrom.cc
  25. +1
    -1
      methods/file.cc
  26. +3
    -3
      methods/ftp.cc
  27. +1
    -1
      methods/gpgv.cc
  28. +1
    -1
      methods/http.cc
  29. +1
    -1
      methods/mirror.cc
  30. +1
    -1
      methods/rred.cc
  31. +1
    -1
      methods/rsh.cc
  32. +1
    -1
      methods/store.cc

+ 1
- 1
apt-inst/contrib/arfile.h View File

@@ -44,7 +44,7 @@ class ARArchive
const Member *FindMember(const char *Name) const;
inline Member *Members() { return List; }
ARArchive(FileFd &File);
explicit ARArchive(FileFd &File);
~ARArchive();
};



+ 2
- 2
apt-inst/deb/debfile.h View File

@@ -56,7 +56,7 @@ class debDebFile
const ARArchive::Member *GotoMember(const char *Name);
inline FileFd &GetFile() {return File;};
debDebFile(FileFd &File);
explicit debDebFile(FileFd &File);
};

class debDebFile::ControlExtract : public pkgDirStream
@@ -87,7 +87,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
bool TakeControl(const void *Data,unsigned long long Size);

MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
explicit MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
~MemControlExtract() {delete [] Control;};
};
/*}}}*/


+ 2
- 2
apt-inst/filelist.h View File

@@ -97,7 +97,7 @@ class pkgFLCache
bool AddConfFile(const char *Name,const char *NameEnd,
PkgIterator const &Owner,const unsigned char *Sum);

pkgFLCache(DynamicMMap &Map);
explicit pkgFLCache(DynamicMMap &Map);
// ~pkgFLCache();
};

@@ -288,7 +288,7 @@ class pkgFLCache::NodeIterator
Package *RealPackage() const;

NodeIterator() : Nde(0), Type(NdeHash), Owner(0) {};
NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}
explicit NodeIterator(pkgFLCache &Owner) : Nde(Owner.NodeP), Type(NdeHash), Owner(&Owner) {}
NodeIterator(pkgFLCache &Owner,Node *Trg) : Nde(Trg), Type(NdeHash), Owner(&Owner) {}
NodeIterator(pkgFLCache &Owner,Node *Trg,Package *) : Nde(Trg), Type(NdePkg), Owner(&Owner) {}
};


+ 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/configuration.h View File

@@ -119,7 +119,7 @@ class Configuration
void Dump(std::ostream& str, char const * const root,
char const * const format, bool const emptyValue);

Configuration(const Item *Root);
explicit Configuration(const Item *Root);
Configuration();
~Configuration();

@@ -130,7 +130,7 @@ class Configuration
APT_HIDDEN void clearPatterns();

public:
MatchAgainstConfig(char const * Config);
explicit MatchAgainstConfig(char const * Config);
virtual ~MatchAgainstConfig();

/** \brief Returns \b true for a string matching one of the patterns */


+ 1
- 1
apt-pkg/contrib/fileutl.cc View File

@@ -1944,7 +1944,7 @@ class APT_HIDDEN LzmaFileFdPrivate: public FileFdPrivate { /*{{{*/
bool eof;
bool compressing;

LZMAFILE(FileFd * const fd) : file(nullptr), filefd(fd), eof(false), compressing(false) { buffer[0] = '\0'; }
explicit LZMAFILE(FileFd * const fd) : file(nullptr), filefd(fd), eof(false), compressing(false) { buffer[0] = '\0'; }
~LZMAFILE()
{
if (compressing == true && filefd->Failed() == false)


+ 5
- 5
apt-pkg/contrib/hashes.h View File

@@ -47,7 +47,7 @@ class HashString

public:
HashString(std::string Type, std::string Hash);
HashString(std::string StringedHashString); // init from str as "type:hash"
explicit HashString(std::string StringedHashString); // init from str as "type:hash"
HashString();

// get hash type used
@@ -163,11 +163,11 @@ class HashStringList
HashStringList() {}

// simplifying API-compatibility constructors
HashStringList(std::string const &hash) {
explicit HashStringList(std::string const &hash) {
if (hash.empty() == false)
list.push_back(HashString(hash));
}
HashStringList(char const * const hash) {
explicit HashStringList(char const * const hash) {
if (hash != NULL && hash[0] != '\0')
list.push_back(HashString(hash));
}
@@ -210,9 +210,9 @@ class Hashes
* which hashes to generate. */
Hashes();
/** @param Hashes bitflag composed of #SupportedHashes */
Hashes(unsigned int const Hashes);
explicit Hashes(unsigned int const Hashes);
/** @param Hashes is a list of hashes */
Hashes(HashStringList const &Hashes);
explicit Hashes(HashStringList const &Hashes);
virtual ~Hashes();
};



+ 1
- 1
apt-pkg/contrib/mmap.h View File

@@ -74,7 +74,7 @@ class MMap
bool Sync(unsigned long Start,unsigned long Stop);
MMap(FileFd &F,unsigned long Flags);
MMap(unsigned long Flags);
explicit MMap(unsigned long Flags);
virtual ~MMap();
};



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

@@ -80,9 +80,9 @@ class OpTextProgress : public OpProgress

virtual void Done() APT_OVERRIDE;
OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate),
explicit OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate),
NoDisplay(false), LastLen(0) {};
OpTextProgress(Configuration &Config);
explicit OpTextProgress(Configuration &Config);
virtual ~OpTextProgress() {Done();};
};



+ 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) {}
};



+ 5
- 5
apt-pkg/deb/debindexfile.h View File

@@ -44,7 +44,7 @@ public:

virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;

debStatusIndex(std::string const &File);
explicit debStatusIndex(std::string const &File);
virtual ~debStatusIndex();
};

@@ -83,7 +83,7 @@ public:
// Interface for the Cache Generator
virtual bool HasPackages() const APT_OVERRIDE;

debTranslationsIndex(IndexTarget const &Target);
explicit debTranslationsIndex(IndexTarget const &Target);
virtual ~debTranslationsIndex();
};

@@ -141,7 +141,7 @@ public:

// Interface for acquire

debDebPkgFileIndex(std::string const &DebFile);
explicit debDebPkgFileIndex(std::string const &DebFile);
virtual ~debDebPkgFileIndex();

//FIXME: use proper virtual-handling on next ABI break
@@ -162,7 +162,7 @@ public:
virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
virtual bool HasPackages() const APT_OVERRIDE {return false;};

debDscFileIndex(std::string const &DscFile);
explicit debDscFileIndex(std::string const &DscFile);
virtual ~debDscFileIndex();
};

@@ -191,7 +191,7 @@ public:
// Abort if the file does not exist.
virtual bool Exists() const APT_OVERRIDE {return true;};

debStringPackageIndex(std::string const &content);
explicit debStringPackageIndex(std::string const &content);
virtual ~debStringPackageIndex();
};
#endif

+ 3
- 3
apt-pkg/deb/deblistparser.h View File

@@ -121,7 +121,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser

APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);

debListParser(FileFd *File);
explicit debListParser(FileFd *File);
virtual ~debListParser();
};

@@ -145,7 +145,7 @@ class APT_HIDDEN debTranslationsParser : public debListParser
virtual APT::StringView Version() APT_OVERRIDE { return ""; }
#endif

debTranslationsParser(FileFd *File)
explicit debTranslationsParser(FileFd *File)
: debListParser(File) {};
};

@@ -153,7 +153,7 @@ class APT_HIDDEN debStatusListParser : public debListParser
{
public:
virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
debStatusListParser(FileFd *File)
explicit debStatusListParser(FileFd *File)
: debListParser(File) {};
};
#endif

+ 1
- 1
apt-pkg/deb/debmetaindex.cc View File

@@ -109,7 +109,7 @@ class APT_HIDDEN debReleaseIndexPrivate /*{{{*/
std::vector<std::string> SupportedComponents;
std::map<std::string, std::string> const ReleaseOptions;

debReleaseIndexPrivate(std::map<std::string, std::string> const &Options) : CheckValidUntil(metaIndex::TRI_UNSET), ValidUntilMin(0), ValidUntilMax(0), CheckDate(metaIndex::TRI_UNSET), DateMaxFuture(0), NotBefore(0), ReleaseOptions(Options) {}
explicit debReleaseIndexPrivate(std::map<std::string, std::string> const &Options) : CheckValidUntil(metaIndex::TRI_UNSET), ValidUntilMin(0), ValidUntilMax(0), CheckDate(metaIndex::TRI_UNSET), DateMaxFuture(0), NotBefore(0), ReleaseOptions(Options) {}
};
/*}}}*/
// ReleaseIndex::MetaIndex* - display helpers /*{{{*/


+ 1
- 1
apt-pkg/deb/debrecords.h View File

@@ -85,7 +85,7 @@ class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
public:
virtual std::string FileName() APT_OVERRIDE;

debDebFileRecordParser(std::string FileName);
explicit debDebFileRecordParser(std::string FileName);
virtual ~debDebFileRecordParser();
};



+ 1
- 1
apt-pkg/deb/dpkgpm.h View File

@@ -131,7 +131,7 @@ class pkgDPkgPM : public pkgPackageManager
public:

pkgDPkgPM(pkgDepCache *Cache);
explicit pkgDPkgPM(pkgDepCache *Cache);
virtual ~pkgDPkgPM();

APT_HIDDEN static bool ExpandPendingCalls(std::vector<Item> &List, pkgDepCache &Cache);


+ 3
- 3
apt-pkg/edsp/edspindexfile.h View File

@@ -29,7 +29,7 @@ public:
virtual bool Exists() const APT_OVERRIDE;
virtual bool HasPackages() const APT_OVERRIDE;

edspLikeIndex(std::string const &File);
explicit edspLikeIndex(std::string const &File);
virtual ~edspLikeIndex();
};

@@ -42,7 +42,7 @@ protected:
public:
virtual const Type *GetType() const APT_OVERRIDE APT_PURE;

edspIndex(std::string const &File);
explicit edspIndex(std::string const &File);
virtual ~edspIndex();
};

@@ -55,7 +55,7 @@ protected:
public:
virtual const Type *GetType() const APT_OVERRIDE APT_PURE;

eippIndex(std::string const &File);
explicit eippIndex(std::string const &File);
virtual ~eippIndex();
};



+ 3
- 3
apt-pkg/edsp/edsplistparser.h View File

@@ -35,7 +35,7 @@ class APT_HIDDEN edspLikeListParser : public debListParser
virtual APT::StringView Description_md5() APT_OVERRIDE;
virtual unsigned short VersionHash() APT_OVERRIDE;

edspLikeListParser(FileFd *File);
explicit edspLikeListParser(FileFd *File);
virtual ~edspLikeListParser();
};

@@ -48,7 +48,7 @@ protected:
virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;

public:
edspListParser(FileFd *File);
explicit edspListParser(FileFd *File);
virtual ~edspListParser();
};

@@ -58,7 +58,7 @@ protected:
virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;

public:
eippListParser(FileFd *File);
explicit eippListParser(FileFd *File);
virtual ~eippListParser();
};
#endif

+ 1
- 1
apt-pkg/edsp/edspsystem.h View File

@@ -37,7 +37,7 @@ public:
virtual bool FindIndex(pkgCache::PkgFileIterator File,
pkgIndexFile *&Found) const APT_OVERRIDE;

edspLikeSystem(char const * const Label);
explicit edspLikeSystem(char const * const Label);
virtual ~edspLikeSystem();
};



+ 2
- 0
apt-private/private-cacheset.h View File

@@ -18,6 +18,8 @@ class VerIteratorWithCaching
const pkgCache::VerIterator iter;
const pkgCache::DescFile * descFile;
public:

// cppcheck-suppress noExplicitConstructor
VerIteratorWithCaching(const pkgCache::VerIterator& iter) :
iter(iter),
descFile(iter->DescriptionList != 0


+ 1
- 1
apt-private/private-json-hooks.cc View File

@@ -79,7 +79,7 @@ class APT_HIDDEN JsonWriter
}

public:
JsonWriter(std::ostream &os) : os(os) { old_locale = os.imbue(std::locale::classic()); }
explicit JsonWriter(std::ostream &os) : os(os) { old_locale = os.imbue(std::locale::classic()); }
~JsonWriter() { os.imbue(old_locale); }
JsonWriter &beginArray()
{


+ 1
- 1
apt-private/private-sources.cc View File

@@ -31,7 +31,7 @@
class APT_HIDDEN ScopedGetLock {
public:
int fd;
ScopedGetLock(std::string const &filename) : fd(GetLock(filename)) {}
explicit ScopedGetLock(std::string const &filename) : fd(GetLock(filename)) {}
~ScopedGetLock() { close(fd); }
};
bool EditSources(CommandLine &CmdL)


+ 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/mirror.cc View File

@@ -97,7 +97,7 @@ class MirrorMethod : public aptMethod /*{{{*/
void DealWithPendingItems(std::vector<std::string> const &baseuris, MirrorListInfo const &info, FetchItem *const Itm, std::function<void()> handler);

public:
MirrorMethod(std::string &&pProg) : aptMethod(std::move(pProg), "2.0", SingleInstance | Pipeline | SendConfig | AuxRequests), genrng(clock())
explicit MirrorMethod(std::string &&pProg) : aptMethod(std::move(pProg), "2.0", SingleInstance | Pipeline | SendConfig | AuxRequests), genrng(clock())
{
SeccompFlags = aptMethod::BASE | aptMethod::DIRECTORY;
}


+ 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