summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashes.h
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/hashes.h')
-rw-r--r--apt-pkg/contrib/hashes.h53
1 files changed, 11 insertions, 42 deletions
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index 28bfd3459..c636852ec 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -47,14 +47,12 @@ 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
std::string HashType() const { return Type; };
std::string HashValue() const { return Hash; };
- APT_DEPRECATED_MSG("method was const-ified") std::string HashType() { return Type; };
- APT_DEPRECATED_MSG("method was const-ified") std::string HashValue() { return Hash; };
// verify the given filename against the currently loaded hash
bool VerifyFile(std::string filename) const;
@@ -165,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));
}
@@ -182,19 +180,17 @@ class PrivateHashes;
class Hashes
{
PrivateHashes * const d;
-
- public:
- /* those will disappear in the future as it is hard to add new ones this way.
+ /* TODO: those will disappear in the future as it is hard to add new ones this way.
* Use Add* to build the results and get them via GetHashStringList() instead */
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") MD5Summation MD5;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA1Summation SHA1;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA256Summation SHA256;
- APT_DEPRECATED_MSG("Use general .Add* and .GetHashStringList methods instead of hardcoding specific hashes") SHA512Summation SHA512;
+ MD5Summation MD5;
+ SHA1Summation SHA1;
+ SHA256Summation SHA256;
+ SHA512Summation SHA512;
+ public:
static const int UntilEOF = 0;
bool Add(const unsigned char * const Data, unsigned long long const Size) APT_NONNULL(2);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes) APT_NONNULL(2);
inline bool Add(const char * const Data) APT_NONNULL(2)
{return Add(reinterpret_cast<unsigned char const *>(Data),strlen(Data));};
inline bool Add(const unsigned char * const Beg,const unsigned char * const End) APT_NONNULL(2,3)
@@ -203,13 +199,10 @@ class Hashes
enum SupportedHashes { MD5SUM = (1 << 0), SHA1SUM = (1 << 1), SHA256SUM = (1 << 2),
SHA512SUM = (1 << 3) };
bool AddFD(int const Fd,unsigned long long Size = 0);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(int const Fd,unsigned long long Size, unsigned int const Hashes);
bool AddFD(FileFd &Fd,unsigned long long Size = 0);
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(FileFd &Fd,unsigned long long Size, unsigned int const Hashes);
HashStringList GetHashStringList();
-APT_IGNORE_DEPRECATED_PUSH
/** create a Hashes object to calculate all supported hashes
*
* If ALL is too much, you can limit which Hashes are calculated
@@ -217,34 +210,10 @@ APT_IGNORE_DEPRECATED_PUSH
* 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();
-APT_IGNORE_DEPRECATED_POP
-
- private:
- APT_HIDDEN APT_PURE inline unsigned int boolsToFlag(bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512)
- {
- unsigned int hashes = ~0;
- if (addMD5 == false) hashes &= ~MD5SUM;
- if (addSHA1 == false) hashes &= ~SHA1SUM;
- if (addSHA256 == false) hashes &= ~SHA256SUM;
- if (addSHA512 == false) hashes &= ~SHA512SUM;
- return hashes;
- }
-
- public:
-APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(int const Fd, unsigned long long Size, bool const addMD5,
- bool const addSHA1, bool const addSHA256, bool const addSHA512) {
- return AddFD(Fd, Size, boolsToFlag(addMD5, addSHA1, addSHA256, addSHA512));
- };
- APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool AddFD(FileFd &Fd, unsigned long long Size, bool const addMD5,
- bool const addSHA1, bool const addSHA256, bool const addSHA512) {
- return AddFD(Fd, Size, boolsToFlag(addMD5, addSHA1, addSHA256, addSHA512));
- };
-APT_IGNORE_DEPRECATED_POP
};
#endif