Remove some SSZ compilation warnings

This commit is contained in:
Zahary Karadjov 2020-02-05 15:26:45 +01:00 committed by zah
parent a620c83916
commit 4fb654f2af
2 changed files with 1 additions and 9 deletions

View File

@ -270,8 +270,8 @@ template fromSszBytes*[T; N](_: type TypeWithMaxLen[T, N],
fromSszBytes(T, bytes)
proc readValue*[T](r: var SszReader, val: var T) =
const minimalSize = fixedPortionSize(T)
when isFixedSize(T):
const minimalSize = fixedPortionSize(T)
if r.stream[].ensureBytes(minimalSize):
val = readSszValue(r.stream.readBytes(minimalSize), T)
else:

View File

@ -20,14 +20,6 @@ proc setOutputSize(s: var string, length: int) {.inline.} =
raise newException(MalformedSszError, "SSZ string is too large to fit in memory")
s.setLen length
template assignNullValue(loc: untyped, T: type): auto =
when T is ref|ptr:
loc = nil
elif T is Option:
loc = T()
else:
raise newException(MalformedSszError, "SSZ list element of zero size")
# fromSszBytes copies the wire representation to a Nim variable,
# assuming there's enough data in the buffer
func fromSszBytes*(T: type SomeInteger, data: openarray[byte]): T =