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/contrib | |
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/contrib')
-rw-r--r-- | apt-pkg/contrib/configuration.h | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/mmap.h | 2 | ||||
-rw-r--r-- | apt-pkg/contrib/progress.h | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 2a3ae1aa4..b5dfe721f 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -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 */ diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 3b4a4a10c..8d6cb3146 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -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) diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index 63d54d27c..3af1f47fb 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -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(); }; diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h index 4406a388b..903e6613e 100644 --- a/apt-pkg/contrib/progress.h +++ b/apt-pkg/contrib/progress.h @@ -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();}; }; |