]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Eliminate new GCC compiler warnings (Issue #5591)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 13 Jun 2019 20:39:34 +0000 (16:39 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 13 Jun 2019 20:39:34 +0000 (16:39 -0400)
CHANGES.md
scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
scheduler/subscriptions.c
tools/ippeveprinter.c

index 35fb5b5f222fe29f891ea9b802ccd49aeef3f7aa..74c6c59e96e5d2fb7d3d7041586b20c39c669a3d 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.3.0 - 2019-06-12
+CHANGES - 2.3.0 - 2019-06-13
 ============================
 
 
@@ -7,6 +7,7 @@ Changes in CUPS v2.3.0
 
 - Fixed a bug in the scheduler job cleanup code (Issue #5588)
 - Fixed builds when there is no TLS library (Issue #5590)
+- Eliminated some new GCC compiler warnings (Issue #5591)
 - Removed dead code from the scheduler (Issue #5593)
 - "make" failed with GZIP options (Issue #5595)
 - Fixed an issue with `EXPECT !name WITH-VALUE ...` tests.
index d519b85c0bb6630dd672e9667db5d10519101628..a385597513d25b6033bab158a104d61d1809bcbc 100644 (file)
@@ -1902,18 +1902,14 @@ add_job(cupsd_client_t  *con,           /* I - Client connection */
   * Fill in the response info...
   */
 
-  httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL,
-                   con->clientname, con->clientport, "/jobs/%d", job->id);
-  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL,
-               job_uri);
+  httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, con->clientname, con->clientport, "/jobs/%d", job->id);
+  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, job_uri);
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
 
-  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
-                job->state_value);
+  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state", (int)job->state_value);
   ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_TEXT, "job-state-message", NULL, "");
-  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-state-reasons",
-               NULL, job->reasons->values[0].string.text);
+  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-state-reasons", NULL, job->reasons->values[0].string.text);
 
   con->response->request.status.status_code = IPP_OK;
 
@@ -3283,7 +3279,7 @@ cancel_all_jobs(cupsd_client_t  *con,     /* I - Client connection */
       * Cancel all jobs on all printers...
       */
 
-      cupsdCancelJobs(NULL, username, purge);
+      cupsdCancelJobs(NULL, username, purge != CUPSD_JOB_DEFAULT);
 
       cupsdLogMessage(CUPSD_LOG_INFO, "All jobs were %s by \"%s\".",
                      purge == CUPSD_JOB_PURGE ? "purged" : "canceled",
@@ -3342,7 +3338,7 @@ cancel_all_jobs(cupsd_client_t  *con,     /* I - Client connection */
       * Cancel all of the jobs on the named printer...
       */
 
-      cupsdCancelJobs(printer->name, username, purge);
+      cupsdCancelJobs(printer->name, username, purge != CUPSD_JOB_DEFAULT);
 
       cupsdLogMessage(CUPSD_LOG_INFO, "All jobs on \"%s\" were %s by \"%s\".",
                      printer->name,
@@ -3998,8 +3994,7 @@ close_job(cupsd_client_t  *con,           /* I - Client connection */
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
 
-  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
-                job->state_value);
+  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state", (int)job->state_value);
 
   con->response->request.status.status_code = IPP_OK;
 
@@ -4965,7 +4960,7 @@ copy_printer_attrs(
     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME, "printer-op-policy", NULL, printer->op_policy);
 
   if (!ra || cupsArrayFind(ra, "printer-state"))
-    ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", printer->state);
+    ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", (int)printer->state);
 
   if (!ra || cupsArrayFind(ra, "printer-state-change-date-time"))
     ippAddDate(con->response, IPP_TAG_PRINTER, "printer-state-change-date-time", ippTimeToDate(printer->state_time));
@@ -5510,7 +5505,7 @@ create_local_printer(
   add_printer_attributes:
 
   ippAddBoolean(con->response, IPP_TAG_PRINTER, "printer-is-accepting-jobs", (char)printer->accepting);
-  ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", printer->state);
+  ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", (int)printer->state);
   add_printer_state_reasons(con, printer);
 
   httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), httpIsEncrypted(con->http) ? "ipps" : "ipp", NULL, con->clientname, con->clientport, "/printers/%s", printer->name);
@@ -9947,17 +9942,13 @@ send_document(cupsd_client_t  *con,     /* I - Client connection */
   * Fill in the response info...
   */
 
-  httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL,
-                   con->clientname, con->clientport, "/jobs/%d", jobid);
-  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL,
-               job_uri);
+  httpAssembleURIf(HTTP_URI_CODING_ALL, job_uri, sizeof(job_uri), "ipp", NULL, con->clientname, con->clientport, "/jobs/%d", jobid);
+  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_URI, "job-uri", NULL, job_uri);
 
   ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", jobid);
 
-  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state",
-                job->state_value);
-  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-state-reasons",
-               NULL, job->reasons->values[0].string.text);
+  ippAddInteger(con->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state", (int)job->state_value);
+  ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-state-reasons", NULL, job->reasons->values[0].string.text);
 
   con->response->request.status.status_code = IPP_OK;
 
index 6b2f3e7089757543fb9676fa17cbc2494984aa2f..4e8990fe52cb0602e961aeb07585c124c0c5c788 100644 (file)
@@ -2577,7 +2577,7 @@ cupsdSetJobState(
   job->state_value = newstate;
 
   if (job->state)
-    job->state->values[0].integer = newstate;
+    job->state->values[0].integer = (int)newstate;
 
   switch (newstate)
   {
index e4841c0713cd2580fe1345d3385be05ecd352b8c..3fb46dc8910829ed30b833c5e65df3483b26b468 100644 (file)
@@ -4586,7 +4586,7 @@ load_ppd(cupsd_printer_t *p)              /* I - Printer */
       for (fin = (_pwg_finishings_t *)cupsArrayFirst(p->pc->finishings); fin; fin = (_pwg_finishings_t *)cupsArrayNext(p->pc->finishings))
       {
         if (num_finishings < (int)(sizeof(finishings) / sizeof(finishings[0])))
-          finishings[num_finishings++] = fin->value;
+          finishings[num_finishings++] = (int)fin->value;
 
         switch (fin->value)
         {
index 0908f3c0cedc76a6f9ac88f561a9f46e47e0a38d..ecd6334c4de04a82832675dbf873a6f277c436b0 100644 (file)
@@ -163,27 +163,18 @@ cupsdAddEvent(
        * Add printer attributes...
        */
 
-       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI,
-                    "notify-printer-uri", NULL, dest->uri);
+       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_URI, "notify-printer-uri", NULL, dest->uri);
 
-       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
-                    "printer-name", NULL, dest->name);
+       ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME, "printer-name", NULL, dest->name);
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
-                     "printer-state", dest->state);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM, "printer-state", (int)dest->state);
 
        if (dest->num_reasons == 0)
-         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                      IPP_TAG_KEYWORD, "printer-state-reasons", NULL,
-                      dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
+         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "printer-state-reasons", NULL, dest->state == IPP_PRINTER_STOPPED ? "paused" : "none");
        else
-         ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                       IPP_TAG_KEYWORD, "printer-state-reasons",
-                       dest->num_reasons, NULL,
-                       (const char * const *)dest->reasons);
+         ippAddStrings(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "printer-state-reasons", dest->num_reasons, NULL, (const char * const *)dest->reasons);
 
-       ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                     "printer-is-accepting-jobs", (char)dest->accepting);
+       ippAddBoolean(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, "printer-is-accepting-jobs", (char)dest->accepting);
       }
 
       if (job)
@@ -192,75 +183,51 @@ cupsdAddEvent(
        * Add job attributes...
        */
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                     "notify-job-id", job->id);
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
-                     "job-state", job->state_value);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER, "notify-job-id", job->id);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM, "job-state", (int)job->state_value);
 
-        if ((attr = ippFindAttribute(job->attrs, "job-name",
-                                    IPP_TAG_NAME)) != NULL)
-         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME,
-                      "job-name", NULL, attr->values[0].string.text);
+        if ((attr = ippFindAttribute(job->attrs, "job-name", IPP_TAG_NAME)) != NULL)
+         ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_NAME, "job-name", NULL, attr->values[0].string.text);
 
        switch (job->state_value)
        {
          case IPP_JOB_PENDING :
               if (dest && dest->state == IPP_PRINTER_STOPPED)
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "printer-stopped");
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "printer-stopped");
               else
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "none");
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "none");
               break;
 
          case IPP_JOB_HELD :
               if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_KEYWORD) != NULL ||
                  ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME) != NULL)
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "job-hold-until-specified");
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-hold-until-specified");
               else
-               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                            IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                            "job-incoming");
+               ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-incoming");
               break;
 
          case IPP_JOB_PROCESSING :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-printing");
+              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-printing");
               break;
 
          case IPP_JOB_STOPPED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-stopped");
+              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-stopped");
               break;
 
          case IPP_JOB_CANCELED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-canceled-by-user");
+              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-canceled-by-user");
               break;
 
          case IPP_JOB_ABORTED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "aborted-by-system");
+              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "aborted-by-system");
               break;
 
          case IPP_JOB_COMPLETED :
-              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
-                          IPP_TAG_KEYWORD, "job-state-reasons", NULL,
-                          "job-completed-successfully");
+              ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_KEYWORD, "job-state-reasons", NULL, "job-completed-successfully");
               break;
        }
 
-       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER,
-                     "job-impressions-completed",
-                     job->sheets ? job->sheets->values[0].integer : 0);
+       ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_INTEGER, "job-impressions-completed", job->sheets ? job->sheets->values[0].integer : 0);
       }
 
      /*
@@ -274,8 +241,7 @@ cupsdAddEvent(
   if (temp)
     cupsdMarkDirty(CUPSD_DIRTY_SUBSCRIPTIONS);
   else
-    cupsdLogMessage(CUPSD_LOG_DEBUG, "Discarding unused %s event...",
-                    cupsdEventName(event));
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "Discarding unused %s event...", cupsdEventName(event));
 }
 
 
index 43353cc93949246c9809cd5338395f5c4920eb14..76c57961a5262826cabd3c589c597e739a678dc5 100644 (file)
@@ -4861,13 +4861,13 @@ load_ppd_attributes(
   attr = ippAddIntegers(attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM, "finishings-ready", cupsArrayCount(pc->finishings) + 1, NULL);
   ippSetInteger(attrs, &attr, 0, IPP_FINISHINGS_NONE);
   for (i = 1, finishings = (_pwg_finishings_t *)cupsArrayFirst(pc->finishings); finishings; i ++, finishings = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
-    ippSetInteger(attrs, &attr, i, finishings->value);
+    ippSetInteger(attrs, &attr, i, (int)finishings->value);
 
   /* finishings-supported */
   attr = ippAddIntegers(attrs, IPP_TAG_PRINTER, IPP_TAG_ENUM, "finishings-supported", cupsArrayCount(pc->finishings) + 1, NULL);
   ippSetInteger(attrs, &attr, 0, IPP_FINISHINGS_NONE);
   for (i = 1, finishings = (_pwg_finishings_t *)cupsArrayFirst(pc->finishings); finishings; i ++, finishings = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
-    ippSetInteger(attrs, &attr, i, finishings->value);
+    ippSetInteger(attrs, &attr, i, (int)finishings->value);
 
   /* media-bottom-margin-supported */
   for (i = 0, num_margins = 0, pwg_size = pc->sizes; i < pc->num_sizes && num_margins < (int)(sizeof(margins) / sizeof(margins[0])); i ++, pwg_size ++)