[buffer] use promoted type and made variables const