MCPcopy
hub / github.com/rs/zerolog / decodeString

Function decodeString

internal/cbor/decode_stream.go:197–216  ·  view source on GitHub ↗
(src *bufio.Reader, noQuotes bool)

Source from the content-addressed store, hash-verified

195}
196
197func decodeString(src *bufio.Reader, noQuotes bool) []byte {
198 pb := readByte(src)
199 major := pb & maskOutAdditionalType
200 minor := pb & maskOutMajorType
201 if major != majorTypeByteString {
202 panic(fmt.Errorf("Major type is: %d in decodeString", major))
203 }
204 result := []byte{}
205 if !noQuotes {
206 result = append(result, '"')
207 }
208 length := decodeIntAdditionalType(src, minor)
209 len := int(length)
210 pbs := readNBytes(src, len)
211 result = append(result, pbs...)
212 if noQuotes {
213 return result
214 }
215 return append(result, '"')
216}
217func decodeStringToDataUrl(src *bufio.Reader, mimeType string) []byte {
218 pb := readByte(src)
219 major := pb & maskOutAdditionalType

Callers 2

decodeTagDataFunction · 0.85
cbor2JsonOneObjectFunction · 0.85

Calls 3

readByteFunction · 0.85
decodeIntAdditionalTypeFunction · 0.85
readNBytesFunction · 0.85

Tested by

no test coverage detected