This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: WIN-25.1: natPlainSocketImpl.cc [UPDATED]
Here's what I think we should do here. Tom may have a reason why this
shouldn't be used, but I find it hard to imagine that this would not
work anywhere given that the recvfrom() in natPlainDatagramSocket is
basically the same.
The original code casted the buffer to (void *) instead of (char *)
which is probibly what caused the problems?
Bryce.
2002-02-28 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/net/natPlainSocketImpl.cc (_Jv_recv): Removed.
(read): Call recv() directly, not _Jv_recv().
Index: natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.30
diff -u -r1.30 natPlainSocketImpl.cc
--- natPlainSocketImpl.cc 2002/02/07 03:24:01 1.30
+++ natPlainSocketImpl.cc 2002/02/28 03:37:55
@@ -72,15 +72,6 @@
#undef accept
#endif
-// A wrapper for recv so we don't have to do configure tests.
-template <typename T_ret, typename T_fd, typename T_buf,
- typename T_len, typename T_flags>
-static inline ssize_t
-_Jv_recv (T_ret (*recv_func) (T_fd s, T_buf buf, T_len len, T_flags flags),
- int s, void *buf, size_t len, int flags)
-{
- return recv_func ((T_fd) s, (T_buf) buf, (T_len) len, (T_flags) flags);
-}
#endif /* DISABLE_JAVA_NET */
#include <gcj/cni.h>
@@ -551,7 +542,7 @@
}
}
// Read the socket.
- int r = _Jv_recv (::recv, fnum, (void *) bytes, count, 0);
+ int r = ::recv (fnum, (char *) bytes, (size_t) count, 0);
if (r == 0)
return -1;
if (java::lang::Thread::interrupted())