[PATCH] bdiff: avoid pointer arithmetic on void*

Yuya Nishihara yuya at tcha.org
Sun Mar 4 07:10:21 EST 2018


On Sat, 03 Mar 2018 23:31:12 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1520137780 18000
> #      Sat Mar 03 23:29:40 2018 -0500
> # Node ID 8b9334b59784246d5a09bad537d6e15a0f190c97
> # Parent  3f829cbdfe3a89c28c8807d3a933159fb2d93992
> bdiff: avoid pointer arithmetic on void*

Queued, thanks.

> 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);
                                        ^
Fixed typo.


More information about the Mercurial-devel mailing list