mirror of https://github.com/goccy/go-json.git
Fix array decoder
This commit is contained in:
parent
3ffbfe413f
commit
44ae468930
|
@ -102,11 +102,19 @@ func (d *arrayDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (int64
|
||||||
idx := 0
|
idx := 0
|
||||||
for {
|
for {
|
||||||
cursor++
|
cursor++
|
||||||
c, err := d.valueDecoder.decode(buf, cursor, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size))
|
if idx < d.alen {
|
||||||
if err != nil {
|
c, err := d.valueDecoder.decode(buf, cursor, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size))
|
||||||
return 0, err
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
cursor = c
|
||||||
|
} else {
|
||||||
|
c, err := skipValue(buf, cursor)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
cursor = c
|
||||||
}
|
}
|
||||||
cursor = c
|
|
||||||
cursor = skipWhiteSpace(buf, cursor)
|
cursor = skipWhiteSpace(buf, cursor)
|
||||||
switch buf[cursor] {
|
switch buf[cursor] {
|
||||||
case ']':
|
case ']':
|
||||||
|
|
Loading…
Reference in New Issue