diff --git a/src/common/lz4_compression.cpp b/src/common/lz4_compression.cpp index 25700015a..dbb40da7c 100644 --- a/src/common/lz4_compression.cpp +++ b/src/common/lz4_compression.cpp @@ -59,8 +59,7 @@ std::vector CompressDataLZ4HCMax(const u8* source, std::size_t source_size) return CompressDataLZ4HC(source, source_size, LZ4HC_CLEVEL_MAX); } -std::vector DecompressDataLZ4(const std::vector& compressed, - std::size_t uncompressed_size) { +std::vector DecompressDataLZ4(std::span compressed, std::size_t uncompressed_size) { std::vector uncompressed(uncompressed_size); const int size_check = LZ4_decompress_safe(reinterpret_cast(compressed.data()), reinterpret_cast(uncompressed.data()), diff --git a/src/common/lz4_compression.h b/src/common/lz4_compression.h index 87a4be1b0..1b4717595 100644 --- a/src/common/lz4_compression.h +++ b/src/common/lz4_compression.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "common/common_types.h" @@ -53,7 +54,7 @@ namespace Common::Compression { * * @return the decompressed data. */ -[[nodiscard]] std::vector DecompressDataLZ4(const std::vector& compressed, +[[nodiscard]] std::vector DecompressDataLZ4(std::span compressed, std::size_t uncompressed_size); -} // namespace Common::Compression \ No newline at end of file +} // namespace Common::Compression diff --git a/src/common/zstd_compression.cpp b/src/common/zstd_compression.cpp index 5f45459da..695b96a43 100644 --- a/src/common/zstd_compression.cpp +++ b/src/common/zstd_compression.cpp @@ -32,7 +32,7 @@ std::vector CompressDataZSTDDefault(const u8* source, std::size_t source_siz return CompressDataZSTD(source, source_size, ZSTD_CLEVEL_DEFAULT); } -std::vector DecompressDataZSTD(const std::vector& compressed) { +std::vector DecompressDataZSTD(std::span compressed) { const std::size_t decompressed_size = ZSTD_getDecompressedSize(compressed.data(), compressed.size()); std::vector decompressed(decompressed_size); diff --git a/src/common/zstd_compression.h b/src/common/zstd_compression.h index c26a30ab9..bbce14f4e 100644 --- a/src/common/zstd_compression.h +++ b/src/common/zstd_compression.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "common/common_types.h" @@ -40,6 +41,6 @@ namespace Common::Compression { * * @return the decompressed data. */ -[[nodiscard]] std::vector DecompressDataZSTD(const std::vector& compressed); +[[nodiscard]] std::vector DecompressDataZSTD(std::span compressed); -} // namespace Common::Compression \ No newline at end of file +} // namespace Common::Compression