(v *string)
| 14 | return dec.decodeString(v) |
| 15 | } |
| 16 | func (dec *Decoder) decodeString(v *string) error { |
| 17 | for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { |
| 18 | switch dec.data[dec.cursor] { |
| 19 | case ' ', '\n', '\t', '\r', ',': |
| 20 | // is string |
| 21 | continue |
| 22 | case '"': |
| 23 | dec.cursor++ |
| 24 | start, end, err := dec.getString() |
| 25 | if err != nil { |
| 26 | return err |
| 27 | } |
| 28 | // we do minus one to remove the last quote |
| 29 | d := dec.data[start : end-1] |
| 30 | *v = *(*string)(unsafe.Pointer(&d)) |
| 31 | dec.cursor = end |
| 32 | return nil |
| 33 | // is nil |
| 34 | case 'n': |
| 35 | dec.cursor++ |
| 36 | err := dec.assertNull() |
| 37 | if err != nil { |
| 38 | return err |
| 39 | } |
| 40 | return nil |
| 41 | default: |
| 42 | dec.err = dec.makeInvalidUnmarshalErr(v) |
| 43 | err := dec.skipData() |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | return nil |
| 48 | } |
| 49 | } |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func (dec *Decoder) decodeStringNull(v **string) error { |
| 54 | for ; dec.cursor < dec.length || dec.read(); dec.cursor++ { |
no test coverage detected