mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-20 17:49:38 +08:00
natFileDescriptorWin32.cc (read): Handle case where count is 0.
* java/io/natFileDescriptorWin32.cc (read): Handle case where count is 0. * java/io/natFileDescriptorPosix.cc (read): Handle case where count is 0. From-SVN: r58997
This commit is contained in:
parent
f18590c620
commit
a6b5bd3b6b
@ -1,5 +1,10 @@
|
||||
2002-11-10 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.
|
||||
|
||||
* java/io/Externalizable.java, java/io/FilePermission.java,
|
||||
java/io/ObjectStreamConstants.java, java/io/Serializable.java,
|
||||
java/io/SerializablePermission.java, java/text/Format.java,
|
||||
|
@ -293,6 +293,11 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
|
||||
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)
|
||||
|
@ -305,6 +305,10 @@ java::io::FileDescriptor::read(jbyteArray buffer, jint offset, jint count)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user