Commit f15491d8 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

zlib inflate chunk copy code: fix compiler warnings

Comparison of a pointer difference to a size_t cause the compiler
to whine about the different signs: 'long' and 'unsigned long' in
this case. Fix that by using ptrdff_t for these comparisons.

No change in behavior, no new tests.

Tbr: mtklein@chromium.org
Bug: 796470
Change-Id: Ie585ba45f1e09f31f7d4cf48c41f2378a1b0808b
Reviewed-on: https://chromium-review.googlesource.com/836291
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525312}
parent 163835a2
......@@ -111,7 +111,7 @@ static inline unsigned char FAR* chunkcopy_core_safe(
unsigned len,
unsigned char FAR* limit) {
Assert(out + len <= limit, "chunk copy exceeds safety limit");
if (limit - out < CHUNKCOPY_CHUNK_SIZE) {
if ((limit - out) < (ptrdiff_t)CHUNKCOPY_CHUNK_SIZE) {
const unsigned char FAR* Z_RESTRICT rfrom = from;
if (len & 8) {
Z_BUILTIN_MEMCPY(out, rfrom, 8);
......@@ -396,7 +396,7 @@ static inline unsigned char FAR* chunkcopy_lapped_safe(
unsigned len,
unsigned char FAR* limit) {
Assert(out + len <= limit, "chunk copy exceeds safety limit");
if (limit - out < CHUNKCOPY_CHUNK_SIZE * 3) {
if ((limit - out) < (ptrdiff_t)(3 * CHUNKCOPY_CHUNK_SIZE)) {
/* TODO(cavalcantii): try harder to optimise this */
while (len-- > 0) {
*out = *(out - dist);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment