From ed0300b1437895adc1d954cffc0d2e401cdba8d1 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 25 Jul 2015 00:38:34 -0400 Subject: [PATCH] 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 --- zdeflate.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 +#include // 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(diff)) break; } }