mirror of https://github.com/goccy/go-json.git
Fix streaming decoder for float value
This commit is contained in:
parent
1d1572fb55
commit
76baae6ce8
|
@ -114,9 +114,6 @@ func (d *floatDecoder) decodeStream(s *stream, p unsafe.Pointer) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !validEndNumberChar[s.char()] {
|
||||
return errUnexpectedEndOfJSON("float", s.totalOffset())
|
||||
}
|
||||
str := *(*string)(unsafe.Pointer(&bytes))
|
||||
f64, err := strconv.ParseFloat(str, 64)
|
||||
if err != nil {
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"reflect"
|
||||
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -186,7 +187,6 @@ func nlines(s string, n int) string {
|
|||
return s
|
||||
}
|
||||
|
||||
/*
|
||||
func TestDecoder(t *testing.T) {
|
||||
for i := 0; i <= len(streamTest); i++ {
|
||||
// Use stream without newlines as input,
|
||||
|
@ -218,7 +218,6 @@ func TestDecoder(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestDecoderBuffered(t *testing.T) {
|
||||
r := strings.NewReader(`{"Name": "Gopher"} extra `)
|
||||
|
|
Loading…
Reference in New Issue