diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-04-30 11:36:18 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-04-30 17:43:56 +0200 |
commit | 85e2c1b4ecbaf975d9d978f01227dc4987ee9d6c (patch) | |
tree | 9f86ba4295b24ecc3fde89a7e99ab09ffbe9e862 /apt-pkg/contrib/hashes.h | |
parent | b52c6552c44fcb997b0db9f5e9f17b4674dd5359 (diff) |
apt-pkg: hashes: Add 'explicit' to single argument constructors
This avoids funny code where strings get implicitly converted to
HashString or HashStringList.
Diffstat (limited to 'apt-pkg/contrib/hashes.h')
-rw-r--r-- | apt-pkg/contrib/hashes.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 9ef2945d7..c636852ec 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -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(); }; |