diff options
author | Patrick Steinhardt <ps@pks.im> | 2015-11-24 10:18:58 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2015-12-01 09:02:47 +0100 |
commit | cb1cb24ca9588e43edfb8b37e008c2e83af580af (patch) | |
tree | 16ae98aa4378f1ebd31f01536bd2184a68013bb8 /include | |
parent | 337b2b08f46ea77d61fa66657ad62d8702bc233a (diff) | |
download | libgit2-cb1cb24ca9588e43edfb8b37e008c2e83af580af.tar.gz |
blame: use size_t for line counts in git_blame_hunk
It is not unreasonable to have versioned files with a line count
exceeding 2^16. Upon blaming such files we fail to correctly keep
track of the lines as `git_blame_hunk` stores them in `uint16_t`
fields.
Fix this by converting the line fields of `git_blame_hunk` to
`size_t`. Add test to verify behavior.
Diffstat (limited to 'include')
-rw-r--r-- | include/git2/blame.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/git2/blame.h b/include/git2/blame.h index 173e9994b..84bb7f94c 100644 --- a/include/git2/blame.h +++ b/include/git2/blame.h @@ -74,8 +74,8 @@ typedef struct git_blame_options { uint16_t min_match_characters; git_oid newest_commit; git_oid oldest_commit; - uint32_t min_line; - uint32_t max_line; + size_t min_line; + size_t max_line; } git_blame_options; #define GIT_BLAME_OPTIONS_VERSION 1 @@ -113,15 +113,15 @@ GIT_EXTERN(int) git_blame_init_options( * root, or the commit specified in git_blame_options.oldest_commit) */ typedef struct git_blame_hunk { - uint16_t lines_in_hunk; + size_t lines_in_hunk; git_oid final_commit_id; - uint16_t final_start_line_number; + size_t final_start_line_number; git_signature *final_signature; git_oid orig_commit_id; const char *orig_path; - uint16_t orig_start_line_number; + size_t orig_start_line_number; git_signature *orig_signature; char boundary; @@ -156,7 +156,7 @@ GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byindex( */ GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline( git_blame *blame, - uint32_t lineno); + size_t lineno); /** * Get the blame for a single file. |