2020-03-21 15:01:59 +00:00
|
|
|
package lz4
|
|
|
|
|
2020-05-30 14:29:47 +00:00
|
|
|
import "errors"
|
2020-03-21 15:01:59 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
// ErrInvalidSourceShortBuffer is returned by UncompressBlock or CompressBLock when a compressed
|
|
|
|
// block is corrupted or the destination buffer is not large enough for the uncompressed data.
|
|
|
|
ErrInvalidSourceShortBuffer = errors.New("lz4: invalid source or destination buffer too short")
|
|
|
|
// ErrInvalid is returned when reading an invalid LZ4 archive.
|
|
|
|
ErrInvalid = errors.New("lz4: bad magic number")
|
|
|
|
// ErrBlockDependency is returned when attempting to decompress an archive created with block dependency.
|
|
|
|
ErrBlockDependency = errors.New("lz4: block dependency not supported")
|
|
|
|
)
|
|
|
|
|
|
|
|
func recoverBlock(e *error) {
|
2020-05-30 14:29:47 +00:00
|
|
|
if recover() != nil && *e == nil {
|
2020-03-21 15:01:59 +00:00
|
|
|
*e = ErrInvalidSourceShortBuffer
|
|
|
|
}
|
|
|
|
}
|