summaryrefslogtreecommitdiff
path: root/zdeflate.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-07-25 00:38:34 -0400
committerJeffrey Walton <noloader@gmail.com>2015-07-25 00:38:34 -0400
commited0300b1437895adc1d954cffc0d2e401cdba8d1 (patch)
treec021a1b26880382f03ac620e2e346efbb65c354b /zdeflate.cpp
parent81af9257164c8f1a1c566a1a35fb6aeeb7a64070 (diff)
downloadcryptopp-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.cpp8
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;
}
}