summaryrefslogtreecommitdiff
path: root/vendor/github.com/goccy/go-json/decode_unmarshal_json.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-10 14:42:14 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-10 14:42:14 +0200
commitf2e5bedea6fb93fbbf68ed8f7153c353cc57a9f0 (patch)
tree475ae9e7470d0df670ab2a59dce351cd1d07498a /vendor/github.com/goccy/go-json/decode_unmarshal_json.go
parentfixes + db changes (#204) (diff)
downloadgotosocial-f2e5bedea6fb93fbbf68ed8f7153c353cc57a9f0.tar.xz
migrate go version to 1.17 (#203)
* migrate go version to 1.17 * update contributing
Diffstat (limited to 'vendor/github.com/goccy/go-json/decode_unmarshal_json.go')
-rw-r--r--vendor/github.com/goccy/go-json/decode_unmarshal_json.go72
1 files changed, 0 insertions, 72 deletions
diff --git a/vendor/github.com/goccy/go-json/decode_unmarshal_json.go b/vendor/github.com/goccy/go-json/decode_unmarshal_json.go
deleted file mode 100644
index faa593bbe..000000000
--- a/vendor/github.com/goccy/go-json/decode_unmarshal_json.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package json
-
-import (
- "unsafe"
-)
-
-type unmarshalJSONDecoder struct {
- typ *rtype
- structName string
- fieldName string
-}
-
-func newUnmarshalJSONDecoder(typ *rtype, structName, fieldName string) *unmarshalJSONDecoder {
- return &unmarshalJSONDecoder{
- typ: typ,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *unmarshalJSONDecoder) annotateError(cursor int64, err error) {
- switch e := err.(type) {
- case *UnmarshalTypeError:
- e.Struct = d.structName
- e.Field = d.fieldName
- case *SyntaxError:
- e.Offset = cursor
- }
-}
-
-func (d *unmarshalJSONDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) error {
- s.skipWhiteSpace()
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- if err := v.(Unmarshaler).UnmarshalJSON(dst); err != nil {
- d.annotateError(s.cursor, err)
- return err
- }
- return nil
-}
-
-func (d *unmarshalJSONDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- if err := v.(Unmarshaler).UnmarshalJSON(dst); err != nil {
- d.annotateError(cursor, err)
- return 0, err
- }
- return end, nil
-}