summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-10-28 16:46:14 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-10-28 16:47:54 (GMT)
commitd9b009bfed86ac273da4fc589daa34d852437254 (patch)
tree125d7935774c339dfce19f2df6a7f54ae05cb1c5
parentda1519020a53dbdc717fb3bffeaad07c5142a6e3 (diff)
downloadQt-d9b009bfed86ac273da4fc589daa34d852437254.zip
Qt-d9b009bfed86ac273da4fc589daa34d852437254.tar.gz
Qt-d9b009bfed86ac273da4fc589daa34d852437254.tar.bz2
make magic comment parsing stricter
there must be a space after the //: and similar comments, otherwise harmless comments of the sort of //====== foo here ===== will be parsed as message ids, etc.
-rw-r--r--tools/linguist/lupdate/cpp.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 7a616e3..6374912 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -1899,25 +1899,25 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
case Tok_Comment:
if (!tor)
goto case_default;
- if (yyWord.startsWith(QLatin1Char(':'))) {
- yyWord.remove(0, 1);
+ if (yyWord.at(0) == QLatin1Char(':') && yyWord.at(1).isSpace()) {
+ yyWord.remove(0, 2);
extracomment += yyWord;
extracomment.detach();
- } else if (yyWord.startsWith(QLatin1Char('='))) {
- yyWord.remove(0, 1);
+ } else if (yyWord.at(0) == QLatin1Char('=') && yyWord.at(1).isSpace()) {
+ yyWord.remove(0, 2);
msgid = yyWord.simplified();
msgid.detach();
- } else if (yyWord.startsWith(QLatin1Char('~'))) {
- yyWord.remove(0, 1);
+ } else if (yyWord.at(0) == QLatin1Char('~') && yyWord.at(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.startsWith(QLatin1Char('%'))) {
- sourcetext.reserve(sourcetext.length() + yyWord.length());
+ } else if (yyWord.at(0) == QLatin1Char('%') && yyWord.at(1).isSpace()) {
+ sourcetext.reserve(sourcetext.length() + yyWord.length() - 2);
ushort *ptr = (ushort *)sourcetext.data() + sourcetext.length();
- int p = 1, c;
+ int p = 2, c;
forever {
if (p >= yyWord.length())
break;