]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-addrlist.c
<rdar://problem/15386424> cups.org: gunzip bug prevents use of some gzip'd PPD files...
[thirdparty/cups.git] / cups / http-addrlist.c
index 0b7e24359fbad5df8f59743d598e32c4539ab343..287692ff3d6434fd57aab764a8d235f04407eac5 100644 (file)
@@ -1,25 +1,16 @@
 /*
  * "$Id$"
  *
- *   HTTP address list routines for CUPS.
+ * HTTP address list routines for CUPS.
  *
- *   Copyright 2007-2013 by Apple Inc.
- *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
- *   These coded instructions, statements, and computer programs are the
- *   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:
- *
- *   httpAddrConnect() - Connect to any of the addresses in the list.
- *   httpAddrConnect2() - Connect to any of the addresses in the list with a
- *                       timeout and optional cancel.
- *   httpAddrCopyList() - Copy an address list.
- *   httpAddrFreeList() - Free an address list.
- *   httpAddrGetList() - Get a list of addresses for a hostname.
+ * These coded instructions, statements, and computer programs are the
+ * 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/".
  */
 
 /*
@@ -225,11 +216,7 @@ httpAddrConnect2(
 
             DEBUG_puts("1httpAddrConnect2: Canceled connect()");
 
-#    ifdef WIN32
-           closesocket(*sock);
-#    else
-           close(*sock);
-#    endif /* WIN32 */
+            httpAddrClose(NULL, *sock);
 
            *sock = -1;
 
@@ -297,11 +284,7 @@ httpAddrConnect2(
     * Close this socket and move to the next address...
     */
 
-#ifdef WIN32
-    closesocket(*sock);
-#else
-    close(*sock);
-#endif /* WIN32 */
+    httpAddrClose(NULL, *sock);
 
     *sock    = -1;
     addrlist = addrlist->next;
@@ -647,9 +630,10 @@ httpAddrGetList(const char *hostname,      /* I - Hostname, IP address, or NULL for p
            return (NULL);
 
           first->addr.ipv4.sin_family = AF_INET;
-          first->addr.ipv4.sin_addr.s_addr = htonl(((((((ip[0] << 8) |
-                                                      ip[1]) << 8) |
-                                                    ip[2]) << 8) | ip[3]));
+          first->addr.ipv4.sin_addr.s_addr = htonl((((((((unsigned)ip[0] << 8) |
+                                                      (unsigned)ip[1]) << 8) |
+                                                    (unsigned)ip[2]) << 8) |
+                                                  (unsigned)ip[3]));
           first->addr.ipv4.sin_port = htons(portnum);
        }
       }