1919%{
2020
2121/*
22- * includes
22+ * includes
2323 */
2424#include " config.h"
2525#include " input.h"
4646
4747/* -----------------------------------------------------------------
4848 *
49- * static variables
49+ * static variables
5050 */
5151
5252struct ConfigFileState
@@ -77,8 +77,8 @@ static const char *stateToString(int state);
7777
7878/* -----------------------------------------------------------------
7979 */
80- #undef YY_INPUT
81- #define YY_INPUT (buf,result,max_size ) result=yyread(buf,max_size);
80+ #undef YY_INPUT
81+ #define YY_INPUT (buf,result,max_size ) result=yyread(buf,max_size);
8282
8383static int yyread (char *buf,int maxSize)
8484{
@@ -334,7 +334,7 @@ static void readIncludeFile(const QString &incName)
334334 if (g_includeDepth==MAX_INCLUDE_DEPTH)
335335 {
336336 config_err (" maximum include depth (%d) reached, %s is not included." ,
337- MAX_INCLUDE_DEPTH,qPrintable (incName));
337+ MAX_INCLUDE_DEPTH,qPrintable (incName));
338338 }
339339
340340 QString inc = incName;
@@ -722,7 +722,7 @@ static void upgradeConfig(const QHash<QString,Input*> &options)
722722 bool classGraph = InputBool::convertToBool (v3,isValid3);
723723 if (isValid1 && isValid2 && isValid3 && !classDiagrams && !haveDot && classGraph)
724724 {
725- config_warn (" Changing CLASS_GRAPH option to TEXT because obsolete option CLASS_DIAGRAM was found and set to NO.\n " );
725+ config_warn (" Changing CLASS_GRAPH option to TEXT because obsolete option CLASS_DIAGRAM was found and set to NO.\n " );
726726 optClassGraph->setValue (QString::fromLatin1 (" TEXT" ));
727727 }
728728 }
@@ -800,10 +800,10 @@ void writeStringValue(QTextStream &t,TextCodecAdapter *codec,const QString &s)
800800 while (!(c=*p++).isNull () && !needsEscaping)
801801 {
802802 needsEscaping = (c==QChar::fromLatin1 (' ' ) ||
803- c==QChar::fromLatin1 (' ,' ) ||
804- c==QChar::fromLatin1 (' \n ' ) ||
805- c==QChar::fromLatin1 (' \t ' ) ||
806- c==QChar::fromLatin1 (' "' ));
803+ c==QChar::fromLatin1 (' ,' ) ||
804+ c==QChar::fromLatin1 (' \n ' ) ||
805+ c==QChar::fromLatin1 (' \t ' ) ||
806+ c==QChar::fromLatin1 (' "' ));
807807 }
808808 p=s.data ();
809809 while (!(c=*p++).isNull () && !needsHashEscaping)
@@ -820,15 +820,27 @@ void writeStringValue(QTextStream &t,TextCodecAdapter *codec,const QString &s)
820820 p=s.data ();
821821 while (!p->isNull ())
822822 {
823- if (*p ==QChar::fromLatin1 (' ' ) &&
824- *(p+1 )==QChar::fromLatin1 (' \0 ' )) break ; // skip inserted space at the end
825- if (*p ==QChar::fromLatin1 (' "' )) t << " \\ " ; // escape quotes
826- t << *p++;
823+ if (*p ==QChar::fromLatin1 (' ' ) &&
824+ *(p+1 )==QChar::fromLatin1 (' \0 ' )) break ; // skip inserted space at the end
825+ if (*p ==QChar::fromLatin1 (' "' )) t << " \\ " ; // escape quotes
826+ if (*p ==QChar::fromLatin1 (' <' )) t << " <" ;
827+ else if (*p ==QChar::fromLatin1 (' >' )) t << " >" ;
828+ else if (*p ==QChar::fromLatin1 (' &' )) t << " &" ;
829+ else t << *p;
830+ p++;
827831 }
828832 }
829833 else
830834 {
831- t << s;
835+ p=s.data ();
836+ while (!p->isNull ())
837+ {
838+ if (*p ==QChar::fromLatin1 (' <' )) t << " <" ;
839+ else if (*p ==QChar::fromLatin1 (' >' )) t << " >" ;
840+ else if (*p ==QChar::fromLatin1 (' &' )) t << " &" ;
841+ else t << *p;
842+ p++;
843+ }
832844 }
833845 if (needsHashEscaping || needsEscaping)
834846 {
0 commit comments