wp
This commit is contained in:
@@ -190,7 +190,7 @@ func (s *InstantDeltaCompressor) Size() int {
|
||||
if s.state == nil {
|
||||
return s.pos
|
||||
} else {
|
||||
return len(s.state.Payload)
|
||||
return bin.CountVarInt64(s.state.LastDelta) + hSize + len(s.state.Payload)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,18 +205,9 @@ func (s *InstantDeltaCompressor) Payload() []byte {
|
||||
|
||||
func (s *InstantDeltaCompressor) WritePayloadTo(w io.Writer) (err error) {
|
||||
if s.state == nil {
|
||||
err = bin.WriteUint16(w, uint16(s.pos))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = w.Write(s.buf[:s.pos])
|
||||
return
|
||||
} else {
|
||||
size := bin.CountVarInt64(s.state.LastDelta) + hSize + len(s.state.Payload)
|
||||
err = bin.WriteUint16(w, uint16(size))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = w.Write(s.state.Payload)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -225,7 +216,7 @@ func (s *InstantDeltaCompressor) WritePayloadTo(w io.Writer) (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
w.Write([]byte{
|
||||
_, err = w.Write([]byte{
|
||||
s.state.H,
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user