Commit 968625c3 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge second part of #2726

Enable more checks from cppcheck and fix reports caused by that. Fix
also reports produced by different version of cppcheck than the local
one.
parents 7c2793d4 b6f56488
......@@ -524,7 +524,8 @@ ResolverImpl::processNormalQuery(const IOMessage& io_message,
{
const ConstQuestionPtr question = *query_message->beginQuestion();
const RRType qtype = question->getType();
const RRClass qclass = question->getClass();
// Make cppcheck happy with the reference.
const RRClass& qclass = question->getClass();
// Apply query ACL
const Client client(io_message);
......
......@@ -29,7 +29,7 @@ namespace config {
/// point to anything defined in the .spec file)
class DataNotFoundError : public isc::Exception {
public:
DataNotFoundError(const char* file, size_t line, const std::string& what) :
DataNotFoundError(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) {}
};
......
......@@ -125,6 +125,7 @@ public:
rrclass_(RRClass::IN()),
// The empty list corresponds to a list with no elements inside
list_(new TestedList(rrclass_)),
negative_result_(),
config_elem_(Element::fromJSON("["
"{"
" \"type\": \"test_type\","
......
......@@ -98,10 +98,10 @@ struct SectionIteratorImpl;
template <typename T>
class SectionIterator : public std::iterator<std::input_iterator_tag, T> {
public:
SectionIterator<T>() : impl_(NULL) {}
SectionIterator<T>(const SectionIteratorImpl<T>& impl);
~SectionIterator<T>();
SectionIterator<T>(const SectionIterator<T>& source);
SectionIterator() : impl_(NULL) {}
SectionIterator(const SectionIteratorImpl<T>& impl);
~SectionIterator();
SectionIterator(const SectionIterator<T>& source);
void operator=(const SectionIterator<T>& source);
SectionIterator<T>& operator++();
SectionIterator<T> operator++(int);
......
......@@ -370,13 +370,13 @@ TSIG::toText() const {
lexical_cast<string>(impl_->time_signed_) + " " +
lexical_cast<string>(impl_->fudge_) + " " +
lexical_cast<string>(impl_->mac_.size()) + " ";
if (impl_->mac_.size() > 0) {
if (!impl_->mac_.empty()) {
result += encodeBase64(impl_->mac_) + " ";
}
result += lexical_cast<string>(impl_->original_id_) + " ";
result += TSIGError(impl_->error_).toText() + " ";
result += lexical_cast<string>(impl_->other_data_.size());
if (impl_->other_data_.size() > 0) {
if (!impl_->other_data_.empty()) {
result += " " + encodeBase64(impl_->other_data_);
}
......@@ -520,7 +520,7 @@ TSIG::getMACSize() const {
const void*
TSIG::getMAC() const {
if (impl_->mac_.size() > 0) {
if (!impl_->mac_.empty()) {
return (&impl_->mac_[0]);
} else {
return (NULL);
......@@ -544,7 +544,7 @@ TSIG::getOtherLen() const {
const void*
TSIG::getOtherData() const {
if (impl_->other_data_.size() > 0) {
if (!impl_->other_data_.empty()) {
return (&impl_->other_data_[0]);
} else {
return (NULL);
......
......@@ -127,7 +127,7 @@ void
MessageReader::parsePrefix(const vector<string>& tokens) {
// Should not get here unless there is something in the tokens array.
assert(tokens.size() > 0);
assert(!tokens.empty());
// Process $PREFIX. With no arguments, the prefix is set to the empty
// string. One argument sets the prefix to the to its value and more than
......
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