diff options
author | baude <bbaude@redhat.com> | 2019-06-20 15:05:29 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-06-20 15:14:09 -0500 |
commit | 7e4d75eb8b74c62e44c7b1be93dd338695814c92 (patch) | |
tree | 04c929c4e992ccb1813e1e7f7b946feb138a3c96 /vendor/github.com/DataDog/zstd/errors.go | |
parent | 1fad6b74f2a6360b26afbeea1a1705cfd42b6ca7 (diff) | |
download | podman-7e4d75eb8b74c62e44c7b1be93dd338695814c92.tar.gz podman-7e4d75eb8b74c62e44c7b1be93dd338695814c92.tar.bz2 podman-7e4d75eb8b74c62e44c7b1be93dd338695814c92.zip |
vendor containers/storage v1.12.11
vendor cs with overlay caching
cs also carries a dep on github.com/DataDog/zstd
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'vendor/github.com/DataDog/zstd/errors.go')
-rw-r--r-- | vendor/github.com/DataDog/zstd/errors.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/DataDog/zstd/errors.go b/vendor/github.com/DataDog/zstd/errors.go new file mode 100644 index 000000000..38db0d51c --- /dev/null +++ b/vendor/github.com/DataDog/zstd/errors.go @@ -0,0 +1,35 @@ +package zstd + +/* +#define ZSTD_STATIC_LINKING_ONLY +#include "zstd.h" +*/ +import "C" + +// ErrorCode is an error returned by the zstd library. +type ErrorCode int + +// Error returns the error string given by zstd +func (e ErrorCode) Error() string { + return C.GoString(C.ZSTD_getErrorName(C.size_t(e))) +} + +func cIsError(code int) bool { + return int(C.ZSTD_isError(C.size_t(code))) != 0 +} + +// getError returns an error for the return code, or nil if it's not an error +func getError(code int) error { + if code < 0 && cIsError(code) { + return ErrorCode(code) + } + return nil +} + +// IsDstSizeTooSmallError returns whether the error correspond to zstd standard sDstSizeTooSmall error +func IsDstSizeTooSmallError(e error) bool { + if e != nil && e.Error() == "Destination buffer is too small" { + return true + } + return false +} |