Re: How the attributes of "userdata" are altered with every handler function call?

Reid Spencer <[email protected]>
Newsgroups gmane.text.xml.expat.general
Organization eXtensible Systems, Inc.
Message-ID <[email protected]>
This sounds like a general "C" programming issue and not relevant to
this list. However, since you're trying to use the expat interface,
here's some things to think about:

1. Did you allocate the C struct on the stack or on the heap? If on the
stack, it could be corrupted.

2. Did you call XML_SetUserData with the correct value in the second
argument?

3. How are you doing the cast? Any chance the address might change
during the cast? Which compiler is it? If you're using a modern compiler
or C++ you need to use reinterpret_cast<struct name*>(user_data).

Reid.

On Wed, 2005-07-06 at 16:32 -0400, [email protected] wrote:
> Hello,
> 
> I have built a C Struc to keep track of the elements and attributes that the handler functions read. I make the explicit cast from "void* data* to my C Struc. In the first pass, 
> the attributes are stored correctly in the C Struct. However, every time the handlers are called, the C Struct attributes (that were initially stored correctly) change. 
> 
> In other words, every time the handlers are called they override part of the information that has been stored (but not through the program logic). Is like the "void* user data" argument is corrupted with each handler function call.
> 
> I have been trapped with this problem for a week. Does anybody have an idea of why this is happening?
> 
> Thank you in advance for your help!
> -Rodrigo
> 
> 
> _______________________________________________
> Expat-discuss mailing list
> [email protected]
> http://mail.libexpat.org/mailman/listinfo/expat-discuss

_______________________________________________
Expat-discuss mailing list
[email protected]
http://mail.libexpat.org/mailman/listinfo/expat-discuss
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCzG5b3J9yEj6nvGcRApjRAKDbqHCStRNj6JnqXvkOWAaqhzwDzACfZTEt
HFw4VRJU/0spmNMiNTXKDhY=
=NZc6
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.