diff: Cleanup documentation and printf compat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/include/git2/diff.h b/include/git2/diff.h
index d145506..85bb308 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -455,6 +455,11 @@ GIT_EXTERN(int) git_diff_iterator_next_file(
* so the first call for a new file is expensive (at least in relative
* terms - in reality, it is still pretty darn fast).
*
+ * @param range Pointer where to store the range for the hunk
+ * @param header Pointer where to store the header for the chunk;
+ * this string is owned by the library and should not be freed by
+ * the user
+ * @param header_len Pointer where to store the length of the returned header
* @param iterator The iterator object
* @return 0 on success, GIT_ITEROVER when done with current file, other
* value < 0 on error
@@ -468,8 +473,14 @@ GIT_EXTERN(int) git_diff_iterator_next_hunk(
/**
* Return the next line of the current hunk of diffs.
*
+ * @param line_origin Pointer where to store a GIT_DIFF_LINE_ value;
+ * this value is a single character, not a buffer
+ * @param content Pointer where to store the content of the line;
+ * this string is owned by the library and should not be freed by
+ * the user
+ * @param Pointer where to store the length of the returned content
* @param iterator The iterator object
- * @return 0 on success, GIT_ITEROVER when done with current hunk, other
+ * @return 0 on success, GIT_ITEROVER when done with current line, other
* value < 0 on error
*/
GIT_EXTERN(int) git_diff_iterator_next_line(
diff --git a/src/diff_output.c b/src/diff_output.c
index d715f9e..2c64b92 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -89,21 +89,21 @@ static int format_hunk_header(char *header, size_t len, git_diff_range *range)
{
if (range->old_lines != 1) {
if (range->new_lines != 1)
- return snprintf(
+ return p_snprintf(
header, len, "@@ -%d,%d +%d,%d @@",
range->old_start, range->old_lines,
range->new_start, range->new_lines);
else
- return snprintf(
+ return p_snprintf(
header, len, "@@ -%d,%d +%d @@",
range->old_start, range->old_lines, range->new_start);
} else {
if (range->new_lines != 1)
- return snprintf(
+ return p_snprintf(
header, len, "@@ -%d +%d,%d @@",
range->old_start, range->new_start, range->new_lines);
else
- return snprintf(
+ return p_snprintf(
header, len, "@@ -%d +%d @@",
range->old_start, range->new_start);
}