summaryrefslogtreecommitdiff
path: root/src/xdiff
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-24 14:08:20 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-03-02 15:49:28 -0800
commit8b75f7f3ea91b3efc4e58a7bf737aedfd19671e7 (patch)
tree36d9a0c8f39d4f42c1b063d7797c77208b037af6 /src/xdiff
parent2705576bfa90675433be49a4141cfdd867e380cc (diff)
downloadlibgit2-8b75f7f3ea91b3efc4e58a7bf737aedfd19671e7.tar.gz
Eliminate xdiff compiler warnings
This cleans up the various GCC compiler warnings with the xdiff code that was copied in.
Diffstat (limited to 'src/xdiff')
-rw-r--r--src/xdiff/xdiff.h2
-rw-r--r--src/xdiff/xemit.c5
-rw-r--r--src/xdiff/xhistogram.c28
-rw-r--r--src/xdiff/xutils.c4
4 files changed, 26 insertions, 13 deletions
diff --git a/src/xdiff/xdiff.h b/src/xdiff/xdiff.h
index 00d36c3ac..e18b4d2f6 100644
--- a/src/xdiff/xdiff.h
+++ b/src/xdiff/xdiff.h
@@ -94,7 +94,7 @@ typedef struct s_xdemitconf {
unsigned long flags;
find_func_t find_func;
void *find_func_priv;
- void (*emit_func)();
+ void (*emit_func)(void);
} xdemitconf_t;
typedef struct s_bdiffparam {
diff --git a/src/xdiff/xemit.c b/src/xdiff/xemit.c
index d11dbf9f1..8b7d417a1 100644
--- a/src/xdiff/xemit.c
+++ b/src/xdiff/xemit.c
@@ -71,6 +71,8 @@ xdchange_t *xdl_get_hunk(xdchange_t *xscr, xdemitconf_t const *xecfg) {
static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
{
+ (void)priv;
+
if (len > 0 &&
(isalpha((unsigned char)*rec) || /* identifier? */
*rec == '_' || /* also identifier? */
@@ -91,6 +93,9 @@ static int xdl_emit_common(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
const char *rchg = xdf->rchg;
long ix;
+ (void)xscr;
+ (void)xecfg;
+
for (ix = 0; ix < xdf->nrec; ix++) {
if (rchg[ix])
continue;
diff --git a/src/xdiff/xhistogram.c b/src/xdiff/xhistogram.c
index 18f6f997c..5d101754d 100644
--- a/src/xdiff/xhistogram.c
+++ b/src/xdiff/xhistogram.c
@@ -107,9 +107,10 @@ static int cmp_recs(xpparam_t const *xpp,
#define TABLE_HASH(index, side, line) \
XDL_HASHLONG((REC(index->env, side, line))->ha, index->table_bits)
-static int scanA(struct histindex *index, int line1, int count1)
+static int scanA(struct histindex *index, unsigned int line1, unsigned int count1)
{
- unsigned int ptr, tbl_idx;
+ unsigned int ptr;
+ unsigned int tbl_idx;
unsigned int chain_len;
struct record **rec_chain, *rec;
@@ -160,8 +161,10 @@ continue_scan:
return 0;
}
-static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,
- int line1, int count1, int line2, int count2)
+static int try_lcs(
+ struct histindex *index, struct region *lcs, unsigned int b_ptr,
+ unsigned int line1, unsigned int count1,
+ unsigned int line2, unsigned int count2)
{
unsigned int b_next = b_ptr + 1;
struct record *rec = index->records[TABLE_HASH(index, 2, b_ptr)];
@@ -233,9 +236,12 @@ static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,
return b_next;
}
-static int find_lcs(struct histindex *index, struct region *lcs,
- int line1, int count1, int line2, int count2) {
- int b_ptr;
+static int find_lcs(
+ struct histindex *index, struct region *lcs,
+ unsigned int line1, unsigned int count1,
+ unsigned int line2, unsigned int count2)
+{
+ unsigned int b_ptr;
if (scanA(index, line1, count1))
return -1;
@@ -258,12 +264,14 @@ static int fall_back_to_classic_diff(struct histindex *index,
line1, count1, line2, count2);
}
-static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
- int line1, int count1, int line2, int count2)
+static int histogram_diff(
+ xpparam_t const *xpp, xdfenv_t *env,
+ unsigned int line1, unsigned int count1,
+ unsigned int line2, unsigned int count2)
{
struct histindex index;
struct region lcs;
- int sz;
+ unsigned int sz;
int result = -1;
if (count1 <= 0 && count2 <= 0)
diff --git a/src/xdiff/xutils.c b/src/xdiff/xutils.c
index 0de084e53..9dea04bba 100644
--- a/src/xdiff/xutils.c
+++ b/src/xdiff/xutils.c
@@ -372,8 +372,8 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
nb += 3;
if (func && funclen) {
buf[nb++] = ' ';
- if (funclen > sizeof(buf) - nb - 1)
- funclen = sizeof(buf) - nb - 1;
+ if (funclen > (long)sizeof(buf) - nb - 1)
+ funclen = (long)sizeof(buf) - nb - 1;
memcpy(buf + nb, func, funclen);
nb += funclen;
}