aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppBitsOfBinaryContentId.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-09-05 20:37:05 +0200
committerLinus Jahn <lnj@kaidan.im>2022-09-06 00:46:56 +0200
commit5f813f8a4bbe1e075daad7b3933829044befffb4 (patch)
tree20102aa665b03cfb6dfe0c6ece94938320b6430e /src/base/QXmppBitsOfBinaryContentId.cpp
parent4c60b13e0b8011e4e0b093a690e939f3b23e2436 (diff)
downloadqxmpp-5f813f8a4bbe1e075daad7b3933829044befffb4.tar.gz
Reformat code
Diffstat (limited to 'src/base/QXmppBitsOfBinaryContentId.cpp')
-rw-r--r--src/base/QXmppBitsOfBinaryContentId.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/base/QXmppBitsOfBinaryContentId.cpp b/src/base/QXmppBitsOfBinaryContentId.cpp
index 877e08f7..a348b2f8 100644
--- a/src/base/QXmppBitsOfBinaryContentId.cpp
+++ b/src/base/QXmppBitsOfBinaryContentId.cpp
@@ -78,8 +78,9 @@ QXmppBitsOfBinaryContentIdPrivate::QXmppBitsOfBinaryContentIdPrivate()
///
QXmppBitsOfBinaryContentId QXmppBitsOfBinaryContentId::fromCidUrl(const QString &input)
{
- if (input.startsWith(CONTENTID_URL))
+ if (input.startsWith(CONTENTID_URL)) {
return fromContentId(input.mid(CONTENTID_URL_LENGTH));
+ }
return {};
}
@@ -98,19 +99,22 @@ QXmppBitsOfBinaryContentId QXmppBitsOfBinaryContentId::fromCidUrl(const QString
///
QXmppBitsOfBinaryContentId QXmppBitsOfBinaryContentId::fromContentId(const QString &input)
{
- if (input.startsWith(CONTENTID_URL) || !input.endsWith(CONTENTID_POSTFIX))
+ if (input.startsWith(CONTENTID_URL) || !input.endsWith(CONTENTID_POSTFIX)) {
return {};
+ }
// remove '@bob.xmpp.org'
QString hashAndAlgoStr = input.left(input.size() - CONTENTID_POSTFIX_LENGTH);
// get size of hash algo id
QStringList algoAndHash = hashAndAlgoStr.split(CONTENTID_HASH_SEPARATOR);
- if (algoAndHash.size() != 2)
+ if (algoAndHash.size() != 2) {
return {};
+ }
QCryptographicHash::Algorithm algo = HASH_ALGORITHMS.key(algoAndHash.first(), QCryptographicHash::Algorithm(-1));
- if (int(algo) == -1)
+ if (int(algo) == -1) {
return {};
+ }
QXmppBitsOfBinaryContentId cid;
cid.setAlgorithm(algo);
@@ -151,8 +155,9 @@ QXmppBitsOfBinaryContentId &QXmppBitsOfBinaryContentId::operator=(QXmppBitsOfBin
///
QString QXmppBitsOfBinaryContentId::toContentId() const
{
- if (!isValid())
+ if (!isValid()) {
return {};
+ }
return HASH_ALGORITHMS.value(d->algorithm) +
CONTENTID_HASH_SEPARATOR +
@@ -165,8 +170,9 @@ QString QXmppBitsOfBinaryContentId::toContentId() const
///
QString QXmppBitsOfBinaryContentId::toCidUrl() const
{
- if (!isValid())
+ if (!isValid()) {
return {};
+ }
return toContentId().prepend(CONTENTID_URL);
}