File apt-missing_includes.patch of Package apt
--- apt-pkg/acquire-method.h
+++ apt-pkg/acquire-method.h
@@ -32,21 +32,21 @@
{
FetchItem *Next;
- string Uri;
- string DestFile;
+ std::string Uri;
+ std::string DestFile;
time_t LastModified;
bool IndexFile;
};
struct FetchResult
{
- string MD5Sum;
- string SHA1Sum;
+ std::string MD5Sum;
+ std::string SHA1Sum;
// CNC:2002-07-03
- string SignatureFP;
+ std::string SignatureFP;
time_t LastModified;
bool IMSHit;
- string Filename;
+ std::string Filename;
unsigned long Size;
unsigned long ResumePoint;
@@ -55,26 +55,26 @@
};
// State
- vector<string> Messages;
+ std::vector<std::string> Messages;
FetchItem *Queue;
FetchItem *QueueBack;
- string FailExtra;
+ std::string FailExtra;
// 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);};
- void Fail(string Why, bool Transient = false);
+ inline void Fail(const char *Why, bool Transient = false) {Fail(std::string(Why),Transient);};
+ void Fail(std::string Why, bool Transient = false);
void URIStart(FetchResult &Res);
void URIDone(FetchResult &Res,FetchResult *Alt = 0);
- bool MediaFail(string Required,string Drive);
- bool NeedAuth(string Description,string &User,string &Pass);
+ bool MediaFail(std::string Required,std::string Drive);
+ bool NeedAuth(std::string Description,std::string &User,std::string &Pass);
virtual void Exit() {};
// CNC:2004-04-27
- virtual string PreferredURI() { return ""; };
+ virtual std::string PreferredURI() { return ""; };
public:
@@ -86,10 +86,10 @@
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 SetFailExtraMsg(string Msg) {FailExtra = Msg;};
+ inline void SetFailExtraMsg(std::string Msg) {FailExtra = Msg;};
pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
virtual ~pkgAcqMethod() {};
--- apt-pkg/contrib/cdromutl.cc
+++ apt-pkg/contrib/cdromutl.cc
@@ -34,6 +34,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
+#include <cstring>
+#include <cstdlib>
/*}}}*/
// IsMounted - Returns true if the mount point is mounted /*{{{*/
@@ -94,7 +96,7 @@
if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true)
{
- if (system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0)
+ if (std::system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0)
_exit(100);
_exit(0);
}
@@ -142,7 +144,7 @@
if (_config->Exists("Acquire::cdrom::"+Path+"::Mount") == true)
{
- if (system(_config->Find("Acquire::cdrom::"+Path+"::Mount").c_str()) != 0)
+ if (std::system(_config->Find("Acquire::cdrom::"+Path+"::Mount").c_str()) != 0)
_exit(100);
_exit(0);
}
@@ -184,8 +186,8 @@
for (struct dirent *Dir = readdir(D); Dir != 0; Dir = readdir(D))
{
// Skip some files..
- if (strcmp(Dir->d_name,".") == 0 ||
- strcmp(Dir->d_name,"..") == 0)
+ if (std::strcmp(Dir->d_name,".") == 0 ||
+ std::strcmp(Dir->d_name,"..") == 0)
continue;
if (Version <= 1)
--- apt-pkg/contrib/cmndline.cc
+++ apt-pkg/contrib/cmndline.cc
@@ -14,6 +14,9 @@
#ifdef __GNUG__
#pragma implementation "apt-pkg/cmndline.h"
#endif
+#include <cstring>
+using std::strlen;
+
#include <apt-pkg/cmndline.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
@@ -185,7 +188,7 @@
{
if (Argument == 0)
return _error->Error(_("Option %s requires an argument."),argv[I]);
- Opt += strlen(Opt);
+ Opt += std::strlen(Opt);
I += IncI;
// Parse a configuration file
@@ -240,7 +243,7 @@
if (EndPtr != 0 && EndPtr != Argument && *EndPtr == 0)
{
Conf->Set(A->ConfName,Value);
- Opt += strlen(Opt);
+ Opt += std::strlen(Opt);
I += IncI;
return true;
}
@@ -264,7 +267,7 @@
if (PreceedMatch == false)
break;
- if (strlen(argv[I]) >= sizeof(Buffer))
+ if (std::strlen(argv[I]) >= sizeof(Buffer))
return _error->Error(_("Option '%s' is too long"),argv[I]);
// Skip the leading dash
@@ -275,7 +278,7 @@
for (; *JEnd != 0 && *JEnd != '-'; JEnd++);
if (*JEnd != 0)
{
- strncpy(Buffer,J,JEnd - J);
+ std::strncpy(Buffer,J,JEnd - J);
Buffer[JEnd - J] = 0;
Argument = Buffer;
CertainArg = true;
@@ -291,7 +294,7 @@
// Eat the argument
if (Argument != Buffer)
{
- Opt += strlen(Opt);
+ Opt += std::strlen(Opt);
I += IncI;
}
break;
@@ -335,7 +338,7 @@
int I;
for (I = 0; Map[I].Match != 0; I++)
{
- if (strcmp(FileList[0],Map[I].Match) == 0)
+ if (std::strcmp(FileList[0],Map[I].Match) == 0)
{
bool Res = Map[I].Handler(*this);
if (Res == false && _error->PendingError() == false)
--- apt-pkg/contrib/configuration.cc
+++ apt-pkg/contrib/configuration.cc
@@ -33,6 +33,7 @@
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <cstring>
using namespace std;
/*}}}*/
--- apt-pkg/contrib/error.cc
+++ apt-pkg/contrib/error.cc
@@ -26,7 +26,8 @@
#include <string>
#include <stdarg.h>
#include <unistd.h>
-
+#include <string.h>
+
#include "config.h"
/*}}}*/
--- apt-pkg/contrib/fileutl.cc
+++ apt-pkg/contrib/fileutl.cc
@@ -30,6 +30,8 @@
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
// CNC:2003-02-14 - Ralf Corsepius told RH8 with GCC 3.2.1 fails
// compiling without moving this header to here.
--- apt-pkg/contrib/md5.cc
+++ apt-pkg/contrib/md5.cc
@@ -172,7 +172,7 @@
// MD5SumValue::MD5SumValue - Constructs the summation from a string /*{{{*/
// ---------------------------------------------------------------------
/* The string form of a MD5 is a 32 character hex number */
-MD5SumValue::MD5SumValue(string Str)
+MD5SumValue::MD5SumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -183,13 +183,13 @@
/* Sets the value to 0 */
MD5SumValue::MD5SumValue()
{
- memset(Sum,0,sizeof(Sum));
+ std::memset(Sum,0,sizeof(Sum));
}
/*}}}*/
// MD5SumValue::Set - Set the sum from a string /*{{{*/
// ---------------------------------------------------------------------
/* Converts the hex string into a set of chars */
-bool MD5SumValue::Set(string Str)
+bool MD5SumValue::Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
}
@@ -197,7 +197,7 @@
// MD5SumValue::Value - Convert the number into a string /*{{{*/
// ---------------------------------------------------------------------
/* Converts the set of chars into a hex string in lower case */
-string MD5SumValue::Value() const
+std::string MD5SumValue::Value() const
{
char Conv[16] = {'0','1','2','3','4','5','6','7','8','9','a','b',
'c','d','e','f'};
@@ -213,7 +213,7 @@
Result[I + 1] = Conv[Sum[J] & 0xF];
}
- return string(Result);
+ return std::string(Result);
}
/*}}}*/
// MD5SumValue::operator == - Comparitor /*{{{*/
--- apt-pkg/contrib/md5.h
+++ apt-pkg/contrib/md5.h
@@ -28,8 +28,7 @@
#endif
#include <string>
-
-using std::string;
+#include <cstring>
class MD5Summation;
@@ -42,15 +41,15 @@
// Accessors
bool operator ==(const MD5SumValue &rhs) const;
- string Value() const;
+ std::string Value() const;
inline void Value(unsigned char S[16])
{for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
- inline operator string() const {return Value();};
- bool Set(string Str);
+ inline operator std::string() const {return Value();};
+ bool Set(std::string Str);
inline void Set(unsigned char S[16])
{for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
- MD5SumValue(string Str);
+ MD5SumValue(std::string Str);
MD5SumValue();
};
@@ -64,7 +63,7 @@
public:
bool Add(const unsigned char *Data,unsigned long Size);
- inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
+ inline bool Add(const char *Data) {return Add((unsigned char *)Data,std::strlen(Data));};
bool AddFD(int Fd,unsigned long Size);
inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);};
--- apt-pkg/contrib/mmap.cc
+++ apt-pkg/contrib/mmap.cc
@@ -35,6 +35,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+#include <cstring>
/*}}}*/
// MMap::MMap - Constructor /*{{{*/
@@ -176,7 +177,7 @@
return;
Base = new unsigned char[WorkSpace];
- memset(Base,0,WorkSpace);
+ std::memset(Base,0,WorkSpace);
iSize = 0;
}
/*}}}*/
@@ -278,9 +279,9 @@
}
if (Len == (unsigned long)-1)
- Len = strlen(String);
+ Len = std::strlen(String);
iSize += Len + 1;
- memcpy((char *)Base + Result,String,Len);
+ std::memcpy((char *)Base + Result,String,Len);
((char *)Base)[Result + Len] = 0;
return Result;
}
--- apt-pkg/contrib/progress.cc
+++ apt-pkg/contrib/progress.cc
@@ -19,6 +19,7 @@
#include <iostream>
#include <stdio.h>
+#include <string.h>
/*}}}*/
using namespace std;
--- apt-pkg/contrib/sha1.cc
+++ apt-pkg/contrib/sha1.cc
@@ -185,7 +185,7 @@
// SHA1SumValue::SHA1SumValue - Constructs the summation from a string /*{{{*/
// ---------------------------------------------------------------------
/* The string form of a SHA1 is a 40 character hex number */
-SHA1SumValue::SHA1SumValue(string Str)
+SHA1SumValue::SHA1SumValue(std::string Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -204,7 +204,7 @@
// SHA1SumValue::Set - Set the sum from a string /*{{{*/
// ---------------------------------------------------------------------
/* Converts the hex string into a set of chars */
-bool SHA1SumValue::Set(string Str)
+bool SHA1SumValue::Set(std::string Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
}
@@ -213,7 +213,7 @@
// SHA1SumValue::Value - Convert the number into a string /*{{{*/
// ---------------------------------------------------------------------
/* Converts the set of chars into a hex string in lower case */
-string SHA1SumValue::Value() const
+std::string SHA1SumValue::Value() const
{
char Conv[16] =
{ '0','1','2','3','4','5','6','7','8','9','a','b',
@@ -231,7 +231,7 @@
Result[I + 1] = Conv[Sum[J] & 0xF];
}
- return string(Result);
+ return std::string(Result);
}
/*}}} */
--- apt-pkg/contrib/sha1.h
+++ apt-pkg/contrib/sha1.h
@@ -19,8 +19,7 @@
#endif
#include <string>
-
-using std::string;
+#include <cstring>
class SHA1Summation;
@@ -33,15 +32,15 @@
// Accessors
bool operator ==(const SHA1SumValue &rhs) const;
- string Value() const;
+ std::string Value() const;
inline void Value(unsigned char S[20])
{for (int I = 0; I != sizeof(Sum); I++) S[I] = Sum[I];};
- inline operator string() const {return Value();};
- bool Set(string Str);
+ inline operator std::string() const {return Value();};
+ bool Set(std::string Str);
inline void Set(unsigned char S[20])
{for (int I = 0; I != sizeof(Sum); I++) Sum[I] = S[I];};
- SHA1SumValue(string Str);
+ SHA1SumValue(std::string Str);
SHA1SumValue();
};
@@ -56,7 +55,7 @@
public:
bool Add(const unsigned char *inbuf,unsigned long inlen);
- inline bool Add(const char *Data) {return Add((unsigned char *)Data,strlen(Data));};
+ inline bool Add(const char *Data) {return Add((unsigned char *)Data,std::strlen(Data));};
bool AddFD(int Fd,unsigned long Size);
inline bool Add(const unsigned char *Beg,const unsigned char *End)
{return Add(Beg,End-Beg);};
--- apt-pkg/contrib/strutl.h
+++ apt-pkg/contrib/strutl.h
@@ -20,15 +20,12 @@
#pragma interface "apt-pkg/strutl.h"
#endif
-#include <stdlib.h>
+#include <cstdlib>
#include <string>
#include <vector>
#include <iostream>
-#include <time.h>
-
-using std::string;
-using std::vector;
-using std::ostream;
+#include <ctime>
+#include <cstring>
#ifdef __GNUG__
// Methods have a hidden this parameter that is visible to this attribute
@@ -41,57 +38,57 @@
char *_strstrip(char *String);
char *_strtabexpand(char *String,size_t Len);
-bool ParseQuoteWord(const char *&String,string &Res);
-bool ParseCWord(const char *&String,string &Res);
-string QuoteString(string Str,const char *Bad);
-string DeQuoteString(string Str);
-string SizeToStr(double Bytes);
-string TimeToStr(unsigned long Sec);
-string Base64Encode(string Str);
-string URItoFileName(string URI);
-string TimeRFC1123(time_t Date);
-bool StrToTime(string Val,time_t &Result);
-string LookupTag(string Message,const char *Tag,const char *Default = 0);
-int StringToBool(string Text,int Default = -1);
-bool ReadMessages(int Fd, vector<string> &List);
+bool ParseQuoteWord(const char *&String,std::string &Res);
+bool ParseCWord(const char *&String,std::string &Res);
+std::string QuoteString(std::string Str,const char *Bad);
+std::string DeQuoteString(std::string Str);
+std::string SizeToStr(double Bytes);
+std::string TimeToStr(unsigned long Sec);
+std::string Base64Encode(std::string Str);
+std::string URItoFileName(std::string URI);
+std::string TimeRFC1123(time_t Date);
+bool StrToTime(std::string Val,time_t &Result);
+std::string LookupTag(std::string Message,const char *Tag,const char *Default = 0);
+int StringToBool(std::string Text,int Default = -1);
+bool ReadMessages(int Fd, std::vector<std::string> &List);
bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
-bool Hex2Num(string Str,unsigned char *Num,unsigned int Length);
+bool Hex2Num(std::string Str,unsigned char *Num,unsigned int Length);
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);
-void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
+void ioprintf(std::ostream &out,const char *format,...) APT_FORMAT2;
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
-bool CheckDomainList(string Host,string List);
+bool CheckDomainList(std::string Host,std::string List);
#define APT_MKSTRCMP(name,func) \
-inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(string A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
-inline int name(string A,string B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
-inline int name(string A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
+inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+std::strlen(B));}; \
+inline int name(std::string A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+std::strlen(B));}; \
+inline int name(std::string A,std::string B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
+inline int name(std::string A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
#define APT_MKSTRCMP2(name,func) \
-inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(string A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
-inline int name(string A,string B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
-inline int name(string A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
+inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+std::strlen(B));}; \
+inline int name(std::string A,const char *B) {return func(A.begin(),A.end(),B,B+std::strlen(B));}; \
+inline int name(std::string A,std::string B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
+inline int name(std::string A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
/* We assume that GCC 3 indicates that libstdc++3 is in use too. In that
- case the definition of string::const_iterator is not the same as
+ case the definition of std::string::const_iterator is not the same as
const char * and we need these extra functions */
#if __GNUC__ >= 3
-int stringcmp(string::const_iterator A,string::const_iterator AEnd,
+int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
const char *B,const char *BEnd);
-int stringcmp(string::const_iterator A,string::const_iterator AEnd,
- string::const_iterator B,string::const_iterator BEnd);
-int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
+int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
+ std::string::const_iterator B,std::string::const_iterator BEnd);
+int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
const char *B,const char *BEnd);
-int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
- string::const_iterator B,string::const_iterator BEnd);
+int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
+ std::string::const_iterator B,std::string::const_iterator BEnd);
-inline int stringcmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
-inline int stringcasecmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
+inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+std::strlen(B));};
+inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+std::strlen(B));};
#endif
APT_MKSTRCMP2(stringcmp,stringcmp);
@@ -101,33 +98,33 @@
class URI
{
- void CopyFrom(string From);
+ void CopyFrom(std::string From);
public:
- string Access;
- string User;
- string Password;
- string Host;
- string Path;
+ std::string Access;
+ std::string User;
+ std::string Password;
+ std::string Host;
+ std::string Path;
unsigned int Port;
- operator string();
- inline void operator =(string From) {CopyFrom(From);};
+ operator std::string();
+ inline void operator =(std::string From) {CopyFrom(From);};
inline bool empty() {return Access.empty();};
- static string SiteOnly(string URI);
+ static std::string SiteOnly(std::string URI);
- URI(string Path) {CopyFrom(Path);};
+ URI(std::string Path) {CopyFrom(Path);};
URI() : Port(0) {};
};
struct SubstVar
{
const char *Subst;
- const string *Contents;
+ const std::string *Contents;
};
-string SubstVar(string Str,const struct SubstVar *Vars);
-string SubstVar(string Str,string Subst,string Contents);
+std::string SubstVar(std::string Str,const struct SubstVar *Vars);
+std::string SubstVar(std::string Str,std::string Subst,std::string Contents);
struct RxChoiceList
{
--- apt-pkg/indexfile.cc
+++ apt-pkg/indexfile.cc
@@ -14,6 +14,7 @@
#include <apt-pkg/indexfile.h>
#include <apt-pkg/error.h>
+#include <string.h>
/*}}}*/
// Global list of Item supported
--- apt-pkg/init.cc
+++ apt-pkg/init.cc
@@ -15,6 +15,8 @@
#include <apti18n.h>
#include <config.h>
#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
// CNC:2003-03-17
#include <apt-pkg/luaiface.h>
--- apt-pkg/pkgcachegen.h
+++ apt-pkg/pkgcachegen.h
@@ -47,25 +47,25 @@
pkgCache Cache;
OpProgress *Progress;
- string PkgFileName;
+ std::string PkgFileName;
pkgCache::PackageFile *CurrentFile;
// Flag file dependencies
bool FoundFileDeps;
bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
- unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
+ unsigned long NewVersion(pkgCache::VerIterator &Ver,std::string VerStr,unsigned long Next);
public:
// CNC:2003-02-27 - We need this in rpmListParser.
- bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
+ bool NewPackage(pkgCache::PkgIterator &Pkg,std::string Name);
unsigned long WriteUniqString(const char *S,unsigned int Size);
- inline unsigned long WriteUniqString(string S) {return WriteUniqString(S.c_str(),S.length());};
+ inline unsigned long WriteUniqString(std::string S) {return WriteUniqString(S.c_str(),S.length());};
void DropProgress() {Progress = 0;};
- bool SelectFile(string File,string Site,pkgIndexFile const &Index,
+ bool SelectFile(std::string File,std::string Site,pkgIndexFile const &Index,
unsigned long Flags = 0);
bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
inline pkgCache &GetCache() {return Cache;};
@@ -98,22 +98,22 @@
pkgCacheGenerator *Owner;
friend class pkgCacheGenerator;
- inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
+ inline unsigned long WriteUniqString(std::string S) {return Owner->WriteUniqString(S);};
inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
- inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
+ inline unsigned long WriteString(std::string S) {return Owner->Map.WriteString(S);};
inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
- bool NewDepends(pkgCache::VerIterator Ver,string Package,
- string Version,unsigned int Op,
+ bool NewDepends(pkgCache::VerIterator Ver,std::string Package,
+ std::string Version,unsigned int Op,
unsigned int Type);
- bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version);
+ bool NewProvides(pkgCache::VerIterator Ver,std::string Package,std::string Version);
public:
// These all operate against the current section
- virtual string Package() = 0;
- virtual string Version() = 0;
+ virtual std::string Package() = 0;
+ virtual std::string Version() = 0;
// CNC:2002-07-09
- virtual string Architecture() {return string();};
+ virtual std::string Architecture() {return std::string();};
virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
virtual unsigned short VersionHash() = 0;
virtual bool UsePackage(pkgCache::PkgIterator Pkg,
--- apt-pkg/pkgsystem.cc
+++ apt-pkg/pkgsystem.cc
@@ -16,6 +16,7 @@
#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/policy.h>
+#include <string.h>
/*}}}*/
pkgSystem *_system = 0;
--- apt-pkg/rpm/repomd.cc
+++ apt-pkg/rpm/repomd.cc
@@ -15,6 +15,7 @@
#endif
#include <iostream>
+#include <cstring>
#include <apt-pkg/repomd.h>
#include <apt-pkg/error.h>
#include <libxml/parser.h>
--- apt-pkg/rpm/rpmmisc.h
+++ apt-pkg/rpm/rpmmisc.h
@@ -3,13 +3,15 @@
#ifdef WITH_GNU_HASH_MAP
+#include <cstring>
+#include <string>
#include <ext/hash_map>
using namespace __gnu_cxx;
struct hash_string
{
- size_t operator()(string str) const {
+ size_t operator()(std::string str) const {
unsigned long h = 0;
const char *s = str.c_str();
for (; *s; ++s)
@@ -21,14 +23,14 @@
struct cstr_eq_pred
{
size_t operator()(const char *s1, const char *s2) const
- { return strcmp(s1, s2) == 0; };
+ { return std::strcmp(s1, s2) == 0; };
};
#endif /* WITH_GNU_HASH_MAP */
struct cstr_lt_pred
{
size_t operator()(const char *s1, const char *s2) const
- { return strcmp(s1, s2) < 0; };
+ { return std::strcmp(s1, s2) < 0; };
};
#endif
--- apt-pkg/rpm/rpmpackagedata.cc
+++ apt-pkg/rpm/rpmpackagedata.cc
@@ -14,6 +14,8 @@
#include <rpm/rpmlib.h>
+using namespace std;
+
RPMPackageData::RPMPackageData()
: MinArchScore(-1)
#ifdef WITH_HASH_MAP
--- apt-pkg/rpm/rpmpackagedata.h
+++ apt-pkg/rpm/rpmpackagedata.h
@@ -7,14 +7,14 @@
#include <map>
#include <vector>
-#include <regex.h>
+#include <cstring>
-using namespace std;
+#include <regex.h>
struct LessPred
{
bool operator()(const char* s1, const char* s2) const
- { return strcmp(s1, s2) < 0; }
+ { return std::strcmp(s1, s2) < 0; }
};
class RPMPackageData
@@ -22,75 +22,75 @@
protected:
#ifdef WITH_HASH_MAP
- hash_map<string,pkgCache::State::VerPriority,hash_string> Priorities;
- hash_map<string,pkgCache::Flag::PkgFlags,hash_string> Flags;
- hash_map<string,vector<string>*,hash_string> FakeProvides;
- hash_map<string,int,hash_string> IgnorePackages;
- hash_map<string,int,hash_string> DuplicatedPackages;
- hash_map<string,vector<string>,hash_string> CompatArch;
- typedef map<string,pkgCache::VerIterator> VerMapValueType;
+ hash_map<std::string,pkgCache::State::VerPriority,hash_string> Priorities;
+ hash_map<std::string,pkgCache::Flag::PkgFlags,hash_string> Flags;
+ hash_map<std::string,std::vector<std::string>*,hash_string> FakeProvides;
+ hash_map<std::string,int,hash_string> IgnorePackages;
+ hash_map<std::string,int,hash_string> DuplicatedPackages;
+ hash_map<std::string,std::vector<std::string>,hash_string> CompatArch;
+ typedef std::map<std::string,pkgCache::VerIterator> VerMapValueType;
typedef hash_map<unsigned long,VerMapValueType> VerMapType;
typedef hash_map<const char*,int,
hash<const char*>,cstr_eq_pred> ArchScoresType;
#else
- map<string,pkgCache::State::VerPriority> Priorities;
- map<string,pkgCache::Flag::PkgFlags> Flags;
- map<string,vector<string>*> FakeProvides;
- map<string,int> IgnorePackages;
- map<string,int> DuplicatedPackages;
- map<string,vector<string> > CompatArch;
- typedef map<string,pkgCache::VerIterator> VerMapValueType;
- typedef map<unsigned long,VerMapValueType> VerMapType;
- typedef map<const char*,int,cstr_lt_pred> ArchScoresType;
+ std::map<std::string,pkgCache::State::VerPriority> Priorities;
+ std::map<std::string,pkgCache::Flag::PkgFlags> Flags;
+ std::map<std::string,std::vector<std::string>*> FakeProvides;
+ std::map<std::string,int> IgnorePackages;
+ std::map<std::string,int> DuplicatedPackages;
+ std::map<std::string,std::vector<std::string> > CompatArch;
+ typedef std::map<std::string,pkgCache::VerIterator> VerMapValueType;
+ typedef std::map<unsigned long,VerMapValueType> VerMapType;
+ typedef std::map<const char*,int,cstr_lt_pred> ArchScoresType;
#endif
- vector<regex_t*> HoldPackages;
- vector<regex_t*> DuplicatedPatterns;
+ std::vector<regex_t*> HoldPackages;
+ std::vector<regex_t*> DuplicatedPatterns;
struct Translate {
regex_t Pattern;
- string Template;
+ std::string Template;
};
- vector<Translate*> BinaryTranslations;
- vector<Translate*> SourceTranslations;
- vector<Translate*> IndexTranslations;
+ std::vector<Translate*> BinaryTranslations;
+ std::vector<Translate*> SourceTranslations;
+ std::vector<Translate*> IndexTranslations;
VerMapType VerMap;
- void GenericTranslate(vector<Translate*> &TList, string &FullURI,
- map<string,string> &Dict);
+ void GenericTranslate(std::vector<Translate*> &TList, std::string &FullURI,
+ std::map<std::string,std::string> &Dict);
int MinArchScore;
ArchScoresType ArchScores;
int RpmArchScore(const char *Arch);
- string BaseArch;
+ std::string BaseArch;
bool MultilibSys;
public:
- inline pkgCache::State::VerPriority VerPriority(const string &Package)
+ inline pkgCache::State::VerPriority VerPriority(const std::string &Package)
{
if (Priorities.find(Package) != Priorities.end())
return Priorities[Package];
return pkgCache::State::Standard;
};
- inline pkgCache::Flag::PkgFlags PkgFlags(const string &Package)
+ inline pkgCache::Flag::PkgFlags PkgFlags(const std::string &Package)
{return Flags[Package];};
bool HoldPackage(const char *name);
- bool IgnorePackage(const string &Name)
+ bool IgnorePackage(const std::string &Name)
{return IgnorePackages.find(Name) != IgnorePackages.end();};
bool IgnoreDep(pkgVersioningSystem &VS,pkgCache::DepIterator &Dep);
- void TranslateBinary(string &FullURI, map<string,string> &Dict)
+ void TranslateBinary(std::string &FullURI, std::map<std::string,std::string> &Dict)
{return GenericTranslate(BinaryTranslations, FullURI, Dict);};
- void TranslateSource(string &FullURI, map<string,string> &Dict)
+ void TranslateSource(std::string &FullURI, std::map<std::string,std::string> &Dict)
{return GenericTranslate(SourceTranslations, FullURI, Dict);};
- void TranslateIndex(string &FullURI, map<string,string> &Dict)
+ void TranslateIndex(std::string &FullURI, std::map<std::string,std::string> &Dict)
{return GenericTranslate(IndexTranslations, FullURI, Dict);};
bool HasBinaryTranslation()
@@ -112,21 +112,21 @@
}
void InitMinArchScore();
- bool IsCompatArch(string Arch);
+ bool IsCompatArch(std::string Arch);
bool IsMultilibSys() { return MultilibSys; };
- void SetDupPackage(const string &Name)
+ void SetDupPackage(const std::string &Name)
{DuplicatedPackages[Name] = 1;};
- bool IsDupPackage(const string &Name);
+ bool IsDupPackage(const std::string &Name);
static RPMPackageData *Singleton();
- void SetVersion(string ID, unsigned long Offset,
+ void SetVersion(std::string ID, unsigned long Offset,
pkgCache::VerIterator &Version)
{
VerMap[Offset][ID] = Version;
};
- const pkgCache::VerIterator *GetVersion(string ID, unsigned long Offset)
+ const pkgCache::VerIterator *GetVersion(std::string ID, unsigned long Offset)
{
VerMapType::const_iterator I1 = VerMap.find(Offset);
if (I1 != VerMap.end()) {
--- apt-pkg/rpm/rpmpm.cc
+++ apt-pkg/rpm/rpmpm.cc
@@ -33,6 +33,7 @@
#include <errno.h>
#include <stdio.h>
#include <iostream>
+#include <string.h>
#if RPM_VERSION >= 0x040100
#include <rpm/rpmdb.h>
--- apt-pkg/rpm/rpmrecords.cc
+++ apt-pkg/rpm/rpmrecords.cc
@@ -24,6 +24,7 @@
#include <apt-pkg/rpmsystem.h>
#include <apti18n.h>
+#include <cstring>
using namespace std;
--- cmdline/rpmindexcopy.h
+++ cmdline/rpmindexcopy.h
@@ -19,15 +19,15 @@
{
protected:
- string RipComponent(string Path);
- string RipDirectory(string Path);
- string RipDistro(string Path);
+ std::string RipComponent(std::string Path);
+ std::string RipDirectory(std::string Path);
+ std::string RipDistro(std::string Path);
- void ConvertToSourceList(string CD, string &Path);
+ void ConvertToSourceList(std::string CD, std::string &Path);
public:
- bool CopyPackages(string CDROM,string Name,vector<string> &List);
+ bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List);
};
--- methods/http.h
+++ methods/http.h
@@ -14,9 +14,8 @@
#define MAXLEN 360
#include <iostream>
-
-using std::cout;
-using std::endl;
+#include <vector>
+#include <string>
class HttpMethod;
@@ -26,7 +25,7 @@
unsigned long Size;
unsigned long InP;
unsigned long OutP;
- string OutQueue;
+ std::string OutQueue;
unsigned long StrPos;
unsigned long MaxGet;
struct timeval Start;
@@ -55,16 +54,16 @@
// Read data in
bool Read(int Fd);
- bool Read(string Data);
+ bool Read(std::string Data);
// Write data out
bool Write(int Fd);
- bool WriteTillEl(string &Data,bool Single = false);
+ bool WriteTillEl(std::string &Data,bool Single = false);
// Control the write limit
void Limit(long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}
bool IsLimit() {return MaxGet == OutP;};
- void Print() {cout << MaxGet << ',' << OutP << endl;};
+ void Print() {std::cout << MaxGet << ',' << OutP << std::endl;};
// Test for free space in the buffer
bool ReadSpace() {return Size - (InP - OutP) > 0;};
@@ -94,8 +93,8 @@
enum {Chunked,Stream,Closes} Encoding;
enum {Header, Data} State;
bool Persistent;
- string Location;
- string Realm, ProxyRealm;
+ std::string Location;
+ std::string Realm, ProxyRealm;
// This is a Persistent attribute of the server itself.
bool Pipeline;
@@ -108,7 +107,7 @@
int ServerFd;
URI ServerName;
- bool HeaderLine(string Line);
+ bool HeaderLine(std::string Line);
bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0;
Encoding = Closes; time(&Date); ServerFd = -1;
@@ -127,10 +126,10 @@
{
struct AuthRec
{
- string Host;
- string Realm;
- string User;
- string Password;
+ std::string Host;
+ std::string Realm;
+ std::string User;
+ std::string Password;
};
void SendReq(FetchItem *Itm,CircleBuf &Out);
@@ -140,16 +139,16 @@
int DealWithHeaders(FetchResult &Res,ServerState *Srv);
virtual bool Fetch(FetchItem *);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
// In the event of a fatal signal this file will be closed and timestamped.
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);
- string NextURI;
- vector<AuthRec> AuthList;
+ std::string NextURI;
+ std::vector<AuthRec> AuthList;
public:
friend class ServerState;