]> git.mdlowis.com Git - proto/libregexp.git/commitdiff
fix warnings
authorDavid du Colombier <0intro@gmail.com>
Sat, 8 Jun 2013 19:20:00 +0000 (21:20 +0200)
committerDavid du Colombier <0intro@gmail.com>
Sat, 8 Jun 2013 19:20:00 +0000 (21:20 +0200)
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

regcomp.c
test.c
test2.c
utf.c
utf.h

index a8c46856e85e302ed91329929a384a3c4293bb0e..36b6eb3548e19d4c7c1d6fccd99b43daab30c266 100644 (file)
--- 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 257efed7086b03f9dbc40fec117f17ee3a3e5f7e..61190703a54e9c6d525d729337d311ff1a686870 100644 (file)
--- 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 a83451aa4d14832b6b430e3cd57cb97549f18b74..8fb1deb04227a0c87d497211e964e30a0b01d2b8 100644 (file)
--- 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 f4f5922d8208447947969ab2e153173b99aa9a89..5eb4efb57481dc1d572dff6a85982700797f30f4 100644 (file)
--- 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 36521549010c56b0c816b63a03dff09cf4a3ae47..7429bb9cdca9522e00c2ef3721ae7e9926ce7bef 100644 (file)
--- 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)
 }