diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-10-29 15:48:38 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-10-29 15:49:08 (GMT) |
commit | 89ccbd14fe8c0e6b0fefcca2151da28d98088bf5 (patch) | |
tree | 400ad864fd7c8cdbe8b34d60d439e73f9f7f5477 /tools/linguist | |
parent | 94be7bf47fe93ca4fa6ae90f5906f6ef711f558e (diff) | |
download | Qt-89ccbd14fe8c0e6b0fefcca2151da28d98088bf5.zip Qt-89ccbd14fe8c0e6b0fefcca2151da28d98088bf5.tar.gz Qt-89ccbd14fe8c0e6b0fefcca2151da28d98088bf5.tar.bz2 |
do not crash
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 6374912..4d89156 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -1896,25 +1896,26 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) prospectiveContext.clear(); } break; - case Tok_Comment: + case Tok_Comment: { if (!tor) goto case_default; - if (yyWord.at(0) == QLatin1Char(':') && yyWord.at(1).isSpace()) { + const QChar *ptr = yyWord.unicode(); + if (*ptr == QLatin1Char(':') && ptr[1].isSpace()) { yyWord.remove(0, 2); extracomment += yyWord; extracomment.detach(); - } else if (yyWord.at(0) == QLatin1Char('=') && yyWord.at(1).isSpace()) { + } else if (*ptr == QLatin1Char('=') && ptr[1].isSpace()) { yyWord.remove(0, 2); msgid = yyWord.simplified(); msgid.detach(); - } else if (yyWord.at(0) == QLatin1Char('~') && yyWord.at(1).isSpace()) { + } else if (*ptr == QLatin1Char('~') && ptr[1].isSpace()) { yyWord.remove(0, 2); text = yyWord.trimmed(); int k = text.indexOf(QLatin1Char(' ')); if (k > -1) extra.insert(text.left(k), text.mid(k + 1).trimmed()); text.clear(); - } else if (yyWord.at(0) == QLatin1Char('%') && yyWord.at(1).isSpace()) { + } else if (*ptr == QLatin1Char('%') && ptr[1].isSpace()) { sourcetext.reserve(sourcetext.length() + yyWord.length() - 2); ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length(); int p = 2, c; @@ -1977,6 +1978,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions) } yyTok = getToken(); break; + } case Tok_Arrow: yyTok = getToken(); if (yyTok == Tok_tr || yyTok == Tok_trUtf8) |