Browse Source

- Remove INVALID_SOCKET and SOCKET_ERROR constants from fpwinsockh.inc,
because the socket unit routines use signed types.

git-svn-id: trunk@6421 -

daniel 18 years ago
parent
commit
3330a91e9e
2 changed files with 8 additions and 4 deletions
  1. 5 1
      rtl/win/fpwinsockh.inc
  2. 3 3
      rtl/win/sockets.pp

+ 5 - 1
rtl/win/fpwinsockh.inc

@@ -129,9 +129,13 @@ const
 
 
 { This is used instead of -1, since the
 { This is used instead of -1, since the
   TSocket type is unsigned.}
   TSocket type is unsigned.}
-
+{
+  Tsocket might be unsigned, but the sockets unit uses
+  signed types. So, we cannot use these constants, signed
+  ones are defined in socketh.inc.
   INVALID_SOCKET                = winsock2.INVALID_SOCKET;
   INVALID_SOCKET                = winsock2.INVALID_SOCKET;
   SOCKET_ERROR                  = winsock2.SOCKET_ERROR;
   SOCKET_ERROR                  = winsock2.SOCKET_ERROR;
+}
 
 
 { Option flags per-socket. }
 { Option flags per-socket. }
 
 

+ 3 - 3
rtl/win/sockets.pp

@@ -291,7 +291,7 @@ end;
 function fpWrite(handle : longint;Const bufptr;size : dword) : dword;
 function fpWrite(handle : longint;Const bufptr;size : dword) : dword;
 begin
 begin
   fpWrite := dword(Winsock2.send(handle, bufptr, size, 0));
   fpWrite := dword(Winsock2.send(handle, bufptr, size, 0));
-  if fpWrite = dword(SOCKET_ERROR) then
+  if fpWrite = dword(winsock2.SOCKET_ERROR) then
   begin
   begin
     SocketError := WSAGetLastError;
     SocketError := WSAGetLastError;
     fpWrite := 0;
     fpWrite := 0;
@@ -305,7 +305,7 @@ function fpRead(handle : longint;var bufptr;size : dword) : dword;
      d : dword;
      d : dword;
 
 
   begin
   begin
-     if ioctlsocket(handle,FIONREAD,@d) = SOCKET_ERROR then
+     if ioctlsocket(handle,FIONREAD,@d) = winsock2.SOCKET_ERROR then
        begin
        begin
          SocketError:=WSAGetLastError;
          SocketError:=WSAGetLastError;
          fpRead:=0;
          fpRead:=0;
@@ -316,7 +316,7 @@ function fpRead(handle : longint;var bufptr;size : dword) : dword;
          if size>d then
          if size>d then
            size:=d;
            size:=d;
          fpRead := dword(Winsock2.recv(handle, bufptr, size, 0));
          fpRead := dword(Winsock2.recv(handle, bufptr, size, 0));
-         if fpRead = dword(SOCKET_ERROR) then
+         if fpRead = dword(winsock2.SOCKET_ERROR) then
          begin
          begin
            SocketError:= WSAGetLastError;
            SocketError:= WSAGetLastError;
            fpRead := 0;
            fpRead := 0;