Commit 8845466c authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

overall style cleanup: adjusted brace positions according to the coding guideline.

skipping review.  confirmed it compiled.


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3225 e5f2f494-b856-4b98-b285-d166d9295462
parent 5791c24c
......@@ -19,8 +19,7 @@
#include <dns/tests/unittest_util.h>
int
main(int argc, char* argv[])
{
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR);
......
......@@ -184,7 +184,8 @@ Element::find(const std::string& identifier UNUSED_PARAM,
namespace {
inline void
throwJSONError(const std::string& error, const std::string& file, int line, int pos)
throwJSONError(const std::string& error, const std::string& file, int line,
int pos)
{
std::stringstream ss;
ss << error << " in " + file + ":" << line << ":" << pos;
......@@ -427,13 +428,15 @@ from_stringstream_null(std::istream &in, const std::string& file,
}
ElementPtr
from_stringstream_string(std::istream& in, const std::string& file, int& line, int& pos)
from_stringstream_string(std::istream& in, const std::string& file, int& line,
int& pos)
{
return (Element::create(str_from_stringstream(in, file, line, pos)));
}
ElementPtr
from_stringstream_list(std::istream &in, const std::string& file, int& line, int& pos)
from_stringstream_list(std::istream &in, const std::string& file, int& line,
int& pos)
{
char c = 0;
ElementPtr list = Element::createList();
......@@ -484,8 +487,7 @@ from_stringstream_map(std::istream &in, const std::string& file, int& line,
}
std::string
Element::typeToName(Element::types type)
{
Element::typeToName(Element::types type) {
switch (type) {
case Element::integer:
return (std::string("integer"));
......@@ -538,14 +540,16 @@ Element::fromJSON(std::istream& in) throw(JSONError) {
}
ElementPtr
Element::fromJSON(std::istream& in, const std::string& file_name) throw(JSONError)
Element::fromJSON(std::istream& in, const std::string& file_name)
throw(JSONError)
{
int line = 1, pos = 1;
return (fromJSON(in, file_name, line, pos));
}
ElementPtr
Element::fromJSON(std::istream &in, const std::string& file, int& line, int& pos) throw(JSONError)
Element::fromJSON(std::istream &in, const std::string& file, int& line,
int& pos) throw(JSONError)
{
char c = 0;
ElementPtr element;
......
......@@ -17,8 +17,7 @@
#include <gtest/gtest.h>
int
main(int argc, char* argv[])
{
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS());
}
......@@ -333,8 +333,7 @@ ModuleCCSession::checkCommand() {
}
std::string
ModuleCCSession::addRemoteConfig(const std::string& spec_file_name)
{
ModuleCCSession::addRemoteConfig(const std::string& spec_file_name) {
ModuleSpec rmod_spec = readModuleSpecification(spec_file_name);
std::string module_name = rmod_spec.getFullSpec()->get("module_name")->stringValue();
ConfigData rmod_config = ConfigData(rmod_spec);
......@@ -362,8 +361,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_file_name)
}
void
ModuleCCSession::removeRemoteConfig(const std::string& module_name)
{
ModuleCCSession::removeRemoteConfig(const std::string& module_name) {
std::map<std::string, ConfigData>::iterator it;
it = remote_module_configs_.find(module_name);
......
......@@ -164,8 +164,7 @@ TEST_F(CCSessionTest, session1) {
EXPECT_EQ(0, session.getMsgQueue()->size());
}
TEST_F(CCSessionTest, session2)
{
TEST_F(CCSessionTest, session2) {
EXPECT_EQ(false, session.haveSubscription("Spec2", "*"));
ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL);
EXPECT_EQ(true, session.haveSubscription("Spec2", "*"));
......
......@@ -105,8 +105,7 @@ TEST(ModuleSpec, SpecfileItems) {
"badname is not a valid type name");
}
TEST(ModuleSpec, SpecfileConfigData)
{
TEST(ModuleSpec, SpecfileConfigData) {
module_spec_error("spec7.spec",
"module_name missing in { }");
module_spec_error("spec8.spec",
......@@ -117,8 +116,7 @@ TEST(ModuleSpec, SpecfileConfigData)
"commands is not a list of elements");
}
TEST(ModuleSpec, SpecfileCommands)
{
TEST(ModuleSpec, SpecfileCommands) {
module_spec_error("spec17.spec",
"command_name missing in { \"command_args\": [ { \"item_default\": \"\", \"item_name\": \"message\", \"item_optional\": false, \"item_type\": \"string\" } ], \"command_description\": \"Print the given message to stdout\" }");
module_spec_error("spec18.spec",
......
......@@ -17,8 +17,7 @@
#include <gtest/gtest.h>
int
main(int argc, char* argv[])
{
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS());
}
......@@ -110,14 +110,12 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
"0 28800 7200 604800 86400"));
}
StaticDataSrc::StaticDataSrc()
{
StaticDataSrc::StaticDataSrc() {
setClass(RRClass::CH());
impl_ = new StaticDataSrcImpl;
}
StaticDataSrc::~StaticDataSrc()
{
StaticDataSrc::~StaticDataSrc() {
delete impl_;
}
......
......@@ -19,8 +19,7 @@
#include <dns/tests/unittest_util.h>
int
main(int argc, char* argv[])
{
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
......
......@@ -219,8 +219,7 @@ def generate_typeclasscode(fileprefix, basemtime, code2txt, type_or_class):
codetxt = code2txt[code].upper()
declarationtxt += ' ' * 4 + 'static const RR' + cap_key + '& ' + codetxt + '();\n'
deftxt += '''inline const RR''' + cap_key + '''&
RR''' + cap_key + '''::''' + codetxt + '''()
{
RR''' + cap_key + '''::''' + codetxt + '''() {
static RR''' + cap_key + ''' ''' + lower_key + '''(''' + code + ''');
return (''' + lower_key + ''');
}\n
......
......@@ -715,8 +715,7 @@ Message::clear(Mode mode) {
}
void
Message::makeResponse()
{
Message::makeResponse() {
if (impl_->mode_ != Message::PARSE) {
isc_throw(InvalidMessageOperation,
"makeResponse() is performed in non-parse mode");
......
......@@ -114,50 +114,43 @@ private:
};
inline const MessageFlag&
MessageFlag::QR()
{
MessageFlag::QR() {
static MessageFlag f(0x8000);
return (f);
}
inline const MessageFlag&
MessageFlag::AA()
{
MessageFlag::AA() {
static MessageFlag f(0x0400);
return (f);
}
inline const MessageFlag&
MessageFlag::TC()
{
MessageFlag::TC() {
static MessageFlag f(0x0200);
return (f);
}
inline const MessageFlag&
MessageFlag::RD()
{
MessageFlag::RD() {
static MessageFlag f(0x0100);
return (f);
}
inline const MessageFlag&
MessageFlag::RA()
{
MessageFlag::RA() {
static MessageFlag f(0x0080);
return (f);
}
inline const MessageFlag&
MessageFlag::AD()
{
MessageFlag::AD() {
static MessageFlag f(0x0020);
return (f);
}
inline const MessageFlag&
MessageFlag::CD()
{
MessageFlag::CD() {
static MessageFlag f(0x0010);
return (f);
}
......@@ -199,29 +192,25 @@ private:
};
inline const Section&
Section::QUESTION()
{
Section::QUESTION() {
static Section s(SECTION_QUESTION);
return (s);
}
inline const Section&
Section::ANSWER()
{
Section::ANSWER() {
static Section s(SECTION_ANSWER);
return (s);
}
inline const Section&
Section::AUTHORITY()
{
Section::AUTHORITY() {
static Section s(SECTION_AUTHORITY);
return (s);
}
inline const Section&
Section::ADDITIONAL()
{
Section::ADDITIONAL() {
static Section s(SECTION_ADDITIONAL);
return (s);
}
......
......@@ -42,15 +42,13 @@ Question::Question(InputBuffer& buffer) :
}
string
Question::toText() const
{
Question::toText() const {
return (name_.toText() + " " + rrclass_.toText() + " " +
rrtype_.toText() + "\n");
}
unsigned int
Question::toWire(OutputBuffer& buffer) const
{
Question::toWire(OutputBuffer& buffer) const {
name_.toWire(buffer);
rrtype_.toWire(buffer);
rrclass_.toWire(buffer); // number of "entries", which is always 1
......@@ -59,8 +57,7 @@ Question::toWire(OutputBuffer& buffer) const
}
unsigned int
Question::toWire(MessageRenderer& renderer) const
{
Question::toWire(MessageRenderer& renderer) const {
renderer.writeName(name_);
rrtype_.toWire(renderer);
rrclass_.toWire(renderer);
......@@ -69,8 +66,7 @@ Question::toWire(MessageRenderer& renderer) const
}
ostream&
operator<<(std::ostream& os, const Question& question)
{
operator<<(std::ostream& os, const Question& question) {
os << question.toText();
return (os);
}
......
......@@ -82,8 +82,7 @@ createRdata(const RRType& rrtype, const RRClass& rrclass, const Rdata& source)
}
int
compareNames(const Name& n1, const Name& n2)
{
compareNames(const Name& n1, const Name& n2) {
size_t len1 = n1.getLength();
size_t len2 = n2.getLength();
size_t cmplen = min(len1, len2);
......@@ -107,8 +106,7 @@ struct GenericImpl {
vector<uint8_t> data_;
};
Generic::Generic(InputBuffer& buffer, size_t rdata_len)
{
Generic::Generic(InputBuffer& buffer, size_t rdata_len) {
if (rdata_len > MAX_RDLENGTH) {
isc_throw(InvalidRdataLength, "RDLENGTH too large");
}
......@@ -119,8 +117,7 @@ Generic::Generic(InputBuffer& buffer, size_t rdata_len)
impl_ = new GenericImpl(data);
}
Generic::Generic(const string& rdata_string)
{
Generic::Generic(const string& rdata_string) {
istringstream iss(rdata_string);
string unknown_mark;
iss >> unknown_mark;
......@@ -181,8 +178,7 @@ Generic::Generic(const string& rdata_string)
impl_ = new GenericImpl(data);
}
Generic::~Generic()
{
Generic::~Generic() {
delete impl_;
}
......@@ -191,8 +187,7 @@ Generic::Generic(const Generic& source) :
{}
Generic&
Generic::operator=(const Generic& source)
{
Generic::operator=(const Generic& source) {
if (impl_ == source.impl_) {
return (*this);
}
......@@ -218,8 +213,7 @@ private:
}
string
Generic::toText() const
{
Generic::toText() const {
ostringstream oss;
oss << "\\# " << impl_->data_.size() << " ";
......@@ -231,21 +225,18 @@ Generic::toText() const
}
void
Generic::toWire(OutputBuffer& buffer) const
{
Generic::toWire(OutputBuffer& buffer) const {
buffer.writeData(&impl_->data_[0], impl_->data_.size());
}
void
Generic::toWire(MessageRenderer& renderer) const
{
Generic::toWire(MessageRenderer& renderer) const {
renderer.writeData(&impl_->data_[0], impl_->data_.size());
}
namespace {
inline int
compare_internal(const GenericImpl& lhs, const GenericImpl& rhs)
{
compare_internal(const GenericImpl& lhs, const GenericImpl& rhs) {
size_t this_len = lhs.data_.size();
size_t other_len = rhs.data_.size();
size_t len = (this_len < other_len) ? this_len : other_len;
......@@ -262,16 +253,14 @@ compare_internal(const GenericImpl& lhs, const GenericImpl& rhs)
}
int
Generic::compare(const Rdata& other) const
{
Generic::compare(const Rdata& other) const {
const Generic& other_rdata = dynamic_cast<const Generic&>(other);
return (compare_internal(*impl_, *other_rdata.impl_));
}
std::ostream&
operator<<(std::ostream& os, const Generic& rdata)
{
operator<<(std::ostream& os, const Generic& rdata) {
return (os << rdata.toText());
}
} // end of namespace generic
......
......@@ -30,13 +30,11 @@ using namespace std;
// BEGIN_ISC_NAMESPACE
// BEGIN_RDATA_NAMESPACE
A::A(const string& addrstr UNUSED_PARAM)
{
A::A(const string& addrstr UNUSED_PARAM) {
// TBD
}
A::A(InputBuffer& buffer UNUSED_PARAM, size_t rdata_len UNUSED_PARAM)
{
A::A(InputBuffer& buffer UNUSED_PARAM, size_t rdata_len UNUSED_PARAM) {
// TBD
}
......@@ -45,27 +43,23 @@ A::A(const A& source UNUSED_PARAM) : Rdata() {
}
void
A::toWire(OutputBuffer& buffer UNUSED_PARAM) const
{
A::toWire(OutputBuffer& buffer UNUSED_PARAM) const {
// TBD
}
void
A::toWire(MessageRenderer& renderer UNUSED_PARAM) const
{
A::toWire(MessageRenderer& renderer UNUSED_PARAM) const {
// TBD
}
string
A::toText() const
{
A::toText() const {
// TBD
isc_throw(InvalidRdataText, "Not implemented yet");
}
int
A::compare(const Rdata& other UNUSED_PARAM) const
{
A::compare(const Rdata& other UNUSED_PARAM) const {
return (0); // dummy. TBD
}
......
......@@ -49,34 +49,29 @@ CNAME::CNAME(const Name& cname) :
{}
void
CNAME::toWire(OutputBuffer& buffer) const
{
CNAME::toWire(OutputBuffer& buffer) const {
cname_.toWire(buffer);
}
void
CNAME::toWire(MessageRenderer& renderer) const
{
CNAME::toWire(MessageRenderer& renderer) const {
renderer.writeName(cname_);
}
string
CNAME::toText() const
{
CNAME::toText() const {
return (cname_.toText());
}
int
CNAME::compare(const Rdata& other) const
{
CNAME::compare(const Rdata& other) const {
const CNAME& other_cname = dynamic_cast<const CNAME&>(other);
return (compareNames(cname_, other_cname.cname_));
}
const Name&
CNAME::getCname() const
{
CNAME::getCname() const {
return (cname_);
}
......
......@@ -49,34 +49,29 @@ DNAME::DNAME(const Name& dname) :
{}
void
DNAME::toWire(OutputBuffer& buffer) const
{
DNAME::toWire(OutputBuffer& buffer) const {
dname_.toWire(buffer);
}
void
DNAME::toWire(MessageRenderer& renderer) const
{
DNAME::toWire(MessageRenderer& renderer) const {
renderer.writeName(dname_);
}
string
DNAME::toText() const
{
DNAME::toText() const {
return (dname_.toText());
}
int
DNAME::compare(const Rdata& other) const
{
DNAME::compare(const Rdata& other) const {
const DNAME& other_dname = dynamic_cast<const DNAME&>(other);
return (compareNames(dname_, other_dname.dname_));
}
const Name&
DNAME::getDname() const
{
DNAME::getDname() const {
return (dname_);
}
......
......@@ -103,8 +103,7 @@ DNSKEY::DNSKEY(const DNSKEY& source) :
{}
DNSKEY&
DNSKEY::operator=(const DNSKEY& source)
{
DNSKEY::operator=(const DNSKEY& source) {
if (impl_ == source.impl_) {
return (*this);
}
......@@ -116,14 +115,12 @@ DNSKEY::operator=(const DNSKEY& source)
return (*this);
}
DNSKEY::~DNSKEY()
{
DNSKEY::~DNSKEY() {
delete impl_;
}
string
DNSKEY::toText() const
{
DNSKEY::toText() const {
return (boost::lexical_cast<string>(static_cast<int>(impl_->flags_)) +
" " + boost::lexical_cast<string>(static_cast<int>(impl_->protocol_)) +
" " + boost::lexical_cast<string>(static_cast<int>(impl_->algorithm_)) +
......@@ -131,8 +128,7 @@ DNSKEY::toText() const
}
void
DNSKEY::toWire(OutputBuffer& buffer) const
{
DNSKEY::toWire(OutputBuffer& buffer) const {
buffer.writeUint16(impl_->flags_);
buffer.writeUint8(impl_->protocol_);
buffer.writeUint8(impl_->algorithm_);
......@@ -140,8 +136,7 @@ DNSKEY::toWire(OutputBuffer& buffer) const
}
void
DNSKEY::toWire(MessageRenderer& renderer) const
{
DNSKEY::toWire(MessageRenderer& renderer) const {
renderer.writeUint16(impl_->flags_);
renderer.writeUint8(impl_->protocol_);
renderer.writeUint8(impl_->algorithm_);
......@@ -149,8 +144,7 @@ DNSKEY::toWire(MessageRenderer& renderer) const
}
int
DNSKEY::compare(const Rdata& other) const
{
DNSKEY::compare(const Rdata& other) const {
const DNSKEY& other_dnskey = dynamic_cast<const DNSKEY&>(other);