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/deb/debindexfile.cc | 12 ++++++------ apt-pkg/deb/debindexfile.h | 12 ++++++------ apt-pkg/deb/deblistparser.cc | 2 +- apt-pkg/deb/deblistparser.h | 2 +- apt-pkg/deb/debmetaindex.cc | 6 +++--- apt-pkg/deb/debmetaindex.h | 4 ++-- apt-pkg/deb/debrecords.cc | 6 +++--- apt-pkg/deb/debrecords.h | 6 +++--- apt-pkg/deb/debsrcrecords.cc | 2 +- apt-pkg/deb/debsrcrecords.h | 2 +- apt-pkg/deb/debsystem.cc | 5 +---- apt-pkg/deb/debsystem.h | 2 +- apt-pkg/deb/dpkgpm.cc | 5 ++--- apt-pkg/deb/dpkgpm.h | 2 +- 14 files changed, 32 insertions(+), 36 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 0fffa52b0..29a9a941c 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -45,7 +45,7 @@ using std::string; // --------------------------------------------------------------------- /* */ debSourcesIndex::debSourcesIndex(IndexTarget const &Target,bool const Trusted) : - pkgIndexTargetFile(Target, Trusted) + pkgIndexTargetFile(Target, Trusted), d(NULL) { } /*}}}*/ @@ -84,7 +84,7 @@ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const // --------------------------------------------------------------------- /* */ debPackagesIndex::debPackagesIndex(IndexTarget const &Target, bool const Trusted) : - pkgIndexTargetFile(Target, Trusted) + pkgIndexTargetFile(Target, Trusted), d(NULL) { } /*}}}*/ @@ -179,7 +179,7 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const // TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/ debTranslationsIndex::debTranslationsIndex(IndexTarget const &Target) : - pkgIndexTargetFile(Target, true) + pkgIndexTargetFile(Target, true), d(NULL) {} /*}}}*/ bool debTranslationsIndex::HasPackages() const /*{{{*/ @@ -255,7 +255,7 @@ pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) con // StatusIndex::debStatusIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File) +debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), d(NULL), File(File) { } /*}}}*/ @@ -341,7 +341,7 @@ APT_CONST bool debStatusIndex::Exists() const // debDebPkgFile - Single .deb file /*{{{*/ debDebPkgFileIndex::debDebPkgFileIndex(std::string DebFile) - : pkgIndexFile(true), DebFile(DebFile) + : pkgIndexFile(true), d(NULL), DebFile(DebFile) { DebFileFullPath = flAbsPath(DebFile); } @@ -445,7 +445,7 @@ unsigned long debDebPkgFileIndex::Size() const // debDscFileIndex stuff debDscFileIndex::debDscFileIndex(std::string &DscFile) - : pkgIndexFile(true), DscFile(DscFile) + : pkgIndexFile(true), d(NULL), DscFile(DscFile) { } diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 6285a9e5c..1de609a7b 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -29,7 +29,7 @@ class pkgCacheGenerator; class APT_HIDDEN debStatusIndex : public pkgIndexFile { - void *d; + void * const d; protected: std::string File; @@ -53,7 +53,7 @@ class APT_HIDDEN debStatusIndex : public pkgIndexFile class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile { - void *d; + void * const d; public: virtual const Type *GetType() const APT_CONST; @@ -72,7 +72,7 @@ class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile { - void *d; + void * const d; public: virtual const Type *GetType() const APT_CONST; @@ -88,7 +88,7 @@ class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile { - void *d; + void * const d; public: virtual const Type *GetType() const APT_CONST; @@ -110,7 +110,7 @@ class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile { private: - void *d; + void * const d; std::string DebFile; std::string DebFileFullPath; @@ -148,7 +148,7 @@ class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile class APT_HIDDEN debDscFileIndex : public pkgIndexFile { private: - void *d; + void * const d; std::string DscFile; public: virtual const Type *GetType() const APT_CONST; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index c5e77b0ff..4e49e1c78 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -50,7 +50,7 @@ static debListParser::WordList PrioList[] = { /* Provide an architecture and only this one and "all" will be accepted in Step(), if no Architecture is given we will accept every arch we would accept in general with checkArchitecture() */ -debListParser::debListParser(FileFd *File, string const &Arch) : Tags(File), +debListParser::debListParser(FileFd *File, string const &Arch) : d(NULL), Tags(File), Arch(Arch) { if (Arch == "native") this->Arch = _config->Find("APT::Architecture"); diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 420d5ff08..3fd040bdd 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -39,7 +39,7 @@ class APT_HIDDEN debListParser : public pkgCacheGenerator::ListParser private: /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; protected: pkgTagFile Tags; diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 430a5021b..026af077f 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -86,11 +86,11 @@ std::string debReleaseIndex::LocalFileName() const } debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) : - metaIndex(URI, Dist, "deb"), Trusted(CHECK_TRUST) + metaIndex(URI, Dist, "deb"), d(NULL), Trusted(CHECK_TRUST) {} debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist, bool const Trusted) : - metaIndex(URI, Dist, "deb") { + metaIndex(URI, Dist, "deb"), d(NULL) { SetTrusted(Trusted); } @@ -541,7 +541,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type }; debDebFileMetaIndex::debDebFileMetaIndex(std::string const &DebFile) - : metaIndex(DebFile, "local-uri", "deb-dist"), DebFile(DebFile) + : metaIndex(DebFile, "local-uri", "deb-dist"), d(NULL), DebFile(DebFile) { DebIndex = new debDebPkgFileIndex(DebFile); Indexes = new vector(); diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index f2706e08a..648c22436 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -36,7 +36,7 @@ class APT_HIDDEN debReleaseIndex : public metaIndex { private: /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; std::map > ArchEntries; enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted; @@ -75,7 +75,7 @@ class APT_HIDDEN debReleaseIndex : public metaIndex { class APT_HIDDEN debDebFileMetaIndex : public metaIndex { private: - void *d; + void * const d; std::string DebFile; debDebPkgFileIndex *DebIndex; public: diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index f527042e4..326102d08 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -34,7 +34,7 @@ using std::string; // RecordParser::debRecordParser - Constructor /*{{{*/ debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : - debRecordParserBase(), File(FileName, FileFd::ReadOnly, FileFd::Extension), + debRecordParserBase(), d(NULL), File(FileName, FileFd::ReadOnly, FileFd::Extension), Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200) { } @@ -51,7 +51,7 @@ bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc) /*}}}*/ debRecordParser::~debRecordParser() {} -debRecordParserBase::debRecordParserBase() : Parser() {} +debRecordParserBase::debRecordParserBase() : Parser(), d(NULL) {} // RecordParserBase::FileName - Return the archive filename on the site /*{{{*/ string debRecordParserBase::FileName() { @@ -212,5 +212,5 @@ bool debDebFileRecordParser::Jump(pkgCache::VerFileIterator const &) { return Lo bool debDebFileRecordParser::Jump(pkgCache::DescFileIterator const &) { return LoadContent(); } std::string debDebFileRecordParser::FileName() { return debFileName; } -debDebFileRecordParser::debDebFileRecordParser(std::string FileName) : debRecordParserBase(), debFileName(FileName) {} +debDebFileRecordParser::debDebFileRecordParser(std::string FileName) : debRecordParserBase(), d(NULL), debFileName(FileName) {} debDebFileRecordParser::~debDebFileRecordParser() {} diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 8efcec8cd..4d0b713d4 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -27,7 +27,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser { - void *d; + void * const d; protected: pkgTagSection Section; @@ -57,7 +57,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser class APT_HIDDEN debRecordParser : public debRecordParserBase { - void *d; + void * const d; protected: FileFd File; pkgTagFile Tags; @@ -73,7 +73,7 @@ class APT_HIDDEN debRecordParser : public debRecordParserBase // custom record parser that reads deb files directly class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase { - void *d; + void * const d; std::string debFileName; std::string controlContent; diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 21a4ff8ea..9404b6421 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -33,7 +33,7 @@ using std::max; using std::string; debSrcRecordParser::debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) - : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400), + : Parser(Index), d(NULL), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400), iOffset(0), Buffer(NULL) {} // SrcRecordParser::Binaries - Return the binaries field /*{{{*/ diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index 7aeb2db88..64b07a1ec 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -24,7 +24,7 @@ class pkgIndexFile; class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; protected: FileFd Fd; diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index 9a5da9da1..465e13b9e 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -53,11 +53,8 @@ public: // System::debSystem - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debSystem::debSystem() +debSystem::debSystem() : pkgSystem("Debian dpkg interface", &debVS), d(new debSystemPrivate()) { - d = new debSystemPrivate(); - Label = "Debian dpkg interface"; - VS = &debVS; } /*}}}*/ // System::~debSystem - Destructor /*{{{*/ diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h index 226cd60bf..e59bbebed 100644 --- a/apt-pkg/deb/debsystem.h +++ b/apt-pkg/deb/debsystem.h @@ -28,7 +28,7 @@ class debStatusIndex; class debSystem : public pkgSystem { // private d-pointer - debSystemPrivate *d; + debSystemPrivate * const d; APT_HIDDEN bool CheckUpdates(); public: diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 6ee939edd..1991a4a66 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -216,10 +216,9 @@ pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg) // DPkgPM::pkgDPkgPM - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) - : pkgPackageManager(Cache), pkgFailures(0), PackagesDone(0), PackagesTotal(0) +pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) + : pkgPackageManager(Cache),d(new pkgDPkgPMPrivate()), pkgFailures(0), PackagesDone(0), PackagesTotal(0) { - d = new pkgDPkgPMPrivate(); } /*}}}*/ // DPkgPM::pkgDPkgPM - Destructor /*{{{*/ diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 2a6e7e004..a1b36c6c0 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -37,7 +37,7 @@ class pkgDPkgPMPrivate; class pkgDPkgPM : public pkgPackageManager { private: - pkgDPkgPMPrivate *d; + pkgDPkgPMPrivate * const d; /** \brief record the disappear action and handle accordingly -- cgit v1.2.3