Commit 6d24ce6a authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Use midRef(), leftRef(), rightRef() where possible.

parent 39eb5d3d
...@@ -199,7 +199,7 @@ QStringList splitArgs(const QString& str) ...@@ -199,7 +199,7 @@ QStringList splitArgs(const QString& str)
return QStringList(); return QStringList();
c = str.at(pos++); c = str.at(pos++);
} while (c != QLatin1Char('\'')); } while (c != QLatin1Char('\''));
param += str.mid(spos, pos - spos - 1); param += str.midRef(spos, pos - spos - 1);
} else if (c == QLatin1Char('"')) { } else if (c == QLatin1Char('"')) {
for (;;) { for (;;) {
if (pos >= str.size()) if (pos >= str.size())
......
...@@ -195,7 +195,7 @@ void FormatConfig::formatString(QString& str) const ...@@ -195,7 +195,7 @@ void FormatConfig::formatString(QString& str) const
++j; ++j;
} }
if (j > i) { if (j > i) {
newstr.append(str.mid(i, j - i)); newstr.append(str.midRef(i, j - i));
i = j - 1; i = j - 1;
continue; continue;
} }
......
...@@ -86,7 +86,7 @@ QString FrameTableModel::getDisplayName(const QString& str) ...@@ -86,7 +86,7 @@ QString FrameTableModel::getDisplayName(const QString& str)
// probably "TXXX - User defined text information\nDescription" or // probably "TXXX - User defined text information\nDescription" or
// "WXXX - User defined URL link\nDescription" // "WXXX - User defined URL link\nDescription"
return str.mid(nlPos + 1); return str.mid(nlPos + 1);
} else if (str.mid(4, 3) == QLatin1String(" - ")) { } else if (str.midRef(4, 3) == QLatin1String(" - ")) {
// probably "ID3-ID - Description" // probably "ID3-ID - Description"
return str.left(4); return str.left(4);
} else { } else {
......
...@@ -628,11 +628,11 @@ FrameCollection::const_iterator FrameCollection::searchByName( ...@@ -628,11 +628,11 @@ FrameCollection::const_iterator FrameCollection::searchByName(
int len = ucName.length(); int len = ucName.length();
for (it = begin(); it != end(); ++it) { for (it = begin(); it != end(); ++it) {
QString ucFrameName(it->getName().toUpper().remove(QLatin1Char('/'))); QString ucFrameName(it->getName().toUpper().remove(QLatin1Char('/')));
if (ucName == ucFrameName.left(len)) { if (ucName == ucFrameName.leftRef(len)) {
break; break;
} }
int nlPos = ucFrameName.indexOf(QLatin1Char('\n')); int nlPos = ucFrameName.indexOf(QLatin1Char('\n'));
if (nlPos > 0 && ucName == ucFrameName.mid(nlPos + 1, len)) { if (nlPos > 0 && ucName == ucFrameName.midRef(nlPos + 1, len)) {
// Description in TXXX, WXXX, COMM, PRIV matches // Description in TXXX, WXXX, COMM, PRIV matches
break; break;
} }
......
...@@ -33,7 +33,7 @@ bool Utils::hasIllegalFileNameCharacters(const QString& fileName) ...@@ -33,7 +33,7 @@ bool Utils::hasIllegalFileNameCharacters(const QString& fileName)
{ {
static const char illegalChars[] = "<>:\"|?*"; static const char illegalChars[] = "<>:\"|?*";
QString fileNameWithoutDrive( QString fileNameWithoutDrive(
(QDir::isAbsolutePath(fileName) && fileName.mid(1, 2) == QLatin1String(":/")) (QDir::isAbsolutePath(fileName) && fileName.midRef(1, 2) == QLatin1String(":/"))
? fileName.mid(3) : fileName); ? fileName.mid(3) : fileName);
for (const char* chPtr = illegalChars; *chPtr; ++chPtr) { for (const char* chPtr = illegalChars; *chPtr; ++chPtr) {
if (fileNameWithoutDrive.contains(QLatin1Char(*chPtr))) { if (fileNameWithoutDrive.contains(QLatin1Char(*chPtr))) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment