Commit 8b75f7f3 by Russell Belfer

Eliminate xdiff compiler warnings

This cleans up the various GCC compiler warnings with the
xdiff code that was copied in.
parent 2705576b
......@@ -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 {
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment