diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-02-25 14:19:35 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-25 14:19:35 -0800 |
| commit | f52abcda959c2fa83243be21041d289735379b7c (patch) | |
| tree | 3e36ba2d695d6dcb07edb23ac42f47eab4828c30 /xdiff/xutils.c | |
| parent | 2d2a71ce85026edcc40f469678a1035df0dfcf57 (diff) | |
| parent | a3b56f5f431d2421b575f329d401361e3196b467 (diff) | |
| download | git-f52abcda959c2fa83243be21041d289735379b7c.tar.gz | |
Merge branch 'da/xdiff-w-sign-compare-workaround'
Noises from "-Wsign-compare" in the borrowed xdiff code has been
squelched.
* da/xdiff-w-sign-compare-workaround:
xdiff: avoid signed vs. unsigned comparisons in xutils.c
xdiff: avoid signed vs. unsigned comparisons in xpatience.c
xdiff: avoid signed vs. unsigned comparisons in xhistogram.c
xdiff: avoid signed vs. unsigned comparisons in xemit.c
xdiff: avoid signed vs. unsigned comparisons in xdiffi.c
xdiff: move sign comparison warning guard into each file
Diffstat (limited to 'xdiff/xutils.c')
| -rw-r--r-- | xdiff/xutils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xdiff/xutils.c b/xdiff/xutils.c index 9e36f24875..444a108f87 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -375,7 +375,7 @@ static int xdl_format_hunk_hdr(long s1, long c1, long s2, long c2, nb += 3; if (func && funclen) { buf[nb++] = ' '; - if (funclen > sizeof(buf) - nb - 1) + if ((size_t)funclen > sizeof(buf) - nb - 1) funclen = sizeof(buf) - nb - 1; memcpy(buf + nb, func, funclen); nb += funclen; @@ -437,7 +437,7 @@ void* xdl_alloc_grow_helper(void *p, long nr, long *alloc, size_t size) { void *tmp = NULL; size_t n = ((LONG_MAX - 16) / 2 >= *alloc) ? 2 * *alloc + 16 : LONG_MAX; - if (nr > n) + if ((size_t)nr > n) n = nr; if (SIZE_MAX / size >= n) tmp = xdl_realloc(p, n * size); |
