Remove use of deprecated QRegExp from QLibraryInfo
This patch replaces QRegExp by QString search and replace. Change-Id: I11165afa45f8f9a856e6fb9b64929e4bdacb913d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
parent
e0f0850cd4
commit
9170cf9f1d
@ -530,14 +530,24 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// expand environment variables in the form $(ENVVAR)
|
int startIndex = 0;
|
||||||
int rep;
|
forever {
|
||||||
QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
|
startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
|
||||||
reg_var.setMinimal(true);
|
if (startIndex < 0)
|
||||||
while((rep = reg_var.indexIn(ret)) != -1) {
|
break;
|
||||||
ret.replace(rep, reg_var.matchedLength(),
|
if (ret.length() < startIndex + 3)
|
||||||
QString::fromLocal8Bit(qgetenv(ret.midRef(rep + 2,
|
break;
|
||||||
reg_var.matchedLength() - 3).toLatin1().constData()).constData()));
|
if (ret.at(startIndex + 1) != QLatin1Char('(')) {
|
||||||
|
startIndex++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int endIndex = ret.indexOf(QLatin1Char(')'), startIndex + 2);
|
||||||
|
if (endIndex < 0)
|
||||||
|
break;
|
||||||
|
QStringRef envVarName = ret.midRef(startIndex + 2, endIndex - startIndex - 2);
|
||||||
|
QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
|
||||||
|
ret.replace(startIndex, endIndex - startIndex + 1, value);
|
||||||
|
startIndex += value.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
config->endGroup();
|
config->endGroup();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user