From e64bbf889e506ff08b5390d44969b76b26310b10 Mon Sep 17 00:00:00 2001 From: "peterl%netscape.com" Date: Thu, 11 Feb 1999 06:42:02 +0000 Subject: [PATCH] fixed bug while tokenizing ints at end of input stream git-svn-id: svn://10.0.0.236/trunk@20384 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/style/src/nsCSSScanner.cpp | 8 ++++++++ mozilla/layout/html/style/src/nsCSSScanner.cpp | 8 ++++++++ mozilla/layout/style/nsCSSScanner.cpp | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/content/html/style/src/nsCSSScanner.cpp +++ b/mozilla/content/html/style/src/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE; diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ b/mozilla/layout/html/style/src/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE; diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index f00044d4c79..43ff6c26036 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -674,6 +674,7 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, } else if ('%' == c) { type = eCSSToken_Percentage; value = value / 100.0f; + ident.SetLength(0); } else { // Put back character that stopped numeric scan Unread(); @@ -684,6 +685,13 @@ PRBool nsCSSScanner::ParseNumber(PRInt32& aErrorCode, PRInt32 c, ident.SetLength(0); } } + else { // stream ended + if (!gotDot) { + aToken.mInteger = ident.ToInteger(&ec); + aToken.mIntegerValid = PR_TRUE; + } + ident.SetLength(0); + } aToken.mNumber = value; aToken.mType = type; return PR_TRUE;