8000 LEAmDNS - consistent const <-> non-const accessors · mcspr/esp8266-Arduino@d5a5b17 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5a5b17

Browse files
committed
LEAmDNS - consistent const <-> non-const accessors
> error: infinite recursion detected [-Werror=infinite-recursion]
1 parent ce89ac1 commit d5a5b17

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

libraries/ESP8266mDNS/src/LEAmDNS_Structs.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,15 +1735,6 @@ namespace MDNSImplementation
17351735
const MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address*
17361736
MDNSResponder::stcMDNSServiceQuery::stcAnswer::findIP4Address(
17371737
const IPAddress& p_IPAddress) const
1738-
{
1739-
return (stcIP4Address*)(((const stcAnswer*)this)->findIP4Address(p_IPAddress));
1740-
}
1741-
1742-
/*
1743-
MDNSResponder::stcMDNSServiceQuery::stcAnswer::findIP4Address
1744-
*/
1745-
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address*
1746-
MDNSResponder::stcMDNSServiceQuery::stcAnswer::findIP4Address(const IPAddress& p_IPAddress)
17471738
{
17481739
stcIP4Address* pIP4Address = m_pIP4Addresses;
17491740
while (pIP4Address)
@@ -1757,6 +1748,16 @@ namespace MDNSImplementation
17571748
return pIP4Address;
17581749
}
17591750

1751+
/*
1752+
MDNSResponder::stcMDNSServiceQuery::stcAnswer::findIP4Address
1753+
*/
1754+
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcIP4Address*
1755+
MDNSResponder::stcMDNSServiceQuery::stcAnswer::findIP4Address(const IPAddress& p_IPAddress)
1756+
{
1757+
const auto& cref = static_cast<const decltype(*this)>(*this);
1758+
return const_cast<stcIP4Address*>(cref.findIP4Address(p_IPAddress));
1759+
}
1760+
17601761
/*
17611762
MDNSResponder::stcMDNSServiceQuery::stcAnswer::IP4AddressCount
17621763
*/
@@ -2033,7 +2034,8 @@ namespace MDNSImplementation
20332034
MDNSResponder::stcMDNSServiceQuery::stcAnswer*
20342035
MDNSResponder::stcMDNSServiceQuery::answerAtIndex(uint32_t p_u32Index)
20352036
{
2036-
return (stcAnswer*)(((const stcMDNSServiceQuery*)this)->answerAtIndex(p_u32Index));
2037+
const auto& cref = static_cast<const decltype(*this)>(*this);
2038+
return const_cast<stcAnswer*>(cref.answerAtIndex(p_u32Index));
20372039
}
20382040

20392041
/*

0 commit comments

Comments
 (0)
0