This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: java.io fixlet
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 10 Nov 2002 15:15:43 -0700
- Subject: Patch: FYI: java.io fixlet
- Reply-to: tromey at redhat dot com
I'm checking this in.
This fixes a Mauve failure.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/io/natFileDescriptorWin32.cc (read): Handle case where
count is 0.
* java/io/natFileDescriptorPosix.cc (read): Handle case where
count is 0.
Index: java/io/natFileDescriptorPosix.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/natFileDescriptorPosix.cc,v
retrieving revision 1.22
diff -u -r1.22 natFileDescriptorPosix.cc
--- java/io/natFileDescriptorPosix.cc 29 Aug 2002 18:05:15 -0000 1.22
+++ java/io/natFileDescriptorPosix.cc 10 Nov 2002 22:16:30 -0000
@@ -293,6 +293,11 @@
jsize bsize = JvGetArrayLength (buffer);
if (offset < 0 || count < 0 || offset + count > bsize)
throw new java::lang::ArrayIndexOutOfBoundsException;
+
+ // Must return 0 if an attempt is made to read 0 bytes.
+ if (count == 0)
+ return 0;
+
jbyte *bytes = elements (buffer) + offset;
int r = ::read (fd, bytes, count);
if (r == 0)
Index: java/io/natFileDescriptorWin32.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/natFileDescriptorWin32.cc,v
retrieving revision 1.10
diff -u -r1.10 natFileDescriptorWin32.cc
--- java/io/natFileDescriptorWin32.cc 24 Jul 2002 17:48:41 -0000 1.10
+++ java/io/natFileDescriptorWin32.cc 10 Nov 2002 22:16:30 -0000
@@ -305,6 +305,10 @@
if (offset < 0 || count < 0 || offset + count > bsize)
throw new java::lang::ArrayIndexOutOfBoundsException;
+ // Must return 0 if an attempt is made to read 0 bytes.
+ if (count == 0)
+ return 0;
+
jbyte *bytes = elements (buffer) + offset;
DWORD read;