From d0b3aaecd90ba7d899c5ee950c836376e7a87eb9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 15 Jun 2019 18:07:37 +0200 Subject: Make QIPAddressUtils::toString() const-correct for IPv6 The IPv4 overload takes a IPv4Address, which is just an quint32, so it doesn't matter whether clients call it with a const or a mutable argument. The IPv6 overload, OTOH, took a IPv6Address, which is a typedef for quint8[16]. This allows users to pass a quint16[16], but not a const quint8[16], because that would lose the const. The function, however, doesn't modify the argument, so it could be const. Make it so, even though, due to the typedef, it looks like a redundant top-level const. Change-Id: I0506f6f9026ad616c4450fceb45fea137ac27692 Reviewed-by: Thiago Macieira --- src/corelib/io/qipaddress_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/io/qipaddress_p.h') diff --git a/src/corelib/io/qipaddress_p.h b/src/corelib/io/qipaddress_p.h index d95cccb3bd..ea31e5883d 100644 --- a/src/corelib/io/qipaddress_p.h +++ b/src/corelib/io/qipaddress_p.h @@ -64,7 +64,7 @@ typedef quint8 IPv6Address[16]; Q_CORE_EXPORT bool parseIp4(IPv4Address &address, const QChar *begin, const QChar *end); Q_CORE_EXPORT const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end); Q_CORE_EXPORT void toString(QString &appendTo, IPv4Address address); -Q_CORE_EXPORT void toString(QString &appendTo, IPv6Address address); +Q_CORE_EXPORT void toString(QString &appendTo, const IPv6Address address); } // namespace -- cgit v1.2.3