]> granicus.if.org Git - graphviz/commitdiff
Visio plugin: replace redeclaration of 'xml_string' with a #include
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Oct 2021 17:03:07 +0000 (10:03 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 8 Oct 2021 14:50:57 +0000 (07:50 -0700)
There is no need for this duplicate prototype, or to lie about its type
signature.

Related to #1868.

plugin/visio/VisioText.cpp

index 64eed34480ddeafea6e4dd05fc45dc31441f408b..53021818a1b8c50b2d18527688359451fe2089ba 100644 (file)
@@ -17,9 +17,7 @@
 #include <cstdlib>
 #include <string.h>
 
-// slight lie that this function takes a const pointer (it does not, but we know
-// it does not modify its argument)
-extern "C" char *xml_string(const char* str);
+#include <common/utils.h>
 
 namespace Visio
 {
@@ -66,7 +64,8 @@ namespace Visio
        
        void Run::Print(GVJ_t* job, unsigned int index) const
        {
-               gvprintf(job, "<pp IX='%u'/><cp IX='%u'/>%s\n", index, index, xml_string(_text.c_str()));       /* para mark + char mark + actual text */
+               auto c_str = const_cast<char*>(_text.c_str());
+               gvprintf(job, "<pp IX='%u'/><cp IX='%u'/>%s\n", index, index, xml_string(c_str));       /* para mark + char mark + actual text */
        }
        
        Text Text::CreateText(GVJ_t* job, pointf p, textspan_t* span)