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]

Patch: FYI: java.io fixlet


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;


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