From e4e45bc5bb3a4b38f8f726b26f863c1fdb5575f1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 18 Aug 2009 20:09:47 +0200 Subject: take advantage of knowing that qstrings are zero-terminated internally --- tools/linguist/lupdate/cpp.cpp | 11 +++++------ 1 file 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; -- cgit v0.12