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

Method readBytesConvertWithLimit

gen/decode.go:329–342  ·  view source on GitHub ↗
(tmp string, allowNil bool, receiverVar string)

Source from the content-addressed store, hash-verified

327}
328
329func (d *decodeGen) readBytesConvertWithLimit(tmp string, allowNil bool, receiverVar string) {
330 if !d.p.ok() {
331 return
332 }
333
334 // Check if limits exist to decide on reading strategy
335 if d.ctx.currentFieldArrayLimit != math.MaxUint32 || d.ctx.arrayLimit != math.MaxUint32 {
336 // No limits - use original efficient approach with receiver cast as destination
337 d.p.printf("\n%s, err = dc.ReadBytesLimit(%s, %d)", tmp, receiverVar, min(d.ctx.currentFieldArrayLimit, d.ctx.arrayLimit))
338 } else {
339 // No limits - use original efficient approach with receiver cast as destination
340 d.p.printf("\n%s, err = dc.ReadBytes(%s)", tmp, receiverVar)
341 }
342}
343
344func (d *decodeGen) gBase(b *BaseElem) {
345 if !d.p.ok() {

Callers 1

gBaseMethod · 0.95

Calls 2

okMethod · 0.80
printfMethod · 0.80

Tested by

no test coverage detected