summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-02-26 12:57:46 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2019-02-26 16:31:20 +0100
commitf53a120320cd09d572658d424badc5485f1b9182 (patch)
tree41d00b0c22825066c544b40924e62c31dbc81fa7
parent97bd7e492bad1ef50f2659faef61b409ffe67311 (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.
-rw-r--r--apt-pkg/contrib/hashes.cc21
-rw-r--r--apt-pkg/contrib/hashes.h43
-rw-r--r--debian/libapt-pkg6.0.symbols11
3 files changed, 6 insertions, 69 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
diff --git a/debian/libapt-pkg6.0.symbols b/debian/libapt-pkg6.0.symbols
index 01dc3808a..5cf9e64b9 100644
--- a/debian/libapt-pkg6.0.symbols
+++ b/debian/libapt-pkg6.0.symbols
@@ -394,7 +394,6 @@ libapt-pkg.so.6.0 libapt-pkg6.0 #MINVER#
(c++)"IndexCopy::ChopDirs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)@APTPKG_6.0" 0.8.0
(c++)"IndexCopy::GrabFirst(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int)@APTPKG_6.0" 0.8.0
(c++)"SigVerify::CopyAndVerify(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)@APTPKG_6.0" 0.8.0
- (c++)"SigVerify::RunGPGV(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int const&, int*)@APTPKG_6.0" 0.8.0
(c++)"debSystem::Initialize(Configuration&)@APTPKG_6.0" 0.8.0
(c++)"debSystem::AddStatusFiles(std::vector<pkgIndexFile*, std::allocator<pkgIndexFile*> >&)@APTPKG_6.0" 0.8.0
(c++)"debSystem::ArchiveSupported(char const*)@APTPKG_6.0" 0.8.0
@@ -967,15 +966,6 @@ libapt-pkg.so.6.0 libapt-pkg6.0 #MINVER#
(c++)"typeinfo name for APT::VersionContainer<std::vector<pkgCache::VerIterator, std::allocator<pkgCache::VerIterator> > >@APTPKG_6.0" 1.1~exp15
(c++)"vtable for APT::VersionContainer<std::vector<pkgCache::VerIterator, std::allocator<pkgCache::VerIterator> > >@APTPKG_6.0" 1.1~exp15
### all the hashes are belong to us
-# (c++|optional=inline)"Hashes::AddFD(int, unsigned long long, bool, bool, bool, bool)@APTPKG_6.0" 0.8.16~exp6
-# (c++|optional=inline)"Hashes::AddFD(FileFd&, unsigned long long, bool, bool, bool, bool)@APTPKG_6.0" 0.8.16~exp9
-# (c++|optional=inline)"pkgRecords::Parser::MD5Hash()@APTPKG_6.0" 0.8.0
-# (c++|optional=inline)"pkgRecords::Parser::SHA1Hash()@APTPKG_6.0" 0.8.0
-# (c++|optional=inline)"pkgRecords::Parser::SHA256Hash()@APTPKG_6.0" 0.8.0
-# (c++|optional=inline)"pkgRecords::Parser::SHA512Hash()@APTPKG_6.0" 0.8.16~exp6
- (c++)"Hashes::AddFD(FileFd&, unsigned long long, unsigned int)@APTPKG_6.0" 1.1~exp1
- (c++)"Hashes::AddFD(int, unsigned long long, unsigned int)@APTPKG_6.0" 1.1~exp1
- (c++)"Hashes::Add(unsigned char const*, unsigned long long, unsigned int)@APTPKG_6.0" 1.1~exp1
(c++)"Hashes::GetHashStringList()@APTPKG_6.0" 1.1~exp1
(c++)"Hashes::Hashes()@APTPKG_6.0" 1.1~exp1
(c++)"Hashes::~Hashes()@APTPKG_6.0" 1.1~exp1
@@ -1011,7 +1001,6 @@ libapt-pkg.so.6.0 libapt-pkg6.0 #MINVER#
(c++)"_strrstrip(char*)@APTPKG_6.0" 0.9.7.9~exp2
(c++)"SplitClearSignedFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, FileFd*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, FileFd*)@APTPKG_6.0" 0.9.7.9~exp2
(c++)"OpenMaybeClearSignedFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, FileFd&)@APTPKG_6.0" 0.9.7.9~exp2
- (c++)"SigVerify::RunGPGV(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int const&)@APTPKG_6.0" 0.9.7.9~exp2
(c++)"Configuration::Dump(std::basic_ostream<char, std::char_traits<char> >&, char const*, char const*, bool)@APTPKG_6.0" 0.9.3
(c++)"AcquireUpdate(pkgAcquire&, int, bool, bool)@APTPKG_6.0" 0.9.3
(c++)"APT::CacheFilter::PackageArchitectureMatchesSpecification::PackageArchitectureMatchesSpecification(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)@APTPKG_6.0" 0.9.7