Message ID | 1521ed89-989e-452b-b7fc-9e73672e0764@web.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 78687168bcaeabd3bdcaa1849dc9dc7d3a6f02db |
Headers | show |
Series | t-strvec: fix type mismatch in check_strvec | expand |
René Scharfe <l.s.r@web.de> writes: > Cast i from size_t to uintmax_t to match the format string. > > Reported-by: Jeff King <peff@peff.net> > Signed-off-by: René Scharfe <l.s.r@web.de> > --- > Oops, sorry about that. :-( > > PRIuMAX is "lu" on my system, so the compiler didn't flag the mistake. > > t/unit-tests/t-strvec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) The fix is of course identical to what I added to the integration I prepared, but the line-wrapping is better in this version, so I'll replace ;-) > diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c > index fdb28ba220..fa1a041469 100644 > --- a/t/unit-tests/t-strvec.c > +++ b/t/unit-tests/t-strvec.c > @@ -11,7 +11,8 @@ > check_uint((vec)->nr, <=, (vec)->alloc)) { \ > for (size_t i = 0; i < ARRAY_SIZE(expect); i++) { \ > if (!check_str((vec)->v[i], expect[i])) { \ > - test_msg(" i: %"PRIuMAX, i); \ > + test_msg(" i: %"PRIuMAX, \ > + (uintmax_t)i); \ > break; \ > } \ > } \ > -- > 2.45.2
diff --git a/t/unit-tests/t-strvec.c b/t/unit-tests/t-strvec.c index fdb28ba220..fa1a041469 100644 --- a/t/unit-tests/t-strvec.c +++ b/t/unit-tests/t-strvec.c @@ -11,7 +11,8 @@ check_uint((vec)->nr, <=, (vec)->alloc)) { \ for (size_t i = 0; i < ARRAY_SIZE(expect); i++) { \ if (!check_str((vec)->v[i], expect[i])) { \ - test_msg(" i: %"PRIuMAX, i); \ + test_msg(" i: %"PRIuMAX, \ + (uintmax_t)i); \ break; \ } \ } \
Cast i from size_t to uintmax_t to match the format string. Reported-by: Jeff King <peff@peff.net> Signed-off-by: René Scharfe <l.s.r@web.de> --- Oops, sorry about that. :-( PRIuMAX is "lu" on my system, so the compiler didn't flag the mistake. t/unit-tests/t-strvec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.45.2