mbimmodem: Convert back to using __builtin_bswap16 with proper indexing

This commit is contained in:
Marcel Holtmann 2018-10-31 21:03:49 +01:00
parent 2df69194ac
commit 2a5c9cf0f2
1 changed files with 4 additions and 2 deletions

View File

@ -196,8 +196,10 @@ static bool _iter_copy_string(struct mbim_message_iter *iter,
/* Strings are in UTF16-LE, so convert to UTF16-CPU first if needed */
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
for (i = 0; i < len; i+= 2)
l_put_u16(l_get_le16(buf + i), buf + i);
uint16_t *le = (uint16_t *) buf;
for (i = 0; i < len / 2; i++)
le[i] = __builtin_bswap16(le[i]);
}
*out = l_utf8_from_utf16(buf, len);