| 192 | } |
| 193 | |
| 194 | int pn_buffer_trim(pn_buffer_t *buf, size_t left, size_t right) |
| 195 | { |
| 196 | if (left + right > buf->size) return PN_ARG_ERR; |
| 197 | |
| 198 | // In special case where we trim everything just clear buffer |
| 199 | if (left + right == buf->size) { |
| 200 | pn_buffer_clear(buf); |
| 201 | return 0; |
| 202 | } |
| 203 | buf->start += left; |
| 204 | if (buf->start >= buf->capacity) |
| 205 | buf->start -= buf->capacity; |
| 206 | |
| 207 | buf->size -= left + right; |
| 208 | |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | void pn_buffer_clear(pn_buffer_t *buf) |
| 213 | { |
no test coverage detected