From 5bf6a0310db88b551eb23d56e50b08fe9e203d9c Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 22 Feb 2016 13:55:25 +0000 Subject: [PATCH] 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, _Alloc = std::allocator]()' Reference: https://stackoverflow.com/questions/2135094/gcc-reverse-iterator-comparison-operators-missing --- nmap_dns.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nmap_dns.cc b/nmap_dns.cc index d8b8a0690..58cefb69d 100644 --- a/nmap_dns.cc +++ b/nmap_dns.cc @@ -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 == '.')