[Expat-bugs] [ expat-Bugs-644334 ] (expat 1.95.5) Compiling by aCC on HP

SourceForge.net noreply at sourceforge.net
Mon Jan 20 21:05:16 EST 2003


Bugs item #644334, was opened at 2002-11-26 16:03
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=644334&group_id=10127

Category: Documentation
Group: Platform Specific
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Artyom Bolgar (artyom17)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: (expat 1.95.5) Compiling by aCC on HP

Initial Comment:
I found out that EXPAT can't be compiled by aCC 
compiler on HP and SUN. It happens because this 
compiler tries to compile C-files as C++ ones. That is 
why some lines can't be compiled, for example:

   parser = memsuite->malloc_fcn(sizeof(struct 
XML_ParserStruct));

it should be changed to:

   parser = (struct XML_ParserStruct*)memsuite-
>malloc_fcn(sizeof(struct XML_ParserStruct));

In this case it is compatible with both C and C++ 
languages. There are a lot of such lines in xmlparse.c 
and one in xmltok.c. I fixed all such places and I 
attached the .diff-files for 1.95.5 version. 
This problem could be easyly reproduced by compiling 
by VC6 or VC7 with '-TP' option ("compile all files as 
C++").


----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2003-01-21 00:05

Message:
Logged In: YES 
user_id=3066

Documented XML_SetExternalEntityRefHandlerArg(), including
API foolishness, in doc/reference.html 1.40.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2002-11-27 13:10

Message:
Logged In: NO 

Couldn't this problem be simply solved by specifying using 
c89 (not aCC) when compiling?

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-11-27 12:08

Message:
Logged In: YES 
user_id=290026

There were more things to fix, some cosmetic changes,
and I uncovered a problem with the API - the 
externalEntityRefHandler type definition:

This is how the externalEntityRefHandler is called:

if (!externalEntityRefHandler(
                                        externalEntityRefHandlerArg,
                                        0,
                                        entity->base,
                                        entity->systemId,
                                        entity->publicId))

and this is how one sets externalEntityRefHandlerArg:

void
XML_SetExternalEntityRefHandlerArg(
                                      XML_Parser parser, void *arg)
{
  if (arg)
    externalEntityRefHandlerArg = arg;
  else
    externalEntityRefHandlerArg = parser;
}

So, externalEntityRefHandlerArg is a void pointer, but 
can contain a user defined pointer or a parser pointer.
Unfortunately the externalEntityRefHandler is defined 
like this:

typedef int (*XML_ExternalEntityRefHandler)(
                                            XML_Parser parser,
                                            const XML_Char *context,
                                            const XML_Char *base,
                                            const XML_Char *systemId,
                                            const XML_Char *publicId);

In order to fix that I changed the type of
externalEntityRefHandlerArg  from void * to
XML_Parser (= struct struct XML_ParserStruct *)
and added a type cast in 
XML_SetExternalEntityRefHandlerArg.
However, this is not a real fix, since ideally
the API should be changed. Needs documentation.

Attached as xmlparse.diff.

Leave open for Fred to document the API issue.






----------------------------------------------------------------------

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-11-26 23:05

Message:
Logged In: YES 
user_id=3066

Committed changes based on the supplied patch as 
lib/xmlparse.c 1.96 and lib/xmltok.c 1.27.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=110127&aid=644334&group_id=10127



More information about the Expat-bugs mailing list