From c1623a0d42c9869e5a1d04081e7660722a863de5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 23 Apr 2012 16:29:18 +0200 Subject: Don't use the QRegExp methods that modify the object QRegExp matching methods modify the object, which we don't want to. In particular, when we receive a QRegExp from the user or we store in a context that might require thread-safety, make sure we make a copy before using it. QRegularExpression has no such shortcoming. Task-number: QTBUG-25064 Change-Id: I2c4d5f4b60d6b3569568103cd7107cd2adaa3ae8 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Lars Knoll --- src/xmlpatterns/schema/qxsdschemaparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/xmlpatterns/schema/qxsdschemaparser.cpp') diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index a00b77e..292886e 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -511,7 +511,7 @@ void XsdSchemaParser::parseSchema(ParserType parserType) if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) { const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML); - const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); + QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); if (!exp.exactMatch(value)) { attributeContentError("xml:lang", "schema", value); return; @@ -1286,7 +1286,7 @@ XsdDocumentation::Ptr XsdSchemaParser::parseDocumentation() if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) { const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML); - const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); + QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*")); if (!exp.exactMatch(value)) { attributeContentError("xml:lang", "documentation", value); return documentation; -- cgit v1.2.1