summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-08-28 15:37:22 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2014-08-28 15:37:22 +0000
commit7d5824d6a8f0aeb47c446f61e655c3a0f5c51e93 (patch)
tree62f89468c9607219f8c1fbc49c56fe546fc8bde0
parent3bc376ee94dd13ff43b9af675eb7381e443ea6ea (diff)
downloadcups-7d5824d6a8f0aeb47c446f61e655c3a0f5c51e93.tar.gz
Fix Linux builds without normal prerequisite libraries installed.
Also correct GCC 4.8 compiler warnings. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12124 a1ca3aef-8c08-0410-bb20-df032aa958be
-rw-r--r--backend/network.c16
-rw-r--r--backend/usb-unix.c2
-rw-r--r--cups/globals.c2
-rw-r--r--cups/http-support.c2
-rw-r--r--cups/http.c4
-rw-r--r--cups/md5.c2
-rw-r--r--cups/ppd-cache.c2
-rw-r--r--cups/sidechannel.c2
-rw-r--r--cups/tls.c57
-rw-r--r--cups/usersys.c2
-rw-r--r--filter/raster.c4
-rw-r--r--filter/rastertoepson.c24
-rw-r--r--scheduler/auth.c10
-rw-r--r--scheduler/client.c6
-rw-r--r--scheduler/cups-driverd.cxx4
-rw-r--r--scheduler/ipp.c8
-rw-r--r--systemv/lpstat.c5
-rw-r--r--test/ippserver.c23
18 files changed, 124 insertions, 51 deletions
diff --git a/backend/network.c b/backend/network.c
index 62be7f399..4560fb033 100644
--- a/backend/network.c
+++ b/backend/network.c
@@ -175,13 +175,13 @@ backendNetworkSideCB(
{
case CUPS_ASN1_BOOLEAN :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%d", packet.object_value.boolean);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_INTEGER :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%d",
packet.object_value.integer);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_BIT_STRING :
@@ -193,13 +193,13 @@ backendNetworkSideCB(
memcpy(dataptr, packet.object_value.string.bytes, i);
- datalen += i;
+ datalen += (int)i;
break;
case CUPS_ASN1_OID :
_cupsSNMPOIDToString(packet.object_value.oid, dataptr,
sizeof(data) - (size_t)(dataptr - data));
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_HEX_STRING :
@@ -208,22 +208,22 @@ backendNetworkSideCB(
dataptr < (data + sizeof(data) - 3);
i ++, dataptr += 2)
sprintf(dataptr, "%02X", packet.object_value.string.bytes[i]);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_COUNTER :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.counter);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_GAUGE :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.gauge);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
case CUPS_ASN1_TIMETICKS :
snprintf(dataptr, sizeof(data) - (size_t)(dataptr - data), "%u", packet.object_value.timeticks);
- datalen += strlen(dataptr);
+ datalen += (int)strlen(dataptr);
break;
default :
diff --git a/backend/usb-unix.c b/backend/usb-unix.c
index ae344a4d4..870cbfd68 100644
--- a/backend/usb-unix.c
+++ b/backend/usb-unix.c
@@ -146,7 +146,7 @@ print_device(const char *uri, /* I - Device URI */
tcgetattr(device_fd, &opts);
- opts.c_lflag &= ~(ICANON | ECHO | ISIG); /* Raw mode */
+ opts.c_lflag &= ~(unsigned)(ICANON | ECHO | ISIG); /* Raw mode */
/**** No options supported yet ****/
diff --git a/cups/globals.c b/cups/globals.c
index df742c407..7218d2844 100644
--- a/cups/globals.c
+++ b/cups/globals.c
@@ -361,7 +361,9 @@ cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
httpClose(cg->http);
+#ifdef HAVE_SSL
_httpFreeCredentials(cg->tls_credentials);
+#endif /* HAVE_SSL */
cupsFileClose(cg->stdio_files[0]);
cupsFileClose(cg->stdio_files[1]);
diff --git a/cups/http-support.c b/cups/http-support.c
index 18762669f..4207ae299 100644
--- a/cups/http-support.c
+++ b/cups/http-support.c
@@ -649,7 +649,7 @@ httpDecode64_2(char *out, /* I - String to write to */
break;
case 3 :
if (outptr < outend)
- *outptr++ |= base64;
+ *outptr++ |= (char)base64;
pos = 0;
break;
}
diff --git a/cups/http.c b/cups/http.c
index 1d6e4f75c..9520fa4bd 100644
--- a/cups/http.c
+++ b/cups/http.c
@@ -2557,9 +2557,11 @@ httpSetCredentials(http_t *http, /* I - HTTP connection */
if (!http || cupsArrayCount(credentials) < 1)
return (-1);
+#ifdef HAVE_SSL
_httpFreeCredentials(http->tls_credentials);
http->tls_credentials = _httpCreateCredentials(credentials);
+#endif /* HAVE_SSL */
return (http->tls_credentials ? 0 : -1);
}
@@ -2856,8 +2858,10 @@ httpShutdown(http_t *http) /* I - HTTP connection */
if (!http || http->fd < 0)
return;
+#ifdef HAVE_SSL
if (http->tls)
_httpTLSStop(http);
+#endif /* HAVE_SSL */
#ifdef WIN32
shutdown(http->fd, SD_RECEIVE); /* Microsoft-ism... */
diff --git a/cups/md5.c b/cups/md5.c
index c2d627bd9..851715ff1 100644
--- a/cups/md5.c
+++ b/cups/md5.c
@@ -333,7 +333,7 @@ _cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16])
for (i = 0; i < 8; ++i)
data[i] = (unsigned char)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
- _cupsMD5Append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+ _cupsMD5Append(pms, pad, (int)((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
_cupsMD5Append(pms, data, 8);
for (i = 0; i < 16; ++i)
diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c
index 8b29e04d1..510bb5f9f 100644
--- a/cups/ppd-cache.c
+++ b/cups/ppd-cache.c
@@ -2630,7 +2630,7 @@ pwg_compare_finishings(
_pwg_finishings_t *a, /* I - First finishings value */
_pwg_finishings_t *b) /* I - Second finishings value */
{
- return (b->value - a->value);
+ return ((int)b->value - (int)a->value);
}
diff --git a/cups/sidechannel.c b/cups/sidechannel.c
index 0928d8b34..8dc2ce0ff 100644
--- a/cups/sidechannel.c
+++ b/cups/sidechannel.c
@@ -490,7 +490,7 @@ cupsSideChannelSNMPWalk(
real_data[real_datalen] = '\0';
real_oidlen = strlen(real_data) + 1;
- real_datalen -= real_oidlen;
+ real_datalen -= (int)real_oidlen;
/*
* Call the callback with the OID and data...
diff --git a/cups/tls.c b/cups/tls.c
index 1a0b00fa4..f0d799d1d 100644
--- a/cups/tls.c
+++ b/cups/tls.c
@@ -46,9 +46,64 @@
# include "tls-gnutls.c"
# elif defined(HAVE_CDSASSL)
# include "tls-darwin.c"
-# else
+# else defined(HAVE_SSPI)
# include "tls-sspi.c"
# endif /* HAVE_GNUTLS */
+#else
+/* Stubs for when TLS is not supported/available */
+int
+httpCopyCredentials(http_t *http, cups_array_t **credentials)
+{
+ (void)http;
+ if (credentials)
+ *credentials = NULL;
+ return (-1);
+}
+int
+httpCredentialsAreValidForName(cups_array_t *credentials, const char *common_name)
+{
+ (void)credentials;
+ (void)common_name;
+ return (1);
+}
+time_t
+httpCredentialsGetExpiration(cups_array_t *credentials)
+{
+ (void)credentials;
+ return (INT_MAX);
+}
+http_trust_t
+httpCredentialsGetTrust(cups_array_t *credentials, const char *common_name)
+{
+ (void)credentials;
+ (void)common_name;
+ return (HTTP_TRUST_OK);
+}
+size_t
+httpCredentialsString(cups_array_t *credentials, char *buffer, size_t bufsize)
+{
+ (void)credentials;
+ (void)bufsize;
+ if (buffer)
+ *buffer = '\0';
+ return (0);
+}
+int
+httpLoadCredentials(const char *path, cups_array_t **credentials, const char *common_name)
+{
+ (void)path;
+ (void)credentials;
+ (void)common_name;
+ return (-1);
+}
+int
+httpSaveCredentials(const char *path, cups_array_t *credentials, const char *common_name)
+{
+ (void)path;
+ (void)credentials;
+ (void)common_name;
+ return (-1);
+}
#endif /* HAVE_SSL */
diff --git a/cups/usersys.c b/cups/usersys.c
index b6ef93e4d..b0568ddfc 100644
--- a/cups/usersys.c
+++ b/cups/usersys.c
@@ -211,8 +211,10 @@ cupsSetCredentials(
if (cupsArrayCount(credentials) < 1)
return (-1);
+#ifdef HAVE_SSL
_httpFreeCredentials(cg->tls_credentials);
cg->tls_credentials = _httpCreateCredentials(credentials);
+#endif /* HAVE_SSL */
return (cg->tls_credentials ? 0 : -1);
}
diff --git a/filter/raster.c b/filter/raster.c
index d1387086d..f6eb3d406 100644
--- a/filter/raster.c
+++ b/filter/raster.c
@@ -378,7 +378,7 @@ cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
if (!cups_raster_read(r, &byte, 1))
return (0);
- r->count = byte + 1;
+ r->count = (unsigned)byte + 1;
if (r->count > 1)
ptr = r->pixels;
@@ -418,7 +418,7 @@ cupsRasterReadPixels(cups_raster_t *r, /* I - Raster stream */
* Repeat the next N bytes...
*/
- count = (byte + 1) * r->bpp;
+ count = ((unsigned)byte + 1) * r->bpp;
if (count > (unsigned)bytes)
count = (unsigned)bytes;
diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c
index 0975d3e7b..87243a966 100644
--- a/filter/rastertoepson.c
+++ b/filter/rastertoepson.c
@@ -201,14 +201,14 @@ StartPage(
if (Model < EPSON_ICOLOR)
{
pwrite("\033(U\001\000", 5); /* Resolution/units */
- putchar(3600 / header->HWResolution[1]);
+ putchar((int)(3600 / header->HWResolution[1]));
}
else
{
pwrite("\033(U\005\000", 5);
- putchar(1440 / header->HWResolution[1]);
- putchar(1440 / header->HWResolution[1]);
- putchar(1440 / header->HWResolution[0]);
+ putchar((int)(1440 / header->HWResolution[1]));
+ putchar((int)(1440 / header->HWResolution[1]));
+ putchar((int)(1440 / header->HWResolution[0]));
putchar(0xa0); /* n/1440ths... */
putchar(0x05);
}
@@ -811,8 +811,8 @@ OutputRows(
{
putchar(0x1b);
putchar('$');
- putchar(i & 255);
- putchar(i >> 8);
+ putchar((int)(i & 255));
+ putchar((int)(i >> 8));
}
/*
@@ -853,8 +853,8 @@ OutputRows(
}
n = dot_count / DotBytes;
- putchar(n & 255);
- putchar(n / 256);
+ putchar((int)(n & 255));
+ putchar((int)(n / 256));
/*
* Write the graphics data...
@@ -883,8 +883,8 @@ OutputRows(
{
putchar(0x1b);
putchar('$');
- putchar(i & 255);
- putchar(i >> 8);
+ putchar((int)(i & 255));
+ putchar((int)(i >> 8));
}
if (header->HWResolution[0] == 120)
@@ -893,8 +893,8 @@ OutputRows(
printf("\033*\003"); /* Select bit image */
n = (unsigned)dot_count / DotBytes;
- putchar(n & 255);
- putchar(n / 256);
+ putchar((int)(n & 255));
+ putchar((int)(n / 256));
for (n = dot_count / 2, ptr = dot_ptr + 1; n > 0; n --, ptr += 2)
{
diff --git a/scheduler/auth.c b/scheduler/auth.c
index a7b3f9866..23fe843a0 100644
--- a/scheduler/auth.c
+++ b/scheduler/auth.c
@@ -2171,23 +2171,23 @@ cups_crypt(const char *pw, /* I - Password string */
* Copy the final sum to the result string and return...
*/
- memcpy(result, salt, salt_end - salt);
+ memcpy(result, salt, (size_t)(salt_end - salt));
ptr = result + (salt_end - salt);
*ptr++ = '$';
for (i = 0; i < 5; i ++, ptr += 4)
{
- n = (((digest[i] << 8) | digest[i + 6]) << 8);
+ n = ((((unsigned)digest[i] << 8) | (unsigned)digest[i + 6]) << 8);
if (i < 4)
- n |= digest[i + 12];
+ n |= (unsigned)digest[i + 12];
else
- n |= digest[5];
+ n |= (unsigned)digest[5];
to64(ptr, n, 4);
}
- to64(ptr, digest[11], 2);
+ to64(ptr, (unsigned)digest[11], 2);
ptr += 2;
*ptr = '\0';
diff --git a/scheduler/client.c b/scheduler/client.c
index 36dd3ad0b..8169895cc 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -934,7 +934,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
return;
}
#else
- if (!cupsdSendError(con, HTTP_NOT_IMPLEMENTED, CUPSD_AUTH_NONE))
+ if (!cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE))
{
cupsdCloseClient(con);
return;
@@ -993,7 +993,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
return;
}
#else
- if (!cupsdSendError(con, HTTP_NOT_IMPLEMENTED, CUPSD_AUTH_NONE))
+ if (!cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE))
{
cupsdCloseClient(con);
return;
@@ -1891,7 +1891,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
con->request->request.op.version[1],
ippOpString(con->request->request.op.operation_id),
con->request->request.op.request_id);
- con->bytes += ippLength(con->request);
+ con->bytes += (off_t)ippLength(con->request);
}
}
diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx
index c6e4b17e5..7924bc95b 100644
--- a/scheduler/cups-driverd.cxx
+++ b/scheduler/cups-driverd.cxx
@@ -1321,7 +1321,7 @@ list_ppds(int request_id, /* I - Request ID */
if (device_id_re &&
!regexec(device_id_re, ppd->record.device_id,
- (int)(sizeof(re_matches) / sizeof(re_matches[0])),
+ (size_t)(sizeof(re_matches) / sizeof(re_matches[0])),
re_matches, 0))
{
/*
@@ -1351,7 +1351,7 @@ list_ppds(int request_id, /* I - Request ID */
if (make_and_model_re &&
!regexec(make_and_model_re, ppd->record.make_and_model,
- (int)(sizeof(re_matches) / sizeof(re_matches[0])),
+ (size_t)(sizeof(re_matches) / sizeof(re_matches[0])),
re_matches, 0))
{
// See how much of the make-and-model string we matched...
diff --git a/scheduler/ipp.c b/scheduler/ipp.c
index 0e682ee8c..d775fb7ee 100644
--- a/scheduler/ipp.c
+++ b/scheduler/ipp.c
@@ -10823,8 +10823,10 @@ validate_job(cupsd_client_t *con, /* I - Client connection */
ipp_attribute_t *uri) /* I - Printer URI */
{
http_status_t status; /* Policy status */
- ipp_attribute_t *attr, /* Current attribute */
- *auth_info; /* auth-info attribute */
+ ipp_attribute_t *attr; /* Current attribute */
+#ifdef HAVE_SSL
+ ipp_attribute_t *auth_info; /* auth-info attribute */
+#endif /* HAVE_SSL */
ipp_attribute_t *format, /* Document-format attribute */
*name; /* Job-name attribute */
cups_ptype_t dtype; /* Destination type (printer/class) */
@@ -10990,7 +10992,9 @@ validate_job(cupsd_client_t *con, /* I - Client connection */
* Check policy...
*/
+#ifdef HAVE_SSL
auth_info = ippFindAttribute(con->request, "auth-info", IPP_TAG_TEXT);
+#endif /* HAVE_SSL */
if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, NULL)) != HTTP_OK)
{
diff --git a/systemv/lpstat.c b/systemv/lpstat.c
index f77fc5873..43e4c7a33 100644
--- a/systemv/lpstat.c
+++ b/systemv/lpstat.c
@@ -1270,7 +1270,6 @@ show_jobs(const char *dests, /* I - Destinations */
*reasons; /* Job state reasons attribute */
const char *dest, /* Pointer into job-printer-uri */
*username, /* Pointer to job-originating-user-name */
- *title, /* Pointer to job-name */
*message, /* Pointer to job-printer-state-message */
*time_at; /* time-at-xxx attribute name to use */
int rank, /* Rank in queue */
@@ -1385,7 +1384,6 @@ show_jobs(const char *dests, /* I - Destinations */
username = NULL;
dest = NULL;
jobtime = 0;
- title = "no title";
message = NULL;
reasons = NULL;
@@ -1411,9 +1409,6 @@ show_jobs(const char *dests, /* I - Destinations */
else if (!strcmp(attr->name, "job-originating-user-name") &&
attr->value_tag == IPP_TAG_NAME)
username = attr->values[0].string.text;
- else if (!strcmp(attr->name, "job-name") &&
- attr->value_tag == IPP_TAG_NAME)
- title = attr->values[0].string.text;
else if (!strcmp(attr->name, "job-state-reasons") &&
attr->value_tag == IPP_TAG_KEYWORD)
reasons = attr;
diff --git a/test/ippserver.c b/test/ippserver.c
index 1fde82c4f..65039c6b3 100644
--- a/test/ippserver.c
+++ b/test/ippserver.c
@@ -480,7 +480,8 @@ main(int argc, /* I - Number of command-line args */
i ++;
if (i >= argc)
usage(1);
- strlcpy(directory, argv[i], sizeof(directory));
+ strncpy(directory, argv[i], sizeof(directory) - 1);
+ directory[sizeof(directory) - 1] = '\0';
break;
case 'f' : /* -f type/subtype[,...] */
@@ -1061,7 +1062,7 @@ create_listener(int family, /* I - Address family */
if (!*port)
{
- *port = 8000 + (getuid() % 1000);
+ *port = 8000 + ((int)getuid() % 1000);
fprintf(stderr, "Listening on port %d.\n", *port);
}
@@ -1482,7 +1483,11 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default)
ptr += strlen(ptr);
prefix = ",";
}
- strlcat(device_id, ";", sizeof(device_id));
+ if (ptr < (device_id + sizeof(device_id) - 1))
+ {
+ *ptr++ = ';';
+ *ptr = '\0';
+ }
/*
* Get the maximum spool size based on the size of the filesystem used for
@@ -5270,7 +5275,7 @@ process_job(_ipp_job_t *job) /* I - Job */
* Sleep for a random amount of time to simulate job processing.
*/
- sleep(5 + (rand() % 11));
+ sleep((unsigned)(5 + (rand() % 11)));
}
if (job->cancel)
@@ -5383,7 +5388,10 @@ register_printer(
if (subtype && *subtype)
snprintf(regtype, sizeof(regtype), "_ipp._tcp,%s", subtype);
else
- strlcpy(regtype, "_ipp._tcp", sizeof(regtype));
+ {
+ strncpy(regtype, "_ipp._tcp", sizeof(regtype) - 1);
+ regtype[sizeof(regtype) - 1] = '\0';
+ }
if ((error = DNSServiceRegister(&(printer->ipp_ref),
kDNSServiceFlagsShareConnection,
@@ -5411,7 +5419,10 @@ register_printer(
if (subtype && *subtype)
snprintf(regtype, sizeof(regtype), "_ipps._tcp,%s", subtype);
else
- strlcpy(regtype, "_ipps._tcp", sizeof(regtype));
+ {
+ strncpy(regtype, "_ipps._tcp", sizeof(regtype) - 1);
+ regtype[sizeof(regtype) - 1] = '\0';
+ }
if ((error = DNSServiceRegister(&(printer->ipps_ref),
kDNSServiceFlagsShareConnection,