]> git.saurik.com Git - apt.git/commitdiff
follow the recommendation of cppcheck to make some method methods (scnr)
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 11 Aug 2011 21:30:09 +0000 (23:30 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 11 Aug 2011 21:30:09 +0000 (23:30 +0200)
const and initial mostly Debug member values in the constructors

methods/cdrom.cc
methods/ftp.cc
methods/http.h
methods/mirror.cc
methods/rred.cc
methods/rsh.h

index b25fdf5a855738e4b37dadd5380897333998a29f..ae699dfc33b5479648b251446d374231a68c12bc 100644 (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();
index c2c4857697e09a4296d26b538986eea82872bb2f..eb7fedd85509bca7e838670d829ebad976ed8f40 100644 (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;
index aa96c6810d9824c36893a59cd9fda7d910e56f29..6302807c5e743fcfa2a764eaf462906596ec1f0d 100644 (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;};
index 565df532734f656ff468676d1d3202ec9b40bb23..cb24a06cf1743a80eaf5f072bb4cad08d56c563b 100644 (file)
@@ -54,7 +54,7 @@ using namespace std;
  */
 
 MirrorMethod::MirrorMethod()
-   : HttpMethod(), DownloadedMirrorFile(false)
+   : HttpMethod(), DownloadedMirrorFile(false), Debug(false)
 {
 };
 
index 849973e1a6405a8fa06a1f37546789344b194a99..6c55880ca1726c782bd1f939c50952a7f083c0ba 100644 (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 {
index b06d5a94e67ad2ac9e74bfc35a4b55428c9084fd..98ca6a88ce69162526fe94fafd5d67fd53c58196 100644 (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();