lmi
[Top][All Lists]
Advanced

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

[lmi] xmlwrapp-0.8.1 '-Wcast-qual' warning


From: Greg Chicares
Subject: [lmi] xmlwrapp-0.8.1 '-Wcast-qual' warning
Date: Sun, 1 Oct 2017 15:17:10 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

Compiling xmlwrapp-0.8.1 with '-Wcast-qual' I see:

/opt/lmi/third_party/src/libxml/node.cxx: In member function ‘void 
xml::node::set_namespace(const string&)’:
/opt/lmi/third_party/src/libxml/node.cxx:592:36: error: cast from type ‘const 
xmlChar* {aka const unsigned char*}’ to type ‘void*’ casts away qualifiers 
[-Werror=cast-qual]
                 xmlFree((void*)ns->href);
                                    ^~~~

I didn't dig through the typedefs to find where that becomes const,
but the coarse patch below does prevent the warning, so I'll add
it to the lmi repository:

diff --recursive '--unified=3' original/xmlwrapp-0.8.1/src/libxml/node.cxx 
modified/xmlwrapp-0.8.1/src/libxml/node.cxx
--- original/xmlwrapp-0.8.1/src/libxml/node.cxx 2016-12-11 14:28:47.000000000 
+0000
+++ modified/xmlwrapp-0.8.1/src/libxml/node.cxx 2017-09-30 21:50:56.765557364 
+0000
@@ -589,7 +589,7 @@
         {
             if ( ns->prefix == NULL )
             {
-                xmlFree((void*)ns->href);
+                xmlFree((void*)const_cast<xmlChar*>(ns->href));
                 ns->href = xmlStrdup(xmlHref);
                 break;
             }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]