fix the returned length for c_buffer_extract_string()
document the return value of c_buffer_remove*() functions
fix c_buffer_write()