[svn] commit: r704 - in /branches/parkinglot/src: bin/auth/ bin/host/ bin/parkinglot/ lib/auth/cpp/ lib/cc/cpp/ lib/dns/cpp/

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Feb 2 16:45:02 UTC 2010


Author: jelte
Date: Tue Feb  2 16:45:02 2010
New Revision: 704

Log:
small fixes for most of the cppcheck errors

Modified:
    branches/parkinglot/src/bin/auth/auth_srv.cc
    branches/parkinglot/src/bin/host/host.cc
    branches/parkinglot/src/bin/parkinglot/b10-parkinglot.cc
    branches/parkinglot/src/bin/parkinglot/builtin_bench.cc
    branches/parkinglot/src/bin/parkinglot/data_source.h
    branches/parkinglot/src/lib/auth/cpp/query.h
    branches/parkinglot/src/lib/cc/cpp/data_unittests.cc
    branches/parkinglot/src/lib/cc/cpp/session.cc
    branches/parkinglot/src/lib/dns/cpp/buffer_unittest.cc
    branches/parkinglot/src/lib/dns/cpp/rrparamregistry_unittest.cc
    branches/parkinglot/src/lib/dns/cpp/rrttl.cc

Modified: branches/parkinglot/src/bin/auth/auth_srv.cc
==============================================================================
--- branches/parkinglot/src/bin/auth/auth_srv.cc (original)
+++ branches/parkinglot/src/bin/auth/auth_srv.cc Tue Feb  2 16:45:02 2010
@@ -74,12 +74,13 @@
     socklen_t sa_len = sizeof(ss);
     struct sockaddr* sa = static_cast<struct sockaddr*>((void*)&ss);
     int s = sock;
-    Message msg;
     char recvbuf[4096];
     int cc;
 
     if ((cc = recvfrom(s, recvbuf, sizeof(recvbuf), 0, sa, &sa_len)) > 0) {
+        Message msg;
         InputBuffer buffer(recvbuf, cc);
+
         try {
             msg.fromWire(buffer);
         } catch (...) {

Modified: branches/parkinglot/src/bin/host/host.cc
==============================================================================
--- branches/parkinglot/src/bin/host/host.cc (original)
+++ branches/parkinglot/src/bin/host/host.cc Tue Feb  2 16:45:02 2010
@@ -97,9 +97,10 @@
     char recvbuf[4096];
     int cc;
     if ((cc = recvfrom(s, recvbuf, sizeof(recvbuf), 0, sa, &sa_len)) > 0) {
-        Message rmsg;
-        InputBuffer ibuffer(recvbuf, cc);
         try {
+            Message rmsg;
+            InputBuffer ibuffer(recvbuf, cc);
+
             rmsg.fromWire(ibuffer);
             if (!verbose) {
                   for (RRsetIterator it = rmsg.beginSection(Section::ANSWER());

Modified: branches/parkinglot/src/bin/parkinglot/b10-parkinglot.cc
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/b10-parkinglot.cc (original)
+++ branches/parkinglot/src/bin/parkinglot/b10-parkinglot.cc Tue Feb  2 16:45:02 2010
@@ -119,12 +119,13 @@
     socklen_t sa_len = sizeof(ss);
     struct sockaddr* sa = static_cast<struct sockaddr*>((void*)&ss);
     int s = sock;
-    Message msg;
     char recvbuf[4096];
     int cc;
 
     if ((cc = recvfrom(s, recvbuf, sizeof(recvbuf), 0, sa, &sa_len)) > 0) {
+        Message msg;
         InputBuffer buffer(recvbuf, cc);
+
         try {
             msg.fromWire(buffer);
         } catch (...) {

Modified: branches/parkinglot/src/bin/parkinglot/builtin_bench.cc
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/builtin_bench.cc (original)
+++ branches/parkinglot/src/bin/parkinglot/builtin_bench.cc Tue Feb  2 16:45:02 2010
@@ -114,14 +114,6 @@
     return (rrset);
 }
 
-inline OutputBuffer
-txtToWire(const string& txt)
-{
-    OutputBuffer buffer(0);
-    generic::TXT(txt).toWire(buffer);
-    return (buffer);
-}
-
 struct WireDataInserter
 {
     WireDataInserter(vector<OutputBuffer>& buffers) : buffers_(buffers)

Modified: branches/parkinglot/src/bin/parkinglot/data_source.h
==============================================================================
--- branches/parkinglot/src/bin/parkinglot/data_source.h (original)
+++ branches/parkinglot/src/bin/parkinglot/data_source.h Tue Feb  2 16:45:02 2010
@@ -27,6 +27,7 @@
 // i.e. do we want this to be able to hold more types than RRset?
 class SearchResult {
 public:
+    SearchResult() : status(success) {};
     enum status_type { success, error, not_implemented,
                        zone_not_found, name_not_found };
 

Modified: branches/parkinglot/src/lib/auth/cpp/query.h
==============================================================================
--- branches/parkinglot/src/lib/auth/cpp/query.h (original)
+++ branches/parkinglot/src/lib/auth/cpp/query.h Tue Feb  2 16:45:02 2010
@@ -84,9 +84,8 @@
         qname_ = &query->getName();
         qclass_ = &query->getClass();
         qtype_ = &query->getType();
-        QueryTask *qt = new QueryTask(*qname_, *qclass_, *qtype_,
-                                      Section::ANSWER());
-        querytasks.push(QueryTaskPtr(qt));
+        querytasks.push(QueryTaskPtr(new QueryTask(*qname_, *qclass_,
+                                     *qtype_, Section::ANSWER())));
     };
 
     virtual ~Query() {}

Modified: branches/parkinglot/src/lib/cc/cpp/data_unittests.cc
==============================================================================
--- branches/parkinglot/src/lib/cc/cpp/data_unittests.cc (original)
+++ branches/parkinglot/src/lib/cc/cpp/data_unittests.cc Tue Feb  2 16:45:02 2010
@@ -195,18 +195,6 @@
     EXPECT_FALSE(el->find("name/error", el2));
 }
 
-void my_print(std::string &s) {
-    int i;
-    for (i = 0; i < s.size(); i++) {
-        if (isalnum(s.at(i))) {
-            std::cout << s.at(i);
-        } else {
-            std::cout << "\\" << setfill('0') << setw(3) << oct << int(s.at(i));
-        }
-    }
-    std::cout << std::endl;
-}
-
 TEST(Element, to_and_from_wire) {
     ElementPtr el, decoded_el;
     std::string wire;

Modified: branches/parkinglot/src/lib/cc/cpp/session.cc
==============================================================================
--- branches/parkinglot/src/lib/cc/cpp/session.cc (original)
+++ branches/parkinglot/src/lib/cc/cpp/session.cc Tue Feb  2 16:45:02 2010
@@ -17,6 +17,7 @@
 Session::Session()
 {
     sock = -1;
+    sequence = 1;
 }
 
 void

Modified: branches/parkinglot/src/lib/dns/cpp/buffer_unittest.cc
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/buffer_unittest.cc (original)
+++ branches/parkinglot/src/lib/dns/cpp/buffer_unittest.cc Tue Feb  2 16:45:02 2010
@@ -30,6 +30,7 @@
     {
         data16 = (2 << 8) | 3;
         data32 = (4 << 24) | (5 << 16) | (6 << 8) | 7;
+        memset(vdata, 0, sizeof(testdata));
     }
 
     InputBuffer ibuffer;

Modified: branches/parkinglot/src/lib/dns/cpp/rrparamregistry_unittest.cc
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/rrparamregistry_unittest.cc (original)
+++ branches/parkinglot/src/lib/dns/cpp/rrparamregistry_unittest.cc Tue Feb  2 16:45:02 2010
@@ -31,7 +31,7 @@
 namespace {
 class RRParamRegistryTest : public ::testing::Test {
 protected:
-    virtual void SetUp() {
+    /*virtual void SetUp() {
         ostringstream oss1;
         oss1 << test_class_code;
         test_class_unknown_str = "CLASS" + oss1.str();
@@ -39,7 +39,7 @@
         ostringstream oss2;
         oss2 << test_type_code;
         test_type_unknown_str = "TYPE" + oss2.str();
-    }
+    }*/
 
     string test_class_unknown_str;
     string test_type_unknown_str;

Modified: branches/parkinglot/src/lib/dns/cpp/rrttl.cc
==============================================================================
--- branches/parkinglot/src/lib/dns/cpp/rrttl.cc (original)
+++ branches/parkinglot/src/lib/dns/cpp/rrttl.cc Tue Feb  2 16:45:02 2010
@@ -22,6 +22,7 @@
 #include "messagerenderer.h"
 #include "rrttl.h"
 
+#include <iostream>
 using namespace std;
 using namespace isc::dns;
 




More information about the bind10-changes mailing list