diff3.c's skip() returns number of bytes skipped so switch from int to size_t
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
diff --git a/lib/diff3.c b/lib/diff3.c
index 1948809..d79b7a1 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -158,7 +158,7 @@ static int number(char **);
static const struct got_error *readin(size_t *, char *, struct diff **,
struct diff3_state *);
static int ed_patch_lines(struct rcs_lines *, struct rcs_lines *);
-static const struct got_error *skip(int *, int, int, struct diff3_state *);
+static const struct got_error *skip(size_t *, int, int, struct diff3_state *);
static const struct got_error *edscript(int, struct diff3_state *);
static const struct got_error *merge(size_t, size_t, struct diff3_state *);
static const struct got_error *prange(struct range *, struct diff3_state *);
@@ -821,9 +821,12 @@ prange(struct range *rold, struct diff3_state *d3s)
return NULL;
}
-/* skip to just before line number from in file "i". */
+/*
+ * Skip to just before line number from in file "i".
+ * Return the number of bytes skipped in *nskipped.
+ */
static const struct got_error *
-skip(int *nskipped, int i, int from, struct diff3_state *d3s)
+skip(size_t *nskipped, int i, int from, struct diff3_state *d3s)
{
const struct got_error *err = NULL;
size_t len, n;
@@ -850,7 +853,8 @@ duplicate(int *dpl, struct range *r1, struct range *r2, struct diff3_state *d3s)
const struct got_error *err = NULL;
int c,d;
int nchar;
- int nline, nskipped;
+ int nline;
+ size_t nskipped;
*dpl = 0;
@@ -904,7 +908,7 @@ static const struct got_error *
edit(struct diff *diff, int fdup, int *j, struct diff3_state *d3s)
{
const struct got_error *err = NULL;
- int nskipped;
+ size_t nskipped;
if (((fdup + 1) & 3) == 0)
return NULL;