Display "Your plist looks so wonderful" even when there is info

messages.
This commit is contained in:
jief666 2021-10-20 20:38:03 +02:00
parent c7d8bbf283
commit 23e4b83d20

View File

@ -92,23 +92,23 @@ extern "C" int main(int argc, const char * argv[])
} }
buf[st.st_size] = 0; // should not be needed. buf[st.st_size] = 0; // should not be needed.
bool b;
ConfigPlistClass configPlistTest; ConfigPlistClass configPlistTest;
XmlLiteParser xmlLiteParser; XmlLiteParser xmlLiteParser;
xmlLiteParser.init(buf, st.st_size); xmlLiteParser.init(buf, st.st_size);
b = configPlistTest.parse(&xmlLiteParser, LString8("")); configPlistTest.parse(&xmlLiteParser, LString8(""));
bool b = true;
for ( size_t idx = 0 ; idx < xmlLiteParser.getXmlParserMessageArray().size() ; idx++ ) { for ( size_t idx = 0 ; idx < xmlLiteParser.getXmlParserMessageArray().size() ; idx++ ) {
const XmlParserMessage& xmlMsg = xmlLiteParser.getXmlParserMessageArray()[idx]; const XmlParserMessage& xmlMsg = xmlLiteParser.getXmlParserMessageArray()[idx];
if ( xmlMsg.type != XmlParserMessageType::info ) { if ( xmlMsg.type != XmlParserMessageType::info ) {
printf("%s\n", xmlMsg.getFormattedMsg().c_str()); printf("%s\n", xmlMsg.getFormattedMsg().c_str());
b = false;
}else{
// One day, create a command line option to display info messages.
} }
} }
if ( b ) { if ( b ) {
// if ( xmlLiteParser.getErrorsAndWarnings().size() > 0 ) {
// printf("parse return true, but there is error and warnings! BUG !!");
// }
if ( xmlLiteParser.getXmlParserMessageArray().size() == 0 ) { if ( xmlLiteParser.getXmlParserMessageArray().size() == 0 ) {
printf("Your plist looks so wonderful. Well done!\n"); printf("Your plist looks so wonderful. Well done!\n");
} }