From 02e20767719873fa8f1919bd0e7a75f63e00c484 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 7 Nov 2014 17:49:36 +0100 Subject: guard const-ification API changes Git-Dch: Ignore --- apt-pkg/acquire-item.cc | 28 ++++++++++++++++++++++++++++ apt-pkg/acquire-item.h | 41 ++++++++++++++++++++++++++++++++++++++++- apt-pkg/contrib/hashes.h | 2 ++ apt-pkg/pkgrecords.h | 7 +++++++ apt-pkg/tagfile.cc | 4 ++++ apt-pkg/tagfile.h | 4 ++++ 6 files changed, 85 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 2df638a83..dd85fda79 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -373,7 +373,11 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, // AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- /* The only header we use is the last-modified header. */ +#if APT_PKG_ABI >= 413 string pkgAcqDiffIndex::Custom600Headers() const +#else +string pkgAcqDiffIndex::Custom600Headers() +#endif { string Final = _config->FindDir("Dir::State::lists"); Final += URItoFileName(Desc.URI); @@ -1239,7 +1243,11 @@ void pkgAcqIndex::InitByHashIfNeeded(const std::string MetaKey) // AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- /* The only header we use is the last-modified header. */ +#if APT_PKG_ABI >= 413 string pkgAcqIndex::Custom600Headers() const +#else +string pkgAcqIndex::Custom600Headers() +#endif { string Final = GetFinalFilename(); @@ -1638,7 +1646,11 @@ pkgAcqMetaSig::~pkgAcqMetaSig() /*{{{*/ /*}}}*/ // pkgAcqMetaSig::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- +#if APT_PKG_ABI >= 413 string pkgAcqMetaSig::Custom600Headers() const +#else +string pkgAcqMetaSig::Custom600Headers() +#endif { std::string Header = GetCustom600Headers(RealURI); return Header; @@ -1783,7 +1795,11 @@ void pkgAcqMetaIndex::Init(std::string URIDesc, std::string ShortDesc) /*}}}*/ // pkgAcqMetaIndex::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- +#if APT_PKG_ABI >= 413 string pkgAcqMetaIndex::Custom600Headers() const +#else +string pkgAcqMetaIndex::Custom600Headers() +#endif { return GetCustom600Headers(RealURI); } @@ -2107,7 +2123,11 @@ pkgAcqMetaClearSig::~pkgAcqMetaClearSig() /*{{{*/ /*}}}*/ // pkgAcqMetaClearSig::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- +#if APT_PKG_ABI >= 413 string pkgAcqMetaClearSig::Custom600Headers() const +#else +string pkgAcqMetaClearSig::Custom600Headers() +#endif { string Header = GetCustom600Headers(RealURI); Header += "\nFail-Ignore: true"; @@ -2499,7 +2519,11 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*}}}*/ // AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source /*{{{*/ // --------------------------------------------------------------------- +#if APT_PKG_ABI >= 413 APT_PURE bool pkgAcqArchive::IsTrusted() const +#else +APT_PURE bool pkgAcqArchive::IsTrusted() +#endif { return Trusted; } @@ -2644,7 +2668,11 @@ void pkgAcqFile::Failed(string Message,pkgAcquire::MethodConfig *Cnf) // AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ // --------------------------------------------------------------------- /* The only header we use is the last-modified header. */ +#if APT_PKG_ABI >= 413 string pkgAcqFile::Custom600Headers() const +#else +string pkgAcqFile::Custom600Headers() +#endif { if (IsIndexFile) return "\nIndex-File: true"; diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 6fcb42c3a..1af737e00 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -254,7 +254,11 @@ class pkgAcquire::Item : public WeakPointable * line, so they should (if nonempty) have a leading newline and * no trailing newline. */ +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const {return std::string();}; +#else + virtual std::string Custom600Headers() {return std::string();}; +#endif /** \brief A "descriptive" URI-like string. * @@ -280,9 +284,16 @@ class pkgAcquire::Item : public WeakPointable /** \return the acquire process with which this item is associated. */ pkgAcquire *GetOwner() const {return Owner;}; +#if APT_PKG_ABI < 413 + pkgAcquire *GetOwner() {return Owner;}; +#endif /** \return \b true if this object is being fetched from a trusted source. */ +#if APT_PKG_ABI >= 413 virtual bool IsTrusted() const {return false;}; +#else + virtual bool IsTrusted() {return false;}; +#endif /** \brief Report mirror problem * @@ -497,7 +508,11 @@ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqMetaBase virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes, pkgAcquire::MethodConfig *Cnf); +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif virtual std::string DescURI() {return RealURI; }; /** \brief Create a new pkgAcqMetaSig. */ @@ -551,7 +566,11 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf); virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes, pkgAcquire::MethodConfig *Cnf); +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif virtual std::string DescURI() {return RealURI; }; virtual void Finished(); @@ -589,7 +608,11 @@ class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex public: virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf); +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes, pkgAcquire::MethodConfig *Cnf); @@ -675,7 +698,11 @@ class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes, pkgAcquire::MethodConfig *Cnf); virtual std::string DescURI() {return RealURI + "Index";}; +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif /** \brief Parse the Index file for a set of Packages diffs. * @@ -989,7 +1016,11 @@ class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes, pkgAcquire::MethodConfig *Cnf); +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif virtual std::string DescURI() {return Desc.URI;}; /** \brief Create a pkgAcqIndex. @@ -1111,8 +1142,12 @@ class pkgAcqArchive : public pkgAcquire::Item virtual std::string DescURI() {return Desc.URI;}; virtual std::string ShortDesc() {return Desc.ShortDesc;}; virtual void Finished(); +#if APT_PKG_ABI >= 413 virtual bool IsTrusted() const; - +#else + virtual bool IsTrusted(); +#endif + /** \brief Create a new pkgAcqArchive. * * \param Owner The pkgAcquire object with which this item is @@ -1161,7 +1196,11 @@ class pkgAcqFile : public pkgAcquire::Item virtual void Done(std::string Message,unsigned long long Size, HashStringList const &CalcHashes, pkgAcquire::MethodConfig *Cnf); virtual std::string DescURI() {return Desc.URI;}; +#if APT_PKG_ABI >= 413 virtual std::string Custom600Headers() const; +#else + virtual std::string Custom600Headers(); +#endif /** \brief Create a new pkgAcqFile object. * diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index ca186d704..154862457 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -55,6 +55,8 @@ class HashString // get hash type used std::string HashType() const { return Type; }; std::string HashValue() const { return Hash; }; + APT_DEPRECATED std::string HashType() { return Type; }; + APT_DEPRECATED std::string HashValue() { return Hash; }; // verify the given filename against the currently loaded hash bool VerifyFile(std::string filename) const; diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index a902da8b8..bcc05baba 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -68,10 +68,17 @@ class pkgRecords::Parser /*{{{*/ * choose the hash to be used. */ virtual HashStringList Hashes() const { return HashStringList(); }; +#if APT_PKG_ABI >= 413 APT_DEPRECATED std::string MD5Hash() const { return GetHashFromHashes("MD5Sum"); }; APT_DEPRECATED std::string SHA1Hash() const { return GetHashFromHashes("SHA1"); }; APT_DEPRECATED std::string SHA256Hash() const { return GetHashFromHashes("SHA256"); }; APT_DEPRECATED std::string SHA512Hash() const { return GetHashFromHashes("SHA512"); }; +#else + APT_DEPRECATED std::string MD5Hash() { return GetHashFromHashes("MD5Sum"); }; + APT_DEPRECATED std::string SHA1Hash() { return GetHashFromHashes("SHA1"); }; + APT_DEPRECATED std::string SHA256Hash() { return GetHashFromHashes("SHA256"); }; + APT_DEPRECATED std::string SHA512Hash() { return GetHashFromHashes("SHA512"); }; +#endif // These are some general stats about the package virtual std::string Maintainer() {return std::string();}; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index b263baf66..e667c495f 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -408,7 +408,11 @@ void pkgTagSection::Trim() } /*}}}*/ // TagSection::Exists - return True if a tag exists /*{{{*/ +#if APT_PKG_ABI >= 413 bool pkgTagSection::Exists(const char* const Tag) const +#else +bool pkgTagSection::Exists(const char* const Tag) +#endif { unsigned int tmp; return Find(Tag, tmp); diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 4cd99b2fc..99e2a8d93 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -97,7 +97,11 @@ class pkgTagSection * times, but only the last occurrence is available via Find methods. */ unsigned int Count() const; +#if APT_PKG_ABI >= 413 bool Exists(const char* const Tag) const; +#else + bool Exists(const char* const Tag); +#endif inline void Get(const char *&Start,const char *&Stop,unsigned int I) const {Start = Section + Tags[I].StartTag; Stop = Section + Tags[I+1].StartTag;} -- cgit v1.2.3