Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
jvilaca #1
Member since Aug 2006 · 1 post
Group memberships: Members
Show profile · Link to this post
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;
         }
Avatar
Alex #2
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes thats correct.
This is a port of the XP Java XML parser. I think this code was created with the Java Language Conversion Assistant.
Its fixed in my working copy, i will commit the code to SVN in the evening.

Alex
Alexander Gnauck
AG-Software
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS