Commit bc361547 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

small fixes for most of the cppcheck errors


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@704 e5f2f494-b856-4b98-b285-d166d9295462
parent a7dbef7d
......@@ -74,12 +74,13 @@ AuthSrv::processMessage() {
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 (...) {
......
......@@ -97,9 +97,10 @@ host_lookup(char* name, std::string type)
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());
......
......@@ -119,12 +119,13 @@ ParkingLot::processMessage() {
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 (...) {
......
......@@ -114,14 +114,6 @@ getNormalRRset(const vector<OutputBuffer>& buffers)
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)
......
......@@ -27,6 +27,7 @@ namespace dns {
// 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 };
......
......@@ -84,9 +84,8 @@ public:
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() {}
......
......@@ -195,18 +195,6 @@ TEST(Element, MapElement) {
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;
......
......@@ -17,6 +17,7 @@ using namespace isc::data;
Session::Session()
{
sock = -1;
sequence = 1;
}
void
......
......@@ -30,6 +30,7 @@ protected:
{
data16 = (2 << 8) | 3;
data32 = (4 << 24) | (5 << 16) | (6 << 8) | 7;
memset(vdata, 0, sizeof(testdata));
}
InputBuffer ibuffer;
......
......@@ -31,7 +31,7 @@ using namespace isc::dns;
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 @@ protected:
ostringstream oss2;
oss2 << test_type_code;
test_type_unknown_str = "TYPE" + oss2.str();
}
}*/
string test_class_unknown_str;
string test_type_unknown_str;
......
......@@ -22,6 +22,7 @@
#include "messagerenderer.h"
#include "rrttl.h"
#include <iostream>
using namespace std;
using namespace isc::dns;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment