beautify string operations

Change-Id: I895a1ae26ee0c884c404bf585261d1a7e8a8242c
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-08-20 14:33:08 +02:00 committed by Qt by Nokia
parent 996bbcd78b
commit 3db9344f04
2 changed files with 4 additions and 5 deletions

View File

@ -792,8 +792,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
for(int x = 0; x < tmp.count();) { for(int x = 0; x < tmp.count();) {
bool remove = false; bool remove = false;
QString library, name, opt = tmp[x].trimmed(); QString library, name, opt = tmp[x].trimmed();
if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && if (opt.length() >= 2 && (opt.at(0) == '"' || opt.at(0) == '\'') && opt.endsWith(opt.at(0)))
opt[(int) opt.length()-1] == opt[0])
opt = opt.mid(1, opt.length()-2); opt = opt.mid(1, opt.length()-2);
if(opt.startsWith("-L")) { if(opt.startsWith("-L")) {
QString r = opt.right(opt.length() - 2); QString r = opt.right(opt.length() - 2);
@ -867,7 +866,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
break; break;
} }
} }
} else if(opt.left(1) != "-") { } else if (!opt.startsWith('-')) {
if(exists(opt)) { if(exists(opt)) {
remove = true; remove = true;
library = opt; library = opt;
@ -981,7 +980,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << "files = (" << "\n"; << "\t\t\t" << "files = (" << "\n";
if(!project->isEmpty("ICON")) { if(!project->isEmpty("ICON")) {
QString icon = project->first("ICON"); QString icon = project->first("ICON");
if(icon.length() >= 2 && (icon[0] == '"' || icon[0] == '\'') && icon[(int)icon.length()-1] == icon[0]) if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0)))
icon = icon.mid(1, icon.length()-2); icon = icon.mid(1, icon.length()-2);
t << "\t\t\t\t" << keyFor(icon + ".BUILDABLE") << ",\n"; t << "\t\t\t\t" << keyFor(icon + ".BUILDABLE") << ",\n";
} }

View File

@ -176,7 +176,7 @@ QMakeMetaInfo::readLibtoolFile(const QString &f)
} else if(it.key() == "dependency_libs") { } else if(it.key() == "dependency_libs") {
if(lst.count() == 1) { if(lst.count() == 1) {
QString dep = lst.first(); QString dep = lst.first();
if((dep.startsWith("'") || dep.startsWith("\"")) && dep.endsWith(QString(dep[0]))) if ((dep.startsWith('\'') || dep.startsWith('"')) && dep.endsWith(dep.at(0)))
dep = dep.mid(1, dep.length() - 2); dep = dep.mid(1, dep.length() - 2);
lst = dep.trimmed().split(" "); lst = dep.trimmed().split(" ");
} }