From c8a4ce6cbed57ae108dc955d4a850f9b129a0693 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 16 Jun 2015 16:22:46 +0200 Subject: add d-pointer, virtual destructors and de-inline de/constructors To have a chance to keep the ABI for a while we need all three to team up. One of them missing and we might loose, so ensuring that they are available is a very tedious but needed task once in a while. Git-Dch: Ignore --- apt-pkg/indexcopy.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'apt-pkg/indexcopy.h') diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 729b0c8cb..7ee162542 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: indexcopy.h,v 1.3 2001/05/27 04:46:54 jgg Exp $ /* ###################################################################### Index Copying - Aid for copying and verifying the index files @@ -54,39 +53,52 @@ class IndexCopy /*{{{*/ bool CopyPackages(std::string CDROM,std::string Name,std::vector &List, pkgCdromStatus *log); + IndexCopy(); virtual ~IndexCopy(); }; /*}}}*/ class PackageCopy : public IndexCopy /*{{{*/ { + void *d; protected: - + virtual bool GetFile(std::string &Filename,unsigned long long &Size); virtual bool RewriteEntry(FileFd &Target, std::string const &File); virtual const char *GetFileName() {return "Packages";}; virtual const char *Type() {return "Package";}; - + + public: + PackageCopy(); + virtual ~PackageCopy(); }; /*}}}*/ class SourceCopy : public IndexCopy /*{{{*/ { + void *d; protected: virtual bool GetFile(std::string &Filename,unsigned long long &Size); virtual bool RewriteEntry(FileFd &Target, std::string const &File); virtual const char *GetFileName() {return "Sources";}; virtual const char *Type() {return "Source";}; - + + public: + SourceCopy(); + virtual ~SourceCopy(); }; /*}}}*/ class TranslationsCopy /*{{{*/ { + void *d; protected: pkgTagSection *Section; public: bool CopyTranslations(std::string CDROM,std::string Name,std::vector &List, pkgCdromStatus *log); + + TranslationsCopy(); + virtual ~TranslationsCopy(); }; /*}}}*/ class SigVerify /*{{{*/ @@ -106,6 +118,9 @@ class SigVerify /*{{{*/ int const &statusfd, int fd[2]); APT_DEPRECATED static bool RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd = -1); + + SigVerify(); + virtual ~SigVerify(); }; /*}}}*/ -- cgit v1.2.3 From 6c55f07a5fa3612a5d59c61a17da5fe640eadc8b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Jun 2015 09:29:00 +0200 Subject: make all d-pointer * const pointers Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore --- apt-pkg/indexcopy.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg/indexcopy.h') diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 7ee162542..4f4c47169 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -32,7 +32,7 @@ class FileFd; class IndexCopy /*{{{*/ { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; protected: @@ -59,7 +59,7 @@ class IndexCopy /*{{{*/ /*}}}*/ class PackageCopy : public IndexCopy /*{{{*/ { - void *d; + void * const d; protected: virtual bool GetFile(std::string &Filename,unsigned long long &Size); @@ -74,7 +74,7 @@ class PackageCopy : public IndexCopy /*{{{*/ /*}}}*/ class SourceCopy : public IndexCopy /*{{{*/ { - void *d; + void * const d; protected: virtual bool GetFile(std::string &Filename,unsigned long long &Size); @@ -89,7 +89,7 @@ class SourceCopy : public IndexCopy /*{{{*/ /*}}}*/ class TranslationsCopy /*{{{*/ { - void *d; + void * const d; protected: pkgTagSection *Section; @@ -104,7 +104,7 @@ class TranslationsCopy /*{{{*/ class SigVerify /*{{{*/ { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records); APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName, -- cgit v1.2.3 From 5ad0096a4e19e191b59634e8a8817995ec4045ad Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 23 Jun 2015 15:16:08 +0200 Subject: merge indexRecords into metaIndex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit indexRecords was used to parse the Release file – mostly the hashes – while metaIndex deals with downloading the Release file, storing all indexes coming from this release and … parsing the Release file, but this time mostly for the other fields. That wasn't a problem in metaIndex as this was done in the type specific subclass, but indexRecords while allowing to override the parsing method did expect by default a specific format. APT isn't really supporting different types at the moment, but this is a violation of the abstraction we have everywhere else and, which is the actual reason for this merge: Options e.g. coming from the sources.list come to metaIndex naturally, which needs to wrap them up and bring them into indexRecords, so the acquire system is told about it as they don't get to see the metaIndex, but they don't really belong in indexRecords as this is just for storing data loaded from the Release file… the result is a complete mess. I am not saying it is a lot prettier after the merge, but at least adding new options is now slightly easier and there is just one place responsible for parsing the Release file. That can't hurt. --- apt-pkg/indexcopy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/indexcopy.h') diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 4f4c47169..6eecad028 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -25,9 +25,9 @@ using std::vector; #endif class pkgTagSection; -class indexRecords; class pkgCdromStatus; class FileFd; +class metaIndex; class IndexCopy /*{{{*/ { @@ -106,7 +106,7 @@ class SigVerify /*{{{*/ /** \brief dpointer placeholder (for later in case we need it) */ void * const d; - APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records); + APT_HIDDEN bool Verify(std::string prefix,std::string file, metaIndex *records); APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName, std::string prefix, std::string file); -- cgit v1.2.3 From 3b3028467ceccca0b73a8f53051c0fa4de313111 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 9 Jul 2015 00:35:40 +0200 Subject: add c++11 override marker to overridden methods C++11 adds the 'override' specifier to mark that a method is overriding a base class method and error out if not. We hide it in the APT_OVERRIDE macro to ensure that we keep compiling in pre-c++11 standards. Reported-By: clang-modernize -add-override -override-macros Git-Dch: Ignore --- apt-pkg/indexcopy.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'apt-pkg/indexcopy.h') diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 6eecad028..316672e1d 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -62,10 +62,10 @@ class PackageCopy : public IndexCopy /*{{{*/ void * const d; protected: - virtual bool GetFile(std::string &Filename,unsigned long long &Size); - virtual bool RewriteEntry(FileFd &Target, std::string const &File); - virtual const char *GetFileName() {return "Packages";}; - virtual const char *Type() {return "Package";}; + virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE; + virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE; + virtual const char *GetFileName() APT_OVERRIDE {return "Packages";}; + virtual const char *Type() APT_OVERRIDE {return "Package";}; public: PackageCopy(); @@ -77,10 +77,10 @@ class SourceCopy : public IndexCopy /*{{{*/ void * const d; protected: - virtual bool GetFile(std::string &Filename,unsigned long long &Size); - virtual bool RewriteEntry(FileFd &Target, std::string const &File); - virtual const char *GetFileName() {return "Sources";}; - virtual const char *Type() {return "Source";}; + virtual bool GetFile(std::string &Filename,unsigned long long &Size) APT_OVERRIDE; + virtual bool RewriteEntry(FileFd &Target, std::string const &File) APT_OVERRIDE; + virtual const char *GetFileName() APT_OVERRIDE {return "Sources";}; + virtual const char *Type() APT_OVERRIDE {return "Source";}; public: SourceCopy(); -- cgit v1.2.3 From 88a8975f156e452d9f3ebe76822b236e8962ebba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 17 Aug 2015 12:01:45 +0200 Subject: Cleanup includes after running iwyu --- apt-pkg/indexcopy.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/indexcopy.h') diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index 316672e1d..d4f04b5b1 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -10,8 +10,10 @@ #define INDEXCOPY_H #include +#ifndef APT_11_CLEAN_HEADERS #include #include +#endif #include -- cgit v1.2.3