From 2fdd5a53ad2b9366e39d6b48456aa5eb06b898b0 Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Mon, 6 Sep 2021 13:09:32 -0400
Subject: [PATCH] GeoModelXml: Fix compilation with gcc11.

Need to convert XMLCh to a char* to use it with a MsgStream.
---
 .../GeoModelXml/src/LogvolProcessor.cxx                | 10 +++++++---
 DetectorDescription/GeoModelXml/src/MakeShaperef.cxx   |  4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/DetectorDescription/GeoModelXml/src/LogvolProcessor.cxx b/DetectorDescription/GeoModelXml/src/LogvolProcessor.cxx
index 65a33e8a23f9..237771bb7102 100644
--- a/DetectorDescription/GeoModelXml/src/LogvolProcessor.cxx
+++ b/DetectorDescription/GeoModelXml/src/LogvolProcessor.cxx
@@ -68,9 +68,11 @@ GeoNameTag *physVolName;
         DOMNode *parent = refShape->getParentNode();
         if (XMLString::compareIString(parent->getNodeName(), XMLString::transcode("shapes")) != 0) {
 
+            char* shape_s = XMLString::transcode (shape);
             msglog << MSG::FATAL << "Processing logvol " << name << 
                     ". Error in gmx file. An IDREF for a logvol shape did not refer to a shape.\n" <<
-                    "Shape ref was " << shape << "; exiting" << endmsg;
+              "Shape ref was " << shape_s << "; exiting" << endmsg;
+            XMLString::release (&shape_s);
             exit (1); // Need to improve...
         }
 //
@@ -92,10 +94,12 @@ GeoNameTag *physVolName;
         parent = refMaterial->getParentNode();
 	XMLCh * materials_tmp = XMLString::transcode("materials");
         if (XMLString::compareIString(parent->getNodeName(), materials_tmp) != 0) {
+            char* material_s = XMLString::transcode (material);
             msglog << MSG::FATAL << "Processing logvol " << name << 
                     ". Error in gmx file. An IDREF for a logvol material did not refer to a material.\n" <<
-                    "Material ref was " << material << "; exiting" << endmsg;
-            exit (1); // Need to improve...
+                    "Material ref was " << material_s << "; exiting" << endmsg;
+           XMLString::release (&material_s);
+           exit (1); // Need to improve...
         }
 
         GeoMaterial *m = (GeoMaterial *) gmxUtil.tagHandler.material.process(refMaterial, gmxUtil);
diff --git a/DetectorDescription/GeoModelXml/src/MakeShaperef.cxx b/DetectorDescription/GeoModelXml/src/MakeShaperef.cxx
index fe8a6a1cf812..7bcb5b2374eb 100644
--- a/DetectorDescription/GeoModelXml/src/MakeShaperef.cxx
+++ b/DetectorDescription/GeoModelXml/src/MakeShaperef.cxx
@@ -31,9 +31,11 @@ const RCBase *MakeShaperef::process(const DOMElement *element, GmxUtil &gmxUtil)
 //
     DOMNode *parent = shape->getParentNode();
     if (XMLString::compareIString(parent->getNodeName(), shapes_tmp) != 0) {
+        char* idref_s = XMLString::transcode (idref);
         OUTPUT_STREAM;
         msglog << MSG::FATAL << "Error processing <shaperef> tag: An IDREF for a shape did not refer to a shape.\nShape ref was " << 
-               idref << "; exiting" << endmsg;
+               idref_s << "; exiting" << endmsg;
+        XMLString::release (&idref_s);
         exit (1); // Need to improve...
     }
 //
-- 
GitLab