Subject: Duplicate attribute exception
I'm getting a duplicate attribute exception when attribute count exceeds 8. I tracked the bug down to the parser, in the grow static functions. The BlockCopy copies bytes, and so a int[] has Length*sizeof(int) bytes, not Length bytes. It is simpler and more to the point to use the CopyTo() from the Array API as follows in the patch:
Index: Xml/xpnet/ContentToken.cs
===================================================================
--- Xml/xpnet/ContentToken.cs (revision 61)
+++ Xml/xpnet/ContentToken.cs (working copy)
@@ -165,7 +165,7 @@
{
int[] tem = v;
v = new int[tem.Length << 1];
- System.Buffer.BlockCopy(tem, 0, v, 0, tem.Length);
+ tem.CopyTo(v, 0);
return v;
}
@@ -173,7 +173,7 @@
{
bool[] tem = v;
v = new bool[tem.Length << 1];
- System.Buffer.BlockCopy(tem, 0, v, 0, tem.Length);
+ tem.CopyTo(v, 0);
return v;
}
Index: Xml/xpnet/ContentToken.cs
===================================================================
--- Xml/xpnet/ContentToken.cs (revision 61)
+++ Xml/xpnet/ContentToken.cs (working copy)
@@ -165,7 +165,7 @@
{
int[] tem = v;
v = new int[tem.Length << 1];
- System.Buffer.BlockCopy(tem, 0, v, 0, tem.Length);
+ tem.CopyTo(v, 0);
return v;
}
@@ -173,7 +173,7 @@
{
bool[] tem = v;
v = new bool[tem.Length << 1];
- System.Buffer.BlockCopy(tem, 0, v, 0, tem.Length);
+ tem.CopyTo(v, 0);
return v;
}
jvilaca
Show profile
Link to this post
