From 69ffd7b6c0dc2d1cd34b97dc19449c4c95dde519 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 Apr 2020 11:01:04 +0200 Subject: [PATCH] QUrl: replace some lower-case macros with functions It's cleaner. Change-Id: Ib2297b905f5dd242c5e7ab431393398e7c93ecbf Reviewed-by: Lars Knoll --- src/corelib/io/qurl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index a1e7503969c..7b09db55668 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -725,9 +725,11 @@ inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, in // the decodedXXX tables are run with the delimiters set to "decode" by default // (except for the query, which doesn't use these functions) -#define decode(x) ushort(x) -#define leave(x) ushort(0x100 | (x)) -#define encode(x) ushort(0x200 | (x)) +namespace { +template constexpr ushort decode(T x) noexcept { return ushort(x); } +template constexpr ushort leave(T x) noexcept { return ushort(0x100 | x); } +template constexpr ushort encode(T x) noexcept { return ushort(0x200 | x); } +} static const ushort userNameInIsolation[] = { decode(':'), // 0