diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-09-05 20:37:05 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-09-06 00:46:56 +0200 |
| commit | 5f813f8a4bbe1e075daad7b3933829044befffb4 (patch) | |
| tree | 20102aa665b03cfb6dfe0c6ece94938320b6430e /src/base/QXmppBitsOfBinaryContentId.cpp | |
| parent | 4c60b13e0b8011e4e0b093a690e939f3b23e2436 (diff) | |
| download | qxmpp-5f813f8a4bbe1e075daad7b3933829044befffb4.tar.gz | |
Reformat code
Diffstat (limited to 'src/base/QXmppBitsOfBinaryContentId.cpp')
| -rw-r--r-- | src/base/QXmppBitsOfBinaryContentId.cpp | 18 |
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); } |
