aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-04-07 19:55:09 +0000
committerlloyd <[email protected]>2009-04-07 19:55:09 +0000
commita2d83a8339600f0b3ffd4fb1217d31b87f085683 (patch)
tree1714fccb7c55179f452df116beccf82641732272
parent3926091249430e31baa182e24747b0689cc9e836 (diff)
Avoid calling compress_n in MDx_HashFunction unless at least one block is
going to be compressed - otherwise it's a noop.
-rw-r--r--src/hash/mdx_hash/mdx_hash.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hash/mdx_hash/mdx_hash.cpp b/src/hash/mdx_hash/mdx_hash.cpp
index 2d5a2fe82..b630ec227 100644
--- a/src/hash/mdx_hash/mdx_hash.cpp
+++ b/src/hash/mdx_hash/mdx_hash.cpp
@@ -57,7 +57,8 @@ void MDx_HashFunction::add_data(const byte input[], u32bit length)
const u32bit full_blocks = length / HASH_BLOCK_SIZE;
const u32bit remaining = length % HASH_BLOCK_SIZE;
- compress_n(input, full_blocks);
+ if(full_blocks)
+ compress_n(input, full_blocks);
buffer.copy(position, input + full_blocks * HASH_BLOCK_SIZE, remaining);
position += remaining;