From 53792a1f58a712dd715c75a34dd31120a369a63c Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Fri, 31 Jul 2020 18:07:11 +0900 Subject: [PATCH] Fix stream decoder bug --- decode_float.go | 1 + decode_int.go | 2 ++ decode_uint.go | 1 + 3 files changed, 4 insertions(+) diff --git a/decode_float.go b/decode_float.go index 2cdabe2..3393a6c 100644 --- a/decode_float.go +++ b/decode_float.go @@ -37,6 +37,7 @@ func floatBytes(s *stream) []byte { continue } else if s.char() == nul { if s.read() { + s.cursor-- // for retry current character continue } } diff --git a/decode_int.go b/decode_int.go index 676490d..3db1f45 100644 --- a/decode_int.go +++ b/decode_int.go @@ -63,6 +63,7 @@ func (d *intDecoder) decodeStreamByte(s *stream) ([]byte, error) { continue } else if s.char() == nul { if s.read() { + s.cursor-- // for retry current character continue } } @@ -82,6 +83,7 @@ func (d *intDecoder) decodeStreamByte(s *stream) ([]byte, error) { continue } else if s.char() == nul { if s.read() { + s.cursor-- // for retry current character continue } } diff --git a/decode_uint.go b/decode_uint.go index 0048e60..5ab2277 100644 --- a/decode_uint.go +++ b/decode_uint.go @@ -38,6 +38,7 @@ func (d *uintDecoder) decodeStreamByte(s *stream) ([]byte, error) { continue } else if s.char() == nul { if s.read() { + s.cursor-- // for retry current character continue } }