]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/dest-options.c
Move debug printfs to internal usage only.
[thirdparty/cups.git] / cups / dest-options.c
index 38317085efe8a0737153de7eb003a18d037d57b6..308ee33597cb0d6ae7881d29281f547d8108dd15 100644 (file)
@@ -1,9 +1,10 @@
 /*
  * Destination option/media support for CUPS.
  *
- * Copyright 2012-2018 by Apple Inc.
+ * Copyright © 2012-2018 by Apple Inc.
  *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
@@ -11,6 +12,7 @@
  */
 
 #include "cups-private.h"
+#include "debug-internal.h"
 
 
 /*
@@ -693,17 +695,27 @@ cupsCopyDestInfo(
 
   if (!http)
   {
+    DEBUG_puts("1cupsCopyDestInfo: Default server connection.");
     http   = _cupsConnect();
     dflags = CUPS_DEST_FLAGS_NONE;
   }
 #ifdef AF_LOCAL
-  else if (strcmp(http->hostname, cg->server) || (httpAddrFamily(http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(http->hostaddr)))
-#else
-  else if (strcmp(http->hostname, cg->server) || cg->ipp_port != httpAddrPort(http->hostaddr))
+  else if (httpAddrFamily(http->hostaddr) == AF_LOCAL)
+  {
+    DEBUG_puts("1cupsCopyDestInfo: Connection to server (domain socket).");
+    dflags = CUPS_DEST_FLAGS_NONE;
+  }
 #endif /* AF_LOCAL */
+  else if ((strcmp(http->hostname, cg->server) && cg->server[0] != '/') || cg->ipp_port != httpAddrPort(http->hostaddr))
+  {
+    DEBUG_printf(("1cupsCopyDestInfo: Connection to device (%s).", http->hostname));
     dflags = CUPS_DEST_FLAGS_DEVICE;
+  }
   else
+  {
+    DEBUG_printf(("1cupsCopyDestInfo: Connection to server (%s).", http->hostname));
     dflags = CUPS_DEST_FLAGS_NONE;
+  }
 
  /*
   * Range check input...
@@ -1515,18 +1527,18 @@ cups_collection_string(
         if (!ippGetBoolean(member, 0))
         {
          if (bufptr < bufend)
-           strlcpy(bufptr, "no", bufend - bufptr + 1);
+           strlcpy(bufptr, "no", (size_t)(bufend - bufptr + 1));
          bufptr += 2;
         }
 
        if (bufptr < bufend)
-         strlcpy(bufptr, mname, bufend - bufptr + 1);
+         strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
        bufptr += strlen(mname);
         continue;
       }
 
       if (bufptr < bufend)
-        strlcpy(bufptr, mname, bufend - bufptr + 1);
+        strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
       bufptr += strlen(mname);
 
       if (bufptr < bufend)
@@ -1562,7 +1574,7 @@ cups_collection_string(
           {
             case IPP_TAG_INTEGER :
             case IPP_TAG_ENUM :
-                bufptr += snprintf(bufptr, bufptr < bufend ? (bufend - bufptr + 1) : 0, "%d", ippGetInteger(member, j));
+                bufptr += snprintf(bufptr, bufptr < bufend ? (size_t)(bufend - bufptr + 1) : 0, "%d", ippGetInteger(member, j));
                 break;
 
            case IPP_TAG_STRING :