mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-02 04:42:33 +00:00
core/protobuf: use utils.decode_bytes
This commit is contained in:
parent
355c7fcbd5
commit
d8e06d487b
@ -5,6 +5,8 @@ bytes, string, embedded message and repeated fields.
|
|||||||
|
|
||||||
from micropython import const
|
from micropython import const
|
||||||
|
|
||||||
|
from trezor.utils import decode_bytes
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from typing import Any, Dict, Iterable, List, Tuple, Type, TypeVar, Union
|
from typing import Any, Dict, Iterable, List, Tuple, Type, TypeVar, Union
|
||||||
from typing_extensions import Protocol
|
from typing_extensions import Protocol
|
||||||
@ -257,7 +259,7 @@ def load_message(
|
|||||||
elif ftype is UnicodeType:
|
elif ftype is UnicodeType:
|
||||||
fvalue = bytearray(ivalue)
|
fvalue = bytearray(ivalue)
|
||||||
reader.readinto(fvalue)
|
reader.readinto(fvalue)
|
||||||
fvalue = bytes(fvalue).decode()
|
fvalue = decode_bytes(fvalue)
|
||||||
elif issubclass(ftype, MessageType):
|
elif issubclass(ftype, MessageType):
|
||||||
fvalue = load_message(LimitedReader(reader, ivalue), ftype, field_cache)
|
fvalue = load_message(LimitedReader(reader, ivalue), ftype, field_cache)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user