]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-addrlist.c
Import CUPS 1.4svn-r7464.
[thirdparty/cups.git] / cups / http-addrlist.c
index 6700e567da45cb01d2b2a7c12d333884f46799f2..6d645053cae98af13c81b45b451818277a423e75 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: http-addrlist.c 5679 2006-06-20 14:45:15Z mike $"
+ * "$Id: http-addrlist.c 6649 2007-07-11 21:46:42Z mike $"
  *
  *   HTTP address list routines for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+ *   Copyright 2007-2008 by Apple Inc.
+ *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  * Contents:
  *
@@ -62,7 +53,7 @@ httpAddrConnect(
     * Create the socket...
     */
 
-    if ((*sock = socket(addrlist->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
+    if ((*sock = (int)socket(addrlist->addr.addr.sa_family, SOCK_STREAM, 0)) < 0)
     {
      /*
       * Don't abort yet, as this could just be an issue with the local
@@ -186,16 +177,17 @@ httpAddrGetList(const char *hostname,     /* I - Hostname, IP address, or NULL for p
 
 
 #ifdef DEBUG
-  printf("httpAddrGetList(hostname=\"%s\", family=AF_%s, service=\"%s\")\n",
-         hostname ? hostname : "(nil)",
-        family == AF_UNSPEC ? "UNSPEC" :
+  _cups_debug_printf("httpAddrGetList(hostname=\"%s\", family=AF_%s, "
+                     "service=\"%s\")\n",
+                    hostname ? hostname : "(nil)",
+                    family == AF_UNSPEC ? "UNSPEC" :
 #  ifdef AF_LOCAL
-            family == AF_LOCAL ? "LOCAL" :
+                        family == AF_LOCAL ? "LOCAL" :
 #  endif /* AF_LOCAL */
 #  ifdef AF_INET6
-            family == AF_INET6 ? "INET6" :
+                        family == AF_INET6 ? "INET6" :
 #  endif /* AF_INET6 */
-            family == AF_INET ? "INET" : "???", service);
+                        family == AF_INET ? "INET" : "???", service);
 #endif /* DEBUG */
 
  /*
@@ -211,9 +203,11 @@ httpAddrGetList(const char *hostname,      /* I - Hostname, IP address, or NULL for p
     * Domain socket address...
     */
 
-    first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
-    first->addr.un.sun_family = AF_LOCAL;
-    strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
+    if ((first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t))) != NULL)
+    {
+      first->addr.un.sun_family = AF_LOCAL;
+      strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
+    }
   }
   else
 #endif /* AF_LOCAL */
@@ -248,7 +242,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
        */
 
        strlcpy(ipv6, hostname + 4, sizeof(ipv6));
-       if ((ipv6len = strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
+       if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
        {
           ipv6[ipv6len] = '\0';
          hostname      = ipv6;
@@ -268,7 +262,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
        */
 
        strlcpy(ipv6, hostname + 1, sizeof(ipv6));
-       if ((ipv6len = strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
+       if ((ipv6len = (int)strlen(ipv6) - 1) >= 0 && ipv6[ipv6len] == ']')
        {
           ipv6[ipv6len] = '\0';
          hostname      = ipv6;
@@ -605,5 +599,5 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
 
 
 /*
- * End of "$Id: http-addrlist.c 5679 2006-06-20 14:45:15Z mike $".
+ * End of "$Id: http-addrlist.c 6649 2007-07-11 21:46:42Z mike $".
  */