aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-11-23 01:38:31 +0000
committerMohan Embar <membar@gcc.gnu.org>2003-11-23 01:38:31 +0000
commit539edbe025fc62fd752336b6bfe8b6a05a3afe0e (patch)
tree1ff853f8f58898b54d30065be8b294cce97ba655
parenta6e5d84721ffda399db293cf22911f74585c25f6 (diff)
downloadgcc-539edbe025fc62fd752336b6bfe8b6a05a3afe0e.zip
gcc-539edbe025fc62fd752336b6bfe8b6a05a3afe0e.tar.gz
gcc-539edbe025fc62fd752336b6bfe8b6a05a3afe0e.tar.bz2
* gnu/java/net/natPlainDatagramSocketImplWin32.cc
(peekData): Use offset and maximal free space in datagram packet. (receive): Likewise. (send): Use offset in datagram packet. From-SVN: r73848
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc12
2 files changed, 14 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index f5a23b2..938a517 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,12 @@
2003-11-22 Michael Koch <konqueror@gmx.de>
+ * gnu/java/net/natPlainDatagramSocketImplWin32.cc
+ (peekData): Use offset and maximal free space in datagram packet.
+ (receive): Likewise.
+ (send): Use offset in datagram packet.
+
+2003-11-22 Michael Koch <konqueror@gmx.de>
+
* gnu/java/net/natPlainDatagramSocketImplPosix.cc
(peekData): Use offset and maximal free space in datagram packet.
(receive): Likewise.
diff --git a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
index 4a4ec98..15105b96 100644
--- a/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
+++ b/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
@@ -202,7 +202,8 @@ gnu::java::net::PlainDatagramSocketImpl::peekData(::java::net::DatagramPacket *p
// FIXME: Deal with Multicast and if the socket is connected.
union SockAddr u;
socklen_t addrlen = sizeof(u);
- jbyte *dbytes = elements (p->getData());
+ jbyte *dbytes = elements (p->getData()) + p->getOffset();
+ jint maxlen = p->getData()->length - p->getOffset();
ssize_t retlen = 0;
if (timeout > 0)
@@ -214,7 +215,7 @@ gnu::java::net::PlainDatagramSocketImpl::peekData(::java::net::DatagramPacket *p
}
retlen =
- ::recvfrom (native_fd, (char *) dbytes, p->getLength(), MSG_PEEK, (sockaddr*) &u,
+ ::recvfrom (native_fd, (char *) dbytes, maxlen, MSG_PEEK, (sockaddr*) &u,
&addrlen);
if (retlen == SOCKET_ERROR)
goto error;
@@ -280,7 +281,7 @@ gnu::java::net::PlainDatagramSocketImpl::send (::java::net::DatagramPacket *p)
jbyte *bytes = elements (haddress);
int len = haddress->length;
struct sockaddr *ptr = (struct sockaddr *) &u.address;
- jbyte *dbytes = elements (p->getData());
+ jbyte *dbytes = elements (p->getData()) + p->getOffset();
if (len == 4)
{
u.address.sin_family = AF_INET;
@@ -316,7 +317,8 @@ gnu::java::net::PlainDatagramSocketImpl::receive (::java::net::DatagramPacket *p
// FIXME: Deal with Multicast and if the socket is connected.
union SockAddr u;
socklen_t addrlen = sizeof(u);
- jbyte *dbytes = elements (p->getData());
+ jbyte *dbytes = elements (p->getData()) + p->getOffset();
+ jint maxlen = p->getData()->length - p->getOffset();
ssize_t retlen = 0;
if (timeout > 0)
@@ -331,7 +333,7 @@ gnu::java::net::PlainDatagramSocketImpl::receive (::java::net::DatagramPacket *p
}
retlen =
- ::recvfrom (native_fd, (char *) dbytes, p->getLength(), 0, (sockaddr*) &u,
+ ::recvfrom (native_fd, (char *) dbytes, maxlen, 0, (sockaddr*) &u,
&addrlen);
if (retlen < 0)
goto error;