MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / bytesLen

Method bytesLen

decode_string.go:10–32  ·  view source on GitHub ↗
(c byte)

Source from the content-addressed store, hash-verified

8)
9
10func (d *Decoder) bytesLen(c byte) (int, error) {
11 if c == msgpcode.Nil {
12 return -1, nil
13 }
14
15 if msgpcode.IsFixedString(c) {
16 return int(c & msgpcode.FixedStrMask), nil
17 }
18
19 switch c {
20 case msgpcode.Str8, msgpcode.Bin8:
21 n, err := d.uint8()
22 return int(n), err
23 case msgpcode.Str16, msgpcode.Bin16:
24 n, err := d.uint16()
25 return int(n), err
26 case msgpcode.Str32, msgpcode.Bin32:
27 n, err := d.uint32()
28 return int(n), err
29 }
30
31 return 0, fmt.Errorf("msgpack: invalid code=%x decoding string/bytes length", c)
32}
33
34func (d *Decoder) DecodeString() (string, error) {
35 if intern := d.flags&useInternedStringsFlag != 0; intern || len(d.dict) > 0 {

Callers 7

stringMethod · 0.95
DecodeBytesLenMethod · 0.95
bytesMethod · 0.95
decodeStringTempMethod · 0.95
bytesPtrMethod · 0.95
skipBytesMethod · 0.95
decodeByteArrayValueFunction · 0.80

Calls 4

uint8Method · 0.95
uint16Method · 0.95
uint32Method · 0.95
IsFixedStringFunction · 0.92

Tested by

no test coverage detected