MCPcopy Index your code
hub / github.com/tinylib/msgp / rwString

Function rwString

msgp/json.go:372–419  ·  view source on GitHub ↗
(dst jsWriter, src *Reader)

Source from the content-addressed store, hash-verified

370}
371
372func rwString(dst jsWriter, src *Reader) (n int, err error) {
373 lead, err := src.R.PeekByte()
374 if err != nil {
375 return
376 }
377 var read int
378 var p []byte
379 if isfixstr(lead) {
380 read = int(rfixstr(lead))
381 src.R.Skip(1)
382 goto write
383 }
384
385 switch lead {
386 case mstr8:
387 p, err = src.R.Next(2)
388 if err != nil {
389 return
390 }
391 read = int(p[1])
392 case mstr16:
393 p, err = src.R.Next(3)
394 if err != nil {
395 return
396 }
397 read = int(big.Uint16(p[1:]))
398 case mstr32:
399 p, err = src.R.Next(5)
400 if err != nil {
401 return
402 }
403 read = int(big.Uint32(p[1:]))
404 default:
405 err = badPrefix(StrType, lead)
406 return
407 }
408write:
409 if uint64(read) > src.GetMaxStringLength() {
410 err = ErrLimitExceeded
411 return
412 }
413 p, err = src.R.Next(read)
414 if err != nil {
415 return
416 }
417 n, err = rwquoted(dst, p)
418 return
419}
420
421func rwBytes(dst jsWriter, src *Reader) (n int, err error) {
422 var nn int

Callers

nothing calls this directly

Calls 6

isfixstrFunction · 0.85
rfixstrFunction · 0.85
badPrefixFunction · 0.85
rwquotedFunction · 0.85
SkipMethod · 0.80
GetMaxStringLengthMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…