Skip to content

Commit

Permalink
Add missing include headers
Browse files Browse the repository at this point in the history
  • Loading branch information
nbougalis committed Jan 9, 2021
1 parent c76a124 commit b015623
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/ripple/basics/CompressionAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,15 @@

#include <ripple/basics/contract.h>
#include <algorithm>
#include <cstdint>
#include <lz4.h>
#include <stdexcept>
#include <vector>

namespace ripple {

namespace compression_algorithms {

/** Convenience wrapper for Throw
* @param message Message to log/throw
*/
inline void
doThrow(const char* message)
{
Throw<std::runtime_error>(message);
}

/** LZ4 block compression.
* @tparam BufferFactory Callable object or lambda.
* Takes the requested buffer size and returns allocated buffer pointer.
Expand All @@ -50,7 +44,7 @@ std::size_t
lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
{
if (inSize > UINT32_MAX)
doThrow("lz4 compress: invalid size");
Throw<std::runtime_error>("lz4 compress: invalid size");

auto const outCapacity = LZ4_compressBound(inSize);

Expand All @@ -64,7 +58,7 @@ lz4Compress(void const* in, std::size_t inSize, BufferFactory&& bf)
inSize,
outCapacity);
if (compressedSize == 0)
doThrow("lz4 compress: failed");
Throw<std::runtime_error>("lz4 compress: failed");

return compressedSize;
}
Expand All @@ -90,7 +84,7 @@ lz4Decompress(
decompressedSize);

if (ret <= 0 || ret != decompressedSize)
doThrow("lz4 decompress: failed");
Throw<std::runtime_error>("lz4 decompress: failed");

return decompressedSize;
}
Expand Down Expand Up @@ -153,7 +147,7 @@ lz4Decompress(

if ((copiedInSize == 0 && chunkSize < inSize) ||
(copiedInSize > 0 && copiedInSize != inSize))
doThrow("lz4 decompress: insufficient input size");
Throw<std::runtime_error>("lz4 decompress: insufficient input size");

return lz4Decompress(chunk, inSize, decompressed, decompressedSize);
}
Expand Down
1 change: 1 addition & 0 deletions src/ripple/protocol/SOTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <functional>
#include <initializer_list>
#include <memory>
#include <stdexcept>

namespace ripple {

Expand Down

0 comments on commit b015623

Please sign in to comment.