[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Text ASCIIEncoding.cs
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Text ASCIIEncoding.cs,1.5,1.6 Latin1Encoding.cs,1.3,1.4 |
Date: |
Wed, 23 Apr 2003 18:23:02 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Text
In directory subversions:/tmp/cvs-serv21262/runtime/System/Text
Modified Files:
ASCIIEncoding.cs Latin1Encoding.cs
Log Message:
Return "String.Empty" for a zero-length array range in "GetString";
use '?' for high characters in "ASCIIEncoding.GetChars".
Index: ASCIIEncoding.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Text/ASCIIEncoding.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ASCIIEncoding.cs 24 Aug 2002 22:39:59 -0000 1.5
--- ASCIIEncoding.cs 23 Apr 2003 22:23:00 -0000 1.6
***************
*** 212,218 ****
}
int count = byteCount;
while(count-- > 0)
{
! chars[charIndex++] =
(char)(bytes[byteIndex++]);
}
return byteCount;
--- 212,227 ----
}
int count = byteCount;
+ byte ch;
while(count-- > 0)
{
! ch = bytes[byteIndex++];
! if(ch < 0x80)
! {
! chars[charIndex++] = (char)ch;
! }
! else
! {
! chars[charIndex++] = '?';
! }
}
return byteCount;
***************
*** 260,263 ****
--- 269,276 ----
("count", _("ArgRange_Array"));
}
+ if(count == 0)
+ {
+ return String.Empty;
+ }
String s = String.NewString(count);
int posn = 0;
***************
*** 273,276 ****
--- 286,293 ----
{
throw new
ArgumentNullException("bytes");
+ }
+ if(bytes.Length == 0)
+ {
+ return String.Empty;
}
int count = bytes.Length;
Index: Latin1Encoding.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Text/Latin1Encoding.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Latin1Encoding.cs 15 Apr 2002 11:43:33 -0000 1.3
--- Latin1Encoding.cs 23 Apr 2003 22:23:00 -0000 1.4
***************
*** 272,275 ****
--- 272,279 ----
("count", _("ArgRange_Array"));
}
+ if(count == 0)
+ {
+ return String.Empty;
+ }
String s = String.NewString(count);
int posn = 0;
***************
*** 285,288 ****
--- 289,296 ----
{
throw new
ArgumentNullException("bytes");
+ }
+ if(bytes.Length == 0)
+ {
+ return String.Empty;
}
int count = bytes.Length;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Text ASCIIEncoding.cs,1.5,1.6 Latin1Encoding.cs,1.3,1.4,
Rhys Weatherley <address@hidden> <=