Skip to content

Commit

Permalink
Fix streaming decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Feb 6, 2021
1 parent e0b010d commit c5234b8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions decode_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ func decodeKeyByBitmapInt8Stream(d *structDecoder, s *stream) (*structFieldSet,
switch s.char() {
case ' ', '\n', '\t', '\r':
s.cursor++
case nul:
if s.read() {
continue
}
return nil, "", errNotAtBeginningOfValue(s.totalOffset())
case '"':
s.cursor++
FIRST_CHAR:
Expand Down Expand Up @@ -434,6 +439,11 @@ func decodeKeyByBitmapInt16Stream(d *structDecoder, s *stream) (*structFieldSet,
switch s.char() {
case ' ', '\n', '\t', '\r':
s.cursor++
case nul:
if s.read() {
continue
}
return nil, "", errNotAtBeginningOfValue(s.totalOffset())
case '"':
s.cursor++
FIRST_CHAR:
Expand Down Expand Up @@ -585,9 +595,6 @@ func (d *structDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
}
}
s.skipWhiteSpace()
if s.char() == nul {
s.read()
}
c := s.char()
if c == '}' {
s.cursor++
Expand Down

0 comments on commit c5234b8

Please sign in to comment.