From: David du Colombier <0intro@gmail.com> Date: Sat, 8 Jun 2013 19:20:00 +0000 (+0200) Subject: fix warnings X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=825c013eb89e0762edcf33422ee6e93f624e08ff;p=proto%2Flibregexp.git fix warnings regcomp.c:311:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ regcomp.c:311:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ regcomp.c:311:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long int’ regcomp.c:333:12: warning: comparison between signed and unsigned integer expressions regcomp.c:542:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ test2.c:16:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘char *’ test2.c:16:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘char *’ test2.c:16:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘char *’ test2.c:19:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘char *’ test2.c:19:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘char *’ test2.c:19:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘char *’ test2.c:7:10: warning: unused parameter ‘ac’ test2.c:7:21: warning: unused parameter ‘av’ test.c:28:10: warning: unused parameter ‘ac’ utf.c:159:8: warning: comparison between signed and unsigned integer expressions --- diff --git a/regcomp.c b/regcomp.c index a8c4685..36b6eb3 100644 --- a/regcomp.c +++ b/regcomp.c @@ -36,7 +36,7 @@ static int lastwasand; /* Last token was operand */ static int nbra; static char* exprp; /* pointer to next character in source expression */ static int lexdone; -static int nclass; +static unsigned int nclass; static Reclass*classp; static Reinst* freep; static int errors; @@ -307,8 +307,8 @@ dump(Reprog *pp) l = pp->firstinst; do{ - printf("%d:\t0%o\t%d\t%d", l-pp->firstinst, l->type, - l->u2.left-pp->firstinst, l->u1.right-pp->firstinst); + printf("%d:\t0%o\t%d\t%d", (int)(l-pp->firstinst), l->type, + (int)(l->u2.left-pp->firstinst), (int)(l->u1.right-pp->firstinst)); if(l->type == RUNE) printf("\t%C\n", l->u1.r); else if(l->type == CCLASS || l->type == NCCLASS){ @@ -539,7 +539,7 @@ regcomp1(char *s, int literal, int dot_type) #endif pp = optimize(pp); #ifdef DEBUG - printf("start: %d\n", andp->first-pp->firstinst); + printf("start: %d\n", (int)(andp->first-pp->firstinst)); dump(pp); #endif out: diff --git a/test.c b/test.c index 257efed..6119070 100644 --- a/test.c +++ b/test.c @@ -31,6 +31,9 @@ main(int ac, char **av) char dst[128]; struct x *tp; + if(ac != 2) + exit(1); + for(tp = t; tp->re; tp++) tp->p = regcomp(tp->re); diff --git a/test2.c b/test2.c index a83451a..8fb1deb 100644 --- a/test2.c +++ b/test2.c @@ -4,7 +4,7 @@ #include "regexp9.h" int -main(int ac, char **av) +main() { Resub rs[10]; Reprog *p; @@ -13,9 +13,9 @@ main(int ac, char **av) p = regcomp("[^a-z]"); s = "\n"; if(regexec(p, s, rs, 10)) - printf("%s %lux %lux %lux\n", s, s, rs[0].s.sp, rs[0].e.ep); + printf("%s %p %p %p\n", s, s, rs[0].s.sp, rs[0].e.ep); s = "0"; if(regexec(p, s, rs, 10)) - printf("%s %lux %lux %lux\n", s, s, rs[0].s.sp, rs[0].e.ep); + printf("%s %p %p %p\n", s, s, rs[0].s.sp, rs[0].e.ep); exit(0); } diff --git a/utf.c b/utf.c index f4f5922..5eb4efb 100644 --- a/utf.c +++ b/utf.c @@ -135,9 +135,9 @@ runestrchr(Rune *s, Rune c) } char* -utfrune(char *s, long c) +utfrune(char *s, Rune c) { - long c1; + Rune c1; Rune r; int n; diff --git a/utf.h b/utf.h index 3652154..7429bb9 100644 --- a/utf.h +++ b/utf.h @@ -17,7 +17,7 @@ enum int chartorune(Rune *rune, char *str); Rune* runestrchr(Rune *s, Rune c); -char* utfrune(char *s, long c); +char* utfrune(char *s, Rune c); #if defined(__cplusplus) }