]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix Linux builds without normal prerequisite libraries installed.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 28 Aug 2014 15:37:22 +0000 (15:37 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Thu, 28 Aug 2014 15:37:22 +0000 (15:37 +0000)
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

18 files changed:
backend/network.c
backend/usb-unix.c
cups/globals.c
cups/http-support.c
cups/http.c
cups/md5.c
cups/ppd-cache.c
cups/sidechannel.c
cups/tls.c
cups/usersys.c
filter/raster.c
filter/rastertoepson.c
scheduler/auth.c
scheduler/client.c
scheduler/cups-driverd.cxx
scheduler/ipp.c
systemv/lpstat.c
test/ippserver.c

index 62be7f399e6c82930cc1f1ad2908c84553f3759d..4560fb03375509f48750e2ef148206c8035d7690 100644 (file)
@@ -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 :
index ae344a4d43c4440956c26268340947cb45557abb..870cbfd68a03b4b15f8f8f070c232c87ac936da0 100644 (file)
@@ -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 ****/
 
index df742c4077754a1952f75447bf40dc6ac41594a0..7218d28447e9fcc5b14528aacb920e4fc87b430c 100644 (file)
@@ -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]);
index 18762669f17f1261d6dd5f28b78e912662eb71b8..4207ae299fe417a0505f11efb47dda6ed6703b80 100644 (file)
@@ -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;
     }
index 1d6e4f75c5a336cfe4447d9d5c66670c0c47e8cf..9520fa4bd502b0a6baadbdbbe6891053ef898052 100644 (file)
@@ -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... */
index c2d627bd9dd985a43a15cb140cc05740272e9f82..851715ff110015d020a8610737404836718bb737 100644 (file)
@@ -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)
index 8b29e04d17109146313b060aa9ad994a41251d6a..510bb5f9f5dbafaa69765bdde8bc4dfa44ccd6e0 100644 (file)
@@ -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);
 }
 
 
index 0928d8b34fe6881a478dab03f6fba294e62b04e5..8dc2ce0ff8aeb6ed0d52ac1184063fcafd79d45b 100644 (file)
@@ -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...
index 1a0b00fa41468fccc7fa344b82296f4981fed22a..f0d799d1d3d98954eb171842e2a5cf1f6d12f17b 100644 (file)
 #    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 */
 
 
index b6ef93e4dcac813a00559f5c9ac851291a6582ba..b0568ddfc295e4729ff4f820d55f44b0366c3fa0 100644 (file)
@@ -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);
 }
index d1387086d79b5a5d3b6ca1920da0bb92b843b9a6..f6eb3d40600f78122c4ea697b5e17af9a06ec3f5 100644 (file)
@@ -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;
 
index 0975d3e7b17a013f9811a15f527a187af0b00f3e..87243a96629bd3a3712470fa7132fd77775bf57f 100644 (file)
@@ -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)
       {
index a7b3f9866744bd3c7a383508739e7d8cc9987f81..23fe843a0c68e6994958e133e4250be57c22ffbf 100644 (file)
@@ -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';
 
index 36dd3ad0b5a987e40e0239b1469cf6054529b5a7..8169895cc6e4bfa5a2b9da5a1d35a528e7e44bd6 100644 (file)
@@ -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);
            }
          }
 
index c6e4b17e5c01fd51a999ab5cddd424e9ad7d8404..7924bc95bd97eef508599b6c1b1147e0fbc61a51 100644 (file)
@@ -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...
index 0e682ee8c2677e1a7051fdbb83d7c59bc4dd727d..d775fb7ee6ae0b07ad07e3ba71ee19d71e1ed091 100644 (file)
@@ -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)
   {
index f77fc5873d436c1b1a45427b81ac4688f215a213..43e4c7a33098fbbb784b8dfcdde02f7c385bdece 100644 (file)
@@ -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;
index 1fde82c4f99722822ca2936662b08aac47bee7d3..65039c6b315cf191eb05a9e4363a7eed226b3763 100644 (file)
@@ -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,