From b04b815dc7358c79904f1785fbbba83eb1bfbdfd Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Sat, 25 Dec 2004 04:44:02 +0000 Subject: [PATCH] bug 275288: remove obsolete CRC calculations. r+sr=roc git-svn-id: svn://10.0.0.236/trunk@167028 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/parser/htmlparser/src/CNavDTD.cpp | 94 +------------------- mozilla/parser/htmlparser/src/CNavDTD.h | 5 -- mozilla/parser/htmlparser/src/nsDTDUtils.cpp | 42 --------- mozilla/parser/htmlparser/src/nsDTDUtils.h | 13 --- 4 files changed, 2 insertions(+), 152 deletions(-) diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 574b3d6234e..e6a105ee917 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -35,7 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -//#define ENABLE_CRC //#define ALLOW_TR_AS_CHILD_OF_TABLE //by setting this to true, TR is allowable directly in TABLE. #define ENABLE_RESIDUALSTYLE @@ -83,13 +82,8 @@ static const char kNullToken[] = "Error: Null token given"; static const char kInvalidTagStackPos[] = "Error: invalid tag stack position"; #endif -#ifdef ENABLE_CRC -static char gShowCRC; -#endif - #include "nsElementTable.h" - #ifdef MOZ_PERF_METRICS # define START_TIMER() \ if(mParser) MOZ_TIMER_START(mParser->mParseTime); \ @@ -179,10 +173,6 @@ CNavDTD::CNavDTD() : nsIDTD(), mLineNumber(1), mOpenMapCount(0), mFlags(NS_DTD_FLAG_NONE) -#ifdef ENABLE_CRC - ,mComputedCRC32(0), - mExpectedCRC32(0) -#endif { mBodyContext=new nsDTDContext(); } @@ -393,11 +383,6 @@ nsresult CNavDTD::WillBuildModel(const CParserContext& aParserContext, mFlags |= NS_IPARSER_FLAG_SCRIPT_ENABLED; } } - -#ifdef ENABLE_CRC - mComputedCRC32=0; - mExpectedCRC32=0; -#endif } return result; @@ -591,43 +576,8 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode, } } - STOP_TIMER(); - MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this)); - -#ifdef ENABLE_CRC - - //let's only grab this state once! - if (!gShowCRC) { - gShowCRC=1; //this only indicates we'll not initialize again. - char* theEnvString = PR_GetEnv("RICKG_CRC"); - if (theEnvString){ - if (('1'== theEnvString[0]) || ('Y'== theEnvString[0]) || ('y'== theEnvString[0])){ - gShowCRC=2; //this indicates that the CRC flag was found in the environment. - } - } - } - - if (2 == gShowCRC) { - if (mComputedCRC32 != mExpectedCRC32) { - if (mExpectedCRC32 != 0) { - printf("CRC Computed: %u Expected CRC: %u\n,",mComputedCRC32,mExpectedCRC32); - result = aSink->DidBuildModel(); - } - else { - printf("Computed CRC: %u.\n",mComputedCRC32); - result = aSink->DidBuildModel(); - NS_ENSURE_SUCCESS(result, result); - } - } - } -#endif - - MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::DidBuildModel(), this=%p\n", this)); - START_TIMER(); - - //Now make sure the misplaced content list is empty, - //by forcefully recycling any tokens we might find there. - + //Now make sure the misplaced content list is empty, + //by forcefully recycling any tokens we might find there. CToken* theToken = 0; while ((theToken = (CToken*)mMisplacedContent.Pop())) { IF_FREE(theToken, mTokenAllocator); @@ -1428,35 +1378,6 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNode START_TIMER() if(NS_SUCCEEDED(result)) { - -#ifdef ENABLE_CRC - - STOP_TIMER() - - if(eHTMLTag_meta==aTag) { - PRInt32 theCount=aNode.GetAttributeCount(); - if(1> 24) ^ *data_blk_ptr++ ) & 0xff; - crc_accum = ( crc_accum << 8 ) ^ crc_table[i]; - } - return crc_accum; -} - /************************************************************** This defines the topic object used by the observer service. The observerService uses a list of these, 1 per topic when diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.h b/mozilla/parser/htmlparser/src/nsDTDUtils.h index d78b5354e8a..db5eedbebaa 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.h +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.h @@ -96,9 +96,6 @@ class nsNodeAllocator; void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle); void DebugDumpContainmentRules2(nsIDTD& theDTD,const char* aFilename,const char* aTitle); #endif -PRUint32 AccumulateCRC(PRUint32 crc_accum, char *data_blk_ptr, int data_blk_size); - - /*************************************************************** First, define the tagstack class @@ -471,16 +468,6 @@ inline PRBool FindTagInSet(PRInt32 aTag,const eHTMLTags *aTagSet,PRInt32 aCount) return PRBool(-1