(b []byte, size uint32)
| 107 | } |
| 108 | |
| 109 | func encodeSize(b []byte, size uint32) int { |
| 110 | if size > 127 { |
| 111 | size |= 1 << 31 |
| 112 | binary.BigEndian.PutUint32(b, size) |
| 113 | return 4 |
| 114 | } |
| 115 | b[0] = byte(size) //nolint:gosec // false positive; b is made 8 bytes long, then this function is always called with b being at least 4 or 1 byte long |
| 116 | return 1 |
| 117 | } |
| 118 | |
| 119 | // writeHeader populate header wire data in buf, it abuses buffer.Bytes() modification |
| 120 | func (w *streamWriter) writeHeader() { |