]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix compiler warnings from new clang - lots of enums being assigned to ints but
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:12:22 +0000 (15:12 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 7 Oct 2019 19:12:22 +0000 (15:12 -0400)
the compiler deciding that was worthy of a warning (even though the range of
values clearly falls within the range of an int...)

backend/ipp.c
cups/ppd-cache.c
filter/rastertohp.c
scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
scheduler/subscriptions.c
test/ippfind.c
test/ippserver.c
test/ipptool.c

index 23a46a7675320d945c14ae10eb264cf8eafc9ada..482d6f766ecad949b4834ce8d32fe4eeee49673f 100644 (file)
@@ -2572,7 +2572,7 @@ monitor_printer(
       }
 
       fprintf(stderr, "DEBUG: (monitor) job-state = %s\n",
-              ippEnumString("job-state", monitor->job_state));
+              ippEnumString("job-state", (int)monitor->job_state));
 
       if (!job_canceled &&
           (monitor->job_state == IPP_JSTATE_CANCELED ||
@@ -2654,7 +2654,7 @@ monitor_printer(
       ippDelete(response);
 
       fprintf(stderr, "DEBUG: (monitor) job-state = %s\n",
-              ippEnumString("job-state", monitor->job_state));
+              ippEnumString("job-state", (int)monitor->job_state));
 
       if (!job_canceled &&
           (monitor->job_state == IPP_JSTATE_CANCELED ||
index b1b53e4b30be4872186be1d440ab7b582d0397e9..02e502f8fb1ff191dd1e475b98903496ff8c6454 100644 (file)
@@ -2089,7 +2089,7 @@ _ppdCacheGetFinishingValues(
        f;
        f = (_pwg_finishings_t *)cupsArrayNext(pc->finishings))
   {
-    DEBUG_printf(("_ppdCacheGetFinishingValues: Checking %d (%s)", f->value, ippEnumString("finishings", f->value)));
+    DEBUG_printf(("_ppdCacheGetFinishingValues: Checking %d (%s)", (int)f->value, ippEnumString("finishings", (int)f->value)));
 
     for (i = f->num_options, option = f->options; i > 0; i --, option ++)
     {
@@ -2105,9 +2105,9 @@ _ppdCacheGetFinishingValues(
 
     if (i == 0)
     {
-      DEBUG_printf(("_ppdCacheGetFinishingValues: Adding %d (%s)", f->value, ippEnumString("finishings", f->value)));
+      DEBUG_printf(("_ppdCacheGetFinishingValues: Adding %d (%s)", (int)f->value, ippEnumString("finishings", (int)f->value)));
 
-      values[num_values ++] = f->value;
+      values[num_values ++] = (int)f->value;
 
       if (num_values >= max_values)
         break;
index eb11c8c1f8d10644f0680dfff06cfcd751f02814..d231bdca3f17a5ed011f8419cda24525f2e5625c 100644 (file)
@@ -111,7 +111,7 @@ StartPage(ppd_file_t         *ppd,  /* I - PPD file */
   * Setup printer/job attributes...
   */
 
-  Duplex    = header->Duplex;
+  Duplex    = (int)header->Duplex;
   ColorBits = header->cupsBitsPerColor;
 
   if ((!Duplex || (Page & 1)) && header->MediaPosition)
index 9be8a7f3b67f82d4d6a09e22bebbd191d06cd2f9..07765a15b426bfef20f61c264895560d696a81f5 100644 (file)
@@ -1918,7 +1918,7 @@ add_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);
+                (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);
@@ -3284,7 +3284,7 @@ cancel_all_jobs(cupsd_client_t  *con,     /* I - Client connection */
       * Cancel all jobs on all printers...
       */
 
-      cupsdCancelJobs(NULL, username, purge);
+      cupsdCancelJobs(NULL, username, (int)purge);
 
       cupsdLogMessage(CUPSD_LOG_INFO, "All jobs were %s by \"%s\".",
                      purge == CUPSD_JOB_PURGE ? "purged" : "canceled",
@@ -3343,7 +3343,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, (int)purge);
 
       cupsdLogMessage(CUPSD_LOG_INFO, "All jobs on \"%s\" were %s by \"%s\".",
                      printer->name,
@@ -4000,7 +4000,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);
+                (int)job->state_value);
 
   con->response->request.status.status_code = IPP_OK;
 
@@ -4995,7 +4995,7 @@ copy_printer_attrs(
 
   if (!ra || cupsArrayFind(ra, "printer-state"))
     ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state",
-                  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));
@@ -5541,7 +5541,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);
@@ -9971,7 +9971,7 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
   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);
+                (int)job->state_value);
   ippAddString(con->response, IPP_TAG_JOB, IPP_TAG_KEYWORD, "job-state-reasons",
                NULL, job->reasons->values[0].string.text);
 
index 1a7a34ca9f95c6269ec80317e2493b7ca77a1f15..7c87e76e205a70caffda1fa150be05596bbe76b0 100644 (file)
@@ -2581,7 +2581,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 937d0f3c9da014f7b429fa917fe16a6d4c9dbd0c..9c1e18600858a83d6227d528eb2cde6e081fc245 100644 (file)
@@ -4523,7 +4523,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 cac340520d9d02a9263baf21fb92162dc43f7d5a..4bdd1f00eda5faea3ae1dcb6aa73d9f4a9864ace 100644 (file)
@@ -174,7 +174,7 @@ cupsdAddEvent(
                     "printer-name", NULL, dest->name);
 
        ippAddInteger(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_ENUM,
-                     "printer-state", dest->state);
+                     "printer-state", (int)dest->state);
 
        if (dest->num_reasons == 0)
          ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION,
@@ -199,7 +199,7 @@ cupsdAddEvent(
        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);
+                     "job-state", (int)job->state_value);
 
         if ((attr = ippFindAttribute(job->attrs, "job-name",
                                     IPP_TAG_NAME)) != NULL)
index 012609d96b7a1a03f92c673e686dca13c0fd9ab2..a63aba0a790beead4016dea9d78631e122ed376c 100644 (file)
@@ -1798,7 +1798,7 @@ eval_expr(ippfind_srv_t  *service,        /* I - Service */
   */
 
   if (expressions && expressions->parent)
-    logic = expressions->parent->op;
+    logic = (int)expressions->parent->op;
   else
     logic = IPPFIND_OP_AND;
 
@@ -2370,7 +2370,7 @@ list_service(ippfind_srv_t *service)      /* I - Service */
     httpClose(http);
 
     _cupsLangPrintf(stdout, "%s %s %s %s", service->uri,
-                    ippEnumString("printer-state", pstate),
+                    ippEnumString("printer-state", (int)pstate),
                     paccepting ? "accepting-jobs" : "not-accepting-jobs",
                     preasons);
   }
index 7d83158a2291bf05ecae357b89a08d4f502687cf..b58c8507a6434649fc4906b88550db3c22f98fb5 100644 (file)
@@ -834,7 +834,7 @@ copy_job_attributes(
 
   if (!ra || cupsArrayFind(ra, "job-state"))
     ippAddInteger(client->response, IPP_TAG_JOB, IPP_TAG_ENUM,
-                 "job-state", job->state);
+                 "job-state", (int)job->state);
 
   if (!ra || cupsArrayFind(ra, "job-state-message"))
   {
@@ -3647,7 +3647,7 @@ ipp_get_printer_attributes(
 
   if (!ra || cupsArrayFind(ra, "printer-state"))
     ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_ENUM,
-                  "printer-state", printer->state);
+                  "printer-state", (int)printer->state);
 
   if (!ra || cupsArrayFind(ra, "printer-state-change-date-time"))
     ippAddDate(client->response, IPP_TAG_PRINTER, "printer-state-change-date-time", ippTimeToDate(printer->state_time));
index 703e6810eccea5f0a61abf7157cc4c276d537393..750128fd2aeb8a93a13cb99da64bbacd3ad69c64 100644 (file)
@@ -2619,7 +2619,7 @@ do_tests(cups_file_t  *outfile,           /* I - Output file */
                 group = attrptr ? attrptr->group_tag : IPP_TAG_ZERO;
             attrptr;
             attrptr = attrptr->next)
-         print_attr(outfile, Output, attrptr, &group);
+         print_attr(outfile, (int)Output, attrptr, &group);
        cupsFilePuts(outfile, "</dict>\n");
       }
       cupsFilePuts(outfile, "</array>\n");
@@ -3388,7 +3388,7 @@ do_tests(cups_file_t  *outfile,           /* I - Output file */
                group = attrptr ? attrptr->group_tag : IPP_TAG_ZERO;
           attrptr;
           attrptr = attrptr->next)
-       print_attr(outfile, Output, attrptr, &group);
+       print_attr(outfile, (int)Output, attrptr, &group);
       cupsFilePuts(outfile, "</dict>\n");
       cupsFilePuts(outfile, "</array>\n");
     }
@@ -3494,7 +3494,7 @@ do_tests(cups_file_t  *outfile,           /* I - Output file */
          {
            if (!strcmp(displayed[i], attrptr->name))
            {
-             print_attr(outfile, Output, attrptr, NULL);
+             print_attr(outfile, (int)Output, attrptr, NULL);
              break;
            }
          }