CBOR: Remove dead code: len[12] are not used with UTF-16

The lengths are only needed to check if one of the two strings is empty
and in the direct 8-bit comparisons with memcmp(). So we don't need this
division by 2, which was here since the initial commit.

Amends d4c7da9a07dc1434692fe08a61ba22c794574c4f.

Change-Id: Ie28eadac333c4bcd8c08fffd17c5ecbce564ccd1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a7b9ec7f6f465ce0d90edfe7154a4837b1fb9c00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-04-13 12:12:09 -07:00 committed by Qt Cherry-pick Bot
parent 3e3bfcc731
commit f84f752864

View File

@ -1149,11 +1149,6 @@ static int compareElementRecursive(const QCborContainerPrivate *c1, const Elemen
if (b1 || b2) {
auto len1 = b1 ? b1->len : 0;
auto len2 = b2 ? b2->len : 0;
if (e1.flags & Element::StringIsUtf16)
len1 /= 2;
if (e2.flags & Element::StringIsUtf16)
len2 /= 2;
if (len1 == 0 || len2 == 0)
return len1 < len2 ? -1 : len1 == len2 ? 0 : 1;