forked from mirror/go-json
Fix streaming decoder
This commit is contained in:
parent
e0b010dcd8
commit
c5234b8605
|
@ -331,6 +331,11 @@ func decodeKeyByBitmapInt8Stream(d *structDecoder, s *stream) (*structFieldSet,
|
||||||
switch s.char() {
|
switch s.char() {
|
||||||
case ' ', '\n', '\t', '\r':
|
case ' ', '\n', '\t', '\r':
|
||||||
s.cursor++
|
s.cursor++
|
||||||
|
case nul:
|
||||||
|
if s.read() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return nil, "", errNotAtBeginningOfValue(s.totalOffset())
|
||||||
case '"':
|
case '"':
|
||||||
s.cursor++
|
s.cursor++
|
||||||
FIRST_CHAR:
|
FIRST_CHAR:
|
||||||
|
@ -434,6 +439,11 @@ func decodeKeyByBitmapInt16Stream(d *structDecoder, s *stream) (*structFieldSet,
|
||||||
switch s.char() {
|
switch s.char() {
|
||||||
case ' ', '\n', '\t', '\r':
|
case ' ', '\n', '\t', '\r':
|
||||||
s.cursor++
|
s.cursor++
|
||||||
|
case nul:
|
||||||
|
if s.read() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return nil, "", errNotAtBeginningOfValue(s.totalOffset())
|
||||||
case '"':
|
case '"':
|
||||||
s.cursor++
|
s.cursor++
|
||||||
FIRST_CHAR:
|
FIRST_CHAR:
|
||||||
|
@ -585,9 +595,6 @@ func (d *structDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.skipWhiteSpace()
|
s.skipWhiteSpace()
|
||||||
if s.char() == nul {
|
|
||||||
s.read()
|
|
||||||
}
|
|
||||||
c := s.char()
|
c := s.char()
|
||||||
if c == '}' {
|
if c == '}' {
|
||||||
s.cursor++
|
s.cursor++
|
||||||
|
|
Loading…
Reference in New Issue