diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-08-18 18:09:47 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-09-23 13:44:27 (GMT) |
commit | e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1 (patch) | |
tree | eaad615708f91b068914e887aa2bee22f12a6ce9 | |
parent | d5d169a79fe199ad210d5625b20344bdc2814e60 (diff) | |
download | Qt-e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1.zip Qt-e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1.tar.gz Qt-e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1.tar.bz2 |
take advantage of knowing that qstrings are zero-terminated internally
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 8de403e..3999b84 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -307,13 +307,12 @@ void CppParser::setInput(QTextStream &ts, const QString &fileName) uint CppParser::getChar() { - int len = yyInStr.size(); const ushort *uc = (const ushort *)yyInStr.unicode(); forever { - if (yyInPos >= len) - return EOF; uint c = uc[yyInPos++]; - if (c == '\\' && yyInPos < len) { + if (!c) + return EOF; + if (c == '\\') { if (uc[yyInPos] == '\n') { ++yyCurLineNo; ++yyInPos; @@ -322,13 +321,13 @@ uint CppParser::getChar() if (uc[yyInPos] == '\r') { ++yyCurLineNo; ++yyInPos; - if (yyInPos < len && uc[yyInPos] == '\n') + if (uc[yyInPos] == '\n') ++yyInPos; continue; } } if (c == '\r') { - if (yyInPos < len && uc[yyInPos] == '\n') + if (uc[yyInPos] == '\n') ++yyInPos; c = '\n'; ++yyCurLineNo; |