diff options
author | JINMEI Tatuya <jinmei@isc.org> | 2010-08-17 00:08:14 +0200 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2010-08-17 00:08:14 +0200 |
commit | 81eb4c244c143e73c10e9a5c382bbcbc6175d458 (patch) | |
tree | 53de0306a9919b3ec9a735e9aeb8da8835f12f6f /src/lib | |
parent | added missing errno and fixed an exception variable that was referenced by th... (diff) | |
download | kea-81eb4c244c143e73c10e9a5c382bbcbc6175d458.tar.xz kea-81eb4c244c143e73c10e9a5c382bbcbc6175d458.zip |
style fixes:
- added surrandong parentheses for return values based on agreed guideline
- removed redundant semicolons after a block
- fixed curly brace position
diff is large, but the change is very trivial. so I'm skipping explicit review.
git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@2745 e5f2f494-b856-4b98-b285-d166d9295462
Diffstat (limited to 'src/lib')
41 files changed, 275 insertions, 296 deletions
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index 4112ae906b..d6d0aa73a7 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -35,24 +35,21 @@ namespace isc { namespace data { std::string -Element::str() -{ +Element::str() { std::stringstream ss; toJSON(ss); - return ss.str(); + return (ss.str()); } std::string -Element::toWire() -{ +Element::toWire() { std::stringstream ss; toJSON(ss); - return ss.str(); + return (ss.str()); } void -Element::toWire(std::ostream& ss) -{ +Element::toWire(std::ostream& ss) { toJSON(ss); } @@ -65,63 +62,62 @@ Element::toWire(std::ostream& ss) // bool Element::getValue(long int& t UNUSED_PARAM) { - return false; + return (false); } bool Element::getValue(double& t UNUSED_PARAM) { - return false; + return (false); } bool Element::getValue(bool& t UNUSED_PARAM) { - return false; + return (false); } bool Element::getValue(std::string& t UNUSED_PARAM) { - return false; + return (false); } bool Element::getValue(std::vector<ElementPtr>& t UNUSED_PARAM) { - return false; + return (false); } bool Element::getValue(std::map<std::string, ElementPtr>& t UNUSED_PARAM) { - return false; + return (false); } bool Element::setValue(const long int v UNUSED_PARAM) { - return false; + return (false); } bool Element::setValue(const double v UNUSED_PARAM) { - return false; + return (false); } bool Element::setValue(const bool t UNUSED_PARAM) { - return false; + return (false); } bool Element::setValue(const std::string& v UNUSED_PARAM) { - return false; + return (false); } bool Element::setValue(const std::vector<ElementPtr>& v UNUSED_PARAM) { - return false; + return (false); } bool -Element::setValue(const std::map<std::string, ElementPtr>& v UNUSED_PARAM) -{ - return false; +Element::setValue(const std::map<std::string, ElementPtr>& v UNUSED_PARAM) { + return (false); } ElementPtr @@ -180,7 +176,7 @@ bool Element::find(const std::string& identifier UNUSED_PARAM, ElementPtr& t UNUSED_PARAM) { - return false; + return (false); } namespace { @@ -194,11 +190,11 @@ throwJSONError(const std::string& error, const std::string& file, int line, int } std::ostream& operator <<(std::ostream &out, const isc::data::ElementPtr& e) { - return out << e->str(); + return (out << e->str()); } bool operator==(const isc::data::ElementPtr a, const isc::data::ElementPtr b) { - return a->equals(b); + return (a->equals(b)); }; // @@ -206,37 +202,37 @@ bool operator==(const isc::data::ElementPtr a, const isc::data::ElementPtr b) { // ElementPtr Element::create() { - return ElementPtr(new NullElement()); + return (ElementPtr(new NullElement())); } ElementPtr Element::create(const long int i) { - return ElementPtr(new IntElement(i)); + return (ElementPtr(new IntElement(i))); } ElementPtr Element::create(const double d) { - return ElementPtr(new DoubleElement(d)); + return (ElementPtr(new DoubleElement(d))); } ElementPtr Element::create(const std::string& s) { - return ElementPtr(new StringElement(s)); + return (ElementPtr(new StringElement(s))); } ElementPtr Element::create(const bool b) { - return ElementPtr(new BoolElement(b)); + return (ElementPtr(new BoolElement(b))); } ElementPtr Element::createList() { - return ElementPtr(new ListElement()); + return (ElementPtr(new ListElement())); } ElementPtr Element::createMap() { - return ElementPtr(new MapElement()); + return (ElementPtr(new MapElement())); } @@ -248,10 +244,10 @@ bool char_in(const char c, const char *chars) { for (size_t i = 0; i < strlen(chars); ++i) { if (chars[i] == c) { - return true; + return (true); } } - return false; + return (false); } void @@ -332,7 +328,7 @@ str_from_stringstream(std::istream &in, const std::string& file, const int line, c = in.get(); ++pos; } - return ss.str(); + return (ss.str()); } std::string @@ -342,7 +338,7 @@ word_from_stringstream(std::istream &in, int& pos) { ss << (char) in.get(); } pos += ss.str().size(); - return ss.str(); + return (ss.str()); } static std::string @@ -353,7 +349,7 @@ number_from_stringstream(std::istream &in, int& pos) { ss << (char) in.get(); } pos += ss.str().size(); - return ss.str(); + return (ss.str()); } // Should we change from IntElement and DoubleElement to NumberElement @@ -386,9 +382,9 @@ from_stringstream_number(std::istream &in, int &pos) { } if (is_double) { - return Element::create(d); + return (Element::create(d)); } else { - return Element::create(i); + return (Element::create(i)); } } @@ -398,13 +394,13 @@ from_stringstream_bool(std::istream &in, const std::string& file, { const std::string word = word_from_stringstream(in, pos); if (boost::iequals(word, "True")) { - return Element::create(true); + return (Element::create(true)); } else if (boost::iequals(word, "False")) { - return Element::create(false); + return (Element::create(false)); } else { throwJSONError(std::string("Bad boolean value: ") + word, file, line, pos); // above is a throw shortcurt, return empty is never reached - return ElementPtr(); + return (ElementPtr()); } } @@ -414,17 +410,17 @@ from_stringstream_null(std::istream &in, const std::string& file, { const std::string word = word_from_stringstream(in, pos); if (boost::iequals(word, "null")) { - return Element::create(); + return (Element::create()); } else { throwJSONError(std::string("Bad null value: ") + word, file, line, pos); - return ElementPtr(); + return (ElementPtr()); } } ElementPtr 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 @@ -444,7 +440,7 @@ from_stringstream_list(std::istream &in, const std::string& file, int& line, int c = in.get(); pos++; } - return list; + return (list); } ElementPtr @@ -474,53 +470,53 @@ from_stringstream_map(std::istream &in, const std::string& file, int& line, pos++; } } - return map; + return (map); } } std::string Element::typeToName(Element::types type) { - switch(type) { + switch (type) { case Element::integer: - return std::string("integer"); + return (std::string("integer")); case Element::real: - return std::string("real"); + return (std::string("real")); case Element::boolean: - return std::string("boolean"); + return (std::string("boolean")); case Element::string: - return std::string("string"); + return (std::string("string")); case Element::list: - return std::string("list"); + return (std::string("list")); case Element::map: - return std::string("map"); + return (std::string("map")); case Element::null: - return std::string("null"); + return (std::string("null")); case Element::any: - return std::string("any"); + return (std::string("any")); default: - return std::string("unknown"); + return (std::string("unknown")); } } Element::types Element::nameToType(const std::string& type_name) { if (type_name == "integer") { - return Element::integer; + return (Element::integer); } else if (type_name == "real") { - return Element::real; + return (Element::real); } else if (type_name == "boolean") { - return Element::boolean; + return (Element::boolean); } else if (type_name == "string") { - return Element::string; + return (Element::string); } else if (type_name == "list") { - return Element::list; + return (Element::list); } else if (type_name == "map") { - return Element::map; + return (Element::map); } else if (type_name == "null") { - return Element::null; + return (Element::null); } else if (type_name == "any") { - return Element::any; + return (Element::any); } else { isc_throw(TypeError, type_name + " is not a valid type name"); } @@ -529,14 +525,14 @@ Element::nameToType(const std::string& type_name) { ElementPtr Element::fromJSON(std::istream& in) throw(JSONError) { int line = 1, pos = 1; - return fromJSON(in, "<istream>", line, pos); + return (fromJSON(in, "<istream>", line, pos)); } ElementPtr Element::fromJSON(std::istream& in, const std::string& file_name) throw(JSONError) { int line = 1, pos = 1; - return fromJSON(in, file_name, line, pos); + return (fromJSON(in, file_name, line, pos)); } ElementPtr @@ -602,7 +598,7 @@ Element::fromJSON(std::istream &in, const std::string& file, int& line, int& pos } } if (el_read) { - return element; + return (element); } else { isc_throw(JSONError, "nothing read"); } @@ -612,7 +608,7 @@ ElementPtr Element::fromJSON(const std::string &in) { std::stringstream ss; ss << in; - return fromJSON(ss, "<string>"); + return (fromJSON(ss, "<string>")); } // to JSON format @@ -698,18 +694,18 @@ ElementPtr MapElement::find(const std::string& id) { const size_t sep = id.find('/'); if (sep == std::string::npos) { - return get(id); + return (get(id)); } else { ElementPtr ce = get(id.substr(0, sep)); if (ce) { // ignore trailing slash if (sep + 1 != id.size()) { - return ce->find(id.substr(sep + 1)); + return (ce->find(id.substr(sep + 1))); } else { - return ce; + return (ce); } } else { - return ElementPtr(); + return (ElementPtr()); } } } @@ -719,7 +715,7 @@ Element::fromWire(const std::string& s) { std::stringstream ss; ss << s; int line = 0, pos = 0; - return fromJSON(ss, "<wire>", line, pos); + return (fromJSON(ss, "<wire>", line, pos)); } ElementPtr @@ -735,7 +731,7 @@ Element::fromWire(std::stringstream& in, int length) { //} //length -= 4; int line = 0, pos = 0; - return fromJSON(in, "<wire>", line, pos); + return (fromJSON(in, "<wire>", line, pos)); } void @@ -749,12 +745,12 @@ MapElement::find(const std::string& id, ElementPtr& t) { ElementPtr p = find(id); if (p) { t = p; - return true; + return (true); } } catch (const TypeError& e) { // ignore } - return false; + return (false); } bool @@ -777,7 +773,7 @@ BoolElement::equals(ElementPtr other) { bool NullElement::equals(ElementPtr other) { - return other->getType() == Element::null; + return (other->getType() == Element::null); } bool @@ -791,16 +787,16 @@ ListElement::equals(ElementPtr other) { if (other->getType() == Element::list) { const int s = size(); if (s != other->size()) { - return false; + return (false); } for (int i = 0; i < s; ++i) { if (!get(i)->equals(other->get(i))) { - return false; + return (false); } } - return true; + return (true); } else { - return false; + return (false); } } @@ -812,10 +808,10 @@ MapElement::equals(ElementPtr other) { it != m.end() ; ++it) { if (other->contains((*it).first)) { if (!get((*it).first)->equals(other->get((*it).first))) { - return false; + return (false); } } else { - return false; + return (false); } } // quickly walk through the other map too, to see if there's @@ -827,18 +823,18 @@ MapElement::equals(ElementPtr other) { for (std::map<std::string, ElementPtr>::const_iterator it = m.begin(); it != m.end() ; ++it) { if (!contains((*it).first)) { - return false; + return (false); } } - return true; + return (true); } else { - return false; + return (false); } } bool isNull(ElementPtr p) { - return !p; + return (!p); } void diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h index 07fc138447..d9e049b7fe 100644 --- a/src/lib/cc/data.h +++ b/src/lib/cc/data.h @@ -90,7 +90,7 @@ public: virtual ~Element() {}; /// \return the type of this element - int getType() { return type; }; + int getType() { return (type); } /// Returns a string representing the Element and all its /// child elements; note that this is different from stringValue(), @@ -265,13 +265,13 @@ public: //@{ static ElementPtr create(); static ElementPtr create(const long int i); - static ElementPtr create(const int i) { return create(static_cast<long int>(i)); }; + static ElementPtr create(const int i) { return (create(static_cast<long int>(i))); }; static ElementPtr create(const double d); static ElementPtr create(const bool b); static ElementPtr create(const std::string& s); // need both std:string and char *, since c++ will match // bool before std::string when you pass it a char * - static ElementPtr create(const char *s) { return create(std::string(s)); }; + static ElementPtr create(const char *s) { return (create(std::string(s))); } /// \brief Creates an empty ListElement type ElementPtr. static ElementPtr createList(); @@ -364,12 +364,12 @@ class IntElement : public Element { long int i; public: - IntElement(long int v) : Element(integer), i(v) { }; - long int intValue() { return i; } + IntElement(long int v) : Element(integer), i(v) { } + long int intValue() { return (i); } using Element::getValue; - bool getValue(long int& t) { t = i; return true; }; + bool getValue(long int& t) { t = i; return (true); } using Element::setValue; - bool setValue(const long int v) { i = v; return true; }; + bool setValue(const long int v) { i = v; return (true); } void toJSON(std::ostream& ss); bool equals(ElementPtr other); }; @@ -379,11 +379,11 @@ class DoubleElement : public Element { public: DoubleElement(double v) : Element(real), d(v) {}; - double doubleValue() { return d; } + double doubleValue() { return (d); } using Element::getValue; - bool getValue(double& t) { t = d; return true; }; + bool getValue(double& t) { t = d; return (true); } using Element::setValue; - bool setValue(const double v) { d = v; return true; }; + bool setValue(const double v) { d = v; return (true); } void toJSON(std::ostream& ss); bool equals(ElementPtr other); }; @@ -393,11 +393,11 @@ class BoolElement : public Element { public: BoolElement(const bool v) : Element(boolean), b(v) {}; - bool boolValue() { return b; } + bool boolValue() { return (b); } using Element::getValue; - bool getValue(bool& t) { t = b; return true; }; + bool getValue(bool& t) { t = b; return (true); } using Element::setValue; - bool setValue(const bool v) { b = v; return true; }; + bool setValue(const bool v) { b = v; return (true); } void toJSON(std::ostream& ss); bool equals(ElementPtr other); }; @@ -414,11 +414,11 @@ class StringElement : public Element { public: StringElement(std::string v) : Element(string), s(v) {}; - std::string stringValue() { return s; }; + std::string stringValue() { return (s); } using Element::getValue; - bool getValue(std::string& t) { t = s; return true; }; + bool getValue(std::string& t) { t = s; return (true); } using Element::setValue; - bool setValue(const std::string& v) { s = v; return true; }; + bool setValue(const std::string& v) { s = v; return (true); } void toJSON(std::ostream& ss); bool equals(ElementPtr other); }; @@ -428,20 +428,20 @@ class ListElement : public Element { public: ListElement() : Element(list), l(std::vector<ElementPtr>()) {}; - const std::vector<ElementPtr>& listValue() { return l; } + const std::vector<ElementPtr>& listValue() { return (l); } using Element::getValue; - bool getValue(std::vector<ElementPtr>& t) { t = l; return true; }; + bool getValue(std::vector<ElementPtr>& t) { t = l; return (true); } using Element::setValue; - bool setValue(const std::vector<ElementPtr>& v) { l = v; return true; }; + bool setValue(const std::vector<ElementPtr>& v) { l = v; return (true); } using Element::get; - ElementPtr get(int i) { return l.at(i); }; + ElementPtr get(int i) { return (l.at(i)); } using Element::set; void set(size_t i, ElementPtr e) { if (i <= l.size()) {l[i] = e;} else { throw std::out_of_range("vector::_M_range_check"); } }; void add(ElementPtr e) { l.push_back(e); }; using Element::remove; void remove(int i) { l.erase(l.begin() + i); }; void toJSON(std::ostream& ss); - size_t size() { return l.size(); } + size_t size() { return (l.size()); } bool equals(ElementPtr other); }; @@ -451,18 +451,18 @@ class MapElement : public Element { public: MapElement() : Element(map), m(std::map<std::string, ElementPtr>()) {}; // TODO: should we have direct iterators instead of exposing the std::map here? - const std::map<std::string, ElementPtr>& mapValue() { return m; } + const std::map<std::string, ElementPtr>& mapValue() { return (m); } using Element::getValue; - bool getValue(std::map<std::string, ElementPtr>& t) { t = m; return true; }; + bool getValue(std::map<std::string, ElementPtr>& t) { t = m; return (true); } using Element::setValue; - bool setValue(std::map<std::string, ElementPtr>& v) { m = v; return true; }; + bool setValue(std::map<std::string, ElementPtr>& v) { m = v; return (true); } using Element::get; - ElementPtr get(const std::string& s) { if (contains(s)) { return m[s]; } else { return ElementPtr();} }; + ElementPtr get(const std::string& s) { if (contains(s)) { return (m[s]); } else { return (ElementPtr());} } using Element::set; void set(const std::string& key, ElementPtr value); using Element::remove; void remove(const std::string& s) { m.erase(s); } - bool contains(const std::string& s) { return m.find(s) != m.end(); } + bool contains(const std::string& s) { return (m.find(s) != m.end()); } void toJSON(std::ostream& ss); // we should name the two finds better... diff --git a/src/lib/cc/session.cc b/src/lib/cc/session.cc index 0b8476417d..9b950932f0 100644 --- a/src/lib/cc/session.cc +++ b/src/lib/cc/session.cc @@ -268,7 +268,7 @@ Session::sendmsg(ElementPtr& env, ElementPtr& msg) { bool Session::recvmsg(ElementPtr& msg, bool nonblock, int seq) { ElementPtr l_env; - return recvmsg(l_env, msg, nonblock, seq); + return (recvmsg(l_env, msg, nonblock, seq)); } bool @@ -290,7 +290,7 @@ Session::recvmsg(ElementPtr& env, ElementPtr& msg, env = q_el->get(0); msg = q_el->get(1); impl_->queue_->remove(i); - return true; + return (true); } } } @@ -328,13 +328,13 @@ Session::recvmsg(ElementPtr& env, ElementPtr& msg, ) { env = l_env; msg = l_msg; - return true; + return (true); } else { ElementPtr q_el = Element::createList(); q_el->add(l_env); q_el->add(l_msg); impl_->queue_->add(q_el); - return recvmsg(env, msg, nonblock, seq); + return (recvmsg(env, msg, nonblock, seq)); } // XXXMLG handle non-block here, and return false for short reads } @@ -377,7 +377,7 @@ Session::group_sendmsg(ElementPtr msg, std::string group, //env->set("msg", Element::create(msg->toWire())); sendmsg(env, msg); - return nseq; + return (nseq); } bool @@ -402,12 +402,11 @@ Session::reply(ElementPtr& envelope, ElementPtr& newmsg) { sendmsg(env, newmsg); - return nseq; + return (nseq); } bool -Session::hasQueuedMsgs() -{ +Session::hasQueuedMsgs() { return (impl_->queue_->size() > 0); } diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc index bb3e4943a2..9fe618926f 100644 --- a/src/lib/cc/tests/data_unittests.cc +++ b/src/lib/cc/tests/data_unittests.cc @@ -400,7 +400,7 @@ TEST(Element, to_and_from_wire) { static ElementPtr efs(const std::string& str) { - return Element::fromJSON(str); + return (Element::fromJSON(str)); } TEST(Element, equals) { diff --git a/src/lib/config/ccsession.cc b/src/lib/config/ccsession.cc index 49e16290e1..73a1c36614 100644 --- a/src/lib/config/ccsession.cc +++ b/src/lib/config/ccsession.cc @@ -53,17 +53,15 @@ namespace config { /// Creates a standard config/command protocol answer message ElementPtr -createAnswer() -{ +createAnswer() { ElementPtr answer = Element::fromJSON("{\"result\": [] }"); ElementPtr answer_content = answer->get("result"); answer_content->add(Element::create(0)); - return answer; + return (answer); } ElementPtr -createAnswer(const int rcode, const ElementPtr arg) -{ +createAnswer(const int rcode, const ElementPtr arg) { if (rcode != 0 && (!arg || arg->getType() != Element::string)) { isc_throw(CCSessionError, "Bad or no argument for rcode != 0"); } @@ -71,22 +69,20 @@ createAnswer(const int rcode, const ElementPtr arg) ElementPtr answer_content = answer->get("result"); answer_content->add(Element::create(rcode)); answer_content->add(arg); - return answer; + return (answer); } ElementPtr -createAnswer(const int rcode, const std::string& arg) -{ +createAnswer(const int rcode, const std::string& arg) { ElementPtr answer = Element::fromJSON("{\"result\": [] }"); ElementPtr answer_content = answer->get("result"); answer_content->add(Element::create(rcode)); answer_content->add(Element::create(arg)); - return answer; + return (answer); } ElementPtr -parseAnswer(int &rcode, const ElementPtr msg) -{ +parseAnswer(int &rcode, const ElementPtr msg) { if (msg && msg->getType() == Element::map && msg->contains("result")) { @@ -99,13 +95,13 @@ parseAnswer(int &rcode, const ElementPtr msg) rcode = result->get(0)->intValue(); if (result->size() > 1) { if (rcode == 0 || result->get(1)->getType() == Element::string) { - return result->get(1); + return (result->get(1)); } else { isc_throw(CCSessionError, "Error description in result with rcode != 0 is not a string"); } } else { if (rcode == 0) { - return ElementPtr(); + return (ElementPtr()); } else { isc_throw(CCSessionError, "Result with rcode != 0 does not have an error description"); } @@ -116,14 +112,12 @@ parseAnswer(int &rcode, const ElementPtr msg) } ElementPtr -createCommand(const std::string& command) -{ - return createCommand(command, ElementPtr()); +createCommand(const std::string& command) { + return (createCommand(command, ElementPtr())); } ElementPtr -createCommand(const std::string& command, ElementPtr arg) -{ +createCommand(const std::string& command, ElementPtr arg) { ElementPtr cmd = Element::createMap(); ElementPtr cmd_parts = Element::createList(); cmd_parts->add(Element::create(command)); @@ -131,7 +125,7 @@ createCommand(const std::string& command, ElementPtr arg) cmd_parts->add(arg); } cmd->set("command", cmd_parts); - return cmd; + return (cmd); } /// Returns "" and empty ElementPtr() if this does not @@ -151,7 +145,7 @@ parseCommand(ElementPtr& arg, const ElementPtr command) } else { arg = ElementPtr(); } - return cmd->get(0)->stringValue(); + return (cmd->get(0)->stringValue()); } else { isc_throw(CCSessionError, "Command part in command message missing, empty, or not a list"); } @@ -182,7 +176,7 @@ ModuleCCSession::readModuleSpecification(const std::string& filename) { exit(1); } file.close(); - return module_spec; + return (module_spec); } void @@ -275,7 +269,7 @@ ModuleCCSession::handleConfigUpdate(ElementPtr new_config) setLocalConfig(local_config); } } - return answer; + return (answer); } bool @@ -293,7 +287,7 @@ ModuleCCSession::checkCommand() /* ignore result messages (in case we're out of sync, to prevent * pingpongs */ if (data->getType() != Element::map || data->contains("result")) { - return 0; + return (0); } ElementPtr arg; ElementPtr answer; @@ -308,7 +302,7 @@ ModuleCCSession::checkCommand() // in our remote config list, update that updateRemoteConfig(target_module, arg); // we're not supposed to answer to this, so return - return 0; + return (0); } } else { if (target_module == module_name_) { @@ -329,7 +323,7 @@ ModuleCCSession::checkCommand() } } - return 0; + return (0); } std::string @@ -356,7 +350,7 @@ ModuleCCSession::addRemoteConfig(const std::string& spec_file_name) // all ok, add it remote_module_configs_[module_name] = rmod_config; - return module_name; + return (module_name); } void @@ -378,7 +372,7 @@ ModuleCCSession::getRemoteConfigValue(const std::string& module_name, const std: it = remote_module_configs_.find(module_name); if (it != remote_module_configs_.end()) { - return remote_module_configs_[module_name].getValue(identifier); + return (remote_module_configs_[module_name].getValue(identifier)); } else { isc_throw(CCSessionError, "Remote module " + module_name + " not found."); } diff --git a/src/lib/config/config_data.cc b/src/lib/config/config_data.cc index 6a01d089c7..9eac3e5b25 100644 --- a/src/lib/config/config_data.cc +++ b/src/lib/config/config_data.cc @@ -104,7 +104,7 @@ find_spec_part(ElementPtr spec, const std::string& identifier) } } //std::cout << "[XX] found spec part: " << std::endl << spec_part << std::endl; - return spec_part; + return (spec_part); } // @@ -142,17 +142,15 @@ spec_name_list(ElementPtr result, ElementPtr spec_part, std::string prefix, bool } ElementPtr -ConfigData::getValue(const std::string& identifier) -{ +ConfigData::getValue(const std::string& identifier) { // 'fake' is set, but dropped by this function and // serves no further purpose. bool fake; - return getValue(fake, identifier); + return (getValue(fake, identifier)); } ElementPtr -ConfigData::getValue(bool& is_default, const std::string& identifier) -{ +ConfigData::getValue(bool& is_default, const std::string& identifier) { ElementPtr value = _config->find(identifier); if (value) { is_default = false; @@ -166,7 +164,7 @@ ConfigData::getValue(bool& is_default, const std::string& identifier) value = ElementPtr(); } } - return value; + return (value); } /// Returns an ElementPtr pointing to a ListElement containing @@ -181,7 +179,7 @@ ConfigData::getItemList(const std::string& identifier, bool recurse) spec_part = find_spec_part(spec_part, identifier); } spec_name_list(result, spec_part, identifier, recurse); - return result; + return (result); } /// Returns an ElementPtr containing a MapElement with identifier->value @@ -194,7 +192,7 @@ ConfigData::getFullConfig() BOOST_FOREACH(ElementPtr item, items->listValue()) { result->set(item->stringValue(), getValue(item->stringValue())); } - return result; + return (result); } } diff --git a/src/lib/config/config_data.h b/src/lib/config/config_data.h index a38c209d69..d1674e53e8 100644 --- a/src/lib/config/config_data.h +++ b/src/lib/config/config_data.h @@ -70,7 +70,7 @@ public: ElementPtr getValue(bool &is_default, const std::string& identifier); /// Returns the ModuleSpec associated with this ConfigData object - const ModuleSpec getModuleSpec() { return _module_spec; }; + const ModuleSpec getModuleSpec() { return (_module_spec); } /// Set the ModuleSpec associated with this ConfigData object void setModuleSpec(ModuleSpec module_spec) { _module_spec = module_spec; }; @@ -84,7 +84,7 @@ public: /// Returns the local (i.e. non-default) configuration. /// \returns An ElementPtr pointing to a MapElement containing all /// non-default configuration options. - ElementPtr getLocalConfig() { return _config; } + ElementPtr getLocalConfig() { return (_config); } /// Returns a list of all possible configuration options as specified /// by the ModuleSpec. diff --git a/src/lib/config/module_spec.cc b/src/lib/config/module_spec.cc index 19cad4bd52..ec9aa379ab 100644 --- a/src/lib/config/module_spec.cc +++ b/src/lib/config/module_spec.cc @@ -141,53 +141,49 @@ ModuleSpec::ModuleSpec(ElementPtr module_spec_element, } const ElementPtr -ModuleSpec::getCommandsSpec() const -{ +ModuleSpec::getCommandsSpec() const { if (module_specification->contains("commands")) { - return module_specification->get("commands"); + return (module_specification->get("commands")); } else { - return ElementPtr(); + return (ElementPtr()); } } const ElementPtr -ModuleSpec::getConfigSpec() const -{ +ModuleSpec::getConfigSpec() const { if (module_specification->contains("config_data")) { - return module_specification->get("config_data"); + return (module_specification->get("config_data")); } else { - return ElementPtr(); + return (ElementPtr()); } } const std::string -ModuleSpec::getModuleName() const -{ - return module_specification->get("module_name")->stringValue(); +ModuleSpec::getModuleName() const { + return (module_specification->get("module_name")->stringValue()); } const std::string -ModuleSpec::getModuleDescription() const -{ +ModuleSpec::getModuleDescription() const { if (module_specification->contains("module_description")) { - return module_specification->get("module_description")->stringValue(); + return (module_specification->get("module_description")->stringValue()); } else { - return std::string(""); + return (std::string("")); } } bool -ModuleSpec::validate_config(const ElementPtr data, const bool full) -{ +ModuleSpec::validate_config(const ElementPtr data, const bool full) { ElementPtr spec = module_specification->find("config_data"); - return validate_spec_list(spec, data, full, ElementPtr()); + return (validate_spec_list(spec, data, full, ElementPtr())); } bool -ModuleSpec::validate_config(const ElementPtr data, const bool full, ElementPtr errors) +ModuleSpec::validate_config(const ElementPtr data, const bool full, + ElementPtr errors) { ElementPtr spec = module_specification->find("config_data"); - return validate_spec_list(spec, data, full, errors); + return (validate_spec_list(spec, data, full, errors)); } ModuleSpec @@ -205,7 +201,7 @@ moduleSpecFromFile(const std::string& file_name, const bool check) ElementPtr module_spec_element = Element::fromJSON(file, file_name); if (module_spec_element->contains("module_spec")) { - return ModuleSpec(module_spec_element->get("module_spec"), check); + return (ModuleSpec(module_spec_element->get("module_spec"), check)); } else { throw ModuleSpecError("No module_spec in specification"); } @@ -213,10 +209,11 @@ moduleSpecFromFile(const std::string& file_name, const bool check) ModuleSpec moduleSpecFromFile(std::ifstream& in, const bool check) - throw(JSONError, ModuleSpecError) { + throw(JSONError, ModuleSpecError) +{ ElementPtr module_spec_element = Element::fromJSON(in); if (module_spec_element->contains("module_spec")) { - return ModuleSpec(module_spec_element->get("module_spec"), check); + return (ModuleSpec(module_spec_element->get("module_spec"), check)); } else { throw ModuleSpecError("No module_spec in specification"); } @@ -236,29 +233,29 @@ check_type(ElementPtr spec, ElementPtr element) std::string cur_item_type; cur_item_type = spec->get("item_type")->stringValue(); if (cur_item_type == "any") { - return true; + return (true); } switch (element->getType()) { case Element::integer: - return cur_item_type == "integer"; + return (cur_item_type == "integer"); break; case Element::real: - return cur_item_type == "real"; + return (cur_item_type == "real"); break; case Element::boolean: - return cur_item_type == "boolean"; + return (cur_item_type == "boolean"); break; case Element::string: - return cur_item_type == "string"; + return (cur_item_type == "string"); break; case Element::list: - return cur_item_type == "list"; + return (cur_item_type == "list"); break; case Element::map: - return cur_item_type == "map"; + return (cur_item_type == "map"); break; } - return false; + return (false); } bool @@ -270,7 +267,7 @@ ModuleSpec::validate_item(const ElementPtr spec, const ElementPtr data, const bo if (errors) { errors->add(Element::create("Type mismatch")); } - return false; + return (false); } if (data->getType() == Element::list) { ElementPtr list_spec = spec->get("list_item_spec"); @@ -279,21 +276,21 @@ ModuleSpec::validate_item(const ElementPtr spec, const ElementPtr data, const bo if (errors) { errors->add(Element::create("Type mismatch")); } - return false; + return (false); } if (list_spec->get("item_type")->stringValue() == "map") { if (!validate_item(list_spec, list_el, full, errors)) { - return false; + return (false); } } } } if (data->getType() == Element::map) { if (!validate_spec_list(spec->get("map_item_spec"), data, full, errors)) { - return false; + return (false); } } - return true; + return (true); } // spec is a map with item_name etc, data is a map @@ -306,17 +303,17 @@ ModuleSpec::validate_spec(const ElementPtr spec, const ElementPtr data, const bo if (data_el) { if (!validate_item(spec, data_el, full, errors)) { - return false; + return (false); } } else { if (!optional && full) { if (errors) { errors->add(Element::create("Non-optional value missing")); } - return false; + return (false); } } - return true; + return (true); } // spec is a list of maps, data is a map @@ -326,10 +323,10 @@ ModuleSpec::validate_spec_list(const ElementPtr spec, const ElementPtr data, con std::string cur_item_name; BOOST_FOREACH(ElementPtr cur_spec_el, spec->listValue()) { if (!validate_spec(cur_spec_el, data, full, errors)) { - return false; + return (false); } } - return true; + return (true); } } diff --git a/src/lib/config/module_spec.h b/src/lib/config/module_spec.h index 431545c2fd..22554e6dbe 100644 --- a/src/lib/config/module_spec.h +++ b/src/lib/config/module_spec.h @@ -34,7 +34,7 @@ namespace isc { namespace config { public: ModuleSpecError(std::string m = "Module specification is invalid") : msg(m) {} ~ModuleSpecError() throw() {} - const char* what() const throw() { return msg.c_str(); } + const char* what() const throw() { return (msg.c_str()); } private: std::string msg; }; @@ -72,7 +72,7 @@ namespace isc { namespace config { /// Returns the full module specification as an ElementPtr /// \return ElementPtr Shared pointer to the specification - const ElementPtr getFullSpec() const { return module_specification; }; + const ElementPtr getFullSpec() const { return (module_specification); } /// Returns the module name as specified by the specification const std::string getModuleName() const; diff --git a/src/lib/config/tests/ccsession_unittests.cc b/src/lib/config/tests/ccsession_unittests.cc index 67e9997d11..afdae9e74f 100644 --- a/src/lib/config/tests/ccsession_unittests.cc +++ b/src/lib/config/tests/ccsession_unittests.cc @@ -34,12 +34,12 @@ using namespace std; namespace { std::string ccspecfile(const std::string name) { - return std::string(TEST_DATA_PATH) + "/" + name; + return (std::string(TEST_DATA_PATH) + "/" + name); } ElementPtr el(const std::string& str) { - return Element::fromJSON(str); + return (Element::fromJSON(str)); } class CCSessionTest : public ::testing::Test { @@ -183,28 +183,28 @@ TEST_F(CCSessionTest, session2) ElementPtr my_config_handler(ElementPtr new_config) { if (new_config && new_config->contains("item1") && new_config->get("item1")->intValue() == 5) { - return createAnswer(6, "I do not like the number 5"); + return (createAnswer(6, "I do not like the number 5")); } - return createAnswer(); + return (createAnswer()); } ElementPtr my_command_handler(const std::string& command, ElementPtr arg UNUSED_PARAM) { if (command == "good_command") { - return createAnswer(); + return (createAnswer()); } else if (command == "command_with_arg") { if (arg) { if (arg->getType() == Element::integer) { - return createAnswer(0, el("2")); + return (createAnswer(0, el("2"))); } else { - return createAnswer(1, "arg bad type"); + return (createAnswer(1, "arg bad type")); } } else { - return createAnswer(1, "arg missing"); + return (createAnswer(1, "arg missing")); } } else { - return createAnswer(1, "bad command"); + return (createAnswer(1, "bad command")); } } diff --git a/src/lib/config/tests/config_data_unittests.cc b/src/lib/config/tests/config_data_unittests.cc index 6910f94d74..30605a1e65 100644 --- a/src/lib/config/tests/config_data_unittests.cc +++ b/src/lib/config/tests/config_data_unittests.cc @@ -26,10 +26,9 @@ using namespace isc::data; using namespace isc::config; ConfigData -setupSpec2() -{ +setupSpec2() { ModuleSpec spec2 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec22.spec"); - return ConfigData(spec2); + return (ConfigData(spec2)); } TEST(ConfigData, Creation) { diff --git a/src/lib/config/tests/fake_session.cc b/src/lib/config/tests/fake_session.cc index 8d082bb868..89653a04fb 100644 --- a/src/lib/config/tests/fake_session.cc +++ b/src/lib/config/tests/fake_session.cc @@ -145,7 +145,7 @@ FakeSession::recvmsg(ElementPtr& env, ElementPtr& msg, // do we need initial message to have env[group] and [to] too? msg = messages_->get(0); messages_->remove(0); - return true; + return (true); } else if (msg_queue_) { BOOST_FOREACH(ElementPtr c_m, msg_queue_->listValue()) { ElementPtr to_remove = ElementPtr(); @@ -158,13 +158,13 @@ FakeSession::recvmsg(ElementPtr& env, ElementPtr& msg, } if (to_remove) { listRemove(msg_queue_, to_remove); - return true; + return (true); } } } msg = ElementPtr(); env = ElementPtr(); - return false; + return (false); } void @@ -198,7 +198,7 @@ FakeSession::group_sendmsg(ElementPtr msg, std::string group, //cout << "[XX] client sends message: " << msg << endl; //cout << "[XX] to: " << group << " . " << instance << "." << to << endl; addMessage(msg, group, to); - return 1; + return (1); } bool @@ -213,12 +213,12 @@ FakeSession::reply(ElementPtr& envelope, ElementPtr& newmsg) { //cout << "[XX] client sends reply: " << newmsg << endl; //cout << "[XX] env: " << envelope << endl; addMessage(newmsg, envelope->get("group")->stringValue(), envelope->get("to")->stringValue()); - return 1; + return (1); } bool FakeSession::hasQueuedMsgs() { - return false; + return (false); } ElementPtr @@ -229,7 +229,7 @@ FakeSession::getFirstMessage(std::string& group, std::string& to) { msg_queue_->remove(0); group = el->get(0)->stringValue(); to = el->get(1)->stringValue(); - return el->get(2); + return (el->get(2)); } else { group = ""; to = ""; diff --git a/src/lib/config/tests/module_spec_unittests.cc b/src/lib/config/tests/module_spec_unittests.cc index 1bf72b1e2c..6a0211de3f 100644 --- a/src/lib/config/tests/module_spec_unittests.cc +++ b/src/lib/config/tests/module_spec_unittests.cc @@ -26,7 +26,7 @@ using namespace isc::data; using namespace isc::config; std::string specfile(const std::string name) { - return std::string(TEST_DATA_PATH) + "/" + name; + return (std::string(TEST_DATA_PATH) + "/" + name); } void @@ -134,15 +134,14 @@ TEST(ModuleSpec, SpecfileCommands) } bool -data_test(ModuleSpec dd, const std::string& data_file_name) -{ +data_test(ModuleSpec dd, const std::string& data_file_name) { std::ifstream data_file; data_file.open(specfile(data_file_name).c_str()); ElementPtr data = Element::fromJSON(data_file, data_file_name); data_file.close(); - return dd.validate_config(data); + return (dd.validate_config(data)); } bool @@ -154,7 +153,7 @@ data_test_with_errors(ModuleSpec dd, const std::string& data_file_name, ElementP ElementPtr data = Element::fromJSON(data_file, data_file_name); data_file.close(); - return dd.validate_config(data, true, errors); + return (dd.validate_config(data, true, errors)); } TEST(ModuleSpec, DataValidation) { diff --git a/src/lib/datasrc/data_source.cc b/src/lib/datasrc/data_source.cc index 8bfe6ba545..6f0d7df403 100644 --- a/src/lib/datasrc/data_source.cc +++ b/src/lib/datasrc/data_source.cc @@ -1246,7 +1246,7 @@ Nsec3Param::getHash(const Name& name) const { // DataSrc::Result DataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) { - return NOT_IMPLEMENTED; + return (NOT_IMPLEMENTED); } DataSrc::Result diff --git a/src/lib/datasrc/data_source.h b/src/lib/datasrc/data_source.h index 88acf3c41c..b73b8ea735 100644 --- a/src/lib/datasrc/data_source.h +++ b/src/lib/datasrc/data_source.h @@ -182,13 +182,13 @@ public: virtual void findClosestEnclosure(DataSrcMatch& match) const = 0; - const isc::dns::RRClass& getClass() const { return rrclass; } + const isc::dns::RRClass& getClass() const { return (rrclass); } void setClass(isc::dns::RRClass& c) { rrclass = c; } void setClass(const isc::dns::RRClass& c) { rrclass = c; } - Result init() { return NOT_IMPLEMENTED; } + Result init() { return (NOT_IMPLEMENTED); } Result init(const isc::data::ElementPtr config); - Result close() { return NOT_IMPLEMENTED; } + Result close() { return (NOT_IMPLEMENTED); } virtual Result findRRset(const isc::dns::Name& qname, const isc::dns::RRClass& qclass, @@ -247,7 +247,7 @@ public: void addDataSrc(ConstDataSrcPtr data_src); void removeDataSrc(ConstDataSrcPtr data_src); - size_t dataSrcCount() { return data_sources.size(); }; + size_t dataSrcCount() { return (data_sources.size()); } void findClosestEnclosure(DataSrcMatch& match) const; diff --git a/src/lib/datasrc/sqlite3_datasrc.h b/src/lib/datasrc/sqlite3_datasrc.h index 26cbac109c..a010351d08 100644 --- a/src/lib/datasrc/sqlite3_datasrc.h +++ b/src/lib/datasrc/sqlite3_datasrc.h @@ -94,7 +94,7 @@ public: std::string& hash, isc::dns::RRsetList& target) const; - Result init() { return init(isc::data::ElementPtr()); }; + Result init() { return (init(isc::data::ElementPtr())); } Result init(const isc::data::ElementPtr config); Result close(); diff --git a/src/lib/datasrc/static_datasrc.cc b/src/lib/datasrc/static_datasrc.cc index 77baefc3aa..e9c7636058 100644 --- a/src/lib/datasrc/static_datasrc.cc +++ b/src/lib/datasrc/static_datasrc.cc @@ -261,7 +261,7 @@ StaticDataSrc::init() { // is intentionally ignored. DataSrc::Result StaticDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) { - return init(); + return (init()); } DataSrc::Result diff --git a/src/lib/datasrc/tests/test_datasrc.cc b/src/lib/datasrc/tests/test_datasrc.cc index f249861b44..38529e5e2b 100644 --- a/src/lib/datasrc/tests/test_datasrc.cc +++ b/src/lib/datasrc/tests/test_datasrc.cc @@ -309,7 +309,7 @@ vector<Zone> zones; DataSrc::Result TestDataSrc::init(const isc::data::ElementPtr config UNUSED_PARAM) { - return init(); + return (init()); } void diff --git a/src/lib/dns/name.h b/src/lib/dns/name.h index e73d6b8b58..69eb75af1e 100644 --- a/src/lib/dns/name.h +++ b/src/lib/dns/name.h @@ -406,7 +406,7 @@ public: /// This method simply negates the result of \c equal() method, and in that /// sense it's redundant. The separate method is provided just for /// convenience. - bool nequals(const Name& other) const { return !(equals(other)); } + bool nequals(const Name& other) const { return (!(equals(other))); } /// Same as nequals() bool operator!=(const Name& other) const { return (nequals(other)); } diff --git a/src/lib/dns/python/message_python.cc b/src/lib/dns/python/message_python.cc index c81f1fad1d..d2814caab7 100644 --- a/src/lib/dns/python/message_python.cc +++ b/src/lib/dns/python/message_python.cc @@ -326,9 +326,9 @@ Opcode_toText(s_Opcode* self) { static PyObject* Opcode_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* @@ -624,9 +624,9 @@ Rcode_toText(s_Rcode* self) { static PyObject* Rcode_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* @@ -886,22 +886,22 @@ Section_createStatic(const Section& section) { static PyObject* Section_QUESTION(s_Section* self UNUSED_PARAM) { - return Section_createStatic(Section::QUESTION()); + return (Section_createStatic(Section::QUESTION())); } static PyObject* Section_ANSWER(s_Section* self UNUSED_PARAM) { - return Section_createStatic(Section::ANSWER()); + return (Section_createStatic(Section::ANSWER())); } static PyObject* Section_AUTHORITY(s_Section* self UNUSED_PARAM) { - return Section_createStatic(Section::AUTHORITY()); + return (Section_createStatic(Section::AUTHORITY())); } static PyObject* Section_ADDITIONAL(s_Section* self UNUSED_PARAM) { - return Section_createStatic(Section::ADDITIONAL()); + return (Section_createStatic(Section::ADDITIONAL())); } static PyObject* @@ -1526,9 +1526,9 @@ Message_toText(s_Message* self) { static PyObject* Message_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/messagerenderer_python.cc b/src/lib/dns/python/messagerenderer_python.cc index 3a7ac51c56..ccf0798e63 100644 --- a/src/lib/dns/python/messagerenderer_python.cc +++ b/src/lib/dns/python/messagerenderer_python.cc @@ -133,9 +133,9 @@ MessageRenderer_destroy(s_MessageRenderer* self) { static PyObject* MessageRenderer_getData(s_MessageRenderer* self) { - return Py_BuildValue("y#", + return (Py_BuildValue("y#", self->messagerenderer->getData(), - self->messagerenderer->getLength()); + self->messagerenderer->getLength())); } static PyObject* diff --git a/src/lib/dns/python/name_python.cc b/src/lib/dns/python/name_python.cc index 9b68e7076a..936290fe55 100644 --- a/src/lib/dns/python/name_python.cc +++ b/src/lib/dns/python/name_python.cc @@ -400,9 +400,9 @@ Name_str(PyObject* self) { // Simply call the to_text method we already defined // str() is not defined in the c++ version, only to_text // and we already have a wrapper for that one. - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/question_python.cc b/src/lib/dns/python/question_python.cc index d5950fdf8a..e67d667e84 100644 --- a/src/lib/dns/python/question_python.cc +++ b/src/lib/dns/python/question_python.cc @@ -231,9 +231,9 @@ Question_toText(s_Question* self) { static PyObject* Question_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/rdata_python.cc b/src/lib/dns/python/rdata_python.cc index 3af38aba1e..c642ddfa0d 100644 --- a/src/lib/dns/python/rdata_python.cc +++ b/src/lib/dns/python/rdata_python.cc @@ -174,9 +174,9 @@ Rdata_toText(s_Rdata* self) { static PyObject* Rdata_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/rrclass_python.cc b/src/lib/dns/python/rrclass_python.cc index c9e7cfbb2b..ef4146f95b 100644 --- a/src/lib/dns/python/rrclass_python.cc +++ b/src/lib/dns/python/rrclass_python.cc @@ -215,9 +215,9 @@ RRClass_toText(s_RRClass* self) { static PyObject* RRClass_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/rrset_python.cc b/src/lib/dns/python/rrset_python.cc index 2abb7e59e4..721e681f64 100644 --- a/src/lib/dns/python/rrset_python.cc +++ b/src/lib/dns/python/rrset_python.cc @@ -293,9 +293,9 @@ RRset_toText(s_RRset* self) { static PyObject* RRset_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/rrttl_python.cc b/src/lib/dns/python/rrttl_python.cc index de178bd993..29b361bd40 100644 --- a/src/lib/dns/python/rrttl_python.cc +++ b/src/lib/dns/python/rrttl_python.cc @@ -213,9 +213,9 @@ RRTTL_toText(s_RRTTL* self) { static PyObject* RRTTL_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/python/rrtype_python.cc b/src/lib/dns/python/rrtype_python.cc index f3f081dffc..87d0f8c3dc 100644 --- a/src/lib/dns/python/rrtype_python.cc +++ b/src/lib/dns/python/rrtype_python.cc @@ -253,8 +253,8 @@ RRType_toText(s_RRType* self) { static PyObject* RRType_str(PyObject* self) { // Simply call the to_text method we already defined - return PyObject_CallMethod(self, const_cast<char*>("to_text"), - const_cast<char*>("")); + return (PyObject_CallMethod(self, const_cast<char*>("to_text"), + const_cast<char*>(""))); } static PyObject* diff --git a/src/lib/dns/rdata/generic/ds_43.cc b/src/lib/dns/rdata/generic/ds_43.cc index 3bbe5ab290..41e24f0177 100644 --- a/src/lib/dns/rdata/generic/ds_43.cc +++ b/src/lib/dns/rdata/generic/ds_43.cc @@ -173,7 +173,7 @@ DS::compare(const Rdata& other) const uint16_t DS::getTag() const { - return impl_->tag_; + return (impl_->tag_); } // END_RDATA_NAMESPACE diff --git a/src/lib/dns/rdata/generic/nsec3_50.cc b/src/lib/dns/rdata/generic/nsec3_50.cc index d524d65020..652274b76f 100644 --- a/src/lib/dns/rdata/generic/nsec3_50.cc +++ b/src/lib/dns/rdata/generic/nsec3_50.cc @@ -323,22 +323,22 @@ NSEC3::compare(const Rdata& other) const uint8_t NSEC3::getHashalg() const { - return impl_->hashalg_; + return (impl_->hashalg_); } uint8_t NSEC3::getFlags() const { - return impl_->flags_; + return (impl_->flags_); } uint16_t NSEC3::getIterations() const { - return impl_->iterations_; + return (impl_->iterations_); } vector<uint8_t>& NSEC3::getSalt() const { - return impl_->salt_; + return (impl_->salt_); } // END_RDATA_NAMESPACE diff --git a/src/lib/dns/rrsetlist.cc b/src/lib/dns/rrsetlist.cc index 84e2ce5d15..02479536e3 100644 --- a/src/lib/dns/rrsetlist.cc +++ b/src/lib/dns/rrsetlist.cc @@ -53,10 +53,10 @@ RRsetList::findRRset(const RRType& rrtype, const RRClass& rrclass) { BOOST_FOREACH(RRsetPtr rrsetptr, rrsets_) { if ((rrsetptr->getClass() == rrclass) && (rrsetptr->getType() == rrtype)) { - return rrsetptr; + return (rrsetptr); } } - return RRsetPtr(); + return (RRsetPtr()); } } diff --git a/src/lib/dns/rrtype-placeholder.h b/src/lib/dns/rrtype-placeholder.h index 1ed42ee123..7b455ce9cc 100644 --- a/src/lib/dns/rrtype-placeholder.h +++ b/src/lib/dns/rrtype-placeholder.h @@ -221,7 +221,7 @@ public: bool equals(const RRType& other) const { return (typecode_ == other.typecode_); } /// \brief Same as \c equals(). - bool operator==(const RRType& other) const { return equals(other); } + bool operator==(const RRType& other) const { return (equals(other)); } /// \brief Return true iff two RRTypes are equal. /// @@ -232,7 +232,7 @@ public: bool nequals(const RRType& other) const { return (typecode_ != other.typecode_); } /// \brief Same as \c nequals(). - bool operator!=(const RRType& other) const { return nequals(other); } + bool operator!=(const RRType& other) const { return (nequals(other)); } /// \brief Less-than comparison for RRType against \c other /// diff --git a/src/lib/dns/tests/rrparamregistry_unittest.cc b/src/lib/dns/tests/rrparamregistry_unittest.cc index b71095abdf..76d5fce238 100644 --- a/src/lib/dns/tests/rrparamregistry_unittest.cc +++ b/src/lib/dns/tests/rrparamregistry_unittest.cc @@ -107,11 +107,11 @@ TEST_F(RRParamRegistryTest, addError) class TestRdataFactory : public AbstractRdataFactory { public: virtual RdataPtr create(const string& rdata_str) const - { return RdataPtr(new in::A(rdata_str)); } + { return (RdataPtr(new in::A(rdata_str))); } virtual RdataPtr create(InputBuffer& buffer, size_t rdata_len) const - { return RdataPtr(new in::A(buffer, rdata_len)); } + { return (RdataPtr(new in::A(buffer, rdata_len))); } virtual RdataPtr create(const Rdata& source) const - { return RdataPtr(new in::A(dynamic_cast<const in::A&>(source))); } + { return (RdataPtr(new in::A(dynamic_cast<const in::A&>(source)))); } }; TEST_F(RRParamRegistryTest, addRemoveFactory) diff --git a/src/lib/dns/tests/unittest_util.cc b/src/lib/dns/tests/unittest_util.cc index 414f410980..90b0bdf7c3 100644 --- a/src/lib/dns/tests/unittest_util.cc +++ b/src/lib/dns/tests/unittest_util.cc @@ -158,7 +158,7 @@ UnitTestUtil::matchWireData(const char* dataexp1 UNUSED_PARAM, << "Expected: " << len2 << "\n"; return (::testing::AssertionFailure(msg)); } - return ::testing::AssertionSuccess(); + return (::testing::AssertionSuccess()); } ::testing::AssertionResult @@ -177,5 +177,5 @@ UnitTestUtil::matchName(const char* nameexp1 UNUSED_PARAM, << "Other: " << name2 << "\n"; return (::testing::AssertionFailure(msg)); } - return ::testing::AssertionSuccess(); + return (::testing::AssertionSuccess()); } diff --git a/src/lib/dns/util/base16_from_binary.h b/src/lib/dns/util/base16_from_binary.h index db704385d2..8606c619c8 100644 --- a/src/lib/dns/util/base16_from_binary.h +++ b/src/lib/dns/util/base16_from_binary.h @@ -46,7 +46,7 @@ struct from_4_bit { "0123456789" "ABCDEF"; assert(t < 16); - return lookup_table[static_cast<size_t>(t)]; + return (lookup_table[static_cast<size_t>(t)]); } }; diff --git a/src/lib/dns/util/base32hex_from_binary.h b/src/lib/dns/util/base32hex_from_binary.h index 210f36447e..5d16d044be 100644 --- a/src/lib/dns/util/base32hex_from_binary.h +++ b/src/lib/dns/util/base32hex_from_binary.h @@ -48,7 +48,7 @@ struct from_5_bit { "0123456789" "ABCDEFGHIJKLMNOPQRSTUV"; assert(t < 32); - return lookup_table[static_cast<size_t>(t)]; + return (lookup_table[static_cast<size_t>(t)]); } }; diff --git a/src/lib/dns/util/binary_from_base16.h b/src/lib/dns/util/binary_from_base16.h index acd2a7dbe5..50342f1012 100644 --- a/src/lib/dns/util/binary_from_base16.h +++ b/src/lib/dns/util/binary_from_base16.h @@ -56,7 +56,7 @@ struct to_4_bit { isc_throw(isc::BadValue, "attempt to decode a value not in base16 char set"); } - return value; + return (value); } }; diff --git a/src/lib/dns/util/binary_from_base32hex.h b/src/lib/dns/util/binary_from_base32hex.h index 8b13efca8c..1d83f54360 100644 --- a/src/lib/dns/util/binary_from_base32hex.h +++ b/src/lib/dns/util/binary_from_base32hex.h @@ -59,7 +59,7 @@ struct to_5_bit { isc_throw(isc::BadValue, "attempt to decode a value not in base32hex char set"); } - return value; + return (value); } }; diff --git a/src/lib/dns/util/sha1.cc b/src/lib/dns/util/sha1.cc index 1513581fa8..ee25134bfa 100644 --- a/src/lib/dns/util/sha1.cc +++ b/src/lib/dns/util/sha1.cc @@ -85,9 +85,9 @@ SHA1AddLength(SHA1Context *context, uint32_t length) { uint32_t addTemp = context->Length_Low; context->Length_Low += length; if (context->Length_Low < addTemp && ++context->Length_High == 0) { - return true; + return (true); } else { - return false; + return (false); } } diff --git a/src/lib/xfr/fdshare_python.cc b/src/lib/xfr/fdshare_python.cc index 014bf6405f..b28c12f535 100644 --- a/src/lib/xfr/fdshare_python.cc +++ b/src/lib/xfr/fdshare_python.cc @@ -23,25 +23,23 @@ #include <xfr/fd_share.h> static PyObject* -fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args) -{ +fdshare_recv_fd(PyObject *self UNUSED_PARAM, PyObject *args) { int sock, fd; if (!PyArg_ParseTuple(args, "i", &sock)) { - return NULL; + return (NULL); } fd = isc::xfr::recv_fd(sock); - return Py_BuildValue("i", fd); + return (Py_BuildValue("i", fd)); } static PyObject* -fdshare_send_fd(PyObject *self UNUSED_PARAM, PyObject *args) -{ +fdshare_send_fd(PyObject *self UNUSED_PARAM, PyObject *args) { int sock, fd, result; if (!PyArg_ParseTuple(args, "ii", &sock, &fd)) { - return NULL; + return (NULL); } result = isc::xfr::send_fd(sock, fd); - return Py_BuildValue("i", result); + return (Py_BuildValue("i", result)); } static PyMethodDef fdshare_Methods[] = { @@ -64,13 +62,12 @@ static PyModuleDef bind10_fdshare_python = { }; PyMODINIT_FUNC -PyInit_libxfr_python(void) -{ +PyInit_libxfr_python(void) { PyObject *mod = PyModule_Create(&bind10_fdshare_python); if (mod == NULL) { - return NULL; + return (NULL); } - return mod; + return (mod); } diff --git a/src/lib/xfr/xfrout_client.cc b/src/lib/xfr/xfrout_client.cc index b6264d17a9..9ea201dc9b 100644 --- a/src/lib/xfr/xfrout_client.cc +++ b/src/lib/xfr/xfrout_client.cc @@ -101,7 +101,7 @@ XfroutClient::sendXfroutRequestInfo(const int tcp_sock, "xfr query hasn't been processed properly by xfrout module"); } - return 0; + return (0); } } // End for xfr |