From: Adam Dickmeiss Date: Tue, 26 Jul 2011 07:38:07 +0000 (+0200) Subject: Remove assignment to variables not in use. X-Git-Tag: v4.2.6~8 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=896b145fa7a02199bfc3e8aa824c018b9d7cbf98;ds=sidebyside Remove assignment to variables not in use. Fixes warnings produced by GCC 4.6.1. --- diff --git a/src/dumpber.c b/src/dumpber.c index c02ae3b..d249c0d 100644 --- a/src/dumpber.c +++ b/src/dumpber.c @@ -18,7 +18,7 @@ static int do_dumpBER(FILE *f, const char *buf, int len, int level, int offset) { int res, ll, zclass, tag, cons, lenlen, taglen; - const char *b = buf, *bp = buf; + const char *b = buf; if (!len) return 0; @@ -56,7 +56,6 @@ static int do_dumpBER(FILE *f, const char *buf, int len, int level, int offset) b += res; taglen = res; len -= res; - bp = b; if ((res = ber_declen((unsigned char*)b, &ll, len)) <= 0) { fprintf(f, "\n%*sBad length\n", level*4+5, ""); diff --git a/src/prt-ext.c b/src/prt-ext.c index aad4cc7..f170994 100644 --- a/src/prt-ext.c +++ b/src/prt-ext.c @@ -261,18 +261,12 @@ int z_External(ODR o, Z_External **p, int opt, const char *name) Z_External *z_ext_record_oid(ODR o, const Odr_oid *oid, const char *buf, int len) { Z_External *thisext; - char oid_str_buf[OID_STR_MAX]; - const char *oid_str; - oid_class oclass; if (!oid) return 0; thisext = (Z_External *) odr_malloc(o, sizeof(*thisext)); thisext->descriptor = 0; thisext->indirect_reference = 0; - - oid_str = yaz_oid_to_string_buf(oid, &oclass, oid_str_buf); - thisext->direct_reference = odr_oiddup(o, oid); if (len < 0) /* Structured data */ @@ -343,18 +337,12 @@ Z_External *z_ext_record_oid_any(ODR o, const Odr_oid *oid, const char *buf, int len) { Z_External *thisext; - char oid_str_buf[OID_STR_MAX]; - const char *oid_str; - oid_class oclass; if (!oid) return 0; thisext = (Z_External *) odr_malloc(o, sizeof(*thisext)); thisext->descriptor = 0; thisext->indirect_reference = 0; - - oid_str = yaz_oid_to_string_buf(oid, &oclass, oid_str_buf); - thisext->direct_reference = odr_oiddup(o, oid); thisext->which = Z_External_single; diff --git a/src/tcpip.c b/src/tcpip.c index 8ffa3ab..b9466d6 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -1524,47 +1524,44 @@ void cs_print_session_info(COMSTACK cs) void *cs_get_ssl(COMSTACK cs) { #if HAVE_OPENSSL_SSL_H - struct tcpip_state *sp; - if (!cs || cs->type != ssl_type) - return 0; - sp = (struct tcpip_state *) cs->cprivate; - return sp->ssl; -#else - return 0; + if (cs && cs->type == ssl_type) + { + struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate; + return sp->ssl; + } #endif + return 0; } int cs_set_ssl_ctx(COMSTACK cs, void *ctx) { #if ENABLE_SSL - struct tcpip_state *sp; - if (!cs || cs->type != ssl_type) - return 0; - sp = (struct tcpip_state *) cs->cprivate; + if (cs && cs->type == ssl_type) + { #if HAVE_OPENSSL_SSL_H - if (sp->ctx_alloc) - return 0; - sp->ctx = (SSL_CTX *) ctx; + struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate; + if (sp->ctx_alloc) + return 0; + sp->ctx = (SSL_CTX *) ctx; #endif - return 1; -#else - return 0; + return 1; + } #endif + return 0; } int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname) { #if ENABLE_SSL - struct tcpip_state *sp; - if (!cs || cs->type != ssl_type) - return 0; - sp = (struct tcpip_state *) cs->cprivate; - strncpy(sp->cert_fname, fname, sizeof(sp->cert_fname)-1); - sp->cert_fname[sizeof(sp->cert_fname)-1] = '\0'; - return 1; -#else - return 0; + if (cs && cs->type == ssl_type) + { + struct tcpip_state *sp = (struct tcpip_state *) cs->cprivate; + strncpy(sp->cert_fname, fname, sizeof(sp->cert_fname)-1); + sp->cert_fname[sizeof(sp->cert_fname)-1] = '\0'; + return 1; + } #endif + return 0; } int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len)