Cpp: fixed write_data by chunks.
Fixed prepare size - for write with offset it should includes offset and file size