summaryrefslogtreecommitdiff
path: root/cups
diff options
context:
space:
mode:
authorAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>2021-08-30 12:23:00 -0400
committerAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>2021-09-07 11:55:17 -0400
commitbaa764fab09e72e667dc31c9397094627eda1913 (patch)
treed24e59172d1a41a568b15dc8716ebab18755df90 /cups
parentfd5021277412ed47e9b4fa344396119c25f47ce6 (diff)
downloadcups-baa764fab09e72e667dc31c9397094627eda1913.tar.gz
Remove redundant code
Diffstat (limited to 'cups')
-rw-r--r--cups/auth.c11
-rw-r--r--cups/getdevices.c18
-rw-r--r--cups/ipp-file.c15
-rw-r--r--cups/pwg-media.c4
-rw-r--r--cups/tls-gnutls.c5
5 files changed, 16 insertions, 37 deletions
diff --git a/cups/auth.c b/cups/auth.c
index b6fec6b98..bff6d218f 100644
--- a/cups/auth.c
+++ b/cups/auth.c
@@ -330,10 +330,6 @@ _cupsSetNegotiateAuthString(
gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER;
/* Output token */
-
- (void)method;
- (void)resource;
-
# ifdef __APPLE__
/*
* If the weak-linked GSSAPI/Kerberos library is not present, don't try
@@ -450,6 +446,9 @@ _cupsSetNegotiateAuthString(
}
}
}
+# else
+ (void)method;
+ (void)resource;
# endif /* HAVE_GSS_ACQUIRED_CRED_EX_F */
if (major_status == GSS_S_NO_CRED)
@@ -562,9 +561,9 @@ cups_auth_find(const char *www_authenticate, /* I - Pointer into WWW-Authenticat
* Skip quoted value...
*/
- www_authenticate ++;
- while (*www_authenticate && *www_authenticate != '\"')
+ do
www_authenticate ++;
+ while (*www_authenticate && *www_authenticate != '\"');
DEBUG_printf(("9cups_auth_find: After quoted: \"%s\"", www_authenticate));
}
diff --git a/cups/getdevices.c b/cups/getdevices.c
index de2186f5f..a35540640 100644
--- a/cups/getdevices.c
+++ b/cups/getdevices.c
@@ -246,20 +246,14 @@ cupsGetDevices(
httpBlocking(http, blocking);
httpFlush(http);
- if (status == HTTP_STATUS_ERROR)
- _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0);
- else
- {
- attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
+ attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
- DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"",
- ippErrorString(response->request.status.status_code),
- attr ? attr->values[0].string.text : ""));
+ DEBUG_printf(("cupsGetDevices: status-code=%s, status-message=\"%s\"",
+ ippErrorString(response->request.status.status_code),
+ attr ? attr->values[0].string.text : ""));
- _cupsSetError(response->request.status.status_code,
- attr ? attr->values[0].string.text :
- ippErrorString(response->request.status.status_code), 0);
- }
+ _cupsSetError(response->request.status.status_code,
+ attr ? attr->values[0].string.text : ippErrorString(response->request.status.status_code), 0);
ippDelete(response);
diff --git a/cups/ipp-file.c b/cups/ipp-file.c
index 5db5932a4..5483a607d 100644
--- a/cups/ipp-file.c
+++ b/cups/ipp-file.c
@@ -303,10 +303,7 @@ _ippFileReadToken(_ipp_file_t *f, /* I - File to read from */
* Start of quoted text or regular expression...
*/
- if (ch == '<')
- quote = '>';
- else
- quote = ch;
+ quote = ch;
DEBUG_printf(("1_ippFileReadToken: Start of quoted string, quote=%c, pos=%ld", quote, (long)cupsFileTell(f->fp)));
}
@@ -571,12 +568,10 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
{
case IPP_TAG_BOOLEAN :
return (ippSetBoolean(ipp, attr, element, !_cups_strcasecmp(value, "true")));
- break;
case IPP_TAG_ENUM :
case IPP_TAG_INTEGER :
return (ippSetInteger(ipp, attr, element, (int)strtol(value, NULL, 0)));
- break;
case IPP_TAG_DATE :
{
@@ -690,7 +685,6 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
return (ippSetDate(ipp, attr, element, date));
}
- break;
case IPP_TAG_RESOLUTION :
{
@@ -718,7 +712,6 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
else
return (ippSetResolution(ipp, attr, element, (ipp_res_t)0, xres, yres));
}
- break;
case IPP_TAG_RANGE :
{
@@ -733,7 +726,6 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
return (ippSetRange(ipp, attr, element, lower, upper));
}
- break;
case IPP_TAG_STRING :
valuelen = strlen(value);
@@ -774,7 +766,6 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
}
else
return (ippSetOctetString(ipp, attr, element, value, (int)valuelen));
- break;
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
@@ -787,7 +778,6 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
case IPP_TAG_LANGUAGE :
case IPP_TAG_MIMETYPE :
return (ippSetString(ipp, attr, element, value));
- break;
case IPP_TAG_BEGIN_COLLECTION :
{
@@ -808,14 +798,11 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */
return (status);
}
- break;
default :
report_error(f, v, user_data, "Unsupported value on line %d of \"%s\".", f->linenum, f->filename);
return (0);
}
-
- return (1);
}
diff --git a/cups/pwg-media.c b/cups/pwg-media.c
index 00bb2ed61..535db0880 100644
--- a/cups/pwg-media.c
+++ b/cups/pwg-media.c
@@ -448,13 +448,13 @@ pwgInitSize(pwg_size_t *size, /* I - Size to initialize */
size->width = x_dimension->values[0].integer;
size->length = y_dimension->values[0].integer;
}
- else if (!x_dimension)
+ else if (!x_dimension) /* x_dimension is missing */
{
_cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("Missing x-dimension in media-size."), 1);
return (0);
}
- else if (!y_dimension)
+ else /* y_dimension must be missing */
{
_cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("Missing y-dimension in media-size."), 1);
diff --git a/cups/tls-gnutls.c b/cups/tls-gnutls.c
index 25adbdfb2..ffe1aa695 100644
--- a/cups/tls-gnutls.c
+++ b/cups/tls-gnutls.c
@@ -659,7 +659,7 @@ httpCredentialsString(
if (!buffer)
return (0);
- if (buffer && bufsize > 0)
+ if (bufsize > 0)
*buffer = '\0';
if ((first = (http_credential_t *)cupsArrayFirst(credentials)) != NULL &&
@@ -1516,8 +1516,7 @@ _httpTLSStart(http_t *http) /* I - Connection to server */
DEBUG_printf(("4_httpTLSStart: Using certificate \"%s\" and private key \"%s\".", crtfile, keyfile));
- if (!status)
- status = gnutls_certificate_set_x509_key_file(*credentials, crtfile, keyfile, GNUTLS_X509_FMT_PEM);
+ status = gnutls_certificate_set_x509_key_file(*credentials, crtfile, keyfile, GNUTLS_X509_FMT_PEM);
}
if (!status)