Преглед изворни кода

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
David Kalnischkies пре 11 година
родитељ
комит
6c55f07a5f
72 измењених фајлова са 244 додато и 234 уклоњено
  1. 13 13
      apt-pkg/acquire-item.cc
  2. 14 14
      apt-pkg/acquire-item.h
  3. 2 2
      apt-pkg/acquire-method.cc
  4. 2 2
      apt-pkg/acquire-method.h
  5. 4 9
      apt-pkg/acquire-worker.cc
  6. 1 1
      apt-pkg/acquire-worker.h
  7. 2 2
      apt-pkg/acquire.cc
  8. 5 5
      apt-pkg/acquire.h
  9. 1 1
      apt-pkg/algorithms.cc
  10. 2 2
      apt-pkg/algorithms.h
  11. 1 1
      apt-pkg/cachefile.h
  12. 14 5
      apt-pkg/cacheset.cc
  13. 6 4
      apt-pkg/cacheset.h
  14. 3 3
      apt-pkg/cdrom.cc
  15. 3 3
      apt-pkg/cdrom.h
  16. 1 1
      apt-pkg/clean.cc
  17. 1 1
      apt-pkg/clean.h
  18. 19 0
      apt-pkg/contrib/fileutl.cc
  19. 8 19
      apt-pkg/contrib/fileutl.h
  20. 15 14
      apt-pkg/contrib/hashes.cc
  21. 1 1
      apt-pkg/contrib/hashes.h
  22. 6 6
      apt-pkg/deb/debindexfile.cc
  23. 6 6
      apt-pkg/deb/debindexfile.h
  24. 1 1
      apt-pkg/deb/deblistparser.cc
  25. 1 1
      apt-pkg/deb/deblistparser.h
  26. 3 3
      apt-pkg/deb/debmetaindex.cc
  27. 2 2
      apt-pkg/deb/debmetaindex.h
  28. 3 3
      apt-pkg/deb/debrecords.cc
  29. 3 3
      apt-pkg/deb/debrecords.h
  30. 1 1
      apt-pkg/deb/debsrcrecords.cc
  31. 1 1
      apt-pkg/deb/debsrcrecords.h
  32. 1 4
      apt-pkg/deb/debsystem.cc
  33. 1 1
      apt-pkg/deb/debsystem.h
  34. 2 3
      apt-pkg/deb/dpkgpm.cc
  35. 1 1
      apt-pkg/deb/dpkgpm.h
  36. 2 2
      apt-pkg/depcache.cc
  37. 2 2
      apt-pkg/depcache.h
  38. 1 1
      apt-pkg/edsp/edspindexfile.cc
  39. 1 1
      apt-pkg/edsp/edspindexfile.h
  40. 1 1
      apt-pkg/edsp/edsplistparser.cc
  41. 1 1
      apt-pkg/edsp/edsplistparser.h
  42. 2 6
      apt-pkg/edsp/edspsystem.cc
  43. 1 1
      apt-pkg/edsp/edspsystem.h
  44. 5 5
      apt-pkg/indexcopy.cc
  45. 5 5
      apt-pkg/indexcopy.h
  46. 2 2
      apt-pkg/indexfile.cc
  47. 2 2
      apt-pkg/indexfile.h
  48. 1 1
      apt-pkg/indexrecords.h
  49. 4 4
      apt-pkg/install-progress.cc
  50. 5 5
      apt-pkg/install-progress.h
  51. 1 1
      apt-pkg/metaindex.cc
  52. 1 1
      apt-pkg/metaindex.h
  53. 1 1
      apt-pkg/orderlist.cc
  54. 1 1
      apt-pkg/orderlist.h
  55. 1 1
      apt-pkg/packagemanager.cc
  56. 1 1
      apt-pkg/packagemanager.h
  57. 1 1
      apt-pkg/pkgcache.cc
  58. 1 1
      apt-pkg/pkgcache.h
  59. 2 2
      apt-pkg/pkgcachegen.cc
  60. 2 2
      apt-pkg/pkgcachegen.h
  61. 1 1
      apt-pkg/pkgrecords.cc
  62. 2 2
      apt-pkg/pkgrecords.h
  63. 2 1
      apt-pkg/pkgsystem.cc
  64. 5 5
      apt-pkg/pkgsystem.h
  65. 1 1
      apt-pkg/policy.cc
  66. 2 2
      apt-pkg/policy.h
  67. 2 2
      apt-pkg/sourcelist.cc
  68. 1 1
      apt-pkg/sourcelist.h
  69. 1 1
      apt-pkg/srcrecords.cc
  70. 2 2
      apt-pkg/srcrecords.h
  71. 24 22
      apt-pkg/tagfile.cc
  72. 4 4
      apt-pkg/tagfile.h

+ 13 - 13
apt-pkg/acquire-item.cc

@@ -406,7 +406,7 @@ class APT_HIDDEN NoActionItem : public pkgAcquire::Item			/*{{{*/
 APT_IGNORE_DEPRECATED_PUSH
 APT_IGNORE_DEPRECATED_PUSH
 pkgAcquire::Item::Item(pkgAcquire * const owner) :
 pkgAcquire::Item::Item(pkgAcquire * const owner) :
    FileSize(0), PartialSize(0), Mode(0), ID(0), Complete(false), Local(false),
    FileSize(0), PartialSize(0), Mode(0), ID(0), Complete(false), Local(false),
-    QueueCounter(0), ExpectedAdditionalItems(0), Owner(owner)
+    QueueCounter(0), ExpectedAdditionalItems(0), Owner(owner), d(NULL)
 {
 {
    Owner->Add(this);
    Owner->Add(this);
    Status = StatIdle;
    Status = StatIdle;
@@ -662,7 +662,7 @@ std::string pkgAcquire::Item::HashSum() const				/*{{{*/
 
 
 pkgAcqTransactionItem::pkgAcqTransactionItem(pkgAcquire * const Owner,	/*{{{*/
 pkgAcqTransactionItem::pkgAcqTransactionItem(pkgAcquire * const Owner,	/*{{{*/
       pkgAcqMetaBase * const transactionManager, IndexTarget const &target) :
       pkgAcqMetaBase * const transactionManager, IndexTarget const &target) :
-   pkgAcquire::Item(Owner), Target(target), TransactionManager(transactionManager)
+   pkgAcquire::Item(Owner), d(NULL), Target(target), TransactionManager(transactionManager)
 {
 {
    if (TransactionManager != this)
    if (TransactionManager != this)
       TransactionManager->Add(this);
       TransactionManager->Add(this);
@@ -684,7 +684,7 @@ pkgAcqMetaBase::pkgAcqMetaBase(pkgAcquire * const Owner,
       std::vector<IndexTarget> const &IndexTargets,
       std::vector<IndexTarget> const &IndexTargets,
       IndexTarget const &DataTarget,
       IndexTarget const &DataTarget,
       indexRecords * const MetaIndexParser)
       indexRecords * const MetaIndexParser)
-: pkgAcqTransactionItem(Owner, TransactionManager, DataTarget),
+: pkgAcqTransactionItem(Owner, TransactionManager, DataTarget), d(NULL),
    MetaIndexParser(MetaIndexParser), LastMetaIndexParser(NULL), IndexTargets(IndexTargets),
    MetaIndexParser(MetaIndexParser), LastMetaIndexParser(NULL), IndexTargets(IndexTargets),
    AuthPass(false), IMSHit(false)
    AuthPass(false), IMSHit(false)
 {
 {
@@ -1106,7 +1106,7 @@ pkgAcqMetaClearSig::pkgAcqMetaClearSig(pkgAcquire * const Owner,	/*{{{*/
       std::vector<IndexTarget> const &IndexTargets,
       std::vector<IndexTarget> const &IndexTargets,
       indexRecords * const MetaIndexParser) :
       indexRecords * const MetaIndexParser) :
    pkgAcqMetaIndex(Owner, this, ClearsignedTarget, DetachedSigTarget, IndexTargets, MetaIndexParser),
    pkgAcqMetaIndex(Owner, this, ClearsignedTarget, DetachedSigTarget, IndexTargets, MetaIndexParser),
-   ClearsignedTarget(ClearsignedTarget),
+   d(NULL), ClearsignedTarget(ClearsignedTarget),
    DetachedDataTarget(DetachedDataTarget)
    DetachedDataTarget(DetachedDataTarget)
 {
 {
    // index targets + (worst case:) Release/Release.gpg
    // index targets + (worst case:) Release/Release.gpg
@@ -1245,7 +1245,7 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire * const Owner,		/*{{{*/
 				 IndexTarget const &DetachedSigTarget,
 				 IndexTarget const &DetachedSigTarget,
 				 vector<IndexTarget> const &IndexTargets,
 				 vector<IndexTarget> const &IndexTargets,
 				 indexRecords * const MetaIndexParser) :
 				 indexRecords * const MetaIndexParser) :
-   pkgAcqMetaBase(Owner, TransactionManager, IndexTargets, DataTarget, MetaIndexParser),
+   pkgAcqMetaBase(Owner, TransactionManager, IndexTargets, DataTarget, MetaIndexParser), d(NULL),
    DetachedSigTarget(DetachedSigTarget)
    DetachedSigTarget(DetachedSigTarget)
 {
 {
    if(_config->FindB("Debug::Acquire::Transaction", false) == true)
    if(_config->FindB("Debug::Acquire::Transaction", false) == true)
@@ -1327,7 +1327,7 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire * const Owner,
       pkgAcqMetaBase * const TransactionManager,
       pkgAcqMetaBase * const TransactionManager,
       IndexTarget const &Target,
       IndexTarget const &Target,
       pkgAcqMetaIndex * const MetaIndex) :
       pkgAcqMetaIndex * const MetaIndex) :
-   pkgAcqTransactionItem(Owner, TransactionManager, Target), MetaIndex(MetaIndex)
+   pkgAcqTransactionItem(Owner, TransactionManager, Target), d(NULL), MetaIndex(MetaIndex)
 {
 {
    DestFile = GetPartialFileNameFromURI(Target.URI);
    DestFile = GetPartialFileNameFromURI(Target.URI);
 
 
@@ -1489,7 +1489,7 @@ void pkgAcqMetaSig::Failed(string const &Message,pkgAcquire::MethodConfig const
 pkgAcqBaseIndex::pkgAcqBaseIndex(pkgAcquire * const Owner,
 pkgAcqBaseIndex::pkgAcqBaseIndex(pkgAcquire * const Owner,
       pkgAcqMetaBase * const TransactionManager,
       pkgAcqMetaBase * const TransactionManager,
       IndexTarget const &Target)
       IndexTarget const &Target)
-: pkgAcqTransactionItem(Owner, TransactionManager, Target)
+: pkgAcqTransactionItem(Owner, TransactionManager, Target), d(NULL)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -1505,7 +1505,7 @@ pkgAcqBaseIndex::~pkgAcqBaseIndex() {}
 pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire * const Owner,
 pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire * const Owner,
                                  pkgAcqMetaBase * const TransactionManager,
                                  pkgAcqMetaBase * const TransactionManager,
                                  IndexTarget const &Target)
                                  IndexTarget const &Target)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target)
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL)
 {
 {
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
 
 
@@ -1907,7 +1907,7 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire * const Owner,
                                    pkgAcqMetaBase * const TransactionManager,
                                    pkgAcqMetaBase * const TransactionManager,
                                    IndexTarget const &Target,
                                    IndexTarget const &Target,
 				   vector<DiffInfo> const &diffs)
 				   vector<DiffInfo> const &diffs)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target),
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
      available_patches(diffs)
      available_patches(diffs)
 {
 {
    DestFile = GetPartialFileNameFromURI(Target.URI);
    DestFile = GetPartialFileNameFromURI(Target.URI);
@@ -2131,7 +2131,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire * const Owner,
                                              IndexTarget const &Target,
                                              IndexTarget const &Target,
                                              DiffInfo const &patch,
                                              DiffInfo const &patch,
                                              std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches)
                                              std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches)
-  : pkgAcqBaseIndex(Owner, TransactionManager, Target),
+  : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
      patch(patch), allPatches(allPatches), State(StateFetchDiff)
      patch(patch), allPatches(allPatches), State(StateFetchDiff)
 {
 {
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
@@ -2274,7 +2274,7 @@ pkgAcqIndexMergeDiffs::~pkgAcqIndexMergeDiffs() {}
 pkgAcqIndex::pkgAcqIndex(pkgAcquire * const Owner,
 pkgAcqIndex::pkgAcqIndex(pkgAcquire * const Owner,
                          pkgAcqMetaBase * const TransactionManager,
                          pkgAcqMetaBase * const TransactionManager,
                          IndexTarget const &Target)
                          IndexTarget const &Target)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target), Stage(STAGE_DOWNLOAD)
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL), Stage(STAGE_DOWNLOAD)
 {
 {
    // autoselect the compression method
    // autoselect the compression method
    AutoSelectCompression();
    AutoSelectCompression();
@@ -2555,7 +2555,7 @@ pkgAcqIndex::~pkgAcqIndex() {}
 pkgAcqArchive::pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
 pkgAcqArchive::pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
 			     pkgRecords * const Recs,pkgCache::VerIterator const &Version,
 			     pkgRecords * const Recs,pkgCache::VerIterator const &Version,
 			     string &StoreFilename) :
 			     string &StoreFilename) :
-               Item(Owner), LocalSource(false), Version(Version), Sources(Sources), Recs(Recs),
+               Item(Owner), d(NULL), LocalSource(false), Version(Version), Sources(Sources), Recs(Recs),
                StoreFilename(StoreFilename), Vf(Version.FileList()),
                StoreFilename(StoreFilename), Vf(Version.FileList()),
 	       Trusted(false)
 	       Trusted(false)
 {
 {
@@ -3048,7 +3048,7 @@ pkgAcqFile::pkgAcqFile(pkgAcquire * const Owner,string const &URI, HashStringLis
 		       unsigned long long const Size,string const &Dsc,string const &ShortDesc,
 		       unsigned long long const Size,string const &Dsc,string const &ShortDesc,
 		       const string &DestDir, const string &DestFilename,
 		       const string &DestDir, const string &DestFilename,
                        bool const IsIndexFile) :
                        bool const IsIndexFile) :
-                       Item(Owner), IsIndexFile(IsIndexFile), ExpectedHashes(Hashes)
+                       Item(Owner), d(NULL), IsIndexFile(IsIndexFile), ExpectedHashes(Hashes)
 {
 {
    Retries = _config->FindI("Acquire::Retries",0);
    Retries = _config->FindI("Acquire::Retries",0);
 
 

+ 14 - 14
apt-pkg/acquire-item.h

@@ -336,7 +336,7 @@ class pkgAcquire::Item : public WeakPointable				/*{{{*/
    virtual std::string GetFinalFilename() const;
    virtual std::string GetFinalFilename() const;
 
 
    private:
    private:
-   void *d;
+   void * const d;
 
 
    friend class pkgAcqMetaBase;
    friend class pkgAcqMetaBase;
 };
 };
@@ -344,7 +344,7 @@ class pkgAcquire::Item : public WeakPointable				/*{{{*/
 class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item		/*{{{*/
 class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item		/*{{{*/
 /** \brief baseclass for the indexes files to manage them all together */
 /** \brief baseclass for the indexes files to manage them all together */
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    IndexTarget const Target;
    IndexTarget const Target;
    HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
    HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
@@ -379,7 +379,7 @@ class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item		/*{{{*/
 class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem		/*{{{*/
 class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem		/*{{{*/
 /** \brief the manager of a transaction */
 /** \brief the manager of a transaction */
 {
 {
-   void *d;
+   void * const d;
  protected:
  protected:
    std::vector<pkgAcqTransactionItem*> Transaction;
    std::vector<pkgAcqTransactionItem*> Transaction;
 
 
@@ -492,7 +492,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem		/*{{{*/
  */
  */
 class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
 class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    IndexTarget const DetachedSigTarget;
    IndexTarget const DetachedSigTarget;
 
 
@@ -527,7 +527,7 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
  */
  */
 class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
 class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
 {
 {
-   void *d;
+   void * const d;
 
 
    pkgAcqMetaIndex * const MetaIndex;
    pkgAcqMetaIndex * const MetaIndex;
 
 
@@ -556,7 +556,7 @@ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
 /** \brief An item repsonsible for downloading clearsigned metaindexes	{{{*/
 /** \brief An item repsonsible for downloading clearsigned metaindexes	{{{*/
 class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex
 class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex
 {
 {
-   void *d;
+   void * const d;
 
 
    IndexTarget const ClearsignedTarget;
    IndexTarget const ClearsignedTarget;
    IndexTarget const DetachedDataTarget;
    IndexTarget const DetachedDataTarget;
@@ -580,7 +580,7 @@ public:
 /** \brief Common base class for all classes that deal with fetching indexes	{{{*/
 /** \brief Common base class for all classes that deal with fetching indexes	{{{*/
 class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
 class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
 {
 {
-   void *d;
+   void * const d;
 
 
  public:
  public:
    /** \brief Get the full pathname of the final file for the current URI */
    /** \brief Get the full pathname of the final file for the current URI */
@@ -602,7 +602,7 @@ class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
  */
  */
 class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex
 class APT_HIDDEN pkgAcqDiffIndex : public pkgAcqBaseIndex
 {
 {
-   void *d;
+   void * const d;
 
 
  protected:
  protected:
    /** \brief If \b true, debugging information will be written to std::clog. */
    /** \brief If \b true, debugging information will be written to std::clog. */
@@ -684,7 +684,7 @@ struct APT_HIDDEN DiffInfo {						/*{{{*/
  */
  */
 class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
 class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
 {
 {
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
 
 
@@ -768,7 +768,7 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
  */
  */
 class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
 class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
 {
 {
-   void *d;
+   void * const d;
 
 
    private:
    private:
 
 
@@ -878,7 +878,7 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
  */
  */
 class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
 class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
 {
 {
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
 
 
@@ -957,7 +957,7 @@ class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
  */
  */
 class pkgAcqArchive : public pkgAcquire::Item
 class pkgAcqArchive : public pkgAcquire::Item
 {
 {
-   void *d;
+   void * const d;
 
 
    bool LocalSource;
    bool LocalSource;
    HashStringList ExpectedHashes;
    HashStringList ExpectedHashes;
@@ -1045,7 +1045,7 @@ class pkgAcqArchive : public pkgAcquire::Item
  */
  */
 class pkgAcqChangelog : public pkgAcquire::Item
 class pkgAcqChangelog : public pkgAcquire::Item
 {
 {
-   void *d;
+   void * const d;
    std::string TemporaryDirectory;
    std::string TemporaryDirectory;
    std::string const SrcName;
    std::string const SrcName;
    std::string const SrcVersion;
    std::string const SrcVersion;
@@ -1160,7 +1160,7 @@ private:
  */
  */
 class pkgAcqFile : public pkgAcquire::Item
 class pkgAcqFile : public pkgAcquire::Item
 {
 {
-   void *d;
+   void * const d;
 
 
    /** \brief How many times to retry the download, set from
    /** \brief How many times to retry the download, set from
     *  Acquire::Retries.
     *  Acquire::Retries.

+ 2 - 2
apt-pkg/acquire-method.cc

@@ -457,7 +457,7 @@ void pkgAcqMethod::Redirect(const string &NewURI)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 pkgAcqMethod::FetchResult::FetchResult() : LastModified(0),
 pkgAcqMethod::FetchResult::FetchResult() : LastModified(0),
-                                   IMSHit(false), Size(0), ResumePoint(0)
+                                   IMSHit(false), Size(0), ResumePoint(0), d(NULL)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -480,7 +480,7 @@ void pkgAcqMethod::Dequeue() {						/*{{{*/
 									/*}}}*/
 									/*}}}*/
 pkgAcqMethod::~pkgAcqMethod() {}
 pkgAcqMethod::~pkgAcqMethod() {}
 
 
-pkgAcqMethod::FetchItem::FetchItem() {}
+pkgAcqMethod::FetchItem::FetchItem() : d(NULL) {}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 
 
 pkgAcqMethod::FetchResult::~FetchResult() {}
 pkgAcqMethod::FetchResult::~FetchResult() {}

+ 2 - 2
apt-pkg/acquire-method.h

@@ -56,7 +56,7 @@ class pkgAcqMethod
       FetchItem();
       FetchItem();
       virtual ~FetchItem();
       virtual ~FetchItem();
       private:
       private:
-      void *d;
+      void * const d;
    };
    };
    
    
    struct FetchResult
    struct FetchResult
@@ -73,7 +73,7 @@ class pkgAcqMethod
       FetchResult();
       FetchResult();
       virtual ~FetchResult();
       virtual ~FetchResult();
       private:
       private:
-      void *d;
+      void * const d;
    };
    };
 
 
    // State
    // State

+ 4 - 9
apt-pkg/acquire-worker.cc

@@ -47,7 +47,7 @@ using namespace std;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
 pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
-			   pkgAcquireStatus *log) : Log(log)
+			   pkgAcquireStatus *log) : d(NULL), Log(log)
 {
 {
    OwnerQ = Q;
    OwnerQ = Q;
    Config = Cnf;
    Config = Cnf;
@@ -62,15 +62,10 @@ pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
 // Worker::Worker - Constructor for method config startup		/*{{{*/
 // Worker::Worker - Constructor for method config startup		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgAcquire::Worker::Worker(MethodConfig *Cnf)
+pkgAcquire::Worker::Worker(MethodConfig *Cnf) : d(NULL), OwnerQ(NULL), Config(Cnf),
+						Access(Cnf->Access), CurrentItem(NULL),
+						CurrentSize(0), TotalSize(0)
 {
 {
-   OwnerQ = 0;
-   Config = Cnf;
-   Access = Cnf->Access;
-   CurrentItem = 0;
-   TotalSize = 0;
-   CurrentSize = 0;
-
    Construct();
    Construct();
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 1
apt-pkg/acquire-worker.h

@@ -47,7 +47,7 @@
 class pkgAcquire::Worker : public WeakPointable
 class pkgAcquire::Worker : public WeakPointable
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
   
   
    friend class pkgAcquire;
    friend class pkgAcquire;
    
    

+ 2 - 2
apt-pkg/acquire.cc

@@ -51,13 +51,13 @@ using namespace std;
 // Acquire::pkgAcquire - Constructor					/*{{{*/
 // Acquire::pkgAcquire - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* We grab some runtime state from the configuration space */
 /* We grab some runtime state from the configuration space */
-pkgAcquire::pkgAcquire() : LockFD(-1), Queues(0), Workers(0), Configs(0), Log(NULL), ToFetch(0),
+pkgAcquire::pkgAcquire() : LockFD(-1), d(NULL), Queues(0), Workers(0), Configs(0), Log(NULL), ToFetch(0),
 			   Debug(_config->FindB("Debug::pkgAcquire",false)),
 			   Debug(_config->FindB("Debug::pkgAcquire",false)),
 			   Running(false)
 			   Running(false)
 {
 {
    Initialize();
    Initialize();
 }
 }
-pkgAcquire::pkgAcquire(pkgAcquireStatus *Progress) : LockFD(-1), Queues(0), Workers(0),
+pkgAcquire::pkgAcquire(pkgAcquireStatus *Progress) : LockFD(-1), d(NULL), Queues(0), Workers(0),
 			   Configs(0), Log(NULL), ToFetch(0),
 			   Configs(0), Log(NULL), ToFetch(0),
 			   Debug(_config->FindB("Debug::pkgAcquire",false)),
 			   Debug(_config->FindB("Debug::pkgAcquire",false)),
 			   Running(false)
 			   Running(false)

+ 5 - 5
apt-pkg/acquire.h

@@ -101,7 +101,7 @@ class pkgAcquire
    /** \brief FD of the Lock file we acquire in Setup (if any) */
    /** \brief FD of the Lock file we acquire in Setup (if any) */
    int LockFD;
    int LockFD;
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    public:
    public:
    
    
@@ -411,7 +411,7 @@ class pkgAcquire::Queue
    friend class pkgAcquire::Worker;
    friend class pkgAcquire::Worker;
 
 
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    /** \brief The next queue in the pkgAcquire object's list of queues. */
    /** \brief The next queue in the pkgAcquire object's list of queues. */
    Queue *Next;
    Queue *Next;
@@ -596,7 +596,7 @@ class pkgAcquire::Queue
 class pkgAcquire::UriIterator
 class pkgAcquire::UriIterator
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    /** The next queue to iterate over. */
    /** The next queue to iterate over. */
    pkgAcquire::Queue *CurQ;
    pkgAcquire::Queue *CurQ;
@@ -633,7 +633,7 @@ class pkgAcquire::UriIterator
 struct pkgAcquire::MethodConfig
 struct pkgAcquire::MethodConfig
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
    
    
    /** \brief The next link on the acquire method list.
    /** \brief The next link on the acquire method list.
     *
     *
@@ -694,7 +694,7 @@ struct pkgAcquire::MethodConfig
 class pkgAcquireStatus
 class pkgAcquireStatus
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
    
    

+ 1 - 1
apt-pkg/algorithms.cc

@@ -43,7 +43,7 @@ pkgProblemResolver *pkgProblemResolver::This = 0;
 /* The legacy translations here of input Pkg iterators is obsolete, 
 /* The legacy translations here of input Pkg iterators is obsolete, 
    this is not necessary since the pkgCaches are fully shared now. */
    this is not necessary since the pkgCaches are fully shared now. */
 pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
 pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
-		            iPolicy(Cache),
+		            d(NULL), iPolicy(Cache),
 			    Sim(&Cache->GetCache(),&iPolicy),
 			    Sim(&Cache->GetCache(),&iPolicy),
 			    group(Sim)
 			    group(Sim)
 {
 {

+ 2 - 2
apt-pkg/algorithms.h

@@ -54,7 +54,7 @@ using std::ostream;
 
 
 class pkgSimulate : public pkgPackageManager				/*{{{*/
 class pkgSimulate : public pkgPackageManager				/*{{{*/
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
 
 
    class Policy : public pkgDepCache::Policy
    class Policy : public pkgDepCache::Policy
@@ -95,7 +95,7 @@ class pkgProblemResolver						/*{{{*/
 {
 {
  private:
  private:
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    pkgDepCache &Cache;
    pkgDepCache &Cache;
    typedef pkgCache::PkgIterator PkgIterator;
    typedef pkgCache::PkgIterator PkgIterator;

+ 1 - 1
apt-pkg/cachefile.h

@@ -37,7 +37,7 @@ class OpProgress;
 class pkgCacheFile
 class pkgCacheFile
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
    
    

+ 14 - 5
apt-pkg/cacheset.cc

@@ -813,16 +813,25 @@ APT_CONST void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &
 									/*}}}*/
 									/*}}}*/
 
 
 CacheSetHelper::CacheSetHelper(bool const ShowError, GlobalError::MsgType ErrorType) :
 CacheSetHelper::CacheSetHelper(bool const ShowError, GlobalError::MsgType ErrorType) :
-   ShowError(ShowError), ErrorType(ErrorType) {}
+   ShowError(ShowError), ErrorType(ErrorType), d(NULL) {}
 CacheSetHelper::~CacheSetHelper() {}
 CacheSetHelper::~CacheSetHelper() {}
 
 
-PackageContainerInterface::PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN) {}
-PackageContainerInterface::PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by) {}
+PackageContainerInterface::PackageContainerInterface() : ConstructedBy(CacheSetHelper::UNKNOWN), d(NULL) {}
+PackageContainerInterface::PackageContainerInterface(CacheSetHelper::PkgSelector const by) : ConstructedBy(by), d(NULL) {}
+PackageContainerInterface& PackageContainerInterface::operator=(PackageContainerInterface const &other) {
+   if (this != &other)
+      this->ConstructedBy = other.ConstructedBy;
+   return *this;
+}
 PackageContainerInterface::~PackageContainerInterface() {}
 PackageContainerInterface::~PackageContainerInterface() {}
 
 
-PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner) { }
+PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) { }
 PackageUniverse::~PackageUniverse() {}
 PackageUniverse::~PackageUniverse() {}
 
 
-VersionContainerInterface::VersionContainerInterface() {}
+VersionContainerInterface::VersionContainerInterface() : d(NULL) {}
+VersionContainerInterface& VersionContainerInterface::operator=(VersionContainerInterface const &) {
+   return *this;
+}
+
 VersionContainerInterface::~VersionContainerInterface() {}
 VersionContainerInterface::~VersionContainerInterface() {}
 }
 }

+ 6 - 4
apt-pkg/cacheset.h

@@ -203,7 +203,7 @@ protected:
 	bool PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
 	bool PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
 	bool PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
 	bool PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
 private:
 private:
-	void *d;
+	void * const d;
 };									/*}}}*/
 };									/*}}}*/
 
 
 class PackageContainerInterface {					/*{{{*/
 class PackageContainerInterface {					/*{{{*/
@@ -266,6 +266,7 @@ APT_IGNORE_DEPRECATED_POP
 	CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
 	CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
 	PackageContainerInterface();
 	PackageContainerInterface();
 	explicit PackageContainerInterface(CacheSetHelper::PkgSelector const by);
 	explicit PackageContainerInterface(CacheSetHelper::PkgSelector const by);
+	PackageContainerInterface& operator=(PackageContainerInterface const &other);
 	virtual ~PackageContainerInterface();
 	virtual ~PackageContainerInterface();
 
 
 	APT_DEPRECATED static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
 	APT_DEPRECATED static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
@@ -294,7 +295,7 @@ APT_IGNORE_DEPRECATED_POP
 
 
 private:
 private:
 	CacheSetHelper::PkgSelector ConstructedBy;
 	CacheSetHelper::PkgSelector ConstructedBy;
-	void *d;
+	void * const d;
 };
 };
 									/*}}}*/
 									/*}}}*/
 template<class Container> class PackageContainer : public PackageContainerInterface {/*{{{*/
 template<class Container> class PackageContainer : public PackageContainerInterface {/*{{{*/
@@ -555,7 +556,7 @@ template<> template<class Compare> inline bool PackageContainer<std::vector<pkgC
     private methods. */
     private methods. */
 class APT_HIDDEN PackageUniverse : public PackageContainerInterface {
 class APT_HIDDEN PackageUniverse : public PackageContainerInterface {
 	pkgCache * const _cont;
 	pkgCache * const _cont;
-	void *d;
+	void * const d;
 public:
 public:
 	typedef pkgCache::PkgIterator iterator;
 	typedef pkgCache::PkgIterator iterator;
 	typedef pkgCache::PkgIterator const_iterator;
 	typedef pkgCache::PkgIterator const_iterator;
@@ -707,9 +708,10 @@ APT_IGNORE_DEPRECATED_PUSH
 APT_IGNORE_DEPRECATED_POP
 APT_IGNORE_DEPRECATED_POP
 
 
 	VersionContainerInterface();
 	VersionContainerInterface();
+	VersionContainerInterface& operator=(VersionContainerInterface const &other);
 	virtual ~VersionContainerInterface();
 	virtual ~VersionContainerInterface();
 private:
 private:
-	void *d;
+	void * const d;
 
 
 protected:								/*{{{*/
 protected:								/*{{{*/
 
 

+ 3 - 3
apt-pkg/cdrom.cc

@@ -917,7 +917,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
 }
 }
 									/*}}}*/
 									/*}}}*/
 pkgUdevCdromDevices::pkgUdevCdromDevices()				/*{{{*/
 pkgUdevCdromDevices::pkgUdevCdromDevices()				/*{{{*/
-: libudev_handle(NULL), udev_new(NULL), udev_enumerate_add_match_property(NULL),
+: d(NULL), libudev_handle(NULL), udev_new(NULL), udev_enumerate_add_match_property(NULL),
    udev_enumerate_scan_devices(NULL), udev_enumerate_get_list_entry(NULL),
    udev_enumerate_scan_devices(NULL), udev_enumerate_get_list_entry(NULL),
    udev_device_new_from_syspath(NULL), udev_enumerate_get_udev(NULL),
    udev_device_new_from_syspath(NULL), udev_enumerate_get_udev(NULL),
    udev_list_entry_get_name(NULL), udev_device_get_devnode(NULL),
    udev_list_entry_get_name(NULL), udev_device_get_devnode(NULL),
@@ -1023,8 +1023,8 @@ pkgUdevCdromDevices::~pkgUdevCdromDevices()                             /*{{{*/
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
-pkgCdromStatus::pkgCdromStatus() : totalSteps(0) {}
+pkgCdromStatus::pkgCdromStatus() : d(NULL), totalSteps(0) {}
 pkgCdromStatus::~pkgCdromStatus() {}
 pkgCdromStatus::~pkgCdromStatus() {}
 
 
-pkgCdrom::pkgCdrom() {}
+pkgCdrom::pkgCdrom() : d(NULL) {}
 pkgCdrom::~pkgCdrom() {}
 pkgCdrom::~pkgCdrom() {}

+ 3 - 3
apt-pkg/cdrom.h

@@ -18,7 +18,7 @@ class OpProgress;
 
 
 class pkgCdromStatus							/*{{{*/
 class pkgCdromStatus							/*{{{*/
 {
 {
-   void *d;
+   void * const d;
  protected:
  protected:
    int totalSteps;
    int totalSteps;
 
 
@@ -79,7 +79,7 @@ class pkgCdrom								/*{{{*/
    virtual ~pkgCdrom();
    virtual ~pkgCdrom();
 
 
  private:
  private:
-   void *d;
+   void * const d;
 
 
    APT_HIDDEN bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM,
    APT_HIDDEN bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM,
 	 std::string &ident, pkgCdromStatus * const log, bool const interactive);
 	 std::string &ident, pkgCdromStatus * const log, bool const interactive);
@@ -98,7 +98,7 @@ struct CdromDevice							/*{{{*/
 									/*}}}*/
 									/*}}}*/
 class pkgUdevCdromDevices						/*{{{*/
 class pkgUdevCdromDevices						/*{{{*/
 {
 {
-   void *d;
+   void * const d;
  protected:
  protected:
    // libudev dlopen structure
    // libudev dlopen structure
    void *libudev_handle;
    void *libudev_handle;

+ 1 - 1
apt-pkg/clean.cc

@@ -132,5 +132,5 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
-pkgArchiveCleaner::pkgArchiveCleaner() {}
+pkgArchiveCleaner::pkgArchiveCleaner() : d(NULL) {}
 APT_CONST pkgArchiveCleaner::~pkgArchiveCleaner() {}
 APT_CONST pkgArchiveCleaner::~pkgArchiveCleaner() {}

+ 1 - 1
apt-pkg/clean.h

@@ -21,7 +21,7 @@ class pkgCache;
 class pkgArchiveCleaner
 class pkgArchiveCleaner
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
 
 

+ 19 - 0
apt-pkg/contrib/fileutl.cc

@@ -1011,6 +1011,25 @@ class FileFdPrivate {							/*{{{*/
 	~FileFdPrivate() { CloseDown(""); }
 	~FileFdPrivate() { CloseDown(""); }
 };
 };
 									/*}}}*/
 									/*}}}*/
+// FileFd Constructors							/*{{{*/
+FileFd::FileFd(std::string FileName,unsigned int const Mode,unsigned long AccessMode) : iFd(-1), Flags(0), d(NULL)
+{
+   Open(FileName,Mode, None, AccessMode);
+}
+FileFd::FileFd(std::string FileName,unsigned int const Mode, CompressMode Compress, unsigned long AccessMode) : iFd(-1), Flags(0), d(NULL)
+{
+   Open(FileName,Mode, Compress, AccessMode);
+}
+FileFd::FileFd() : iFd(-1), Flags(AutoClose), d(NULL) {}
+FileFd::FileFd(int const Fd, unsigned int const Mode, CompressMode Compress) : iFd(-1), Flags(0), d(NULL)
+{
+   OpenDescriptor(Fd, Mode, Compress);
+}
+FileFd::FileFd(int const Fd, bool const AutoClose) : iFd(-1), Flags(0), d(NULL)
+{
+   OpenDescriptor(Fd, ReadWrite, None, AutoClose);
+}
+									/*}}}*/
 // FileFd::Open - Open a file						/*{{{*/
 // FileFd::Open - Open a file						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The most commonly used open mode combinations are given with Mode */
 /* The most commonly used open mode combinations are given with Mode */

+ 8 - 19
apt-pkg/contrib/fileutl.h

@@ -130,28 +130,17 @@ class FileFd
    inline bool Eof() {return (Flags & HitEof) == HitEof;};
    inline bool Eof() {return (Flags & HitEof) == HitEof;};
    inline bool IsCompressed() {return (Flags & Compressed) == Compressed;};
    inline bool IsCompressed() {return (Flags & Compressed) == Compressed;};
    inline std::string &Name() {return FileName;};
    inline std::string &Name() {return FileName;};
-   
-   FileFd(std::string FileName,unsigned int const Mode,unsigned long AccessMode = 0666) : iFd(-1), Flags(0), d(NULL)
-   {
-      Open(FileName,Mode, None, AccessMode);
-   };
-   FileFd(std::string FileName,unsigned int const Mode, CompressMode Compress, unsigned long AccessMode = 0666) : iFd(-1), Flags(0), d(NULL)
-   {
-      Open(FileName,Mode, Compress, AccessMode);
-   };
-   FileFd() : iFd(-1), Flags(AutoClose), d(NULL) {};
-   FileFd(int const Fd, unsigned int const Mode = ReadWrite, CompressMode Compress = None) : iFd(-1), Flags(0), d(NULL)
-   {
-      OpenDescriptor(Fd, Mode, Compress);
-   };
-   FileFd(int const Fd, bool const AutoClose) : iFd(-1), Flags(0), d(NULL)
-   {
-      OpenDescriptor(Fd, ReadWrite, None, AutoClose);
-   };
+
+   FileFd(std::string FileName,unsigned int const Mode,unsigned long AccessMode = 0666);
+   FileFd(std::string FileName,unsigned int const Mode, CompressMode Compress, unsigned long AccessMode = 0666);
+   FileFd();
+   FileFd(int const Fd, unsigned int const Mode = ReadWrite, CompressMode Compress = None);
+   FileFd(int const Fd, bool const AutoClose);
    virtual ~FileFd();
    virtual ~FileFd();
 
 
    private:
    private:
-   FileFdPrivate* d;
+   FileFdPrivate * d;
+   APT_HIDDEN FileFd & operator=(const FileFd &);
    APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor);
    APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor);
 
 
    // private helpers to set Fail flag and call _error->Error
    // private helpers to set Fail flag and call _error->Error

+ 15 - 14
apt-pkg/contrib/hashes.cc

@@ -277,6 +277,18 @@ public:
    unsigned int CalcHashes;
    unsigned int CalcHashes;
 
 
    explicit PrivateHashes(unsigned int const CalcHashes) : FileSize(0), CalcHashes(CalcHashes) {}
    explicit PrivateHashes(unsigned int const CalcHashes) : FileSize(0), CalcHashes(CalcHashes) {}
+   explicit PrivateHashes(HashStringList const &Hashes) : FileSize(0) {
+      unsigned int calcHashes = Hashes.usable() ? 0 : ~0;
+      if (Hashes.find("MD5Sum") != NULL)
+	 calcHashes |= Hashes::MD5SUM;
+      if (Hashes.find("SHA1") != NULL)
+	 calcHashes |= Hashes::SHA1SUM;
+      if (Hashes.find("SHA256") != NULL)
+	 calcHashes |= Hashes::SHA256SUM;
+      if (Hashes.find("SHA512") != NULL)
+	 calcHashes |= Hashes::SHA512SUM;
+      CalcHashes = calcHashes;
+   }
 };
 };
 									/*}}}*/
 									/*}}}*/
 // Hashes::Add* - Add the contents of data or FD			/*{{{*/
 // Hashes::Add* - Add the contents of data or FD			/*{{{*/
@@ -372,19 +384,8 @@ APT_IGNORE_DEPRECATED_POP
    return hashes;
    return hashes;
 }
 }
 APT_IGNORE_DEPRECATED_PUSH
 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) {
-   unsigned int calcHashes = Hashes.usable() ? 0 : ~0;
-   if (Hashes.find("MD5Sum") != NULL)
-      calcHashes |= MD5SUM;
-   if (Hashes.find("SHA1") != NULL)
-      calcHashes |= SHA1SUM;
-   if (Hashes.find("SHA256") != NULL)
-      calcHashes |= SHA256SUM;
-   if (Hashes.find("SHA512") != NULL)
-      calcHashes |= SHA512SUM;
-   d = new PrivateHashes(calcHashes);
-}
+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; }
 Hashes::~Hashes() { delete d; }
 APT_IGNORE_DEPRECATED_POP
 APT_IGNORE_DEPRECATED_POP

+ 1 - 1
apt-pkg/contrib/hashes.h

@@ -182,7 +182,7 @@ class HashStringList
 class PrivateHashes;
 class PrivateHashes;
 class Hashes
 class Hashes
 {
 {
-   PrivateHashes *d;
+   PrivateHashes * const d;
 
 
    public:
    public:
    /* those will disappear in the future as it is hard to add new ones this way.
    /* those will disappear in the future as it is hard to add new ones this way.

+ 6 - 6
apt-pkg/deb/debindexfile.cc

@@ -45,7 +45,7 @@ using std::string;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 debSourcesIndex::debSourcesIndex(IndexTarget const &Target,bool const Trusted) :
 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) :
 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			/*{{{*/
 // TranslationsIndex::debTranslationsIndex - Contructor			/*{{{*/
 debTranslationsIndex::debTranslationsIndex(IndexTarget const &Target) :
 debTranslationsIndex::debTranslationsIndex(IndexTarget const &Target) :
-			pkgIndexTargetFile(Target, true)
+			pkgIndexTargetFile(Target, true), d(NULL)
 {}
 {}
 									/*}}}*/
 									/*}}}*/
 bool debTranslationsIndex::HasPackages() const				/*{{{*/
 bool debTranslationsIndex::HasPackages() const				/*{{{*/
@@ -255,7 +255,7 @@ pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) con
 // StatusIndex::debStatusIndex - Constructor				/*{{{*/
 // 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					/*{{{*/
 // debDebPkgFile - Single .deb file					/*{{{*/
 debDebPkgFileIndex::debDebPkgFileIndex(std::string DebFile)
 debDebPkgFileIndex::debDebPkgFileIndex(std::string DebFile)
-   : pkgIndexFile(true), DebFile(DebFile)
+   : pkgIndexFile(true), d(NULL), DebFile(DebFile)
 {
 {
    DebFileFullPath = flAbsPath(DebFile);
    DebFileFullPath = flAbsPath(DebFile);
 }
 }
@@ -445,7 +445,7 @@ unsigned long debDebPkgFileIndex::Size() const
 
 
 // debDscFileIndex stuff
 // debDscFileIndex stuff
 debDscFileIndex::debDscFileIndex(std::string &DscFile) 
 debDscFileIndex::debDscFileIndex(std::string &DscFile) 
-   : pkgIndexFile(true), DscFile(DscFile)
+   : pkgIndexFile(true), d(NULL), DscFile(DscFile)
 {
 {
 }
 }
 
 

+ 6 - 6
apt-pkg/deb/debindexfile.h

@@ -29,7 +29,7 @@ class pkgCacheGenerator;
 
 
 class APT_HIDDEN debStatusIndex : public pkgIndexFile
 class APT_HIDDEN debStatusIndex : public pkgIndexFile
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    std::string File;
    std::string File;
 
 
@@ -53,7 +53,7 @@ class APT_HIDDEN debStatusIndex : public pkgIndexFile
 
 
 class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
 class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
 {
 {
-   void *d;
+   void * const d;
    public:
    public:
 
 
    virtual const Type *GetType() const APT_CONST;
    virtual const Type *GetType() const APT_CONST;
@@ -72,7 +72,7 @@ class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
 
 
 class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
 class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
 {
 {
-   void *d;
+   void * const d;
    public:
    public:
 
 
    virtual const Type *GetType() const APT_CONST;
    virtual const Type *GetType() const APT_CONST;
@@ -88,7 +88,7 @@ class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
 
 
 class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
 class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
 {
 {
-   void *d;
+   void * const d;
    public:
    public:
 
 
    virtual const Type *GetType() const APT_CONST;
    virtual const Type *GetType() const APT_CONST;
@@ -110,7 +110,7 @@ class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
 class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
 class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
 {
 {
  private:
  private:
-   void *d;
+   void * const d;
    std::string DebFile;
    std::string DebFile;
    std::string DebFileFullPath;
    std::string DebFileFullPath;
 
 
@@ -148,7 +148,7 @@ class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
 {
 {
  private:
  private:
-   void *d;
+   void * const d;
    std::string DscFile;
    std::string DscFile;
  public:
  public:
    virtual const Type *GetType() const APT_CONST;
    virtual const Type *GetType() const APT_CONST;

+ 1 - 1
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
 /* Provide an architecture and only this one and "all" will be accepted
    in Step(), if no Architecture is given we will accept every arch
    in Step(), if no Architecture is given we will accept every arch
    we would accept in general with checkArchitecture() */
    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) {
 				Arch(Arch) {
    if (Arch == "native")
    if (Arch == "native")
       this->Arch = _config->Find("APT::Architecture");
       this->Arch = _config->Find("APT::Architecture");

+ 1 - 1
apt-pkg/deb/deblistparser.h

@@ -39,7 +39,7 @@ class APT_HIDDEN debListParser : public pkgCacheGenerator::ListParser
 
 
    private:
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
    pkgTagFile Tags;
    pkgTagFile Tags;

+ 3 - 3
apt-pkg/deb/debmetaindex.cc

@@ -86,11 +86,11 @@ std::string debReleaseIndex::LocalFileName() const
 }
 }
 
 
 debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) :
 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) :
 debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist, bool const Trusted) :
-					metaIndex(URI, Dist, "deb") {
+					metaIndex(URI, Dist, "deb"), d(NULL) {
 	SetTrusted(Trusted);
 	SetTrusted(Trusted);
 }
 }
 
 
@@ -541,7 +541,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type
 };
 };
 
 
 debDebFileMetaIndex::debDebFileMetaIndex(std::string const &DebFile)
 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);
    DebIndex = new debDebPkgFileIndex(DebFile);
    Indexes = new vector<pkgIndexFile *>();
    Indexes = new vector<pkgIndexFile *>();

+ 2 - 2
apt-pkg/deb/debmetaindex.h

@@ -36,7 +36,7 @@ class APT_HIDDEN debReleaseIndex : public metaIndex {
 
 
    private:
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
    std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
    std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
    enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
    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
 class APT_HIDDEN debDebFileMetaIndex : public metaIndex
 {
 {
  private:
  private:
-    void *d;
+    void * const d;
    std::string DebFile;
    std::string DebFile;
    debDebPkgFileIndex *DebIndex;
    debDebPkgFileIndex *DebIndex;
  public:
  public:

+ 3 - 3
apt-pkg/deb/debrecords.cc

@@ -34,7 +34,7 @@ using std::string;
 
 
 // RecordParser::debRecordParser - Constructor				/*{{{*/
 // RecordParser::debRecordParser - Constructor				/*{{{*/
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
 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)
    Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200)
 {
 {
 }
 }
@@ -51,7 +51,7 @@ bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc)
 									/*}}}*/
 									/*}}}*/
 debRecordParser::~debRecordParser() {}
 debRecordParser::~debRecordParser() {}
 
 
-debRecordParserBase::debRecordParserBase() : Parser() {}
+debRecordParserBase::debRecordParserBase() : Parser(), d(NULL) {}
 // RecordParserBase::FileName - Return the archive filename on the site	/*{{{*/
 // RecordParserBase::FileName - Return the archive filename on the site	/*{{{*/
 string debRecordParserBase::FileName()
 string debRecordParserBase::FileName()
 {
 {
@@ -212,5 +212,5 @@ bool debDebFileRecordParser::Jump(pkgCache::VerFileIterator const &) { return Lo
 bool debDebFileRecordParser::Jump(pkgCache::DescFileIterator const &) { return LoadContent(); }
 bool debDebFileRecordParser::Jump(pkgCache::DescFileIterator const &) { return LoadContent(); }
 std::string debDebFileRecordParser::FileName() { return debFileName; }
 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() {}
 debDebFileRecordParser::~debDebFileRecordParser() {}

+ 3 - 3
apt-pkg/deb/debrecords.h

@@ -27,7 +27,7 @@
 
 
 class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
 class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
 {
 {
-   void *d;
+   void * const d;
  protected:
  protected:
    pkgTagSection Section;
    pkgTagSection Section;
 
 
@@ -57,7 +57,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
 
 
 class APT_HIDDEN debRecordParser : public debRecordParserBase
 class APT_HIDDEN debRecordParser : public debRecordParserBase
 {
 {
-   void *d;
+   void * const d;
  protected:
  protected:
    FileFd File;
    FileFd File;
    pkgTagFile Tags;
    pkgTagFile Tags;
@@ -73,7 +73,7 @@ class APT_HIDDEN debRecordParser : public debRecordParserBase
 // custom record parser that reads deb files directly
 // custom record parser that reads deb files directly
 class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
 class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
 {
 {
-   void *d;
+   void * const d;
    std::string debFileName;
    std::string debFileName;
    std::string controlContent;
    std::string controlContent;
 
 

+ 1 - 1
apt-pkg/deb/debsrcrecords.cc

@@ -33,7 +33,7 @@ using std::max;
 using std::string;
 using std::string;
 
 
 debSrcRecordParser::debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
 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) {}
    iOffset(0), Buffer(NULL) {}
 
 
 // SrcRecordParser::Binaries - Return the binaries field		/*{{{*/
 // SrcRecordParser::Binaries - Return the binaries field		/*{{{*/

+ 1 - 1
apt-pkg/deb/debsrcrecords.h

@@ -24,7 +24,7 @@ class pkgIndexFile;
 class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
 class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
  protected:
  protected:
    FileFd Fd;
    FileFd Fd;

+ 1 - 4
apt-pkg/deb/debsystem.cc

@@ -53,11 +53,8 @@ public:
 // System::debSystem - Constructor					/*{{{*/
 // 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					/*{{{*/
 // System::~debSystem - Destructor					/*{{{*/

+ 1 - 1
apt-pkg/deb/debsystem.h

@@ -28,7 +28,7 @@ class debStatusIndex;
 class debSystem : public pkgSystem
 class debSystem : public pkgSystem
 {
 {
    // private d-pointer
    // private d-pointer
-   debSystemPrivate *d;
+   debSystemPrivate * const d;
    APT_HIDDEN bool CheckUpdates();
    APT_HIDDEN bool CheckUpdates();
 
 
    public:
    public:

+ 2 - 3
apt-pkg/deb/dpkgpm.cc

@@ -216,10 +216,9 @@ pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg)
 // DPkgPM::pkgDPkgPM - Constructor					/*{{{*/
 // 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					/*{{{*/
 // DPkgPM::pkgDPkgPM - Destructor					/*{{{*/

+ 1 - 1
apt-pkg/deb/dpkgpm.h

@@ -37,7 +37,7 @@ class pkgDPkgPMPrivate;
 class pkgDPkgPM : public pkgPackageManager
 class pkgDPkgPM : public pkgPackageManager
 {
 {
    private:
    private:
-   pkgDPkgPMPrivate *d;
+   pkgDPkgPMPrivate * const d;
 
 
    /** \brief record the disappear action and handle accordingly
    /** \brief record the disappear action and handle accordingly
 
 

+ 2 - 2
apt-pkg/depcache.cc

@@ -63,7 +63,7 @@ ConfigValueInSubTree(const char* SubTree, const char *needle)
 }
 }
 									/*}}}*/
 									/*}}}*/
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :		/*{{{*/
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :		/*{{{*/
-  cache(cache), released(false)
+  d(NULL), cache(cache), released(false)
 {
 {
   ++cache.group_level;
   ++cache.group_level;
 }
 }
@@ -97,7 +97,7 @@ pkgDepCache::ActionGroup::~ActionGroup()
 pkgDepCache::pkgDepCache(pkgCache *pCache,Policy *Plcy) :
 pkgDepCache::pkgDepCache(pkgCache *pCache,Policy *Plcy) :
   group_level(0), Cache(pCache), PkgState(0), DepState(0),
   group_level(0), Cache(pCache), PkgState(0), DepState(0),
    iUsrSize(0), iDownloadSize(0), iInstCount(0), iDelCount(0), iKeepCount(0),
    iUsrSize(0), iDownloadSize(0), iInstCount(0), iDelCount(0), iKeepCount(0),
-   iBrokenCount(0), iPolicyBrokenCount(0), iBadCount(0)
+   iBrokenCount(0), iPolicyBrokenCount(0), iBadCount(0), d(NULL)
 {
 {
    DebugMarker = _config->FindB("Debug::pkgDepCache::Marker", false);
    DebugMarker = _config->FindB("Debug::pkgDepCache::Marker", false);
    DebugAutoInstall = _config->FindB("Debug::pkgDepCache::AutoInstall", false);
    DebugAutoInstall = _config->FindB("Debug::pkgDepCache::AutoInstall", false);

+ 2 - 2
apt-pkg/depcache.h

@@ -163,7 +163,7 @@ class pkgDepCache : protected pkgCache::Namespace
     */
     */
    class ActionGroup
    class ActionGroup
    {
    {
-       void *d;
+       void * const d;
        pkgDepCache &cache;
        pkgDepCache &cache;
 
 
        bool released;
        bool released;
@@ -503,7 +503,7 @@ class pkgDepCache : protected pkgCache::Namespace
 	 bool const rPurge, unsigned long const Depth, bool const FromUser);
 	 bool const rPurge, unsigned long const Depth, bool const FromUser);
 
 
    private:
    private:
-   void *d;
+   void * const d;
 
 
    APT_HIDDEN bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
    APT_HIDDEN bool IsModeChangeOk(ModeList const mode, PkgIterator const &Pkg,
 			unsigned long const Depth, bool const FromUser);
 			unsigned long const Depth, bool const FromUser);

+ 1 - 1
apt-pkg/edsp/edspindexfile.cc

@@ -29,7 +29,7 @@
 // edspIndex::edspIndex - Constructor					/*{{{*/
 // edspIndex::edspIndex - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-edspIndex::edspIndex(std::string File) : debStatusIndex(File)
+edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 1
apt-pkg/edsp/edspindexfile.h

@@ -21,7 +21,7 @@ class pkgCacheGenerator;
 class APT_HIDDEN edspIndex : public debStatusIndex
 class APT_HIDDEN edspIndex : public debStatusIndex
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    public:
    public:
 
 

+ 1 - 1
apt-pkg/edsp/edsplistparser.cc

@@ -22,7 +22,7 @@
 									/*}}}*/
 									/*}}}*/
 
 
 // ListParser::edspListParser - Constructor				/*{{{*/
 // ListParser::edspListParser - Constructor				/*{{{*/
-edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
+edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch), d(NULL)
 {}
 {}
 									/*}}}*/
 									/*}}}*/
 // ListParser::NewVersion - Fill in the version structure		/*{{{*/
 // ListParser::NewVersion - Fill in the version structure		/*{{{*/

+ 1 - 1
apt-pkg/edsp/edsplistparser.h

@@ -27,7 +27,7 @@ class FileFd;
 
 
 class APT_HIDDEN edspListParser : public debListParser
 class APT_HIDDEN edspListParser : public debListParser
 {
 {
-   void *d;
+   void * const d;
    public:
    public:
    virtual bool NewVersion(pkgCache::VerIterator &Ver);
    virtual bool NewVersion(pkgCache::VerIterator &Ver);
    virtual std::string Description();
    virtual std::string Description();

+ 2 - 6
apt-pkg/edsp/edspsystem.cc

@@ -26,13 +26,9 @@
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
 
 
-// System::debSystem - Constructor					/*{{{*/
-edspSystem::edspSystem()
+// System::edspSystem - Constructor					/*{{{*/
+edspSystem::edspSystem() : pkgSystem("Debian APT solver interface", &debVS), d(NULL), StatusFile(NULL)
 {
 {
-   StatusFile = 0;
-
-   Label = "Debian APT solver interface";
-   VS = &debVS;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // System::~debSystem - Destructor					/*{{{*/
 // System::~debSystem - Destructor					/*{{{*/

+ 1 - 1
apt-pkg/edsp/edspsystem.h

@@ -25,7 +25,7 @@ class edspIndex;
 class APT_HIDDEN edspSystem : public pkgSystem
 class APT_HIDDEN edspSystem : public pkgSystem
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    edspIndex *StatusFile;
    edspIndex *StatusFile;
 
 

+ 5 - 5
apt-pkg/indexcopy.cc

@@ -769,14 +769,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
-IndexCopy::IndexCopy() {}
+IndexCopy::IndexCopy() : d(NULL) {}
 APT_CONST IndexCopy::~IndexCopy() {}
 APT_CONST IndexCopy::~IndexCopy() {}
 
 
-PackageCopy::PackageCopy() : IndexCopy() {}
+PackageCopy::PackageCopy() : IndexCopy(), d(NULL) {}
 APT_CONST PackageCopy::~PackageCopy() {}
 APT_CONST PackageCopy::~PackageCopy() {}
-SourceCopy::SourceCopy() : IndexCopy() {}
+SourceCopy::SourceCopy() : IndexCopy(), d(NULL) {}
 APT_CONST SourceCopy::~SourceCopy() {}
 APT_CONST SourceCopy::~SourceCopy() {}
-TranslationsCopy::TranslationsCopy() {}
+TranslationsCopy::TranslationsCopy() : d(NULL) {}
 APT_CONST TranslationsCopy::~TranslationsCopy() {}
 APT_CONST TranslationsCopy::~TranslationsCopy() {}
-SigVerify::SigVerify() {}
+SigVerify::SigVerify() : d(NULL) {}
 APT_CONST SigVerify::~SigVerify() {}
 APT_CONST SigVerify::~SigVerify() {}

+ 5 - 5
apt-pkg/indexcopy.h

@@ -32,7 +32,7 @@ class FileFd;
 class IndexCopy								/*{{{*/
 class IndexCopy								/*{{{*/
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
    
    
@@ -59,7 +59,7 @@ class IndexCopy								/*{{{*/
 									/*}}}*/
 									/*}}}*/
 class PackageCopy : public IndexCopy					/*{{{*/
 class PackageCopy : public IndexCopy					/*{{{*/
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
 
 
    virtual bool GetFile(std::string &Filename,unsigned long long &Size);
    virtual bool GetFile(std::string &Filename,unsigned long long &Size);
@@ -74,7 +74,7 @@ class PackageCopy : public IndexCopy					/*{{{*/
 									/*}}}*/
 									/*}}}*/
 class SourceCopy : public IndexCopy					/*{{{*/
 class SourceCopy : public IndexCopy					/*{{{*/
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    
    
    virtual bool GetFile(std::string &Filename,unsigned long long &Size);
    virtual bool GetFile(std::string &Filename,unsigned long long &Size);
@@ -89,7 +89,7 @@ class SourceCopy : public IndexCopy					/*{{{*/
 									/*}}}*/
 									/*}}}*/
 class TranslationsCopy							/*{{{*/
 class TranslationsCopy							/*{{{*/
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    pkgTagSection *Section;
    pkgTagSection *Section;
 
 
@@ -104,7 +104,7 @@ class TranslationsCopy							/*{{{*/
 class SigVerify								/*{{{*/
 class SigVerify								/*{{{*/
 {
 {
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \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 Verify(std::string prefix,std::string file, indexRecords *records);
    APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
    APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,

+ 2 - 2
apt-pkg/indexfile.cc

@@ -53,7 +53,7 @@ pkgIndexFile::Type *pkgIndexFile::Type::GetType(const char *Type)
 }
 }
 									/*}}}*/
 									/*}}}*/
 pkgIndexFile::pkgIndexFile(bool Trusted) :				/*{{{*/
 pkgIndexFile::pkgIndexFile(bool Trusted) :				/*{{{*/
-   Trusted(Trusted)
+   d(NULL), Trusted(Trusted)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -172,7 +172,7 @@ std::string IndexTarget::Format(std::string format) const		/*{{{*/
 									/*}}}*/
 									/*}}}*/
 
 
 pkgIndexTargetFile::pkgIndexTargetFile(IndexTarget const &Target, bool const Trusted) :/*{{{*/
 pkgIndexTargetFile::pkgIndexTargetFile(IndexTarget const &Target, bool const Trusted) :/*{{{*/
-   pkgIndexFile(Trusted), Target(Target)
+   pkgIndexFile(Trusted), d(NULL), Target(Target)
 {
 {
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 2 - 2
apt-pkg/indexfile.h

@@ -89,7 +89,7 @@ class IndexTarget							/*{{{*/
 
 
 class pkgIndexFile
 class pkgIndexFile
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    bool Trusted;
    bool Trusted;
 
 
@@ -150,7 +150,7 @@ class pkgIndexFile
 
 
 class pkgIndexTargetFile : public pkgIndexFile
 class pkgIndexTargetFile : public pkgIndexFile
 {
 {
-   void *d;
+   void * const d;
 protected:
 protected:
    IndexTarget const Target;
    IndexTarget const Target;
 
 

+ 1 - 1
apt-pkg/indexrecords.h

@@ -27,7 +27,7 @@ class indexRecords
    private:
    private:
    enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
    enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
    // dpointer (for later)
    // dpointer (for later)
-   void * d;
+   void * const d;
 
 
    protected:
    protected:
    std::string Dist;
    std::string Dist;

+ 4 - 4
apt-pkg/install-progress.cc

@@ -65,7 +65,7 @@ bool PackageManager::StatusChanged(std::string /*PackageName*/,
 }
 }
 
 
 PackageManagerProgressFd::PackageManagerProgressFd(int progress_fd)
 PackageManagerProgressFd::PackageManagerProgressFd(int progress_fd)
-   : StepsDone(0), StepsTotal(1)
+   : d(NULL), StepsDone(0), StepsTotal(1)
 {
 {
    OutStatusFd = progress_fd;
    OutStatusFd = progress_fd;
 }
 }
@@ -154,7 +154,7 @@ bool PackageManagerProgressFd::StatusChanged(std::string PackageName,
 
 
 
 
 PackageManagerProgressDeb822Fd::PackageManagerProgressDeb822Fd(int progress_fd)
 PackageManagerProgressDeb822Fd::PackageManagerProgressDeb822Fd(int progress_fd)
-   : StepsDone(0), StepsTotal(1)
+   : d(NULL), StepsDone(0), StepsTotal(1)
 {
 {
    OutStatusFd = progress_fd;
    OutStatusFd = progress_fd;
 }
 }
@@ -235,7 +235,7 @@ bool PackageManagerProgressDeb822Fd::StatusChanged(std::string PackageName,
 
 
 
 
 PackageManagerFancy::PackageManagerFancy()
 PackageManagerFancy::PackageManagerFancy()
-   : child_pty(-1)
+   : d(NULL), child_pty(-1)
 {
 {
    // setup terminal size
    // setup terminal size
    old_SIGWINCH = signal(SIGWINCH, PackageManagerFancy::staticSIGWINCH);
    old_SIGWINCH = signal(SIGWINCH, PackageManagerFancy::staticSIGWINCH);
@@ -435,7 +435,7 @@ bool PackageManagerText::StatusChanged(std::string PackageName,
    return true;
    return true;
 }
 }
 
 
-PackageManagerText::PackageManagerText() : PackageManager() {}
+PackageManagerText::PackageManagerText() : PackageManager(), d(NULL) {}
 PackageManagerText::~PackageManagerText() {}
 PackageManagerText::~PackageManagerText() {}
 
 
 
 

+ 5 - 5
apt-pkg/install-progress.h

@@ -18,7 +18,7 @@ namespace Progress {
  {
  {
  private:
  private:
     /** \brief dpointer placeholder */
     /** \brief dpointer placeholder */
-    void *d;
+    void * const d;
 
 
  protected:
  protected:
     std::string progress_str;
     std::string progress_str;
@@ -61,7 +61,7 @@ namespace Progress {
 
 
  class PackageManagerProgressFd : public PackageManager
  class PackageManagerProgressFd : public PackageManager
  {
  {
-    void *d;
+    void * const d;
  protected:
  protected:
     int OutStatusFd;
     int OutStatusFd;
     int StepsDone;
     int StepsDone;
@@ -92,7 +92,7 @@ namespace Progress {
 
 
  class PackageManagerProgressDeb822Fd : public PackageManager
  class PackageManagerProgressDeb822Fd : public PackageManager
  {
  {
-    void *d;
+    void * const d;
  protected:
  protected:
     int OutStatusFd;
     int OutStatusFd;
     int StepsDone;
     int StepsDone;
@@ -122,7 +122,7 @@ namespace Progress {
 
 
  class PackageManagerFancy : public PackageManager
  class PackageManagerFancy : public PackageManager
  {
  {
-    void *d;
+    void * const d;
  private:
  private:
     APT_HIDDEN static void staticSIGWINCH(int);
     APT_HIDDEN static void staticSIGWINCH(int);
     static std::vector<PackageManagerFancy*> instances;
     static std::vector<PackageManagerFancy*> instances;
@@ -158,7 +158,7 @@ namespace Progress {
 
 
  class PackageManagerText : public PackageManager
  class PackageManagerText : public PackageManager
  {
  {
-    void *d;
+    void * const d;
  public:
  public:
     virtual bool StatusChanged(std::string PackageName,
     virtual bool StatusChanged(std::string PackageName,
                                unsigned int StepsDone,
                                unsigned int StepsDone,

+ 1 - 1
apt-pkg/metaindex.cc

@@ -41,7 +41,7 @@ bool metaIndex::Merge(pkgCacheGenerator &Gen,OpProgress *) const
 
 
 metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
 metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
       char const * const Type)
       char const * const Type)
-: Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
+: d(NULL), Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
 {
 {
    /* nothing */
    /* nothing */
 }
 }

+ 1 - 1
apt-pkg/metaindex.h

@@ -28,7 +28,7 @@ class OpProgress;
 
 
 class metaIndex
 class metaIndex
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
    std::vector <pkgIndexFile *> *Indexes;
    std::vector <pkgIndexFile *> *Indexes;
    const char *Type;
    const char *Type;

+ 1 - 1
apt-pkg/orderlist.cc

@@ -86,7 +86,7 @@ pkgOrderList *pkgOrderList::Me = 0;
 // OrderList::pkgOrderList - Constructor				/*{{{*/
 // OrderList::pkgOrderList - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgOrderList::pkgOrderList(pkgDepCache *pCache) : Cache(*pCache),
+pkgOrderList::pkgOrderList(pkgDepCache *pCache) : d(NULL), Cache(*pCache),
 						  Primary(NULL), Secondary(NULL),
 						  Primary(NULL), Secondary(NULL),
 						  RevDepends(NULL), Remove(NULL),
 						  RevDepends(NULL), Remove(NULL),
 						  AfterEnd(NULL), FileList(NULL),
 						  AfterEnd(NULL), FileList(NULL),

+ 1 - 1
apt-pkg/orderlist.h

@@ -24,7 +24,7 @@
 class pkgDepCache;
 class pkgDepCache;
 class pkgOrderList : protected pkgCache::Namespace
 class pkgOrderList : protected pkgCache::Namespace
 {
 {
-   void *d;
+   void * const d;
    protected:
    protected:
 
 
    pkgDepCache &Cache;   
    pkgDepCache &Cache;   

+ 1 - 1
apt-pkg/packagemanager.cc

@@ -45,7 +45,7 @@ bool pkgPackageManager::SigINTStop = false;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 pkgPackageManager::pkgPackageManager(pkgDepCache *pCache) : Cache(*pCache),
 pkgPackageManager::pkgPackageManager(pkgDepCache *pCache) : Cache(*pCache),
-							    List(NULL), Res(Incomplete)
+							    List(NULL), Res(Incomplete), d(NULL)
 {
 {
    FileNames = new string[Cache.Head().PackageCount];
    FileNames = new string[Cache.Head().PackageCount];
    Debug = _config->FindB("Debug::pkgPackageManager",false);
    Debug = _config->FindB("Debug::pkgPackageManager",false);

+ 1 - 1
apt-pkg/packagemanager.h

@@ -145,7 +145,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    virtual ~pkgPackageManager();
    virtual ~pkgPackageManager();
 
 
    private:
    private:
-   void *d;
+   void * const d;
    enum APT_HIDDEN SmartAction { UNPACK_IMMEDIATE, UNPACK, CONFIGURE };
    enum APT_HIDDEN SmartAction { UNPACK_IMMEDIATE, UNPACK, CONFIGURE };
    APT_HIDDEN bool NonLoopingSmart(SmartAction const action, pkgCache::PkgIterator &Pkg,
    APT_HIDDEN bool NonLoopingSmart(SmartAction const action, pkgCache::PkgIterator &Pkg,
       pkgCache::PkgIterator DepPkg, int const Depth, bool const PkgLoop,
       pkgCache::PkgIterator DepPkg, int const Depth, bool const PkgLoop,

+ 1 - 1
apt-pkg/pkgcache.cc

@@ -122,7 +122,7 @@ bool pkgCache::Header::CheckSizes(Header &Against) const
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 APT_IGNORE_DEPRECATED_PUSH
 APT_IGNORE_DEPRECATED_PUSH
-pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
+pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map), d(NULL)
 {
 {
    // call getArchitectures() with cached=false to ensure that the 
    // call getArchitectures() with cached=false to ensure that the 
    // architectures cache is re-evaulated. this is needed in cases
    // architectures cache is re-evaulated. this is needed in cases

+ 1 - 1
apt-pkg/pkgcache.h

@@ -271,7 +271,7 @@ class pkgCache								/*{{{*/
    virtual ~pkgCache();
    virtual ~pkgCache();
 
 
 private:
 private:
-   void *d;
+   void * const d;
    bool MultiArchEnabled;
    bool MultiArchEnabled;
    APT_HIDDEN PkgIterator SingleArchFindPkg(const std::string &Name);
    APT_HIDDEN PkgIterator SingleArchFindPkg(const std::string &Name);
 };
 };

+ 2 - 2
apt-pkg/pkgcachegen.cc

@@ -54,7 +54,7 @@ using std::string;
 /* We set the dirty flag and make sure that is written to the disk */
 /* We set the dirty flag and make sure that is written to the disk */
 pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) :
 pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) :
 		    Map(*pMap), Cache(pMap,false), Progress(Prog),
 		    Map(*pMap), Cache(pMap,false), Progress(Prog),
-		     CurrentRlsFile(NULL), CurrentFile(NULL), FoundFileDeps(0)
+		     CurrentRlsFile(NULL), CurrentFile(NULL), FoundFileDeps(0), d(NULL)
 {
 {
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return;
       return;
@@ -1721,5 +1721,5 @@ bool pkgCacheGenerator::FinishCache(OpProgress * /*Progress*/)
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
-pkgCacheGenerator::ListParser::ListParser() : Owner(NULL), OldDepLast(NULL), FoundFileDeps(false) {}
+pkgCacheGenerator::ListParser::ListParser() : Owner(NULL), OldDepLast(NULL), FoundFileDeps(false), d(NULL) {}
 pkgCacheGenerator::ListParser::~ListParser() {}
 pkgCacheGenerator::ListParser::~ListParser() {}

+ 2 - 2
apt-pkg/pkgcachegen.h

@@ -125,7 +125,7 @@ class APT_HIDDEN pkgCacheGenerator					/*{{{*/
    virtual ~pkgCacheGenerator();
    virtual ~pkgCacheGenerator();
 
 
    private:
    private:
-   void *d;
+   void * const d;
    APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
    APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
    APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
    APT_HIDDEN bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
    APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
    APT_HIDDEN bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
@@ -152,7 +152,7 @@ class APT_HIDDEN pkgCacheGenerator::ListParser
    // Flag file dependencies
    // Flag file dependencies
    bool FoundFileDeps;
    bool FoundFileDeps;
 
 
-   void *d;
+   void * const d;
 
 
    protected:
    protected:
 
 

+ 1 - 1
apt-pkg/pkgrecords.cc

@@ -77,5 +77,5 @@ pkgRecords::Parser &pkgRecords::Lookup(pkgCache::DescFileIterator const &Desc)
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
-pkgRecords::Parser::Parser() {}
+pkgRecords::Parser::Parser() : d(NULL) {}
 pkgRecords::Parser::~Parser() {}
 pkgRecords::Parser::~Parser() {}

+ 2 - 2
apt-pkg/pkgrecords.h

@@ -31,7 +31,7 @@ class pkgRecords							/*{{{*/
    
    
    private:
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
    
    
    pkgCache &Cache;
    pkgCache &Cache;
    std::vector<Parser *>Files;
    std::vector<Parser *>Files;
@@ -111,7 +111,7 @@ class pkgRecords::Parser						/*{{{*/
    virtual ~Parser();
    virtual ~Parser();
 
 
    private:
    private:
-   void *d;
+   void * const d;
    APT_HIDDEN std::string GetHashFromHashes(char const * const type) const
    APT_HIDDEN std::string GetHashFromHashes(char const * const type) const
    {
    {
       HashStringList const hashes = Hashes();
       HashStringList const hashes = Hashes();

+ 2 - 1
apt-pkg/pkgsystem.cc

@@ -27,7 +27,8 @@ unsigned long pkgSystem::GlobalListLen = 0;
 // System::pkgSystem - Constructor					/*{{{*/
 // System::pkgSystem - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Add it to the global list.. */
 /* Add it to the global list.. */
-pkgSystem::pkgSystem() : Label(NULL), VS(NULL)
+pkgSystem::pkgSystem(char const * const label, pkgVersioningSystem * const vs) :
+   Label(label), VS(vs), d(NULL)
 {
 {
    assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
    assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList));
    SysList[GlobalListLen] = this;
    SysList[GlobalListLen] = this;

+ 5 - 5
apt-pkg/pkgsystem.h

@@ -60,8 +60,8 @@ class pkgSystem
    static unsigned long GlobalListLen;
    static unsigned long GlobalListLen;
    static pkgSystem *GetSystem(const char *Label);
    static pkgSystem *GetSystem(const char *Label);
    
    
-   const char *Label;
-   pkgVersioningSystem *VS;
+   const char * const Label;
+   pkgVersioningSystem * const VS;
    
    
    /* Prevent other programs from touching shared data not covered by
    /* Prevent other programs from touching shared data not covered by
       other locks (cache or state locks) */
       other locks (cache or state locks) */
@@ -90,11 +90,11 @@ class pkgSystem
    virtual signed Score(Configuration const &/*Cnf*/) {
    virtual signed Score(Configuration const &/*Cnf*/) {
       return 0;
       return 0;
    };
    };
-   
-   pkgSystem();
+
+   pkgSystem(char const * const Label, pkgVersioningSystem * const VS);
    virtual ~pkgSystem();
    virtual ~pkgSystem();
    private:
    private:
-   void *d;
+   void * const d;
 };
 };
 
 
 // The environment we are operating in.
 // The environment we are operating in.

+ 1 - 1
apt-pkg/policy.cc

@@ -45,7 +45,7 @@ using namespace std;
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Set the defaults for operation. The default mode with no loaded policy
 /* Set the defaults for operation. The default mode with no loaded policy
    file matches the V0 policy engine. */
    file matches the V0 policy engine. */
-pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
+pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner), d(NULL)
 {
 {
    if (Owner == 0)
    if (Owner == 0)
       return;
       return;

+ 2 - 2
apt-pkg/policy.h

@@ -88,8 +88,8 @@ class pkgPolicy : public pkgDepCache::Policy
    explicit pkgPolicy(pkgCache *Owner);
    explicit pkgPolicy(pkgCache *Owner);
    virtual ~pkgPolicy();
    virtual ~pkgPolicy();
    private:
    private:
-   pkgCache::VerIterator GetCandidateVerNew(pkgCache::PkgIterator const &Pkg);
-   void *d;
+   APT_HIDDEN pkgCache::VerIterator GetCandidateVerNew(pkgCache::PkgIterator const &Pkg);
+   void * const d;
 };
 };
 
 
 bool ReadPinFile(pkgPolicy &Plcy, std::string File = "");
 bool ReadPinFile(pkgPolicy &Plcy, std::string File = "");

+ 2 - 2
apt-pkg/sourcelist.cc

@@ -236,11 +236,11 @@ bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List,
 // SourceList::pkgSourceList - Constructors				/*{{{*/
 // SourceList::pkgSourceList - Constructors				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgSourceList::pkgSourceList()
+pkgSourceList::pkgSourceList() : d(NULL)
 {
 {
 }
 }
 
 
-pkgSourceList::pkgSourceList(string File)
+pkgSourceList::pkgSourceList(string File) : d(NULL)
 {
 {
    Read(File);
    Read(File);
 }
 }

+ 1 - 1
apt-pkg/sourcelist.h

@@ -53,7 +53,7 @@ class metaIndex;
 
 
 class pkgSourceList
 class pkgSourceList
 {
 {
-   void *d;
+   void * const d;
    public:
    public:
 
 
    // List of supported source list types
    // List of supported source list types

+ 1 - 1
apt-pkg/srcrecords.cc

@@ -180,5 +180,5 @@ bool pkgSrcRecords::Parser::Files2(std::vector<pkgSrcRecords::File2> &F2)/*{{{*/
 									/*}}}*/
 									/*}}}*/
 
 
 
 
-pkgSrcRecords::Parser::Parser(const pkgIndexFile *Index) : iIndex(Index) {}
+pkgSrcRecords::Parser::Parser(const pkgIndexFile *Index) : d(NULL), iIndex(Index) {}
 pkgSrcRecords::Parser::~Parser() {}
 pkgSrcRecords::Parser::~Parser() {}

+ 2 - 2
apt-pkg/srcrecords.h

@@ -48,7 +48,7 @@ APT_IGNORE_DEPRECATED_POP
    // Abstract parser for each source record
    // Abstract parser for each source record
    class Parser
    class Parser
    {
    {
-      void *d;
+      void * const d;
       protected:
       protected:
       
       
       const pkgIndexFile *iIndex;
       const pkgIndexFile *iIndex;
@@ -93,7 +93,7 @@ APT_IGNORE_DEPRECATED_POP
    
    
    private:
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
    
    
    // The list of files and the current parser pointer
    // The list of files and the current parser pointer
    std::vector<Parser*> Files;
    std::vector<Parser*> Files;

+ 24 - 22
apt-pkg/tagfile.cc

@@ -32,13 +32,22 @@ using std::string;
 class pkgTagFilePrivate
 class pkgTagFilePrivate
 {
 {
 public:
 public:
-   pkgTagFilePrivate(FileFd *pFd, unsigned long long Size) : Fd(*pFd), Buffer(NULL),
-							     Start(NULL), End(NULL),
-							     Done(false), iOffset(0),
-							     Size(Size)
+   void Reset(FileFd * const pFd, unsigned long long const pSize)
    {
    {
+      Fd = pFd;
+      Buffer = NULL;
+      Start = NULL;
+      End = NULL;
+      Done = false;
+      iOffset = 0;
+      Size = pSize;
    }
    }
-   FileFd &Fd;
+
+   pkgTagFilePrivate(FileFd * const pFd, unsigned long long const Size)
+   {
+      Reset(pFd, Size);
+   }
+   FileFd * Fd;
    char *Buffer;
    char *Buffer;
    char *Start;
    char *Start;
    char *End;
    char *End;
@@ -83,27 +92,21 @@ static unsigned long AlphaHash(const char *Text, size_t Length)		/*{{{*/
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size)
-   : d(NULL)
+pkgTagFile::pkgTagFile(FileFd * const pFd,unsigned long long const Size)
+   : d(new pkgTagFilePrivate(pFd, Size + 4))
 {
 {
    Init(pFd, Size);
    Init(pFd, Size);
 }
 }
-
-void pkgTagFile::Init(FileFd *pFd,unsigned long long Size)
+void pkgTagFile::Init(FileFd * const pFd,unsigned long long Size)
 {
 {
    /* The size is increased by 4 because if we start with the Size of the
    /* The size is increased by 4 because if we start with the Size of the
       filename we need to try to read 1 char more to see an EOF faster, 1
       filename we need to try to read 1 char more to see an EOF faster, 1
       char the end-pointer can be on and maybe 2 newlines need to be added
       char the end-pointer can be on and maybe 2 newlines need to be added
       to the end of the file -> 4 extra chars */
       to the end of the file -> 4 extra chars */
    Size += 4;
    Size += 4;
-   if(d != NULL)
-   {
-      free(d->Buffer);
-      delete d;
-   }
-   d = new pkgTagFilePrivate(pFd, Size);
+   d->Reset(pFd, Size);
 
 
-   if (d->Fd.IsOpen() == false)
+   if (d->Fd->IsOpen() == false)
       d->Start = d->End = d->Buffer = 0;
       d->Start = d->End = d->Buffer = 0;
    else
    else
       d->Buffer = (char*)malloc(sizeof(char) * Size);
       d->Buffer = (char*)malloc(sizeof(char) * Size);
@@ -184,7 +187,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
 
 
 	 if (Resize() == false)
 	 if (Resize() == false)
 	    return _error->Error(_("Unable to parse package file %s (%d)"),
 	    return _error->Error(_("Unable to parse package file %s (%d)"),
-		  d->Fd.Name().c_str(), 1);
+		  d->Fd->Name().c_str(), 1);
 
 
       } while (Tag.Scan(d->Start,d->End - d->Start, false) == false);
       } while (Tag.Scan(d->Start,d->End - d->Start, false) == false);
    }
    }
@@ -213,7 +216,7 @@ bool pkgTagFile::Fill()
    {
    {
       // See if only a bit of the file is left
       // See if only a bit of the file is left
       unsigned long long const dataSize = d->Size - ((d->End - d->Buffer) + 1);
       unsigned long long const dataSize = d->Size - ((d->End - d->Buffer) + 1);
-      if (d->Fd.Read(d->End, dataSize, &Actual) == false)
+      if (d->Fd->Read(d->End, dataSize, &Actual) == false)
 	 return false;
 	 return false;
       if (Actual != dataSize)
       if (Actual != dataSize)
 	 d->Done = true;
 	 d->Done = true;
@@ -268,7 +271,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
    // Reposition and reload..
    // Reposition and reload..
    d->iOffset = Offset;
    d->iOffset = Offset;
    d->Done = false;
    d->Done = false;
-   if (d->Fd.Seek(Offset) == false)
+   if (d->Fd->Seek(Offset) == false)
       return false;
       return false;
    d->End = d->Start = d->Buffer;
    d->End = d->Start = d->Buffer;
    
    
@@ -283,7 +286,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
       return false;
       return false;
    
    
    if (Tag.Scan(d->Start, d->End - d->Start, false) == false)
    if (Tag.Scan(d->Start, d->End - d->Start, false) == false)
-      return _error->Error(_("Unable to parse package file %s (%d)"),d->Fd.Name().c_str(), 2);
+      return _error->Error(_("Unable to parse package file %s (%d)"),d->Fd->Name().c_str(), 2);
    
    
    return true;
    return true;
 }
 }
@@ -293,9 +296,8 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
 /* */
 /* */
 APT_IGNORE_DEPRECATED_PUSH
 APT_IGNORE_DEPRECATED_PUSH
 pkgTagSection::pkgTagSection()
 pkgTagSection::pkgTagSection()
-   : Section(0), d(NULL), Stop(0)
+   : Section(0), d(new pkgTagSectionPrivate()), Stop(0)
 {
 {
-   d = new pkgTagSectionPrivate();
 #if APT_PKG_ABI < 413
 #if APT_PKG_ABI < 413
    TagCount = 0;
    TagCount = 0;
    memset(&Indexes, 0, sizeof(Indexes));
    memset(&Indexes, 0, sizeof(Indexes));

+ 4 - 4
apt-pkg/tagfile.h

@@ -46,7 +46,7 @@ class pkgTagSection
    APT_DEPRECATED unsigned int TagCount;
    APT_DEPRECATED unsigned int TagCount;
 #endif
 #endif
 
 
-   pkgTagSectionPrivate *d;
+   pkgTagSectionPrivate * const d;
 
 
    protected:
    protected:
    const char *Stop;
    const char *Stop;
@@ -145,7 +145,7 @@ class pkgTagSection
 class pkgTagFilePrivate;
 class pkgTagFilePrivate;
 class pkgTagFile
 class pkgTagFile
 {
 {
-   pkgTagFilePrivate *d;
+   pkgTagFilePrivate * const d;
 
 
    APT_HIDDEN bool Fill();
    APT_HIDDEN bool Fill();
    APT_HIDDEN bool Resize();
    APT_HIDDEN bool Resize();
@@ -157,9 +157,9 @@ class pkgTagFile
    unsigned long Offset();
    unsigned long Offset();
    bool Jump(pkgTagSection &Tag,unsigned long long Offset);
    bool Jump(pkgTagSection &Tag,unsigned long long Offset);
 
 
-   void Init(FileFd *F,unsigned long long Size = 32*1024);
+   void Init(FileFd * const F,unsigned long long const Size = 32*1024);
 
 
-   pkgTagFile(FileFd *F,unsigned long long Size = 32*1024);
+   pkgTagFile(FileFd * const F,unsigned long long Size = 32*1024);
    virtual ~pkgTagFile();
    virtual ~pkgTagFile();
 };
 };