[Cmake-commits] [cmake-commits] king committed cmXMLSafe.cxx 1.4 1.5

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 2 16:27:52 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv681/Source

Modified Files:
	cmXMLSafe.cxx 
Log Message:
BUG: Avoid encoding invalid XML chars in CTest

CTest encodes test and tool output in XML for dashboard submission.
This fixes the XML encoding implementation to not encode an invalid
character and instead put a human-readable tag in its place.
See issue #8647.


Index: cmXMLSafe.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmXMLSafe.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** cmXMLSafe.cxx	2 Mar 2009 14:59:14 -0000	1.4
--- cmXMLSafe.cxx	2 Mar 2009 21:27:50 -0000	1.5
***************
*** 83,87 ****
            // handle the current locale and its encoding.
            char buf[16];
!           sprintf(buf, "[bad-char-%hx]", static_cast<unsigned short>(c));
            os << buf;
            }
--- 83,97 ----
            // handle the current locale and its encoding.
            char buf[16];
!           // http://www.w3.org/TR/REC-xml/#NT-Char
!           if(c >= 0x80)
!             {
!             sprintf(buf, "&#x%hx;", static_cast<unsigned short>(c));
!             }
!           else
!             {
!             // We cannot use "&#x%hx;" here because this value is not
!             // valid in XML.  Instead use a human-readable hex value.
!             sprintf(buf, "&lt;0x%hx&gt;", static_cast<unsigned short>(c));
!             }
            os << buf;
            }



More information about the Cmake-commits mailing list