From c03dd8a0105a6d020983981d17b1429dd4835103 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 29 Dec 2020 11:00:03 +0100 Subject: issue #8282 Error on ALIAS declaration without quotes - also escape a "," (comma) when writing out string values (doxygen and doxywizard) - check on empty lists in stringlist for the wizard --- addon/doxywizard/config_doxyw.l | 1 + addon/doxywizard/inputstrlist.cpp | 69 ++++++++++++++++++++++----------------- src/configimpl.l | 2 +- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l index 6b487ee..b93a79d 100644 --- a/addon/doxywizard/config_doxyw.l +++ b/addon/doxywizard/config_doxyw.l @@ -729,6 +729,7 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) while (!(c=*p++).isNull() && !needsEscaping) { needsEscaping = (c==QChar::fromLatin1(' ') || + c==QChar::fromLatin1(',') || c==QChar::fromLatin1('\n') || c==QChar::fromLatin1('\t') || c==QChar::fromLatin1('"')); diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp index fae45b5..cdc7d14 100644 --- a/addon/doxywizard/inputstrlist.cpp +++ b/addon/doxywizard/inputstrlist.cpp @@ -258,48 +258,57 @@ void InputStrList::writeValue(QTextStream &t,QTextCodec *codec) } } -#include bool InputStrList::isDefault() { - bool isEq = m_strList==m_default; + if (m_strList==m_default) return true; - if (!isEq) + auto it1 = m_strList.begin(); + auto it2 = m_default.begin(); + while (it1!=m_strList.end() && (*it1).isEmpty()) { - isEq = true; + ++it1; + } + while (it2!=m_default.end() && (*it2).isEmpty()) + { + ++it2; + } + // both lists are empty + if (it1==m_strList.end() && it2==m_default.end()) return true; - auto it1 = m_strList.begin(); - auto it2 = m_default.begin(); - while (it1!=m_strList.end() && it2!=m_default.end()) + // one list is empty but the other is not + if (it1==m_default.end()) return false; + if (it2==m_strList.end()) return false; + + it1 = m_strList.begin(); + it2 = m_default.begin(); + while (it1!=m_strList.end() && it2!=m_default.end()) + { + // skip over empty values + while (it1!=m_strList.end() && (*it1).isEmpty()) { - // skip over empty values - while (it1!=m_strList.end() && (*it1).isEmpty()) - { ++it1; - } - while (it2!=m_default.end() && (*it2).isEmpty()) - { - ++it2; - } - if ((it1!=m_strList.end()) && (it2!=m_default.end())) - { - if ((*it1).trimmed()!= (*it2).trimmed()) // difference so not the default - { - isEq=false; - break; - } - ++it1; - ++it2; - } - else if ((it1!=m_strList.end()) || (it2!=m_default.end())) + } + while (it2!=m_default.end() && (*it2).isEmpty()) + { + ++it2; + } + if ((it1!=m_strList.end()) && (it2!=m_default.end())) + { + if ((*it1).trimmed()!= (*it2).trimmed()) // difference so not the default { - // one list empty so cannot be the default - isEq=false; - break; + return false; } + ++it1; + ++it2; + } + else if ((it1!=m_strList.end()) || (it2!=m_default.end())) + { + // one list empty so cannot be the default + return false; } } - return isEq; + return true; } bool InputStrList::isEmpty() diff --git a/src/configimpl.l b/src/configimpl.l index e2ef8eb..17e56b3 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -153,7 +153,7 @@ void ConfigOption::writeStringValue(FTextStream &t,const QCString &s) { t << " "; while ((c=*p++)!=0 && !needsEscaping) - needsEscaping = (c==' ' || c=='\n' || c=='\t' || c=='"' || c=='#'); + needsEscaping = (c==' ' || c== ',' || c=='\n' || c=='\t' || c=='"' || c=='#'); if (needsEscaping) { t << "\""; -- cgit v0.12