mirror of git://git.sysmocom.de/ofono
mbimmodem: Convert back to using __builtin_bswap16 with proper indexing
This commit is contained in:
parent
2df69194ac
commit
2a5c9cf0f2
|
@ -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 */
|
/* Strings are in UTF16-LE, so convert to UTF16-CPU first if needed */
|
||||||
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
|
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
|
||||||
for (i = 0; i < len; i+= 2)
|
uint16_t *le = (uint16_t *) buf;
|
||||||
l_put_u16(l_get_le16(buf + i), buf + i);
|
|
||||||
|
for (i = 0; i < len / 2; i++)
|
||||||
|
le[i] = __builtin_bswap16(le[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = l_utf8_from_utf16(buf, len);
|
*out = l_utf8_from_utf16(buf, len);
|
||||||
|
|
Loading…
Reference in New Issue