[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] - Fix a compiler warning on OSX

From: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-11-20 20:13:01 CET

"Mark Phippard" <markphip@gmail.com> writes:
> I noticed this in my output. I report it only because a similar
> warning in the mergeinfo.c code was fixed last week, therefore I
> assume people think it is a good idea to fix these.
>
> subversion/libsvn_subr/xml.c: In function 'svn_xml_parse':
> subversion/libsvn_subr/xml.c:402: warning: format '%d' expects type
> 'int', but argument 5 has type 'XML_Size'
>
> Changing the format specifier to %ld makes the warning go away. I
> imagine an XML file is not likely to have a line number that is bigger
> than the size of int, and I was not sure if there are some
> platform-specific size differences, so I did not just blindly commit
> it. Also, according to blame it looks like the code has been around a
> while.
>
> I have attached a patch with log message. If this is something we
> should fix then let me know and I can commit it.

What version of expat do you have? I have 1.95.8; you can look in
/usr/include/expat.h for this:

   #define XML_MAJOR_VERSION 1
   #define XML_MINOR_VERSION 95
   #define XML_MICRO_VERSION 8

Also in expat.h, I see this:

   XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);

So it's "int" there. But your warning was about type "XML_Size",
which according to your patch maps to long int:

> --- subversion/libsvn_subr/xml.c (revision 27938)
> +++ subversion/libsvn_subr/xml.c (working copy)
> @@ -397,7 +397,7 @@
> {
> err = svn_error_createf
> (SVN_ERR_XML_MALFORMED, NULL,
> - _("Malformed XML: %s at line %d"),
> + mail_("Malformed XML: %s at line %ld"),
> XML_ErrorString(XML_GetErrorCode(svn_parser->parser)),
> XML_GetCurrentLineNumber(svn_parser->parser));

"XML_Size" doesn't even appear in any of my expat header files :-).
So are you using a different parser with an almost-but-not-quite-same
API, or just a different version of expat?

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 20 20:15:35 2007

This is an archived mail posted to the Subversion Dev mailing list.