[Mono-devel-list] Re: CodeDom in Compiler.cs
Atsushi Eno
atsushi at ximian.com
Mon Apr 4 12:30:09 EDT 2005
I am not David so I'm not 100% sure (you could ask him directly).
But I can guess from his comment - he wrote that the input string
must be ASCII. And once it is transformed into byte[] by
ASCIIEncoding .GetBytes(), it could be more efficient to use
TransformBlock() that expects byte[].
Atsushi Eno
Andrew Skiba wrote:
> Atsushi Eno wrote:
>
>>> Yes, that's what I meant. Other similar thing is at
>>> System.Xml.Schema/BuiltInDatatype.cs:36. Does it really need
>>> System.Security.Cryptography?
>>
>>
>> Yes. It uses FromBase64Transform.
>>
>
> I see that FromBase64Transform was inserted there at svn revision 22077.
> What was the rationale of that fix? Why is FromBase64String better than
> Convert.FromBase64String? This is the relevant part of the patch:
>
> --- System.Xml.Schema/ChangeLog (revision 22076)
> +++ System.Xml.Schema/ChangeLog (revision 22077)
> @@ -1,3 +1,15 @@
> +2004-01-14 David Sheldon <dave-mono at earth.li>
> +
> + * BuiltInDatatype.cs:
> + XsdBase64Binary - Added Length, and used more direct, less
> fussy,
> + Base64 decoder.
>
> --- System.Xml.Schema/BuiltInDatatype.cs (revision 22076)
> +++ System.Xml.Schema/BuiltInDatatype.cs (revision 22077)
> @@ -12,6 +12,7 @@
> using System.Xml;
> using System.Xml.Schema;
> using System.Globalization;
> +using System.Security.Cryptography;
>
> namespace Mono.Xml.Schema
> {
> @@ -1126,21 +1094,83 @@
> public override object ParseValue (string s,
> XmlNameTable nameTable, XmlNamespaceManager nsmgr)
> {
> - return Convert.FromBase64String (Normalize (s));
> + // If it isnt ASCII it isnt valid base64 data
> + byte[] inArr = new
> System.Text.ASCIIEncoding().GetBytes(s);
> + FromBase64Transform t = new FromBase64Transform();
> + return t.TransformFinalBlock(inArr, 0,
> inArr.Length);
> }
>
>
More information about the Mono-devel-list
mailing list