diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-06-27 15:14:08 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-07-05 11:28:57 +0200 |
commit | e7bb1fe8b2ac478850ce2241c3392131dc8f3237 (patch) | |
tree | 05262ad275041e43d4b8728a9b26e2ccd0d76016 /examples/blame.c | |
parent | 976eed8078c69857c698f8753a4a66bda4690882 (diff) | |
download | libgit2-e7bb1fe8b2ac478850ce2241c3392131dc8f3237.tar.gz |
examples: avoid passing signed integer to `memchr`
The memchr(3P) function expects a `size_t` as its last parameter, but we
do pass it an object size, which is of signed type `git_off_t`. As we
can be sure that the result will be non-negative, let's just cast the
parameter to a `size_t`.
Diffstat (limited to 'examples/blame.c')
-rw-r--r-- | examples/blame.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/blame.c b/examples/blame.c index 0625dd55c..76f5ed2bd 100644 --- a/examples/blame.c +++ b/examples/blame.c @@ -91,7 +91,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[]) i = 0; break_on_null_hunk = 0; while (i < rawsize) { - const char *eol = memchr(rawdata + i, '\n', rawsize - i); + const char *eol = memchr(rawdata + i, '\n', (size_t)(rawsize - i)); char oid[10] = {0}; const git_blame_hunk *hunk = git_blame_get_hunk_byline(blame, line); |