diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-04-30 12:07:07 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-04-30 17:43:31 +0200 |
commit | b52c6552c44fcb997b0db9f5e9f17b4674dd5359 (patch) | |
tree | 711f7259a65f5b658cb5ad4798323c2226cfb7c2 /apt-pkg/deb | |
parent | 4fa03143eee3776e2fa8fbd59d3cbaea40be0871 (diff) |
Add 'explicit' to most single argument constructors
This prevents implicit conversions that we do not want, such
as having a FileFd* being converted to a debListParser.
Two cases are not yet handled because they require changes
in code using them:
1. The classes in hashes.h
2. The URI class - this one is used quite a lot
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debindexfile.h | 10 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 6 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.h | 2 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.h | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 5c89f9c54..222fed229 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -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 diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index f02252d58..ad2b947fe 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -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 diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index f2a6b97ad..13575e10b 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -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 /*{{{*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 7c3b9020c..ea3fc320a 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -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(); }; diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 67c141766..3ba4770e8 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -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); |