From d4cdbab99b8ead6ae2462d6b452f8b2462ca8733 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Fri, 4 Jul 2008 23:12:52 +0000 Subject: [PATCH] Avoid warnings with -pedantic, specifically: Conversion between void * and function pointer. Value computed not used. Signed/unsigned argument. --- apps/openssl.c | 2 +- crypto/asn1/ameth_lib.c | 2 +- crypto/asn1/x_name.c | 2 +- crypto/conf/conf_api.c | 2 +- crypto/engine/eng_table.c | 2 +- crypto/evp/evp_pbe.c | 2 +- crypto/evp/pmeth_lib.c | 2 +- crypto/ex_data.c | 2 +- crypto/mem_dbg.c | 22 +++++++++++++++------- crypto/objects/obj_xref.c | 2 +- crypto/txt_db/txt_db.c | 2 +- crypto/x509v3/v3_utl.c | 2 +- ssl/ssl_sess.c | 2 +- 13 files changed, 27 insertions(+), 19 deletions(-) diff --git a/apps/openssl.c b/apps/openssl.c index dcfb796176..8323b59659 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -618,7 +618,7 @@ static LHASH_OF(FUNCTION) *prog_init(void) return(NULL); for (f=functions; f->name != NULL; f++) - lh_FUNCTION_insert(ret,f); + (void)lh_FUNCTION_insert(ret,f); return(ret); } diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index d155791324..47cbdd28d0 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -94,7 +94,7 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = }; typedef int sk_cmp_fn_type(const char * const *a, const char * const *b); -DECLARE_STACK_OF(EVP_PKEY_ASN1_METHOD); +DECLARE_STACK_OF(EVP_PKEY_ASN1_METHOD) static STACK_OF(EVP_PKEY_ASN1_METHOD) *app_methods = NULL; diff --git a/crypto/asn1/x_name.c b/crypto/asn1/x_name.c index b46434c7bd..c6658d7aff 100644 --- a/crypto/asn1/x_name.c +++ b/crypto/asn1/x_name.c @@ -64,7 +64,7 @@ #include "asn1_locl.h" typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; -DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY); +DECLARE_STACK_OF(STACK_OF_X509_NAME_ENTRY) static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len, diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index 53d7945da4..22617e5fa1 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -241,7 +241,7 @@ void _CONF_free_data(CONF *conf) static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) { if (a->name != NULL) - lh_CONF_VALUE_delete(conf,a); + (void)lh_CONF_VALUE_delete(conf,a); } static void value_free_stack_doall(CONF_VALUE *a) diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c index e0709bef36..954b4d7970 100644 --- a/crypto/engine/eng_table.c +++ b/crypto/engine/eng_table.c @@ -157,7 +157,7 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, goto end; } fnd->funct = NULL; - lh_ENGINE_PILE_insert(&(*table)->piles, fnd); + (void)lh_ENGINE_PILE_insert(&(*table)->piles, fnd); } /* A registration shouldn't add duplciate entries */ (void)sk_ENGINE_delete_ptr(fnd->sk, e); diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index a7ed0f84b7..8fecd34221 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -64,7 +64,7 @@ /* Password based encryption (PBE) functions */ -DECLARE_STACK_OF(EVP_PBE_CTL); +DECLARE_STACK_OF(EVP_PBE_CTL) static STACK_OF(EVP_PBE_CTL) *pbe_algs; /* Setup a cipher context from a PBE algorithm */ diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 8b6647a91d..765a6c07db 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -69,7 +69,7 @@ typedef int sk_cmp_fn_type(const char * const *a, const char * const *b); -DECLARE_STACK_OF(EVP_PKEY_METHOD); +DECLARE_STACK_OF(EVP_PKEY_METHOD) STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL; extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth; diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 528689edb5..e2bc8298d0 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -317,7 +317,7 @@ static EX_CLASS_ITEM *def_get_class(int class_index) { /* Because we're inside the ex_data lock, the * return value from the insert will be NULL */ - lh_EX_CLASS_ITEM_insert(ex_data, gen); + (void)lh_EX_CLASS_ITEM_insert(ex_data, gen); p = gen; } } diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 72859f8992..d7b1021b8c 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -379,7 +379,7 @@ static APP_INFO *pop_info(void) if (next != NULL) { next->references++; - lh_APP_INFO_insert(amih,next); + (void)lh_APP_INFO_insert(amih,next); } #ifdef LEVITTE_DEBUG_MEM if (ret->thread_id != tmp.thread_id || ret->thread_idptr != tmp.thread_idptr) @@ -656,7 +656,7 @@ void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, #endif mp->addr=addr2; mp->num=num; - lh_MEM_insert(mh,mp); + (void)lh_MEM_insert(mh,mp); } MemCheck_on(); /* release MALLOC2 lock @@ -860,18 +860,26 @@ void CRYPTO_mem_leaks_fp(FILE *fp) /* NB: The prototypes have been typedef'd to CRYPTO_MEM_LEAK_CB inside crypto.h * If this code is restructured, remove the callback type if it is no longer * needed. -- Geoff Thorpe */ -static void cb_leak_doall_arg(const MEM *m, CRYPTO_MEM_LEAK_CB *cb) + +/* Can't pass CRYPTO_MEM_LEAK_CB directly to lh_MEM_doall_arg because it + * is a function pointer and conversion to void * is prohibited. Instead + * pass its address + */ + +typedef CRYPTO_MEM_LEAK_CB *PCRYPTO_MEM_LEAK_CB; + +static void cb_leak_doall_arg(const MEM *m, PCRYPTO_MEM_LEAK_CB *cb) { - cb(m->order,m->file,m->line,m->num,m->addr); + (*cb)(m->order,m->file,m->line,m->num,m->addr); } -static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM, CRYPTO_MEM_LEAK_CB) +static IMPLEMENT_LHASH_DOALL_ARG_FN(cb_leak, const MEM, PCRYPTO_MEM_LEAK_CB) void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb) { if (mh == NULL) return; CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); - lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), CRYPTO_MEM_LEAK_CB, - cb); + lh_MEM_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), PCRYPTO_MEM_LEAK_CB, + &cb); CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); } diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index 167336db89..4ebaa1cc6a 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -59,7 +59,7 @@ #include #include "obj_xref.h" -DECLARE_STACK_OF(nid_triple); +DECLARE_STACK_OF(nid_triple) STACK_OF(nid_triple) *sig_app, *sigx_app; static int cmp_sig(const nid_triple *a, const nid_triple *b) diff --git a/crypto/txt_db/txt_db.c b/crypto/txt_db/txt_db.c index 3da50e86ab..7e33f143cb 100644 --- a/crypto/txt_db/txt_db.c +++ b/crypto/txt_db/txt_db.c @@ -334,7 +334,7 @@ int TXT_DB_insert(TXT_DB *db, STRING *row) { if ((db->qual[i] != NULL) && (db->qual[i](row) == 0)) continue; - lh_STRING_insert(db->index[i],row); + (void)lh_STRING_insert(db->index[i],row); } } return(1); diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index d3d12d261f..7f1fc8fa0b 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -554,7 +554,7 @@ static int append_ia5(STACK_OF(STRING) **sk, ASN1_IA5STRING *email) if(!*sk) return 0; /* Don't add duplicates */ if(sk_STRING_find(*sk, (char *)email->data) != -1) return 1; - emtmp = BUF_strdup(email->data); + emtmp = BUF_strdup((char *)email->data); if(!emtmp || !sk_STRING_push(*sk, emtmp)) { X509_email_free(*sk); *sk = NULL; diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 12cc486b1b..c5ca1c2014 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -847,7 +847,7 @@ static void timeout_doall_arg(SSL_SESSION *s, TIMEOUT_PARAM *p) { /* The reason we don't call SSL_CTX_remove_session() is to * save on locking overhead */ - lh_SSL_SESSION_delete(p->cache,s); + (void)lh_SSL_SESSION_delete(p->cache,s); SSL_SESSION_list_remove(p->ctx,s); s->not_resumable=1; if (p->ctx->remove_session_cb != NULL) -- 2.25.1