buffer: no warning when encoding isn't passed

Buffer#write() was showing the deprecation warning when only
buf.write('string') was passed. This is incorrect since the encoding is
always optional.

Argument order should follow:
  Buffer#write(string[, offset[, length]][encoding])

(yeah, not confusing at all)
src: make buffer size errors more explicit

Fixes #6490
buffer: convert values to uint, not int

In many cases values expected to be unsigned were converted to a signed
integer.

Also include some small code cleanup.