blob: d5b0a59cb4caa653d097ad32749c5723c4a773e7 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "engine.h"
#include <zstd/zstd.h>
int64_t DecompressorEngine::operator()(byte_view input, std::byte* output, size_t output_size) {
auto rc = ZSTD_decompress(output, output_size, input.data(), input.size());
if (ZSTD_isError(rc) || rc != output_size) {
return ZX_ERR_IO_DATA_INTEGRITY;
}
return ZX_OK;
}