summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-17 09:29:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-10 17:25:25 +0200
commit6c55f07a5fa3612a5d59c61a17da5fe640eadc8b (patch)
treee63587b9caf9781cb4606e0a95b4f19d7b727f92
parente8afd16892e87a6e2f17c1019ee455f5583387c2 (diff)
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
-rw-r--r--apt-pkg/acquire-item.cc26
-rw-r--r--apt-pkg/acquire-item.h28
-rw-r--r--apt-pkg/acquire-method.cc4
-rw-r--r--apt-pkg/acquire-method.h4
-rw-r--r--apt-pkg/acquire-worker.cc13
-rw-r--r--apt-pkg/acquire-worker.h2
-rw-r--r--apt-pkg/acquire.cc4
-rw-r--r--apt-pkg/acquire.h10
-rw-r--r--apt-pkg/algorithms.cc2
-rw-r--r--apt-pkg/algorithms.h4
-rw-r--r--apt-pkg/cachefile.h2
-rw-r--r--apt-pkg/cacheset.cc19
-rw-r--r--apt-pkg/cacheset.h10
-rw-r--r--apt-pkg/cdrom.cc6
-rw-r--r--apt-pkg/cdrom.h6
-rw-r--r--apt-pkg/clean.cc2
-rw-r--r--apt-pkg/clean.h2
-rw-r--r--apt-pkg/contrib/fileutl.cc19
-rw-r--r--apt-pkg/contrib/fileutl.h27
-rw-r--r--apt-pkg/contrib/hashes.cc29
-rw-r--r--apt-pkg/contrib/hashes.h2
-rw-r--r--apt-pkg/deb/debindexfile.cc12
-rw-r--r--apt-pkg/deb/debindexfile.h12
-rw-r--r--apt-pkg/deb/deblistparser.cc2
-rw-r--r--apt-pkg/deb/deblistparser.h2
-rw-r--r--apt-pkg/deb/debmetaindex.cc6
-rw-r--r--apt-pkg/deb/debmetaindex.h4
-rw-r--r--apt-pkg/deb/debrecords.cc6
-rw-r--r--apt-pkg/deb/debrecords.h6
-rw-r--r--apt-pkg/deb/debsrcrecords.cc2
-rw-r--r--apt-pkg/deb/debsrcrecords.h2
-rw-r--r--apt-pkg/deb/debsystem.cc5
-rw-r--r--apt-pkg/deb/debsystem.h2
-rw-r--r--apt-pkg/deb/dpkgpm.cc5
-rw-r--r--apt-pkg/deb/dpkgpm.h2
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--apt-pkg/depcache.h4
-rw-r--r--apt-pkg/edsp/edspindexfile.cc2
-rw-r--r--apt-pkg/edsp/edspindexfile.h2
-rw-r--r--apt-pkg/edsp/edsplistparser.cc2
-rw-r--r--apt-pkg/edsp/edsplistparser.h2
-rw-r--r--apt-pkg/edsp/edspsystem.cc8
-rw-r--r--apt-pkg/edsp/edspsystem.h2
-rw-r--r--apt-pkg/indexcopy.cc10
-rw-r--r--apt-pkg/indexcopy.h10
-rw-r--r--apt-pkg/indexfile.cc4
-rw-r--r--apt-pkg/indexfile.h4
-rw-r--r--apt-pkg/indexrecords.h2
-rw-r--r--apt-pkg/install-progress.cc8
-rw-r--r--apt-pkg/install-progress.h10
-rw-r--r--apt-pkg/metaindex.cc2
-rw-r--r--apt-pkg/metaindex.h2
-rw-r--r--apt-pkg/orderlist.cc2
-rw-r--r--apt-pkg/orderlist.h2
-rw-r--r--apt-pkg/packagemanager.cc2
-rw-r--r--apt-pkg/packagemanager.h2
-rw-r--r--apt-pkg/pkgcache.cc2
-rw-r--r--apt-pkg/pkgcache.h2
-rw-r--r--apt-pkg/pkgcachegen.cc4
-rw-r--r--apt-pkg/pkgcachegen.h4
-rw-r--r--apt-pkg/pkgrecords.cc2
-rw-r--r--apt-pkg/pkgrecords.h4
-rw-r--r--apt-pkg/pkgsystem.cc3
-rw-r--r--apt-pkg/pkgsystem.h10
-rw-r--r--apt-pkg/policy.cc2
-rw-r--r--apt-pkg/policy.h4
-rw-r--r--apt-pkg/sourcelist.cc4
-rw-r--r--apt-pkg/sourcelist.h2
-rw-r--r--apt-pkg/srcrecords.cc2
-rw-r--r--apt-pkg/srcrecords.h4
-rw-r--r--apt-pkg/tagfile.cc46
-rw-r--r--apt-pkg/tagfile.h8
72 files changed, 244 insertions, 234 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 034b7725a..222ca8931 100644
--- a/apt-pkg/acquire-item.cc
+++ b/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);
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 36fedc7be..c4bbfc7a1 100644
--- a/apt-pkg/acquire-item.h
+++ b/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.
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc
index d3aff4d5e..991e6780a 100644
--- a/apt-pkg/acquire-method.cc
+++ b/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() {}
diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h
index f6659ef1f..cab2bda40 100644
--- a/apt-pkg/acquire-method.h
+++ b/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
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 55fa5734f..8d619e96d 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/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();
}
/*}}}*/
diff --git a/apt-pkg/acquire-worker.h b/apt-pkg/acquire-worker.h
index 31b9d3b88..42762abe0 100644
--- a/apt-pkg/acquire-worker.h
+++ b/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;
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index f70feeeec..5fd378096 100644
--- a/apt-pkg/acquire.cc
+++ b/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)
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h
index 661b35f34..aa581dfb8 100644
--- a/apt-pkg/acquire.h
+++ b/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:
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index adbec82f7..db765febe 100644
--- a/apt-pkg/algorithms.cc
+++ b/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)
{
diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h
index 9c9ceead4..d9cce672a 100644
--- a/apt-pkg/algorithms.h
+++ b/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;
diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h
index 74a092593..83dd90d36 100644
--- a/apt-pkg/cachefile.h
+++ b/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:
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index c42f76112..a4e330a0a 100644
--- a/apt-pkg/cacheset.cc
+++ b/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() {}
}
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index 7fd740335..4fe1eba87 100644
--- a/apt-pkg/cacheset.h
+++ b/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: /*{{{*/
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index de5cd0657..463225963 100644
--- a/apt-pkg/cdrom.cc
+++ b/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() {}
diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h
index 5626b5059..ab1e046bf 100644
--- a/apt-pkg/cdrom.h
+++ b/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;
diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc
index d05ae83b9..ebe8a8a53 100644
--- a/apt-pkg/clean.cc
+++ b/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() {}
diff --git a/apt-pkg/clean.h b/apt-pkg/clean.h
index a1495702b..6cedae086 100644
--- a/apt-pkg/clean.h
+++ b/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:
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 8ec868ec0..f40526b5c 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/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 */
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 97cb05c56..3a99e3e61 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/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
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 05a137653..4481321c4 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/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
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index e8d84da9e..0e6ff9ef1 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/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.
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 0fffa52b0..29a9a941c 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -45,7 +45,7 @@ using std::string;
// ---------------------------------------------------------------------
/* */
debSourcesIndex::debSourcesIndex(IndexTarget const &Target,bool const Trusted) :
- pkgIndexTargetFile(Target, Trusted)
+ pkgIndexTargetFile(Target, Trusted), d(NULL)
{
}
/*}}}*/
@@ -84,7 +84,7 @@ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const
// ---------------------------------------------------------------------
/* */
debPackagesIndex::debPackagesIndex(IndexTarget const &Target, bool const Trusted) :
- pkgIndexTargetFile(Target, Trusted)
+ pkgIndexTargetFile(Target, Trusted), d(NULL)
{
}
/*}}}*/
@@ -179,7 +179,7 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
// TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/
debTranslationsIndex::debTranslationsIndex(IndexTarget const &Target) :
- pkgIndexTargetFile(Target, true)
+ pkgIndexTargetFile(Target, true), d(NULL)
{}
/*}}}*/
bool debTranslationsIndex::HasPackages() const /*{{{*/
@@ -255,7 +255,7 @@ pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) con
// StatusIndex::debStatusIndex - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File)
+debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), d(NULL), File(File)
{
}
/*}}}*/
@@ -341,7 +341,7 @@ APT_CONST bool debStatusIndex::Exists() const
// debDebPkgFile - Single .deb file /*{{{*/
debDebPkgFileIndex::debDebPkgFileIndex(std::string DebFile)
- : pkgIndexFile(true), DebFile(DebFile)
+ : pkgIndexFile(true), d(NULL), DebFile(DebFile)
{
DebFileFullPath = flAbsPath(DebFile);
}
@@ -445,7 +445,7 @@ unsigned long debDebPkgFileIndex::Size() const
// debDscFileIndex stuff
debDscFileIndex::debDscFileIndex(std::string &DscFile)
- : pkgIndexFile(true), DscFile(DscFile)
+ : pkgIndexFile(true), d(NULL), DscFile(DscFile)
{
}
diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h
index 6285a9e5c..1de609a7b 100644
--- a/apt-pkg/deb/debindexfile.h
+++ b/apt-pkg/deb/debindexfile.h
@@ -29,7 +29,7 @@ class pkgCacheGenerator;
class APT_HIDDEN debStatusIndex : public pkgIndexFile
{
- void *d;
+ void * const d;
protected:
std::string File;
@@ -53,7 +53,7 @@ class APT_HIDDEN debStatusIndex : public pkgIndexFile
class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
{
- void *d;
+ void * const d;
public:
virtual const Type *GetType() const APT_CONST;
@@ -72,7 +72,7 @@ class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
{
- void *d;
+ void * const d;
public:
virtual const Type *GetType() const APT_CONST;
@@ -88,7 +88,7 @@ class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
{
- void *d;
+ void * const d;
public:
virtual const Type *GetType() const APT_CONST;
@@ -110,7 +110,7 @@ class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
{
private:
- void *d;
+ void * const d;
std::string DebFile;
std::string DebFileFullPath;
@@ -148,7 +148,7 @@ class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
class APT_HIDDEN debDscFileIndex : public pkgIndexFile
{
private:
- void *d;
+ void * const d;
std::string DscFile;
public:
virtual const Type *GetType() const APT_CONST;
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index c5e77b0ff..4e49e1c78 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -50,7 +50,7 @@ static debListParser::WordList PrioList[] = {
/* Provide an architecture and only this one and "all" will be accepted
in Step(), if no Architecture is given we will accept every arch
we would accept in general with checkArchitecture() */
-debListParser::debListParser(FileFd *File, string const &Arch) : Tags(File),
+debListParser::debListParser(FileFd *File, string const &Arch) : d(NULL), Tags(File),
Arch(Arch) {
if (Arch == "native")
this->Arch = _config->Find("APT::Architecture");
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 420d5ff08..3fd040bdd 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -39,7 +39,7 @@ class APT_HIDDEN debListParser : public pkgCacheGenerator::ListParser
private:
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
protected:
pkgTagFile Tags;
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index 430a5021b..026af077f 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -86,11 +86,11 @@ std::string debReleaseIndex::LocalFileName() const
}
debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) :
- metaIndex(URI, Dist, "deb"), Trusted(CHECK_TRUST)
+ metaIndex(URI, Dist, "deb"), d(NULL), Trusted(CHECK_TRUST)
{}
debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist, bool const Trusted) :
- metaIndex(URI, Dist, "deb") {
+ metaIndex(URI, Dist, "deb"), d(NULL) {
SetTrusted(Trusted);
}
@@ -541,7 +541,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type
};
debDebFileMetaIndex::debDebFileMetaIndex(std::string const &DebFile)
- : metaIndex(DebFile, "local-uri", "deb-dist"), DebFile(DebFile)
+ : metaIndex(DebFile, "local-uri", "deb-dist"), d(NULL), DebFile(DebFile)
{
DebIndex = new debDebPkgFileIndex(DebFile);
Indexes = new vector<pkgIndexFile *>();
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h
index f2706e08a..648c22436 100644
--- a/apt-pkg/deb/debmetaindex.h
+++ b/apt-pkg/deb/debmetaindex.h
@@ -36,7 +36,7 @@ class APT_HIDDEN debReleaseIndex : public metaIndex {
private:
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
std::map<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:
diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc
index f527042e4..326102d08 100644
--- a/apt-pkg/deb/debrecords.cc
+++ b/apt-pkg/deb/debrecords.cc
@@ -34,7 +34,7 @@ using std::string;
// RecordParser::debRecordParser - Constructor /*{{{*/
debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
- debRecordParserBase(), File(FileName, FileFd::ReadOnly, FileFd::Extension),
+ debRecordParserBase(), d(NULL), File(FileName, FileFd::ReadOnly, FileFd::Extension),
Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200)
{
}
@@ -51,7 +51,7 @@ bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc)
/*}}}*/
debRecordParser::~debRecordParser() {}
-debRecordParserBase::debRecordParserBase() : Parser() {}
+debRecordParserBase::debRecordParserBase() : Parser(), d(NULL) {}
// RecordParserBase::FileName - Return the archive filename on the site /*{{{*/
string debRecordParserBase::FileName()
{
@@ -212,5 +212,5 @@ bool debDebFileRecordParser::Jump(pkgCache::VerFileIterator const &) { return Lo
bool debDebFileRecordParser::Jump(pkgCache::DescFileIterator const &) { return LoadContent(); }
std::string debDebFileRecordParser::FileName() { return debFileName; }
-debDebFileRecordParser::debDebFileRecordParser(std::string FileName) : debRecordParserBase(), debFileName(FileName) {}
+debDebFileRecordParser::debDebFileRecordParser(std::string FileName) : debRecordParserBase(), d(NULL), debFileName(FileName) {}
debDebFileRecordParser::~debDebFileRecordParser() {}
diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h
index 8efcec8cd..4d0b713d4 100644
--- a/apt-pkg/deb/debrecords.h
+++ b/apt-pkg/deb/debrecords.h
@@ -27,7 +27,7 @@
class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
{
- void *d;
+ void * const d;
protected:
pkgTagSection Section;
@@ -57,7 +57,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
class APT_HIDDEN debRecordParser : public debRecordParserBase
{
- void *d;
+ void * const d;
protected:
FileFd File;
pkgTagFile Tags;
@@ -73,7 +73,7 @@ class APT_HIDDEN debRecordParser : public debRecordParserBase
// custom record parser that reads deb files directly
class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase
{
- void *d;
+ void * const d;
std::string debFileName;
std::string controlContent;
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 21a4ff8ea..9404b6421 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -33,7 +33,7 @@ using std::max;
using std::string;
debSrcRecordParser::debSrcRecordParser(std::string const &File,pkgIndexFile const *Index)
- : Parser(Index), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400),
+ : Parser(Index), d(NULL), Fd(File,FileFd::ReadOnly, FileFd::Extension), Tags(&Fd,102400),
iOffset(0), Buffer(NULL) {}
// SrcRecordParser::Binaries - Return the binaries field /*{{{*/
diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h
index 7aeb2db88..64b07a1ec 100644
--- a/apt-pkg/deb/debsrcrecords.h
+++ b/apt-pkg/deb/debsrcrecords.h
@@ -24,7 +24,7 @@ class pkgIndexFile;
class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
protected:
FileFd Fd;
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 9a5da9da1..465e13b9e 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -53,11 +53,8 @@ public:
// System::debSystem - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-debSystem::debSystem()
+debSystem::debSystem() : pkgSystem("Debian dpkg interface", &debVS), d(new debSystemPrivate())
{
- d = new debSystemPrivate();
- Label = "Debian dpkg interface";
- VS = &debVS;
}
/*}}}*/
// System::~debSystem - Destructor /*{{{*/
diff --git a/apt-pkg/deb/debsystem.h b/apt-pkg/deb/debsystem.h
index 226cd60bf..e59bbebed 100644
--- a/apt-pkg/deb/debsystem.h
+++ b/apt-pkg/deb/debsystem.h
@@ -28,7 +28,7 @@ class debStatusIndex;
class debSystem : public pkgSystem
{
// private d-pointer
- debSystemPrivate *d;
+ debSystemPrivate * const d;
APT_HIDDEN bool CheckUpdates();
public:
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 6ee939edd..1991a4a66 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -216,10 +216,9 @@ pkgCache::VerIterator FindNowVersion(const pkgCache::PkgIterator &Pkg)
// DPkgPM::pkgDPkgPM - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
- : pkgPackageManager(Cache), pkgFailures(0), PackagesDone(0), PackagesTotal(0)
+pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
+ : pkgPackageManager(Cache),d(new pkgDPkgPMPrivate()), pkgFailures(0), PackagesDone(0), PackagesTotal(0)
{
- d = new pkgDPkgPMPrivate();
}
/*}}}*/
// DPkgPM::pkgDPkgPM - Destructor /*{{{*/
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 2a6e7e004..a1b36c6c0 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -37,7 +37,7 @@ class pkgDPkgPMPrivate;
class pkgDPkgPM : public pkgPackageManager
{
private:
- pkgDPkgPMPrivate *d;
+ pkgDPkgPMPrivate * const d;
/** \brief record the disappear action and handle accordingly
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 921cbced5..d01c14223 100644
--- a/apt-pkg/depcache.cc
+++ b/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);
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 0594a253d..40a2fcaab 100644
--- a/apt-pkg/depcache.h
+++ b/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);
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
index 5d9383e94..3bffc27e9 100644
--- a/apt-pkg/edsp/edspindexfile.cc
+++ b/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)
{
}
/*}}}*/
diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h
index 0f63b7b2a..265a016c5 100644
--- a/apt-pkg/edsp/edspindexfile.h
+++ b/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:
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc
index d1c0cf7e8..63f006628 100644
--- a/apt-pkg/edsp/edsplistparser.cc
+++ b/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 /*{{{*/
diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h
index ef5179e68..98dde4bf5 100644
--- a/apt-pkg/edsp/edsplistparser.h
+++ b/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();
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
index 063517421..4fb34b896 100644
--- a/apt-pkg/edsp/edspsystem.cc
+++ b/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 /*{{{*/
diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h
index 1e27d2cb0..156b02bb5 100644
--- a/apt-pkg/edsp/edspsystem.h
+++ b/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;
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index b0f191ded..6d210e65b 100644
--- a/apt-pkg/indexcopy.cc
+++ b/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() {}
diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h
index 7ee162542..4f4c47169 100644
--- a/apt-pkg/indexcopy.h
+++ b/apt-pkg/indexcopy.h
@@ -32,7 +32,7 @@ class FileFd;
class IndexCopy /*{{{*/
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
protected:
@@ -59,7 +59,7 @@ class IndexCopy /*{{{*/
/*}}}*/
class PackageCopy : public IndexCopy /*{{{*/
{
- void *d;
+ void * const d;
protected:
virtual bool GetFile(std::string &Filename,unsigned long long &Size);
@@ -74,7 +74,7 @@ class PackageCopy : public IndexCopy /*{{{*/
/*}}}*/
class SourceCopy : public IndexCopy /*{{{*/
{
- void *d;
+ void * const d;
protected:
virtual bool GetFile(std::string &Filename,unsigned long long &Size);
@@ -89,7 +89,7 @@ class SourceCopy : public IndexCopy /*{{{*/
/*}}}*/
class TranslationsCopy /*{{{*/
{
- void *d;
+ void * const d;
protected:
pkgTagSection *Section;
@@ -104,7 +104,7 @@ class TranslationsCopy /*{{{*/
class SigVerify /*{{{*/
{
/** \brief dpointer placeholder (for later in case we need it) */
- void *d;
+ void * const d;
APT_HIDDEN bool Verify(std::string prefix,std::string file, indexRecords *records);
APT_HIDDEN bool CopyMetaIndex(std::string CDROM, std::string CDName,
diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc
index b3c5cf229..e9e1b08c3 100644
--- a/apt-pkg/indexfile.cc
+++ b/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)
{
}
/*}}}*/
diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h
index b6472e201..7eeccdbd3 100644
--- a/apt-pkg/indexfile.h
+++ b/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;
diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h
index 3ff072590..683247e42 100644
--- a/apt-pkg/indexrecords.h
+++ b/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;
diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc
index ee2ef683f..ff3f652e5 100644
--- a/apt-pkg/install-progress.cc
+++ b/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() {}
diff --git a/apt-pkg/install-progress.h b/apt-pkg/install-progress.h
index 5da3624c0..07fc15fd8 100644
--- a/apt-pkg/install-progress.h
+++ b/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,
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
index 3c1b696bd..d96349974 100644
--- a/apt-pkg/metaindex.cc
+++ b/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 */
}
diff --git a/apt-pkg/metaindex.h b/apt-pkg/metaindex.h
index 760c7dd15..1bcec1c4a 100644
--- a/apt-pkg/metaindex.h
+++ b/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;
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index a1fcbcc98..edbdd09ab 100644
--- a/apt-pkg/orderlist.cc
+++ b/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),
diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h
index 6d9f45eed..7b35b2955 100644
--- a/apt-pkg/orderlist.h
+++ b/apt-pkg/orderlist.h
@@ -24,7 +24,7 @@
class pkgDepCache;
class pkgOrderList : protected pkgCache::Namespace
{
- void *d;
+ void * const d;
protected:
pkgDepCache &Cache;
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index d137dc75a..016f4474c 100644
--- a/apt-pkg/packagemanager.cc
+++ b/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);
diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h
index 2cdf92cdd..febab26dd 100644
--- a/apt-pkg/packagemanager.h
+++ b/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,
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index dc7698edd..ae04bc699 100644
--- a/apt-pkg/pkgcache.cc
+++ b/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
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index b7bf26c2a..0042eac96 100644
--- a/apt-pkg/pkgcache.h
+++ b/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);
};
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 54e2ef19c..0eba5795f 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/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() {}
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index c7b6de1b6..c56b5abae 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/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:
diff --git a/apt-pkg/pkgrecords.cc b/apt-pkg/pkgrecords.cc
index 87c965f87..ef4c17cd2 100644
--- a/apt-pkg/pkgrecords.cc
+++ b/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() {}
diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h
index 766e845aa..9e10409e4 100644
--- a/apt-pkg/pkgrecords.h
+++ b/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();
diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc
index 98daeb2b9..a6b61e655 100644
--- a/apt-pkg/pkgsystem.cc
+++ b/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;
diff --git a/apt-pkg/pkgsystem.h b/apt-pkg/pkgsystem.h
index 3a447da8b..5be93d059 100644
--- a/apt-pkg/pkgsystem.h
+++ b/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.
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 7947103d5..cd48e040c 100644
--- a/apt-pkg/policy.cc
+++ b/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;
diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h
index 0d2b468bc..58b062a7b 100644
--- a/apt-pkg/policy.h
+++ b/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 = "");
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 8b960572b..99b646513 100644
--- a/apt-pkg/sourcelist.cc
+++ b/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);
}
diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h
index d9eacc08f..e17ad6a9a 100644
--- a/apt-pkg/sourcelist.h
+++ b/apt-pkg/sourcelist.h
@@ -53,7 +53,7 @@ class metaIndex;
class pkgSourceList
{
- void *d;
+ void * const d;
public:
// List of supported source list types
diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc
index bbab9d796..e3ffa9ab0 100644
--- a/apt-pkg/srcrecords.cc
+++ b/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() {}
diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h
index 71173c953..f0a3c463a 100644
--- a/apt-pkg/srcrecords.h
+++ b/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;
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index 130aef19d..4c5505bf3 100644
--- a/apt-pkg/tagfile.cc
+++ b/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));
diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h
index 24eda02f7..23238d979 100644
--- a/apt-pkg/tagfile.h
+++ b/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();
};