Fixed a lot of compile warnings. Now opencryptoki compiles with just
4 warnings :-). Verified and tested cca, ica, soft and ep11 token.

Signed-off-by: Harald Freudenberger <fre...@linux.vnet.ibm.com>
---
 configure.in                                  |    2 +-
 usr/lib/pkcs11/common/new_host.c              |    7 +++++--
 usr/lib/pkcs11/common/obj_mgr.c               |   16 ++++++++--------
 usr/lib/pkcs11/ep11_stdll/new_host.c          |    4 ++--
 usr/lib/pkcs11/icsf_stdll/icsf_config_lexer.l |    3 +++
 usr/lib/pkcs11/icsf_stdll/icsf_config_parse.y |    2 ++
 usr/lib/pkcs11/icsf_stdll/new_host.c          |    4 ++--
 usr/sbin/pkcsslotd/lexer.l                    |    2 ++
 usr/sbin/pkcsslotd/parser.y                   |    4 ++++
 9 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/configure.in b/configure.in
index bcf85cd..13bf12b 100644
--- a/configure.in
+++ b/configure.in
@@ -554,7 +554,7 @@ fi
 
 AM_CONDITIONAL([ENABLE_PKCSEP11_MIGRATE], [test "x$enable_pkcsep11_migrate" = 
"xyes"])
 
-CFLAGS="$CFLAGS -DPKCS64 -D_XOPEN_SOURCE=500 -Wall -Wno-pointer-sign"
+CFLAGS="$CFLAGS -DPKCS64 -D_XOPEN_SOURCE=600 -Wall -Wno-pointer-sign"
 
 CFLAGS+=' -DCONFIG_PATH=\"$(localstatedir)/lib/opencryptoki\" 
-DSBIN_PATH=\"$(sbindir)\" -DLIB_PATH=\"$(libdir)\" 
-DLOCKDIR_PATH=\"$(lockdir)\" -DOCK_CONFDIR=\"$(sysconfdir)/opencryptoki\" 
-DOCK_LOGDIR=\"$(logdir)\"'
 
diff --git a/usr/lib/pkcs11/common/new_host.c b/usr/lib/pkcs11/common/new_host.c
index 1bc0403..03fcec2 100755
--- a/usr/lib/pkcs11/common/new_host.c
+++ b/usr/lib/pkcs11/common/new_host.c
@@ -358,8 +358,11 @@ void Fork_Initializer(void)
         * When implemented...  Although logout_all should clear this up.
         */
 
-       bt_destroy(&priv_token_obj_btree, object_free);
-       bt_destroy(&publ_token_obj_btree, object_free);
+       /* the funny (void (*)(void *)) cast here casts from 
+        * void *func(OBJECT *) to void *func(void *) which is what the
+        * compiler needs according to the bt_destroy() declaration. */
+       bt_destroy(&priv_token_obj_btree, (void (*)(void *)) object_free);
+       bt_destroy(&publ_token_obj_btree, (void (*)(void *)) object_free);
 
        /* Need to do something to prevent the shared memory from
         * having the objects loaded again.... The most likely place
diff --git a/usr/lib/pkcs11/common/obj_mgr.c b/usr/lib/pkcs11/common/obj_mgr.c
index 80f5998..8d288fd 100755
--- a/usr/lib/pkcs11/common/obj_mgr.c
+++ b/usr/lib/pkcs11/common/obj_mgr.c
@@ -1080,7 +1080,7 @@ destroy_object_cb(void *node)
        OBJECT *o;
 
        if (map->is_session_obj)
-               bt_node_free(&sess_obj_btree, map->obj_handle, object_free);
+               bt_node_free(&sess_obj_btree, map->obj_handle, (void (*)(void 
*)) object_free);
        else {
                if (map->is_private)
                        o = bt_get_node_value(&priv_token_obj_btree, 
map->obj_handle);
@@ -1105,9 +1105,9 @@ destroy_object_cb(void *node)
                XProcUnLock();
 
                if (map->is_private)
-                       bt_node_free(&priv_token_obj_btree, map->obj_handle, 
object_free);
+                       bt_node_free(&priv_token_obj_btree, map->obj_handle, 
(void (*)(void *)) object_free);
                else
-                       bt_node_free(&publ_token_obj_btree, map->obj_handle, 
object_free);
+                       bt_node_free(&publ_token_obj_btree, map->obj_handle, 
(void (*)(void *)) object_free);
        }
 done:
        free(map);
@@ -1187,9 +1187,9 @@ delete_token_obj_cb(void *node, unsigned long map_handle, 
void *p3)
                XProcUnLock();
 
                if (map->is_private)
-                       bt_node_free(&priv_token_obj_btree, map->obj_handle, 
object_free);
+                       bt_node_free(&priv_token_obj_btree, map->obj_handle, 
(void (*)(void *)) object_free);
                else
-                       bt_node_free(&publ_token_obj_btree, map->obj_handle, 
object_free);
+                       bt_node_free(&publ_token_obj_btree, map->obj_handle, 
(void (*)(void *)) object_free);
        }
 done:
        /* delete @node from this btree */
@@ -1741,7 +1741,7 @@ purge_session_obj_cb(void *node, unsigned long 
obj_handle, void *p3)
          if (obj->map_handle)
            bt_node_free(&object_map_btree, obj->map_handle, free);
 
-        bt_node_free(&sess_obj_btree, obj_handle, object_free);
+        bt_node_free(&sess_obj_btree, obj_handle, (void (*)(void *)) 
object_free);
       }
    }
 }
@@ -1790,7 +1790,7 @@ purge_token_obj_cb(void *node, unsigned long obj_handle, 
void *p3)
    if (obj->map_handle)
       bt_node_free(&object_map_btree, obj->map_handle, free);
 
-   bt_node_free(t, obj_handle, object_free);
+   bt_node_free(t, obj_handle, (void (*)(void *)) object_free);
 }
 
 // this routine cleans up the list of token objects.  in general, we don't
@@ -2343,7 +2343,7 @@ delete_objs_from_btree_cb(void *node, unsigned long 
obj_handle, void *p3)
    }
 
    /* didn't find it in SHM, delete it from its btree */
-   bt_node_free(ua->t, obj_handle, object_free);
+   bt_node_free(ua->t, obj_handle, (void (*)(void *)) object_free);
 }
 
 void
diff --git a/usr/lib/pkcs11/ep11_stdll/new_host.c 
b/usr/lib/pkcs11/ep11_stdll/new_host.c
index 0c21b54..2939ab2 100644
--- a/usr/lib/pkcs11/ep11_stdll/new_host.c
+++ b/usr/lib/pkcs11/ep11_stdll/new_host.c
@@ -347,8 +347,8 @@ void Fork_Initializer(void)
         * When implemented...  Although logout_all should clear this up.
         */
 
-       bt_destroy(&priv_token_obj_btree, object_free);
-       bt_destroy(&publ_token_obj_btree, object_free);
+       bt_destroy(&priv_token_obj_btree, (void (*)(void *)) object_free);
+       bt_destroy(&publ_token_obj_btree, (void (*)(void *)) object_free);
 
        /* Need to do something to prevent the shared memory from
         * having the objects loaded again.... The most likely place
diff --git a/usr/lib/pkcs11/icsf_stdll/icsf_config_lexer.l 
b/usr/lib/pkcs11/icsf_stdll/icsf_config_lexer.l
index 9f9c185..45730b8 100644
--- a/usr/lib/pkcs11/icsf_stdll/icsf_config_lexer.l
+++ b/usr/lib/pkcs11/icsf_stdll/icsf_config_lexer.l
@@ -284,6 +284,9 @@
 %{
 #include <string.h>
 #include "icsf_config_parse.h"
+
+extern void yyerror(const char *s);
+
 %}
 
 %option noyywrap
diff --git a/usr/lib/pkcs11/icsf_stdll/icsf_config_parse.y 
b/usr/lib/pkcs11/icsf_stdll/icsf_config_parse.y
index e65166a..7223e95 100644
--- a/usr/lib/pkcs11/icsf_stdll/icsf_config_parse.y
+++ b/usr/lib/pkcs11/icsf_stdll/icsf_config_parse.y
@@ -308,6 +308,8 @@ int out_rc;
 /* Function used to report error. */
 void yyerror(const char *str);
 
+extern int yylex();
+
 /* */
 struct ref {
        char *key;
diff --git a/usr/lib/pkcs11/icsf_stdll/new_host.c 
b/usr/lib/pkcs11/icsf_stdll/new_host.c
index 3a36d36..12e32cc 100644
--- a/usr/lib/pkcs11/icsf_stdll/new_host.c
+++ b/usr/lib/pkcs11/icsf_stdll/new_host.c
@@ -344,8 +344,8 @@ void Fork_Initializer(void)
         * When implemented...  Although logout_all should clear this up.
         */
 
-       bt_destroy(&priv_token_obj_btree, object_free);
-       bt_destroy(&publ_token_obj_btree, object_free);
+       bt_destroy(&priv_token_obj_btree, (void (*)(void *)) object_free);
+       bt_destroy(&publ_token_obj_btree, (void (*)(void *)) object_free);
 
        /* Need to do something to prevent the shared memory from
         * having the objects loaded again.... The most likely place
diff --git a/usr/sbin/pkcsslotd/lexer.l b/usr/sbin/pkcsslotd/lexer.l
index d2d502c..81399d1 100644
--- a/usr/sbin/pkcsslotd/lexer.l
+++ b/usr/sbin/pkcsslotd/lexer.l
@@ -291,6 +291,8 @@
 
 int line_num = 1;
 
+extern void yyerror(const char *s);
+
 %}
 
 %option noyywrap
diff --git a/usr/sbin/pkcsslotd/parser.y b/usr/sbin/pkcsslotd/parser.y
index 6a7f12a..872c527 100644
--- a/usr/sbin/pkcsslotd/parser.y
+++ b/usr/sbin/pkcsslotd/parser.y
@@ -310,6 +310,7 @@ extern FILE *yyin;
 extern int yyparse();
 extern void yyerror(const char *s);
 extern int line_num;
+extern int yylex();
 
 typedef enum {
        KW_STDLL,
@@ -337,6 +338,9 @@ static const struct ock_key ock_keywords[] = {
 
 void set_init(void);
 void set_defaults(void);
+int lookup_keyword(const char *key);
+int do_str(char *slotinfo, int size, char* kw, char *val);
+int do_vers(CK_VERSION *slotinfo, char *kw, char *val);
 %}
 
 %union {
-- 
1.7.9.5


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Opencryptoki-tech mailing list
Opencryptoki-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to