MCPcopy
hub / github.com/tinylib/msgp / ReadExtensionRaw

Method ReadExtensionRaw

msgp/extension.go:405–420  ·  view source on GitHub ↗

ReadExtensionRaw reads the next object from the reader as an extension. The returned slice is only valid until the next *Reader method call.

()

Source from the content-addressed store, hash-verified

403// as an extension. The returned slice is only
404// valid until the next *Reader method call.
405func (m *Reader) ReadExtensionRaw() (int8, []byte, error) {
406 offset, length, extType, err := m.peekExtensionHeader()
407 if err != nil {
408 return 0, nil, err
409 }
410 if uint32(length) > m.GetMaxElements() {
411 return 0, nil, ErrLimitExceeded
412 }
413
414 payload, err := m.R.Next(offset + length)
415 if err != nil {
416 return 0, nil, err
417 }
418
419 return extType, payload[offset:], nil
420}
421
422// AppendExtension appends a MessagePack extension to the provided slice
423func AppendExtension(b []byte, e Extension) ([]byte, error) {

Callers 6

FuzzReaderFunction · 0.95
TestReadWriteExtensionFunction · 0.95
checkExtMinusOneFunction · 0.95

Calls 2

peekExtensionHeaderMethod · 0.95
GetMaxElementsMethod · 0.95

Tested by 6

FuzzReaderFunction · 0.76
TestReadWriteExtensionFunction · 0.76
checkExtMinusOneFunction · 0.76