aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp19
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h1
2 files changed, 10 insertions, 10 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 8703311db..38a2a60bf 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -539,21 +539,22 @@ bool Handler::importFileElement(const QXmlStreamAttributes &atts)
return true;
}
-bool Handler::convertBoolean(const QString &_value, const QString &attributeName, bool defaultValue)
+static bool convertBoolean(const QString &value, const QString &attributeName, bool defaultValue)
{
- QString value = _value.toLower();
- if (value == trueAttributeValue() || value == yesAttributeValue())
+ if (value.compare(trueAttributeValue(), Qt::CaseInsensitive) == 0
+ || value.compare(yesAttributeValue(), Qt::CaseInsensitive) == 0) {
return true;
- else if (value == falseAttributeValue() || value == noAttributeValue())
+ }
+ if (value.compare(falseAttributeValue(), Qt::CaseInsensitive) == 0
+ || value.compare(noAttributeValue(), Qt::CaseInsensitive) == 0) {
return false;
- else {
- QString warn = QStringLiteral("Boolean value '%1' not supported in attribute '%2'. Use 'yes' or 'no'. Defaulting to '%3'.")
+ }
+ const QString warn = QStringLiteral("Boolean value '%1' not supported in attribute '%2'. Use 'yes' or 'no'. Defaulting to '%3'.")
.arg(value, attributeName,
defaultValue ? yesAttributeValue() : noAttributeValue());
- qCWarning(lcShiboken).noquote().nospace() << warn;
- return defaultValue;
- }
+ qCWarning(lcShiboken).noquote().nospace() << warn;
+ return defaultValue;
}
static bool convertRemovalAttribute(const QString& removalAttribute, Modification& mod, QString& errorMsg)
diff --git a/sources/shiboken2/ApiExtractor/typesystem_p.h b/sources/shiboken2/ApiExtractor/typesystem_p.h
index fd67ef49b..d3485726e 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_p.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_p.h
@@ -153,7 +153,6 @@ private:
QHash<QString, QString> *acceptedAttributes);
bool importFileElement(const QXmlStreamAttributes &atts);
- bool convertBoolean(const QString &, const QString &, bool);
void addFlags(const QString &name, QString flagName,
const QHash<QString, QString> &attributes, double since);