Re: [xml] hash.c: problem and patch



On Tue, Jun 18, 2002 at 09:30:17AM +0200, Peter Jacobi wrote:
Content-Description: Mail message body
Hi Daniel, All,

Some days ago I wrote, that using Watcom C on Win32, validating 
(xmllint --valid) segfaults, but only when compiled without debugging info.

I was wondering since then whether the compiler or the code is to blame. 
I still don't know the answer to this question, but I know the cause of the 
segfaulting and I have a patch.

The problem is the casting of a callback function to a different signature 
in xmlHashScanner:

  xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) {
!     xmlHashScanFull (table, (xmlHashScannerFull) f, data);
  }

I'm pretty sure the C++ standard sees this as cause of undefined 
behaviour, but I don't know whether written or unwritten C rules require a 
compiler to handle this.

  Hum, I think from a C point of view it's okay, but I have no clue about
C++ handling of this.

Anyway, I've attached a patch which avoids this cast by using a stub 
function with the right signature. Strictly speaking, it's not completely 
kosher, as it still requires casting away a const modifier.

  Since this solves your problem, and doesn't seems to introduce any,
I applied your patch, thanks !

Daniel


-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]