1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Work around a C++ standard defect

Reported on Solaris 5.9:
nmap_dns.cc:1320: error: no match for 'operator!=' in 'c !=
std::basic_string<_CharT, _Traits, _Alloc>::rend() [with _CharT = char,
_Traits = std::char_traits<char>, _Alloc = std::allocator<char>]()'

Reference:
https://stackoverflow.com/questions/2135094/gcc-reverse-iterator-comparison-operators-missing
This commit is contained in:
dmiller
2016-02-22 13:55:25 +00:00
parent 27a5fd2132
commit 5bf6a0310d

View File

@@ -1317,7 +1317,8 @@ bool DNS::Factory::ipToPtr(const sockaddr_storage &ip, std::string &ptr)
std::string ipv4 = ipv4_c;
std::string octet;
for (std::string::const_reverse_iterator c=ipv4.rbegin(); c != ipv4.rend(); ++c)
std::string::const_reverse_iterator crend = ipv4.rend();
for (std::string::const_reverse_iterator c=ipv4.rbegin(); c != crend; ++c)
if((*c)=='.')
{
ptr += octet + ".";
@@ -1382,7 +1383,8 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, sockaddr_storage &ip)
{
std::string octet;
for (std::string::const_reverse_iterator it = mptr.rend()-pos; it != mptr.rend(); ++it)
std::string::const_reverse_iterator crend = mptr.rend();
for (std::string::const_reverse_iterator it = crend-pos; it != crend; ++it)
{
const char &c = *it;
if(c == '.')