diff options
Diffstat (limited to 'Source/CPack/WiX/cmWIXSourceWriter.cxx')
-rw-r--r-- | Source/CPack/WiX/cmWIXSourceWriter.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index af7ba80..214b8ac 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -21,7 +21,8 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, bool isIncludeFile): Logger(logger), file(filename.c_str()), - state(DEFAULT) + state(DEFAULT), + sourceFilename(filename) { WriteXMLDeclaration(); @@ -39,10 +40,15 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, cmWIXSourceWriter::~cmWIXSourceWriter() { - while(elements.size()) + if(elements.size() > 1) { - EndElement(); + cmCPackLogger(cmCPackLog::LOG_ERROR, + elements.size() - 1 << " WiX elements were still open when closing '" << + sourceFilename << "'" << std::endl); + return; } + + EndElement(elements.back()); } void cmWIXSourceWriter::BeginElement(const std::string& name) @@ -60,12 +66,22 @@ void cmWIXSourceWriter::BeginElement(const std::string& name) state = BEGIN; } -void cmWIXSourceWriter::EndElement() +void cmWIXSourceWriter::EndElement(std::string const& name) { if(elements.empty()) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "can not end WiX element with no open elements" << std::endl); + "can not end WiX element with no open elements in '" << + sourceFilename << "'" << std::endl); + return; + } + + if(elements.back() != name) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "WiX element <" << elements.back() << + "> can not be closed by </" << name << "> in '" << + sourceFilename << "'" << std::endl); return; } @@ -173,6 +189,9 @@ std::string cmWIXSourceWriter::EscapeAttributeValue( case '<': result += "<"; break; + case '>': + result += ">"; + break; case '&': result +="&"; break; |