]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/request.c
Changes to eliminate warnings from new Clang.
[thirdparty/cups.git] / cups / request.c
index 3ee1da04ca24fad5877d72fb4b4a2809691787fe..1ab0cc3c5b989ccf34553d1a58931479f0c4b4a1 100644 (file)
@@ -53,10 +53,7 @@ cupsDoFileRequest(http_t     *http,  /* I - Connection to server or @code CUPS_HT
   int          infile;                 /* Input file */
 
 
-  DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
-                "filename=\"%s\")", http, request,
-               request ? ippOpString(request->request.op.operation_id) : "?",
-               resource, filename));
+  DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", filename=\"%s\")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, filename));
 
   if (filename)
   {
@@ -117,10 +114,7 @@ cupsDoIORequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
   char         buffer[32768];          /* Output buffer */
 
 
-  DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
-                "infile=%d, outfile=%d)", http, request,
-               request ? ippOpString(request->request.op.operation_id) : "?",
-               resource, infile, outfile));
+  DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", infile=%d, outfile=%d)", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, infile, outfile));
 
  /*
   * Range check input...
@@ -304,10 +298,7 @@ cupsDoRequest(http_t     *http,            /* I - Connection to server or @code CUPS_HTTP_
               ipp_t      *request,     /* I - IPP request */
               const char *resource)    /* I - HTTP resource for POST */
 {
-  DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")",
-                http, request,
-               request ? ippOpString(request->request.op.operation_id) : "?",
-               resource));
+  DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource));
 
   return (cupsDoIORequest(http, request, resource, -1, -1));
 }
@@ -333,7 +324,7 @@ cupsGetResponse(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
   ipp_t                *response = NULL;       /* IPP response */
 
 
-  DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", http, resource));
+  DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", (void *)http, resource));
   DEBUG_printf(("1cupsGetResponse: http->state=%d", http ? http->state : HTTP_STATE_ERROR));
 
  /*
@@ -557,8 +548,7 @@ cupsReadResponseData(
   * Get the default connection as needed...
   */
 
-  DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
-                "length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
+  DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (void *)buffer, CUPS_LLCAST length));
 
   if (!http)
   {
@@ -610,10 +600,7 @@ cupsSendRequest(http_t     *http,  /* I - Connection to server or @code CUPS_HTTP
   http_status_t                expect;         /* Expect: header to use */
 
 
-  DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
-                "length=" CUPS_LLFMT ")", http, request,
-               request ? ippOpString(request->request.op.operation_id) : "?",
-               resource, CUPS_LLCAST length));
+  DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", length=" CUPS_LLFMT ")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, CUPS_LLCAST length));
 
  /*
   * Range check input...
@@ -747,9 +734,8 @@ cupsSendRequest(http_t     *http,   /* I - Connection to server or @code CUPS_HTTP
     got_status     = 0;
 
     while ((state = ippWrite(http, request)) != IPP_STATE_DATA)
-      if (state == IPP_STATE_ERROR)
-       break;
-      else if (httpCheck(http))
+    {
+      if (httpCheck(http))
       {
         got_status = 1;
 
@@ -757,15 +743,30 @@ cupsSendRequest(http_t     *http, /* I - Connection to server or @code CUPS_HTTP
        if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
          break;
       }
+      else if (state == IPP_STATE_ERROR)
+       break;
+    }
 
     if (state == IPP_STATE_ERROR)
     {
-      DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
+     /*
+      * We weren't able to send the IPP request. But did we already get a HTTP
+      * error status?
+      */
 
-      http->status = HTTP_STATUS_ERROR;
-      http->state  = HTTP_STATE_WAITING;
+      if (!got_status || status < HTTP_STATUS_MULTIPLE_CHOICES)
+      {
+       /*
+        * No, something else went wrong.
+       */
 
-      return (HTTP_STATUS_ERROR);
+       DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
+
+       http->status = HTTP_STATUS_ERROR;
+       http->state  = HTTP_STATE_WAITING;
+
+       return (HTTP_STATUS_ERROR);
+      }
     }
 
    /*
@@ -906,8 +907,7 @@ cupsWriteRequestData(
   * Get the default connection as needed...
   */
 
-  DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
-                "length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
+  DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (void *)buffer, CUPS_LLCAST length));
 
   if (!http)
   {