mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 20:14:44 +00:00
Eliminate xdiff compiler warnings
This cleans up the various GCC compiler warnings with the xdiff code that was copied in.
This commit is contained in:
parent
2705576bfa
commit
8b75f7f3ea
@ -94,7 +94,7 @@ typedef struct s_xdemitconf {
|
|||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
find_func_t find_func;
|
find_func_t find_func;
|
||||||
void *find_func_priv;
|
void *find_func_priv;
|
||||||
void (*emit_func)();
|
void (*emit_func)(void);
|
||||||
} xdemitconf_t;
|
} xdemitconf_t;
|
||||||
|
|
||||||
typedef struct s_bdiffparam {
|
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)
|
static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
|
||||||
{
|
{
|
||||||
|
(void)priv;
|
||||||
|
|
||||||
if (len > 0 &&
|
if (len > 0 &&
|
||||||
(isalpha((unsigned char)*rec) || /* identifier? */
|
(isalpha((unsigned char)*rec) || /* identifier? */
|
||||||
*rec == '_' || /* also 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;
|
const char *rchg = xdf->rchg;
|
||||||
long ix;
|
long ix;
|
||||||
|
|
||||||
|
(void)xscr;
|
||||||
|
(void)xecfg;
|
||||||
|
|
||||||
for (ix = 0; ix < xdf->nrec; ix++) {
|
for (ix = 0; ix < xdf->nrec; ix++) {
|
||||||
if (rchg[ix])
|
if (rchg[ix])
|
||||||
continue;
|
continue;
|
||||||
|
@ -107,9 +107,10 @@ static int cmp_recs(xpparam_t const *xpp,
|
|||||||
#define TABLE_HASH(index, side, line) \
|
#define TABLE_HASH(index, side, line) \
|
||||||
XDL_HASHLONG((REC(index->env, side, line))->ha, index->table_bits)
|
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;
|
unsigned int chain_len;
|
||||||
struct record **rec_chain, *rec;
|
struct record **rec_chain, *rec;
|
||||||
|
|
||||||
@ -160,8 +161,10 @@ continue_scan:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,
|
static int try_lcs(
|
||||||
int line1, int count1, int line2, int count2)
|
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;
|
unsigned int b_next = b_ptr + 1;
|
||||||
struct record *rec = index->records[TABLE_HASH(index, 2, b_ptr)];
|
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;
|
return b_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_lcs(struct histindex *index, struct region *lcs,
|
static int find_lcs(
|
||||||
int line1, int count1, int line2, int count2) {
|
struct histindex *index, struct region *lcs,
|
||||||
int b_ptr;
|
unsigned int line1, unsigned int count1,
|
||||||
|
unsigned int line2, unsigned int count2)
|
||||||
|
{
|
||||||
|
unsigned int b_ptr;
|
||||||
|
|
||||||
if (scanA(index, line1, count1))
|
if (scanA(index, line1, count1))
|
||||||
return -1;
|
return -1;
|
||||||
@ -258,12 +264,14 @@ static int fall_back_to_classic_diff(struct histindex *index,
|
|||||||
line1, count1, line2, count2);
|
line1, count1, line2, count2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
|
static int histogram_diff(
|
||||||
int line1, int count1, int line2, int count2)
|
xpparam_t const *xpp, xdfenv_t *env,
|
||||||
|
unsigned int line1, unsigned int count1,
|
||||||
|
unsigned int line2, unsigned int count2)
|
||||||
{
|
{
|
||||||
struct histindex index;
|
struct histindex index;
|
||||||
struct region lcs;
|
struct region lcs;
|
||||||
int sz;
|
unsigned int sz;
|
||||||
int result = -1;
|
int result = -1;
|
||||||
|
|
||||||
if (count1 <= 0 && count2 <= 0)
|
if (count1 <= 0 && count2 <= 0)
|
||||||
|
@ -372,8 +372,8 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
|
|||||||
nb += 3;
|
nb += 3;
|
||||||
if (func && funclen) {
|
if (func && funclen) {
|
||||||
buf[nb++] = ' ';
|
buf[nb++] = ' ';
|
||||||
if (funclen > sizeof(buf) - nb - 1)
|
if (funclen > (long)sizeof(buf) - nb - 1)
|
||||||
funclen = sizeof(buf) - nb - 1;
|
funclen = (long)sizeof(buf) - nb - 1;
|
||||||
memcpy(buf + nb, func, funclen);
|
memcpy(buf + nb, func, funclen);
|
||||||
nb += funclen;
|
nb += funclen;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user