From bcdcfa2b1705ccd76503a8ab07955b01c68151e7 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Fri, 23 Feb 2001 06:44:37 +0000 Subject: [PATCH] r=harishd. sr=vidur. Fix for bug 44094. Fixes off by one error in column number in XML error message. git-svn-id: svn://10.0.0.236/trunk@87783 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsExpatTokenizer.cpp | 5 +++-- mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/nsExpatTokenizer.cpp b/mozilla/htmlparser/src/nsExpatTokenizer.cpp index fcbdb3438cd..8690a18e2df 100644 --- a/mozilla/htmlparser/src/nsExpatTokenizer.cpp +++ b/mozilla/htmlparser/src/nsExpatTokenizer.cpp @@ -320,7 +320,7 @@ CreateSourceText(const nsParserError* aError, nsString& aSourceString) aSourceString.Append(aError->sourceLine); aSourceString.AppendWithConversion("\n"); - for (int i = 0; i < errorPosition; i++) + for (PRInt32 i = 0; i < errorPosition - 1; i++) aSourceString.AppendWithConversion("-"); aSourceString.AppendWithConversion("^"); @@ -399,7 +399,8 @@ nsExpatTokenizer::PushXMLErrorTokens(const char *aBuffer, PRUint32 aLength, PRBo /* Fill in the values of the error token */ error->code = XML_GetErrorCode(mExpatParser); error->lineNumber = XML_GetCurrentLineNumber(mExpatParser); - error->colNumber = XML_GetCurrentColumnNumber(mExpatParser); + // Adjust the column number so that it is one based rather than zero based. + error->colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1; error->description.AssignWithConversion(XML_ErrorString(error->code)); if (!aIsFinal) { PRInt32 byteIndexRelativeToFile = 0; diff --git a/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp b/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp index fcbdb3438cd..8690a18e2df 100644 --- a/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp +++ b/mozilla/parser/htmlparser/src/nsExpatTokenizer.cpp @@ -320,7 +320,7 @@ CreateSourceText(const nsParserError* aError, nsString& aSourceString) aSourceString.Append(aError->sourceLine); aSourceString.AppendWithConversion("\n"); - for (int i = 0; i < errorPosition; i++) + for (PRInt32 i = 0; i < errorPosition - 1; i++) aSourceString.AppendWithConversion("-"); aSourceString.AppendWithConversion("^"); @@ -399,7 +399,8 @@ nsExpatTokenizer::PushXMLErrorTokens(const char *aBuffer, PRUint32 aLength, PRBo /* Fill in the values of the error token */ error->code = XML_GetErrorCode(mExpatParser); error->lineNumber = XML_GetCurrentLineNumber(mExpatParser); - error->colNumber = XML_GetCurrentColumnNumber(mExpatParser); + // Adjust the column number so that it is one based rather than zero based. + error->colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1; error->description.AssignWithConversion(XML_ErrorString(error->code)); if (!aIsFinal) { PRInt32 byteIndexRelativeToFile = 0;