]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix builds with Visual C++
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 24 Jan 2013 18:09:22 +0000 (18:09 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 24 Jan 2013 18:09:22 +0000 (18:09 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10837 7a7537e8-13f0-0310-91df-b6672ffda945

cups/http-addr.c
cups/http-addrlist.c
cups/http-private.h
cups/http-support.c
cups/http.c
cups/libcups2.def
cups/request.c
cups/snmp.c
cups/usersys.c
vcnet/config.h

index e3dba9e9aba346e660d11ce5041c2b0469131320..c8834df4189917ec1589a501a596233cec03dbb9 100644 (file)
@@ -162,11 +162,11 @@ httpAddrListen(http_addr_t *addr, /* I - Address to bind to */
   }
 
   val = 1;
-  setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
+  setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
 
 #ifdef IPV6_V6ONLY
   if (addr->addr.sa_family == AF_INET6)
-    setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof(val));
+    setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, CUPS_SOCAST &val, sizeof(val));
 #endif /* IPV6_V6ONLY */
 
   _httpAddrSetPort(addr, port);
@@ -195,7 +195,7 @@ httpAddrListen(http_addr_t *addr,   /* I - Address to bind to */
   */
 
   val = 1;
-  setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+  setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
 #endif /* SO_NOSIGPIPE */
 
   return (fd);
index 470376d5f32dfdf05860586075623991f81fa34e..fd5da4bbe3f1d79fcc073f7be57b8f4b9a7dc325 100644 (file)
@@ -139,21 +139,16 @@ httpAddrConnect2(
     */
 
     val = 1;
-#ifdef WIN32
-    setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&val,
-               sizeof(val));
-#else
-    setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
-#endif /* WIN32 */
+    setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
 
 #ifdef SO_REUSEPORT
     val = 1;
-    setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
+    setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, CUPS_SOCAST &val, sizeof(val));
 #endif /* SO_REUSEPORT */
 
 #ifdef SO_NOSIGPIPE
     val = 1;
-    setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+    setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
 #endif /* SO_NOSIGPIPE */
 
    /*
@@ -162,12 +157,7 @@ httpAddrConnect2(
     */
 
     val = 1;
-#ifdef WIN32
-    setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&val,
-               sizeof(val));
-#else
-    setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
-#endif /* WIN32 */
+    setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
 
 #ifdef FD_CLOEXEC
    /*
index 7e006e59c2275ad76900c6d9594d9abfc74434c1..910d7ec48dd014dfae64dd1b9f571169dc65d647 100644 (file)
 #  ifdef WIN32
 #    include <io.h>
 #    include <winsock2.h>
+#    define CUPS_SOCAST (const char *)
 #  else
 #    include <unistd.h>
 #    include <fcntl.h>
 #    include <sys/socket.h>
 #    define closesocket(f) close(f)
+#    define CUPS_SOCAST
 #  endif /* WIN32 */
 
 #  ifdef HAVE_GSSAPI
index 294021f11dd462b3ad4b3d99c3dc398012d3e6f3..fe2041c8a3060654930b57e40fe231ecf9d6c77c 100644 (file)
@@ -1553,15 +1553,15 @@ _httpResolveURI(
 #  ifdef HAVE_DNSSD
     if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
     {
-      int interface = kDNSServiceInterfaceIndexAny;
+      int myinterface = kDNSServiceInterfaceIndexAny;
                                        /* Lookup on any interface */
 
       if (!strcmp(scheme, "ippusb"))
-        interface = kDNSServiceInterfaceIndexLocalOnly;
+        myinterface = kDNSServiceInterfaceIndexLocalOnly;
 
       localref = ref;
       if (DNSServiceResolve(&localref,
-                            kDNSServiceFlagsShareConnection, interface,
+                            kDNSServiceFlagsShareConnection, myinterface,
                             hostname, regtype, "local.", http_resolve_cb,
                            &uribuf) == kDNSServiceErr_NoError)
       {
@@ -1636,7 +1636,7 @@ _httpResolveURI(
              domainref = ref;
              if (DNSServiceResolve(&domainref,
                                    kDNSServiceFlagsShareConnection,
-                                   interface, hostname, regtype, domain,
+                                   myinterface, hostname, regtype, domain,
                                    http_resolve_cb,
                                    &uribuf) == kDNSServiceErr_NoError)
                domainsent = 1;
index 2075ec2d083f0641e15806098205b0cce3f9221b..7b7446cd7a6d4746ea35c62db1ea7eb110ad83e6 100644 (file)
@@ -347,7 +347,7 @@ httpAcceptConnection(int fd,                /* I - Listen socket file descriptor */
   */
 
   val = 1;
-  setsockopt(http->fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
+  setsockopt(http->fd, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
 #endif /* SO_NOSIGPIPE */
 
  /*
@@ -358,7 +358,7 @@ httpAcceptConnection(int fd,                /* I - Listen socket file descriptor */
   */
 
   val = 1;
-  setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
+  setsockopt(http->fd, IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
 
 #ifdef FD_CLOEXEC
  /*
@@ -2253,10 +2253,18 @@ httpRead2(http_t *http,                 /* I - Connection to server */
   ssize_t      bytes;                  /* Bytes read */
 
 
+#ifdef HAVE_LIBZ
   DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT
                 ") coding=%d data_encoding=%d data_remaining=" CUPS_LLFMT,
-                http, buffer, CUPS_LLCAST length, http->coding,
+                http, buffer, CUPS_LLCAST length,
+                http->coding,
+                http->data_encoding, CUPS_LLCAST http->data_remaining));
+#else
+  DEBUG_printf(("httpRead2(http=%p, buffer=%p, length=" CUPS_LLFMT
+                ") data_encoding=%d data_remaining=" CUPS_LLFMT,
+                http, buffer, CUPS_LLCAST length,
                 http->data_encoding, CUPS_LLCAST http->data_remaining));
+#endif /* HAVE_LIBZ */
 
   if (http == NULL || buffer == NULL)
     return (-1);
@@ -2374,8 +2382,8 @@ httpRead2(http_t *http,                   /* I - Connection to server */
     DEBUG_printf(("1httpRead2: Reading up to %d bytes into buffer.",
                   (int)length));
 
-    if (length > http->data_remaining)
-      length = http->data_remaining;
+    if (length > (size_t)http->data_remaining)
+      length = (size_t)http->data_remaining;
 
     if ((bytes = http_read_buffered(http, buffer, length)) > 0)
       http->data_remaining -= bytes;
@@ -4039,6 +4047,7 @@ httpWriteResponse(http_t        *http,    /* I - HTTP connection */
 
     http_set_length(http);
 
+#ifdef HAVE_LIBZ
    /*
     * Then start any content encoding...
     */
@@ -4046,6 +4055,7 @@ httpWriteResponse(http_t        *http,    /* I - HTTP connection */
     DEBUG_puts("1httpWriteResponse: Calling http_content_coding_start.");
     http_content_coding_start(http,
                              httpGetField(http, HTTP_FIELD_CONTENT_ENCODING));
+#endif /* HAVE_LIBZ */
   }
 
   return (0);
@@ -5035,8 +5045,8 @@ http_set_timeout(int    fd,               /* I - File descriptor */
   DWORD tv = (DWORD)(timeout * 1000);
                                      /* Timeout in milliseconds */
 
-  setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
-  setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv));
+  setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, CUPS_SOCAST &tv, sizeof(tv));
+  setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, CUPS_SOCAST &tv, sizeof(tv));
 
 #else
   struct timeval tv;                   /* Timeout in secs and usecs */
@@ -5044,8 +5054,8 @@ http_set_timeout(int    fd,               /* I - File descriptor */
   tv.tv_sec  = (int)timeout;
   tv.tv_usec = (int)(1000000 * fmod(timeout, 1.0));
 
-  setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
-  setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+  setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, CUPS_SOCAST &tv, sizeof(tv));
+  setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, CUPS_SOCAST &tv, sizeof(tv));
 #endif /* WIN32 */
 }
 
index ef22daa4f39da700a265b284b3e8078e88e64c25..c4cf46212645f183c17fb5ccd248ec2e687b320e 100644 (file)
@@ -1,5 +1,5 @@
 LIBRARY libcups2\r
-VERSION 2.9\r
+VERSION 2.10\r
 EXPORTS\r
 _cupsBufferGet\r
 _cupsBufferRelease\r
@@ -34,12 +34,9 @@ _cups_strncasecmp
 _cups_strcpy\r
 _cups_strlcat\r
 _cups_strlcpy\r
-_httpAddrPort\r
 _httpAddrSetPort\r
 _httpAssembleUUID\r
-_httpCreate\r
 _httpEncodeURI\r
-_httpPeek\r
 _httpResolveURI\r
 _httpWait\r
 _ippFindOption\r
@@ -186,32 +183,40 @@ cupsSetPasswordCB
 cupsSetServer\r
 cupsSetServerCertCB\r
 cupsSetUser\r
+cupsSetUserAgent\r
 cupsTempFd\r
 cupsTempFile\r
 cupsTempFile2\r
+cupsUserAgent\r
 cupsUTF32ToUTF8\r
 cupsUTF8ToCharset\r
 cupsUTF8ToUTF32\r
 cupsUser\r
 cupsWriteRequestData\r
+httpAcceptConnection\r
 httpAddCredential\r
 httpAddrAny\r
 httpAddrConnect\r
+httpAddrCopyList\r
 httpAddrEqual\r
 httpAddrFreeList\r
 httpAddrGetList\r
 httpAddrLength\r
+httpAddrListen\r
 httpAddrLocalhost\r
 httpAddrLookup\r
+httpAddrPort\r
 httpAddrString\r
 httpAssembleURI\r
 httpAssembleURIf\r
+httpAssembleUUID\r
 httpBlocking\r
 httpCheck\r
 httpClearCookie\r
 httpClearFields\r
 httpClose\r
 httpConnect\r
+httpConnect2\r
 httpConnectEncrypt\r
 httpCopyCredentials\r
 httpDecode64\r
@@ -226,10 +231,12 @@ httpFlushWrite
 httpFreeCredentials\r
 httpGet\r
 httpGetBlocking\r
+httpGetContentEncoding\r
 httpGetCookie\r
 httpGetDateString\r
 httpGetDateString2\r
 httpGetDateTime\r
+httpGetExpect\r
 httpGetFd\r
 httpGetField\r
 httpGetHostByName\r
@@ -246,17 +253,20 @@ httpMD5
 httpMD5Final\r
 httpMD5String\r
 httpOptions\r
+httpPeek\r
 httpPost\r
 httpPrintf\r
 httpPut\r
 httpRead\r
 httpRead2\r
+httpReadRequest\r
 httpReconnect\r
 httpSeparate\r
 httpSeparate2\r
 httpSeparateURI\r
 httpSetCookie\r
 httpSetCredentials\r
+httpSetDefaultField\r
 httpSetExpect\r
 httpSetField\r
 httpSetLength\r
@@ -267,6 +277,7 @@ httpUpdate
 httpWait\r
 httpWrite\r
 httpWrite2\r
+httpWriteResponse\r
 ippAddBoolean\r
 ippAddBooleans\r
 ippAddCollection\r
@@ -282,8 +293,12 @@ ippAddResolution
 ippAddResolutions\r
 ippAddSeparator\r
 ippAddString\r
+ippAddStringf\r
+ippAddStringfv\r
 ippAddStrings\r
 ippAttributeString\r
+ippContainsInteger\r
+ippContainsString\r
 ippCopyAttribute\r
 ippCopyAttributes\r
 ippDateToTime\r
@@ -316,6 +331,7 @@ ippGetVersion
 ippLength\r
 ippNew\r
 ippNewRequest\r
+ippNewResponse\r
 ippNextAttribute\r
 ippOpString\r
 ippOpValue\r
@@ -337,11 +353,15 @@ ippSetResolution
 ippSetState\r
 ippSetStatusCode\r
 ippSetString\r
+ippSetStringf\r
+ippSetStringfv\r
 ippSetValueTag\r
 ippSetVersion\r
 ippTagString\r
 ippTagValue\r
 ippTimeToDate\r
+ippValidateAttribute\r
+ippValidateAttributes\r
 ippWrite\r
 ippWriteFile\r
 ippWriteIO\r
index f81785d3a2b6455d9a18cdd15304b579288691bb..191a536fcc58266007c8620f3baf9bd3c3c5703d 100644 (file)
@@ -1015,8 +1015,13 @@ _cupsConnect(void)
 
       char ch;                         /* Connection check byte */
 
+#ifdef WIN32
+      if (recv(cg->http->fd, &ch, 1, MSG_PEEK) < 0 &&
+          WSAGetLastError() != WSAEWOULDBLOCK)
+#else
       if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
           errno != EWOULDBLOCK)
+#endif /* WIN32 */
       {
        /*
         * Nope, close the connection...
index 33dd1d4ea6b9cdd57930d18f58aa17c596b1659a..034db89a9e6a022bf27b7c0f6f35213a6f8ee7c5 100644 (file)
@@ -362,11 +362,7 @@ _cupsSNMPOpen(int family)          /* I - Address family - @code AF_INET@ or @code AF_IN
 
   val = 1;
 
-#ifdef WIN32
-  if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char *)&val, sizeof(val)))
-#else
-  if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
-#endif /* WIN32 */
+  if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, CUPS_SOCAST &val, sizeof(val)))
   {
     DEBUG_printf(("5_cupsSNMPOpen: Returning -1 (%s)", strerror(errno)));
 
index fc2ed9ceda898d631cf3a671d0c9a23c2a95b6da..12d76f77240380649acfb65d4da3fd01ccc20dd1 100644 (file)
@@ -462,8 +462,8 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
   _cups_globals_t      *cg = _cupsGlobals();
                                        /* Thread globals */
 #ifdef WIN32
-  SYSTEM_INFO  sysinfo;        /* System information */
-  OSVERSIONEX  version;        /* OS version info */
+  SYSTEM_INFO          sysinfo;        /* System information */
+  OSVERSIONINFO                version;        /* OS version info */
 #else
   struct utsname       name;           /* uname info */
 #endif /* WIN32 */
@@ -476,13 +476,13 @@ cupsSetUserAgent(const char *user_agent)/* I - User-Agent string or @code NULL@
   }
 
 #ifdef WIN32
-  version.dwOSVersionInfoSize = sizeof(OSVERSIONEX);
-  GetVersionInfoEx(&version);
+  version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+  GetVersionEx(&version);
   GetNativeSystemInfo(&sysinfo);
 
   snprintf(cg->user_agent, sizeof(cg->user_agent),
            CUPS_MINIMAL " (Windows %d.%d; %s) IPP/2.0",
-          version.major, version.minor,
+          version.dwMajorVersion, version.dwMinorVersion,
           sysinfo.wProcessorArchitecture
               == PROCESSOR_ARCHITECTURE_AMD64 ? "amd64" :
               sysinfo.wProcessorArchitecture
index 627aa178cb7a4af52c7f8558650b3ff88ad72623..bd73518e2d6fc3d8aa24a253318869993d6089b9 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Configuration file for CUPS on Windows.
  *
- *   Copyright 2007-2012 by Apple Inc.
+ *   Copyright 2007-2013 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
  * Use <stdint.h>?
  */
 
-#define HAVE_STDINT_H 1
+/* #undef HAVE_STDINT_H */
 
 
 /*