]> git.saurik.com Git - apt.git/commitdiff
merge with current debian apt/experimental
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 5 Oct 2011 16:43:00 +0000 (18:43 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 5 Oct 2011 16:43:00 +0000 (18:43 +0200)
1  2 
apt-pkg/acquire-item.h
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/debmetaindex.cc
debian/changelog
ftparchive/cachedb.cc
methods/https.cc

diff --combined apt-pkg/acquire-item.h
index 24f848f272892e3dab2650e97db8be9d12bed564,6c8341b624a21f2a91025bc9ebfa1e8ea0ae651c..27b8e887bba7a4d4440930321a7546a53675227b
  #define PKGLIB_ACQUIRE_ITEM_H
  
  #include <apt-pkg/acquire.h>
 -#include <apt-pkg/indexfile.h>
 -#include <apt-pkg/vendor.h>
 -#include <apt-pkg/sourcelist.h>
 -#include <apt-pkg/pkgrecords.h>
 -#include <apt-pkg/indexrecords.h>
  #include <apt-pkg/hashes.h>
  #include <apt-pkg/weakptr.h>
 +#include <apt-pkg/pkgcache.h>
  
  /** \addtogroup acquire
   *  @{
   *  \file acquire-item.h
   */
  
 +class indexRecords;
 +class pkgRecords;
 +class pkgSourceList;
 +
  /** \brief Represents the process by which a pkgAcquire object should {{{
   *  retrieve a file or a collection of files.
   *
@@@ -74,7 -74,7 +74,7 @@@ class pkgAcquire::Item : public WeakPoi
      *  \param To The new name of #From.  If #To exists it will be
      *  overwritten.
      */
 -   void Rename(string From,string To);
 +   void Rename(std::string From,std::string To);
     
     public:
  
     /** \brief Contains a textual description of the error encountered
      *  if #Status is #StatError or #StatAuthError.
      */
 -   string ErrorText;
 +   std::string ErrorText;
  
     /** \brief The size of the object to fetch. */
     unsigned long long FileSize;
      *  download progress indicator's overall statistics.
      */
     bool Local;
 -   string UsedMirror;
 +   std::string UsedMirror;
  
     /** \brief The number of fetch queues into which this item has been
      *  inserted.
     /** \brief The name of the file into which the retrieved object
      *  will be written.
      */
 -   string DestFile;
 +   std::string DestFile;
  
     /** \brief Invoked by the acquire worker when the object couldn't
      *  be fetched.
      *
      *  \sa pkgAcqMethod
      */
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
  
     /** \brief Invoked by the acquire worker when the object was
      *  fetched successfully.
      *
      *  \sa pkgAcqMethod
      */
 -   virtual void Done(string Message,unsigned long long Size,string Hash,
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
  
     /** \brief Invoked when the worker starts to fetch this object.
      *
      *  \sa pkgAcqMethod
      */
 -   virtual void Start(string Message,unsigned long long Size);
 +   virtual void Start(std::string Message,unsigned long long Size);
  
     /** \brief Custom headers to be sent to the fetch process.
      *
      *  line, so they should (if nonempty) have a leading newline and
      *  no trailing newline.
      */
 -   virtual string Custom600Headers() {return string();};
 +   virtual std::string Custom600Headers() {return std::string();};
  
     /** \brief A "descriptive" URI-like string.
      *
      *  \return a URI that should be used to describe what is being fetched.
      */
 -   virtual string DescURI() = 0;
 +   virtual std::string DescURI() = 0;
     /** \brief Short item description.
      *
      *  \return a brief description of the object being fetched.
      */
 -   virtual string ShortDesc() {return DescURI();}
 +   virtual std::string ShortDesc() {return DescURI();}
  
     /** \brief Invoked by the worker when the download is completely done. */
     virtual void Finished() {};
      *  \return the HashSum of this object, if applicable; otherwise, an
      *  empty string.
      */
 -   virtual string HashSum() {return string();};
 +   virtual std::string HashSum() {return std::string();};
  
     /** \return the acquire process with which this item is associated. */
     pkgAcquire *GetOwner() {return Owner;};
      * 
      *  \param FailCode A short failure string that is send
      */
 -   void ReportMirrorFailure(string FailCode);
 +   void ReportMirrorFailure(std::string FailCode);
  
  
     /** \brief Initialize an item.
  /** \brief Information about an index patch (aka diff). */            /*{{{*/
  struct DiffInfo {
     /** The filename of the diff. */
 -   string file;
 +   std::string file;
  
     /** The sha1 hash of the diff. */
 -   string sha1;
 +   std::string sha1;
  
     /** The size of the diff. */
     unsigned long size;
@@@ -308,12 -308,12 +308,12 @@@ class pkgAcqSubIndex : public pkgAcquir
  
   public:
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string DescURI() {return Desc.URI;};
 -   virtual string Custom600Headers();
 -   virtual bool ParseIndex(string const &IndexFile);
 +   virtual std::string DescURI() {return Desc.URI;};
 +   virtual std::string Custom600Headers();
 +   virtual bool ParseIndex(std::string const &IndexFile);
  
     /** \brief Create a new pkgAcqSubIndex.
      *
      *
      *  \param ExpectedHash The list file's MD5 signature.
      */
 -   pkgAcqSubIndex(pkgAcquire *Owner, string const &URI,string const &URIDesc,
 -                 string const &ShortDesc, HashString const &ExpectedHash);
 +   pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string const &URIDesc,
 +                 std::string const &ShortDesc, HashString const &ExpectedHash);
  };
                                                                        /*}}}*/
  /** \brief An item that is responsible for fetching an index file of  {{{
@@@ -352,7 -352,7 +352,7 @@@ class pkgAcqDiffIndex : public pkgAcqui
     /** \brief The URI of the index file to recreate at our end (either
      *  by downloading it or by applying partial patches).
      */
 -   string RealURI;
 +   std::string RealURI;
  
     /** \brief The Hash that the real index file should have after
      *  all patches have been applied.
     /** \brief The index file which will be patched to generate the new
      *  file.
      */
 -   string CurrentPackagesFile;
 +   std::string CurrentPackagesFile;
  
     /** \brief A description of the Packages file (stored in
      *  pkgAcquire::ItemDesc::Description).
      */
 -   string Description;
 +   std::string Description;
  
   public:
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string DescURI() {return RealURI + "Index";};
 -   virtual string Custom600Headers();
 +   virtual std::string DescURI() {return RealURI + "Index";};
 +   virtual std::string Custom600Headers();
  
     /** \brief Parse the Index file for a set of Packages diffs.
      *
      *  \return \b true if the Index file was successfully parsed, \b
      *  false otherwise.
      */
 -   bool ParseDiffIndex(string IndexDiffFile);
 +   bool ParseDiffIndex(std::string IndexDiffFile);
     
  
     /** \brief Create a new pkgAcqDiffIndex.
      *
      *  \param ExpectedHash The list file's MD5 signature.
      */
 -   pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
 -                 string ShortDesc, HashString ExpectedHash);
 +   pkgAcqDiffIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
 +                 std::string ShortDesc, HashString ExpectedHash);
  };
                                                                        /*}}}*/
  /** \brief An item that is responsible for fetching all the patches   {{{
@@@ -460,7 -460,7 +460,7 @@@ class pkgAcqIndexDiffs : public pkgAcqu
     /** \brief The URI of the package index file that is being
      *  reconstructed.
      */
 -   string RealURI;
 +   std::string RealURI;
  
     /** \brief The HashSum of the package index file that is being
      *  reconstructed.
     HashString ExpectedHash;
  
     /** A description of the file being downloaded. */
 -   string Description;
 +   std::string Description;
  
     /** The patches that remain to be downloaded, including the patch
      *  being downloaded right now.  This list should be ordered so
      *  dictionary instead of relying on ordering and stripping them
      *  off the front?
      */
 -   vector<DiffInfo> available_patches;
 +   std::vector<DiffInfo> available_patches;
  
     /** Stop applying patches when reaching that sha1 */
 -   string ServerSha1;
 +   std::string ServerSha1;
  
     /** The current status of this patch. */
     enum DiffState
      *  This method will fall back to downloading the whole index file
      *  outright; its arguments are ignored.
      */
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
  
 -   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string DescURI() {return RealURI + "Index";};
 +   virtual std::string DescURI() {return RealURI + "Index";};
  
     /** \brief Create an index diff item.
      *
      *  should be ordered so that each diff appears before any diff
      *  that depends on it.
      */
 -   pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
 -                  string ShortDesc, HashString ExpectedHash,
 -                  string ServerSha1,
 -                  vector<DiffInfo> diffs=vector<DiffInfo>());
 +   pkgAcqIndexDiffs(pkgAcquire *Owner,std::string URI,std::string URIDesc,
 +                  std::string ShortDesc, HashString ExpectedHash,
 +                  std::string ServerSha1,
 +                  std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
  };
                                                                        /*}}}*/
  /** \brief An acquire item that is responsible for fetching an index  {{{
@@@ -577,7 -577,7 +577,7 @@@ class pkgAcqIndex : public pkgAcquire::
     /** \brief The object that is actually being fetched (minus any
      *  compression-related extensions).
      */
 -   string RealURI;
 +   std::string RealURI;
  
     /** \brief The expected hashsum of the decompressed index file. */
     HashString ExpectedHash;
     /** \brief The compression-related file extensions that are being
      *  added to the downloaded file one by one if first fails (e.g., "gz bz2").
      */
 -   string CompressionExtension;
 +   std::string CompressionExtension;
  
     public:
     
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string Custom600Headers();
 -   virtual string DescURI() {return Desc.URI;};
 -   virtual string HashSum() {return ExpectedHash.toStr(); };
 +   virtual std::string Custom600Headers();
 +   virtual std::string DescURI() {return Desc.URI;};
 +   virtual std::string HashSum() {return ExpectedHash.toStr(); };
  
     /** \brief Create a pkgAcqIndex.
      *
      *  default is ".lzma" or ".bz2" (if the needed binaries are present)
      *  fallback is ".gz" or none.
      */
 -   pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
 -             string ShortDesc, HashString ExpectedHash, 
 -             string compressExt="");
 +   pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
 +             std::string ShortDesc, HashString ExpectedHash, 
 +             std::string compressExt="");
     pkgAcqIndex(pkgAcquire *Owner, struct IndexTarget const * const Target,
                         HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
 -   void Init(string const &URI, string const &URIDesc, string const &ShortDesc);
 +   void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc);
  };
                                                                        /*}}}*/
  /** \brief An acquire item that is responsible for fetching a         {{{
@@@ -635,8 -635,8 +635,8 @@@ class pkgAcqIndexTrans : public pkgAcqI
  {
     public:
    
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual string Custom600Headers();
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual std::string Custom600Headers();
  
     /** \brief Create a pkgAcqIndexTrans.
      *
      *
      *  \param ShortDesc A brief description of this index file.
      */
 -   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
 -                  string ShortDesc);
 +   pkgAcqIndexTrans(pkgAcquire *Owner,std::string URI,std::string URIDesc,
 +                  std::string ShortDesc);
     pkgAcqIndexTrans(pkgAcquire *Owner, struct IndexTarget const * const Target,
                    HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
  };
@@@ -660,18 -660,18 +660,18 @@@ class IndexTarge
  {
   public:
     /** \brief A URI from which the index file can be downloaded. */
 -   string URI;
 +   std::string URI;
  
     /** \brief A description of the index file. */
 -   string Description;
 +   std::string Description;
  
     /** \brief A shorter description of the index file. */
 -   string ShortDesc;
 +   std::string ShortDesc;
  
     /** \brief The key by which this index file should be
      *  looked up within the meta signature file.
      */
 -   string MetaKey;
 +   std::string MetaKey;
  
     virtual bool IsOptional() const {
        return false;
@@@ -691,6 -691,14 +691,14 @@@ class OptionalIndexTarget : public Inde
                                                                        /*}}}*/
  /** \brief Information about an subindex index file. */                       /*{{{*/
  class SubIndexTarget : public IndexTarget
+ {
+    virtual bool IsSubIndex() const {
+       return true;
+    }
+ };
+                                                                       /*}}}*/
+ /** \brief Information about an subindex index file. */                       /*{{{*/
+ class OptionalSubIndexTarget : public OptionalIndexTarget
  {
     virtual bool IsSubIndex() const {
        return true;
@@@ -710,7 -718,7 +718,7 @@@ class pkgAcqMetaSig : public pkgAcquire
  {
     protected:
     /** \brief The last good signature file */
 -   string LastGoodSig;
 +   std::string LastGoodSig;
  
     /** \brief The fetch request that is currently being processed. */
     pkgAcquire::ItemDesc Desc;
      *  never modified; it is used to determine the file that is being
      *  downloaded.
      */
 -   string RealURI;
 +   std::string RealURI;
  
     /** \brief The URI of the meta-index file to be fetched after the signature. */
 -   string MetaIndexURI;
 +   std::string MetaIndexURI;
  
     /** \brief A "URI-style" description of the meta-index file to be
      *  fetched after the signature.
      */
 -   string MetaIndexURIDesc;
 +   std::string MetaIndexURIDesc;
  
     /** \brief A brief description of the meta-index file to be fetched
      *  after the signature.
      */
 -   string MetaIndexShortDesc;
 +   std::string MetaIndexShortDesc;
  
     /** \brief A package-system-specific parser for the meta-index file. */
     indexRecords* MetaIndexParser;
      *
      *  \todo Why a list of pointers instead of a list of structs?
      */
 -   const vector<struct IndexTarget*>* IndexTargets;
 +   const std::vector<struct IndexTarget*>* IndexTargets;
  
     public:
     
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string Custom600Headers();
 -   virtual string DescURI() {return RealURI; };
 +   virtual std::string Custom600Headers();
 +   virtual std::string DescURI() {return RealURI; };
  
     /** \brief Create a new pkgAcqMetaSig. */
 -   pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
 -               string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
 -               const vector<struct IndexTarget*>* IndexTargets,
 +   pkgAcqMetaSig(pkgAcquire *Owner,std::string URI,std::string URIDesc, std::string ShortDesc,
 +               std::string MetaIndexURI, std::string MetaIndexURIDesc, std::string MetaIndexShortDesc,
 +               const std::vector<struct IndexTarget*>* IndexTargets,
                 indexRecords* MetaIndexParser);
  };
                                                                        /*}}}*/
@@@ -779,17 -787,17 +787,17 @@@ class pkgAcqMetaIndex : public pkgAcqui
     /** \brief The URI that is actually being downloaded; never
      *  modified by pkgAcqMetaIndex.
      */
 -   string RealURI;
 +   std::string RealURI;
  
     /** \brief The file in which the signature for this index was stored.
      *
      *  If empty, the signature and the md5sums of the individual
      *  indices will not be checked.
      */
 -   string SigFile;
 +   std::string SigFile;
  
     /** \brief The index files to download. */
 -   const vector<struct IndexTarget*>* IndexTargets;
 +   const std::vector<struct IndexTarget*>* IndexTargets;
  
     /** \brief The parser for the meta-index file. */
     indexRecords* MetaIndexParser;
      *
      *  \return \b true if no fatal errors were encountered.
      */
 -   bool VerifyVendor(string Message);
 +   bool VerifyVendor(std::string Message);
  
     /** \brief Called when a file is finished being retrieved.
      *
      *  \param Message The message block received from the fetch
      *  subprocess.
      */
 -   void RetrievalDone(string Message);
 +   void RetrievalDone(std::string Message);
  
     /** \brief Called when authentication succeeded.
      *
      *  \param Message The message block received from the fetch
      *  subprocess.
      */
 -   void AuthDone(string Message);
 +   void AuthDone(std::string Message);
  
     /** \brief Starts downloading the individual index files.
      *
     public:
     
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size, string Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size, std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string Custom600Headers();
 -   virtual string DescURI() {return RealURI; };
 +   virtual std::string Custom600Headers();
 +   virtual std::string DescURI() {return RealURI; };
  
     /** \brief Create a new pkgAcqMetaIndex. */
     pkgAcqMetaIndex(pkgAcquire *Owner,
 -                 string URI,string URIDesc, string ShortDesc,
 -                 string SigFile,
 -                 const vector<struct IndexTarget*>* IndexTargets,
 +                 std::string URI,std::string URIDesc, std::string ShortDesc,
 +                 std::string SigFile,
 +                 const std::vector<struct IndexTarget*>* IndexTargets,
                   indexRecords* MetaIndexParser);
  };
                                                                        /*}}}*/
  class pkgAcqMetaClearSig : public pkgAcqMetaIndex
  {
     /** \brief The URI of the meta-index file for the detached signature */
 -   string MetaIndexURI;
 +   std::string MetaIndexURI;
  
     /** \brief A "URI-style" description of the meta-index file */
 -   string MetaIndexURIDesc;
 +   std::string MetaIndexURIDesc;
  
     /** \brief A brief description of the meta-index file */
 -   string MetaIndexShortDesc;
 +   std::string MetaIndexShortDesc;
  
     /** \brief The URI of the detached meta-signature file if the clearsigned one failed. */
 -   string MetaSigURI;
 +   std::string MetaSigURI;
  
     /** \brief A "URI-style" description of the meta-signature file */
 -   string MetaSigURIDesc;
 +   std::string MetaSigURIDesc;
  
     /** \brief A brief description of the meta-signature file */
 -   string MetaSigShortDesc;
 +   std::string MetaSigShortDesc;
  
  public:
 -   void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual string Custom600Headers();
 +   void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual std::string Custom600Headers();
  
     /** \brief Create a new pkgAcqMetaClearSig. */
     pkgAcqMetaClearSig(pkgAcquire *Owner,
 -              string const &URI, string const &URIDesc, string const &ShortDesc,
 -              string const &MetaIndexURI, string const &MetaIndexURIDesc, string const &MetaIndexShortDesc,
 -              string const &MetaSigURI, string const &MetaSigURIDesc, string const &MetaSigShortDesc,
 -              const vector<struct IndexTarget*>* IndexTargets,
 +              std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc,
 +              std::string const &MetaIndexURI, std::string const &MetaIndexURIDesc, std::string const &MetaIndexShortDesc,
 +              std::string const &MetaSigURI, std::string const &MetaSigURIDesc, std::string const &MetaSigShortDesc,
 +              const std::vector<struct IndexTarget*>* IndexTargets,
                indexRecords* MetaIndexParser);
  };
                                                                        /*}}}*/
@@@ -920,7 -928,7 +928,7 @@@ class pkgAcqArchive : public pkgAcquire
     /** \brief A location in which the actual filename of the package
      *  should be stored.
      */
 -   string &StoreFilename;
 +   std::string &StoreFilename;
  
     /** \brief The next file for this version to try to download. */
     pkgCache::VerFileIterator Vf;
     
     public:
     
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string Hash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string DescURI() {return Desc.URI;};
 -   virtual string ShortDesc() {return Desc.ShortDesc;};
 +   virtual std::string DescURI() {return Desc.URI;};
 +   virtual std::string ShortDesc() {return Desc.ShortDesc;};
     virtual void Finished();
 -   virtual string HashSum() {return ExpectedHash.toStr(); };
 +   virtual std::string HashSum() {return ExpectedHash.toStr(); };
     virtual bool IsTrusted();
     
     /** \brief Create a new pkgAcqArchive.
      */
     pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
                 pkgRecords *Recs,pkgCache::VerIterator const &Version,
 -               string &StoreFilename);
 +               std::string &StoreFilename);
  };
                                                                        /*}}}*/
  /** \brief Retrieve an arbitrary file to the current directory.               {{{
@@@ -999,12 -1007,12 +1007,12 @@@ class pkgAcqFile : public pkgAcquire::I
     public:
     
     // Specialized action members
 -   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 -   virtual void Done(string Message,unsigned long long Size,string CalcHash,
 +   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 +   virtual void Done(std::string Message,unsigned long long Size,std::string CalcHash,
                     pkgAcquire::MethodConfig *Cnf);
 -   virtual string DescURI() {return Desc.URI;};
 -   virtual string HashSum() {return ExpectedHash.toStr(); };
 -   virtual string Custom600Headers();
 +   virtual std::string DescURI() {return Desc.URI;};
 +   virtual std::string HashSum() {return ExpectedHash.toStr(); };
 +   virtual std::string Custom600Headers();
  
     /** \brief Create a new pkgAcqFile object.
      *
      * is the absolute name to which the file should be downloaded.
      */
  
 -   pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long long Size,
 -            string Desc, string ShortDesc,
 -            const string &DestDir="", const string &DestFilename="",
 +   pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigned long long Size,
 +            std::string Desc, std::string ShortDesc,
 +            const std::string &DestDir="", const std::string &DestFilename="",
              bool IsIndexFile=false);
  };
                                                                        /*}}}*/
index 3652f9e8b4f4ce89d3c5ee7b6b20c05ce4681bbd,6c8bc838bdc60f064c381ee75ac720fd65a8176b..f6fb2789cd62e042beb5bf3f8e81cf13ab49050a
@@@ -17,7 -17,6 +17,7 @@@
  #include <apt-pkg/configuration.h>
  #include <apt-pkg/aptconfiguration.h>
  #include <apt-pkg/strutl.h>
 +#include <apt-pkg/fileutl.h>
  #include <apt-pkg/crc-16.h>
  #include <apt-pkg/md5.h>
  #include <apt-pkg/macros.h>
@@@ -26,8 -25,6 +26,8 @@@
  #include <ctype.h>
                                                                        /*}}}*/
  
 +using std::string;
 +
  static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
                         {"required",pkgCache::State::Required},
                         {"standard",pkgCache::State::Standard},
@@@ -821,16 -818,16 +821,16 @@@ bool debListParser::LoadReleaseInfo(pkg
        ++lineEnd;
  
        // which datastorage need to be updated
-       map_ptrloc* writeTo = NULL;
+       enum { Suite, Component, Version, Origin, Codename, Label, None } writeTo = None;
        if (buffer[0] == ' ')
         ;
-       #define APT_PARSER_WRITETO(X, Y) else if (strncmp(Y, buffer, len) == 0) writeTo = &X;
-       APT_PARSER_WRITETO(FileI->Archive, "Suite")
-       APT_PARSER_WRITETO(FileI->Component, "Component")
-       APT_PARSER_WRITETO(FileI->Version, "Version")
-       APT_PARSER_WRITETO(FileI->Origin, "Origin")
-       APT_PARSER_WRITETO(FileI->Codename, "Codename")
-       APT_PARSER_WRITETO(FileI->Label, "Label")
+       #define APT_PARSER_WRITETO(X) else if (strncmp(#X, buffer, len) == 0) writeTo = X;
+       APT_PARSER_WRITETO(Suite)
+       APT_PARSER_WRITETO(Component)
+       APT_PARSER_WRITETO(Version)
+       APT_PARSER_WRITETO(Origin)
+       APT_PARSER_WRITETO(Codename)
+       APT_PARSER_WRITETO(Label)
        #undef APT_PARSER_WRITETO
        #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
         pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd);
  
        // load all data from the line and save it
        string data;
-       if (writeTo != NULL)
+       if (writeTo != None)
         data.append(dataStart, dataEnd);
        if (sizeof(buffer) - 1 == (dataEnd - buffer))
        {
         while (fgets(buffer, sizeof(buffer), release) != NULL)
         {
-           if (writeTo != NULL)
+           if (writeTo != None)
               data.append(buffer);
            if (strlen(buffer) != sizeof(buffer) - 1)
               break;
         }
        }
-       if (writeTo != NULL)
+       if (writeTo != None)
        {
         // remove spaces and stuff from the end of the data line
         for (std::string::reverse_iterator s = data.rbegin();
               break;
            *s = '\0';
         }
-        *writeTo = WriteUniqString(data);
+        switch (writeTo) {
+        case Suite: FileI->Archive = WriteUniqString(data); break;
+        case Component: FileI->Component = WriteUniqString(data); break;
+        case Version: FileI->Version = WriteUniqString(data); break;
+        case Origin: FileI->Origin = WriteUniqString(data); break;
+        case Codename: FileI->Codename = WriteUniqString(data); break;
+        case Label: FileI->Label = WriteUniqString(data); break;
+        case None: break;
+        }
        }
     }
     fclose(release);
index 0d07725eb9173817a2f3cda923603cd6baf9c5ba,f24e3afef4555699879a31bfdcc4a71df1ced450..c509c29c7ec094c10d011b8ca2068e44125a8bb0
@@@ -4,12 -4,9 +4,12 @@@
  #include <apt-pkg/debmetaindex.h>
  #include <apt-pkg/debindexfile.h>
  #include <apt-pkg/strutl.h>
 +#include <apt-pkg/fileutl.h>
  #include <apt-pkg/acquire-item.h>
  #include <apt-pkg/configuration.h>
  #include <apt-pkg/aptconfiguration.h>
 +#include <apt-pkg/indexrecords.h>
 +#include <apt-pkg/sourcelist.h>
  #include <apt-pkg/error.h>
  
  #include <set>
@@@ -225,7 -222,7 +225,7 @@@ vector <struct IndexTarget *>* debRelea
        } else {
                for (std::set<std::string>::const_iterator s = sections.begin();
                     s != sections.end(); ++s) {
-                       IndexTarget * Target = new OptionalIndexTarget();
+                       IndexTarget * Target = new OptionalSubIndexTarget();
                        Target->ShortDesc = "TranslationIndex";
                        Target->MetaKey = TranslationIndexURISuffix("Index", *s);
                        Target->URI = TranslationIndexURI("Index", *s);
diff --combined debian/changelog
index 0e7ffb80ff337d0b7ae8aab628c17bed62ec6d4c,a06abbbc08dfcb8864107da9584b8d562354b5b2..f32f7a282e41a93990dfebe3d7a586f134744be8
@@@ -1,22 -1,24 +1,39 @@@
- apt (0.8.16~exp7) experimental; urgency=low
+ apt (0.8.16~exp7) UNRELEASEDexperimental; urgency=low
  
-  -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 21 Sep 2011 19:29:55 +0200
 +  [ David Kalnischkies ]
 +  * do not pollute namespace in the headers with using (Closes: #500198)
 +  * use forward declaration in headers if possible instead of includes
 +  * remove old APT_COMPATIBILITY ifdef's
 +  * apt-pkg/deb/dpkgpm.cc:
 +    - use std::vector instead of fixed size arrays to store args and
 +      multiarch-packagename strings
 +    - load the dpkg base arguments only one time and reuse them later
 +  * cmdline/apt-get.cc:
 +    - follow Provides in the evaluation of saving candidates, too, for
 +      statisfying garbage package dependencies (Closes: #640590)
 +  * apt-pkg/algorithms.cc:
 +    - if a package is garbage, don't try to save it with FixByInstall
 +  * apt-pkg/deb/debsrcrecords.cc:
 +    - remove the limit of 400 Binaries for a source package (Closes: #622110)
++  * apt-pkg/deb/deblistparser.cc:
++    - fix crash when the dynamic mmap needs to be grown in
++      LoadReleaseInfo (LP: #854090)
 +
 -  
+   [ Michael Vogt ]
+   * apt-pkg/contrib/configuration.cc:
+     - fix double delete (LP: #848907)
+     - ignore only the invalid regexp instead of all options
+   * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc:
+     - fix fetching language information by adding OptionalSubIndexTarget
+   * methods/https.cc:
+     - cleanup broken downloads properly
 -  [ David Kalnischkies ]  
 -  * apt-pkg/deb/deblistparser.cc:
 -    - fix crash when the dynamic mmap needs to be grown in
 -      LoadReleaseInfo (LP: #854090)
++
+   [ Colin Watson ]
+   * ftparchive/cachedb.cc:
+     - fix buffersize in bytes2hex
 - -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 05 Oct 2011 18:14:11 +0200
++ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 05 Oct 2011 18:40:57 +0200
  
  apt (0.8.16~exp6) experimental; urgency=low
  
diff --combined ftparchive/cachedb.cc
index c4db88811d1b29195e2ed55aa8300dcea419fa08,6eccb8d4ae6f8f046e49bc5f30c85a99f230e0a9..f0bfa2a6d613cc4ae54c47a5c0e7ba80c79c54a3
@@@ -18,7 -18,6 +18,7 @@@
  #include <apt-pkg/sha2.h>
  #include <apt-pkg/strutl.h>
  #include <apt-pkg/configuration.h>
 +#include <apt-pkg/fileutl.h>
      
  #include <netinet/in.h>       // htonl, etc
  
@@@ -29,7 -28,7 +29,7 @@@
  // CacheDB::ReadyDB - Ready the DB2                                   /*{{{*/
  // ---------------------------------------------------------------------
  /* This opens the DB2 file for caching package information */
 -bool CacheDB::ReadyDB(string const &DB)
 +bool CacheDB::ReadyDB(std::string const &DB)
  {
     int err;
  
@@@ -49,7 -48,7 +49,7 @@@
     
     DBLoaded = false;
     Dbp = 0;
 -   DBFile = string();
 +   DBFile = std::string();
     
     if (DB.empty())
        return true;
@@@ -163,7 -162,7 +163,7 @@@ bool CacheDB::GetCurStat(
                                                                        /*}}}*/
  // CacheDB::GetFileInfo - Get all the info about the file             /*{{{*/
  // ---------------------------------------------------------------------
 -bool CacheDB::GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents,
 +bool CacheDB::GetFileInfo(std::string const &FileName, bool const &DoControl, bool const &DoContents,
                                bool const &GenContentsOnly, bool const &DoMD5, bool const &DoSHA1,
                                bool const &DoSHA256,   bool const &DoSHA512, 
                            bool const &checkMtime)
@@@ -299,12 -298,16 +299,16 @@@ bool CacheDB::LoadContents(bool const &
  }
                                                                        /*}}}*/
  
 -static string bytes2hex(uint8_t *bytes, size_t length) {
 +static std::string bytes2hex(uint8_t *bytes, size_t length) {
-    char space[65];
-    if (length * 2 > sizeof(space) - 1) length = (sizeof(space) - 1) / 2;
-    for (size_t i = 0; i < length; i++)
-       snprintf(&space[i*2], 3, "%02x", bytes[i]);
-    return std::string(space);
+    char buf[3];
 -   string space;
++   std::string space;
+    space.reserve(length*2 + 1);
+    for (size_t i = 0; i < length; i++) {
+       snprintf(buf, sizeof(buf), "%02x", bytes[i]);
+       space.append(buf);
+    }
+    return space;
  }
  
  static inline unsigned char xdig2num(char const &dig) {
@@@ -497,7 -500,7 +501,7 @@@ bool CacheDB::Clean(
               stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
               stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
         {
 -            if (FileExists(string((const char *)Key.data,Colon)) == true)
 +            if (FileExists(std::string((const char *)Key.data,Colon)) == true)
                continue;            
         }
        }
diff --combined methods/https.cc
index e70206dfbd1a6c4808573cedbec80258bdd63c32,709744ce335a7664c745e15e141e58aa737ff751..335699907a8ee5f70bb3ee540df492b84c6b7ae3
@@@ -17,7 -17,6 +17,7 @@@
  #include <apt-pkg/error.h>
  #include <apt-pkg/hashes.h>
  #include <apt-pkg/netrc.h>
 +#include <apt-pkg/configuration.h>
  
  #include <sys/stat.h>
  #include <sys/time.h>
@@@ -272,14 -271,17 +272,17 @@@ bool HttpsMethod::Fetch(FetchItem *Itm
     long curl_servdate;
     curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate);
  
+    File->Close();
     // cleanup
     if(success != 0) 
     {
        _error->Error("%s", curl_errorstr);
+       // unlink, no need keep 401/404 page content in partial/
+       unlink(File->Name().c_str());
        Fail();
        return true;
     }
-    File->Close();
  
     // Timestamp
     struct utimbuf UBuf;