(name string, typ string, fieldLimit uint32)
| 76 | } |
| 77 | |
| 78 | func (d *decodeGen) assignArray(name string, typ string, fieldLimit uint32) { |
| 79 | if !d.p.ok() { |
| 80 | return |
| 81 | } |
| 82 | d.p.printf("\n%s, err = dc.Read%s()", name, typ) |
| 83 | d.p.wrapErrCheck(d.ctx.ArgsStr()) |
| 84 | |
| 85 | // Determine effective limit: field limit > context field limit > file limit |
| 86 | var limit uint32 |
| 87 | var limitName string |
| 88 | |
| 89 | if fieldLimit > 0 { |
| 90 | // Explicit field limit passed as parameter |
| 91 | limit = fieldLimit |
| 92 | limitName = fmt.Sprintf("%d", fieldLimit) |
| 93 | } else if d.ctx.currentFieldArrayLimit != math.MaxUint32 { |
| 94 | // Field limit from context (set during field processing) |
| 95 | limit = d.ctx.currentFieldArrayLimit |
| 96 | limitName = fmt.Sprintf("%d", d.ctx.currentFieldArrayLimit) |
| 97 | } else if d.ctx.arrayLimit != math.MaxUint32 { |
| 98 | // File-level limit |
| 99 | limit = d.ctx.arrayLimit |
| 100 | limitName = fmt.Sprintf("%slimitArrays", d.ctx.limitPrefix) |
| 101 | } |
| 102 | |
| 103 | if limit > 0 && limit != math.MaxUint32 { |
| 104 | d.p.printf("\nif %s > %s {", name, limitName) |
| 105 | d.p.printf("\nerr = msgp.ErrLimitExceeded") |
| 106 | d.p.printf("\nreturn") |
| 107 | d.p.printf("\n}") |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func (d *decodeGen) assignMap(name string, typ string, fieldLimit uint32) { |
| 112 | if !d.p.ok() { |
no test coverage detected