From 631c0dc3b453ab533551ece6ef60fc35792a48b8 Mon Sep 17 00:00:00 2001 From: "heikki%netscape.com" Date: Wed, 7 Mar 2001 02:03:57 +0000 Subject: [PATCH] Bug 66786, fix UMR in GetLine(). Fix by Daniel Bratell (bratell@lysator.liu.se). r=heikki, sr=vidur. --- htmlparser/src/nsExpatTokenizer.cpp | 8 ++++---- parser/htmlparser/src/nsExpatTokenizer.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htmlparser/src/nsExpatTokenizer.cpp b/htmlparser/src/nsExpatTokenizer.cpp index 8690a18e2df..fb216aed919 100644 --- a/htmlparser/src/nsExpatTokenizer.cpp +++ b/htmlparser/src/nsExpatTokenizer.cpp @@ -254,18 +254,18 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength, /* Use start to find the first new line before the error position and end to find the first new line after the error position */ - reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0); - reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer); + reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start); + reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end); while (!reachedStart || !reachedEnd) { if (!reachedStart) { start--; startIndex--; - reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0); + reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start); } if (!reachedEnd) { end++; endIndex++; - reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer); + reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end); } } diff --git a/parser/htmlparser/src/nsExpatTokenizer.cpp b/parser/htmlparser/src/nsExpatTokenizer.cpp index 8690a18e2df..fb216aed919 100644 --- a/parser/htmlparser/src/nsExpatTokenizer.cpp +++ b/parser/htmlparser/src/nsExpatTokenizer.cpp @@ -254,18 +254,18 @@ void nsExpatTokenizer::GetLine(const char* aSourceBuffer, PRUint32 aLength, /* Use start to find the first new line before the error position and end to find the first new line after the error position */ - reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0); - reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer); + reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start); + reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end); while (!reachedStart || !reachedEnd) { if (!reachedStart) { start--; startIndex--; - reachedStart = ('\n' == *start || '\r' == *start || startIndex <= 0); + reachedStart = (startIndex <= 0 || '\n' == *start || '\r' == *start); } if (!reachedEnd) { end++; endIndex++; - reachedEnd = ('\n' == *end || '\r' == *end || endIndex >= numCharsInBuffer); + reachedEnd = (endIndex >= numCharsInBuffer || '\n' == *end || '\r' == *end); } }