This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: natPlainDatagramSocketImplXXXX.cc offset bug.


Here ist the other variant of the patch. I have tested this patch with
Mauve also.

Norbert

        * gnu/java/net/natPlainDatagramSocketImplPosix.cc 
        (peekData): Do not subtract buffer offset from maxlen and 
	refer to DatagramPacket->maxlen directly.
        (receive): Likewise.
        * gnu/java/net/natPlainDatagramSocketImplWin32.cc 
        (peekData): Likewise.
        (receive): Likewise.

Index: gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
===================================================================
RCS file:
/cvs/gcc/gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc,vretrieving revision 1.7
diff -u -r1.7 natPlainDatagramSocketImplPosix.cc
--- gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc 17 Mar
2004 08:10:28 -0000      1.7
+++ gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc 21 Mar
2004 20:27:47 -0000
@@ -210,7 +210,6 @@
   union SockAddr u;
   socklen_t addrlen = sizeof(u);
   jbyte *dbytes = elements (p->getData()) + p->getOffset();
-  jint maxlen = p->maxlen - p->getOffset();
   ssize_t retlen = 0;
  
   // Do timeouts via select since SO_RCVTIMEO is not always available.
@@ -231,7 +230,7 @@
     }
  
   retlen =
-    ::recvfrom (native_fd, (char *) dbytes, maxlen, MSG_PEEK,
(sockaddr*) &u,
+    ::recvfrom (native_fd, (char *) dbytes, p->maxlen, MSG_PEEK,
(sockaddr*) &u,
       &addrlen);
   if (retlen < 0)
     goto error;
@@ -335,7 +334,6 @@
   union SockAddr u;
   socklen_t addrlen = sizeof(u);
   jbyte *dbytes = elements (p->getData()) + p->getOffset();
-  jint maxlen = p->maxlen - p->getOffset();
   ssize_t retlen = 0;
  
   // Do timeouts via select since SO_RCVTIMEO is not always available.
@@ -356,7 +354,7 @@
     }
  
   retlen =
-    ::recvfrom (native_fd, (char *) dbytes, maxlen, 0, (sockaddr*) &u,
+    ::recvfrom (native_fd, (char *) dbytes, p->maxlen, 0, (sockaddr*)
&u,
       &addrlen);
   if (retlen < 0)
     goto error;
Index: gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
===================================================================
RCS file:
/cvs/gcc/gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc,vretrieving revision 1.8
diff -u -r1.8 natPlainDatagramSocketImplWin32.cc
--- gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc 17 Mar
2004 08:10:28 -0000      1.8
+++ gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc 21 Mar
2004 20:27:48 -0000
@@ -202,7 +202,6 @@
   union SockAddr u;
   socklen_t addrlen = sizeof(u);
   jbyte *dbytes = elements (p->getData()) + p->getOffset();
-  jint maxlen = p->maxlen - p->getOffset();
   ssize_t retlen = 0;
  
   if (timeout > 0)
@@ -214,7 +213,7 @@
     }
  
   retlen =
-    ::recvfrom (native_fd, (char *) dbytes, maxlen, MSG_PEEK,
(sockaddr*) &u,
+    ::recvfrom (native_fd, (char *) dbytes, p->maxlen, MSG_PEEK,
(sockaddr*) &u,
       &addrlen);
   if (retlen == SOCKET_ERROR)
     goto error;
@@ -321,7 +320,6 @@
   union SockAddr u;
   socklen_t addrlen = sizeof(u);
   jbyte *dbytes = elements (p->getData()) + p->getOffset();
-  jint maxlen = p->maxlen - p->getOffset();
   ssize_t retlen = 0;
  
   if (timeout > 0)
@@ -336,7 +334,7 @@
     }
  
   retlen =
-    ::recvfrom (native_fd, (char *) dbytes, maxlen, 0, (sockaddr*) &u,
+    ::recvfrom (native_fd, (char *) dbytes, p->maxlen, 0, (sockaddr*)
&u,
       &addrlen);
   if (retlen < 0)
     goto error;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]