summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
Diffstat (limited to 'methods')
-rw-r--r--methods/bzip2.cc2
-rw-r--r--methods/cdrom.cc5
-rw-r--r--methods/connect.cc4
-rw-r--r--methods/copy.cc2
-rw-r--r--methods/file.cc2
-rw-r--r--methods/ftp.cc21
-rw-r--r--methods/ftp.h4
-rw-r--r--methods/gpgv.cc12
-rw-r--r--methods/gzip.cc4
-rw-r--r--methods/http.cc44
-rw-r--r--methods/http.h40
-rw-r--r--methods/http_main.cc2
-rw-r--r--methods/https.cc7
-rw-r--r--methods/mirror.cc10
-rw-r--r--methods/rfc2553emu.cc4
-rw-r--r--methods/rred.cc11
-rw-r--r--methods/rsh.cc21
-rw-r--r--methods/rsh.h8
18 files changed, 119 insertions, 84 deletions
diff --git a/methods/bzip2.cc b/methods/bzip2.cc
index 42932dded..eff83bda7 100644
--- a/methods/bzip2.cc
+++ b/methods/bzip2.cc
@@ -13,6 +13,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
diff --git a/methods/cdrom.cc b/methods/cdrom.cc
index b25fdf5a8..bc115d259 100644
--- a/methods/cdrom.cc
+++ b/methods/cdrom.cc
@@ -8,6 +8,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/cdrom.h>
#include <apt-pkg/cdromutl.h>
@@ -54,7 +56,8 @@ class CDROMMethod : public pkgAcqMethod
CDROMMethod::CDROMMethod() : pkgAcqMethod("1.0",SingleInstance | LocalOnly |
SendConfig | NeedsCleanup |
Removable),
- DatabaseLoaded(false),
+ DatabaseLoaded(false),
+ Debug(false),
MountedByApt(false)
{
UdevCdroms.Dlopen();
diff --git a/methods/connect.cc b/methods/connect.cc
index a5af1f1a6..16fb6e793 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -11,7 +11,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include "connect.h"
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
@@ -29,6 +30,7 @@
#include <arpa/inet.h>
#include <netdb.h>
+#include "connect.h"
#include "rfc2553emu.h"
#include <apti18n.h>
/*}}}*/
diff --git a/methods/copy.cc b/methods/copy.cc
index a6bb372a3..94467e054 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -9,6 +9,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
diff --git a/methods/file.cc b/methods/file.cc
index 9cdd5bc2d..9fc4cd76c 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -13,6 +13,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
diff --git a/methods/ftp.cc b/methods/ftp.cc
index 97248f900..861647aea 100644
--- a/methods/ftp.cc
+++ b/methods/ftp.cc
@@ -15,6 +15,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
@@ -30,7 +32,6 @@
#include <errno.h>
#include <stdarg.h>
#include <iostream>
-#include <apti18n.h>
// Internet stuff
#include <netinet/in.h>
@@ -41,6 +42,7 @@
#include "rfc2553emu.h"
#include "connect.h"
#include "ftp.h"
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -69,7 +71,8 @@ time_t FtpMethod::FailTime = 0;
// ---------------------------------------------------------------------
/* */
FTPConn::FTPConn(URI Srv) : Len(0), ServerFd(-1), DataFd(-1),
- DataListenFd(-1), ServerName(Srv)
+ DataListenFd(-1), ServerName(Srv),
+ ForceExtended(false), TryPassive(true)
{
Debug = _config->FindB("Debug::Acquire::Ftp",false);
PasvAddr = 0;
@@ -559,7 +562,7 @@ bool FTPConn::ExtGoPasv()
string::const_iterator List[4];
unsigned Count = 0;
Pos++;
- for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); I++)
+ for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I)
{
if (*I != Msg[Pos])
continue;
@@ -627,7 +630,7 @@ bool FTPConn::ExtGoPasv()
// FTPConn::Size - Return the size of a file /*{{{*/
// ---------------------------------------------------------------------
/* Grab the file size from the server, 0 means no size or empty file */
-bool FTPConn::Size(const char *Path,unsigned long &Size)
+bool FTPConn::Size(const char *Path,unsigned long long &Size)
{
// Query the size
unsigned int Tag;
@@ -637,7 +640,7 @@ bool FTPConn::Size(const char *Path,unsigned long &Size)
return false;
char *End;
- Size = strtol(Msg.c_str(),&End,10);
+ Size = strtoull(Msg.c_str(),&End,10);
if (Tag >= 400 || End == Msg.c_str())
Size = 0;
return true;
@@ -839,7 +842,7 @@ bool FTPConn::Finalize()
// ---------------------------------------------------------------------
/* This opens a data connection, sends REST and RETR and then
transfers the file over. */
-bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume,
+bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
Hashes &Hash,bool &Missing)
{
Missing = false;
@@ -1002,7 +1005,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
// Get the files information
Status(_("Query"));
- unsigned long Size;
+ unsigned long long Size;
if (Server->Size(File,Size) == false ||
Server->ModTime(File,FailTime) == false)
{
@@ -1024,7 +1027,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
struct stat Buf;
if (stat(Itm->DestFile.c_str(),&Buf) == 0)
{
- if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime)
+ if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime)
{
Res.Size = Buf.st_size;
Res.LastModified = Buf.st_mtime;
@@ -1034,7 +1037,7 @@ bool FtpMethod::Fetch(FetchItem *Itm)
}
// Resume?
- if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+ if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
Res.ResumePoint = Buf.st_size;
}
diff --git a/methods/ftp.h b/methods/ftp.h
index d7f1f7fbe..b4913ca57 100644
--- a/methods/ftp.h
+++ b/methods/ftp.h
@@ -53,9 +53,9 @@ class FTPConn
bool ExtGoPasv();
// Query
- bool Size(const char *Path,unsigned long &Size);
+ bool Size(const char *Path,unsigned long long &Size);
bool ModTime(const char *Path, time_t &Time);
- bool Get(const char *Path,FileFd &To,unsigned long Resume,
+ bool Get(const char *Path,FileFd &To,unsigned long long Resume,
Hashes &MD5,bool &Missing);
FTPConn(URI Srv);
diff --git a/methods/gpgv.cc b/methods/gpgv.cc
index 960c06180..251bcbc90 100644
--- a/methods/gpgv.cc
+++ b/methods/gpgv.cc
@@ -1,9 +1,10 @@
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexcopy.h>
-#include <apti18n.h>
#include <utime.h>
#include <stdio.h>
@@ -12,9 +13,10 @@
#include <sys/wait.h>
#include <iostream>
#include <sstream>
-
#include <vector>
+#include <apti18n.h>
+
#define GNUPGPREFIX "[GNUPG:]"
#define GNUPGBADSIG "[GNUPG:] BADSIG"
#define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
@@ -213,21 +215,21 @@ bool GPGVMethod::Fetch(FetchItem *Itm)
{
errmsg += _("The following signatures were invalid:\n");
for (vector<string>::iterator I = BadSigners.begin();
- I != BadSigners.end(); I++)
+ I != BadSigners.end(); ++I)
errmsg += (*I + "\n");
}
if (!WorthlessSigners.empty())
{
errmsg += _("The following signatures were invalid:\n");
for (vector<string>::iterator I = WorthlessSigners.begin();
- I != WorthlessSigners.end(); I++)
+ I != WorthlessSigners.end(); ++I)
errmsg += (*I + "\n");
}
if (!NoPubKeySigners.empty())
{
errmsg += _("The following signatures couldn't be verified because the public key is not available:\n");
for (vector<string>::iterator I = NoPubKeySigners.begin();
- I != NoPubKeySigners.end(); I++)
+ I != NoPubKeySigners.end(); ++I)
errmsg += (*I + "\n");
}
}
diff --git a/methods/gzip.cc b/methods/gzip.cc
index fc4e1ecfd..f4bb052e2 100644
--- a/methods/gzip.cc
+++ b/methods/gzip.cc
@@ -9,6 +9,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
#include <apt-pkg/acquire-method.h>
@@ -62,7 +64,7 @@ bool GzipMethod::Fetch(FetchItem *Itm)
while (1)
{
unsigned char Buffer[4*1024];
- unsigned long Count;
+ unsigned long long Count = 0;
if (!From.Read(Buffer,sizeof(Buffer),&Count))
{
diff --git a/methods/http.cc b/methods/http.cc
index 13f9cbe06..b60cfeb9e 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -25,6 +25,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
@@ -41,8 +43,6 @@
#include <string.h>
#include <iostream>
#include <map>
-#include <apti18n.h>
-
// Internet stuff
#include <netdb.h>
@@ -51,6 +51,8 @@
#include "connect.h"
#include "rfc2553emu.h"
#include "http.h"
+
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -63,15 +65,15 @@ bool AllowRedirect = false;
bool Debug = false;
URI Proxy;
-unsigned long CircleBuf::BwReadLimit=0;
-unsigned long CircleBuf::BwTickReadData=0;
+unsigned long long CircleBuf::BwReadLimit=0;
+unsigned long long CircleBuf::BwTickReadData=0;
struct timeval CircleBuf::BwReadTick={0,0};
const unsigned int CircleBuf::BW_HZ=10;
// CircleBuf::CircleBuf - Circular input buffer /*{{{*/
// ---------------------------------------------------------------------
/* */
-CircleBuf::CircleBuf(unsigned long Size) : Size(Size), Hash(0)
+CircleBuf::CircleBuf(unsigned long long Size) : Size(Size), Hash(0)
{
Buf = new unsigned char[Size];
Reset();
@@ -87,7 +89,7 @@ void CircleBuf::Reset()
InP = 0;
OutP = 0;
StrPos = 0;
- MaxGet = (unsigned int)-1;
+ MaxGet = (unsigned long long)-1;
OutQueue = string();
if (Hash != 0)
{
@@ -102,7 +104,7 @@ void CircleBuf::Reset()
is non-blocking.. */
bool CircleBuf::Read(int Fd)
{
- unsigned long BwReadMax;
+ unsigned long long BwReadMax;
while (1)
{
@@ -117,7 +119,7 @@ bool CircleBuf::Read(int Fd)
struct timeval now;
gettimeofday(&now,0);
- unsigned long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
+ unsigned long long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
now.tv_usec-CircleBuf::BwReadTick.tv_usec;
if(d > 1000000/BW_HZ) {
CircleBuf::BwReadTick = now;
@@ -131,7 +133,7 @@ bool CircleBuf::Read(int Fd)
}
// Write the buffer segment
- int Res;
+ ssize_t Res;
if(CircleBuf::BwReadLimit) {
Res = read(Fd,Buf + (InP%Size),
BwReadMax > LeftRead() ? LeftRead() : BwReadMax);
@@ -180,7 +182,7 @@ void CircleBuf::FillOut()
return;
// Write the buffer segment
- unsigned long Sz = LeftRead();
+ unsigned long long Sz = LeftRead();
if (OutQueue.length() - StrPos < Sz)
Sz = OutQueue.length() - StrPos;
memcpy(Buf + (InP%Size),OutQueue.c_str() + StrPos,Sz);
@@ -214,7 +216,7 @@ bool CircleBuf::Write(int Fd)
return true;
// Write the buffer segment
- int Res;
+ ssize_t Res;
Res = write(Fd,Buf + (OutP%Size),LeftWrite());
if (Res == 0)
@@ -240,7 +242,7 @@ bool CircleBuf::Write(int Fd)
bool CircleBuf::WriteTillEl(string &Data,bool Single)
{
// We cheat and assume it is unneeded to have more than one buffer load
- for (unsigned long I = OutP; I < InP; I++)
+ for (unsigned long long I = OutP; I < InP; I++)
{
if (Buf[I%Size] != '\n')
continue;
@@ -258,7 +260,7 @@ bool CircleBuf::WriteTillEl(string &Data,bool Single)
Data = "";
while (OutP < I)
{
- unsigned long Sz = LeftWrite();
+ unsigned long long Sz = LeftWrite();
if (Sz == 0)
return false;
if (I - OutP < Sz)
@@ -402,10 +404,10 @@ ServerState::RunHeadersResult ServerState::RunHeaders()
if (Debug == true)
clog << Data;
- for (string::const_iterator I = Data.begin(); I < Data.end(); I++)
+ for (string::const_iterator I = Data.begin(); I < Data.end(); ++I)
{
string::const_iterator J = I;
- for (; J != Data.end() && *J != '\n' && *J != '\r';J++);
+ for (; J != Data.end() && *J != '\n' && *J != '\r'; ++J);
if (HeaderLine(string(I,J)) == false)
return RUN_HEADERS_PARSE_ERROR;
I = J;
@@ -453,7 +455,7 @@ bool ServerState::RunData()
return false;
// See if we are done
- unsigned long Len = strtol(Data.c_str(),0,16);
+ unsigned long long Len = strtoull(Data.c_str(),0,16);
if (Len == 0)
{
In.Limit(-1);
@@ -596,7 +598,7 @@ bool ServerState::HeaderLine(string Line)
if (StartPos != 0)
return true;
- if (sscanf(Val.c_str(),"%lu",&Size) != 1)
+ if (sscanf(Val.c_str(),"%llu",&Size) != 1)
return _error->Error(_("The HTTP server sent an invalid Content-Length header"));
return true;
}
@@ -611,9 +613,9 @@ bool ServerState::HeaderLine(string Line)
{
HaveContent = true;
- if (sscanf(Val.c_str(),"bytes %lu-%*u/%lu",&StartPos,&Size) != 2)
+ if (sscanf(Val.c_str(),"bytes %llu-%*u/%llu",&StartPos,&Size) != 2)
return _error->Error(_("The HTTP server sent an invalid Content-Range header"));
- if ((unsigned)StartPos > Size)
+ if ((unsigned long long)StartPos > Size)
return _error->Error(_("This HTTP server has broken range support"));
return true;
}
@@ -716,7 +718,7 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
{
// In this case we send an if-range query with a range header
- sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",(long)SBuf.st_size - 1,
+ sprintf(Buf,"Range: bytes=%lli-\r\nIf-Range: %s\r\n",(long long)SBuf.st_size - 1,
TimeRFC1123(SBuf.st_mtime).c_str());
Req += Buf;
}
@@ -1325,7 +1327,7 @@ int HttpMethod::Loop()
StopRedirects = true;
else
{
- for (StringVectorIterator I = R.begin(); I != R.end(); I++)
+ for (StringVectorIterator I = R.begin(); I != R.end(); ++I)
if (Queue->Uri == *I)
{
R[0] = "STOP";
diff --git a/methods/http.h b/methods/http.h
index aa96c6810..c47d7184a 100644
--- a/methods/http.h
+++ b/methods/http.h
@@ -23,29 +23,29 @@ class HttpMethod;
class CircleBuf
{
unsigned char *Buf;
- unsigned long Size;
- unsigned long InP;
- unsigned long OutP;
+ unsigned long long Size;
+ unsigned long long InP;
+ unsigned long long OutP;
string OutQueue;
- unsigned long StrPos;
- unsigned long MaxGet;
+ unsigned long long StrPos;
+ unsigned long long MaxGet;
struct timeval Start;
- static unsigned long BwReadLimit;
- static unsigned long BwTickReadData;
+ static unsigned long long BwReadLimit;
+ static unsigned long long BwTickReadData;
static struct timeval BwReadTick;
static const unsigned int BW_HZ;
- unsigned long LeftRead()
+ unsigned long long LeftRead() const
{
- unsigned long Sz = Size - (InP - OutP);
+ unsigned long long Sz = Size - (InP - OutP);
if (Sz > Size - (InP%Size))
Sz = Size - (InP%Size);
return Sz;
}
- unsigned long LeftWrite()
+ unsigned long long LeftWrite() const
{
- unsigned long Sz = InP - OutP;
+ unsigned long long Sz = InP - OutP;
if (InP > MaxGet)
Sz = MaxGet - OutP;
if (Sz > Size - (OutP%Size))
@@ -67,19 +67,19 @@ class CircleBuf
bool WriteTillEl(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 Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}
+ bool IsLimit() const {return MaxGet == OutP;};
+ void Print() const {cout << MaxGet << ',' << OutP << endl;};
// Test for free space in the buffer
- bool ReadSpace() {return Size - (InP - OutP) > 0;};
- bool WriteSpace() {return InP - OutP > 0;};
+ bool ReadSpace() const {return Size - (InP - OutP) > 0;};
+ bool WriteSpace() const {return InP - OutP > 0;};
// Dump everything
void Reset();
void Stats();
- CircleBuf(unsigned long Size);
+ CircleBuf(unsigned long long Size);
~CircleBuf() {delete [] Buf; delete Hash;};
};
@@ -92,8 +92,8 @@ struct ServerState
char Code[MAXLEN];
// These are some statistics from the last parsed header lines
- unsigned long Size;
- signed long StartPos;
+ unsigned long long Size;
+ signed long long StartPos;
time_t Date;
bool HaveContent;
enum {Chunked,Stream,Closes} Encoding;
@@ -113,7 +113,7 @@ struct ServerState
URI ServerName;
bool HeaderLine(string Line);
- bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+ 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;
Pipeline = true;};
diff --git a/methods/http_main.cc b/methods/http_main.cc
index 7815c2fc1..2ca91bfc9 100644
--- a/methods/http_main.cc
+++ b/methods/http_main.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <signal.h>
diff --git a/methods/https.cc b/methods/https.cc
index 668a329e6..709744ce3 100644
--- a/methods/https.cc
+++ b/methods/https.cc
@@ -10,6 +10,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
@@ -25,12 +27,11 @@
#include <errno.h>
#include <string.h>
#include <iostream>
-#include <apti18n.h>
#include <sstream>
#include "config.h"
#include "https.h"
-
+#include <apti18n.h>
/*}}}*/
using namespace std;
@@ -51,7 +52,7 @@ HttpsMethod::progress_callback(void *clientp, double dltotal, double dlnow,
{
HttpsMethod *me = (HttpsMethod *)clientp;
if(dltotal > 0 && me->Res.Size == 0) {
- me->Res.Size = (unsigned long)dltotal;
+ me->Res.Size = (unsigned long long)dltotal;
me->URIStart(me->Res);
}
return 0;
diff --git a/methods/mirror.cc b/methods/mirror.cc
index 7f28c04cb..61a7f12fd 100644
--- a/methods/mirror.cc
+++ b/methods/mirror.cc
@@ -8,6 +8,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
+#include <config.h>
+
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
@@ -34,7 +36,7 @@ using namespace std;
#include "mirror.h"
#include "http.h"
-#include "apti18n.h"
+#include <apti18n.h>
/*}}}*/
/* Done:
@@ -55,7 +57,7 @@ using namespace std;
*/
MirrorMethod::MirrorMethod()
- : HttpMethod(), DownloadedMirrorFile(false)
+ : HttpMethod(), DownloadedMirrorFile(false), Debug(false)
{
};
@@ -108,7 +110,7 @@ bool MirrorMethod::Clean(string Dir)
continue;
// see if we have that uri
- for(I=list.begin(); I != list.end(); I++)
+ for(I=list.begin(); I != list.end(); ++I)
{
string uri = (*I)->GetURI();
if(uri.find("mirror://") != 0)
@@ -346,7 +348,7 @@ string MirrorMethod::GetMirrorFileName(string mirror_uri_str)
vector<metaIndex *>::const_iterator I;
pkgSourceList list;
list.ReadMainList();
- for(I=list.begin(); I != list.end(); I++)
+ for(I=list.begin(); I != list.end(); ++I)
{
string uristr = (*I)->GetURI();
if(Debug)
diff --git a/methods/rfc2553emu.cc b/methods/rfc2553emu.cc
index 66bc906e9..f00e85889 100644
--- a/methods/rfc2553emu.cc
+++ b/methods/rfc2553emu.cc
@@ -14,12 +14,14 @@
##################################################################### */
/*}}}*/
-#include "rfc2553emu.h"
+#include <config.h>
+
#include <stdlib.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <stdio.h>
+#include "rfc2553emu.h"
#ifndef HAVE_GETADDRINFO
// getaddrinfo - Resolve a hostname /*{{{*/
diff --git a/methods/rred.cc b/methods/rred.cc
index 849973e1a..bc941ed04 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -1,4 +1,6 @@
// Includes /*{{{*/
+#include <config.h>
+
#include <apt-pkg/fileutl.h>
#include <apt-pkg/mmap.h>
#include <apt-pkg/error.h>
@@ -51,7 +53,7 @@ protected:
virtual bool Fetch(FetchItem *Itm);
public:
- RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig) {};
+ RredMethod() : pkgAcqMethod("1.1",SingleInstance | SendConfig), Debug(false) {};
};
/*}}}*/
/** \brief applyFile - in reverse order with a tail recursion {{{
@@ -239,7 +241,9 @@ RredMethod::State RredMethod::patchFile(FileFd &Patch, FileFd &From, /*{{{*/
return result;
}
/*}}}*/
-struct EdCommand { /*{{{*/
+/* struct EdCommand {{{*/
+#ifdef _POSIX_MAPPED_FILES
+struct EdCommand {
size_t data_start;
size_t data_end;
size_t data_lines;
@@ -248,13 +252,14 @@ struct EdCommand { /*{{{*/
char type;
};
#define IOV_COUNT 1024 /* Don't really want IOV_MAX since it can be arbitrarily large */
+#endif
/*}}}*/
RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/
FileFd &out_file, Hashes *hash) const {
#ifdef _POSIX_MAPPED_FILES
MMap ed_cmds(MMap::ReadOnly);
if (Patch.gzFd() != NULL) {
- unsigned long mapSize = Patch.Size();
+ unsigned long long mapSize = Patch.Size();
DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
if (dyn->validData() == false) {
delete dyn;
diff --git a/methods/rsh.cc b/methods/rsh.cc
index 21f0d0a22..c95a4d3eb 100644
--- a/methods/rsh.cc
+++ b/methods/rsh.cc
@@ -11,7 +11,8 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include "rsh.h"
+#include <config.h>
+
#include <apt-pkg/error.h>
#include <sys/stat.h>
@@ -22,6 +23,8 @@
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
+#include "rsh.h"
+
#include <apti18n.h>
/*}}}*/
@@ -248,7 +251,7 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
// ---------------------------------------------------------------------
/* Right now for successfull transfer the file size must be known in
advance. */
-bool RSHConn::Size(const char *Path,unsigned long &Size)
+bool RSHConn::Size(const char *Path,unsigned long long &Size)
{
// Query the size
string Msg;
@@ -260,7 +263,7 @@ bool RSHConn::Size(const char *Path,unsigned long &Size)
// FIXME: Sense if the bad reply is due to a File Not Found.
char *End;
- Size = strtoul(Msg.c_str(),&End,10);
+ Size = strtoull(Msg.c_str(),&End,10);
if (End == Msg.c_str())
return _error->Error(_("File not found"));
return true;
@@ -285,8 +288,8 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
// RSHConn::Get - Get a file /*{{{*/
// ---------------------------------------------------------------------
/* */
-bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
- Hashes &Hash,bool &Missing, unsigned long Size)
+bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
+ Hashes &Hash,bool &Missing, unsigned long long Size)
{
Missing = false;
@@ -311,7 +314,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume,
return false;
// Copy loop
- unsigned int MyLen = Resume;
+ unsigned long long MyLen = Resume;
unsigned char Buffer[4096];
while (MyLen < Size)
{
@@ -425,7 +428,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
Status(_("Connecting to %s"), Get.Host.c_str());
// Get the files information
- unsigned long Size;
+ unsigned long long Size;
if (Server->Size(File,Size) == false ||
Server->ModTime(File,FailTime) == false)
{
@@ -446,7 +449,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
// See if the file exists
struct stat Buf;
if (stat(Itm->DestFile.c_str(),&Buf) == 0) {
- if (Size == (unsigned)Buf.st_size && FailTime == Buf.st_mtime) {
+ if (Size == (unsigned long long)Buf.st_size && FailTime == Buf.st_mtime) {
Res.Size = Buf.st_size;
Res.LastModified = Buf.st_mtime;
Res.ResumePoint = Buf.st_size;
@@ -455,7 +458,7 @@ bool RSHMethod::Fetch(FetchItem *Itm)
}
// Resume?
- if (FailTime == Buf.st_mtime && Size > (unsigned)Buf.st_size)
+ if (FailTime == Buf.st_mtime && Size > (unsigned long long)Buf.st_size)
Res.ResumePoint = Buf.st_size;
}
diff --git a/methods/rsh.h b/methods/rsh.h
index b06d5a94e..c81396b5f 100644
--- a/methods/rsh.h
+++ b/methods/rsh.h
@@ -34,17 +34,17 @@ class RSHConn
// Raw connection IO
bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
bool Connect(string Host, string User);
- bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
+ bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
// Connection control
bool Open();
void Close();
// Query
- bool Size(const char *Path,unsigned long &Size);
+ bool Size(const char *Path,unsigned long long &Size);
bool ModTime(const char *Path, time_t &Time);
- bool Get(const char *Path,FileFd &To,unsigned long Resume,
- Hashes &Hash,bool &Missing, unsigned long Size);
+ bool Get(const char *Path,FileFd &To,unsigned long long Resume,
+ Hashes &Hash,bool &Missing, unsigned long long Size);
RSHConn(URI Srv);
~RSHConn();