diff --git a/src/classic.jl b/src/classic.jl index 4d45d4c..3f07083 100644 --- a/src/classic.jl +++ b/src/classic.jl @@ -51,11 +51,14 @@ function write_finish(patch::ClassicPatch) for stream in (patch.ctrl, patch.diff, patch.data) write(stream, TranscodingStreams.TOKEN_END) end - write_int(patch.io, patch.ctrl.stream.size) - write_int(patch.io, patch.diff.stream.size) + ctrl_v = take!(patch.ctrl.stream) + diff_v = take!(patch.diff.stream) + data_v = take!(patch.data.stream) + write_int(patch.io, length(ctrl_v)) + write_int(patch.io, length(diff_v)) write_int(patch.io, patch.new_size) - for stream in (patch.ctrl, patch.diff, patch.data) - write(patch.io, resize!(stream.stream.data, stream.stream.size)) + for v in (ctrl_v, diff_v, data_v) + write(patch.io, v) end flush(patch.io) finalize(patch)