Skip Menu |
 

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 6689
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: gaal [...] forum2.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.58
Fixed in: (no value)

Attachments
perl-libxml-devoded.0.patch



Subject: Compilation error in perl-libxml-mm.c [fix included]
Download (untitled) / with headers
text/plain 147b
There's a small c bug that prevents perl-libxml-mm.c from compiling, apparently from an extra if added before a variable declaration. Fix included.
--- perl-libxml-mm.c-orig 2004-06-21 11:03:10.780046000 +0300 +++ perl-libxml-mm.c 2004-06-21 11:05:32.990005000 +0300 @@ -959,13 +959,14 @@ if ( refnode != NULL ) { xmlDocPtr real_doc = refnode->doc; if ( real_doc != NULL && real_doc->encoding != NULL ) { + xmlChar * decoded; xs_warn( " encode node !!" ); /* The following statement is to handle bad values set by XML::LibXSLT */ if ( PmmNodeEncoding(real_doc) == XML_CHAR_ENCODING_NONE ) { PmmNodeEncoding(real_doc) = XML_CHAR_ENCODING_UTF8; } - xmlChar * decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) , + decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) , (const xmlChar *)string, (const xmlChar*)real_doc->encoding); xs_warn( "push decoded string into SV" );
Download (untitled) / with headers
text/plain 1.3k
[guest - Mon Jun 21 04:19:35 2004]: Show quoted text
> There's a small c bug that prevents perl-libxml-mm.c from compiling, > apparently from an extra if added before a variable declaration. Fix > included.
The attached fix is to change: xmlChar * decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) , (const xmlChar *)string, (const xmlChar*)real_doc->encoding); to: xmlChar * decoded ; ... decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) , (const xmlChar *)string, (const xmlChar*)real_doc->encoding); The funny thing is the elipisis there. I believe the code is otherwise the same, either an in-line declaration or a two statement declare (should be the same, right?) and sure enough, its the xs_warn statment's position: xs_warn( " encode node !!" ); that makes a difference, not the declaration. Why? well the define for xs_warn is (perl-libxml-mm.h): #ifdef XS_WARNINGS #define xs_warn(string) warn(string) #else #define xs_warn(string) #endif and in the undef XS_WARNINGS state that leaves the semicolon at the end of the xs_warn line behind. Some compilers (gcc 2.95.2 anyway) must not like the: if ... ; xmlChar * decoded = ... construct. Not sure if taking that semicolon along in the define would be the better way to do it? a
Download (untitled) / with headers
text/plain 1.2k
[guest - Mon Oct 4 17:24:34 2004]: Show quoted text
> to: > xmlChar * decoded ; > ... > decoded = PmmFastDecodeString( PmmNodeEncoding(real_doc) , > (const xmlChar *)string, > (const xmlChar*)real_doc->encoding);
a smarter programmer (P. Pajas) pointed out: Show quoted text
> AFAIR, the problem was, as someone has pointed out a while ago, that
the "inline" declaration was not at the start of the block (there were some statements before it), which is forbidden by C standard (that being new to me made me look it up when I was fixing that in the CVS). Ooops. Thanks. I was moving stuff around found the xs_warn( ) part by using gcc -E to stop after preprocessing and I saw the lone ';' I thought it should be okay, but (as a perl guy looking at 'C' ...) it was as you say - it didn't allow the declaration that wasn't at the beginning of a block. So this fails: if ( real_doc != NULL && real_doc->encoding != NULL ) { xs_warn( " encode node !!" ); xmlChar * decode_str; even if xs_warn() is ifdeffed away, which is probably why they left the semicolon in the #define - it'd keep this from working w/o XS_WARN defined but failing when it *was* defined. I'll be quiet now ;-> a


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.