From patchwork Sun Mar 4 04:31:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: bdiff: avoid pointer arithmetic on void* From: Matt Harbison X-Patchwork-Id: 28906 Message-Id: <8b9334b59784246d5a09.1520137872@Envy> To: mercurial-devel@mercurial-scm.org Date: Sat, 03 Mar 2018 23:31:12 -0500 # HG changeset patch # User Matt Harbison # Date 1520137780 18000 # Sat Mar 03 23:29:40 2018 -0500 # Node ID 8b9334b59784246d5a09bad537d6e15a0f190c97 # Parent 3f829cbdfe3a89c28c8807d3a933159fb2d93992 bdiff: avoid pointer arithmetic on void* MSVC 2008 complains: mercurial/cext/bdiff.c(106) : error C2036: 'void *' : unknown size mercurial/cext/bdiff.c(107) : error C2036: 'void *' : unknown size Maybe it's a gcc extension? https://stackoverflow.com/questions/37460579/error-c2036-void-unknown-size diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -103,8 +103,8 @@ } /* we can almost add: if (li == lmax) lcommon = li; */ - an = bdiff_splitlines(ba.buf + lcommon, la - lcommon, &al); - bn = bdiff_splitlines(bb.buf + lcommon, lb - lcommon, &bl); + an = bdiff_splitlines(((char *)ba.buf) + lcommon, la - lcommon, &al); + bn = bdiff_splitlines(((char *)ba.buf) + lcommon, lb - lcommon, &bl); if (!al || !bl) { PyErr_NoMemory(); goto cleanup;