diff options
author | Lioncash <mathew1800@gmail.com> | 2020-08-14 09:38:45 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-08-15 17:17:52 -0400 |
commit | df7248039553b3ebd338380c3ef0428b0e046e79 (patch) | |
tree | eca7153300e311ac7954f5c085fdada0c7295699 /src/common/lz4_compression.h | |
parent | 2b601e86360ea47df5b3cb1a280177f428763837 (diff) |
common: Make use of [[nodiscard]] where applicable
Now that clang-format makes [[nodiscard]] attributes format sensibly, we
can apply them to several functions within the common library to allow
the compiler to complain about any misuses of the functions.
Diffstat (limited to 'src/common/lz4_compression.h')
-rw-r--r-- | src/common/lz4_compression.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/lz4_compression.h b/src/common/lz4_compression.h index 173f9b9ad..088ff5c91 100644 --- a/src/common/lz4_compression.h +++ b/src/common/lz4_compression.h @@ -18,7 +18,7 @@ namespace Common::Compression { * * @return the compressed data. */ -std::vector<u8> CompressDataLZ4(std::span<const u8> source); +[[nodiscard]] std::vector<u8> CompressDataLZ4(std::span<const u8> source); /** * Utilizes the LZ4 subalgorithm LZ4HC with the specified compression level. Higher compression @@ -31,7 +31,7 @@ std::vector<u8> CompressDataLZ4(std::span<const u8> source); * * @return the compressed data. */ -std::vector<u8> CompressDataLZ4HC(std::span<const u8> source, s32 compression_level); +[[nodiscard]] std::vector<u8> CompressDataLZ4HC(std::span<const u8> source, s32 compression_level); /** * Utilizes the LZ4 subalgorithm LZ4HC with the highest possible compression level. @@ -40,7 +40,7 @@ std::vector<u8> CompressDataLZ4HC(std::span<const u8> source, s32 compression_le * * @return the compressed data. */ -std::vector<u8> CompressDataLZ4HCMax(std::span<const u8> source); +[[nodiscard]] std::vector<u8> CompressDataLZ4HCMax(std::span<const u8> source); /** * Decompresses a source memory region with LZ4 and returns the uncompressed data in a vector. @@ -50,6 +50,7 @@ std::vector<u8> CompressDataLZ4HCMax(std::span<const u8> source); * * @return the decompressed data. */ -std::vector<u8> DecompressDataLZ4(const std::vector<u8>& compressed, std::size_t uncompressed_size); +[[nodiscard]] std::vector<u8> DecompressDataLZ4(const std::vector<u8>& compressed, + std::size_t uncompressed_size); } // namespace Common::Compression
\ No newline at end of file |