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

pull/35/head
Jeffrey Walton 2015-07-25 00:38:34 -04:00
parent 81af925716
commit ed0300b143
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}
}