ソースを参照

* [ABI-Break] Implement EDSP in libapt-pkg so that all front-ends which
* [ABI-Break] merge lp:~mvo/apt/sha512-template to add support for sha512
* [ABI-Break] merge lp:~mvo/apt/dpointer to support easier extending
without breaking the ABI

Michael Vogt 15 年 前
コミット
36b8ebbb4a

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

@@ -44,6 +44,9 @@
  */
  */
 class pkgAcquire::Worker : public WeakPointable
 class pkgAcquire::Worker : public WeakPointable
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+  
    friend class pkgAcquire;
    friend class pkgAcquire;
    
    
    protected:
    protected:
@@ -314,7 +317,7 @@ class pkgAcquire::Worker : public WeakPointable
     *  Closes the file descriptors; if MethodConfig::NeedsCleanup is
     *  Closes the file descriptors; if MethodConfig::NeedsCleanup is
     *  \b false, also rudely interrupts the worker with a SIGINT.
     *  \b false, also rudely interrupts the worker with a SIGINT.
     */
     */
-   ~Worker();
+   virtual ~Worker();
 };
 };
 
 
 /** @} */
 /** @} */

+ 23 - 4
apt-pkg/acquire.h

@@ -91,6 +91,12 @@ class pkgAcquireStatus;
  */
  */
 class pkgAcquire
 class pkgAcquire
 {   
 {   
+   private:
+   /** \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;
+
    public:
    public:
    
    
    class Item;
    class Item;
@@ -359,9 +365,6 @@ class pkgAcquire
     */
     */
    virtual ~pkgAcquire();
    virtual ~pkgAcquire();
 
 
-   private:
-   /** \brief FD of the Lock file we acquire in Setup (if any) */
-   int LockFD;
 };
 };
 
 
 /** \brief Represents a single download source from which an item
 /** \brief Represents a single download source from which an item
@@ -391,6 +394,9 @@ class pkgAcquire::Queue
    friend class pkgAcquire::UriIterator;
    friend class pkgAcquire::UriIterator;
    friend class pkgAcquire::Worker;
    friend class pkgAcquire::Worker;
 
 
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    /** \brief The next queue in the pkgAcquire object's list of queues. */
    /** \brief The next queue in the pkgAcquire object's list of queues. */
    Queue *Next;
    Queue *Next;
    
    
@@ -540,12 +546,15 @@ class pkgAcquire::Queue
    /** Shut down all the worker processes associated with this queue
    /** Shut down all the worker processes associated with this queue
     *  and empty the queue.
     *  and empty the queue.
     */
     */
-   ~Queue();
+   virtual ~Queue();
 };
 };
 									/*}}}*/
 									/*}}}*/
 /** \brief Iterates over all the URIs being fetched by a pkgAcquire object.	{{{*/
 /** \brief Iterates over all the URIs being fetched by a pkgAcquire object.	{{{*/
 class pkgAcquire::UriIterator
 class pkgAcquire::UriIterator
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    /** The next queue to iterate over. */
    /** The next queue to iterate over. */
    pkgAcquire::Queue *CurQ;
    pkgAcquire::Queue *CurQ;
    /** The item that we currently point at. */
    /** The item that we currently point at. */
@@ -581,11 +590,15 @@ class pkgAcquire::UriIterator
 	 CurQ = CurQ->Next;
 	 CurQ = CurQ->Next;
       }
       }
    }   
    }   
+   virtual ~UriIterator() {};
 };
 };
 									/*}}}*/
 									/*}}}*/
 /** \brief Information about the properties of a single acquire method.	{{{*/
 /** \brief Information about the properties of a single acquire method.	{{{*/
 struct pkgAcquire::MethodConfig
 struct pkgAcquire::MethodConfig
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+   
    /** \brief The next link on the acquire method list.
    /** \brief The next link on the acquire method list.
     *
     *
     *  \todo Why not an STL container?
     *  \todo Why not an STL container?
@@ -634,6 +647,9 @@ struct pkgAcquire::MethodConfig
     *  appropriate.
     *  appropriate.
     */
     */
    MethodConfig();
    MethodConfig();
+
+   /* \brief Destructor, empty currently */
+   virtual ~MethodConfig() {};
 };
 };
 									/*}}}*/
 									/*}}}*/
 /** \brief A monitor object for downloads controlled by the pkgAcquire class.	{{{
 /** \brief A monitor object for downloads controlled by the pkgAcquire class.	{{{
@@ -644,6 +660,9 @@ struct pkgAcquire::MethodConfig
  */
  */
 class pkgAcquireStatus
 class pkgAcquireStatus
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    protected:
    protected:
    
    
    /** \brief The last time at which this monitor object was updated. */
    /** \brief The last time at which this monitor object was updated. */

+ 3 - 0
apt-pkg/algorithms.h

@@ -78,6 +78,9 @@ private:
 									/*}}}*/
 									/*}}}*/
 class pkgProblemResolver						/*{{{*/
 class pkgProblemResolver						/*{{{*/
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    pkgDepCache &Cache;
    pkgDepCache &Cache;
    typedef pkgCache::PkgIterator PkgIterator;
    typedef pkgCache::PkgIterator PkgIterator;
    typedef pkgCache::VerIterator VerIterator;
    typedef pkgCache::VerIterator VerIterator;

+ 3 - 0
apt-pkg/cachefile.h

@@ -25,6 +25,9 @@
 
 
 class pkgCacheFile
 class pkgCacheFile
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    protected:
    protected:
    
    
    MMap *Map;
    MMap *Map;

+ 2 - 0
apt-pkg/cachefilter.h

@@ -16,6 +16,8 @@ namespace APT {
 namespace CacheFilter {
 namespace CacheFilter {
 // PackageNameMatchesRegEx						/*{{{*/
 // PackageNameMatchesRegEx						/*{{{*/
 class PackageNameMatchesRegEx {
 class PackageNameMatchesRegEx {
+         /** \brief dpointer placeholder (for later in case we need it) */
+         void *d;
 	regex_t* pattern;
 	regex_t* pattern;
 public:
 public:
 	PackageNameMatchesRegEx(std::string const &Pattern);
 	PackageNameMatchesRegEx(std::string const &Pattern);

+ 3 - 0
apt-pkg/clean.h

@@ -15,6 +15,9 @@
 
 
 class pkgArchiveCleaner
 class pkgArchiveCleaner
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    protected:
    protected:
    
    
    virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,struct stat & /*St*/) {};
    virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,struct stat & /*St*/) {};

+ 16 - 0
apt-pkg/deb/debindexfile.h

@@ -22,6 +22,9 @@
 
 
 class debStatusIndex : public pkgIndexFile
 class debStatusIndex : public pkgIndexFile
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    protected:
    protected:
    string File;
    string File;
 
 
@@ -41,10 +44,14 @@ class debStatusIndex : public pkgIndexFile
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    debStatusIndex(string File);
    debStatusIndex(string File);
+   virtual ~debStatusIndex() {};
 };
 };
     
     
 class debPackagesIndex : public pkgIndexFile
 class debPackagesIndex : public pkgIndexFile
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    string URI;
    string URI;
    string Dist;
    string Dist;
    string Section;
    string Section;
@@ -74,10 +81,14 @@ class debPackagesIndex : public pkgIndexFile
 
 
    debPackagesIndex(string const &URI, string const &Dist, string const &Section,
    debPackagesIndex(string const &URI, string const &Dist, string const &Section,
 			bool const &Trusted, string const &Arch = "native");
 			bool const &Trusted, string const &Arch = "native");
+   virtual ~debPackagesIndex() {};
 };
 };
 
 
 class debTranslationsIndex : public pkgIndexFile
 class debTranslationsIndex : public pkgIndexFile
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    string URI;
    string URI;
    string Dist;
    string Dist;
    string Section;
    string Section;
@@ -105,10 +116,14 @@ class debTranslationsIndex : public pkgIndexFile
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
 
    debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
    debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
+   virtual ~debTranslationsIndex() {};
 };
 };
 
 
 class debSourcesIndex : public pkgIndexFile
 class debSourcesIndex : public pkgIndexFile
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    string URI;
    string URI;
    string Dist;
    string Dist;
    string Section;
    string Section;
@@ -138,6 +153,7 @@ class debSourcesIndex : public pkgIndexFile
    virtual unsigned long Size() const;
    virtual unsigned long Size() const;
    
    
    debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
    debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
+   virtual ~debSourcesIndex() {};
 };
 };
 
 
 #endif
 #endif

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

@@ -26,8 +26,11 @@ class debListParser : public pkgCacheGenerator::ListParser
       unsigned char Val;
       unsigned char Val;
    };
    };
 
 
-   protected:
+   private:
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
 
 
+   protected:
    pkgTagFile Tags;
    pkgTagFile Tags;
    pkgTagSection Section;
    pkgTagSection Section;
    unsigned long iOffset;
    unsigned long iOffset;
@@ -74,6 +77,7 @@ class debListParser : public pkgCacheGenerator::ListParser
    static const char *ConvertRelation(const char *I,unsigned int &Op);
    static const char *ConvertRelation(const char *I,unsigned int &Op);
 
 
    debListParser(FileFd *File, string const &Arch = "");
    debListParser(FileFd *File, string const &Arch = "");
+   virtual ~debListParser() {};
 };
 };
 
 
 #endif
 #endif

+ 3 - 1
apt-pkg/deb/debmetaindex.h

@@ -19,12 +19,14 @@ class debReleaseIndex : public metaIndex {
    };
    };
 
 
    private:
    private:
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
    std::map<string, vector<debSectionEntry const*> > ArchEntries;
    std::map<string, vector<debSectionEntry const*> > ArchEntries;
 
 
    public:
    public:
 
 
    debReleaseIndex(string const &URI, string const &Dist);
    debReleaseIndex(string const &URI, string const &Dist);
-   ~debReleaseIndex();
+   virtual ~debReleaseIndex();
 
 
    virtual string ArchiveURI(string const &File) const {return URI + File;};
    virtual string ArchiveURI(string const &File) const {return URI + File;};
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;

+ 4 - 0
apt-pkg/deb/debrecords.h

@@ -20,6 +20,9 @@
 
 
 class debRecordParser : public pkgRecords::Parser
 class debRecordParser : public pkgRecords::Parser
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    FileFd File;
    FileFd File;
    pkgTagFile Tags;
    pkgTagFile Tags;
    pkgTagSection Section;
    pkgTagSection Section;
@@ -50,6 +53,7 @@ class debRecordParser : public pkgRecords::Parser
    virtual void GetRec(const char *&Start,const char *&Stop);
    virtual void GetRec(const char *&Start,const char *&Stop);
    
    
    debRecordParser(string FileName,pkgCache &Cache);
    debRecordParser(string FileName,pkgCache &Cache);
+   virtual ~debRecordParser() {};
 };
 };
 
 
 #endif
 #endif

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

@@ -18,6 +18,9 @@
 
 
 class debSrcRecordParser : public pkgSrcRecords::Parser
 class debSrcRecordParser : public pkgSrcRecords::Parser
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    FileFd Fd;
    FileFd Fd;
    pkgTagFile Tags;
    pkgTagFile Tags;
    pkgTagSection Sect;
    pkgTagSection Sect;
@@ -50,7 +53,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    debSrcRecordParser(string const &File,pkgIndexFile const *Index) 
    debSrcRecordParser(string const &File,pkgIndexFile const *Index) 
       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
         Buffer(0), BufSize(0) {}
         Buffer(0), BufSize(0) {}
-   ~debSrcRecordParser();
+   virtual ~debSrcRecordParser();
 };
 };
 
 
 #endif
 #endif

+ 36 - 26
apt-pkg/deb/debsystem.cc

@@ -26,15 +26,24 @@
 
 
 debSystem debSys;
 debSystem debSys;
 
 
+class debSystemPrivate {
+public:
+   debSystemPrivate() : LockFD(-1), LockCount(0), StatusFile(0)
+   {
+   }
+   // For locking support
+   int LockFD;
+   unsigned LockCount;
+   
+   debStatusIndex *StatusFile;
+};
+
 // System::debSystem - Constructor					/*{{{*/
 // System::debSystem - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 debSystem::debSystem()
 debSystem::debSystem()
 {
 {
-   LockFD = -1;
-   LockCount = 0;
-   StatusFile = 0;
-   
+   d = new debSystemPrivate();
    Label = "Debian dpkg interface";
    Label = "Debian dpkg interface";
    VS = &debVS;
    VS = &debVS;
 }
 }
@@ -44,7 +53,8 @@ debSystem::debSystem()
 /* */
 /* */
 debSystem::~debSystem()
 debSystem::~debSystem()
 {
 {
-   delete StatusFile;
+   delete d->StatusFile;
+   delete d;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // System::Lock - Get the lock						/*{{{*/
 // System::Lock - Get the lock						/*{{{*/
@@ -54,16 +64,16 @@ debSystem::~debSystem()
 bool debSystem::Lock()
 bool debSystem::Lock()
 {
 {
    // Disable file locking
    // Disable file locking
-   if (_config->FindB("Debug::NoLocking",false) == true || LockCount > 1)
+   if (_config->FindB("Debug::NoLocking",false) == true || d->LockCount > 1)
    {
    {
-      LockCount++;
+      d->LockCount++;
       return true;
       return true;
    }
    }
 
 
    // Create the lockfile
    // Create the lockfile
    string AdminDir = flNotFile(_config->Find("Dir::State::status"));
    string AdminDir = flNotFile(_config->Find("Dir::State::status"));
-   LockFD = GetLock(AdminDir + "lock");
-   if (LockFD == -1)
+   d->LockFD = GetLock(AdminDir + "lock");
+   if (d->LockFD == -1)
    {
    {
       if (errno == EACCES || errno == EAGAIN)
       if (errno == EACCES || errno == EAGAIN)
 	 return _error->Error(_("Unable to lock the administration directory (%s), "
 	 return _error->Error(_("Unable to lock the administration directory (%s), "
@@ -76,8 +86,8 @@ bool debSystem::Lock()
    // See if we need to abort with a dirty journal
    // See if we need to abort with a dirty journal
    if (CheckUpdates() == true)
    if (CheckUpdates() == true)
    {
    {
-      close(LockFD);
-      LockFD = -1;
+      close(d->LockFD);
+      d->LockFD = -1;
       const char *cmd;
       const char *cmd;
       if (getenv("SUDO_USER") != NULL)
       if (getenv("SUDO_USER") != NULL)
 	 cmd = "sudo dpkg --configure -a";
 	 cmd = "sudo dpkg --configure -a";
@@ -89,7 +99,7 @@ bool debSystem::Lock()
                              "run '%s' to correct the problem. "), cmd);
                              "run '%s' to correct the problem. "), cmd);
    }
    }
 
 
-	 LockCount++;
+	 d->LockCount++;
       
       
    return true;
    return true;
 }
 }
@@ -99,15 +109,15 @@ bool debSystem::Lock()
 /* */
 /* */
 bool debSystem::UnLock(bool NoErrors)
 bool debSystem::UnLock(bool NoErrors)
 {
 {
-   if (LockCount == 0 && NoErrors == true)
+   if (d->LockCount == 0 && NoErrors == true)
       return false;
       return false;
    
    
-   if (LockCount < 1)
+   if (d->LockCount < 1)
       return _error->Error(_("Not locked"));
       return _error->Error(_("Not locked"));
-   if (--LockCount == 0)
+   if (--d->LockCount == 0)
    {
    {
-      close(LockFD);
-      LockCount = 0;
+      close(d->LockFD);
+      d->LockCount = 0;
    }
    }
    
    
    return true;
    return true;
@@ -168,9 +178,9 @@ bool debSystem::Initialize(Configuration &Cnf)
    Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
    Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
    Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
    Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
 
 
-   if (StatusFile) {
-     delete StatusFile;
-     StatusFile = 0;
+   if (d->StatusFile) {
+     delete d->StatusFile;
+     d->StatusFile = 0;
    }
    }
 
 
    return true;
    return true;
@@ -208,9 +218,9 @@ signed debSystem::Score(Configuration const &Cnf)
 /* */
 /* */
 bool debSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
 bool debSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
 {
 {
-   if (StatusFile == 0)
-      StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));
-   List.push_back(StatusFile);
+   if (d->StatusFile == 0)
+      d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));
+   List.push_back(d->StatusFile);
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -220,11 +230,11 @@ bool debSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
 bool debSystem::FindIndex(pkgCache::PkgFileIterator File,
 bool debSystem::FindIndex(pkgCache::PkgFileIterator File,
 			  pkgIndexFile *&Found) const
 			  pkgIndexFile *&Found) const
 {
 {
-   if (StatusFile == 0)
+   if (d->StatusFile == 0)
       return false;
       return false;
-   if (StatusFile->FindInCache(*File.Cache()) == File)
+   if (d->StatusFile->FindInCache(*File.Cache()) == File)
    {
    {
-      Found = StatusFile;
+      Found = d->StatusFile;
       return true;
       return true;
    }
    }
    
    

+ 6 - 7
apt-pkg/deb/debsystem.h

@@ -12,16 +12,15 @@
 
 
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 
 
+class debSystemPrivate;
+
 class debStatusIndex;
 class debStatusIndex;
 class debSystem : public pkgSystem
 class debSystem : public pkgSystem
 {
 {
-   // For locking support
-   int LockFD;
-   unsigned LockCount;
+   // private d-pointer
+   debSystemPrivate *d;
    bool CheckUpdates();
    bool CheckUpdates();
-   
-   debStatusIndex *StatusFile;
-   
+
    public:
    public:
 
 
    virtual bool Lock();
    virtual bool Lock();
@@ -35,7 +34,7 @@ class debSystem : public pkgSystem
 			  pkgIndexFile *&Found) const;
 			  pkgIndexFile *&Found) const;
 
 
    debSystem();
    debSystem();
-   ~debSystem();
+   virtual ~debSystem();
 };
 };
 
 
 extern debSystem debSys;
 extern debSystem debSys;

+ 62 - 46
apt-pkg/deb/dpkgpm.cc

@@ -44,6 +44,21 @@
 
 
 using namespace std;
 using namespace std;
 
 
+class pkgDPkgPMPrivate 
+{
+public:
+   pkgDPkgPMPrivate() : dpkgbuf_pos(0), term_out(NULL), history_out(NULL)
+   {
+   }
+   bool stdin_is_dev_null;
+   // the buffer we use for the dpkg status-fd reading
+   char dpkgbuf[1024];
+   int dpkgbuf_pos;
+   FILE *term_out;
+   FILE *history_out;
+   string dpkg_error;
+};
+
 namespace
 namespace
 {
 {
   // Maps the dpkg "processing" info to human readable names.  Entry 0
   // Maps the dpkg "processing" info to human readable names.  Entry 0
@@ -108,9 +123,9 @@ ionice(int PID)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) 
 pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache) 
-   : pkgPackageManager(Cache), dpkgbuf_pos(0),
-     term_out(NULL), history_out(NULL), PackagesDone(0), PackagesTotal(0)
+   : pkgPackageManager(Cache), PackagesDone(0), PackagesTotal(0)
 {
 {
+   d = new pkgDPkgPMPrivate();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DPkgPM::pkgDPkgPM - Destructor					/*{{{*/
 // DPkgPM::pkgDPkgPM - Destructor					/*{{{*/
@@ -118,6 +133,7 @@ pkgDPkgPM::pkgDPkgPM(pkgDepCache *Cache)
 /* */
 /* */
 pkgDPkgPM::~pkgDPkgPM()
 pkgDPkgPM::~pkgDPkgPM()
 {
 {
+   delete d;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DPkgPM::Install - Install a package					/*{{{*/
 // DPkgPM::Install - Install a package					/*{{{*/
@@ -374,7 +390,7 @@ void pkgDPkgPM::DoStdin(int master)
    if (len)
    if (len)
       write(master, input_buf, len);
       write(master, input_buf, len);
    else
    else
-      stdin_is_dev_null = true;
+      d->stdin_is_dev_null = true;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DPkgPM::DoTerminalPty - Read the terminal pty and write log		/*{{{*/
 // DPkgPM::DoTerminalPty - Read the terminal pty and write log		/*{{{*/
@@ -399,8 +415,8 @@ void pkgDPkgPM::DoTerminalPty(int master)
    if(len <= 0) 
    if(len <= 0) 
       return;
       return;
    write(1, term_buf, len);
    write(1, term_buf, len);
-   if(term_out)
-      fwrite(term_buf, len, sizeof(char), term_out);
+   if(d->term_out)
+      fwrite(term_buf, len, sizeof(char), d->term_out);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DPkgPM::ProcessDpkgStatusBuf                                        	/*{{{*/
 // DPkgPM::ProcessDpkgStatusBuf                                        	/*{{{*/
@@ -604,14 +620,14 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
    char *p, *q;
    char *p, *q;
    int len;
    int len;
 
 
-   len=read(statusfd, &dpkgbuf[dpkgbuf_pos], sizeof(dpkgbuf)-dpkgbuf_pos);
-   dpkgbuf_pos += len;
+   len=read(statusfd, &d->dpkgbuf[d->dpkgbuf_pos], sizeof(d->dpkgbuf)-d->dpkgbuf_pos);
+   d->dpkgbuf_pos += len;
    if(len <= 0)
    if(len <= 0)
       return;
       return;
 
 
    // process line by line if we have a buffer
    // process line by line if we have a buffer
-   p = q = dpkgbuf;
-   while((q=(char*)memchr(p, '\n', dpkgbuf+dpkgbuf_pos-p)) != NULL)
+   p = q = d->dpkgbuf;
+   while((q=(char*)memchr(p, '\n', d->dpkgbuf+d->dpkgbuf_pos-p)) != NULL)
    {
    {
       *q = 0;
       *q = 0;
       ProcessDpkgStatusLine(OutStatusFd, p);
       ProcessDpkgStatusLine(OutStatusFd, p);
@@ -619,8 +635,8 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
    }
    }
 
 
    // now move the unprocessed bits (after the final \n that is now a 0x0) 
    // now move the unprocessed bits (after the final \n that is now a 0x0) 
-   // to the start and update dpkgbuf_pos
-   p = (char*)memrchr(dpkgbuf, 0, dpkgbuf_pos);
+   // to the start and update d->dpkgbuf_pos
+   p = (char*)memrchr(d->dpkgbuf, 0, d->dpkgbuf_pos);
    if(p == NULL)
    if(p == NULL)
       return;
       return;
 
 
@@ -628,8 +644,8 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
    p++;
    p++;
 
 
    // move the unprocessed tail to the start and update pos
    // move the unprocessed tail to the start and update pos
-   memmove(dpkgbuf, p, p-dpkgbuf);
-   dpkgbuf_pos = dpkgbuf+dpkgbuf_pos-p;
+   memmove(d->dpkgbuf, p, p-d->dpkgbuf);
+   d->dpkgbuf_pos = d->dpkgbuf+d->dpkgbuf_pos-p;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DPkgPM::WriteHistoryTag						/*{{{*/
 // DPkgPM::WriteHistoryTag						/*{{{*/
@@ -641,7 +657,7 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value)
    // poor mans rstrip(", ")
    // poor mans rstrip(", ")
    if (value[length-2] == ',' && value[length-1] == ' ')
    if (value[length-2] == ',' && value[length-1] == ' ')
       value.erase(length - 2, 2);
       value.erase(length - 2, 2);
-   fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str());
+   fprintf(d->history_out, "%s: %s\n", tag.c_str(), value.c_str());
 }									/*}}}*/
 }									/*}}}*/
 // DPkgPM::OpenLog							/*{{{*/
 // DPkgPM::OpenLog							/*{{{*/
 bool pkgDPkgPM::OpenLog()
 bool pkgDPkgPM::OpenLog()
@@ -662,13 +678,13 @@ bool pkgDPkgPM::OpenLog()
 				   _config->Find("Dir::Log::Terminal"));
 				   _config->Find("Dir::Log::Terminal"));
    if (!logfile_name.empty())
    if (!logfile_name.empty())
    {
    {
-      term_out = fopen(logfile_name.c_str(),"a");
-      if (term_out == NULL)
+      d->term_out = fopen(logfile_name.c_str(),"a");
+      if (d->term_out == NULL)
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
-      setvbuf(term_out, NULL, _IONBF, 0);
-      SetCloseExec(fileno(term_out), true);
+      setvbuf(d->term_out, NULL, _IONBF, 0);
+      SetCloseExec(fileno(d->term_out), true);
       chmod(logfile_name.c_str(), 0600);
       chmod(logfile_name.c_str(), 0600);
-      fprintf(term_out, "\nLog started: %s\n", timestr);
+      fprintf(d->term_out, "\nLog started: %s\n", timestr);
    }
    }
 
 
    // write your history
    // write your history
@@ -676,11 +692,11 @@ bool pkgDPkgPM::OpenLog()
 				   _config->Find("Dir::Log::History"));
 				   _config->Find("Dir::Log::History"));
    if (!history_name.empty())
    if (!history_name.empty())
    {
    {
-      history_out = fopen(history_name.c_str(),"a");
-      if (history_out == NULL)
+      d->history_out = fopen(history_name.c_str(),"a");
+      if (d->history_out == NULL)
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str());
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str());
       chmod(history_name.c_str(), 0644);
       chmod(history_name.c_str(), 0644);
-      fprintf(history_out, "\nStart-Date: %s\n", timestr);
+      fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
       string remove, purge, install, upgrade, downgrade;
       string remove, purge, install, upgrade, downgrade;
       for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       {
       {
@@ -710,7 +726,7 @@ bool pkgDPkgPM::OpenLog()
       WriteHistoryTag("Downgrade",downgrade);
       WriteHistoryTag("Downgrade",downgrade);
       WriteHistoryTag("Remove",remove);
       WriteHistoryTag("Remove",remove);
       WriteHistoryTag("Purge",purge);
       WriteHistoryTag("Purge",purge);
-      fflush(history_out);
+      fflush(d->history_out);
    }
    }
    
    
    return true;
    return true;
@@ -724,16 +740,16 @@ bool pkgDPkgPM::CloseLog()
    struct tm *tmp = localtime(&t);
    struct tm *tmp = localtime(&t);
    strftime(timestr, sizeof(timestr), "%F  %T", tmp);
    strftime(timestr, sizeof(timestr), "%F  %T", tmp);
 
 
-   if(term_out)
+   if(d->term_out)
    {
    {
-      fprintf(term_out, "Log ended: ");
-      fprintf(term_out, "%s", timestr);
-      fprintf(term_out, "\n");
-      fclose(term_out);
+      fprintf(d->term_out, "Log ended: ");
+      fprintf(d->term_out, "%s", timestr);
+      fprintf(d->term_out, "\n");
+      fclose(d->term_out);
    }
    }
-   term_out = NULL;
+   d->term_out = NULL;
 
 
-   if(history_out)
+   if(d->history_out)
    {
    {
       if (disappearedPkgs.empty() == false)
       if (disappearedPkgs.empty() == false)
       {
       {
@@ -750,12 +766,12 @@ bool pkgDPkgPM::CloseLog()
 	 }
 	 }
 	 WriteHistoryTag("Disappeared", disappear);
 	 WriteHistoryTag("Disappeared", disappear);
       }
       }
-      if (dpkg_error.empty() == false)
-	 fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
-      fprintf(history_out, "End-Date: %s\n", timestr);
-      fclose(history_out);
+      if (d->dpkg_error.empty() == false)
+	 fprintf(d->history_out, "Error: %s\n", d->dpkg_error.c_str());
+      fprintf(d->history_out, "End-Date: %s\n", timestr);
+      fclose(d->history_out);
    }
    }
-   history_out = NULL;
+   d->history_out = NULL;
 
 
    return true;
    return true;
 }
 }
@@ -863,7 +879,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       }
       }
    }
    }
 
 
-   stdin_is_dev_null = false;
+   d->stdin_is_dev_null = false;
 
 
    // create log
    // create log
    OpenLog();
    OpenLog();
@@ -1063,8 +1079,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    const char *s = _("Can not write log, openpty() "
 	    const char *s = _("Can not write log, openpty() "
 	                      "failed (/dev/pts not mounted?)\n");
 	                      "failed (/dev/pts not mounted?)\n");
 	    fprintf(stderr, "%s",s);
 	    fprintf(stderr, "%s",s);
-            if(term_out)
-              fprintf(term_out, "%s",s);
+            if(d->term_out)
+              fprintf(d->term_out, "%s",s);
 	    master = slave = -1;
 	    master = slave = -1;
 	 }  else {
 	 }  else {
 	    struct termios rtt;
 	    struct termios rtt;
@@ -1194,7 +1210,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 
 
 	 // wait for input or output here
 	 // wait for input or output here
 	 FD_ZERO(&rfds);
 	 FD_ZERO(&rfds);
-	 if (master >= 0 && !stdin_is_dev_null)
+	 if (master >= 0 && !d->stdin_is_dev_null)
 	    FD_SET(0, &rfds); 
 	    FD_SET(0, &rfds); 
 	 FD_SET(_dpkgin, &rfds);
 	 FD_SET(_dpkgin, &rfds);
 	 if(master >= 0)
 	 if(master >= 0)
@@ -1248,14 +1264,14 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    RunScripts("DPkg::Post-Invoke");
 	    RunScripts("DPkg::Post-Invoke");
 
 
 	 if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) 
 	 if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV) 
-	    strprintf(dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
+	    strprintf(d->dpkg_error, "Sub-process %s received a segmentation fault.",Args[0]);
 	 else if (WIFEXITED(Status) != 0)
 	 else if (WIFEXITED(Status) != 0)
-	    strprintf(dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
+	    strprintf(d->dpkg_error, "Sub-process %s returned an error code (%u)",Args[0],WEXITSTATUS(Status));
 	 else 
 	 else 
-	    strprintf(dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
+	    strprintf(d->dpkg_error, "Sub-process %s exited unexpectedly",Args[0]);
 
 
-	 if(dpkg_error.size() > 0)
-	    _error->Error("%s", dpkg_error.c_str());
+	 if(d->dpkg_error.size() > 0)
+	    _error->Error("%s", d->dpkg_error.c_str());
 
 
 	 if(stopOnError) 
 	 if(stopOnError) 
 	 {
 	 {
@@ -1402,8 +1418,8 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
    fprintf(report, "ErrorMessage:\n %s\n", errormsg);
    fprintf(report, "ErrorMessage:\n %s\n", errormsg);
 
 
    // ensure that the log is flushed
    // ensure that the log is flushed
-   if(term_out)
-      fflush(term_out);
+   if(d->term_out)
+      fflush(d->term_out);
 
 
    // attach terminal log it if we have it
    // attach terminal log it if we have it
    string logfile_name = _config->FindFile("Dir::Log::Terminal");
    string logfile_name = _config->FindFile("Dir::Log::Terminal");

+ 2 - 9
apt-pkg/deb/dpkgpm.h

@@ -18,19 +18,12 @@
 using std::vector;
 using std::vector;
 using std::map;
 using std::map;
 
 
+class pkgDPkgPMPrivate;
 
 
 class pkgDPkgPM : public pkgPackageManager
 class pkgDPkgPM : public pkgPackageManager
 {
 {
    private:
    private:
-
-   bool stdin_is_dev_null;
-
-   // the buffer we use for the dpkg status-fd reading
-   char dpkgbuf[1024];
-   int dpkgbuf_pos;
-   FILE *term_out;
-   FILE *history_out;
-   string dpkg_error;
+   pkgDPkgPMPrivate *d;
 
 
    /** \brief record the disappear action and handle accordingly
    /** \brief record the disappear action and handle accordingly
 
 

+ 6 - 2
apt-pkg/indexcopy.h

@@ -24,6 +24,9 @@ class pkgCdromStatus;
 
 
 class IndexCopy								/*{{{*/
 class IndexCopy								/*{{{*/
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    protected:
    protected:
    
    
    pkgTagSection *Section;
    pkgTagSection *Section;
@@ -55,7 +58,6 @@ class PackageCopy : public IndexCopy					/*{{{*/
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *Type() {return "Package";};
    virtual const char *Type() {return "Package";};
    
    
-   public:
 };
 };
 									/*}}}*/
 									/*}}}*/
 class SourceCopy : public IndexCopy					/*{{{*/
 class SourceCopy : public IndexCopy					/*{{{*/
@@ -67,7 +69,6 @@ class SourceCopy : public IndexCopy					/*{{{*/
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *Type() {return "Source";};
    virtual const char *Type() {return "Source";};
    
    
-   public:
 };
 };
 									/*}}}*/
 									/*}}}*/
 class TranslationsCopy							/*{{{*/
 class TranslationsCopy							/*{{{*/
@@ -82,6 +83,9 @@ class TranslationsCopy							/*{{{*/
 									/*}}}*/
 									/*}}}*/
 class SigVerify								/*{{{*/
 class SigVerify								/*{{{*/
 {
 {
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
+
    bool Verify(string prefix,string file, indexRecords *records);
    bool Verify(string prefix,string file, indexRecords *records);
    bool CopyMetaIndex(string CDROM, string CDName, 
    bool CopyMetaIndex(string CDROM, string CDName, 
 		      string prefix, string file);
 		      string prefix, string file);

+ 3 - 2
apt-pkg/pkgrecords.h

@@ -28,12 +28,13 @@ class pkgRecords							/*{{{*/
    class Parser;
    class Parser;
    
    
    private:
    private:
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
    
    
    pkgCache &Cache;
    pkgCache &Cache;
    std::vector<Parser *>Files;
    std::vector<Parser *>Files;
 
 
-   public:
-
+    public:
    // Lookup function
    // Lookup function
    Parser &Lookup(pkgCache::VerFileIterator const &Ver);
    Parser &Lookup(pkgCache::VerFileIterator const &Ver);
    Parser &Lookup(pkgCache::DescFileIterator const &Desc);
    Parser &Lookup(pkgCache::DescFileIterator const &Desc);

+ 3 - 1
apt-pkg/srcrecords.h

@@ -79,6 +79,8 @@ class pkgSrcRecords
    };
    };
    
    
    private:
    private:
+   /** \brief dpointer placeholder (for later in case we need it) */
+   void *d;
    
    
    // The list of files and the current parser pointer
    // The list of files and the current parser pointer
    vector<Parser*> Files;
    vector<Parser*> Files;
@@ -93,7 +95,7 @@ class pkgSrcRecords
    Parser *Find(const char *Package,bool const &SrcOnly = false);
    Parser *Find(const char *Package,bool const &SrcOnly = false);
    
    
    pkgSrcRecords(pkgSourceList &List);
    pkgSrcRecords(pkgSourceList &List);
-   ~pkgSrcRecords();
+   virtual ~pkgSrcRecords();
 };
 };
 
 
 #endif
 #endif

+ 72 - 51
apt-pkg/tagfile.cc

@@ -24,26 +24,40 @@
 
 
 using std::string;
 using std::string;
 
 
+class pkgTagFilePrivate
+{
+public:
+   pkgTagFilePrivate(FileFd *pFd, unsigned long Size) : Fd(*pFd), Size(Size)
+   {
+   }
+   FileFd &Fd;
+   char *Buffer;
+   char *Start;
+   char *End;
+   bool Done;
+   unsigned long iOffset;
+   unsigned long Size;
+};
+
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // TagFile::pkgTagFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) :
-     Fd(*pFd),
-     Size(Size)
+pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size)
 {
 {
-   if (Fd.IsOpen() == false)
+   d = new pkgTagFilePrivate(pFd, Size);
+
+   if (d->Fd.IsOpen() == false)
    {
    {
-      Buffer = 0;
-      Start = End = Buffer = 0;
-      Done = true;
-      iOffset = 0;
+      d->Start = d->End = d->Buffer = 0;
+      d->Done = true;
+      d->iOffset = 0;
       return;
       return;
    }
    }
    
    
-   Buffer = new char[Size];
-   Start = End = Buffer;
-   Done = false;
-   iOffset = 0;
+   d->Buffer = new char[Size];
+   d->Start = d->End = d->Buffer;
+   d->Done = false;
+   d->iOffset = 0;
    Fill();
    Fill();
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -52,7 +66,14 @@ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long Size) :
 /* */
 /* */
 pkgTagFile::~pkgTagFile()
 pkgTagFile::~pkgTagFile()
 {
 {
-   delete [] Buffer;
+   delete [] d->Buffer;
+   delete d;
+}
+									/*}}}*/
+// TagFile::Offset - Return the current offset in the buffer     	/*{{{*/
+unsigned long pkgTagFile::Offset()
+{
+   return d->iOffset;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // TagFile::Resize - Resize the internal buffer				/*{{{*/
 // TagFile::Resize - Resize the internal buffer				/*{{{*/
@@ -63,22 +84,22 @@ pkgTagFile::~pkgTagFile()
 bool pkgTagFile::Resize()
 bool pkgTagFile::Resize()
 {
 {
    char *tmp;
    char *tmp;
-   unsigned long EndSize = End - Start;
+   unsigned long EndSize = d->End - d->Start;
 
 
    // fail is the buffer grows too big
    // fail is the buffer grows too big
-   if(Size > 1024*1024+1)
+   if(d->Size > 1024*1024+1)
       return false;
       return false;
 
 
    // get new buffer and use it
    // get new buffer and use it
-   tmp = new char[2*Size];
-   memcpy(tmp, Buffer, Size);
-   Size = Size*2;
-   delete [] Buffer;
-   Buffer = tmp;
+   tmp = new char[2*d->Size];
+   memcpy(tmp, d->Buffer, d->Size);
+   d->Size = d->Size*2;
+   delete [] d->Buffer;
+   d->Buffer = tmp;
 
 
    // update the start/end pointers to the new buffer
    // update the start/end pointers to the new buffer
-   Start = Buffer;
-   End = Start + EndSize;
+   d->Start = d->Buffer;
+   d->End = d->Start + EndSize;
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -90,20 +111,20 @@ bool pkgTagFile::Resize()
  */
  */
 bool pkgTagFile::Step(pkgTagSection &Tag)
 bool pkgTagFile::Step(pkgTagSection &Tag)
 {
 {
-   while (Tag.Scan(Start,End - Start) == false)
+   while (Tag.Scan(d->Start,d->End - d->Start) == false)
    {
    {
       if (Fill() == false)
       if (Fill() == false)
 	 return false;
 	 return false;
       
       
-      if(Tag.Scan(Start,End - Start))
+      if(Tag.Scan(d->Start,d->End - d->Start))
 	 break;
 	 break;
 
 
       if (Resize() == false)
       if (Resize() == false)
 	 return _error->Error(_("Unable to parse package file %s (1)"),
 	 return _error->Error(_("Unable to parse package file %s (1)"),
-				 Fd.Name().c_str());
+                              d->Fd.Name().c_str());
    }
    }
-   Start += Tag.size();
-   iOffset += Tag.size();
+   d->Start += Tag.size();
+   d->iOffset += Tag.size();
 
 
    Tag.Trim();
    Tag.Trim();
    return true;
    return true;
@@ -115,37 +136,37 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
    then fills the rest from the file */
    then fills the rest from the file */
 bool pkgTagFile::Fill()
 bool pkgTagFile::Fill()
 {
 {
-   unsigned long EndSize = End - Start;
+   unsigned long EndSize = d->End - d->Start;
    unsigned long Actual = 0;
    unsigned long Actual = 0;
    
    
-   memmove(Buffer,Start,EndSize);
-   Start = Buffer;
-   End = Buffer + EndSize;
+   memmove(d->Buffer,d->Start,EndSize);
+   d->Start = d->Buffer;
+   d->End = d->Buffer + EndSize;
    
    
-   if (Done == false)
+   if (d->Done == false)
    {
    {
       // See if only a bit of the file is left
       // See if only a bit of the file is left
-      if (Fd.Read(End,Size - (End - Buffer),&Actual) == false)
+      if (d->Fd.Read(d->End, d->Size - (d->End - d->Buffer),&Actual) == false)
 	 return false;
 	 return false;
-      if (Actual != Size - (End - Buffer))
-	 Done = true;
-      End += Actual;
+      if (Actual != d->Size - (d->End - d->Buffer))
+	 d->Done = true;
+      d->End += Actual;
    }
    }
    
    
-   if (Done == true)
+   if (d->Done == true)
    {
    {
       if (EndSize <= 3 && Actual == 0)
       if (EndSize <= 3 && Actual == 0)
 	 return false;
 	 return false;
-      if (Size - (End - Buffer) < 4)
+      if (d->Size - (d->End - d->Buffer) < 4)
 	 return true;
 	 return true;
       
       
       // Append a double new line if one does not exist
       // Append a double new line if one does not exist
       unsigned int LineCount = 0;
       unsigned int LineCount = 0;
-      for (const char *E = End - 1; E - End < 6 && (*E == '\n' || *E == '\r'); E--)
+      for (const char *E = d->End - 1; E - d->End < 6 && (*E == '\n' || *E == '\r'); E--)
 	 if (*E == '\n')
 	 if (*E == '\n')
 	    LineCount++;
 	    LineCount++;
       for (; LineCount < 2; LineCount++)
       for (; LineCount < 2; LineCount++)
-	 *End++ = '\n';
+	 *d->End++ = '\n';
       
       
       return true;
       return true;
    }
    }
@@ -160,33 +181,33 @@ bool pkgTagFile::Fill()
 bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
 bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
 {
 {
    // We are within a buffer space of the next hit..
    // We are within a buffer space of the next hit..
-   if (Offset >= iOffset && iOffset + (End - Start) > Offset)
+   if (Offset >= d->iOffset && d->iOffset + (d->End - d->Start) > Offset)
    {
    {
-      unsigned long Dist = Offset - iOffset;
-      Start += Dist;
-      iOffset += Dist;
+      unsigned long Dist = Offset - d->iOffset;
+      d->Start += Dist;
+      d->iOffset += Dist;
       return Step(Tag);
       return Step(Tag);
    }
    }
 
 
    // Reposition and reload..
    // Reposition and reload..
-   iOffset = Offset;
-   Done = false;
-   if (Fd.Seek(Offset) == false)
+   d->iOffset = Offset;
+   d->Done = false;
+   if (d->Fd.Seek(Offset) == false)
       return false;
       return false;
-   End = Start = Buffer;
+   d->End = d->Start = d->Buffer;
    
    
    if (Fill() == false)
    if (Fill() == false)
       return false;
       return false;
 
 
-   if (Tag.Scan(Start,End - Start) == true)
+   if (Tag.Scan(d->Start, d->End - d->Start) == true)
       return true;
       return true;
    
    
    // This appends a double new line (for the real eof handling)
    // This appends a double new line (for the real eof handling)
    if (Fill() == false)
    if (Fill() == false)
       return false;
       return false;
    
    
-   if (Tag.Scan(Start,End - Start) == false)
-      return _error->Error(_("Unable to parse package file %s (2)"),Fd.Name().c_str());
+   if (Tag.Scan(d->Start, d->End - d->Start) == false)
+      return _error->Error(_("Unable to parse package file %s (2)"),d->Fd.Name().c_str());
    
    
    return true;
    return true;
 }
 }

+ 8 - 13
apt-pkg/tagfile.h

@@ -23,16 +23,16 @@
 
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <stdio.h>
 #include <stdio.h>
-    
+
 class pkgTagSection
 class pkgTagSection
 {
 {
    const char *Section;
    const char *Section;
-   
    // We have a limit of 256 tags per section.
    // We have a limit of 256 tags per section.
    unsigned int Indexes[256];
    unsigned int Indexes[256];
    unsigned int AlphaIndexes[0x100];
    unsigned int AlphaIndexes[0x100];
-   
    unsigned int TagCount;
    unsigned int TagCount;
+   // dpointer placeholder (for later in case we need it)
+   void *d;
 
 
    /* This very simple hash function for the last 8 letters gives
    /* This very simple hash function for the last 8 letters gives
       very good performance on the debian package files */
       very good performance on the debian package files */
@@ -44,7 +44,6 @@ class pkgTagSection
       return Res & 0xFF;
       return Res & 0xFF;
    }
    }
 
 
-
    protected:
    protected:
    const char *Stop;
    const char *Stop;
 
 
@@ -80,17 +79,13 @@ class pkgTagSection
    };
    };
    
    
    pkgTagSection() : Section(0), Stop(0) {};
    pkgTagSection() : Section(0), Stop(0) {};
+   virtual ~pkgTagSection() {};
 };
 };
 
 
+class pkgTagFilePrivate;
 class pkgTagFile
 class pkgTagFile
 {
 {
-   FileFd &Fd;
-   char *Buffer;
-   char *Start;
-   char *End;
-   bool Done;
-   unsigned long iOffset;
-   unsigned long Size;
+   pkgTagFilePrivate *d;
 
 
    bool Fill();
    bool Fill();
    bool Resize();
    bool Resize();
@@ -98,11 +93,11 @@ class pkgTagFile
    public:
    public:
 
 
    bool Step(pkgTagSection &Section);
    bool Step(pkgTagSection &Section);
-   inline unsigned long Offset() {return iOffset;};
+   unsigned long Offset();
    bool Jump(pkgTagSection &Tag,unsigned long Offset);
    bool Jump(pkgTagSection &Tag,unsigned long Offset);
 
 
    pkgTagFile(FileFd *F,unsigned long Size = 32*1024);
    pkgTagFile(FileFd *F,unsigned long Size = 32*1024);
-   ~pkgTagFile();
+   virtual ~pkgTagFile();
 };
 };
 
 
 /* This is the list of things to rewrite. The rewriter
 /* This is the list of things to rewrite. The rewriter

+ 4 - 2
debian/changelog

@@ -1,7 +1,7 @@
 apt (0.8.15) UNRELEASED; urgency=low
 apt (0.8.15) UNRELEASED; urgency=low
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
-  * Implement EDSP in libapt-pkg so that all front-ends which
+  * [ABI-Break] Implement EDSP in libapt-pkg so that all front-ends which
     use the internal resolver can now be used also with external
     use the internal resolver can now be used also with external
     ones as the usage is hidden in between the old API
     ones as the usage is hidden in between the old API
   * provide two edsp solvers in apt-utils:
   * provide two edsp solvers in apt-utils:
@@ -25,7 +25,9 @@ apt (0.8.15) UNRELEASED; urgency=low
     - describe EDSP and the configuration interface around it
     - describe EDSP and the configuration interface around it
   
   
   [ Michael Vogt ]
   [ Michael Vogt ]
-  * merge lp:~mvo/apt/sha512-template to add support for sha512
+  * [ABI-Break] merge lp:~mvo/apt/sha512-template to add support for sha512
+  * [ABI-Break] merge lp:~mvo/apt/dpointer to support easier extending
+    without breaking the ABI
 
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 17 May 2011 18:43:21 +0200
  -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 17 May 2011 18:43:21 +0200