aboutsummaryrefslogtreecommitdiff
path: root/lib/uri.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-06-12 22:43:33 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-06-13 16:29:50 +0200
commitfaf0122db53e4d010ec1f9f00f40feedd6786e71 (patch)
tree0b013bfa3a5695da3fea43dadf9b43d1439cd4d9 /lib/uri.cpp
parentbeb3a135a336dca654d967b88ea06a7457fbbec1 (diff)
downloadlibquotient-faf0122db53e4d010ec1f9f00f40feedd6786e71.tar.gz
libquotient-faf0122db53e4d010ec1f9f00f40feedd6786e71.zip
Uri: Fix ambiguity around QChar constructors
QChar now accepts more types for construction, and that unraveled concatenation of a Type/SecondaryType character with a QString. To fix it, give the compiler a hint by casting to the enum's underlying type (which also nicely documents that we _actually_ switch from enum to character type).
Diffstat (limited to 'lib/uri.cpp')
-rw-r--r--lib/uri.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/uri.cpp b/lib/uri.cpp
index d8624796..c8843dda 100644
--- a/lib/uri.cpp
+++ b/lib/uri.cpp
@@ -186,14 +186,18 @@ QString Uri::primaryId() const
if (primaryType_ == Empty || primaryType_ == Invalid)
return {};
- const auto& idStem = pathSegment(*this, 1);
- return idStem.isEmpty() ? idStem : primaryType_ + idStem;
+ auto idStem = pathSegment(*this, 1);
+ if (!idStem.isEmpty())
+ idStem.push_front(char(primaryType_));
+ return idStem;
}
QString Uri::secondaryId() const
{
- const auto& idStem = pathSegment(*this, 3);
- return idStem.isEmpty() ? idStem : secondaryType() + idStem;
+ auto idStem = pathSegment(*this, 3);
+ if (!idStem.isEmpty())
+ idStem.push_front(char(secondaryType()));
+ return idStem;
}
static const auto ActionKey = QStringLiteral("action");