Re: [xml] libxml2 2.9.4 build error with Visual Studio 2005/2008/2010



On 03.06.2016 11:51, Fabrice Manfroi wrote:
Hello,

I'm trying to build the last libxml2 version (2.9.4) with an old Visual
Studio version (2005, 2008 and 2010) and I get the following errors:

===

..\relaxng.c(2218) : error C2275: 'xmlChar' : illegal use of this type
as an expression

[snip]

..\xmlschemas.c(3172) : error C2275: 'xmlChar' : illegal use of this
type as an expression

===

It could be easily fixed like illustrated in the attached patch.

If you could have a look...


 {
     char msg[1000];
+    xmlChar *result=NULL;
 
     if (arg1 == NULL)
         arg1 = BAD_CAST "";
@@ -2215,7 +2216,7 @@
         snprintf(msg, 1000, "Unknown error code %d\n", err);
     }
     msg[1000 - 1] = 0;
-    xmlChar *result = xmlCharStrdup(msg);
+    result = xmlCharStrdup(msg);
     return (xmlEscapeFormatString(&result));

This makes sense, I think this is worth fixing. I suggest to tweak a
patch a bit - remove initializers you don't need, and keep variable
scope as it is here:

      if (expected) {
          msg = xmlStrcat(msg, BAD_CAST " Expected is '");
-         xmlChar *expectedEscaped = xmlCharStrdup(expected);
+         expectedEscaped = xmlCharStrdup(expected);





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