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 @@ ...@@ -19,8 +19,7 @@
#include <dns/tests/unittest_util.h> #include <dns/tests/unittest_util.h>
int int
main(int argc, char* argv[]) main(int argc, char* argv[]) {
{
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR); isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR); isc::UnitTestUtil::addDataPath(TEST_DATA_BUILDDIR);
......
...@@ -184,7 +184,8 @@ Element::find(const std::string& identifier UNUSED_PARAM, ...@@ -184,7 +184,8 @@ Element::find(const std::string& identifier UNUSED_PARAM,
namespace { namespace {
inline void 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; std::stringstream ss;
ss << error << " in " + file + ":" << line << ":" << pos; ss << error << " in " + file + ":" << line << ":" << pos;
...@@ -427,13 +428,15 @@ from_stringstream_null(std::istream &in, const std::string& file, ...@@ -427,13 +428,15 @@ from_stringstream_null(std::istream &in, const std::string& file,
} }
ElementPtr 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))); return (Element::create(str_from_stringstream(in, file, line, pos)));
} }
ElementPtr 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; char c = 0;
ElementPtr list = Element::createList(); ElementPtr list = Element::createList();
...@@ -484,8 +487,7 @@ from_stringstream_map(std::istream &in, const std::string& file, int& line, ...@@ -484,8 +487,7 @@ from_stringstream_map(std::istream &in, const std::string& file, int& line,
} }
std::string std::string
Element::typeToName(Element::types type) Element::typeToName(Element::types type) {
{
switch (type) { switch (type) {
case Element::integer: case Element::integer:
return (std::string("integer")); return (std::string("integer"));
...@@ -538,14 +540,16 @@ Element::fromJSON(std::istream& in) throw(JSONError) { ...@@ -538,14 +540,16 @@ Element::fromJSON(std::istream& in) throw(JSONError) {
} }
ElementPtr 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; int line = 1, pos = 1;
return (fromJSON(in, file_name, line, pos)); return (fromJSON(in, file_name, line, pos));
} }
ElementPtr 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; char c = 0;
ElementPtr element; ElementPtr element;
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
int int
main(int argc, char* argv[]) main(int argc, char* argv[]) {
{
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS()); return (RUN_ALL_TESTS());
} }
...@@ -333,8 +333,7 @@ ModuleCCSession::checkCommand() { ...@@ -333,8 +333,7 @@ ModuleCCSession::checkCommand() {
} }
std::string 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); ModuleSpec rmod_spec = readModuleSpecification(spec_file_name);
std::string module_name = rmod_spec.getFullSpec()->get("module_name")->stringValue(); std::string module_name = rmod_spec.getFullSpec()->get("module_name")->stringValue();
ConfigData rmod_config = ConfigData(rmod_spec); ConfigData rmod_config = ConfigData(rmod_spec);
...@@ -362,8 +361,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_file_name) ...@@ -362,8 +361,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_file_name)
} }
void void
ModuleCCSession::removeRemoteConfig(const std::string& module_name) ModuleCCSession::removeRemoteConfig(const std::string& module_name) {
{
std::map<std::string, ConfigData>::iterator it; std::map<std::string, ConfigData>::iterator it;
it = remote_module_configs_.find(module_name); it = remote_module_configs_.find(module_name);
......
...@@ -164,8 +164,7 @@ TEST_F(CCSessionTest, session1) { ...@@ -164,8 +164,7 @@ TEST_F(CCSessionTest, session1) {
EXPECT_EQ(0, session.getMsgQueue()->size()); EXPECT_EQ(0, session.getMsgQueue()->size());
} }
TEST_F(CCSessionTest, session2) TEST_F(CCSessionTest, session2) {
{
EXPECT_EQ(false, session.haveSubscription("Spec2", "*")); EXPECT_EQ(false, session.haveSubscription("Spec2", "*"));
ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL); ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL);
EXPECT_EQ(true, session.haveSubscription("Spec2", "*")); EXPECT_EQ(true, session.haveSubscription("Spec2", "*"));
......
...@@ -105,8 +105,7 @@ TEST(ModuleSpec, SpecfileItems) { ...@@ -105,8 +105,7 @@ TEST(ModuleSpec, SpecfileItems) {
"badname is not a valid type name"); "badname is not a valid type name");
} }
TEST(ModuleSpec, SpecfileConfigData) TEST(ModuleSpec, SpecfileConfigData) {
{
module_spec_error("spec7.spec", module_spec_error("spec7.spec",
"module_name missing in { }"); "module_name missing in { }");
module_spec_error("spec8.spec", module_spec_error("spec8.spec",
...@@ -117,8 +116,7 @@ TEST(ModuleSpec, SpecfileConfigData) ...@@ -117,8 +116,7 @@ TEST(ModuleSpec, SpecfileConfigData)
"commands is not a list of elements"); "commands is not a list of elements");
} }
TEST(ModuleSpec, SpecfileCommands) TEST(ModuleSpec, SpecfileCommands) {
{
module_spec_error("spec17.spec", 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\" }"); "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", module_spec_error("spec18.spec",
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
int int
main(int argc, char* argv[]) main(int argc, char* argv[]) {
{
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS()); return (RUN_ALL_TESTS());
} }
...@@ -110,14 +110,12 @@ StaticDataSrcImpl::StaticDataSrcImpl() : ...@@ -110,14 +110,12 @@ StaticDataSrcImpl::StaticDataSrcImpl() :
"0 28800 7200 604800 86400")); "0 28800 7200 604800 86400"));
} }
StaticDataSrc::StaticDataSrc() StaticDataSrc::StaticDataSrc() {
{
setClass(RRClass::CH()); setClass(RRClass::CH());
impl_ = new StaticDataSrcImpl; impl_ = new StaticDataSrcImpl;
} }
StaticDataSrc::~StaticDataSrc() StaticDataSrc::~StaticDataSrc() {
{
delete impl_; delete impl_;
} }
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
#include <dns/tests/unittest_util.h> #include <dns/tests/unittest_util.h>
int int
main(int argc, char* argv[]) main(int argc, char* argv[]) {
{
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
isc::UnitTestUtil::addDataPath(TEST_DATA_DIR); isc::UnitTestUtil::addDataPath(TEST_DATA_DIR);
......
...@@ -219,8 +219,7 @@ def generate_typeclasscode(fileprefix, basemtime, code2txt, type_or_class): ...@@ -219,8 +219,7 @@ def generate_typeclasscode(fileprefix, basemtime, code2txt, type_or_class):
codetxt = code2txt[code].upper() codetxt = code2txt[code].upper()
declarationtxt += ' ' * 4 + 'static const RR' + cap_key + '& ' + codetxt + '();\n' declarationtxt += ' ' * 4 + 'static const RR' + cap_key + '& ' + codetxt + '();\n'
deftxt += '''inline const RR''' + cap_key + '''& deftxt += '''inline const RR''' + cap_key + '''&
RR''' + cap_key + '''::''' + codetxt + '''() RR''' + cap_key + '''::''' + codetxt + '''() {
{
static RR''' + cap_key + ''' ''' + lower_key + '''(''' + code + '''); static RR''' + cap_key + ''' ''' + lower_key + '''(''' + code + ''');
return (''' + lower_key + '''); return (''' + lower_key + ''');
}\n }\n
......
...@@ -715,8 +715,7 @@ Message::clear(Mode mode) { ...@@ -715,8 +715,7 @@ Message::clear(Mode mode) {
} }
void void
Message::makeResponse() Message::makeResponse() {
{
if (impl_->mode_ != Message::PARSE) { if (impl_->mode_ != Message::PARSE) {
isc_throw(InvalidMessageOperation, isc_throw(InvalidMessageOperation,
"makeResponse() is performed in non-parse mode"); "makeResponse() is performed in non-parse mode");
......
...@@ -114,50 +114,43 @@ private: ...@@ -114,50 +114,43 @@ private:
}; };
inline const MessageFlag& inline const MessageFlag&
MessageFlag::QR() MessageFlag::QR() {
{
static MessageFlag f(0x8000); static MessageFlag f(0x8000);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::AA() MessageFlag::AA() {
{
static MessageFlag f(0x0400); static MessageFlag f(0x0400);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::TC() MessageFlag::TC() {
{
static MessageFlag f(0x0200); static MessageFlag f(0x0200);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::RD() MessageFlag::RD() {
{
static MessageFlag f(0x0100); static MessageFlag f(0x0100);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::RA() MessageFlag::RA() {
{
static MessageFlag f(0x0080); static MessageFlag f(0x0080);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::AD() MessageFlag::AD() {
{
static MessageFlag f(0x0020); static MessageFlag f(0x0020);
return (f); return (f);
} }
inline const MessageFlag& inline const MessageFlag&
MessageFlag::CD() MessageFlag::CD() {
{
static MessageFlag f(0x0010); static MessageFlag f(0x0010);
return (f); return (f);
} }
...@@ -199,29 +192,25 @@ private: ...@@ -199,29 +192,25 @@ private:
}; };
inline const Section& inline const Section&
Section::QUESTION() Section::QUESTION() {
{
static Section s(SECTION_QUESTION); static Section s(SECTION_QUESTION);
return (s); return (s);
} }
inline const Section& inline const Section&
Section::ANSWER() Section::ANSWER() {
{
static Section s(SECTION_ANSWER); static Section s(SECTION_ANSWER);
return (s); return (s);
} }
inline const Section& inline const Section&
Section::AUTHORITY() Section::AUTHORITY() {
{
static Section s(SECTION_AUTHORITY); static Section s(SECTION_AUTHORITY);
return (s); return (s);
} }
inline const Section& inline const Section&
Section::ADDITIONAL() Section::ADDITIONAL() {
{
static Section s(SECTION_ADDITIONAL); static Section s(SECTION_ADDITIONAL);
return (s); return (s);
} }
......
...@@ -42,15 +42,13 @@ Question::Question(InputBuffer& buffer) : ...@@ -42,15 +42,13 @@ Question::Question(InputBuffer& buffer) :
} }
string string
Question::toText() const Question::toText() const {
{
return (name_.toText() + " " + rrclass_.toText() + " " + return (name_.toText() + " " + rrclass_.toText() + " " +
rrtype_.toText() + "\n"); rrtype_.toText() + "\n");
} }
unsigned int unsigned int
Question::toWire(OutputBuffer& buffer) const Question::toWire(OutputBuffer& buffer) const {
{
name_.toWire(buffer); name_.toWire(buffer);
rrtype_.toWire(buffer); rrtype_.toWire(buffer);
rrclass_.toWire(buffer); // number of "entries", which is always 1 rrclass_.toWire(buffer); // number of "entries", which is always 1
...@@ -59,8 +57,7 @@ Question::toWire(OutputBuffer& buffer) const ...@@ -59,8 +57,7 @@ Question::toWire(OutputBuffer& buffer) const
} }
unsigned int unsigned int
Question::toWire(MessageRenderer& renderer) const Question::toWire(MessageRenderer& renderer) const {
{
renderer.writeName(name_); renderer.writeName(name_);
rrtype_.toWire(renderer); rrtype_.toWire(renderer);
rrclass_.toWire(renderer); rrclass_.toWire(renderer);
...@@ -69,8 +66,7 @@ Question::toWire(MessageRenderer& renderer) const ...@@ -69,8 +66,7 @@ Question::toWire(MessageRenderer& renderer) const
} }
ostream& ostream&
operator<<(std::ostream& os, const Question& question) operator<<(std::ostream& os, const Question& question) {
{
os << question.toText(); os << question.toText();
return (os); return (os);
} }
......
...@@ -82,8 +82,7 @@ createRdata(const RRType& rrtype, const RRClass& rrclass, const Rdata& source) ...@@ -82,8 +82,7 @@ createRdata(const RRType& rrtype, const RRClass& rrclass, const Rdata& source)
} }
int int
compareNames(const Name& n1, const Name& n2) compareNames(const Name& n1, const Name& n2) {
{
size_t len1 = n1.getLength(); size_t len1 = n1.getLength();
size_t len2 = n2.getLength(); size_t len2 = n2.getLength();
size_t cmplen = min(len1, len2); size_t cmplen = min(len1, len2);
...@@ -107,8 +106,7 @@ struct GenericImpl { ...@@ -107,8 +106,7 @@ struct GenericImpl {
vector<uint8_t> data_; 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) { if (rdata_len > MAX_RDLENGTH) {
isc_throw(InvalidRdataLength, "RDLENGTH too large"); isc_throw(InvalidRdataLength, "RDLENGTH too large");
} }
...@@ -119,8 +117,7 @@ Generic::Generic(InputBuffer& buffer, size_t rdata_len) ...@@ -119,8 +117,7 @@ Generic::Generic(InputBuffer& buffer, size_t rdata_len)
impl_ = new GenericImpl(data); impl_ = new GenericImpl(data);
} }
Generic::Generic(const string& rdata_string) Generic::Generic(const string& rdata_string) {
{
istringstream iss(rdata_string); istringstream iss(rdata_string);
string unknown_mark; string unknown_mark;
iss >> unknown_mark; iss >> unknown_mark;
...@@ -181,8 +178,7 @@ Generic::Generic(const string& rdata_string) ...@@ -181,8 +178,7 @@ Generic::Generic(const string& rdata_string)
impl_ = new GenericImpl(data); impl_ = new GenericImpl(data);
} }
Generic::~Generic() Generic::~Generic() {
{
delete impl_; delete impl_;
} }
...@@ -191,8 +187,7 @@ Generic::Generic(const Generic& source) : ...@@ -191,8 +187,7 @@ Generic::Generic(const Generic& source) :
{} {}
Generic& Generic&
Generic::operator=(const Generic& source) Generic::operator=(const Generic& source) {
{
if (impl_ == source.impl_) { if (impl_ == source.impl_) {
return (*this); return (*this);
} }
...@@ -218,8 +213,7 @@ private: ...@@ -218,8 +213,7 @@ private:
} }
string string
Generic::toText() const Generic::toText() const {
{
ostringstream oss; ostringstream oss;
oss << "\\# " << impl_->data_.size() << " "; oss << "\\# " << impl_->data_.size() << " ";
...@@ -231,21 +225,18 @@ Generic::toText() const ...@@ -231,21 +225,18 @@ Generic::toText() const
} }
void void
Generic::toWire(OutputBuffer& buffer) const Generic::toWire(OutputBuffer& buffer) const {
{
buffer.writeData(&impl_->data_[0], impl_->data_.size()); buffer.writeData(&impl_->data_[0], impl_->data_.size());
} }
void void
Generic::toWire(MessageRenderer& renderer) const Generic::toWire(MessageRenderer& renderer) const {
{
renderer.writeData(&impl_->data_[0], impl_->data_.size()); renderer.writeData(&impl_->data_[0], impl_->data_.size());
} }
namespace { namespace {
inline int 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 this_len = lhs.data_.size();
size_t other_len = rhs.data_.size(); size_t other_len = rhs.data_.size();
size_t len = (this_len < other_len) ? this_len : other_len; size_t len = (this_len < other_len) ? this_len : other_len;
...@@ -262,16 +253,14 @@ compare_internal(const GenericImpl& lhs, const GenericImpl& rhs) ...@@ -262,16 +253,14 @@ compare_internal(const GenericImpl& lhs, const GenericImpl& rhs)
} }
int int
Generic::compare(const Rdata& other) const Generic::compare(const Rdata& other) const {
{
const Generic& other_rdata = dynamic_cast<const Generic&>(other); const Generic& other_rdata = dynamic_cast<const Generic&>(other);
return (compare_internal(*impl_, *other_rdata.impl_)); return (compare_internal(*impl_, *other_rdata.impl_));
} }
std::ostream& std::ostream&
operator<<(std::ostream& os, const Generic& rdata) operator<<(std::ostream& os, const Generic& rdata) {
{
return (os << rdata.toText());