Use 'const' in 'struct buffer' methods

Although many of the `struct buffer` methods do not mutate `self`, none of them declares `self` `const`. Fix this by doing so when appropriate.