diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-26 12:57:46 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-02-26 16:31:20 +0100 |
commit | f53a120320cd09d572658d424badc5485f1b9182 (patch) | |
tree | 41d00b0c22825066c544b40924e62c31dbc81fa7 /apt-pkg | |
parent | 97bd7e492bad1ef50f2659faef61b409ffe67311 (diff) |
hashes: Remove deprecated functions
This keeps the members in the class, but makes them private. We
want to migrate to libgcrypt eventually, since we already use
libgcrypt through gpgv anyway.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/hashes.cc | 21 | ||||
-rw-r--r-- | apt-pkg/contrib/hashes.h | 43 |
2 files changed, 6 insertions, 58 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 98b92cc81..d03fb6083 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -312,7 +312,6 @@ bool Hashes::Add(const unsigned char * const Data, unsigned long long const Size if (Size == 0) return true; bool Res = true; -APT_IGNORE_DEPRECATED_PUSH if ((d->CalcHashes & MD5SUM) == MD5SUM) Res &= MD5.Add(Data, Size); if ((d->CalcHashes & SHA1SUM) == SHA1SUM) @@ -321,15 +320,9 @@ APT_IGNORE_DEPRECATED_PUSH Res &= SHA256.Add(Data, Size); if ((d->CalcHashes & SHA512SUM) == SHA512SUM) Res &= SHA512.Add(Data, Size); -APT_IGNORE_DEPRECATED_POP d->FileSize += Size; return Res; } -bool Hashes::Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes) -{ - d->CalcHashes = Hashes; - return Add(Data, Size); -} bool Hashes::AddFD(int const Fd,unsigned long long Size) { unsigned char Buf[64*64]; @@ -349,11 +342,6 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size) } return true; } -bool Hashes::AddFD(int const Fd,unsigned long long Size, unsigned int const Hashes) -{ - d->CalcHashes = Hashes; - return AddFD(Fd, Size); -} bool Hashes::AddFD(FileFd &Fd,unsigned long long Size) { unsigned char Buf[64*64]; @@ -378,16 +366,10 @@ bool Hashes::AddFD(FileFd &Fd,unsigned long long Size) } return true; } -bool Hashes::AddFD(FileFd &Fd,unsigned long long Size, unsigned int const Hashes) -{ - d->CalcHashes = Hashes; - return AddFD(Fd, Size); -} /*}}}*/ HashStringList Hashes::GetHashStringList() { HashStringList hashes; -APT_IGNORE_DEPRECATED_PUSH if ((d->CalcHashes & MD5SUM) == MD5SUM) hashes.push_back(HashString("MD5Sum", MD5.Result().Value())); if ((d->CalcHashes & SHA1SUM) == SHA1SUM) @@ -396,13 +378,10 @@ APT_IGNORE_DEPRECATED_PUSH hashes.push_back(HashString("SHA256", SHA256.Result().Value())); if ((d->CalcHashes & SHA512SUM) == SHA512SUM) hashes.push_back(HashString("SHA512", SHA512.Result().Value())); -APT_IGNORE_DEPRECATED_POP hashes.FileSize(d->FileSize); return hashes; } -APT_IGNORE_DEPRECATED_PUSH Hashes::Hashes() : d(new PrivateHashes(~0)) { } Hashes::Hashes(unsigned int const Hashes) : d(new PrivateHashes(Hashes)) {} Hashes::Hashes(HashStringList const &Hashes) : d(new PrivateHashes(Hashes)) {} Hashes::~Hashes() { delete d; } -APT_IGNORE_DEPRECATED_POP diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 28bfd3459..9ef2945d7 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -53,8 +53,6 @@ class 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; @@ -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 @@ -221,30 +214,6 @@ APT_IGNORE_DEPRECATED_PUSH /** @param Hashes is a list of hashes */ 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 |