[WININET]
authorThomas Faber <thomas.faber@reactos.org>
Wed, 20 Jun 2012 15:10:50 +0000 (15:10 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Wed, 20 Jun 2012 15:10:50 +0000 (15:10 +0000)
- Fix sock_namelen type in FTP_Connect. Already sent to Wine.
- Fix warnings

svn path=/trunk/; revision=56761

reactos/dll/win32/wininet/CMakeLists.txt
reactos/dll/win32/wininet/ftp.c
reactos/dll/win32/wininet/http.c
reactos/dll/win32/wininet/inet_ntop.c
reactos/dll/win32/wininet/internet.h
reactos/dll/win32/wininet/wininet_ros.diff

index 754b501..305cf19 100644 (file)
@@ -20,22 +20,15 @@ list(APPEND SOURCE
     urlcache.c
     utility.c
     wininet_main.c
+    rsrc.rc
+    version.rc
     ${CMAKE_CURRENT_BINARY_DIR}/wininet_stubs.c
     ${CMAKE_CURRENT_BINARY_DIR}/wininet.def)
 
-add_library(wininet SHARED
-    ${SOURCE}
-    rsrc.rc
-    version.rc)
+add_library(wininet SHARED ${SOURCE})
 
 set_module_type(wininet win32dll)
 target_link_libraries(wininet wine ${PSEH_LIB} zlib)
 add_delay_importlibs(wininet secur32 crypt32 cryptui)
 add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 msvcrt kernel32 ntdll)
 add_cd_file(TARGET wininet DESTINATION reactos/system32 FOR all)
-
-if(NOT MSVC)
-    # FIXME: http://www.cmake.org/Bug/view.php?id=12998
-    #allow_warnings(wininet)
-    set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error")
-endif()
index 0c7ca12..54dd655 100644 (file)
@@ -2433,7 +2433,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
     static const WCHAR szEmpty[] = {'\0'};
     struct sockaddr_in socketAddr;
     INT nsocket = -1;
-    UINT sock_namelen;
+    socklen_t sock_namelen;
     BOOL bSuccess = FALSE;
     ftp_session_t *lpwfs = NULL;
     char szaddr[INET_ADDRSTRLEN];
index d6142d6..c78dafb 100644 (file)
@@ -1901,6 +1901,9 @@ static void http_release_netconn(http_request_t *req, BOOL reuse)
         }
         return;
     }
+#else
+    // silence unused function warning
+    (void)collect_connections_proc;
 #endif
 
     INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,
index 1c5fe35..d082057 100644 (file)
@@ -27,7 +27,7 @@
 #ifdef SPRINTF_CHAR
 # define SPRINTF(x) strlen(sprintf/**/x)
 #else
-# define SPRINTF(x) ((size_t)sprintf x)
+# define SPRINTF(x) ((socklen_t)sprintf x)
 #endif
 
 /*
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static const char *inet_ntop4(const u_char *src, char *dst, size_t size);
+static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size);
 
 #ifdef INET6
-static const char *inet_ntop6(const u_char *src, char *dst, size_t size);
+static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
 #endif
 
 /* char *
@@ -50,7 +50,7 @@ static const char *inet_ntop6(const u_char *src, char *dst, size_t size);
  *     Paul Vixie, 1996.
  */
 const char *
-inet_ntop(int af, const void *src, char *dst, size_t size)
+inet_ntop(int af, const void *src, char *dst, socklen_t size)
 {
 
        switch (af) {
@@ -79,7 +79,7 @@ inet_ntop(int af, const void *src, char *dst, size_t size)
  *     Paul Vixie, 1996.
  */
 static const char *
-inet_ntop4(const u_char *src, char *dst, size_t size)
+inet_ntop4(const u_char *src, char *dst, socklen_t size)
 {
        static const char fmt[] = "%u.%u.%u.%u";
        char tmp[sizeof "255.255.255.255"];
@@ -100,7 +100,7 @@ inet_ntop4(const u_char *src, char *dst, size_t size)
  *     Paul Vixie, 1996.
  */
 static const char *
-inet_ntop6(const u_char *src, char *dst, size_t size)
+inet_ntop6(const u_char *src, char *dst, socklen_t size)
 {
        /*
         * Note that int32_t and int16_t need only be "at least" large enough
@@ -178,7 +178,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
        /*
         * Check for overflow, copy, and we're done.
         */
-       if ((size_t)(tp - tmp) > size) {
+       if ((socklen_t)(tp - tmp) > size) {
                WSASetLastError(WSAEINVAL);
                return (NULL);
        }
index eb2ea6f..4379268 100644 (file)
@@ -540,6 +540,25 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC
 int sock_get_error(int) DECLSPEC_HIDDEN;
 #else
 #define sock_get_error(x) WSAGetLastError()
+const char *inet_ntop(int, const void *, char *, socklen_t);
+
+static inline long unix_recv(int socket, void *buffer, size_t length, int flags)
+{
+    return recv(socket, buffer, length, flags);
+}
+#define recv unix_recv
+
+static inline int unix_ioctl(int filedes, long request, void *arg)
+{
+    return ioctlsocket(filedes, request, arg);
+}
+#define ioctlsocket unix_ioctl
+
+static inline int unix_getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
+{
+    return getsockopt(socket, level, option_name, option_value, option_len);
+}
+#define getsockopt unix_getsockopt
 #endif
 
 extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;
index 82b53bf..fddcbc3 100644 (file)
@@ -1,6 +1,6 @@
---- wine-1.5.4/Wine/dlls/wininet/internet.h    2012-06-20 14:38:39 +0200
-+++ dll/win32/wininet/internet.h       2012-06-20 14:51:41 +0200
-@@ -536,7 +536,11 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
+--- wine-1.5.4/dlls/wininet/internet.h 2012-06-20 14:38:39 +0200
++++ dll/win32/wininet/internet.h       2012-06-20 16:49:05 +0200
+@@ -536,7 +536,30 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE
  LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
  int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
  DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
@@ -8,12 +8,31 @@
  int sock_get_error(int) DECLSPEC_HIDDEN;
 +#else
 +#define sock_get_error(x) WSAGetLastError()
++const char *inet_ntop(int, const void *, char *, socklen_t);
++
++static inline long unix_recv(int socket, void *buffer, size_t length, int flags)
++{
++    return recv(socket, buffer, length, flags);
++}
++#define recv unix_recv
++
++static inline int unix_ioctl(int filedes, long request, void *arg)
++{
++    return ioctlsocket(filedes, request, arg);
++}
++#define ioctlsocket unix_ioctl
++
++static inline int unix_getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
++{
++    return getsockopt(socket, level, option_name, option_value, option_len);
++}
++#define getsockopt unix_getsockopt
 +#endif
  
  extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN;
  extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN;
---- wine-1.5.4/Wine/dlls/wininet/netconnection.c       2012-06-20 14:38:39 +0200
-+++ dll/win32/wininet/netconnection.c  2012-06-20 14:52:22 +0200
+--- wine-1.5.4/dlls/wininet/netconnection.c    2012-06-20 14:38:39 +0200
++++ dll/win32/wininet/netconnection.c  2012-06-20 15:50:06 +0200
 @@ -523,12 +523,16 @@ DWORD create_netconn(BOOL useSSL, server
          if(result == -1)
          {
@@ -51,8 +70,8 @@
  
  /******************************************************************************
   * NETCON_secure_connect
---- wine-1.5.4/Wine/dlls/wininet/internet.c    2012-06-20 14:38:38 +0200
-+++ dll/win32/wininet/internet.c       2012-06-20 14:58:51 +0200
+--- wine-1.5.4/dlls/wininet/internet.c 2012-06-20 14:38:38 +0200
++++ dll/win32/wininet/internet.c       2012-06-20 15:50:05 +0200
 @@ -292,7 +292,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL,
              if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES)
                  return FALSE;
          {
              if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0)
              {
-Index: dll/win32/wininet/urlcache.c
-===================================================================
---- wine-1.5.4/Wine/dlls/wininet/urlcache.c    2012-06-20 14:30:41 +0200
-+++ dll/win32/wininet/urlcache.c       2012-06-20 14:54:06 +0200
+--- wine-1.5.4/dlls/wininet/urlcache.c 2012-06-20 14:30:41 +0200
++++ dll/win32/wininet/urlcache.c       2012-06-20 15:50:06 +0200
 @@ -189,6 +189,8 @@ typedef struct _URLCACHECONTAINER
  
  /* List of all containers available */
@@ -160,10 +177,8 @@ Index: dll/win32/wininet/urlcache.c
      LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry)
      {
          /* The URL cache has prefix L"" (unlike Cookies and History) */
-Index: dll/win32/wininet/http.c
-===================================================================
---- wine-1.5.4/Wine/dlls/wininet/http.c        2012-06-20 14:38:38 +0200
-+++ dll/win32/wininet/http.c   2012-06-20 14:49:11 +0200
+--- wine-1.5.4/dlls/wininet/http.c     2012-06-20 15:19:57 +0200
++++ dll/win32/wininet/http.c   2012-06-20 16:24:11 +0200
 @@ -73,6 +73,9 @@
  #include "wine/exception.h"
  #include "wine/unicode.h"
@@ -218,10 +233,13 @@ Index: dll/win32/wininet/http.c
          req->netconn = NULL;
  
          run_collector = !collector_running;
-@@ -1888,6 +1901,7 @@ static void http_release_netconn(http_re
+@@ -1888,6 +1901,10 @@ static void http_release_netconn(http_re
          }
          return;
      }
++#else
++    // silence unused function warning
++    (void)collect_connections_proc;
 +#endif
  
      INTERNET_SendCallback(&req->hdr, req->hdr.dwContext,