From 0d5b4d4958de99d3f4f52d9fcd920d3d223b4ec9 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Thu, 24 May 2012 19:26:05 +0100 Subject: [PATCH] Fixed: if linted text didn't end with a newline the last character would be ignored. --- Tools/capp_lint/capp_lint | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/capp_lint/capp_lint b/Tools/capp_lint/capp_lint index 9b96ce659..a861dd569 100755 --- a/Tools/capp_lint/capp_lint +++ b/Tools/capp_lint/capp_lint @@ -357,7 +357,10 @@ class LintChecker(object): def next_statement(self, expect_line=False, check_line=True): try: while True: - raw_line = self.sourcefile.next()[:-1] # strip EOL + raw_line = self.sourcefile.next() + # strip EOL + if raw_line[-1] == '\n': # ... unless this is the last line which might not have a \n. + raw_line = raw_line[:-1] try: self.line = unicode(raw_line, 'utf-8', 'strict') # convert to Unicode