[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO BinaryReader.cs,1.2
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO BinaryReader.cs,1.2,1.3 |
Date: |
Fri, 08 Nov 2002 03:58:55 -0500 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO
In directory subversions:/tmp/cvs-serv10503/runtime/System/IO
Modified Files:
BinaryReader.cs
Log Message:
the string header is bytecount, not charcount
Index: BinaryReader.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/IO/BinaryReader.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** BinaryReader.cs 11 Dec 2001 11:03:48 -0000 1.2
--- BinaryReader.cs 8 Nov 2002 08:58:52 -0000 1.3
***************
*** 423,428 ****
public virtual char[] ReadChars(int count)
{
! char[] buffer;
! int result;
if(count < 0)
{
--- 423,428 ----
public virtual char[] ReadChars(int count)
{
! byte[] buffer;
! int len;
if(count < 0)
{
***************
*** 430,449 ****
("count",
_("ArgRange_NonNegative"));
}
! buffer = new char [count];
! result = Read(buffer, 0, count);
! if(result == 0)
{
throw new
EndOfStreamException(_("IO_ReadEndOfStream"));
}
! if(result != count)
! {
! char[] newBuffer = new char [result];
! Array.Copy(buffer, newBuffer, result);
! return newBuffer;
! }
! else
! {
! return buffer;
! }
}
--- 430,443 ----
("count",
_("ArgRange_NonNegative"));
}
! buffer = ReadBytes(count);
! if(buffer.Length <= 0 || buffer.Length!=count)
{
+ /* this exception fall through to the
ReadString */
throw new
EndOfStreamException(_("IO_ReadEndOfStream"));
}
!
len=encoding.GetCharCount(buffer,0,buffer.Length);
! char[] newBuffer = new char[len];
!
encoding.GetChars(buffer,0,buffer.Length,newBuffer,0);
! return newBuffer;
}
***************
*** 460,468 ****
{
chars = ReadChars(len);
! if(chars.Length != len)
! {
! // The string was truncated.
! throw new
EndOfStreamException(_("IO_ReadEndOfStream"));
! }
return new String(chars);
}
--- 454,458 ----
{
chars = ReadChars(len);
! /* an exception is thrown from
ReadChars for EndOfStream */
return new String(chars);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/IO BinaryReader.cs,1.2,1.3,
Gopal.V <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom gencdom.c,NONE,1.1 rules.txt,NONE,1.1
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.425,1.426
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System/CodeDom gencdom.c,NONE,1.1 rules.txt,NONE,1.1
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.425,1.426
- Index(es):