make ProFileParser API less bug-prone

QString::isNull() vs. isEmpty() discrimination is a time bomb ...
This commit is contained in:
Oswald Buddenhagen
2010-09-02 18:06:11 +02:00
parent 34a8a57d81
commit 7322900692
5 changed files with 12 additions and 10 deletions

View File

@@ -124,7 +124,7 @@ ProFileParser::ProFileParser(ProFileCache *cache, ProFileParserHandler *handler)
initialize();
}
ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const QString &contents)
ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const QString *contents)
{
ProFile *pro;
if (cache && m_cache) {
@@ -156,7 +156,7 @@ ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const
locker.unlock();
#endif
pro = new ProFile(fileName);
if (!(contents.isNull() ? read(pro) : read(pro, contents))) {
if (!(!contents ? read(pro) : read(pro, *contents))) {
delete pro;
pro = 0;
} else {
@@ -176,7 +176,7 @@ ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const
}
} else {
pro = new ProFile(fileName);
if (!(contents.isNull() ? read(pro) : read(pro, contents))) {
if (!(!contents ? read(pro) : read(pro, *contents))) {
delete pro;
pro = 0;
}