Using plain char instead of unsigned char in my tests.
authorHeikki Levanto <heikki@indexdata.dk>
Mon, 9 Oct 2006 14:22:43 +0000 (14:22 +0000)
committerHeikki Levanto <heikki@indexdata.dk>
Mon, 9 Oct 2006 14:22:43 +0000 (14:22 +0000)
Removed warnings from printf formats on amd-64

buildconf.sh
src/nfaxml.c
test/nfatest1.c
test/nfaxmltest1.c
test/tstlogthread.c
util/marcdump.c

index efe2805..a0f99c8 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 #!/bin/sh
-# $Id: buildconf.sh,v 1.43 2006-09-27 11:38:59 adam Exp $
+# $Id: buildconf.sh,v 1.44 2006-10-09 14:22:43 heikki Exp $
 
 automake=automake
 aclocal=aclocal
 
 automake=automake
 aclocal=aclocal
@@ -41,7 +41,7 @@ sh_flags=""
 conf_flags=""
 case $1 in
     -d)
 conf_flags=""
 case $1 in
     -d)
-       #sh_flags="-g -Wall -Wdeclaration-after-statement -Werror"
+       #sh_flags="-g -Wall -Wdeclaration-after-statement -Werror -Wstrict-prototypes"
        sh_flags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
        enable_configure=true
        enable_help=false
        sh_flags="-g -Wall -Wdeclaration-after-statement -Wstrict-prototypes"
        enable_configure=true
        enable_help=false
index 8a49693..2771f56 100644 (file)
@@ -1,7 +1,7 @@
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  * 
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  * 
- *  $Id: nfaxml.c,v 1.10 2006-08-04 14:35:40 adam Exp $ 
+ *  $Id: nfaxml.c,v 1.11 2006-10-09 14:22:43 heikki Exp $ 
  */
 
 /**
  */
 
 /**
@@ -45,8 +45,8 @@ static int utf16_content(xmlNodePtr node, yaz_nfa_char *buf, int maxlen,
         if (res == 0) {
             /* should be caught earlier */
             yaz_log(YLOG_FATAL,"Illegal utf-8 sequence "
         if (res == 0) {
             /* should be caught earlier */
             yaz_log(YLOG_FATAL,"Illegal utf-8 sequence "
-                    "%d bytes into '%s' in %s, rule %d ",
-                    cp-content, content, filename, rulenumber);
+                    "%ld bytes into '%s' in %s, rule %d ",
+                    (long)(cp-content), content, filename, rulenumber);
             xmlFree(content);
             return -1;
         }
             xmlFree(content);
             return -1;
         }
index fbce473..9ca0cb9 100644 (file)
@@ -1,7 +1,7 @@
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  *
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  *
- *  $Id: nfatest1.c,v 1.7 2006-10-04 16:59:34 mike Exp $
+ *  $Id: nfatest1.c,v 1.8 2006-10-09 14:22:44 heikki Exp $
  *
  */
 
  *
  */
 
@@ -35,8 +35,8 @@ void test_match(yaz_nfa *n,
     size_t buflen2 = buflen;
     i = yaz_nfa_match(n,&c, &buflen2,&resptr);
     if (yaz_test_get_verbosity()>3)
     size_t buflen2 = buflen;
     i = yaz_nfa_match(n,&c, &buflen2,&resptr);
     if (yaz_test_get_verbosity()>3)
-        printf("\n'%s' returned %d. Moved c by %d, and resulted in '%s'\n",
-            expstr, i, (c-buf),(char*)resptr);
+        printf("\n'%s' returned %d. Moved c by %ld, and resulted in '%s'\n",
+            expstr, i, (long)(c-buf),(char*)resptr);
     YAZ_CHECK_EQ(buflen-buflen2, c-buf);
     YAZ_CHECK_EQ(i, expcode);
     if (i==0)
     YAZ_CHECK_EQ(buflen-buflen2, c-buf);
     YAZ_CHECK_EQ(i, expcode);
     if (i==0)
@@ -46,8 +46,8 @@ void test_match(yaz_nfa *n,
     while((bi!=2) && (yaz_test_get_verbosity()>3)){
         bi = yaz_nfa_get_backref(n, i,&cp1,&cp2);
         if (bi==0 && ( cp1 || cp2 ) ) {
     while((bi!=2) && (yaz_test_get_verbosity()>3)){
         bi = yaz_nfa_get_backref(n, i,&cp1,&cp2);
         if (bi==0 && ( cp1 || cp2 ) ) {
-            printf("  got backref %d of %d chars (%p to %p): '",
-                    i, cp2-cp1+1, cp1, cp2);
+            printf("  got backref %d of %ld chars (%p to %p): '",
+                    i, (long)(cp2-cp1+1), cp1, cp2);
             while (cp2-cp1 >= 0 )
                 printf("%c", *cp1++);
             printf("'\n");
             while (cp2-cp1 >= 0 )
                 printf("%c", *cp1++);
             printf("'\n");
@@ -185,8 +185,8 @@ void construction_test(void) {
     YAZ_CHECK_EQ(*cp1, 'z' );
     YAZ_CHECK_EQ(*cp2, 'k' );
     if (yaz_test_get_verbosity()>3)
     YAZ_CHECK_EQ(*cp1, 'z' );
     YAZ_CHECK_EQ(*cp2, 'k' );
     if (yaz_test_get_verbosity()>3)
-        printf("backref from %p '%c' to %p '%c' is %d long. sz is now %d\n",
-            cp1, *cp1,  cp2, *cp2,  cp2-cp1+1, sz );
+        printf("backref from %p '%c' to %p '%c' is %ld long. sz is now %ld\n",
+            cp1, *cp1,  cp2, *cp2,  (long)(cp2-cp1+1), (long)sz );
 
     yaz_nfa_destroy(n);
 }
 
     yaz_nfa_destroy(n);
 }
@@ -277,10 +277,11 @@ void converter_test(void) {
     YAZ_CHECK_EQ(i,YAZ_NFA_SUCCESS); 
     i=yaz_nfa_get_backref(n, 2, &cp1, &cp2 );
     if (yaz_test_get_verbosity()>3)
     YAZ_CHECK_EQ(i,YAZ_NFA_SUCCESS); 
     i=yaz_nfa_get_backref(n, 2, &cp1, &cp2 );
     if (yaz_test_get_verbosity()>3)
-        printf("backref from %p '%c' to %p '%c' is %d long. sz is now %d\n",
-            cp1, *cp1,  cp2, *cp2,  cp2-cp1+1, sz );
+        printf("backref from %p '%c' to %p '%c' is %ld long. sz is now %ld\n",
+            cp1, *cp1,  cp2, *cp2,  (long)(cp2-cp1+1), (long)sz );
     YAZ_CHECK_EQ(i,0);
     YAZ_CHECK_EQ(i,0);
-    YAZ_CHECK_EQ((int)c1,(int)c2);  /* got our pointer back from nfa */
+    /*YAZ_CHECK_EQ((int)c1,(int)c2);*/  /* got our pointer back from nfa */
+    YAZ_CHECK(c1==c2);  /* got our pointer back from nfa */
     for(i=0;i<1024;i++)
         outbuf[i]=10000+i;
     outp=outbuf;
     for(i=0;i<1024;i++)
         outbuf[i]=10000+i;
     outp=outbuf;
index 94ee4c5..cf87fc4 100644 (file)
@@ -1,7 +1,7 @@
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  *
 /*  Copyright (C) 2006, Index Data ApS
  *  See the file LICENSE for details.
  *
- *  $Id: nfaxmltest1.c,v 1.8 2006-10-04 16:59:34 mike Exp $
+ *  $Id: nfaxmltest1.c,v 1.9 2006-10-09 14:22:44 heikki Exp $
  *
  */
 
  *
  */
 
@@ -132,11 +132,11 @@ void test4(void) {
 
 static void test5(void) {
     struct conv_test {
 
 static void test5(void) {
     struct conv_test {
-        unsigned char *name;
+        char *name;
         int expresult;
         int expresult;
-        unsigned char *xml;
-        unsigned char *from;
-        unsigned char *to;
+        char *xml;
+        char *from;
+        char *to;
     };
     struct conv_test tests[]= {
         { "test5-1",  YAZ_NFA_SUCCESS,
     };
     struct conv_test tests[]= {
         { "test5-1",  YAZ_NFA_SUCCESS,
@@ -232,9 +232,9 @@ static void test5(void) {
     yaz_nfa *nfa;
     yaz_nfa_char frombuf[MAXBUF];
     yaz_nfa_char tobuf[MAXBUF];
     yaz_nfa *nfa;
     yaz_nfa_char frombuf[MAXBUF];
     yaz_nfa_char tobuf[MAXBUF];
-    unsigned char charbuf[MAXBUF];
+    char charbuf[MAXBUF];
     struct conv_test *thistest=tests;
     struct conv_test *thistest=tests;
-    unsigned char *cp;
+    char *cp;
     yaz_nfa_char *ycp;
     size_t incharsleft;
     size_t outcharsleft;
     yaz_nfa_char *ycp;
     size_t incharsleft;
     size_t outcharsleft;
@@ -254,7 +254,7 @@ static void test5(void) {
             }
             ycp=frombuf;
             cp=thistest->from;
             }
             ycp=frombuf;
             cp=thistest->from;
-            while ( (*ycp++ = *cp++) )
+            while ( (*ycp++ = (unsigned char)*cp++) )
                 ; /* strcpy, but expand to yaz_nfa_chars */
             incharsleft = strlen(thistest->from);
             prev_incharsleft = 0;
                 ; /* strcpy, but expand to yaz_nfa_chars */
             incharsleft = strlen(thistest->from);
             prev_incharsleft = 0;
index 1cd934f..49b384e 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1998-2005, Index Data.
  * See the file LICENSE for details.
  * 
  * Copyright (c) 1998-2005, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: tstlogthread.c,v 1.3 2005-10-22 13:27:29 adam Exp $
+ * $Id: tstlogthread.c,v 1.4 2006-10-09 14:22:44 heikki Exp $
  */
 
 #if HAVE_CONFIG_H
  */
 
 #if HAVE_CONFIG_H
@@ -33,7 +33,7 @@ static void *t_loop2(void *vp)
     return 0;
 }
 
     return 0;
 }
 
-static void t_test()
+static void t_test(void)
 {
     pthread_t tids[4];
     
 {
     pthread_t tids[4];
     
index c27e44f..44b79dc 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2006, Index Data ApS
  * See the file LICENSE for details.
  *
  * Copyright (C) 1995-2006, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: marcdump.c,v 1.42 2006-08-28 14:18:23 adam Exp $
+ * $Id: marcdump.c,v 1.43 2006-10-09 14:22:44 heikki Exp $
  */
 
 #define _FILE_OFFSET_BITS 64
  */
 
 #define _FILE_OFFSET_BITS 64
@@ -182,8 +182,8 @@ static void dump(const char *fname, const char *from, const char *to,
                 if (len < 25 || len > 100000)
                 {
                     long off = ftell(inf) - 5;
                 if (len < 25 || len > 100000)
                 {
                     long off = ftell(inf) - 5;
-                    printf("Bad Length %d read at offset %ld (%lx)\n",
-                           len, (long) off, (long) off);
+                    printf("Bad Length %ld read at offset %ld (%lx)\n",
+                           (long)len, (long) off, (long) off);
                     break;
                 }
                 rlen = len - 5;
                     break;
                 }
                 rlen = len - 5;