BIND 10 #318: MSVC++ detected errors and warnings in libdns++
BIND 10 Development
do-not-reply at isc.org
Wed Aug 25 14:03:08 UTC 2010
#318: MSVC++ detected errors and warnings in libdns++
---------------------------+------------------------------------------------
Reporter: stephen | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: Unclassified | Keywords:
Sensitive: 0 | Estimatedhours: 0
Hours: 0 | Billable: 1
Totalhours: 0 | Internal: 0
---------------------------+------------------------------------------------
I've run the libdns++ code in revision 2798 of the trunk through the
Microsoft Visual C++ compiler and it has thrown up a number of warnings
and errors. Those that are relevant to the Unix version of BIND are
listed below; the more Windows-specific erors (e.g. use of a function for
which there is no equivalent in Windows) will be the subject of another
ticket.
'''src/lib/dns/rdata/generic/dnskey_48.cc'''
''DNSKEY::DNSKEY(!InputBuffer& buffer, size_t rdata_len)''
{{{uint16_t protocol = buffer.readUint8();}}}
{{{uint16_t algorithm = buffer.readUint8();}}}
The declarations should be uint8_t. These variables are passed to the
constructor of DNSKEYImpl (which expects them as uint8_t) and the compiler
warns about the conversion of a uint16_t to a uint8_t.
''DNSKEY::getTag()''
{{{for (int i = 0; i < size; i ++)}}}
Compiler warns about a signed/unsigned comparison mismatch (size is
declared as size_t).
'''src/lib/dns/rdata/generic/ds_43.cc'''
''DS::DS(!InputBuffer& buffer, size_t rdata_len)''
{{{uint16_t protocol = buffer.readUint8()}}}
{{{uint16_t algorithm = buffer.readUint8()}}}
The declarations should be uint8_t. These variables are passed to the
constructor of DSImpl (which expects them as uint8_t) and the compiler
warns about the conversion of a uint16_t to a uint8_t.
'''src/lib/dns/rdata/generic/nsec3param_51.cc'''
''NSEC3PARAM::NSEC3PARAM(const string& nsec3param_str)''
{{{uint16_t hashalg, flags, iterations}}}
hashalg and flags should be declared uint8_t. These variables are passed
to the constructor of NSEC3PARAMImpl (which expects them as uint8_t) and
the compiler warns about the conversion of a uint16_t to a uint8_t.
'''src/lib/dns/rdata/generic/nsec3_50.cc'''
''NSEC3::NSEC3(!InputBuffer& buffer, size_t rdata_len)''
{{{for (int i = 0; i < typebits.size(); i += len)}}}
{{{if (i + 2 > typebits.size())}}}
Compiler warns about a signed/unsigned comparison mismatch.
''NSEC3::toText()''
{{{for (int i = 0; i < impl_->typebits_.size(); i += len)}}}
{{{assert(i + 2 <= impl_->typebits_.size())}}}
Compiler warns about a signed/unsigned comparison mismatch.
''NSEC::NSEC(!InputBuffer& buffer, size_t rdata_len)''
{{{for (int i = 0; i < rdata_len; i += len)}}}
{{{if (i + 2 > rdata_len)}}}
and
{{{if (i + len > rdata_len)}}}
Compiler warns about a signed/unsigned comparison mismatch.
''NSEC::toText()''
{{{for (int i = 0; i < impl_->typebits_.size(); i += len)}}}
{{{assert(i + 2 <= impl_->typebits_.size());}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/rdata/generic/rrsig_46.cc'''
''RRSIG::RRSIG(const string& rrsig_str)''
{{{uint32_t timeexpire = timeFromText(expire_txt);}}}
{{{uint32_t timeinception = timeFromText(inception_txt);}}}
timeFromText returns a time_t value. Under Windows, time_t is 64 bits, so
the compiler is warning about a possible loss of data. (Suggestion: as the
value of the inception and expiration times in an RRSIG are defined to be
unsigned 32-bit values, altering the return type of the timeFromText()
function would seem to be a better fix than changing the data types of
timeexpire and timeexception.)
'''src/lib/dns/rdata/generic/txt_16.cc'''
''TXT::TXT(!InputBuffer& buffer, size_t rdata_len)''
{{{if (rdata_len < len + 1)}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/rdata.cc'''
''Generic::Generic(const string& rdata_string)''
{{{while (!iss.eof() && data.size() < rdlen)}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/name.cc'''
''Name::toText(bool omit_final_dot)''
{{{ assert(np_end - np >= count);}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/message.h '''
message.h forward declares !MessageImpl as a struct but message.c defines
it as a class. The compiler warns about the mismatch.
'''src/lib/dns/message.cc'''
''MessageImpl::parseQuestion(!InputBuffer& buffer)''
{{{ for (unsigned int count = 0;}}}
{{{ count < counts_[Section::QUESTION().getCode()];}}}
{{{ ++count)}}}
Compiler warns about a signed/unsigned comparison mismatch.
''MessageImpl::parseSection(const Section& section, !InputBuffer&
buffer)''
{{{ for (unsigned int count = 0; count < counts_[section.getCode()];
++count)}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/dnssectime.cc'''
''timeFromText(const string& time_txt)''
{{{ for (int i = 0; i < time_txt.length(); ++i)}}}
Compiler warns about a signed/unsigned comparison mismatch.
'''src/lib/dns/messagerenderer.c'''
''MessageRenderer::writeName(const Name& name, const bool compress)''
{{{ std::set<NameCompressNode>::const_iterator notfound =
impl_->nodeset_.end();}}}
This gives an error because notfound is declared as:
{{{ std::set<NameCompressNode>::const_iterator}}}
... but nodeset_.end() has type:
{{{ std::set<NameCompressNode, NameCompare>::const_iterator}}}
--
Ticket URL: <http://bind10.isc.org/ticket/318>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list