diff options
author | Jeffrey Walton <noloader@gmail.com> | 2015-07-25 00:38:34 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2015-07-25 00:38:34 -0400 |
commit | ed0300b1437895adc1d954cffc0d2e401cdba8d1 (patch) | |
tree | c021a1b26880382f03ac620e2e346efbb65c354b /zdeflate.cpp | |
parent | 81af9257164c8f1a1c566a1a35fb6aeeb7a64070 (diff) | |
download | cryptopp-git-ed0300b1437895adc1d954cffc0d2e401cdba8d1.tar.gz |
Cleared "signed/unsigned mismatch" warning under GCC 5.1. The pointer math meant we got a ptrdiff_t back from the expression. Its not clear if we should throw, so an assert was added
Diffstat (limited to 'zdeflate.cpp')
-rw-r--r-- | zdeflate.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/zdeflate.cpp b/zdeflate.cpp index 3fad0842..a4f20d45 100644 --- a/zdeflate.cpp +++ b/zdeflate.cpp @@ -8,6 +8,7 @@ #include "pch.h" #include "zdeflate.h" #include <functional> +#include <cstddef> // ptrdiff_t #if _MSC_VER >= 1600 // for make_unchecked_array_iterator @@ -406,7 +407,12 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const { bestLength = len; bestMatch = current; - if (len == (scanEnd - scan)) + + // TODO: should we throw here? + const ptrdiff_t diff = scanEnd - scan; + assert(diff >= 0); + + if (len == static_cast<unsigned int>(diff)) break; } } |