Patch: natSocketChannelImpl.cc use elements + explicit cast
Mohan Embar
gnustuff@thisiscool.com
Sat Mar 8 05:19:00 GMT 2003
Hi Patch Folks,
This patch addresses something that broke under the MingW build,
possibly because jbyte seems to be unsigned char and not signed char
on Win32. It also appeared to me that "elements(data)" was needed instead
of just plain "data". Am I right?
Also see my comment about the cast to char* instead of const char*
in ::send().
Enjoy.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
ChangeLog
2003-03-07 Mohan Embar <gnustuff@thisiscool.com>
* gnu/java/nio/natSocketChannelImpl.cc (SocketRead): use
elements(data) and explicitly cast to char* on platforms
where jbyte is not signed char
(SocketWrite): idem
Index: gnu/java/nio/natSocketChannelImpl.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/gnu/java/nio/natSocketChannelImpl.cc,v
retrieving revision 1.1.12.2
diff -u -2 -r1.1.12.2 natSocketChannelImpl.cc
--- gnu/java/nio/natSocketChannelImpl.cc 1 Mar 2003 22:57:53 -0000 1.1.12.2
+++ gnu/java/nio/natSocketChannelImpl.cc 8 Mar 2003 02:34:11 -0000
@@ -144,5 +144,6 @@
jint offset, jint length)
{
- int result = ::recv (fd, data, offset, length);
+ int result =
+ ::recv (fd, reinterpret_cast<char*>(elements(data)), offset, length);
if (result < 0)
@@ -159,5 +160,8 @@
jint offset, jint length)
{
- int result = ::send (fd, data, offset, length);
+ int result =
+ ::send (fd, reinterpret_cast<char*>(elements(data)), offset, length);
+ // made this char* instead of const char* because I wasn't sure
+ // about the API on all UNICES.
if (result < 0)
More information about the Java-patches
mailing list