mirror of
https://github.com/romanz/amodem.git
synced 2026-04-20 21:26:39 +08:00
rename variables in ecc.decode()
This commit is contained in:
12
ecc.py
12
ecc.py
@@ -36,14 +36,14 @@ def encode(data, nsym=DEFAULT_NSYM):
|
|||||||
def decode(data, nsym=DEFAULT_NSYM):
|
def decode(data, nsym=DEFAULT_NSYM):
|
||||||
|
|
||||||
last_chunk = end_of_stream(BLOCK_SIZE - nsym - 1)
|
last_chunk = end_of_stream(BLOCK_SIZE - nsym - 1)
|
||||||
for _, chunk in common.iterate(data, BLOCK_SIZE):
|
for _, block in common.iterate(data, BLOCK_SIZE):
|
||||||
chunk = bytearray(rs_correct_msg(chunk, nsym))
|
chunk = bytearray(rs_correct_msg(block, nsym))
|
||||||
if chunk == last_chunk:
|
if chunk == last_chunk:
|
||||||
return # end of stream
|
return # end of stream
|
||||||
|
|
||||||
size = chunk[0]
|
size = chunk[0]
|
||||||
chunk = chunk[1:]
|
payload = chunk[1:]
|
||||||
if size > len(chunk):
|
if size > len(payload):
|
||||||
raise ValueError('Invalid chunk', size, len(chunk), chunk)
|
raise ValueError('Invalid chunk', size, len(payload), payload)
|
||||||
|
|
||||||
yield chunk[:size]
|
yield payload[:size]
|
||||||
|
|||||||
Reference in New Issue
Block a user