diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-18 19:14:21 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-09-23 15:44:26 +0200 |
commit | 5bd5154ae0095a3e166e8be9347c613b2194e0be (patch) | |
tree | bd84f2e21f8bc7726c1de90c399716e213c6af02 /tools/linguist | |
parent | 5fc344431354c00340d9727f64dbb3c29972f93d (diff) | |
download | qt4-tools-5bd5154ae0095a3e166e8be9347c613b2194e0be.tar.gz |
cut down use of qstring::simplified()
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 9b7fdc86f9..e72f1c9256 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE /* qmake ignore Q_OBJECT */ -static const char MagicComment[] = "TRANSLATOR "; +static QString MagicComment(QLatin1String("TRANSLATOR")); #define STRING(s) static QString str##s(QLatin1String(#s)) @@ -1811,9 +1811,15 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } sourcetext.resize(ptr - (ushort *)sourcetext.data()); } else { - comment = yyWord.simplified(); - if (comment.startsWith(QLatin1String(MagicComment))) { - comment.remove(0, sizeof(MagicComment) - 1); + const ushort *uc = (const ushort *)yyWord.unicode(); // Is zero-terminated + int idx = 0; + ushort c; + while ((c = uc[idx]) == ' ' || c == '\t' || c == '\n') + ++idx; + if (!memcmp(uc + idx, MagicComment.unicode(), MagicComment.length() * 2)) { + idx += MagicComment.length(); + comment = QString::fromRawData(yyWord.unicode() + idx, + yyWord.length() - idx).simplified(); int k = comment.indexOf(QLatin1Char(' ')); if (k == -1) { context = comment; @@ -1826,8 +1832,6 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) results->tor->setExtras(extra); extra.clear(); } - } else { - comment.detach(); } } yyTok = getToken(); |