buffer: remove c-style casts