summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sweet <michael.r.sweet@gmail.com>2017-06-16 22:47:31 -0400
committerMichael Sweet <michael.r.sweet@gmail.com>2017-06-16 22:47:31 -0400
commit7f500d89880b2dfc0fee4957ba9ade1e6f227c22 (patch)
tree47fd4ce853959dc9af41cf9b4ceb9ed2e3000d21
parentf34c1c99cd8dba4b43a287613833408400a37412 (diff)
downloadcups-7f500d89880b2dfc0fee4957ba9ade1e6f227c22.tar.gz
Fix some (bogus) clang warnings.
-rw-r--r--cgi-bin/help.c2
-rw-r--r--cups/dest.c41
-rw-r--r--cups/snmp.c4
-rw-r--r--test/ippserver.c3
4 files changed, 28 insertions, 22 deletions
diff --git a/cgi-bin/help.c b/cgi-bin/help.c
index 07f6f2720..df3392652 100644
--- a/cgi-bin/help.c
+++ b/cgi-bin/help.c
@@ -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;
/*
diff --git a/cups/dest.c b/cups/dest.c
index 0c9050c2a..f5b0fb402 100644
--- a/cups/dest.c
+++ b/cups/dest.c
@@ -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 */
diff --git a/cups/snmp.c b/cups/snmp.c
index fffa2182b..7958b93e5 100644
--- a/cups/snmp.c
+++ b/cups/snmp.c
@@ -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;
diff --git a/test/ippserver.c b/test/ippserver.c
index 0cca65a05..e93763dbe 100644
--- a/test/ippserver.c
+++ b/test/ippserver.c
@@ -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...