Browse Source

do not pollute namespace in the headers with using (Closes: #500198)

debian/1.8.y
David Kalnischkies 11 years ago
parent
commit
8f3ba4e870
  1. 2
      apt-inst/contrib/arfile.cc
  2. 2
      apt-inst/contrib/arfile.h
  3. 6
      apt-inst/contrib/extracttar.h
  4. 2
      apt-inst/database.cc
  5. 6
      apt-inst/database.h
  6. 6
      apt-inst/deb/debfile.cc
  7. 4
      apt-inst/deb/debfile.h
  8. 8
      apt-inst/deb/dpkgdb.h
  9. 2
      apt-inst/extract.h
  10. 2
      apt-inst/filelist.h
  11. 38
      apt-pkg/acquire-method.h
  12. 12
      apt-pkg/acquire-worker.h
  13. 36
      apt-pkg/acquire.h
  14. 6
      apt-pkg/algorithms.h
  15. 10
      apt-pkg/aptconfiguration.cc
  16. 6
      apt-pkg/cacheiterators.h
  17. 38
      apt-pkg/cdrom.h
  18. 10
      apt-pkg/clean.cc
  19. 4
      apt-pkg/clean.h
  20. 2
      apt-pkg/contrib/cdromutl.cc
  21. 12
      apt-pkg/contrib/cdromutl.h
  22. 46
      apt-pkg/contrib/configuration.h
  23. 42
      apt-pkg/contrib/fileutl.h
  24. 26
      apt-pkg/contrib/hashes.cc
  25. 17
      apt-pkg/contrib/hashes.h
  26. 2
      apt-pkg/contrib/hashsum.cc
  27. 13
      apt-pkg/contrib/hashsum_template.h
  28. 3
      apt-pkg/contrib/md5.h
  29. 4
      apt-pkg/contrib/mmap.h
  30. 1
      apt-pkg/contrib/netrc.cc
  31. 2
      apt-pkg/contrib/netrc.h
  32. 18
      apt-pkg/contrib/progress.h
  33. 3
      apt-pkg/contrib/sha1.h
  34. 108
      apt-pkg/contrib/strutl.h
  35. 68
      apt-pkg/deb/debindexfile.h
  36. 2
      apt-pkg/deb/deblistparser.cc
  37. 24
      apt-pkg/deb/deblistparser.h
  38. 6
      apt-pkg/deb/debrecords.cc
  39. 28
      apt-pkg/deb/debrecords.h
  40. 6
      apt-pkg/deb/debsrcrecords.cc
  41. 18
      apt-pkg/deb/debsrcrecords.h
  42. 4
      apt-pkg/deb/debsystem.cc
  43. 4
      apt-pkg/deb/debversion.cc
  44. 6
      apt-pkg/deb/debversion.h
  45. 19
      apt-pkg/deb/dpkgpm.h
  46. 3
      apt-pkg/depcache.cc
  47. 6
      apt-pkg/depcache.h
  48. 2
      apt-pkg/edsp/edspindexfile.h
  49. 8
      apt-pkg/edsp/edsplistparser.cc
  50. 8
      apt-pkg/edsp/edsplistparser.h
  51. 2
      apt-pkg/edsp/edspsystem.cc
  52. 41
      apt-pkg/indexcopy.h
  53. 10
      apt-pkg/indexfile.cc
  54. 12
      apt-pkg/indexfile.h
  55. 5
      apt-pkg/indexrecords.cc
  56. 30
      apt-pkg/indexrecords.h
  57. 6
      apt-pkg/init.cc
  58. 20
      apt-pkg/metaindex.h
  59. 6
      apt-pkg/orderlist.h
  60. 6
      apt-pkg/packagemanager.h
  61. 4
      apt-pkg/pkgcache.cc
  62. 16
      apt-pkg/pkgcache.h
  63. 38
      apt-pkg/pkgcachegen.h
  64. 2
      apt-pkg/pkgrecords.cc
  65. 26
      apt-pkg/pkgrecords.h
  66. 20
      apt-pkg/policy.h
  67. 33
      apt-pkg/srcrecords.h
  68. 2
      apt-pkg/tagfile.h
  69. 6
      apt-pkg/vendor.cc
  70. 22
      apt-pkg/vendor.h
  71. 3
      apt-pkg/vendorlist.cc
  72. 14
      apt-pkg/vendorlist.h
  73. 4
      apt-pkg/version.h
  74. 2
      apt-pkg/versionmatch.cc
  75. 26
      apt-pkg/versionmatch.h
  76. 7
      debian/changelog
  77. 12
      ftparchive/cachedb.cc
  78. 22
      ftparchive/cachedb.h
  79. 2
      ftparchive/contents.cc
  80. 2
      ftparchive/contents.h
  81. 6
      ftparchive/multicompress.h
  82. 6
      methods/bzip2.cc
  83. 14
      methods/connect.cc
  84. 2
      methods/connect.h
  85. 2
      methods/copy.cc
  86. 6
      methods/file.cc
  87. 10
      methods/ftp.h
  88. 3
      methods/gpgv.cc
  89. 2
      methods/gzip.cc
  90. 18
      methods/http.h
  91. 4
      methods/rred.cc
  92. 18
      methods/rsh.cc
  93. 10
      methods/rsh.h
  94. 4
      test/interactive-helper/test_udevcdrom.cc
  95. 2
      test/libapt/getlistoffilesindir_test.cc
  96. 2
      test/libapt/hashsums_test.cc
  97. 4
      test/libapt/parsedepends_test.cc
  98. 2
      test/libapt/strutil_test.cc

2
apt-inst/contrib/arfile.cc

@ -115,7 +115,7 @@ bool ARArchive::LoadHeaders()
{
unsigned int I = sizeof(Head.Name) - 1;
for (; Head.Name[I] == ' ' || Head.Name[I] == '/'; I--);
Memb->Name = string(Head.Name,I+1);
Memb->Name = std::string(Head.Name,I+1);
}
// Account for the AR header alignment

2
apt-inst/contrib/arfile.h

@ -49,7 +49,7 @@ class ARArchive
struct ARArchive::Member
{
// Fields from the header
string Name;
std::string Name;
unsigned long MTime;
unsigned long UID;
unsigned long GID;

6
apt-inst/contrib/extracttar.h

@ -19,8 +19,6 @@
#include <algorithm>
using std::min;
class ExtractTar
{
protected:
@ -38,7 +36,7 @@ class ExtractTar
int GZPid;
FileFd InFd;
bool Eof;
string DecompressProg;
std::string DecompressProg;
// Fork and reap gzip
bool StartGzip();
@ -48,7 +46,7 @@ class ExtractTar
bool Go(pkgDirStream &Stream);
ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
virtual ~ExtractTar();
};

2
apt-inst/database.cc

@ -17,7 +17,7 @@
// ---------------------------------------------------------------------
/* This re-initializes the meta temporary directory if it hasn't yet
been inited for this cycle. The flag is the emptyness of MetaDir */
bool pkgDataBase::GetMetaTmp(string &Dir)
bool pkgDataBase::GetMetaTmp(std::string &Dir)
{
if (MetaDir.empty() == true)
if (InitMetaTmp(MetaDir) == false)

6
apt-inst/database.h

@ -30,8 +30,8 @@ class pkgDataBase
pkgCacheGenerator *Cache;
pkgFLCache *FList;
string MetaDir;
virtual bool InitMetaTmp(string &Dir) = 0;
std::string MetaDir;
virtual bool InitMetaTmp(std::string &Dir) = 0;
public:
@ -40,7 +40,7 @@ class pkgDataBase
inline pkgFLCache &GetFLCache() {return *FList;};
inline pkgCacheGenerator &GetGenerator() {return *Cache;};
bool GetMetaTmp(string &Dir);
bool GetMetaTmp(std::string &Dir);
virtual bool ReadyFileList(OpProgress &Progress) = 0;
virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
virtual bool LoadChanges() = 0;

6
apt-inst/deb/debfile.cc

@ -107,8 +107,8 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
return false;
// Get into the temporary directory
string Cwd = SafeGetCWD();
string Tmp;
std::string Cwd = SafeGetCWD();
std::string Tmp;
if (DB.GetMetaTmp(Tmp) == false)
return false;
if (chdir(Tmp.c_str()) != 0)
@ -174,7 +174,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB)
{
// Open the control file
string Tmp;
std::string Tmp;
if (DB.GetMetaTmp(Tmp) == false)
return pkgCache::VerIterator(DB.GetCache());
FileFd Fd(Tmp + "control",FileFd::ReadOnly);

4
apt-inst/deb/debfile.h

@ -68,7 +68,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
char *Control;
pkgTagSection Section;
unsigned long Length;
string Member;
std::string Member;
// Members from DirStream
virtual bool DoItem(Item &Itm,int &Fd);
@ -81,7 +81,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
bool TakeControl(const void *Data,unsigned long Size);
MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
MemControlExtract(string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
~MemControlExtract() {delete [] Control;};
};
/*}}}*/

8
apt-inst/deb/dpkgdb.h

@ -25,14 +25,14 @@
class debDpkgDB : public pkgDataBase
{
protected:
string AdminDir;
std::string AdminDir;
DynamicMMap *CacheMap;
DynamicMMap *FileMap;
unsigned long DiverInode;
signed long DiverTime;
virtual bool InitMetaTmp(string &Dir);
virtual bool InitMetaTmp(std::string &Dir);
bool ReadFList(OpProgress &Progress);
bool ReadDiversions();
bool ReadConfFiles();

2
apt-inst/extract.h

@ -33,7 +33,7 @@ class pkgExtract : public pkgDirStream
bool HandleOverwrites(pkgFLCache::NodeIterator Nde,
bool DiverCheck = false);
bool CheckDirReplace(string Dir,unsigned int Depth = 0);
bool CheckDirReplace(std::string Dir,unsigned int Depth = 0);
public:

2
apt-inst/filelist.h

@ -48,7 +48,7 @@ class pkgFLCache
class DiverIterator;
protected:
string CacheFile;
std::string CacheFile;
DynamicMMap &Map;
map_ptrloc LastTreeLookup;
unsigned long LastLookupSize;

38
apt-pkg/acquire-method.h

@ -34,8 +34,8 @@ class pkgAcqMethod
{
FetchItem *Next;
string Uri;
string DestFile;
std::string Uri;
std::string DestFile;
time_t LastModified;
bool IndexFile;
bool FailIgnore;
@ -43,14 +43,14 @@ class pkgAcqMethod
struct FetchResult
{
string MD5Sum;
string SHA1Sum;
string SHA256Sum;
string SHA512Sum;
vector<string> GPGVOutput;
std::string MD5Sum;
std::string SHA1Sum;
std::string SHA256Sum;
std::string SHA512Sum;
std::vector<std::string> GPGVOutput;
time_t LastModified;
bool IMSHit;
string Filename;
std::string Filename;
unsigned long long Size;
unsigned long long ResumePoint;
@ -59,25 +59,25 @@ class pkgAcqMethod
};
// State
vector<string> Messages;
std::vector<std::string> Messages;
FetchItem *Queue;
FetchItem *QueueBack;
string FailReason;
string UsedMirror;
string IP;
std::string FailReason;
std::string UsedMirror;
std::string IP;
// Handlers for messages
virtual bool Configuration(string Message);
virtual bool Configuration(std::string Message);
virtual bool Fetch(FetchItem * /*Item*/) {return true;};
// Outgoing messages
void Fail(bool Transient = false);
inline void Fail(const char *Why, bool Transient = false) {Fail(string(Why),Transient);};
virtual void Fail(string Why, bool Transient = false);
inline void Fail(const char *Why, bool Transient = false) {Fail(std::string(Why),Transient);};
virtual void Fail(std::string Why, bool Transient = false);
virtual void URIStart(FetchResult &Res);
virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
bool MediaFail(string Required,string Drive);
bool MediaFail(std::string Required,std::string Drive);
virtual void Exit() {};
void PrintStatus(char const * const header, const char* Format, va_list &args) const;
@ -91,11 +91,11 @@ class pkgAcqMethod
void Log(const char *Format,...);
void Status(const char *Format,...);
void Redirect(const string &NewURI);
void Redirect(const std::string &NewURI);
int Run(bool Single = false);
inline void SetFailReason(string Msg) {FailReason = Msg;};
inline void SetIP(string aIP) {IP = aIP;};
inline void SetFailReason(std::string Msg) {FailReason = Msg;};
inline void SetIP(std::string aIP) {IP = aIP;};
pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
virtual ~pkgAcqMethod() {};

12
apt-pkg/acquire-worker.h

@ -79,7 +79,7 @@ class pkgAcquire::Worker : public WeakPointable
*
* \todo Doesn't this duplicate Config->Access?
*/
string Access;
std::string Access;
/** \brief The PID of the subprocess. */
pid_t Process;
@ -118,13 +118,13 @@ class pkgAcquire::Worker : public WeakPointable
/** \brief The raw text values of messages received from the
* worker, in sequence.
*/
vector<string> MessageQueue;
std::vector<std::string> MessageQueue;
/** \brief Buffers pending writes to the subprocess.
*
* \todo Wouldn't a std::dequeue be more appropriate?
*/
string OutQueue;
std::string OutQueue;
/** \brief Common code for the constructor.
*
@ -183,7 +183,7 @@ class pkgAcquire::Worker : public WeakPointable
*
* \return \b true.
*/
bool Capabilities(string Message);
bool Capabilities(std::string Message);
/** \brief Send a 601 Configuration message (containing the APT
* configuration) to the subprocess.
@ -214,7 +214,7 @@ class pkgAcquire::Worker : public WeakPointable
* 603 Media Changed, with the Failed field set to \b true if the
* user cancelled the media change).
*/
bool MediaChange(string Message);
bool MediaChange(std::string Message);
/** \brief Invoked when the worked process dies unexpectedly.
*
@ -242,7 +242,7 @@ class pkgAcquire::Worker : public WeakPointable
/** \brief The most recent status string received from the
* subprocess.
*/
string Status;
std::string Status;
/** \brief How many bytes of the file have been downloaded. Zero
* if the current progress of the file cannot be determined.

36
apt-pkg/acquire.h

@ -72,10 +72,6 @@
#include <vector>
#include <string>
using std::vector;
using std::string;
#include <sys/time.h>
#include <unistd.h>
@ -107,8 +103,8 @@ class pkgAcquire
friend class Item;
friend class Queue;
typedef vector<Item *>::iterator ItemIterator;
typedef vector<Item *>::const_iterator ItemCIterator;
typedef std::vector<Item *>::iterator ItemIterator;
typedef std::vector<Item *>::const_iterator ItemCIterator;
protected:
@ -117,7 +113,7 @@ class pkgAcquire
* This is built monotonically as items are created and only
* emptied when the download shuts down.
*/
vector<Item *> Items;
std::vector<Item *> Items;
/** \brief The head of the list of active queues.
*
@ -202,7 +198,7 @@ class pkgAcquire
* \return the string-name of the queue in which a fetch request
* for the given URI should be placed.
*/
string QueueName(string URI,MethodConfig const *&Config);
std::string QueueName(std::string URI,MethodConfig const *&Config);
/** \brief Build up the set of file descriptors upon which select() should
* block.
@ -248,7 +244,7 @@ class pkgAcquire
*
* \return the method whose name is Access, or \b NULL if no such method exists.
*/
MethodConfig *GetConfig(string Access);
MethodConfig *GetConfig(std::string Access);
/** \brief Provides information on how a download terminated. */
enum RunResult {
@ -319,7 +315,7 @@ class pkgAcquire
*
* \return \b true if the directory exists and is readable.
*/
bool Clean(string Dir);
bool Clean(std::string Dir);
/** \return the total size in bytes of all the items included in
* this download.
@ -347,7 +343,7 @@ class pkgAcquire
* only one Acquire class is in action at the time or an empty string
* if no lock file should be used.
*/
bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
@ -372,11 +368,11 @@ class pkgAcquire
struct pkgAcquire::ItemDesc : public WeakPointable
{
/** \brief The URI from which to download this item. */
string URI;
std::string URI;
/** brief A description of this item. */
string Description;
std::string Description;
/** brief A shorter description of this item. */
string ShortDesc;
std::string ShortDesc;
/** brief The underlying item which is to be downloaded. */
Item *Owner;
};
@ -420,7 +416,7 @@ class pkgAcquire::Queue
};
/** \brief The name of this queue. */
string Name;
std::string Name;
/** \brief The head of the list of items contained in this queue.
*
@ -475,7 +471,7 @@ class pkgAcquire::Queue
* \return the first item in the queue whose URI is #URI and that
* is being downloaded by #Owner.
*/
QItem *FindItem(string URI,pkgAcquire::Worker *Owner);
QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner);
/** Presumably this should start downloading an item?
*
@ -538,7 +534,7 @@ class pkgAcquire::Queue
* \param Name The name of the new queue.
* \param Owner The download process that owns the new queue.
*/
Queue(string Name,pkgAcquire *Owner);
Queue(std::string Name,pkgAcquire *Owner);
/** Shut down all the worker processes associated with this queue
* and empty the queue.
@ -603,10 +599,10 @@ struct pkgAcquire::MethodConfig
MethodConfig *Next;
/** \brief The name of this acquire method (e.g., http). */
string Access;
std::string Access;
/** \brief The implementation version of this acquire method. */
string Version;
std::string Version;
/** \brief If \b true, only one download queue should be created for this
* method.
@ -748,7 +744,7 @@ class pkgAcquireStatus
* \todo This is a horrible blocking monster; it should be CPSed
* with prejudice.
*/
virtual bool MediaChange(string Media,string Drive) = 0;
virtual bool MediaChange(std::string Media,std::string Drive) = 0;
/** \brief Invoked when an item is confirmed to be up-to-date.

6
apt-pkg/algorithms.h

@ -37,8 +37,6 @@
#include <iostream>
using std::ostream;
class pkgSimulate : public pkgPackageManager /*{{{*/
{
protected:
@ -63,13 +61,13 @@ class pkgSimulate : public pkgPackageManager /*{{{*/
pkgDepCache::ActionGroup group;
// The Actuall installation implementation
virtual bool Install(PkgIterator Pkg,string File);
virtual bool Install(PkgIterator Pkg,std::string File);
virtual bool Configure(PkgIterator Pkg);
virtual bool Remove(PkgIterator Pkg,bool Purge);
private:
void ShortBreaks();
void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate);
void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candidate);
public:

10
apt-pkg/aptconfiguration.cc

@ -59,10 +59,10 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if ((*o).empty() == true)
continue;
// ignore types we have no method ready to use
if (_config->Exists(string("Acquire::CompressionTypes::").append(*o)) == false)
if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false)
continue;
// ignore types we have no app ready to use
string const appsetting = string("Dir::Bin::").append(*o);
std::string const appsetting = std::string("Dir::Bin::").append(*o);
if (_config->Exists(appsetting) == true) {
std::string const app = _config->FindFile(appsetting.c_str(), "");
if (app.empty() == false && FileExists(app) == false)
@ -83,7 +83,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
continue;
// ignore types we have no app ready to use
string const appsetting = string("Dir::Bin::").append(Types->Value);
std::string const appsetting = std::string("Dir::Bin::").append(Types->Value);
if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
std::string const app = _config->FindFile(appsetting.c_str(), "");
if (app.empty() == false && FileExists(app) == false)
@ -95,7 +95,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
// add the special "uncompressed" type
if (std::find(types.begin(), types.end(), "uncompressed") == types.end())
{
string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
std::string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
if (uncompr.empty() == true || FileExists(uncompr) == true)
types.push_back("uncompressed");
}
@ -441,7 +441,7 @@ Configuration::Compressor::Compressor(char const *name, char const *extension,
char const *binary,
char const *compressArg, char const *uncompressArg,
unsigned short const cost) {
std::string const config = string("APT:Compressor::").append(name).append("::");
std::string const config = std::string("APT:Compressor::").append(name).append("::");
Name = _config->Find(std::string(config).append("Name"), name);
Extension = _config->Find(std::string(config).append("Extension"), extension);
Binary = _config->Find(std::string(config).append("Binary"), binary);

6
apt-pkg/cacheiterators.h

@ -111,7 +111,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
inline PkgIterator PackageList() const;
PkgIterator FindPkg(string Arch = "any") const;
PkgIterator FindPkg(std::string Arch = "any") const;
/** \brief find the package with the "best" architecture
The best architecture is either the "native" or the first
@ -219,7 +219,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
inline VerFileIterator FileList() const;
bool Downloadable() const;
inline const char *PriorityType() const {return Owner->Priority(S->Priority);};
string RelStr() const;
std::string RelStr() const;
bool Automatic() const;
VerFileIterator NewestFile() const;
@ -365,7 +365,7 @@ class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator>
inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;};
bool IsOk();
string RelStr();
std::string RelStr();
// Constructors
inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {};

38
apt-pkg/cdrom.h

@ -6,8 +6,6 @@
#include<vector>
using namespace std;
class pkgCdromStatus /*{{{*/
{
protected:
@ -20,12 +18,12 @@ class pkgCdromStatus /*{{{*/
// total steps
virtual void SetTotal(int total) { totalSteps = total; };
// update steps, will be called regularly as a "pulse"
virtual void Update(string text="", int current=0) = 0;
virtual void Update(std::string text="", int current=0) = 0;
// ask for cdrom insert
virtual bool ChangeCdrom() = 0;
// ask for cdrom name
virtual bool AskCdromName(string &Name) = 0;
virtual bool AskCdromName(std::string &Name) = 0;
// Progress indicator for the Index rewriter
virtual OpProgress* GetOpProgress() {return NULL; };
};
@ -47,22 +45,22 @@ class pkgCdrom /*{{{*/
};
bool FindPackages(string CD,
vector<string> &List,
vector<string> &SList,
vector<string> &SigList,
vector<string> &TransList,
string &InfoDir, pkgCdromStatus *log,
bool FindPackages(std::string CD,
std::vector<std::string> &List,
std::vector<std::string> &SList,
std::vector<std::string> &SigList,
std::vector<std::string> &TransList,
std::string &InfoDir, pkgCdromStatus *log,
unsigned int Depth = 0);
bool DropBinaryArch(vector<string> &List);
bool DropRepeats(vector<string> &List,const char *Name);
void ReduceSourcelist(string CD,vector<string> &List);
bool DropBinaryArch(std::vector<std::string> &List);
bool DropRepeats(std::vector<std::string> &List,const char *Name);
void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
bool WriteDatabase(Configuration &Cnf);
bool WriteSourceList(string Name,vector<string> &List,bool Source);
int Score(string Path);
bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);
int Score(std::string Path);
public:
bool Ident(string &ident, pkgCdromStatus *log);
bool Ident(std::string &ident, pkgCdromStatus *log);
bool Add(pkgCdromStatus *log);
};
/*}}}*/
@ -71,9 +69,9 @@ class pkgCdrom /*{{{*/
// class that uses libudev to find cdrom/removable devices dynamically
struct CdromDevice /*{{{*/
{
string DeviceName;
std::string DeviceName;
bool Mounted;
string MountPath;
std::string MountPath;
};
/*}}}*/
class pkgUdevCdromDevices /*{{{*/
@ -104,9 +102,9 @@ class pkgUdevCdromDevices /*{{{*/
// convenience interface, this will just call ScanForRemovable
// with "APT::cdrom::CdromOnly"
vector<CdromDevice> Scan();
std::vector<CdromDevice> Scan();
vector<CdromDevice> ScanForRemovable(bool CdromOnly);
std::vector<CdromDevice> ScanForRemovable(bool CdromOnly);
};
/*}}}*/

10
apt-pkg/clean.cc

@ -26,7 +26,7 @@
// ---------------------------------------------------------------------
/* Scan the directory for files to erase, we check the version information
against our database to see if it is interesting */
bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
{
bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
@ -34,7 +34,7 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
string StartDir = SafeGetCWD();
std::string StartDir = SafeGetCWD();
if (chdir(Dir.c_str()) != 0)
{
closedir(D);
@ -63,21 +63,21 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
for (; *I != 0 && *I != '_';I++);
if (*I != '_')
continue;
string Pkg = DeQuoteString(string(Dir->d_name,I-Dir->d_name));
std::string Pkg = DeQuoteString(std::string(Dir->d_name,I-Dir->d_name));
// Grab the version
const char *Start = I + 1;
for (I = Start; *I != 0 && *I != '_';I++);
if (*I != '_')
continue;
string Ver = DeQuoteString(string(Start,I-Start));
std::string Ver = DeQuoteString(std::string(Start,I-Start));
// Grab the arch
Start = I + 1;
for (I = Start; *I != 0 && *I != '.' ;I++);
if (*I != '.')
continue;
string const Arch = DeQuoteString(string(Start,I-Start));
std::string const Arch = DeQuoteString(std::string(Start,I-Start));
if (APT::Configuration::checkArchitecture(Arch) == false)
continue;

4
apt-pkg/clean.h

@ -20,11 +20,11 @@ class pkgArchiveCleaner
protected:
virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,struct stat & /*St*/) {};
virtual void Erase(const char * /*File*/,std::string /*Pkg*/,std::string /*Ver*/,struct stat & /*St*/) {};
public:
bool Go(string Dir,pkgCache &Cache);
bool Go(std::string Dir,pkgCache &Cache);
virtual ~pkgArchiveCleaner() {};
};

2
apt-pkg/contrib/cdromutl.cc

@ -30,6 +30,8 @@
#include <apti18n.h>
/*}}}*/
using std::string;
// IsMounted - Returns true if the mount point is mounted /*{{{*/
// ---------------------------------------------------------------------
/* This is a simple algorithm that should always work, we stat the mount point

12
apt-pkg/contrib/cdromutl.h

@ -12,13 +12,11 @@
#include <string>
using std::string;
// mount cdrom, DeviceName (e.g. /dev/sr0) is optional
bool MountCdrom(string Path, string DeviceName="");
bool UnmountCdrom(string Path);
bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
bool IsMounted(string &Path);
string FindMountPointForDevice(const char *device);
bool MountCdrom(std::string Path, std::string DeviceName="");
bool UnmountCdrom(std::string Path);
bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2);
bool IsMounted(std::string &Path);
std::string FindMountPointForDevice(const char *device);
#endif

46
apt-pkg/contrib/configuration.h

@ -34,21 +34,19 @@
#include <vector>
#include <iostream>
using std::string;
class Configuration
{
public:
struct Item
{
string Value;
string Tag;
std::string Value;
std::string Tag;
Item *Parent;
Item *Child;
Item *Next;
string FullTag(const Item *Stop = 0) const;
std::string FullTag(const Item *Stop = 0) const;
Item() : Parent(0), Child(0), Next(0) {};
};
@ -67,35 +65,35 @@ class Configuration
public:
string Find(const char *Name,const char *Default = 0) const;
string Find(string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
string Find(string const &Name, string const &Default) const {return Find(Name.c_str(),Default.c_str());};
string FindFile(const char *Name,const char *Default = 0) const;
string FindDir(const char *Name,const char *Default = 0) const;
std::vector<string> FindVector(const char *Name) const;
std::vector<string> FindVector(string const &Name) const { return FindVector(Name.c_str()); };
std::string Find(const char *Name,const char *Default = 0) const;
std::string Find(std::string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());};
std::string FindFile(const char *Name,const char *Default = 0) const;
std::string FindDir(const char *Name,const char *Default = 0) const;
std::vector<std::string> FindVector(const char *Name) const;
std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str()); };
int FindI(const char *Name,int const &Default = 0) const;
int FindI(string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
bool FindB(const char *Name,bool const &Default = false) const;
bool FindB(string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
string FindAny(const char *Name,const char *Default = 0) const;
bool FindB(std::string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
std::string FindAny(const char *Name,const char *Default = 0) const;
inline void Set(const string &Name,const string &Value) {Set(Name.c_str(),Value);};
void CndSet(const char *Name,const string &Value);
inline void Set(const std::string &Name,const std::string &Value) {Set(Name.c_str(),Value);};
void CndSet(const char *Name,const std::string &Value);
void CndSet(const char *Name,const int Value);
void Set(const char *Name,const string &Value);
void Set(const char *Name,const std::string &Value);
void Set(const char *Name,const int &Value);
inline bool Exists(const string &Name) const {return Exists(Name.c_str());};
inline bool Exists(const std::string &Name) const {return Exists(Name.c_str());};
bool Exists(const char *Name) const;
bool ExistsAny(const char *Name) const;
// clear a whole tree
void Clear(const string &Name);
void Clear(const std::string &Name);
// remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
void Clear(string const &List, string const &Value);
void Clear(string const &List, int const &Value);
void Clear(std::string const &List, std::string const &Value);
void Clear(std::string const &List, int const &Value);
inline const Item *Tree(const char *Name) const {return Lookup(Name);};
@ -127,11 +125,11 @@ class Configuration
extern Configuration *_config;
bool ReadConfigFile(Configuration &Conf,const string &FName,
bool ReadConfigFile(Configuration &Conf,const std::string &FName,
bool const &AsSectional = false,
unsigned const &Depth = 0);
bool ReadConfigDir(Configuration &Conf,const string &Dir,
bool ReadConfigDir(Configuration &Conf,const std::string &Dir,
bool const &AsSectional = false,
unsigned const &Depth = 0);

42
apt-pkg/contrib/fileutl.h

@ -31,8 +31,6 @@
/* Define this for python-apt */
#define APT_HAS_GZIP 1
using std::string;
class FileFd
{
protected:
@ -41,8 +39,8 @@ class FileFd
enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
HitEof = (1<<3), Replace = (1<<4) };
unsigned long Flags;
string FileName;
string TemporaryFileName;
std::string FileName;
std::string TemporaryFileName;
gzFile gz;
public:
@ -79,7 +77,7 @@ class FileFd
return T;
}
bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool Open(std::string FileName,OpenMode Mode,unsigned long Perms = 0666);
bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
bool Close();
bool Sync();
@ -93,9 +91,9 @@ class FileFd
inline void EraseOnFailure() {Flags |= DelOnFail;};
inline void OpFail() {Flags |= Fail;};
inline bool Eof() {return (Flags & HitEof) == HitEof;};
inline string &Name() {return FileName;};
inline std::string &Name() {return FileName;};
FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1),
FileFd(std::string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1),
Flags(0), gz(NULL)
{
Open(FileName,Mode,Perms);
@ -107,12 +105,12 @@ class FileFd
bool RunScripts(const char *Cnf);
bool CopyFile(FileFd &From,FileFd &To);
int GetLock(string File,bool Errors = true);
bool FileExists(string File);
bool RealFileExists(string File);
bool DirectoryExists(string const &Path) __attrib_const;
bool CreateDirectory(string const &Parent, string const &Path);
time_t GetModificationTime(string const &Path);
int GetLock(std::string File,bool Errors = true);
bool FileExists(std::string File);
bool RealFileExists(std::string File);
bool DirectoryExists(std::string const &Path) __attrib_const;
bool CreateDirectory(std::string const &Parent, std::string const &Path);
time_t GetModificationTime(std::string const &Path);
/** \brief Ensure the existence of the given Path
*
@ -120,13 +118,13 @@ time_t GetModificationTime(string const &Path);
* /apt/ will be removed before CreateDirectory call.
* \param Path which should exist after (successful) call
*/
bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path);
bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path);
std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::string const &Ext,
bool const &SortList, bool const &AllowNoExt=false);
std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::vector<std::string> const &Ext,
bool const &SortList);
string SafeGetCWD();
std::string SafeGetCWD();
void SetCloseExec(int Fd,bool Close);
void SetNonBlock(int Fd,bool Block);
bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
@ -134,10 +132,10 @@ pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
// File string manipulators
string flNotDir(string File);
string flNotFile(string File);
string flNoLink(string File);
string flExtension(string File);
string flCombine(string Dir,string File);
std::string flNotDir(std::string File);
std::string flNotFile(std::string File);
std::string flNoLink(std::string File);
std::string flExtension(std::string File);
std::string flCombine(std::string Dir,std::string File);
#endif

26
apt-pkg/contrib/hashes.cc

@ -32,20 +32,20 @@ HashString::HashString()
{
}
HashString::HashString(string Type, string Hash) : Type(Type), Hash(Hash)
HashString::HashString(std::string Type, std::string Hash) : Type(Type), Hash(Hash)
{
}
HashString::HashString(string StringedHash) /*{{{*/
HashString::HashString(std::string StringedHash) /*{{{*/
{
// legacy: md5sum without "MD5Sum:" prefix
if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
if (StringedHash.find(":") == std::string::npos && StringedHash.size() == 32)
{
Type = "MD5Sum";
Hash = StringedHash;
return;
}
string::size_type pos = StringedHash.find(":");
std::string::size_type pos = StringedHash.find(":");
Type = StringedHash.substr(0,pos);
Hash = StringedHash.substr(pos+1, StringedHash.size() - pos);
@ -53,34 +53,34 @@ HashString::HashString(string StringedHash) /*{{{*/
std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
}
/*}}}*/
bool HashString::VerifyFile(string filename) const /*{{{*/
bool HashString::VerifyFile(std::string filename) const /*{{{*/
{
string fileHash;
std::string fileHash;
FileFd Fd(filename, FileFd::ReadOnly);
if(Type == "MD5Sum")
{
MD5Summation MD5;
MD5.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)MD5.Result();
fileHash = (std::string)MD5.Result();
}
else if (Type == "SHA1")
{
SHA1Summation SHA1;
SHA1.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA1.Result();
fileHash = (std::string)SHA1.Result();
}
else if (Type == "SHA256")
{
SHA256Summation SHA256;
SHA256.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA256.Result();
fileHash = (std::string)SHA256.Result();
}
else if (Type == "SHA512")
{
SHA512Summation SHA512;
SHA512.AddFD(Fd.Fd(), Fd.Size());
fileHash = (string)SHA512.Result();
fileHash = (std::string)SHA512.Result();
}
Fd.Close();
@ -100,9 +100,9 @@ bool HashString::empty() const
return (Type.empty() || Hash.empty());
}
string HashString::toStr() const
std::string HashString::toStr() const
{
return Type+string(":")+Hash;
return Type + std::string(":") + Hash;
}
// Hashes::AddFD - Add the contents of the FD /*{{{*/
@ -117,7 +117,7 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
if (!ToEOF) n = min(Size, n);
if (!ToEOF) n = std::min(Size, n);
Res = read(Fd,Buf,n);
if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
return false;

17
apt-pkg/contrib/hashes.h

@ -22,31 +22,28 @@
#include <vector>
#include <cstring>
using std::min;
using std::vector;
// helper class that contains hash function name
// and hash
class HashString
{
protected:
string Type;
string Hash;
std::string Type;
std::string Hash;
static const char * _SupportedHashes[10];
public:
HashString(string Type, string Hash);
HashString(string StringedHashString); // init from str as "type:hash"
HashString(std::string Type, std::string Hash);
HashString(std::string StringedHashString); // init from str as "type:hash"
HashString();
// get hash type used
string HashType() { return Type; };
std::string HashType() { return Type; };
// verify the given filename against the currently loaded hash
bool VerifyFile(string filename) const;
bool VerifyFile(std::string filename) const;
// helper
string toStr() const; // convert to str as "type:hash"
std::string toStr() const; // convert to str as "type:hash"
bool empty() const;
// return the list of hashes we support

2
apt-pkg/contrib/hashsum.cc

@ -14,7 +14,7 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
if (!ToEOF) n = min(Size, n);
if (!ToEOF) n = std::min(Size, n);
Res = read(Fd, Buf, n);
if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
return false;

13
apt-pkg/contrib/hashsum_template.h

@ -15,9 +15,6 @@
#include <algorithm>
#include <stdint.h>
using std::string;
using std::min;
template<int N>
class HashSumValue
{
@ -31,7 +28,7 @@ class HashSumValue
return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
};
string Value() const
std::string Value() const
{
char Conv[16] =
{ '0','1','2','3','4','5','6','7','8','9','a','b',
@ -48,7 +45,7 @@ class HashSumValue
Result[I] = Conv[Sum[J] >> 4];
Result[I + 1] = Conv[Sum[J] & 0xF];
}
return string(Result);
return std::string(Result);
};
inline void Value(unsigned char S[N/8])
@ -57,12 +54,12 @@ class HashSumValue
S[I] = Sum[I];
};
inline operator string() const
inline operator std::string() const
{
return Value();
};
bool Set(string Str)
bool Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
};
@ -73,7 +70,7 @@ class HashSumValue
Sum[I] = S[I];
};
HashSumValue(string Str)
HashSumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);

3
apt-pkg/contrib/md5.h

@ -29,9 +29,6 @@
#include <algorithm>
#include <stdint.h>
using std::string;
using std::min;
#include "hashsum_template.h"
typedef HashSumValue<128> MD5SumValue;

4
apt-pkg/contrib/mmap.h

@ -29,8 +29,6 @@
#include <string>
#include <apt-pkg/fileutl.h>
using std::string;
/* This should be a 32 bit type, larger tyes use too much ram and smaller
types are too small. Where ever possible 'unsigned long' should be used
instead of this internal type */
@ -102,7 +100,7 @@ class DynamicMMap : public MMap
unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0);
unsigned long Allocate(unsigned long ItemSize);
unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
inline unsigned long WriteString(const std::string &S) {return WriteString(S.c_str(),S.length());};
void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &WorkSpace = 2*1024*1024,

1
apt-pkg/contrib/netrc.cc

@ -24,6 +24,7 @@
#include "netrc.h"
using std::string;
/* Get user and password from .netrc when given a machine name */

2
apt-pkg/contrib/netrc.h

@ -25,5 +25,5 @@
// If login[0] != 0, search for password within machine and login.
int parsenetrc (char *host, char *login, char *password, char *filename);
void maybe_add_auth (URI &Uri, string NetRCFile);
void maybe_add_auth (URI &Uri, std::string NetRCFile);
#endif

18
apt-pkg/contrib/progress.h

@ -25,8 +25,6 @@
#include <string>
#include <sys/time.h>
using std::string;
class Configuration;
class OpProgress
{
@ -38,13 +36,13 @@ class OpProgress
// Change reduction code
struct timeval LastTime;
string LastOp;
string LastSubOp;
std::string LastOp;
std::string LastSubOp;
protected:
string Op;
string SubOp;
std::string Op;
std::string SubOp;
float Percent;
bool MajorChange;
@ -55,9 +53,9 @@ class OpProgress
public:
void Progress(unsigned long long Current);
void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1);
void SubProgress(unsigned long long SubTotal, const std::string &Op = "", float const Percent = -1);
void OverallProgress(unsigned long long Current,unsigned long long Total,
unsigned long long Size,const string &Op);
unsigned long long Size,const std::st