summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-19 13:31:29 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-19 13:31:29 +0200
commit8f3ba4e8708cb72be19dacc2af4f601ee5fea292 (patch)
treef624675aa3d4add287f253e19eb28c0dce5669f1 /methods
parentc333ea435b67d7d7d7d10e867298ecac4da0f7b8 (diff)
do not pollute namespace in the headers with using (Closes: #500198)
Diffstat (limited to 'methods')
-rw-r--r--methods/bzip2.cc6
-rw-r--r--methods/connect.cc14
-rw-r--r--methods/connect.h2
-rw-r--r--methods/copy.cc2
-rw-r--r--methods/file.cc6
-rw-r--r--methods/ftp.h10
-rw-r--r--methods/gpgv.cc3
-rw-r--r--methods/gzip.cc2
-rw-r--r--methods/http.h18
-rw-r--r--methods/rred.cc4
-rw-r--r--methods/rsh.cc18
-rw-r--r--methods/rsh.h10
12 files changed, 49 insertions, 46 deletions
diff --git a/methods/bzip2.cc b/methods/bzip2.cc
index eff83bda7..ad5db6cfb 100644
--- a/methods/bzip2.cc
+++ b/methods/bzip2.cc
@@ -47,9 +47,9 @@ class Bzip2Method : public pkgAcqMethod
bool Bzip2Method::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
- string GzPathOption = "Dir::bin::"+string(Prog);
+ std::string GzPathOption = "Dir::bin::" + std::string(Prog);
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -78,7 +78,7 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
SetCloseExec(STDOUT_FILENO,false);
const char *Args[3];
- string Tmp = _config->Find(GzPathOption,Prog);
+ std::string Tmp = _config->Find(GzPathOption,Prog);
Args[0] = Tmp.c_str();
Args[1] = "-d";
Args[2] = 0;
diff --git a/methods/connect.cc b/methods/connect.cc
index 16fb6e793..ba2264faa 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -35,13 +35,13 @@
#include <apti18n.h>
/*}}}*/
-static string LastHost;
+static std::string LastHost;
static int LastPort = 0;
static struct addrinfo *LastHostAddr = 0;
static struct addrinfo *LastUsed = 0;
// Set of IP/hostnames that we timed out before or couldn't resolve
-static std::set<string> bad_addr;
+static std::set<std::string> bad_addr;
// RotateDNS - Select a new server from a DNS rotation /*{{{*/
// ---------------------------------------------------------------------
@@ -58,7 +58,7 @@ void RotateDNS()
// DoConnect - Attempt a connect operation /*{{{*/
// ---------------------------------------------------------------------
/* This helper function attempts a connection to a single address. */
-static bool DoConnect(struct addrinfo *Addr,string Host,
+static bool DoConnect(struct addrinfo *Addr,std::string Host,
unsigned long TimeOut,int &Fd,pkgAcqMethod *Owner)
{
// Show a status indicator
@@ -73,7 +73,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
Owner->Status(_("Connecting to %s (%s)"),Host.c_str(),Name);
// if that addr did timeout before, we do not try it again
- if(bad_addr.find(string(Name)) != bad_addr.end())
+ if(bad_addr.find(std::string(Name)) != bad_addr.end())
return false;
/* If this is an IP rotation store the IP we are using.. If something goes
@@ -100,7 +100,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
/* This implements a timeout for connect by opening the connection
nonblocking */
if (WaitFd(Fd,true,TimeOut) == false) {
- bad_addr.insert(bad_addr.begin(), string(Name));
+ bad_addr.insert(bad_addr.begin(), std::string(Name));
Owner->SetFailReason("Timeout");
return _error->Error(_("Could not connect to %s:%s (%s), "
"connection timed out"),Host.c_str(),Service,Name);
@@ -119,7 +119,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
Owner->SetFailReason("ConnectionRefused");
else if (errno == ETIMEDOUT)
Owner->SetFailReason("ConnectionTimedOut");
- bad_addr.insert(bad_addr.begin(), string(Name));
+ bad_addr.insert(bad_addr.begin(), std::string(Name));
return _error->Errno("connect",_("Could not connect to %s:%s (%s)."),Host.c_str(),
Service,Name);
}
@@ -130,7 +130,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
// Connect - Connect to a server /*{{{*/
// ---------------------------------------------------------------------
/* Performs a connection to the server */
-bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd,
+bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
unsigned long TimeOut,pkgAcqMethod *Owner)
{
if (_error->PendingError() == true)
diff --git a/methods/connect.h b/methods/connect.h
index 6f208e31d..0afa00919 100644
--- a/methods/connect.h
+++ b/methods/connect.h
@@ -13,7 +13,7 @@
#include <string>
#include <apt-pkg/acquire-method.h>
-bool Connect(string To,int Port,const char *Service,int DefPort,
+bool Connect(std::string To,int Port,const char *Service,int DefPort,
int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner);
void RotateDNS();
diff --git a/methods/copy.cc b/methods/copy.cc
index 94467e054..fe2918469 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -37,7 +37,7 @@ class CopyMethod : public pkgAcqMethod
bool CopyMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string File = Get.Path;
+ std::string File = Get.Path;
// Stat the file and send a start message
struct stat Buf;
diff --git a/methods/file.cc b/methods/file.cc
index 9fc4cd76c..d58652e6e 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -40,7 +40,7 @@ class FileMethod : public pkgAcqMethod
bool FileMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string File = Get.Path;
+ std::string File = Get.Path;
FetchResult Res;
if (Get.Host.empty() == false)
return _error->Error(_("Invalid URI, local URIS must not start with //"));
@@ -58,10 +58,10 @@ bool FileMethod::Fetch(FetchItem *Itm)
}
// See if we can compute a file without a .gz exentsion
- string::size_type Pos = File.rfind(".gz");
+ std::string::size_type Pos = File.rfind(".gz");
if (Pos + 3 == File.length())
{
- File = string(File,0,Pos);
+ File = std::string(File,0,Pos);
if (stat(File.c_str(),&Buf) == 0)
{
FetchResult AltRes;
diff --git a/methods/ftp.h b/methods/ftp.h
index b4913ca57..7088e0954 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -33,7 +33,7 @@ class FTPConn
socklen_t ServerAddrLen;
// Private helper functions
- bool ReadLine(string &Text);
+ bool ReadLine(std::string &Text);
bool Login();
bool CreateDataFd();
bool Finalize();
@@ -43,8 +43,8 @@ class FTPConn
bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port && Other.User == ServerName.User && Other.Password == ServerName.Password; };
// Raw connection IO
- bool ReadResp(unsigned int &Ret,string &Text);
- bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...);
+ bool ReadResp(unsigned int &Ret,std::string &Text);
+ bool WriteMsg(unsigned int &Ret,std::string &Text,const char *Fmt,...);
// Connection control
bool Open(pkgAcqMethod *Owner);
@@ -65,11 +65,11 @@ class FTPConn
class FtpMethod : public pkgAcqMethod
{
virtual bool Fetch(FetchItem *Itm);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
FTPConn *Server;
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 251bcbc90..67cbd36a2 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -17,6 +17,9 @@
#include <apti18n.h>
+using std::string;
+using std::vector;
+
#define GNUPGPREFIX "[GNUPG:]"
#define GNUPGBADSIG "[GNUPG:] BADSIG"
#define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
diff --git a/methods/gzip.cc b/methods/gzip.cc
index f4bb052e2..a51497948 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -41,7 +41,7 @@ class GzipMethod : public pkgAcqMethod
bool GzipMethod::Fetch(FetchItem *Itm)
{
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
FetchResult Res;
Res.Filename = Itm->DestFile;
diff --git a/methods/http.h b/methods/http.h
index c47d7184a..08823d1b1 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -26,7 +26,7 @@ class CircleBuf
unsigned long long Size;
unsigned long long InP;
unsigned long long OutP;
- string OutQueue;
+ std::string OutQueue;
unsigned long long StrPos;
unsigned long long MaxGet;
struct timeval Start;
@@ -60,11 +60,11 @@ class CircleBuf
// 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 long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}
@@ -99,7 +99,7 @@ struct ServerState
enum {Chunked,Stream,Closes} Encoding;
enum {Header, Data} State;
bool Persistent;
- string Location;
+ std::string Location;
// This is a Persistent attribute of the server itself.
bool Pipeline;
@@ -112,7 +112,7 @@ struct ServerState
int ServerFd;
URI ServerName;
- bool HeaderLine(string Line);
+ bool HeaderLine(std::string Line);
bool Comp(URI Other) const {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;
@@ -167,10 +167,10 @@ class HttpMethod : public pkgAcqMethod
/** \brief Try to AutoDetect the proxy */
bool AutoDetectProxy();
- 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);
@@ -178,8 +178,8 @@ class HttpMethod : public pkgAcqMethod
protected:
virtual bool Fetch(FetchItem *);
- string NextURI;
- string AutoDetectProxyCmd;
+ std::string NextURI;
+ std::string AutoDetectProxyCmd;
public:
friend struct ServerState;
diff --git a/methods/rred.cc b/methods/rred.cc
index bc941ed04..2a05acce1 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -472,7 +472,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
{
Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
URI Get = Itm->Uri;
- string Path = Get.Host + Get.Path; // To account for relative paths
+ std::string Path = Get.Host + Get.Path; // To account for relative paths
FetchResult Res;
Res.Filename = Itm->DestFile;
@@ -525,7 +525,7 @@ bool RredMethod::Fetch(FetchItem *Itm) /*{{{*/
and use the access time from the "old" file */
struct stat BufBase, BufPatch;
if (stat(Path.c_str(),&BufBase) != 0 ||
- stat(string(Path+".ed").c_str(),&BufPatch) != 0)
+ stat(std::string(Path+".ed").c_str(),&BufPatch) != 0)
return _error->Errno("stat",_("Failed to stat"));
struct utimbuf TimeBuf;
diff --git a/methods/rsh.cc b/methods/rsh.cc
index c95a4d3eb..add128c49 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -32,7 +32,7 @@ const char *Prog;
unsigned long TimeOut = 120;
Configuration::Item const *RshOptions = 0;
time_t RSHMethod::FailTime = 0;
-string RSHMethod::FailFile;
+std::string RSHMethod::FailFile;
int RSHMethod::FailFd = -1;
// RSHConn::RSHConn - Constructor /*{{{*/
@@ -85,7 +85,7 @@ bool RSHConn::Open()
// RSHConn::Connect - Fire up rsh and connect /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::Connect(string Host, string User)
+bool RSHConn::Connect(std::string Host, std::string User)
{
// Create the pipes
int Pipes[4] = {-1,-1,-1,-1};
@@ -154,7 +154,7 @@ bool RSHConn::Connect(string Host, string User)
// RSHConn::ReadLine - Very simple buffered read with timeout /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::ReadLine(string &Text)
+bool RSHConn::ReadLine(std::string &Text)
{
if (Process == -1 || ReadFd == -1)
return false;
@@ -174,7 +174,7 @@ bool RSHConn::ReadLine(string &Text)
continue;
I++;
- Text = string(Buffer,I);
+ Text = std::string(Buffer,I);
memmove(Buffer,Buffer+I,Len - I);
Len -= I;
return true;
@@ -205,7 +205,7 @@ bool RSHConn::ReadLine(string &Text)
// ---------------------------------------------------------------------
/* The remote sync flag appends a || echo which will insert blank line
once the command completes. */
-bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
+bool RSHConn::WriteMsg(std::string &Text,bool Sync,const char *Fmt,...)
{
va_list args;
va_start(args,Fmt);
@@ -254,7 +254,7 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
bool RSHConn::Size(const char *Path,unsigned long long &Size)
{
// Query the size
- string Msg;
+ std::string Msg;
Size = 0;
if (WriteMsg(Msg,true,"find %s -follow -printf '%%s\\n'",Path) == false)
@@ -276,7 +276,7 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
{
Time = time(&Time);
// Query the mod time
- string Msg;
+ std::string Msg;
if (WriteMsg(Msg,true,"TZ=UTC find %s -follow -printf '%%TY%%Tm%%Td%%TH%%TM%%TS\\n'",Path) == false)
return false;
@@ -309,7 +309,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
}
// FIXME: Detect file-not openable type errors.
- string Jnk;
+ std::string Jnk;
if (WriteMsg(Jnk,false,"dd if=%s bs=2048 skip=%u", Path, Resume / 2048) == false)
return false;
@@ -366,7 +366,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
/*}}}*/
// RSHMethod::Configuration - Handle a configuration message /*{{{*/
// ---------------------------------------------------------------------
-bool RSHMethod::Configuration(string Message)
+bool RSHMethod::Configuration(std::string Message)
{
char ProgStr[100];
diff --git a/methods/rsh.h b/methods/rsh.h
index c81396b5f..7bebe29a0 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -25,15 +25,15 @@ class RSHConn
URI ServerName;
// Private helper functions
- bool ReadLine(string &Text);
+ bool ReadLine(std::string &Text);
public:
pid_t Process;
// Raw connection IO
- bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
- bool Connect(string Host, string User);
+ bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
+ bool Connect(std::string Host, std::string User);
bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
// Connection control
@@ -53,11 +53,11 @@ class RSHConn
class RSHMethod : public pkgAcqMethod
{
virtual bool Fetch(FetchItem *Itm);
- virtual bool Configuration(string Message);
+ virtual bool Configuration(std::string Message);
RSHConn *Server;
- static string FailFile;
+ static std::string FailFile;
static int FailFd;
static time_t FailTime;
static void SigTerm(int);