summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lupdate
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-08-18 18:19:25 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-09-23 13:44:27 (GMT)
commit830fd43c53a9cd53d626b8f6fe3682d92df0cc59 (patch)
treef18ebb85176f677ed7eccd8881d5ab2398974086 /tools/linguist/lupdate
parente4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1 (diff)
downloadQt-830fd43c53a9cd53d626b8f6fe3682d92df0cc59.zip
Qt-830fd43c53a9cd53d626b8f6fe3682d92df0cc59.tar.gz
Qt-830fd43c53a9cd53d626b8f6fe3682d92df0cc59.tar.bz2
use a source char pointer instead of a string + index
Diffstat (limited to 'tools/linguist/lupdate')
-rw-r--r--tools/linguist/lupdate/cpp.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 3999b84..8e9933d 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -226,7 +226,7 @@ private:
QTextCodec *yySourceCodec;
bool yySourceIsUnicode;
QString yyInStr;
- int yyInPos;
+ const ushort *yyInPtr;
// Parser state
uint yyTok;
@@ -254,7 +254,6 @@ CppParser::CppParser(ParseResults *_results)
results = new ParseResults;
directInclude = false;
}
- yyInPos = 0;
yyBraceDepth = 0;
yyParenDepth = 0;
yyCurLineNo = 1;
@@ -307,28 +306,32 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName)
uint CppParser::getChar()
{
- const ushort *uc = (const ushort *)yyInStr.unicode();
+ const ushort *uc = yyInPtr;
forever {
- uint c = uc[yyInPos++];
- if (!c)
+ ushort c = *uc;
+ if (!c) {
+ yyInPtr = uc;
return EOF;
+ }
+ ++uc;
if (c == '\\') {
- if (uc[yyInPos] == '\n') {
+ ushort cc = *uc;
+ if (cc == '\n') {
++yyCurLineNo;
- ++yyInPos;
+ ++uc;
continue;
}
- if (uc[yyInPos] == '\r') {
+ if (cc == '\r') {
++yyCurLineNo;
- ++yyInPos;
- if (uc[yyInPos] == '\n')
- ++yyInPos;
+ ++uc;
+ if (*uc == '\n')
+ ++uc;
continue;
}
}
if (c == '\r') {
- if (uc[yyInPos] == '\n')
- ++yyInPos;
+ if (*uc == '\n')
+ ++uc;
c = '\n';
++yyCurLineNo;
yyAtNewline = true;
@@ -338,6 +341,7 @@ uint CppParser::getChar()
} else if (c != ' ' && c != '\t' && c != '#') {
yyAtNewline = false;
}
+ yyInPtr = uc;
return c;
}
}
@@ -1355,6 +1359,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
bool yyTokColonSeen = false; // Start of c'tor's initializer list
yyWord.reserve(yyInStr.size()); // Rather insane. That's because we do no length checking.
+ yyInPtr = (const ushort *)yyInStr.unicode();
yyCh = getChar();
yyTok = getToken();
while (yyTok != Tok_Eof) {