Browse Source

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 8 years ago
parent
commit
6c55f07a5f
72 changed files with 244 additions and 234 deletions
  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
 pkgAcquire::Item::Item(pkgAcquire * const owner) :
    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);
    Status = StatIdle;
@@ -662,7 +662,7 @@ std::string pkgAcquire::Item::HashSum() const				/*{{{*/
 
 pkgAcqTransactionItem::pkgAcqTransactionItem(pkgAcquire * const Owner,	/*{{{*/
       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)
       TransactionManager->Add(this);
@@ -684,7 +684,7 @@ pkgAcqMetaBase::pkgAcqMetaBase(pkgAcquire * const Owner,
       std::vector<IndexTarget> const &IndexTargets,
       IndexTarget const &DataTarget,
       indexRecords * const MetaIndexParser)
-: pkgAcqTransactionItem(Owner, TransactionManager, DataTarget),
+: pkgAcqTransactionItem(Owner, TransactionManager, DataTarget), d(NULL),
    MetaIndexParser(MetaIndexParser), LastMetaIndexParser(NULL), IndexTargets(IndexTargets),
    AuthPass(false), IMSHit(false)
 {
@@ -1106,7 +1106,7 @@ pkgAcqMetaClearSig::pkgAcqMetaClearSig(pkgAcquire * const Owner,	/*{{{*/
       std::vector<IndexTarget> const &IndexTargets,
       indexRecords * const MetaIndexParser) :
    pkgAcqMetaIndex(Owner, this, ClearsignedTarget, DetachedSigTarget, IndexTargets, MetaIndexParser),
-   ClearsignedTarget(ClearsignedTarget),
+   d(NULL), ClearsignedTarget(ClearsignedTarget),
    DetachedDataTarget(DetachedDataTarget)
 {
    // index targets + (worst case:) Release/Release.gpg
@@ -1245,7 +1245,7 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire * const Owner,		/*{{{*/
 				 IndexTarget const &DetachedSigTarget,
 				 vector<IndexTarget> const &IndexTargets,
 				 indexRecords * const MetaIndexParser) :
-   pkgAcqMetaBase(Owner, TransactionManager, IndexTargets, DataTarget, MetaIndexParser),
+   pkgAcqMetaBase(Owner, TransactionManager, IndexTargets, DataTarget, MetaIndexParser), d(NULL),
    DetachedSigTarget(DetachedSigTarget)
 {
    if(_config->FindB("Debug::Acquire::Transaction", false) == true)
@@ -1327,7 +1327,7 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire * const Owner,
       pkgAcqMetaBase * const TransactionManager,
       IndexTarget const &Target,
       pkgAcqMetaIndex * const MetaIndex) :
-   pkgAcqTransactionItem(Owner, TransactionManager, Target), MetaIndex(MetaIndex)
+   pkgAcqTransactionItem(Owner, TransactionManager, Target), d(NULL), MetaIndex(MetaIndex)
 {
    DestFile = GetPartialFileNameFromURI(Target.URI);
 
@@ -1489,7 +1489,7 @@ void pkgAcqMetaSig::Failed(string const &Message,pkgAcquire::MethodConfig const
 pkgAcqBaseIndex::pkgAcqBaseIndex(pkgAcquire * const Owner,
       pkgAcqMetaBase * const TransactionManager,
       IndexTarget const &Target)
-: pkgAcqTransactionItem(Owner, TransactionManager, Target)
+: pkgAcqTransactionItem(Owner, TransactionManager, Target), d(NULL)
 {
 }
 									/*}}}*/
@@ -1505,7 +1505,7 @@ pkgAcqBaseIndex::~pkgAcqBaseIndex() {}
 pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire * const Owner,
                                  pkgAcqMetaBase * const TransactionManager,
                                  IndexTarget const &Target)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target)
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL)
 {
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
 
@@ -1907,7 +1907,7 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire * const Owner,
                                    pkgAcqMetaBase * const TransactionManager,
                                    IndexTarget const &Target,
 				   vector<DiffInfo> const &diffs)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target),
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
      available_patches(diffs)
 {
    DestFile = GetPartialFileNameFromURI(Target.URI);
@@ -2131,7 +2131,7 @@ pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire * const Owner,
                                              IndexTarget const &Target,
                                              DiffInfo const &patch,
                                              std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches)
-  : pkgAcqBaseIndex(Owner, TransactionManager, Target),
+  : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
      patch(patch), allPatches(allPatches), State(StateFetchDiff)
 {
    Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
@@ -2274,7 +2274,7 @@ pkgAcqIndexMergeDiffs::~pkgAcqIndexMergeDiffs() {}
 pkgAcqIndex::pkgAcqIndex(pkgAcquire * const Owner,
                          pkgAcqMetaBase * const TransactionManager,
                          IndexTarget const &Target)
-   : pkgAcqBaseIndex(Owner, TransactionManager, Target), Stage(STAGE_DOWNLOAD)
+   : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL), Stage(STAGE_DOWNLOAD)
 {
    // autoselect the compression method
    AutoSelectCompression();
@@ -2555,7 +2555,7 @@ pkgAcqIndex::~pkgAcqIndex() {}
 pkgAcqArchive::pkgAcqArchive(pkgAcquire * const Owner,pkgSourceList * const Sources,
 			     pkgRecords * const Recs,pkgCache::VerIterator const &Version,
 			     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()),
 	       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,
 		       const string &DestDir, const string &DestFilename,
                        bool const IsIndexFile) :
-                       Item(Owner), IsIndexFile(IsIndexFile), ExpectedHashes(Hashes)
+                       Item(Owner), d(NULL), IsIndexFile(IsIndexFile), ExpectedHashes(Hashes)
 {
    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;
 
    private:
-   void *d;
+   void * const d;
 
    friend class pkgAcqMetaBase;
 };
@@ -344,7 +344,7 @@ class pkgAcquire::Item : public WeakPointable				/*{{{*/
 class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item		/*{{{*/
 /** \brief baseclass for the indexes files to manage them all together */
 {
-   void *d;
+   void * const d;
    protected:
    IndexTarget const Target;
    HashStringList GetExpectedHashesFor(std::string const &MetaKey) const;
@@ -379,7 +379,7 @@ class APT_HIDDEN pkgAcqTransactionItem: public pkgAcquire::Item		/*{{{*/
 class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem		/*{{{*/
 /** \brief the manager of a transaction */
 {
-   void *d;
+   void * const d;
  protected:
    std::vector<pkgAcqTransactionItem*> Transaction;
 
@@ -492,7 +492,7 @@ class APT_HIDDEN pkgAcqMetaBase : public pkgAcqTransactionItem		/*{{{*/
  */
 class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
 {
-   void *d;
+   void * const d;
    protected:
    IndexTarget const DetachedSigTarget;
 
@@ -527,7 +527,7 @@ class APT_HIDDEN pkgAcqMetaIndex : public pkgAcqMetaBase
  */
 class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
 {
-   void *d;
+   void * const d;
 
    pkgAcqMetaIndex * const MetaIndex;
 
@@ -556,7 +556,7 @@ class APT_HIDDEN pkgAcqMetaSig : public pkgAcqTransactionItem
 /** \brief An item repsonsible for downloading clearsigned metaindexes	{{{*/
 class APT_HIDDEN pkgAcqMetaClearSig : public pkgAcqMetaIndex
 {
-   void *d;
+   void * const d;
 
    IndexTarget const ClearsignedTarget;
    IndexTarget const DetachedDataTarget;
@@ -580,7 +580,7 @@ public:
 /** \brief Common base class for all classes that deal with fetching indexes	{{{*/
 class APT_HIDDEN pkgAcqBaseIndex : public pkgAcqTransactionItem
 {
-   void *d;
+   void * const d;
 
  public:
    /** \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
 {
-   void *d;
+   void * const d;
 
  protected:
    /** \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
 {
-   void *d;
+   void * const d;
 
    protected:
 
@@ -768,7 +768,7 @@ class APT_HIDDEN pkgAcqIndexMergeDiffs : public pkgAcqBaseIndex
  */
 class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
 {
-   void *d;
+   void * const d;
 
    private:
 
@@ -878,7 +878,7 @@ class APT_HIDDEN pkgAcqIndexDiffs : public pkgAcqBaseIndex
  */
 class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
 {
-   void *d;
+   void * const d;
 
    protected:
 
@@ -957,7 +957,7 @@ class APT_HIDDEN pkgAcqIndex : public pkgAcqBaseIndex
  */
 class pkgAcqArchive : public pkgAcquire::Item
 {
-   void *d;
+   void * const d;
 
    bool LocalSource;
    HashStringList ExpectedHashes;
@@ -1045,7 +1045,7 @@ class pkgAcqArchive : public pkgAcquire::Item
  */
 class pkgAcqChangelog : public pkgAcquire::Item
 {
-   void *d;
+   void * const d;
    std::string TemporaryDirectory;
    std::string const SrcName;
    std::string const SrcVersion;
@@ -1160,7 +1160,7 @@ private:
  */
 class pkgAcqFile : public pkgAcquire::Item
 {
-   void *d;
+   void * const d;
 
    /** \brief How many times to retry the download, set from
     *  Acquire::Retries.

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

@@ -457,7 +457,7 @@ void pkgAcqMethod::Redirect(const string &NewURI)
 // ---------------------------------------------------------------------
 /* */
 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::FetchItem::FetchItem() {}
+pkgAcqMethod::FetchItem::FetchItem() : d(NULL) {}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 
 pkgAcqMethod::FetchResult::~FetchResult() {}

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

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

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

@@ -47,7 +47,7 @@ using namespace std;
 // ---------------------------------------------------------------------
 /* */
 pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
-			   pkgAcquireStatus *log) : Log(log)
+			   pkgAcquireStatus *log) : d(NULL), Log(log)
 {
    OwnerQ = Q;
    Config = Cnf;
@@ -62,15 +62,10 @@ pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
 // 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();
 }
 									/*}}}*/

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

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

+ 2 - 2
apt-pkg/acquire.cc

@@ -51,13 +51,13 @@ using namespace std;
 // Acquire::pkgAcquire - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* 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)),
 			   Running(false)
 {
    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),
 			   Debug(_config->FindB("Debug::pkgAcquire",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) */
    int LockFD;
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    public:
    
@@ -411,7 +411,7 @@ class pkgAcquire::Queue
    friend class pkgAcquire::Worker;
 
    /** \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. */
    Queue *Next;
@@ -596,7 +596,7 @@ class pkgAcquire::Queue
 class pkgAcquire::UriIterator
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    /** The next queue to iterate over. */
    pkgAcquire::Queue *CurQ;
@@ -633,7 +633,7 @@ class pkgAcquire::UriIterator
 struct pkgAcquire::MethodConfig
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
    
    /** \brief The next link on the acquire method list.
     *
@@ -694,7 +694,7 @@ struct pkgAcquire::MethodConfig
 class pkgAcquireStatus
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    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, 
    this is not necessary since the pkgCaches are fully shared now. */
 pkgSimulate::pkgSimulate(pkgDepCache *Cache) : pkgPackageManager(Cache),
-		            iPolicy(Cache),
+		            d(NULL), iPolicy(Cache),
 			    Sim(&Cache->GetCache(),&iPolicy),
 			    group(Sim)
 {

+ 2 - 2
apt-pkg/algorithms.h

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

+ 1 - 1
apt-pkg/cachefile.h

@@ -37,7 +37,7 @@ class OpProgress;
 class pkgCacheFile
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    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) :
-   ShowError(ShowError), ErrorType(ErrorType) {}
+   ShowError(ShowError), ErrorType(ErrorType), d(NULL) {}
 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() {}
 
-PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner) { }
+PackageUniverse::PackageUniverse(pkgCache * const Owner) : _cont(Owner), d(NULL) { }
 PackageUniverse::~PackageUniverse() {}
 
-VersionContainerInterface::VersionContainerInterface() {}
+VersionContainerInterface::VersionContainerInterface() : d(NULL) {}
+VersionContainerInterface& VersionContainerInterface::operator=(VersionContainerInterface const &) {
+   return *this;
+}
+
 VersionContainerInterface::~VersionContainerInterface() {}
 }

+ 6 - 4
apt-pkg/cacheset.h

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

+ 3 - 3
apt-pkg/cdrom.cc

@@ -917,7 +917,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
 }
 									/*}}}*/
 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_device_new_from_syspath(NULL), udev_enumerate_get_udev(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() {}
 
-pkgCdrom::pkgCdrom() {}
+pkgCdrom::pkgCdrom() : d(NULL) {}
 pkgCdrom::~pkgCdrom() {}

+ 3 - 3
apt-pkg/cdrom.h

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

+ 1 - 1
apt-pkg/clean.h

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

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

@@ -1011,6 +1011,25 @@ class FileFdPrivate {							/*{{{*/
 	~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						/*{{{*/
 // ---------------------------------------------------------------------
 /* 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 IsCompressed() {return (Flags & Compressed) == Compressed;};
    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();
 
    private:
-   FileFdPrivate* d;
+   FileFdPrivate * d;
+   APT_HIDDEN FileFd & operator=(const FileFd &);
    APT_HIDDEN bool OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor);
 
    // 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;
 
    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			/*{{{*/
@@ -372,19 +384,8 @@ APT_IGNORE_DEPRECATED_POP
    return hashes;
 }
 APT_IGNORE_DEPRECATED_PUSH
-Hashes::Hashes() { d = new PrivateHashes(~0); }
-Hashes::Hashes(unsigned int const Hashes) { d = new PrivateHashes(Hashes); }
-Hashes::Hashes(HashStringList const &Hashes) {
-   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; }
 APT_IGNORE_DEPRECATED_POP

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

@@ -182,7 +182,7 @@ class HashStringList
 class PrivateHashes;
 class Hashes
 {
-   PrivateHashes *d;
+   PrivateHashes * const d;
 
    public:
    /* 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) :
-     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)
 {
 }
 

+ 6 - 6
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;

+ 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
    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");

+ 1 - 1
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;

+ 3 - 3
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<pkgIndexFile *>();

+ 2 - 2
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<std::string, std::vector<debSectionEntry const*> > 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:

+ 3 - 3
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() {}

+ 3 - 3
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;
 

+ 1 - 1
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		/*{{{*/

+ 1 - 1
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;

+ 1 - 4
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					/*{{{*/

+ 1 - 1
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:

+ 2 - 3
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					/*{{{*/

+ 1 - 1
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
 

+ 2 - 2
apt-pkg/depcache.cc

@@ -63,7 +63,7 @@ ConfigValueInSubTree(const char* SubTree, const char *needle)
 }
 									/*}}}*/
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :		/*{{{*/
-  cache(cache), released(false)
+  d(NULL), cache(cache), released(false)
 {
   ++cache.group_level;
 }
@@ -97,7 +97,7 @@ pkgDepCache::ActionGroup::~ActionGroup()
 pkgDepCache::pkgDepCache(pkgCache *pCache,Policy *Plcy) :
   group_level(0), Cache(pCache), PkgState(0), DepState(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);
    DebugAutoInstall = _config->FindB("Debug::pkgDepCache::AutoInstall", false);

+ 2 - 2
apt-pkg/depcache.h

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

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

@@ -29,7 +29,7 @@
 // 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
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    public:
 

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

@@ -22,7 +22,7 @@
 									/*}}}*/
 
 // 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		/*{{{*/

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

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

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

@@ -26,13 +26,9 @@
 #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					/*{{{*/

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

@@ -25,7 +25,7 @@ class edspIndex;
 class APT_HIDDEN edspSystem : public pkgSystem
 {
    /** \brief dpointer placeholder (for later in case we need it) */
-   void *d;
+   void * const d;
 
    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() {}
 
-PackageCopy::PackageCopy() : IndexCopy() {}
+PackageCopy::PackageCopy() : IndexCopy(), d(NULL) {}
 APT_CONST PackageCopy::~PackageCopy() {}
-SourceCopy::SourceCopy() : IndexCopy() {}
+SourceCopy::SourceCopy() : IndexCopy(), d(NULL) {}
 APT_CONST SourceCopy::~SourceCopy() {}
-TranslationsCopy::TranslationsCopy() {}
+TranslationsCopy::TranslationsCopy() : d(NULL) {}
 APT_CONST TranslationsCopy::~TranslationsCopy() {}
-SigVerify::SigVerify() {}
+SigVerify::SigVerify() : d(NULL) {}
 APT_CONST SigVerify::~SigVerify() {}

+ 5 - 5
apt-pkg/indexcopy.h

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

+ 2 - 2
apt-pkg/indexfile.cc

@@ -53,7 +53,7 @@ pkgIndexFile::Type *pkgIndexFile::Type::GetType(const char *Type)
 }
 									/*}}}*/
 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) :/*{{{*/
-   pkgIndexFile(Trusted), Target(Target)
+   pkgIndexFile(Trusted), d(NULL), Target(Target)
 {
 }
 									/*}}}*/

+ 2 - 2
apt-pkg/indexfile.h

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

+ 1 - 1
apt-pkg/indexrecords.h

@@ -27,7 +27,7 @@ class indexRecords
    private:
    enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
    // dpointer (for later)
-   void * d;
+   void * const d;
 
    protected:
    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)
-   : StepsDone(0), StepsTotal(1)
+   : d(NULL), StepsDone(0), StepsTotal(1)
 {
    OutStatusFd = progress_fd;
 }
@@ -154,7 +154,7 @@ bool PackageManagerProgressFd::StatusChanged(std::string PackageName,
 
 
 PackageManagerProgressDeb822Fd::PackageManagerProgressDeb822Fd(int progress_fd)
-   : StepsDone(0), StepsTotal(1)
+   : d(NULL), StepsDone(0), StepsTotal(1)
 {
    OutStatusFd = progress_fd;
 }
@@ -235,7 +235,7 @@ bool PackageManagerProgressDeb822Fd::StatusChanged(std::string PackageName,
 
 
 PackageManagerFancy::PackageManagerFancy()
-   : child_pty(-1)
+   : d(NULL), child_pty(-1)
 {
    // setup terminal size
    old_SIGWINCH = signal(SIGWINCH, PackageManagerFancy::staticSIGWINCH);
@@ -435,7 +435,7 @@ bool PackageManagerText::StatusChanged(std::string PackageName,
    return true;
 }
 
-PackageManagerText::PackageManagerText() : PackageManager() {}
+PackageManagerText::PackageManagerText() : PackageManager(), d(NULL) {}
 PackageManagerText::~PackageManagerText() {}
 
 

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

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

+ 1 - 1
apt-pkg/metaindex.h

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

+ 1 - 1
apt-pkg/orderlist.cc

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

+ 1 - 1
apt-pkg/orderlist.h

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

+ 1 - 1
apt-pkg/packagemanager.cc

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

+ 1 - 1
apt-pkg/packagemanager.h

@@ -145,7 +145,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    virtual ~pkgPackageManager();
 
    private:
-   void *d;
+   void * const d;
    enum APT_HIDDEN SmartAction { UNPACK_IMMEDIATE, UNPACK, CONFIGURE };
    APT_HIDDEN bool NonLoopingSmart(SmartAction const action, pkgCache::PkgIterator &Pkg,
       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
-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 
    // architectures cache is re-evaulated. this is needed in cases

+ 1 - 1
apt-pkg/pkgcache.h

@@ -271,7 +271,7 @@ class pkgCache								/*{{{*/
    virtual ~pkgCache();
 
 private:
-   void *d;
+   void * const d;
    bool MultiArchEnabled;
    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 */
 pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *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)
       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() {}

+ 2 - 2
apt-pkg/pkgcachegen.h

@@ -125,7 +125,7 @@ class APT_HIDDEN pkgCacheGenerator					/*{{{*/
    virtual ~pkgCacheGenerator();
 
    private:
-   void *d;
+   void * const d;
    APT_HIDDEN bool MergeListGroup(ListParser &List, std::string const &GrpName);
    APT_HIDDEN bool MergeListPackage(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
    bool FoundFileDeps;
 
-   void *d;
+   void * const d;
 
    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() {}

+ 2 - 2
apt-pkg/pkgrecords.h

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

+ 2 - 1
apt-pkg/pkgsystem.cc

@@ -27,7 +27,8 @@ unsigned long pkgSystem::GlobalListLen = 0;
 // System::pkgSystem - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* 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));
    SysList[GlobalListLen] = this;

+ 5 - 5
apt-pkg/pkgsystem.h

@@ -60,8 +60,8 @@ class pkgSystem
    static unsigned long GlobalListLen;
    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
       other locks (cache or state locks) */
@@ -90,11 +90,11 @@ class pkgSystem
    virtual signed Score(Configuration const &/*Cnf*/) {
       return 0;
    };
-   
-   pkgSystem();
+
+   pkgSystem(char const * const Label, pkgVersioningSystem * const VS);
    virtual ~pkgSystem();
    private:
-   void *d;
+   void * const d;
 };
 
 // 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
    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)
       return;

+ 2 - 2
apt-pkg/policy.h

@@ -88,8 +88,8 @@ class pkgPolicy : public pkgDepCache::Policy
    explicit pkgPolicy(pkgCache *Owner);
    virtual ~pkgPolicy();
    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 = "");

+ 2 - 2
apt-pkg/sourcelist.cc

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

+ 1 - 1
apt-pkg/sourcelist.h

@@ -53,7 +53,7 @@ class metaIndex;
 
 class pkgSourceList
 {
-   void *d;
+   void * const d;
    public:
 
    // 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() {}

+ 2 - 2
apt-pkg/srcrecords.h

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

+ 24 - 22
apt-pkg/tagfile.cc

@@ -32,13 +32,22 @@ using std::string;
 class pkgTagFilePrivate
 {
 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 *Start;
    char *End;
@@ -83,27 +92,21 @@ static unsigned long AlphaHash(const char *Text, size_t Length)		/*{{{*/
 // 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);
 }
-
-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
       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
       to the end of the file -> 4 extra chars */
    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;
    else
       d->Buffer = (char*)malloc(sizeof(char) * Size);
@@ -184,7 +187,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
 
 	 if (Resize() == false)
 	    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);
    }
@@ -213,7 +216,7 @@ bool pkgTagFile::Fill()
    {
       // See if only a bit of the file is left
       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;
       if (Actual != dataSize)
 	 d->Done = true;
@@ -268,7 +271,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
    // Reposition and reload..
    d->iOffset = Offset;
    d->Done = false;
-   if (d->Fd.Seek(Offset) == false)
+   if (d->Fd->Seek(Offset) == false)
       return false;
    d->End = d->Start = d->Buffer;
    
@@ -283,7 +286,7 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
       return 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;
 }
@@ -293,9 +296,8 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
 /* */
 APT_IGNORE_DEPRECATED_PUSH
 pkgTagSection::pkgTagSection()
-   : Section(0), d(NULL), Stop(0)
+   : Section(0), d(new pkgTagSectionPrivate()), Stop(0)
 {
-   d = new pkgTagSectionPrivate();
 #if APT_PKG_ABI < 413
    TagCount = 0;
    memset(&Indexes, 0, sizeof(Indexes));

+ 4 - 4
apt-pkg/tagfile.h

@@ -46,7 +46,7 @@ class pkgTagSection
    APT_DEPRECATED unsigned int TagCount;
 #endif
 
-   pkgTagSectionPrivate *d;
+   pkgTagSectionPrivate * const d;
 
    protected:
    const char *Stop;
@@ -145,7 +145,7 @@ class pkgTagSection
 class pkgTagFilePrivate;
 class pkgTagFile
 {
-   pkgTagFilePrivate *d;
+   pkgTagFilePrivate * const d;
 
    APT_HIDDEN bool Fill();
    APT_HIDDEN bool Resize();
@@ -157,9 +157,9 @@ class pkgTagFile
    unsigned 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();
 };