1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-15 01:40:57 +00:00

core: fix style

This commit is contained in:
Pavol Rusnak 2019-06-22 00:18:31 +02:00
parent e432c37df0
commit 312224b7a3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 6 additions and 4 deletions

View File

@ -91,7 +91,8 @@ STATIC mp_obj_t mod_trezorio_SDCard_read(mp_obj_t self, mp_obj_t block_num,
uint32_t block = trezor_obj_get_uint(block_num); uint32_t block = trezor_obj_get_uint(block_num);
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE); mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
if (sectrue != sdcard_read_blocks(bufinfo.buf, block, bufinfo.len / SDCARD_BLOCK_SIZE)) { if (sectrue !=
sdcard_read_blocks(bufinfo.buf, block, bufinfo.len / SDCARD_BLOCK_SIZE)) {
mp_raise_OSError(MP_EIO); mp_raise_OSError(MP_EIO);
} }
return mp_const_none; return mp_const_none;
@ -110,7 +111,8 @@ STATIC mp_obj_t mod_trezorio_SDCard_write(mp_obj_t self, mp_obj_t block_num,
uint32_t block = trezor_obj_get_uint(block_num); uint32_t block = trezor_obj_get_uint(block_num);
mp_buffer_info_t bufinfo; mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ); mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
if (sectrue != sdcard_write_blocks(bufinfo.buf, block, bufinfo.len / SDCARD_BLOCK_SIZE)) { if (sectrue != sdcard_write_blocks(bufinfo.buf, block,
bufinfo.len / SDCARD_BLOCK_SIZE)) {
mp_raise_OSError(MP_EIO); mp_raise_OSError(MP_EIO);
} }
return mp_const_none; return mp_const_none;

View File

@ -115,14 +115,14 @@ class SDCard:
Returns capacity of the SD card in bytes, or zero if not present. Returns capacity of the SD card in bytes, or zero if not present.
""" """
def read(self, block_num: int, buf: bytearray) -> bool: def read(self, block_num: int, buf: bytearray) -> None:
""" """
Reads blocks starting with block_num from the SD card into buf. Reads blocks starting with block_num from the SD card into buf.
Number of bytes read is length of buf rounded down to multiply of Number of bytes read is length of buf rounded down to multiply of
SDCARD_BLOCK_SIZE. Returns True if in case of success, False otherwise. SDCARD_BLOCK_SIZE. Returns True if in case of success, False otherwise.
""" """
def write(self, block_num: int, buf: bytes) -> bool: def write(self, block_num: int, buf: bytes) -> None:
""" """
Writes blocks starting with block_num from buf to the SD card. Writes blocks starting with block_num from buf to the SD card.
Number of bytes written is length of buf rounded down to multiply of Number of bytes written is length of buf rounded down to multiply of