mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-06 16:05:05 +02:00
...
This commit is contained in:
@@ -82,6 +82,7 @@ func (self *Operation) Unserialize(data []byte) (n int, err error) {
|
||||
return -1, io.ErrShortBuffer
|
||||
}
|
||||
self.BlockIndex = bin.Uint64(data[1:])
|
||||
self.Data = nil
|
||||
case OpBlockRange:
|
||||
n = 13
|
||||
if len(data) < n {
|
||||
@@ -89,6 +90,7 @@ func (self *Operation) Unserialize(data []byte) (n int, err error) {
|
||||
}
|
||||
self.BlockIndex = bin.Uint64(data[1:])
|
||||
self.BlockIndexEnd = self.BlockIndex + uint64(bin.Uint32(data[9:]))
|
||||
self.Data = nil
|
||||
case OpHash:
|
||||
n = 3
|
||||
if len(data) < n {
|
||||
|
||||
@@ -116,7 +116,9 @@ func (self *Patcher) update_delta(data []byte) (consumed int, err error) {
|
||||
if err = self.rsync.ApplyDelta(self.delta_output, self.delta_input, op); err != nil {
|
||||
return
|
||||
}
|
||||
self.total_data_in_delta += len(op.Data)
|
||||
if op.Type == OpData {
|
||||
self.total_data_in_delta += len(op.Data)
|
||||
}
|
||||
} else {
|
||||
if n < 0 {
|
||||
return consumed, nil
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestRsyncRoundtrip(t *testing.T) {
|
||||
|
||||
random_patch := func(data []byte) (size int) {
|
||||
if offset := random.Int(len(data)); offset < len(data) {
|
||||
max_size := utils.Min(256, len(data)-offset)
|
||||
max_size := utils.Min(257, len(data)-offset)
|
||||
if size = random.Int(max_size); size > 0 {
|
||||
total_patch_size += size
|
||||
random.Bytes(data[offset : offset+size])
|
||||
|
||||
Reference in New Issue
Block a user