{
FILE *in; /* Input file */
-
fprintf(stderr, "DEBUG2: cgiCopyTemplateFile(out=%p, tmpl=\"%s\")\n", out,
tmpl ? tmpl : "(null)");
if ((in = fopen(tmpl, "r")) == NULL)
{
fprintf(stderr, "ERROR: Unable to open template file \"%s\" - %s\n",
- tmpl ? tmpl : "(null)", strerror(errno));
+ tmpl, strerror(errno));
return;
}
* Convert the language to a locale name...
*/
- locale[0] = '\0';
-
if ((lang = getenv("LANG")) != NULL)
{
locale[0] = '/';
if ((locptr = strchr(locale, '.')) != NULL)
*locptr = '\0'; /* Strip charset */
}
+ else
+ {
+ locale[0] = '\0';
+ }
fprintf(stderr, "DEBUG2: lang=\"%s\", locale=\"%s\"...\n",
lang ? lang : "(null)", locale);
if (boundary)
boundary += 9;
- if (content_type && !strncmp(content_type, "multipart/form-data; ", 21))
+ if (!strncmp(content_type, "multipart/form-data; ", 21))
{
if (!cgi_initialize_multipart(boundary))
return (0);
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
}
}
}
+# else
+ (void)method;
+ (void)resource;
# endif /* HAVE_GSS_ACQUIRED_CRED_EX_F */
if (major_status == GSS_S_NO_CRED)
* 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));
}
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);
* 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)));
}
{
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 :
{
return (ippSetDate(ipp, attr, element, date));
}
- break;
case IPP_TAG_RESOLUTION :
{
else
return (ippSetResolution(ipp, attr, element, (ipp_res_t)0, xres, yres));
}
- break;
case IPP_TAG_RANGE :
{
return (ippSetRange(ipp, attr, element, lower, upper));
}
- break;
case IPP_TAG_STRING :
valuelen = strlen(value);
}
else
return (ippSetOctetString(ipp, attr, element, value, (int)valuelen));
- break;
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
case IPP_TAG_LANGUAGE :
case IPP_TAG_MIMETYPE :
return (ippSetString(ipp, attr, element, value));
- break;
case IPP_TAG_BEGIN_COLLECTION :
{
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);
}
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);
if (!buffer)
return (0);
- if (buffer && bufsize > 0)
+ if (bufsize > 0)
*buffer = '\0';
if ((first = (http_credential_t *)cupsArrayFirst(credentials)) != NULL &&
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)
if ((classification = getenv("CLASSIFICATION")) == NULL)
classification = "";
- if (strcmp(classification, "none") == 0)
+ else if (strcmp(classification, "none") == 0)
classification = "";
/*
Shutdown();
- if (ppd)
- ppdClose(ppd);
+ ppdClose(ppd);
/*
* Close the raster stream...
case 'h' : /* Show usage/help */
usage(0);
- break;
case 'l' : /* Started by launchd/systemd/upstart... */
#ifdef HAVE_ONDEMAND
_cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
"aborting."), *opt);
usage(1);
- break;
}
}
}
{
cupsdLogMessage(CUPSD_LOG_ERROR, "service_add_listener: Unable to allocate listener: %s.", strerror(errno));
exit(EXIT_FAILURE);
- return;
}
cupsArrayAdd(Listeners, lis);
{
cupsdLogMessage(CUPSD_LOG_ERROR, "service_checkin: Unable to get listener sockets: %s", strerror(error));
exit(EXIT_FAILURE);
- return; /* anti-compiler-warning */
}
/*
return (-1);
else if (digits > 0)
return (1);
- else if (diff)
+ else
return (diff);
}
else if (tolower(*s) < tolower(*t))
cups_array_t * /* O - CUPS array */
cupsdCreateStringsArray(const char *s) /* I - Comma-delimited strings */
{
- if (!s || !*s)
- return (NULL);
- else
+ if (s && *s)
return (_cupsArrayNewStrings(s, ','));
+ else
+ return (NULL);
}
op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job",
cupsLastErrorString());
- if (response)
- ippDelete(response);
+ ippDelete(response);
return (1);
}
op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job",
cupsLastErrorString());
- if (response)
- ippDelete(response);
+ ippDelete(response);
return (1);
}
default :
usage();
- break;
}
}
else
if (!name)
return (0);
- while (*list)
+ do
{
/*
* Skip leading whitespace and commas...
while (*list && !isspace(*list & 255) && *list != ',')
list ++;
}
+ while (*list);
return (0);
}
_cupsLangPrintf(stdout, _("%s not accepting requests since %s -"),
printer, printer_state_time);
_cupsLangPrintf(stdout, _("\t%s"),
- (message == NULL || !*message) ?
- "reason unknown" : message);
+ (message && *message) ?
+ message : "reason unknown");
}
for (i = 0; i < num_dests; i ++)
_("%s/%s not accepting requests since %s -"),
printer, dests[i].instance, printer_state_time);
_cupsLangPrintf(stdout, _("\t%s"),
- (message == NULL || !*message) ?
- "reason unknown" : message);
+ (message && *message) ?
+ message : "reason unknown");
}
}
}
printer_uri = NULL;
members = NULL;
- while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
+ do
{
if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
attr = attr->next;
}
+ while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER);
/*
* If this is a remote class, grab the class info from the
if ((message && *message) || pstate == IPP_PRINTER_STOPPED)
{
- if (!message || !*message)
- _cupsLangPuts(stdout, _("\treason unknown"));
+ if (message && *message)
+ _cupsLangPrintf(stdout, "\t%s", message);
else
- _cupsLangPrintf(stdout, "\t%s", message);
+ _cupsLangPuts(stdout, _("\treason unknown"));
}
if (long_status > 1)
if ((message && *message) || pstate == IPP_PRINTER_STOPPED)
{
- if (!message || !*message)
- _cupsLangPuts(stdout, _("\treason unknown"));
- else
+ if (message && *message)
_cupsLangPrintf(stdout, "\t%s", message);
+ else
+ _cupsLangPuts(stdout, _("\treason unknown"));
}
if (long_status > 1)
if (length > 0)
{
// Copy any remainder into the leftdata array...
- if ((length - leftcount) > 0)
+ if (length > leftcount)
memcpy(leftdata + leftcount, data, (size_t)(length - leftcount));
memset(leftdata + length, 0, (size_t)(4 - length));