Remove assignment to variables not in use.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 26 Jul 2011 07:38:07 +0000 (09:38 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 26 Jul 2011 07:38:07 +0000 (09:38 +0200)
Fixes warnings produced by GCC 4.6.1.

src/dumpber.c
src/prt-ext.c
src/tcpip.c

index c02ae3b..d249c0d 100644 (file)
@@ -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;
 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;
     
     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;
     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, "");
     if ((res = ber_declen((unsigned char*)b, &ll, len)) <= 0)
     {
         fprintf(f, "\n%*sBad length\n", level*4+5, "");
index aad4cc7..f170994 100644 (file)
@@ -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;
 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;
 
     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 */
     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;
                                  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;
 
     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;
     thisext->direct_reference = odr_oiddup(o, oid);
 
     thisext->which = Z_External_single;
index 8ffa3ab..b9466d6 100644 (file)
@@ -1524,47 +1524,44 @@ void cs_print_session_info(COMSTACK cs)
 void *cs_get_ssl(COMSTACK cs)
 {
 #if HAVE_OPENSSL_SSL_H
 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
 #endif
+    return 0;
 }
 
 int cs_set_ssl_ctx(COMSTACK cs, void *ctx)
 {
 #if ENABLE_SSL
 }
 
 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 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
 #endif
-    return 1;
-#else
-    return 0;
+        return 1;
+    }
 #endif
 #endif
+    return 0;
 }
 
 int cs_set_ssl_certificate_file(COMSTACK cs, const char *fname)
 {
 #if ENABLE_SSL
 }
 
 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
 #endif
+    return 0;
 }
 
 int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len)
 }
 
 int cs_get_peer_certificate_x509(COMSTACK cs, char **buf, int *len)