]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix some (bogus) clang warnings.
authorMichael Sweet <michael.r.sweet@gmail.com>
Sat, 17 Jun 2017 02:47:31 +0000 (22:47 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Sat, 17 Jun 2017 02:47:31 +0000 (22:47 -0400)
cgi-bin/help.c
cups/dest.c
cups/snmp.c
test/ippserver.c

index 07f6f27209a5dbc464f1e39ddaa0f8f859eee74c..df3392652c08a43c7036730acc16e73397266523 100644 (file)
@@ -271,7 +271,7 @@ main(int  argc,                             /* I - Number of command-line arguments */
       section = n->section;
     }
 
-    if (!topic || strcmp(n->section, topic))
+    if (!topic || !n->section || strcmp(n->section, topic))
       continue;
 
    /*
index 0c9050c2a3d3780582071980e79ab044ee74da89..f5b0fb402812c1a182aa82f2269d9fae1c1f1c2b 100644 (file)
@@ -976,11 +976,11 @@ cupsEnumDests(
 #  ifdef HAVE_DNSSD
   int                  nfds,           /* Number of files responded */
                        main_fd;        /* File descriptor for lookups */
-  DNSServiceRef                ipp_ref,        /* IPP browser */
-                       local_ipp_ref /* Local IPP browser */
+  DNSServiceRef                ipp_ref = NULL, /* IPP browser */
+                       local_ipp_ref = NULL; /* Local IPP browser */
 #    ifdef HAVE_SSL
-  DNSServiceRef                ipps_ref,       /* IPPS browser */
-                       local_ipps_ref; /* Local IPPS browser */
+  DNSServiceRef                ipps_ref = NULL,/* IPPS browser */
+                       local_ipps_ref = NULL; /* Local IPPS browser */
 #    endif /* HAVE_SSL */
 #    ifdef HAVE_POLL
   struct pollfd                pfd;            /* Polling data */
@@ -990,13 +990,14 @@ cupsEnumDests(
 #    endif /* HAVE_POLL */
 #  else /* HAVE_AVAHI */
   int                  error;          /* Error value */
-  AvahiServiceBrowser  *ipp_ref;       /* IPP browser */
+  AvahiServiceBrowser  *ipp_ref = NULL;/* IPP browser */
 #    ifdef HAVE_SSL
-  AvahiServiceBrowser  *ipps_ref;      /* IPPS browser */
+  AvahiServiceBrowser  *ipps_ref = NULL; /* IPPS browser */
 #    endif /* HAVE_SSL */
 #  endif /* HAVE_DNSSD */
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
+
  /*
   * Range check input...
   */
@@ -1011,6 +1012,8 @@ cupsEnumDests(
   */
 
 #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+  memset(&data, 0, sizeof(data));
+
   data.type      = type;
   data.mask      = mask;
   data.cb        = cb;
@@ -1072,11 +1075,11 @@ cupsEnumDests(
         */
 
         char   scheme[32],             /* URI scheme */
-                  userpass[32],                /* Username:password */
-                  serviceName[256],    /* Service name (host field) */
-                  resource[256],               /* Resource (options) */
-                  *regtype,            /* Registration type */
-                  *replyDomain;                /* Registration domain */
+                userpass[32],           /* Username:password */
+                serviceName[256],       /* Service name (host field) */
+                resource[256],          /* Resource (options) */
+                *regtype,               /* Registration type */
+                *replyDomain;           /* Registration domain */
         int    port;                   /* Port number (not used) */
 
         if (httpSeparateURI(HTTP_URI_CODING_ALL, device_uri, scheme, sizeof(scheme), userpass, sizeof(userpass), serviceName, sizeof(serviceName), &port, resource, sizeof(resource)) >= HTTP_URI_STATUS_OK)
@@ -1312,7 +1315,15 @@ cupsEnumDests(
       break;
 #  endif /* HAVE_AVAHI */
   }
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
+
+ /*
+  * Return...
+  */
+
+  enum_finished:
 
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
 #  ifdef HAVE_DNSSD
   DNSServiceRefDeallocate(ipp_ref);
   DNSServiceRefDeallocate(local_ipp_ref);
@@ -1333,15 +1344,7 @@ cupsEnumDests(
   avahi_client_free(data.client);
   avahi_simple_poll_free(data.simple_poll);
 #  endif /* HAVE_DNSSD */
-#endif /* HAVE_DNSSD || HAVE_DNSSD */
-
- /*
-  * Return...
-  */
-
-  enum_finished:
 
-#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
   cupsArrayDelete(data.devices);
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
index fffa2182ba333da1b03ed489c3f304dcb9d4a83f..7958b93e557e542dd28595d9ca28ef68765a1f2a 100644 (file)
@@ -739,6 +739,10 @@ asn1_debug(const char    *prefix,  /* I - Prefix string */
   _cups_globals_t *cg = _cupsGlobals();        /* Global data */
 
 
+#ifdef __clang_analyzer__ /* Suppress bogus clang error */
+  memset(string, 0, sizeof(string));
+#endif /* __clang_analyzer__ */
+
   if (cg->snmp_debug <= 0)
     return;
 
index 0cca65a05b15c887dbf3fb70f199644028dd789d..e93763dbe83d0ea0266a55d49eecfc22ecaa6c0b 100644 (file)
@@ -5007,7 +5007,6 @@ load_attributes(const char *filename,     /* I - File to load */
                break;
 
              ippSetCollection(attrs, &attrptr, ippGetCount(attrptr), col);
-             lastcol = attrptr;
            }
            while (!strcmp(token, "{"));
            break;
@@ -7015,7 +7014,7 @@ valid_doc_attributes(
     attr = ippAddString(client->request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, format);
   }
 
-  if (!strcmp(format, "application/octet-stream") && (ippGetOperation(client->request) == IPP_OP_PRINT_JOB || ippGetOperation(client->request) == IPP_OP_SEND_DOCUMENT))
+  if (format && !strcmp(format, "application/octet-stream") && (ippGetOperation(client->request) == IPP_OP_PRINT_JOB || ippGetOperation(client->request) == IPP_OP_SEND_DOCUMENT))
   {
    /*
     * Auto-type the file using the first 8 bytes of the file...