aboutsummaryrefslogtreecommitdiff
path: root/zencore/compress.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-16 10:13:28 +0200
committerMartin Ridgers <[email protected]>2021-09-16 10:13:58 +0200
commit7aa3ceabe4254479bd066ae3ea941396fdc6733c (patch)
treea7d0a7fde0a5a3c42302238965c25c665fc28005 /zencore/compress.cpp
parentMissing include (diff)
parentAdded some placeholder HttpClient functions to be fleshed out (diff)
downloadzen-7aa3ceabe4254479bd066ae3ea941396fdc6733c.tar.xz
zen-7aa3ceabe4254479bd066ae3ea941396fdc6733c.zip
Merge from main
Diffstat (limited to 'zencore/compress.cpp')
-rw-r--r--zencore/compress.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/zencore/compress.cpp b/zencore/compress.cpp
index 55808375e..12a7b9ef8 100644
--- a/zencore/compress.cpp
+++ b/zencore/compress.cpp
@@ -103,7 +103,7 @@ struct BufferHeader
constexpr uint64_t MethodOffset = offsetof(BufferHeader, Method);
for (MemoryView View = HeaderView + MethodOffset; const uint64_t ViewSize = View.GetSize();)
{
- const int32_t Size = static_cast<int32_t>(zen::Min<uint64_t>(ViewSize, INT_MAX));
+ const int32_t Size = static_cast<int32_t>(zen::Min<uint64_t>(ViewSize, /* INT_MAX */ 2147483647u));
Crc32 = zen::MemCrc32(View.GetData(), Size, Crc32);
View += Size;
}
@@ -211,7 +211,7 @@ private:
CompositeBuffer
BlockEncoder::Compress(const CompositeBuffer& RawData, const uint64_t BlockSize) const
{
- ZEN_ASSERT(IsPow2(BlockSize) && BlockSize <= (1 << 31));
+ ZEN_ASSERT(IsPow2(BlockSize) && (BlockSize <= (1u << 31)));
const uint64_t RawSize = RawData.GetSize();
BLAKE3Stream RawHash;
@@ -592,7 +592,7 @@ protected:
const int Size = LZ4_decompress_safe(static_cast<const char*>(CompressedData.GetData()),
static_cast<char*>(RawData.GetData()),
static_cast<int>(CompressedData.GetSize()),
- static_cast<int>(zen::Min<uint64_t>(RawData.GetSize(), LZ4_MAX_INPUT_SIZE)));
+ static_cast<int>(zen::Min<uint64_t>(RawData.GetSize(), uint64_t(LZ4_MAX_INPUT_SIZE))));
return static_cast<uint64_t>(Size) == RawData.GetSize();
}
return false;