@ -33,7 +33,8 @@ import (
// - base time delta: 8 bytes
// - base value delta: 8 bytes
const (
doubleDeltaHeaderBytes = 37
doubleDeltaHeaderBytes = 37
doubleDeltaHeaderMinBytes = 21 // header isn't full for chunk w/ one sample
doubleDeltaHeaderBufLenOffset = 0
doubleDeltaHeaderTimeBytesOffset = 2
@ -250,8 +251,8 @@ func (c *doubleDeltaEncodedChunk) unmarshal(r io.Reader) error {
if int ( l ) > cap ( * c ) {
return fmt . Errorf ( "chunk length exceeded during unmarshaling: %d" , l )
}
if int ( l ) < doubleDeltaHeader Bytes {
return fmt . Errorf ( "chunk length less than header size: %d < %d" , l , doubleDeltaHeader Bytes)
if int ( l ) < doubleDeltaHeader Min Bytes {
return fmt . Errorf ( "chunk length less than header size: %d < %d" , l , doubleDeltaHeader Min Bytes)
}
* c = ( * c ) [ : l ]
@ -266,8 +267,8 @@ func (c *doubleDeltaEncodedChunk) unmarshalFromBuf(buf []byte) error {
if int ( l ) > cap ( * c ) {
return fmt . Errorf ( "chunk length exceeded during unmarshaling: %d" , l )
}
if int ( l ) < doubleDeltaHeader Bytes {
return fmt . Errorf ( "chunk length less than header size: %d < %d" , l , doubleDeltaHeader Bytes)
if int ( l ) < doubleDeltaHeader Min Bytes {
return fmt . Errorf ( "chunk length less than header size: %d < %d" , l , doubleDeltaHeader Min Bytes)
}
* c = ( * c ) [ : l ]
return nil