You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com> on 2008/01/24 16:15:50 UTC

[PATCH] Fix compilation warning with Expat 2

[[[
Fix compilation warning with Expat 2.

* subversion/libsvn_subr/xml.c
  (svn_xml_parse): When creating error messages, use format specifier
   conditionalized on the version of Expat.

Patch by: markphip
          arfrever
]]]

The patch is here:
http://svn.haxx.se/dev/archive-2007-12/0766.shtml

-- 
Arfrever Frehtes Taifersar Arahesis

Re: [PATCH] Fix compilation warning with Expat 2

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2008-01-27 01:09:35 Julian Foad napisał(a):
> Hi Arfrever.
> 
> Thanks for the report and the patch and your persistence. I agree your patch is 
> correct. However, I committed the following alternative fix in r29057, which 
> avoids an explicit dependency on particular versions of Expat, and has only one 
> copy of the error message for translators to maintain.
> 
> I tested it by compiling with the function redefined manually to return various 
> types, and looking for the warning to go away with all reasonable integer 
> types. (I have Expat v1 installed.)
> 
> Let me know if there is any problem with this solution, of course.

Thanks. It works correctly.
(Copyright years are still 2000-2006 :) .)

-- 
Arfrever Frehtes Taifersar Arahesis

Re: [PATCH] Fix compilation warning with Expat 2

Posted by Julian Foad <ju...@btopenworld.com>.
Hi Arfrever.

Thanks for the report and the patch and your persistence. I agree your patch is 
correct. However, I committed the following alternative fix in r29057, which 
avoids an explicit dependency on particular versions of Expat, and has only one 
copy of the error message for translators to maintain.

I tested it by compiling with the function redefined manually to return various 
types, and looking for the warning to go away with all reasonable integer 
types. (I have Expat v1 installed.)

Let me know if there is any problem with this solution, of course.

[[[
Index: subversion/libsvn_subr/xml.c
===================================================================
--- subversion/libsvn_subr/xml.c        (revision 29055)
+++ subversion/libsvn_subr/xml.c        (working copy)
@@ -395,11 +395,13 @@
    /* If expat choked internally, return its error. */
    if (! success)
      {
+      /* Line num is "int" in Expat v1, "long" in v2; hide the difference. */
+      long line = XML_GetCurrentLineNumber(svn_parser->parser);
+
        err = svn_error_createf
          (SVN_ERR_XML_MALFORMED, NULL,
-         _("Malformed XML: %s at line %d"),
-         XML_ErrorString(XML_GetErrorCode(svn_parser->parser)),
-         XML_GetCurrentLineNumber(svn_parser->parser));
+         _("Malformed XML: %s at line %ld"),
+         XML_ErrorString(XML_GetErrorCode(svn_parser->parser)), line);

        /* Kill all parsers and return the expat error */
        svn_xml_free_parser(svn_parser);
]]]

Regards,
- Julian


Arfrever Frehtes Taifersar Arahesis wrote:
> [[[
> Fix compilation warning with Expat 2.
> 
> * subversion/libsvn_subr/xml.c
>   (svn_xml_parse): When creating error messages, use format specifier
>    conditionalized on the version of Expat.
> 
> Patch by: markphip
>           arfrever
> ]]]
> 
> The patch is here:
> http://svn.haxx.se/dev/archive-2007-12/0766.shtml

For quick reference:
> Index: subversion/libsvn_subr/xml.c
> ===================================================================
> --- subversion/libsvn_subr/xml.c        (revision 29055)
> +++ subversion/libsvn_subr/xml.c        (working copy)
> @@ -397,7 +397,11 @@
>      {
>        err = svn_error_createf
>          (SVN_ERR_XML_MALFORMED, NULL,
> +#if XML_MAJOR_VERSION >= 2
> +         _("Malformed XML: %s at line %ld"),
> +#else
>           _("Malformed XML: %s at line %d"),
> +#endif
>           XML_ErrorString(XML_GetErrorCode(svn_parser->parser)),
>           XML_GetCurrentLineNumber(svn_parser->parser));
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org