Browse Source

follow the recommendation of cppcheck to make some method methods (scnr)

const and initial mostly Debug member values in the constructors
tags/debian/0.8.15.6
David Kalnischkies 10 years ago
parent
commit
f5a34606b4
6 changed files with 18 additions and 13 deletions
  1. +2
    -1
      methods/cdrom.cc
  2. +2
    -1
      methods/ftp.cc
  3. +7
    -7
      methods/http.h
  4. +1
    -1
      methods/mirror.cc
  5. +5
    -2
      methods/rred.cc
  6. +1
    -1
      methods/rsh.h

+ 2
- 1
methods/cdrom.cc View File

@@ -54,7 +54,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();


+ 2
- 1
methods/ftp.cc View File

@@ -69,7 +69,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;


+ 7
- 7
methods/http.h View File

@@ -36,14 +36,14 @@ class CircleBuf
static struct timeval BwReadTick;
static const unsigned int BW_HZ;

unsigned long LeftRead()
unsigned long LeftRead() const
{
unsigned long Sz = Size - (InP - OutP);
if (Sz > Size - (InP%Size))
Sz = Size - (InP%Size);
return Sz;
}
unsigned long LeftWrite()
unsigned long LeftWrite() const
{
unsigned long Sz = InP - OutP;
if (InP > MaxGet)
@@ -68,12 +68,12 @@ class CircleBuf
// 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;};
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();
@@ -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;};


+ 1
- 1
methods/mirror.cc View File

@@ -54,7 +54,7 @@ using namespace std;
*/

MirrorMethod::MirrorMethod()
: HttpMethod(), DownloadedMirrorFile(false)
: HttpMethod(), DownloadedMirrorFile(false), Debug(false)
{
};



+ 5
- 2
methods/rred.cc View File

@@ -51,7 +51,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 +239,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,6 +250,7 @@ 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 {


+ 1
- 1
methods/rsh.h View File

@@ -34,7 +34,7 @@ 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();


Loading…
Cancel
Save