[ros-diffs] [cgutman] 49078: [WININET] - Add a ROS-specific change that was missed during the last winesync to fix winsock error handling - Remove the CP_UNIXCP definition - Use WSASetLastError instead of errn...

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sat Oct 9 18:40:17 UTC 2010


Author: cgutman
Date: Sat Oct  9 18:40:16 2010
New Revision: 49078

URL: http://svn.reactos.org/svn/reactos?rev=49078&view=rev
Log:
[WININET]
- Add a ROS-specific change that was missed during the last winesync to fix winsock error handling
- Remove the CP_UNIXCP definition
- Use WSASetLastError instead of errno in inet_ntop.c
- Thanks to IRC:igorko for pointing out the bug

Modified:
    trunk/reactos/dll/win32/wininet/inet_ntop.c
    trunk/reactos/dll/win32/wininet/internet.h
    trunk/reactos/dll/win32/wininet/netconnection.c

Modified: trunk/reactos/dll/win32/wininet/inet_ntop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/inet_ntop.c?rev=49078&r1=49077&r2=49078&view=diff
==============================================================================
--- trunk/reactos/dll/win32/wininet/inet_ntop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wininet/inet_ntop.c [iso-8859-1] Sat Oct  9 18:40:16 2010
@@ -15,9 +15,6 @@
  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  * SOFTWARE.
  */
-
-#define ENOSPC 28
-#define EAFNOSUPPORT 52
 
 #ifndef IN6ADDRSZ
 #define	IN6ADDRSZ	16
@@ -64,7 +61,7 @@
 		return (inet_ntop6(src, dst, size));
 #endif
 	default:
-		errno = EAFNOSUPPORT;
+		WSASetLastError(WSAEAFNOSUPPORT);
 		return (NULL);
 	}
 	/* NOTREACHED */
@@ -88,7 +85,7 @@
 	char tmp[sizeof "255.255.255.255"];
 
 	if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
-		errno = ENOSPC;
+		WSASetLastError(WSAEINVAL);
 		return (NULL);
 	}
 	strcpy(dst, tmp);
@@ -182,7 +179,7 @@
 	 * Check for overflow, copy, and we're done.
 	 */
 	if ((size_t)(tp - tmp) > size) {
-		errno = ENOSPC;
+		WSASetLastError(WSAEINVAL);
 		return (NULL);
 	}
 	strcpy(dst, tmp);

Modified: trunk/reactos/dll/win32/wininet/internet.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet.h?rev=49078&r1=49077&r2=49078&view=diff
==============================================================================
--- trunk/reactos/dll/win32/wininet/internet.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wininet/internet.h [iso-8859-1] Sat Oct  9 18:40:16 2010
@@ -47,10 +47,6 @@
 #define ioctlsocket ioctl
 #endif /* __MINGW32__ */
 
-/* ReactOS-specific definitions */
-#undef CP_UNIXCP
-#define CP_UNIXCP   CP_THREAD_ACP
-
 /* used for netconnection.c stuff */
 typedef struct
 {
@@ -441,7 +437,7 @@
 BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available);
 LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection);
 DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value);
-int sock_get_error(int);
+#define sock_get_error(x) WSAGetLastError()
 
 extern void URLCacheContainers_CreateDefaults(void);
 extern void URLCacheContainers_DeleteAll(void);

Modified: trunk/reactos/dll/win32/wininet/netconnection.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/netconnection.c?rev=49078&r1=49077&r2=49078&view=diff
==============================================================================
--- trunk/reactos/dll/win32/wininet/netconnection.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wininet/netconnection.c [iso-8859-1] Sat Oct  9 18:40:16 2010
@@ -513,6 +513,7 @@
         return TRUE;
 }
 
+#if 0
 /* translate a unix error code into a winsock one */
 int sock_get_error( int err )
 {
@@ -579,6 +580,7 @@
 #endif
     return err;
 }
+#endif
 
 /******************************************************************************
  * NETCON_create




More information about the Ros-diffs mailing list