]> git.saurik.com Git - apt.git/commitdiff
act on various suggestions from cppcheck
authorDavid Kalnischkies <david@kalnischkies.de>
Mon, 25 Jan 2016 21:13:52 +0000 (22:13 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 26 Jan 2016 14:32:15 +0000 (15:32 +0100)
Reported-By: cppcheck
Git-Dch: Ignore

apt-pkg/acquire-method.cc
apt-pkg/acquire-worker.cc
apt-pkg/indexcopy.cc
methods/rred.cc
methods/server.cc

index 991e6780a6e71bf375e82430d51f8b73de812157..d0eb01bbc31ff74e338357028df49267dfb1d2bf 100644 (file)
@@ -480,7 +480,10 @@ void pkgAcqMethod::Dequeue() {                                             /*{{{*/
                                                                        /*}}}*/
 pkgAcqMethod::~pkgAcqMethod() {}
 
                                                                        /*}}}*/
 pkgAcqMethod::~pkgAcqMethod() {}
 
-pkgAcqMethod::FetchItem::FetchItem() : d(NULL) {}
+pkgAcqMethod::FetchItem::FetchItem() :
+   Next(nullptr), DestFileFd(-1), LastModified(0), IndexFile(false),
+   FailIgnore(false), MaximumSize(0), d(nullptr)
+{}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 
 pkgAcqMethod::FetchResult::~FetchResult() {}
 pkgAcqMethod::FetchItem::~FetchItem() {}
 
 pkgAcqMethod::FetchResult::~FetchResult() {}
index c2ee8cda39fdba8962fae476ad602cdc84e14464..37804c67a098f585dadab54c018491299008a4cb 100644 (file)
 using namespace std;
 
 // Worker::Worker - Constructor for Queue startup                      /*{{{*/
 using namespace std;
 
 // Worker::Worker - Constructor for Queue startup                      /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-pkgAcquire::Worker::Worker(Queue *Q,MethodConfig *Cnf,
-                          pkgAcquireStatus *log) : d(NULL), Log(log)
+pkgAcquire::Worker::Worker(Queue *Q, MethodConfig *Cnf, pkgAcquireStatus *log) :
+   d(NULL), OwnerQ(Q), Log(log), Config(Cnf), Access(Cnf->Access),
+   CurrentItem(nullptr), CurrentSize(0), TotalSize(0)
 {
 {
-   OwnerQ = Q;
-   Config = Cnf;
-   Access = Cnf->Access;
-   CurrentItem = 0;
-   TotalSize = 0;
-   CurrentSize = 0;
-
    Construct();
 }
                                                                        /*}}}*/
 // Worker::Worker - Constructor for method config startup              /*{{{*/
    Construct();
 }
                                                                        /*}}}*/
 // Worker::Worker - Constructor for method config startup              /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-pkgAcquire::Worker::Worker(MethodConfig *Cnf) : d(NULL), OwnerQ(NULL), Config(Cnf),
-                                               Access(Cnf->Access), CurrentItem(NULL),
-                                               CurrentSize(0), TotalSize(0)
+pkgAcquire::Worker::Worker(MethodConfig *Cnf) : Worker(nullptr, Cnf, nullptr)
 {
 {
-   Construct();
 }
                                                                        /*}}}*/
 // Worker::Construct - Constructor helper                              /*{{{*/
 }
                                                                        /*}}}*/
 // Worker::Construct - Constructor helper                              /*{{{*/
index c54b365dc83a4cd7ed382ed19dd61ad8f8c1f099..4aade6e8a45d58966a2a47d94131565262933175 100644 (file)
@@ -771,14 +771,14 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/
 }
                                                                        /*}}}*/
 
 }
                                                                        /*}}}*/
 
-IndexCopy::IndexCopy() : d(NULL) {}
+IndexCopy::IndexCopy() : d(nullptr), Section(nullptr) {}
 APT_CONST IndexCopy::~IndexCopy() {}
 
 PackageCopy::PackageCopy() : IndexCopy(), d(NULL) {}
 APT_CONST PackageCopy::~PackageCopy() {}
 SourceCopy::SourceCopy() : IndexCopy(), d(NULL) {}
 APT_CONST SourceCopy::~SourceCopy() {}
 APT_CONST IndexCopy::~IndexCopy() {}
 
 PackageCopy::PackageCopy() : IndexCopy(), d(NULL) {}
 APT_CONST PackageCopy::~PackageCopy() {}
 SourceCopy::SourceCopy() : IndexCopy(), d(NULL) {}
 APT_CONST SourceCopy::~SourceCopy() {}
-TranslationsCopy::TranslationsCopy() : d(NULL) {}
+TranslationsCopy::TranslationsCopy() : d(nullptr), Section(nullptr) {}
 APT_CONST TranslationsCopy::~TranslationsCopy() {}
 SigVerify::SigVerify() : d(NULL) {}
 APT_CONST SigVerify::~SigVerify() {}
 APT_CONST TranslationsCopy::~TranslationsCopy() {}
 SigVerify::SigVerify() : d(NULL) {}
 APT_CONST SigVerify::~SigVerify() {}
index 85ec30bd51cd7f727f847bc81f446dacbe340bfd..e568c75b2954a7f26ce804f0d80d6e506c5099ab 100644 (file)
@@ -491,7 +491,11 @@ class Patch {
       for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) {
         std::list<struct Change>::reverse_iterator mg_i, mg_e = ch;
         while (ch->del_cnt == 0 && ch->offset == 0)
       for (ch = filechanges.rbegin(); ch != filechanges.rend(); ++ch) {
         std::list<struct Change>::reverse_iterator mg_i, mg_e = ch;
         while (ch->del_cnt == 0 && ch->offset == 0)
+        {
            ++ch;
            ++ch;
+           if (unlikely(ch == filechanges.rend()))
+              return;
+        }
         line -= ch->del_cnt;
         std::string buf;
         if (ch->add_cnt > 0) {
         line -= ch->del_cnt;
         std::string buf;
         if (ch->add_cnt > 0) {
index 6340390d48c8f5c4314fb1da0d118e60ca1eccf1..322b8d94ca1dfcdd98f20ff20715aa1659437a97 100644 (file)
@@ -246,7 +246,8 @@ bool ServerState::HeaderLine(string Line)
 }
                                                                        /*}}}*/
 // ServerState::ServerState - Constructor                              /*{{{*/
 }
                                                                        /*}}}*/
 // ServerState::ServerState - Constructor                              /*{{{*/
-ServerState::ServerState(URI Srv, ServerMethod *Owner) : ServerName(Srv), TimeOut(120), Owner(Owner)
+ServerState::ServerState(URI Srv, ServerMethod *Owner) :
+   DownloadSize(0), ServerName(Srv), TimeOut(120), Owner(Owner)
 {
    Reset();
 }
 {
    Reset();
 }