mirror of
https://github.com/logos-storage/nim-leopard.git
synced 2026-01-03 22:23:12 +00:00
[wip] in early returns can avoid relying on freeAligned to skip null pointer
This commit is contained in:
parent
29993e7a5f
commit
9ac3893a65
@ -165,7 +165,7 @@ proc encode*(code: ReedSolomonCode, data: Data):
|
|||||||
|
|
||||||
for i in 0..<code.data:
|
for i in 0..<code.data:
|
||||||
if data[i].len != symbolBytes:
|
if data[i].len != symbolBytes:
|
||||||
for i in 0..<code.data: freeAligned enData[i]
|
for j in 0..<(i - 1): freeAligned enData[j]
|
||||||
return err LeopardError(code: LeopardInconsistentSize,
|
return err LeopardError(code: LeopardInconsistentSize,
|
||||||
msg: LeopardInconsistentSizeMsg)
|
msg: LeopardInconsistentSizeMsg)
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ proc decode*(code: ReedSolomonCode, data: Data, parityData: ParityData,
|
|||||||
for i in 0..<code.data:
|
for i in 0..<code.data:
|
||||||
if data[i].len != 0:
|
if data[i].len != 0:
|
||||||
if data[i].len != symbolBytes.int:
|
if data[i].len != symbolBytes.int:
|
||||||
for i in 0..<code.data: freeAligned deData[i]
|
for j in 0..<(i - 1): freeAligned deData[j]
|
||||||
return err LeopardError(code: LeopardInconsistentSize,
|
return err LeopardError(code: LeopardInconsistentSize,
|
||||||
msg: LeopardInconsistentSizeMsg)
|
msg: LeopardInconsistentSizeMsg)
|
||||||
|
|
||||||
@ -274,8 +274,8 @@ proc decode*(code: ReedSolomonCode, data: Data, parityData: ParityData,
|
|||||||
for i in 0..<code.parity:
|
for i in 0..<code.parity:
|
||||||
if parityData[i].len != 0:
|
if parityData[i].len != 0:
|
||||||
if parityData[i].len != symbolBytes.int:
|
if parityData[i].len != symbolBytes.int:
|
||||||
for i in 0..<code.data: freeAligned deData[i]
|
for j in 0..<code.data: freeAligned deData[j]
|
||||||
for i in 0..<code.parity: freeAligned paData[i]
|
for j in 0..<(i - 1): freeAligned paData[j]
|
||||||
return err LeopardError(code: LeopardInconsistentSize,
|
return err LeopardError(code: LeopardInconsistentSize,
|
||||||
msg: LeopardInconsistentSizeMsg)
|
msg: LeopardInconsistentSizeMsg)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user