From 911d2fa2e8c03cb60b5316c0e70ac8cbc16948c2 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 3 Sep 2002 22:23:22 +0000 Subject: [PATCH] use prefix ++, not postfix ++. Bug 82615, r=heikki, sr=jst --- htmlparser/public/nsToken.h | 2 +- htmlparser/robot/nsDebugRobot.cpp | 4 +- htmlparser/robot/nsRobotSink.cpp | 6 +- htmlparser/robot/test/RobotMain.cpp | 28 - htmlparser/src/CNavDTD.cpp | 28 +- htmlparser/src/COtherDTD.cpp | 8 +- htmlparser/src/COtherElements.h | 10 +- htmlparser/src/SelfTest.cpp | 232 -------- htmlparser/src/nsDTDUtils.cpp | 62 +-- htmlparser/src/nsDTDUtils.h | 4 +- htmlparser/src/nsElementTable.cpp | 16 +- htmlparser/src/nsExpatDriver.cpp | 4 +- htmlparser/src/nsHTMLEntities.cpp | 2 +- htmlparser/src/nsHTMLNullSink.cpp | 2 +- htmlparser/src/nsHTMLTags.cpp | 2 +- htmlparser/src/nsHTMLTokenizer.cpp | 6 +- htmlparser/src/nsHTMLTokens.cpp | 6 +- htmlparser/src/nsLoggingSink.cpp | 4 +- htmlparser/src/nsParser.cpp | 18 +- htmlparser/src/nsParserNode.cpp | 4 +- htmlparser/src/nsParserService.cpp | 4 +- htmlparser/src/nsScanner.cpp | 10 +- htmlparser/src/nsToken.cpp | 6 +- htmlparser/src/nsViewSourceHTML.cpp | 12 +- htmlparser/tests/grabpage/grabpage.cpp | 2 +- htmlparser/tests/htmlgen/htmlgen.cpp | 517 ------------------ parser/htmlparser/public/nsToken.h | 2 +- parser/htmlparser/robot/nsDebugRobot.cpp | 4 +- parser/htmlparser/robot/nsRobotSink.cpp | 6 +- parser/htmlparser/robot/test/RobotMain.cpp | 2 +- parser/htmlparser/src/CNavDTD.cpp | 28 +- parser/htmlparser/src/COtherDTD.cpp | 8 +- parser/htmlparser/src/COtherElements.h | 10 +- parser/htmlparser/src/SelfTest.cpp | 232 -------- parser/htmlparser/src/nsDTDUtils.cpp | 62 +-- parser/htmlparser/src/nsDTDUtils.h | 4 +- parser/htmlparser/src/nsElementTable.cpp | 16 +- parser/htmlparser/src/nsExpatDriver.cpp | 4 +- parser/htmlparser/src/nsHTMLEntities.cpp | 2 +- parser/htmlparser/src/nsHTMLNullSink.cpp | 2 +- parser/htmlparser/src/nsHTMLTags.cpp | 2 +- parser/htmlparser/src/nsHTMLTokenizer.cpp | 6 +- parser/htmlparser/src/nsHTMLTokens.cpp | 6 +- parser/htmlparser/src/nsLoggingSink.cpp | 4 +- parser/htmlparser/src/nsParser.cpp | 18 +- parser/htmlparser/src/nsParserNode.cpp | 4 +- parser/htmlparser/src/nsParserService.cpp | 4 +- parser/htmlparser/src/nsScanner.cpp | 10 +- parser/htmlparser/src/nsToken.cpp | 6 +- parser/htmlparser/src/nsViewSourceHTML.cpp | 12 +- parser/htmlparser/tests/grabpage/grabpage.cpp | 2 +- parser/htmlparser/tests/htmlgen/htmlgen.cpp | 2 +- 52 files changed, 224 insertions(+), 1233 deletions(-) diff --git a/htmlparser/public/nsToken.h b/htmlparser/public/nsToken.h index 32d16413653..985e13519bb 100644 --- a/htmlparser/public/nsToken.h +++ b/htmlparser/public/nsToken.h @@ -153,7 +153,7 @@ class CToken { * Make a note on number of times you have been referenced * @update harishd 08/02/00 */ - void AddRef() { mUseCount++; } + void AddRef() { ++mUseCount; } /** * Free yourself if no one is holding you. diff --git a/htmlparser/robot/nsDebugRobot.cpp b/htmlparser/robot/nsDebugRobot.cpp index d5f744969f5..8fe8096b64d 100644 --- a/htmlparser/robot/nsDebugRobot.cpp +++ b/htmlparser/robot/nsDebugRobot.cpp @@ -112,7 +112,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec) PRInt32 nCount = g_duplicateList->Count(); if (nCount > 0) { - for (PRInt32 n = 0; n < nCount; n++) + for (PRInt32 n = 0; n < nCount; ++n) { nsString * pstr = (nsString *)g_duplicateList->ElementAt(n); if (pstr->Equals(aURLSpec)) { @@ -127,7 +127,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec) str.Truncate(); nsString(aURLSpec).Left(str,5); if (str.Equals(NS_LITERAL_STRING("http:"))) { - g_iProcessed++; + ++g_iProcessed; if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0)) g_bHitTop = PR_TRUE; g_workList->AppendElement(new nsString(aURLSpec)); diff --git a/htmlparser/robot/nsRobotSink.cpp b/htmlparser/robot/nsRobotSink.cpp index 64e43d35c65..24bee627584 100644 --- a/htmlparser/robot/nsRobotSink.cpp +++ b/htmlparser/robot/nsRobotSink.cpp @@ -144,7 +144,7 @@ RobotSink::~RobotSink() { NS_IF_RELEASE(mDocumentURL); PRInt32 i, n = mObservers.Count(); - for (i = 0; i < n; i++) { + for (i = 0; i < n; ++i) { nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i); NS_RELEASE(cop); } @@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) if (tmp.Equals(NS_LITERAL_STRING("a"))) { nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); - for (PRInt32 i = 0; i < ac; i++) { + for (PRInt32 i = 0; i < ac; ++i) { // Get upper-cased key const nsAString& key = aNode.GetKeyAt(i); k.Assign(key); @@ -388,7 +388,7 @@ void RobotSink::ProcessLink(const nsString& aLink) // Now give link to robot observers PRInt32 i, n = mObservers.Count(); - for (i = 0; i < n; i++) { + for (i = 0; i < n; ++i) { nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i); cop->ProcessLink(absURLSpec); } diff --git a/htmlparser/robot/test/RobotMain.cpp b/htmlparser/robot/test/RobotMain.cpp index b3b01bef2bf..e69de29bb2d 100644 --- a/htmlparser/robot/test/RobotMain.cpp +++ b/htmlparser/robot/test/RobotMain.cpp @@ -1,28 +0,0 @@ -#include "nsXPCOM.h" -#include "nsVoidArray.h" -#include "nsString.h" -class nsIWebShell; - -extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww); - -int main(int argc, char **argv) -{ - nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); - if (NS_FAILED(rv)) { - printf("NS_InitXPCOM2 failed\n"); - return 1; - } - - nsVoidArray * gWorkList = new nsVoidArray(); - if(gWorkList) { - int i; - for (i = 1; i < argc; i++) { - nsString *tempString = new nsString; - tempString->AssignWithConversion(argv[i]); - gWorkList->AppendElement(tempString); - } - } - - return DebugRobot(gWorkList, nsnull); -} - diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index 69f754b7a6d..62eabf762ad 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -704,7 +704,7 @@ PRBool DoesRequireBody(CToken* aToken,nsITokenizer* aTokenizer) { if(theTag==eHTMLTag_input) { // IE & Nav4x opens up a body for type=text - Bug 66985 PRInt32 ac=aToken->GetAttributeCount(); - for(PRInt32 i=0; iGetTokenAt(i)); const nsAString& name=attr->GetKey(); const nsAString& value=attr->GetValue(); @@ -1032,7 +1032,7 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; - for(theIndex=0;theIndexGetTokenType()); switch(theType) { - case eToken_newline: aNewlineCount++; + case eToken_newline: ++aNewlineCount; case eToken_whitespace: theToken=aTokenizer->PopToken(); IF_FREE(theToken, aTokenAllocator); @@ -2071,7 +2071,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { // considered as a leaf. However, in the sink FORM can either // be a container or a leaf. Therefore, we have to check // with the sink -- Ref: Bug 20087. - anIndex++; + ++anIndex; } STOP_TIMER() @@ -2085,7 +2085,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { PRInt32 i=0; nsEntryStack* theChildStyleStack=0; - for(i=0; i<(theTagCount - theTopIndex); i++) { + for(i=0; i<(theTagCount - theTopIndex); ++i) { nsCParserNode* node=mBodyContext->Pop(theChildStyleStack); mTempContext->Push(node); IF_FREE(node, &mNodeAllocator); //release the popped node since push will addref for us. @@ -2098,7 +2098,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { theTag = (eHTMLTags)theToken->GetTypeID(); attrCount = (gHTMLElements[theTag].mSkipTarget)? 0:theToken->GetAttributeCount(); // Put back attributes, which once got popped out, into the tokenizer - for(PRInt32 j=0;jPushTokenFront(theAttrToken); @@ -2128,7 +2128,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { // Bad-contents were successfully processed. Now, itz time to get // back to the original body context state. - for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++) { + for(PRInt32 k=0; k<(theTagCount - theTopIndex); ++k) { nsCParserNode* node=mTempContext->Pop(theChildStyleStack); mBodyContext->Push(node); IF_FREE(node, &mNodeAllocator); @@ -2380,7 +2380,7 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32 if(aCount<=theAvailTokenCount) { CToken* theToken=0; eHTMLTags theSkipTarget=gHTMLElements[aTag].mSkipTarget; - for(attr=0;attrGetStylesAt(theLevel); if(theStack){ PRInt32 sindex=0; nsTagEntry *theEntry=theStack->mEntries; - for(sindex=0;sindexmCount;sindex++){ + for(sindex=0;sindexmCount;++sindex){ nsCParserNode* theNode=(nsCParserNode*)theEntry->mNode; if(1==theNode->mUseCount) { eHTMLTags theNodeTag=(eHTMLTags)theNode->GetNodeType(); @@ -2965,10 +2965,10 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){ //if the node tag can't contain the child tag, then remove the child tag from the style stack nsCParserNode* node=theStack->Remove(sindex,theNodeTag); IF_FREE(node, &mNodeAllocator); - theEntry--; //back up by one + --theEntry; //back up by one } } //if - theEntry++; + ++theEntry; } //for } //if } //for @@ -3269,7 +3269,7 @@ nsresult CNavDTD::OpenMap(const nsCParserNode *aNode){ if(NS_OK==result) { mBodyContext->Push(aNode); - mOpenMapCount++; + ++mOpenMapCount; } return result; } diff --git a/htmlparser/src/COtherDTD.cpp b/htmlparser/src/COtherDTD.cpp index 18e318c2528..068b4cc1579 100644 --- a/htmlparser/src/COtherDTD.cpp +++ b/htmlparser/src/COtherDTD.cpp @@ -581,7 +581,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theNextToken) { eHTMLTokenTypes theType=eHTMLTokenTypes(theNextToken->GetTokenType()); if(eToken_newline==theType){ - mLineNumber++; + ++mLineNumber; mTokenizer->PopToken(); //skip 1st newline inside PRE and LISTING }//if }//if @@ -599,7 +599,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; - for(theIndex=0;theIndexmElements[aTag]->GetSkipTarget(); CToken* theToken=0; - for(attr=0;attrPopToken(); if(theToken) { // Sanitize the key for it might contain some non-alpha-non-digit characters diff --git a/htmlparser/src/COtherElements.h b/htmlparser/src/COtherElements.h index c61ae599149..190d6397e6a 100644 --- a/htmlparser/src/COtherElements.h +++ b/htmlparser/src/COtherElements.h @@ -104,7 +104,7 @@ inline PRBool ListContainsTag(eHTMLTags* aTagList,eHTMLTags aTag) { if(aTag==*theNextTag) { return PR_TRUE; } - theNextTag++; + ++theNextTag; } } return PR_FALSE; @@ -2109,7 +2109,7 @@ void CElementTable::InitializeElements() { int max=sizeof(mElements)/sizeof(mElements[0]); int index=0; - for(index=0;indexCanContain(theChild,0)){ const PRUnichar *t = nsHTMLTags::GetStringValue(theChild->mTag); printf("%s ", NS_ConvertUCS2toUTF8(t).get()); - count++; + ++count; if(18==count) { count=0; printf("\n%s",prefix); @@ -2528,7 +2528,7 @@ void CElementTable::DebugDumpContainment(const char* aTitle){ printf("==================================================\n"); int i=0; - for(i=1;i -#include - -#include "nsXPCOM.h" -#include "nsISupports.h" -#include "nsTokenizer.h" -#include "nsHTMLDelegate.h" -#include "nsIParser.h" -#include "nsHTMLContentSink.h" -#include "nsIComponentManager.h" -#include "nsParserCIID.h" - - -PRBool compareFiles(const char* file1,const char* file2,int& failpos) { - PRBool result=PR_TRUE; - PRBool done=PR_FALSE; - char ch1,ch2; - int eof1,eof2; - -#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) - /* HAVE_IOS_BINARY needs to be set for mac & win */ - ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); - ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); -#else - ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); - ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); -#endif - input1.setmode(filebuf::binary); - input2.setmode(filebuf::binary); - failpos=-1; - - while(!done) { - - while(!(eof1=input1.eof())) { - input1.read(&ch1,1); - if(failpos>4225) { - int x=failpos; - } - failpos++; - char* p=strchr(" \t\r\n\b",ch1); - if(!p) - break; - } - - while(!(eof2=input2.eof())) { - input2.read(&ch2,1); - char* p=strchr(" \t\r\n\b",ch2); - if(!p) - break; - } - - if(eof1==eof2) { - if(eof1) - done=PR_TRUE; - else if(ch1!=ch2) { - done=PR_TRUE; - result=PR_FALSE; - - } - } - else done=PR_TRUE; - } - return result; -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -void parseFile (const char* aFilename,int size) -{ - //debug - //aFilename="s:\\ns\\raptor\\parser\\tests\\html\\home01.html"; - //aFilename="c:\\temp\\sun\\test00000.html"; - //aFilename="c:\\windows\\temp\\test.html"; - aFilename="s:\\readHTML-VC\\test.html"; - //aFilename="c:\\temp\\sun\\commentbug.html"; - - - char filename[_MAX_PATH]; - strcpy(filename,aFilename); - strcat(filename,".tokens"); - { - nsIParser* parser; - - static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID); - static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); - - nsresult rv = nsComponentManager::CreateInstance(kCParserCID, - nsnull, - kCParserIID, - (void **)&parser); - - CHTMLContentSink theSink; - parser->setContentSink(&theSink); - parser->parse(aFilename); - NS_RELEASE(parser); - } - - int failpos=0; - - if(!compareFiles(aFilename,filename,failpos)) { - char buffer[100]; - printf("FAILED: %s [%i]\n",aFilename,failpos); - } -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -int walkDirectoryTree(char* aPath) { - int result=0; - char fullPath[_MAX_PATH]; - struct _finddata_t c_file; - long hFile; - - strcpy(fullPath,aPath); - strcat(fullPath,"\\*.*"); - /* Find first .c file in current directory */ - if((hFile = _findfirst( fullPath, &c_file )) == -1L ) - printf( "No matching files in current directory!\n" ); - else { - - PRBool done=PR_FALSE; - while(!done) { - if(c_file.attrib & _A_SUBDIR) { - if(strlen(c_file.name)>2){ - char newPath[_MAX_PATH]; - strcpy(newPath,aPath); - strcat(newPath,"\\"); - strcat(newPath,c_file.name); - walkDirectoryTree(newPath); - } - } - else { - int len=strlen(c_file.name); - if(len>5) { - if(0==strnicmp(&c_file.name[len-5],".HTML",5)) { - char filepath[_MAX_PATH]; - strcpy(filepath,aPath); - strcat(filepath,"\\"); - strcat(filepath,c_file.name); - parseFile(filepath,c_file.size); - } - } - } - if(_findnext( hFile, &c_file )!=0) - done=PR_TRUE; - } - _findclose( hFile ); - } - return 0; -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -int main(int argc, char* argv []) -{ - int result=0; - char buffer[_MAX_PATH]; - - if(argc==2) - strcpy(buffer,argv[1]); - else _getcwd(buffer,_MAX_PATH); - - nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); - if (NS_FAILED(rv)) { - printf("NS_InitXPCOM2 failed\n"); - return 1; - } - - walkDirectoryTree(buffer); - return 0; -} - - - - - diff --git a/htmlparser/src/nsDTDUtils.cpp b/htmlparser/src/nsDTDUtils.cpp index b7f37b9707a..43ddef1a80c 100644 --- a/htmlparser/src/nsDTDUtils.cpp +++ b/htmlparser/src/nsDTDUtils.cpp @@ -139,7 +139,7 @@ void nsEntryStack::EnsureCapacityFor(PRInt32 aNewMax,PRInt32 aShiftOffset) { if(temp){ PRInt32 index=0; - for(index=0;indexmCount,0); PRInt32 theIndex=0; - for(theIndex=0;theIndexmEntries[theIndex]; mEntries[mCount++].mParent=0; } @@ -245,7 +245,7 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) { PRInt32 theIndex=0; mCount-=1; - for(theIndex=anIndex;theIndexmEntries; - for(sindex=scount-1;sindex>0;sindex--){ + for(sindex=scount-1;sindex>0;--sindex){ if(theStyleEntry->mTag==aTag) { theStyleEntry->mParent=0; //this tells us that the style is not open at any level break; } - theStyleEntry++; + ++theStyleEntry; } //for } } @@ -299,12 +299,12 @@ nsCParserNode* nsEntryStack::Pop(void) { PRUint32 sindex=0; nsTagEntry *theStyleEntry=theStyleStack->mEntries; - for(sindex=scount-1;sindex>0;sindex--){ + for(sindex=scount-1;sindex>0;--sindex){ if(theStyleEntry->mTag==mEntries[mCount].mTag) { theStyleEntry->mParent=0; //this tells us that the style is not open at any level break; } - theStyleEntry++; + ++theStyleEntry; } //for } } @@ -465,12 +465,12 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const { // skip past leading and trailing quotes/etc if(kQuote==*start) { - start++; + ++start; } if(kSemicolon==theChar || kQuote == theChar) { - end--; + --end; } @@ -478,7 +478,7 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const { PRInt32 theCount=mEntities.GetSize(); PRInt32 theIndex=0; - for(theIndex=0;theIndexmName.Equals(entityName, @@ -592,7 +592,7 @@ public: while(next<=aValue) { // scale up in baseN; exceed current value. root=next; next*=base; - expn++; + ++expn; } while(expn--) { @@ -735,7 +735,7 @@ public: int digitPos=0; int n=0; - for(digitPos=0;digitPosPush(aNode); - mResidualStyleCount++; + ++mResidualStyleCount; } } //if } @@ -1076,10 +1076,10 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){ PRUint32 sindex=0; theEntry=aStyles->mEntries; - for(sindex=0;sindexmParent=0; //this tells us that the style is not open at any level - theEntry++; - mResidualStyleCount++; + ++theEntry; + ++mResidualStyleCount; } //for } @@ -1202,7 +1202,7 @@ nsTokenAllocator::nsTokenAllocator() { #ifdef NS_DEBUG int i=0; - for(i=0;i" << endl; out << prefix; written=0; if(theDTD.IsContainer(i)) { - for(j=1;jCount(); - for (PRInt32 j = 0; j < count; j++) { + for (PRInt32 j = 0; j < count; ++j) { nsISupports* obs = (nsISupports*)mObservers[i]->ElementAt(j); NS_IF_RELEASE(obs); } @@ -1550,7 +1550,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode, // least 2 allocations for mImpl, usually more, plus at least 1 per // string (total = 2*(keys+3) + 2(or more) array allocations )). PRInt32 index; - for (index = 0; index < theAttrCount; index++) { + for (index = 0; index < theAttrCount; ++index) { keys.AppendString(aNode->GetKeyAt(index)); values.AppendString(aNode->GetValueAt(index)); } @@ -1570,7 +1570,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode, nsCOMPtr channel; aParser->GetChannel(getter_AddRefs(channel)); - for (index=0;indexElementAt(index)); if (observer) { result = observer->Notify(aWebShell, channel, @@ -1613,7 +1613,7 @@ nsObserverEntry::AddObserver(nsIElementObserver *aObserver, void nsObserverEntry::RemoveObserver(nsIElementObserver *aObserver) { - for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; i++){ + for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; ++i){ if (mObservers[i]) { nsISupports* obs = aObserver; PRBool removed = mObservers[i]->RemoveElement(obs); diff --git a/htmlparser/src/nsDTDUtils.h b/htmlparser/src/nsDTDUtils.h index 1aaeec4b85b..8b1e4fed585 100644 --- a/htmlparser/src/nsDTDUtils.h +++ b/htmlparser/src/nsDTDUtils.h @@ -446,7 +446,7 @@ inline PRInt32 IndexOfTagInSet(PRInt32 aTag,const eHTMLTags* aTagSet,PRInt32 aCo if(aTag==*theTag) { return theTag-aTagSet; } - theTag++; + ++theTag; } return kNotFound; @@ -622,7 +622,7 @@ inline PRInt32 LastOf(nsDTDContext& aContext,TagList& aTagList){ inline PRInt32 FirstOf(nsDTDContext& aContext,PRInt32 aStartOffset,TagList& aTagList){ int max = aContext.GetCount(); int index; - for(index=aStartOffset;index" << endl; @@ -2322,25 +2322,25 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl written=0; char startChar=0; if(IsContainer((eHTMLTags)i)) { - for(j=1;j // 0123456789012345678 PRUint32 i = 17; // ?> can start at position 17 at the earliest - for (; i < aLength; i++) { + for (; i < aLength; ++i) { if (aValue[i] == '?') break; } @@ -682,7 +682,7 @@ CreateSourceText(const PRInt32 aColNumber, aSourceString.Append(aSourceLine); aSourceString.Append(PRUnichar('\n')); - for (PRInt32 i = 0; i < errorPosition - 1; i++) { + for (PRInt32 i = 0; i < errorPosition - 1; ++i) { aSourceString.Append(PRUnichar('-')); } aSourceString.Append(PRUnichar('^')); diff --git a/htmlparser/src/nsHTMLEntities.cpp b/htmlparser/src/nsHTMLEntities.cpp index 329c2bce27c..1153cc8d00b 100644 --- a/htmlparser/src/nsHTMLEntities.cpp +++ b/htmlparser/src/nsHTMLEntities.cpp @@ -235,7 +235,7 @@ public: nsHTMLEntities::AddRefTable(); // Make sure we can find everything we are supposed to - for (int i = 0; i < NS_HTML_ENTITY_COUNT; i++) { + for (int i = 0; i < NS_HTML_ENTITY_COUNT; ++i) { nsAutoString entity; entity.AssignWithConversion(gEntityArray[i].mStr); value = nsHTMLEntities::EntityToUnicode(entity); diff --git a/htmlparser/src/nsHTMLNullSink.cpp b/htmlparser/src/nsHTMLNullSink.cpp index 8edfbdf9e42..b7227edda0b 100644 --- a/htmlparser/src/nsHTMLNullSink.cpp +++ b/htmlparser/src/nsHTMLNullSink.cpp @@ -153,7 +153,7 @@ nsHTMLNullSink::~nsHTMLNullSink() { #ifdef VERBOSE_DEBUG static void DebugDump(const char* str1,const nsAString& str2,PRInt32 tabs) { - for(PRInt32 i=0;iSetEmpty(isUsableAttr); } if(isUsableAttr) { - theAttrCount++; + ++theAttrCount; AddToken((CToken*&)theToken,result,&mTokenDeque,theAllocator); } else { diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp index 46b64c47674..6d007e6cbb2 100644 --- a/htmlparser/src/nsHTMLTokens.cpp +++ b/htmlparser/src/nsHTMLTokens.cpp @@ -1013,7 +1013,7 @@ static PRBool IsCommentEnd( return PR_TRUE; } if (*current == PRUnichar('-')) { - dashes++; + ++dashes; } else { dashes = 0; } @@ -2028,9 +2028,9 @@ CEntityToken::ConsumeEntity(PRUnichar aChar, aString.Append(aChar); if(aChar==kRightBrace) - rightBraceCount++; + ++rightBraceCount; else if(aChar==kLeftBrace) - leftBraceCount++; + ++leftBraceCount; } while(leftBraceCount!=rightBraceCount); } //if else { diff --git a/htmlparser/src/nsLoggingSink.cpp b/htmlparser/src/nsLoggingSink.cpp index d0a90ae1f8a..463be53af52 100644 --- a/htmlparser/src/nsLoggingSink.cpp +++ b/htmlparser/src/nsLoggingSink.cpp @@ -133,7 +133,7 @@ nsLoggingSink::SetOutputStream(PRFileDesc *aStream,PRBool autoDeleteOutput) { static void WriteTabs(PRFileDesc * out,int aTabCount) { int tabs; - for(tabs=0;tabsGetCount(); PRInt32 theIndex; - for(theIndex=0;theIndexGetTokenAt(theIndex))){ //add code here to pull unwanted tokens out of the stack... } diff --git a/htmlparser/src/nsParserNode.cpp b/htmlparser/src/nsParserNode.cpp index 874765982bb..169df3fc469 100644 --- a/htmlparser/src/nsParserNode.cpp +++ b/htmlparser/src/nsParserNode.cpp @@ -86,7 +86,7 @@ nsCParserNode::nsCParserNode(CToken* aToken, MOZ_COUNT_CTOR(nsCParserNode); static int theNodeCount=0; - theNodeCount++; + ++theNodeCount; mAttributes=0; mToken=aToken; IF_HOLD(mToken); @@ -327,7 +327,7 @@ void nsCParserNode::GetSource(nsString& aString) { } if(mAttributes) { int index=0; - for(index=0;indexGetSize();index++) { + for(index=0;indexGetSize();++index) { CAttributeToken *theToken=(CAttributeToken*)mAttributes->ObjectAt(index); if(theToken) { theToken->AppendSourceTo(aString); diff --git a/htmlparser/src/nsParserService.cpp b/htmlparser/src/nsParserService.cpp index 4ffd43b00c9..aeba847bd0d 100644 --- a/htmlparser/src/nsParserService.cpp +++ b/htmlparser/src/nsParserService.cpp @@ -148,7 +148,7 @@ nsParserService::RegisterObserver(nsIElementObserver* aObserver, if(*aTags != eHTMLTag_userdefined && *aTags <= NS_HTML_TAG_MAX) { entry->AddObserver(aObserver,*aTags); } - aTags++; + ++aTags; } return result; @@ -160,7 +160,7 @@ nsParserService::UnregisterObserver(nsIElementObserver* aObserver, { PRInt32 count = mEntries.GetSize(); - for (PRInt32 i=0; i < count; i++) { + for (PRInt32 i=0; i < count; ++i) { nsObserverEntry* entry = NS_STATIC_CAST(nsObserverEntry*,mEntries.ObjectAt(i)); if (entry && entry->Matches(aTopic)) { entry->RemoveObserver(aObserver); diff --git a/htmlparser/src/nsScanner.cpp b/htmlparser/src/nsScanner.cpp index 4ffdcdce0ce..29d7b140e07 100644 --- a/htmlparser/src/nsScanner.cpp +++ b/htmlparser/src/nsScanner.cpp @@ -356,7 +356,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){ srcLength = aLen; } else { - srcLength++; + ++srcLength; } aBuffer += srcLength; @@ -480,7 +480,7 @@ nsresult nsScanner::GetChar(PRUnichar& aChar) { if(NS_OK == result){ aChar=*mCurrentPosition++; - mCountRemaining--; + --mCountRemaining; } return result; } @@ -581,7 +581,7 @@ nsresult nsScanner::SkipWhitespace(PRInt32& aNewlinesSkipped) { while (!done && current != mEndPosition) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': @@ -1048,7 +1048,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString, while(!done && current != end) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': @@ -1102,7 +1102,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator& aStart, while(!done && current != end) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': diff --git a/htmlparser/src/nsToken.cpp b/htmlparser/src/nsToken.cpp index 09bf7d66b90..2eedff1650b 100644 --- a/htmlparser/src/nsToken.cpp +++ b/htmlparser/src/nsToken.cpp @@ -77,7 +77,7 @@ CToken::CToken(PRInt32 aTag) { mUseCount=1; #ifdef NS_DEBUG - TokenCount++; + ++TokenCount; #endif } @@ -92,7 +92,7 @@ CToken::~CToken() { #ifdef MATCH_CTOR_DTOR MOZ_COUNT_DTOR(CToken); #endif - DelTokenCount++; + ++DelTokenCount; mUseCount=0; } @@ -124,7 +124,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) { anOutputStream << "[" << GetClassName() << "] "; PRUint32 i=0; PRUint32 theLen=GetStringValue().Length(); - for(i=0;iPeekToken(); if(theToken) { eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType()); @@ -1047,7 +1047,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_start: { - mTagCount++; + ++mTagCount; const nsAString& startValue = aToken->GetStringValue(); result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); @@ -1107,9 +1107,9 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_newline: { const nsAString& newlineValue = aToken->GetStringValue(); - mLineNumber++; + ++mLineNumber; result=WriteTag(mText,newlineValue,0,PR_FALSE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK) StartNewPreBlock(); @@ -1120,7 +1120,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { { const nsAString& wsValue = aToken->GetStringValue(); result=WriteTag(mText,wsValue,0,PR_FALSE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !wsValue.IsEmpty()) { @@ -1135,7 +1135,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { { const nsAString& str = aToken->GetStringValue(); result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { PRUnichar ch = str.Last(); diff --git a/htmlparser/tests/grabpage/grabpage.cpp b/htmlparser/tests/grabpage/grabpage.cpp index 1c412e4d3b8..37b6e65a0c1 100644 --- a/htmlparser/tests/grabpage/grabpage.cpp +++ b/htmlparser/tests/grabpage/grabpage.cpp @@ -209,7 +209,7 @@ PageGrabber::NextFile(const char* aExtension) struct stat sb; int s = stat(cname, &sb); if (s < 0) { - mFileNum++; + ++mFileNum; break; } else { diff --git a/htmlparser/tests/htmlgen/htmlgen.cpp b/htmlparser/tests/htmlgen/htmlgen.cpp index 91409cfaf24..e69de29bb2d 100644 --- a/htmlparser/tests/htmlgen/htmlgen.cpp +++ b/htmlparser/tests/htmlgen/htmlgen.cpp @@ -1,517 +0,0 @@ -/*======================================================== - To Do: - 1. Tag sequences on the command line p..table - 2. Dumping documents into the right place - *========================================================*/ - - -/*======================================================== - Special keywords: - $0..$9: represent command line arguments - @file: the name of the file being writtent - @nextfile: the name of the next file to be written - @import: imports text from another file. - *========================================================*/ - - -#include -#include -#include -#include - -#include -#include -#include -#include - - -static char* tagTable[] = { - "A", "ABBR", "ACRONYM", "ADDRESS", "APPLET", "AREA", - "B", "BASE", "BASEFONT", "BDO", "BGSOUND", "BIG", "BLINK", "BLOCKQUOTE", "BODY", "BR", "BUTTON", - "CAPTION", "CENTER", "CITE", "CODE", "COL", "COLGROUP", - "DD", "DEL", "DFN", "DIR", "DIV", "DL", "DT", - "EM", "EMBED", - "FIELDSET", "FONT", "FORM", "FRAME", "FRAMESET", - "H1", "H2", "H3", "H4", "H5", "H6", "HEAD", "HR", "HTML", - "I", "IFRAME", "ILAYER", "IMG", "INPUT", "INS", "ISINDEX", - "KBD", "KEYGEN", - "LABEL", "LAYER", "LEGEND", "LI", "LINK", "LISTING", - "MAP", "MENU", "META", "MULTICOL", - "NOBR", "NOEMBED", "NOFRAMES", "NOLAYER", "NOSCRIPT", - "OBJECT", "OL", "OPTGROUP", "OPTION", - "P", "PARAM", "PLAINTEXT", "PRE", - "Q", - "S","SAMP","SCRIPT","SELECT","SERVER","SMALL","SOUND","SPACER","SPAN","STRIKE","STRONG","STYLE","SUB","SUP", - "TABLE", "TBODY", "TD", "TEXTAREA", "TFOOT", "TH", "THEAD", "TITLE", "TR", "TT", - "U", "UL", - "VAR", - "WBR", - "XMP", - 0 -}; -static char gCWD[1025]; -static char gPrevFile[128]; -static char gThisFile[128]; -static char gNextFile[128]; -static int gFileIndex=0; - - -int findTag(const char* aTagName) { - int low = 0; - int high = 107; - while (low <= high) { - int middle = (low + high) >> 1; - int result = stricmp(aTagName, tagTable[middle]); - if (result == 0) - return middle; - if (result < 0) - high = middle - 1; - else - low = middle + 1; - } - return -1; -} - - -/** - * Call this to find a tag that closely resembles the given tag. - * Note that we match based on the first char. - * @update gess12/23/98 - * @param - * @return - */ -int findNearestTag(char* aTag){ - int result=-1; - if(aTag){ - char theChar=toupper(aTag[0]); - int theIndex=-1; - while(tagTable[++theIndex]){ - if(toupper(tagTable[theIndex][0])==theChar) { - return theIndex; - } - } - } - if(toupper(aTag[0])<'A') - result=0; - else result=107; - return result; -} - -char* getNthTagAfter(int aRangeIndex,char* aStartTag){ - int theIndex=findTag(aStartTag); - if(-1==theIndex){ - theIndex=findNearestTag(aStartTag); - } - if(-10){ - if((strchr(aString,',')) || (strchr(aString,'-'))) { - mRanges[mCount]=new char[sLen+1]; - strcpy(mRanges[mCount++],aString); - } - else { - mKeys[mCount]=new char[sLen+1]; - strcpy(mKeys[mCount++],aString); - } - return true; - } - } - return false; - } - - int getCount() {return mCount;} - - char* getMacro(int anIndex) { - if(anIndex> theBuffer; - if(!stricmp(theBuffer,"-F")){ - //copy the filename... - aStream >> theBuffer; - strcpy(mFilename,theBuffer); - readDefs=false; - } -#if 0 - else if(!stricmp(theBuffer,"-D")){ - readDefs=true; - } -#endif - else if(!stricmp(theBuffer,"-O")){ - aStream >> theBuffer; - readDefs=false; - } - else { - if(theBuffer[0]){ - addMacro(theBuffer); - theBuffer[0]=0; - } - } - } - return true; - } - - void buildArgBuffer(char* aBuffer) { - aBuffer[0]=0; - if(mFilename[0]) { - sprintf(aBuffer,"-o %s -f %s ",gThisFile,mFilename); - } - for(int i=0;i>theWord; - char* thePos=strchr(theWord,'@'); - if(thePos){ - strncat(temp,theWord,thePos-theWord); - if(!strnicmp(thePos,"@file",5)){ - strcat(temp,gThisFile); - thePos+=5; - } - else if(!strnicmp(thePos,"@nextfile",9)){ - strcat(temp,gNextFile); - thePos+=9; - } - else if(!strnicmp(thePos,"@prevfile",9)){ - strcat(temp,gPrevFile); - thePos+=9; - } - strcat(temp,thePos); - } - else strcat(temp,theWord); - strcat(temp," "); - } - strcpy(aBuffer,temp); - } -} - -/** - * - * @update gess12/20/98 - * @param - * @return - */ -void expandMacros(char* aBuffer,CMacros& aMacroSet){ - char temp[1024]; - int rPos=-1; - int wPos=0; - - if(aBuffer){ - while(aBuffer[++rPos]){ - if('$'==aBuffer[rPos]){ - temp[wPos]=0; - rPos++; //skip the $... - int theIndex=aBuffer[rPos]-'0'; - char* theMacro=aMacroSet.getMacro(theIndex); - if(theMacro){ - strcat(temp,theMacro); - wPos=strlen(temp); - } - } - else temp[wPos++]=aBuffer[rPos]; - } - temp[wPos]=0; - strcpy(aBuffer,temp); - } -} - -/** - * - * @update gess12/20/98 - * @param - * @return - */ -int processFile(char* aDir,CMacros& aMacroList,fstream& anOutputStream,fstream& anInputStream){ - int result=0; - - if(anInputStream.is_open()){ - bool done=false; - char theBuffer[1024]; - char* p=0; - - while((!done) && (0==result)){ - - anInputStream.getline(theBuffer,sizeof(theBuffer)-1); - if(anInputStream.gcount()){ - - //before doing anything else, expand the macros and keywords... - expandMacros(theBuffer,aMacroList); - expandKeywords(theBuffer,aMacroList); - - //Now process each line: - p=strstr(theBuffer,"@import"); - if(p) { - - //First, see if the line is an htmlgen statement; if so, recurse to read new file... - char theFilename[1024]; - - strcpy(theFilename,"htmlgen -F "); - p+=8; - strcat(theFilename,p); - - //If you're here, we found an htmlgen statement. - // To handle this, we have to: - // 1. strip off the @htmlgen - // 2. grab the filename and collect the args, - // 3. and recurse... - - fstream theInStream(p,ios::in); - result=processFile(aDir,aMacroList,anOutputStream,theInStream); - } - else anOutputStream << theBuffer << endl; - } - else done=true; - } - } - return result; -} - - -/** - * This is where the different combinations of arguments - * gets constructed and passed on for processing. - * Note that this is even called when the args have only 1 value. - * @return error code - */ -int iterate(istrstream& aInputArgs){ - int result=0; - - CMacros theArgs; - theArgs.consume(aInputArgs); - - char theFilename[1024]; - - bool done=!theArgs.first(); - while((!done) && (0==result)){ - CMacros theTempArgs(theArgs); - - //theTempArgs.buildArgBuffer(theBuffer); - // istrstream theArgStream(theBuffer); - - sprintf(theFilename,"%s\\%s",gCWD,gThisFile); - fstream theOutStream(theFilename,ios::trunc); - - char* theInFile=theArgs.getFilename(); - fstream theInStream(theInFile,ios::in); - - result=processFile(gCWD,theTempArgs,theOutStream,theInStream); - theArgs.dump(); - done=!theArgs.next(); - } - return result; -} - -/** - * - * @update gess12/20/98 - * @param - * @return - */ -int main(int argc,char* argv[]){ - int result=0; - - gPrevFile[0]=gThisFile[0]=gNextFile[0]; - if(argc>1){ - char theBuffer[1024]; - theBuffer[0]=0; - - for(int i=1;iCount(); if (nCount > 0) { - for (PRInt32 n = 0; n < nCount; n++) + for (PRInt32 n = 0; n < nCount; ++n) { nsString * pstr = (nsString *)g_duplicateList->ElementAt(n); if (pstr->Equals(aURLSpec)) { @@ -127,7 +127,7 @@ NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec) str.Truncate(); nsString(aURLSpec).Left(str,5); if (str.Equals(NS_LITERAL_STRING("http:"))) { - g_iProcessed++; + ++g_iProcessed; if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0)) g_bHitTop = PR_TRUE; g_workList->AppendElement(new nsString(aURLSpec)); diff --git a/parser/htmlparser/robot/nsRobotSink.cpp b/parser/htmlparser/robot/nsRobotSink.cpp index 64e43d35c65..24bee627584 100644 --- a/parser/htmlparser/robot/nsRobotSink.cpp +++ b/parser/htmlparser/robot/nsRobotSink.cpp @@ -144,7 +144,7 @@ RobotSink::~RobotSink() { NS_IF_RELEASE(mDocumentURL); PRInt32 i, n = mObservers.Count(); - for (i = 0; i < n; i++) { + for (i = 0; i < n; ++i) { nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i); NS_RELEASE(cop); } @@ -249,7 +249,7 @@ NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode) if (tmp.Equals(NS_LITERAL_STRING("a"))) { nsAutoString k, v; PRInt32 ac = aNode.GetAttributeCount(); - for (PRInt32 i = 0; i < ac; i++) { + for (PRInt32 i = 0; i < ac; ++i) { // Get upper-cased key const nsAString& key = aNode.GetKeyAt(i); k.Assign(key); @@ -388,7 +388,7 @@ void RobotSink::ProcessLink(const nsString& aLink) // Now give link to robot observers PRInt32 i, n = mObservers.Count(); - for (i = 0; i < n; i++) { + for (i = 0; i < n; ++i) { nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i); cop->ProcessLink(absURLSpec); } diff --git a/parser/htmlparser/robot/test/RobotMain.cpp b/parser/htmlparser/robot/test/RobotMain.cpp index b3b01bef2bf..785054b568d 100644 --- a/parser/htmlparser/robot/test/RobotMain.cpp +++ b/parser/htmlparser/robot/test/RobotMain.cpp @@ -16,7 +16,7 @@ int main(int argc, char **argv) nsVoidArray * gWorkList = new nsVoidArray(); if(gWorkList) { int i; - for (i = 1; i < argc; i++) { + for (i = 1; i < argc; ++i) { nsString *tempString = new nsString; tempString->AssignWithConversion(argv[i]); gWorkList->AppendElement(tempString); diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 69f754b7a6d..62eabf762ad 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -704,7 +704,7 @@ PRBool DoesRequireBody(CToken* aToken,nsITokenizer* aTokenizer) { if(theTag==eHTMLTag_input) { // IE & Nav4x opens up a body for type=text - Bug 66985 PRInt32 ac=aToken->GetAttributeCount(); - for(PRInt32 i=0; iGetTokenAt(i)); const nsAString& name=attr->GetKey(); const nsAString& value=attr->GetValue(); @@ -1032,7 +1032,7 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; - for(theIndex=0;theIndexGetTokenType()); switch(theType) { - case eToken_newline: aNewlineCount++; + case eToken_newline: ++aNewlineCount; case eToken_whitespace: theToken=aTokenizer->PopToken(); IF_FREE(theToken, aTokenAllocator); @@ -2071,7 +2071,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { // considered as a leaf. However, in the sink FORM can either // be a container or a leaf. Therefore, we have to check // with the sink -- Ref: Bug 20087. - anIndex++; + ++anIndex; } STOP_TIMER() @@ -2085,7 +2085,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { PRInt32 i=0; nsEntryStack* theChildStyleStack=0; - for(i=0; i<(theTagCount - theTopIndex); i++) { + for(i=0; i<(theTagCount - theTopIndex); ++i) { nsCParserNode* node=mBodyContext->Pop(theChildStyleStack); mTempContext->Push(node); IF_FREE(node, &mNodeAllocator); //release the popped node since push will addref for us. @@ -2098,7 +2098,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { theTag = (eHTMLTags)theToken->GetTypeID(); attrCount = (gHTMLElements[theTag].mSkipTarget)? 0:theToken->GetAttributeCount(); // Put back attributes, which once got popped out, into the tokenizer - for(PRInt32 j=0;jPushTokenFront(theAttrToken); @@ -2128,7 +2128,7 @@ nsresult CNavDTD::HandleSavedTokens(PRInt32 anIndex) { // Bad-contents were successfully processed. Now, itz time to get // back to the original body context state. - for(PRInt32 k=0; k<(theTagCount - theTopIndex); k++) { + for(PRInt32 k=0; k<(theTagCount - theTopIndex); ++k) { nsCParserNode* node=mTempContext->Pop(theChildStyleStack); mBodyContext->Push(node); IF_FREE(node, &mNodeAllocator); @@ -2380,7 +2380,7 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32 if(aCount<=theAvailTokenCount) { CToken* theToken=0; eHTMLTags theSkipTarget=gHTMLElements[aTag].mSkipTarget; - for(attr=0;attrGetStylesAt(theLevel); if(theStack){ PRInt32 sindex=0; nsTagEntry *theEntry=theStack->mEntries; - for(sindex=0;sindexmCount;sindex++){ + for(sindex=0;sindexmCount;++sindex){ nsCParserNode* theNode=(nsCParserNode*)theEntry->mNode; if(1==theNode->mUseCount) { eHTMLTags theNodeTag=(eHTMLTags)theNode->GetNodeType(); @@ -2965,10 +2965,10 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){ //if the node tag can't contain the child tag, then remove the child tag from the style stack nsCParserNode* node=theStack->Remove(sindex,theNodeTag); IF_FREE(node, &mNodeAllocator); - theEntry--; //back up by one + --theEntry; //back up by one } } //if - theEntry++; + ++theEntry; } //for } //if } //for @@ -3269,7 +3269,7 @@ nsresult CNavDTD::OpenMap(const nsCParserNode *aNode){ if(NS_OK==result) { mBodyContext->Push(aNode); - mOpenMapCount++; + ++mOpenMapCount; } return result; } diff --git a/parser/htmlparser/src/COtherDTD.cpp b/parser/htmlparser/src/COtherDTD.cpp index 18e318c2528..068b4cc1579 100644 --- a/parser/htmlparser/src/COtherDTD.cpp +++ b/parser/htmlparser/src/COtherDTD.cpp @@ -581,7 +581,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theNextToken) { eHTMLTokenTypes theType=eHTMLTokenTypes(theNextToken->GetTokenType()); if(eToken_newline==theType){ - mLineNumber++; + ++mLineNumber; mTokenizer->PopToken(); //skip 1st newline inside PRE and LISTING }//if }//if @@ -599,7 +599,7 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; - for(theIndex=0;theIndexmElements[aTag]->GetSkipTarget(); CToken* theToken=0; - for(attr=0;attrPopToken(); if(theToken) { // Sanitize the key for it might contain some non-alpha-non-digit characters diff --git a/parser/htmlparser/src/COtherElements.h b/parser/htmlparser/src/COtherElements.h index c61ae599149..190d6397e6a 100644 --- a/parser/htmlparser/src/COtherElements.h +++ b/parser/htmlparser/src/COtherElements.h @@ -104,7 +104,7 @@ inline PRBool ListContainsTag(eHTMLTags* aTagList,eHTMLTags aTag) { if(aTag==*theNextTag) { return PR_TRUE; } - theNextTag++; + ++theNextTag; } } return PR_FALSE; @@ -2109,7 +2109,7 @@ void CElementTable::InitializeElements() { int max=sizeof(mElements)/sizeof(mElements[0]); int index=0; - for(index=0;indexCanContain(theChild,0)){ const PRUnichar *t = nsHTMLTags::GetStringValue(theChild->mTag); printf("%s ", NS_ConvertUCS2toUTF8(t).get()); - count++; + ++count; if(18==count) { count=0; printf("\n%s",prefix); @@ -2528,7 +2528,7 @@ void CElementTable::DebugDumpContainment(const char* aTitle){ printf("==================================================\n"); int i=0; - for(i=1;i -#include - -#include "nsXPCOM.h" -#include "nsISupports.h" -#include "nsTokenizer.h" -#include "nsHTMLDelegate.h" -#include "nsIParser.h" -#include "nsHTMLContentSink.h" -#include "nsIComponentManager.h" -#include "nsParserCIID.h" - - -PRBool compareFiles(const char* file1,const char* file2,int& failpos) { - PRBool result=PR_TRUE; - PRBool done=PR_FALSE; - char ch1,ch2; - int eof1,eof2; - -#if defined(HAVE_IOS_BINARY) || !defined(XP_UNIX) - /* HAVE_IOS_BINARY needs to be set for mac & win */ - ifstream input1(file1,ios::in && ios::binary,filebuf::openprot); - ifstream input2(file2,ios::in && ios::binary,filebuf::openprot); -#else - ifstream input1(file1,ios::in && ios::bin,filebuf::openprot); - ifstream input2(file2,ios::in && ios::bin,filebuf::openprot); -#endif - input1.setmode(filebuf::binary); - input2.setmode(filebuf::binary); - failpos=-1; - - while(!done) { - - while(!(eof1=input1.eof())) { - input1.read(&ch1,1); - if(failpos>4225) { - int x=failpos; - } - failpos++; - char* p=strchr(" \t\r\n\b",ch1); - if(!p) - break; - } - - while(!(eof2=input2.eof())) { - input2.read(&ch2,1); - char* p=strchr(" \t\r\n\b",ch2); - if(!p) - break; - } - - if(eof1==eof2) { - if(eof1) - done=PR_TRUE; - else if(ch1!=ch2) { - done=PR_TRUE; - result=PR_FALSE; - - } - } - else done=PR_TRUE; - } - return result; -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -void parseFile (const char* aFilename,int size) -{ - //debug - //aFilename="s:\\ns\\raptor\\parser\\tests\\html\\home01.html"; - //aFilename="c:\\temp\\sun\\test00000.html"; - //aFilename="c:\\windows\\temp\\test.html"; - aFilename="s:\\readHTML-VC\\test.html"; - //aFilename="c:\\temp\\sun\\commentbug.html"; - - - char filename[_MAX_PATH]; - strcpy(filename,aFilename); - strcat(filename,".tokens"); - { - nsIParser* parser; - - static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID); - static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); - - nsresult rv = nsComponentManager::CreateInstance(kCParserCID, - nsnull, - kCParserIID, - (void **)&parser); - - CHTMLContentSink theSink; - parser->setContentSink(&theSink); - parser->parse(aFilename); - NS_RELEASE(parser); - } - - int failpos=0; - - if(!compareFiles(aFilename,filename,failpos)) { - char buffer[100]; - printf("FAILED: %s [%i]\n",aFilename,failpos); - } -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -int walkDirectoryTree(char* aPath) { - int result=0; - char fullPath[_MAX_PATH]; - struct _finddata_t c_file; - long hFile; - - strcpy(fullPath,aPath); - strcat(fullPath,"\\*.*"); - /* Find first .c file in current directory */ - if((hFile = _findfirst( fullPath, &c_file )) == -1L ) - printf( "No matching files in current directory!\n" ); - else { - - PRBool done=PR_FALSE; - while(!done) { - if(c_file.attrib & _A_SUBDIR) { - if(strlen(c_file.name)>2){ - char newPath[_MAX_PATH]; - strcpy(newPath,aPath); - strcat(newPath,"\\"); - strcat(newPath,c_file.name); - walkDirectoryTree(newPath); - } - } - else { - int len=strlen(c_file.name); - if(len>5) { - if(0==strnicmp(&c_file.name[len-5],".HTML",5)) { - char filepath[_MAX_PATH]; - strcpy(filepath,aPath); - strcat(filepath,"\\"); - strcat(filepath,c_file.name); - parseFile(filepath,c_file.size); - } - } - } - if(_findnext( hFile, &c_file )!=0) - done=PR_TRUE; - } - _findclose( hFile ); - } - return 0; -} - - -/**------------------------------------------------------- - * LAST MODS: gess - * - * @param - * @return - *------------------------------------------------------*/ -int main(int argc, char* argv []) -{ - int result=0; - char buffer[_MAX_PATH]; - - if(argc==2) - strcpy(buffer,argv[1]); - else _getcwd(buffer,_MAX_PATH); - - nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); - if (NS_FAILED(rv)) { - printf("NS_InitXPCOM2 failed\n"); - return 1; - } - - walkDirectoryTree(buffer); - return 0; -} - - - - - diff --git a/parser/htmlparser/src/nsDTDUtils.cpp b/parser/htmlparser/src/nsDTDUtils.cpp index b7f37b9707a..43ddef1a80c 100644 --- a/parser/htmlparser/src/nsDTDUtils.cpp +++ b/parser/htmlparser/src/nsDTDUtils.cpp @@ -139,7 +139,7 @@ void nsEntryStack::EnsureCapacityFor(PRInt32 aNewMax,PRInt32 aShiftOffset) { if(temp){ PRInt32 index=0; - for(index=0;indexmCount,0); PRInt32 theIndex=0; - for(theIndex=0;theIndexmEntries[theIndex]; mEntries[mCount++].mParent=0; } @@ -245,7 +245,7 @@ nsCParserNode* nsEntryStack::Remove(PRInt32 anIndex,eHTMLTags aTag) { PRInt32 theIndex=0; mCount-=1; - for(theIndex=anIndex;theIndexmEntries; - for(sindex=scount-1;sindex>0;sindex--){ + for(sindex=scount-1;sindex>0;--sindex){ if(theStyleEntry->mTag==aTag) { theStyleEntry->mParent=0; //this tells us that the style is not open at any level break; } - theStyleEntry++; + ++theStyleEntry; } //for } } @@ -299,12 +299,12 @@ nsCParserNode* nsEntryStack::Pop(void) { PRUint32 sindex=0; nsTagEntry *theStyleEntry=theStyleStack->mEntries; - for(sindex=scount-1;sindex>0;sindex--){ + for(sindex=scount-1;sindex>0;--sindex){ if(theStyleEntry->mTag==mEntries[mCount].mTag) { theStyleEntry->mParent=0; //this tells us that the style is not open at any level break; } - theStyleEntry++; + ++theStyleEntry; } //for } } @@ -465,12 +465,12 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const { // skip past leading and trailing quotes/etc if(kQuote==*start) { - start++; + ++start; } if(kSemicolon==theChar || kQuote == theChar) { - end--; + --end; } @@ -478,7 +478,7 @@ CNamedEntity* nsDTDContext::GetEntity(const nsAString& aName)const { PRInt32 theCount=mEntities.GetSize(); PRInt32 theIndex=0; - for(theIndex=0;theIndexmName.Equals(entityName, @@ -592,7 +592,7 @@ public: while(next<=aValue) { // scale up in baseN; exceed current value. root=next; next*=base; - expn++; + ++expn; } while(expn--) { @@ -735,7 +735,7 @@ public: int digitPos=0; int n=0; - for(digitPos=0;digitPosPush(aNode); - mResidualStyleCount++; + ++mResidualStyleCount; } } //if } @@ -1076,10 +1076,10 @@ void nsDTDContext::PushStyles(nsEntryStack *aStyles){ PRUint32 sindex=0; theEntry=aStyles->mEntries; - for(sindex=0;sindexmParent=0; //this tells us that the style is not open at any level - theEntry++; - mResidualStyleCount++; + ++theEntry; + ++mResidualStyleCount; } //for } @@ -1202,7 +1202,7 @@ nsTokenAllocator::nsTokenAllocator() { #ifdef NS_DEBUG int i=0; - for(i=0;i" << endl; out << prefix; written=0; if(theDTD.IsContainer(i)) { - for(j=1;jCount(); - for (PRInt32 j = 0; j < count; j++) { + for (PRInt32 j = 0; j < count; ++j) { nsISupports* obs = (nsISupports*)mObservers[i]->ElementAt(j); NS_IF_RELEASE(obs); } @@ -1550,7 +1550,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode, // least 2 allocations for mImpl, usually more, plus at least 1 per // string (total = 2*(keys+3) + 2(or more) array allocations )). PRInt32 index; - for (index = 0; index < theAttrCount; index++) { + for (index = 0; index < theAttrCount; ++index) { keys.AppendString(aNode->GetKeyAt(index)); values.AppendString(aNode->GetValueAt(index)); } @@ -1570,7 +1570,7 @@ nsObserverEntry::Notify(nsIParserNode* aNode, nsCOMPtr channel; aParser->GetChannel(getter_AddRefs(channel)); - for (index=0;indexElementAt(index)); if (observer) { result = observer->Notify(aWebShell, channel, @@ -1613,7 +1613,7 @@ nsObserverEntry::AddObserver(nsIElementObserver *aObserver, void nsObserverEntry::RemoveObserver(nsIElementObserver *aObserver) { - for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; i++){ + for (PRInt32 i=0; i <= NS_HTML_TAG_MAX; ++i){ if (mObservers[i]) { nsISupports* obs = aObserver; PRBool removed = mObservers[i]->RemoveElement(obs); diff --git a/parser/htmlparser/src/nsDTDUtils.h b/parser/htmlparser/src/nsDTDUtils.h index 1aaeec4b85b..8b1e4fed585 100644 --- a/parser/htmlparser/src/nsDTDUtils.h +++ b/parser/htmlparser/src/nsDTDUtils.h @@ -446,7 +446,7 @@ inline PRInt32 IndexOfTagInSet(PRInt32 aTag,const eHTMLTags* aTagSet,PRInt32 aCo if(aTag==*theTag) { return theTag-aTagSet; } - theTag++; + ++theTag; } return kNotFound; @@ -622,7 +622,7 @@ inline PRInt32 LastOf(nsDTDContext& aContext,TagList& aTagList){ inline PRInt32 FirstOf(nsDTDContext& aContext,PRInt32 aStartOffset,TagList& aTagList){ int max = aContext.GetCount(); int index; - for(index=aStartOffset;index" << endl; @@ -2322,25 +2322,25 @@ void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitl written=0; char startChar=0; if(IsContainer((eHTMLTags)i)) { - for(j=1;j // 0123456789012345678 PRUint32 i = 17; // ?> can start at position 17 at the earliest - for (; i < aLength; i++) { + for (; i < aLength; ++i) { if (aValue[i] == '?') break; } @@ -682,7 +682,7 @@ CreateSourceText(const PRInt32 aColNumber, aSourceString.Append(aSourceLine); aSourceString.Append(PRUnichar('\n')); - for (PRInt32 i = 0; i < errorPosition - 1; i++) { + for (PRInt32 i = 0; i < errorPosition - 1; ++i) { aSourceString.Append(PRUnichar('-')); } aSourceString.Append(PRUnichar('^')); diff --git a/parser/htmlparser/src/nsHTMLEntities.cpp b/parser/htmlparser/src/nsHTMLEntities.cpp index 329c2bce27c..1153cc8d00b 100644 --- a/parser/htmlparser/src/nsHTMLEntities.cpp +++ b/parser/htmlparser/src/nsHTMLEntities.cpp @@ -235,7 +235,7 @@ public: nsHTMLEntities::AddRefTable(); // Make sure we can find everything we are supposed to - for (int i = 0; i < NS_HTML_ENTITY_COUNT; i++) { + for (int i = 0; i < NS_HTML_ENTITY_COUNT; ++i) { nsAutoString entity; entity.AssignWithConversion(gEntityArray[i].mStr); value = nsHTMLEntities::EntityToUnicode(entity); diff --git a/parser/htmlparser/src/nsHTMLNullSink.cpp b/parser/htmlparser/src/nsHTMLNullSink.cpp index 8edfbdf9e42..b7227edda0b 100644 --- a/parser/htmlparser/src/nsHTMLNullSink.cpp +++ b/parser/htmlparser/src/nsHTMLNullSink.cpp @@ -153,7 +153,7 @@ nsHTMLNullSink::~nsHTMLNullSink() { #ifdef VERBOSE_DEBUG static void DebugDump(const char* str1,const nsAString& str2,PRInt32 tabs) { - for(PRInt32 i=0;iSetEmpty(isUsableAttr); } if(isUsableAttr) { - theAttrCount++; + ++theAttrCount; AddToken((CToken*&)theToken,result,&mTokenDeque,theAllocator); } else { diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp index 46b64c47674..6d007e6cbb2 100644 --- a/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/parser/htmlparser/src/nsHTMLTokens.cpp @@ -1013,7 +1013,7 @@ static PRBool IsCommentEnd( return PR_TRUE; } if (*current == PRUnichar('-')) { - dashes++; + ++dashes; } else { dashes = 0; } @@ -2028,9 +2028,9 @@ CEntityToken::ConsumeEntity(PRUnichar aChar, aString.Append(aChar); if(aChar==kRightBrace) - rightBraceCount++; + ++rightBraceCount; else if(aChar==kLeftBrace) - leftBraceCount++; + ++leftBraceCount; } while(leftBraceCount!=rightBraceCount); } //if else { diff --git a/parser/htmlparser/src/nsLoggingSink.cpp b/parser/htmlparser/src/nsLoggingSink.cpp index d0a90ae1f8a..463be53af52 100644 --- a/parser/htmlparser/src/nsLoggingSink.cpp +++ b/parser/htmlparser/src/nsLoggingSink.cpp @@ -133,7 +133,7 @@ nsLoggingSink::SetOutputStream(PRFileDesc *aStream,PRBool autoDeleteOutput) { static void WriteTabs(PRFileDesc * out,int aTabCount) { int tabs; - for(tabs=0;tabsGetCount(); PRInt32 theIndex; - for(theIndex=0;theIndexGetTokenAt(theIndex))){ //add code here to pull unwanted tokens out of the stack... } diff --git a/parser/htmlparser/src/nsParserNode.cpp b/parser/htmlparser/src/nsParserNode.cpp index 874765982bb..169df3fc469 100644 --- a/parser/htmlparser/src/nsParserNode.cpp +++ b/parser/htmlparser/src/nsParserNode.cpp @@ -86,7 +86,7 @@ nsCParserNode::nsCParserNode(CToken* aToken, MOZ_COUNT_CTOR(nsCParserNode); static int theNodeCount=0; - theNodeCount++; + ++theNodeCount; mAttributes=0; mToken=aToken; IF_HOLD(mToken); @@ -327,7 +327,7 @@ void nsCParserNode::GetSource(nsString& aString) { } if(mAttributes) { int index=0; - for(index=0;indexGetSize();index++) { + for(index=0;indexGetSize();++index) { CAttributeToken *theToken=(CAttributeToken*)mAttributes->ObjectAt(index); if(theToken) { theToken->AppendSourceTo(aString); diff --git a/parser/htmlparser/src/nsParserService.cpp b/parser/htmlparser/src/nsParserService.cpp index 4ffd43b00c9..aeba847bd0d 100644 --- a/parser/htmlparser/src/nsParserService.cpp +++ b/parser/htmlparser/src/nsParserService.cpp @@ -148,7 +148,7 @@ nsParserService::RegisterObserver(nsIElementObserver* aObserver, if(*aTags != eHTMLTag_userdefined && *aTags <= NS_HTML_TAG_MAX) { entry->AddObserver(aObserver,*aTags); } - aTags++; + ++aTags; } return result; @@ -160,7 +160,7 @@ nsParserService::UnregisterObserver(nsIElementObserver* aObserver, { PRInt32 count = mEntries.GetSize(); - for (PRInt32 i=0; i < count; i++) { + for (PRInt32 i=0; i < count; ++i) { nsObserverEntry* entry = NS_STATIC_CAST(nsObserverEntry*,mEntries.ObjectAt(i)); if (entry && entry->Matches(aTopic)) { entry->RemoveObserver(aObserver); diff --git a/parser/htmlparser/src/nsScanner.cpp b/parser/htmlparser/src/nsScanner.cpp index 4ffdcdce0ce..29d7b140e07 100644 --- a/parser/htmlparser/src/nsScanner.cpp +++ b/parser/htmlparser/src/nsScanner.cpp @@ -356,7 +356,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){ srcLength = aLen; } else { - srcLength++; + ++srcLength; } aBuffer += srcLength; @@ -480,7 +480,7 @@ nsresult nsScanner::GetChar(PRUnichar& aChar) { if(NS_OK == result){ aChar=*mCurrentPosition++; - mCountRemaining--; + --mCountRemaining; } return result; } @@ -581,7 +581,7 @@ nsresult nsScanner::SkipWhitespace(PRInt32& aNewlinesSkipped) { while (!done && current != mEndPosition) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': @@ -1048,7 +1048,7 @@ nsresult nsScanner::ReadWhitespace(nsString& aString, while(!done && current != end) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': @@ -1102,7 +1102,7 @@ nsresult nsScanner::ReadWhitespace(nsReadingIterator& aStart, while(!done && current != end) { switch(theChar) { case '\n': - case '\r': aNewlinesSkipped++; + case '\r': ++aNewlinesSkipped; case ' ' : case '\b': case '\t': diff --git a/parser/htmlparser/src/nsToken.cpp b/parser/htmlparser/src/nsToken.cpp index 09bf7d66b90..2eedff1650b 100644 --- a/parser/htmlparser/src/nsToken.cpp +++ b/parser/htmlparser/src/nsToken.cpp @@ -77,7 +77,7 @@ CToken::CToken(PRInt32 aTag) { mUseCount=1; #ifdef NS_DEBUG - TokenCount++; + ++TokenCount; #endif } @@ -92,7 +92,7 @@ CToken::~CToken() { #ifdef MATCH_CTOR_DTOR MOZ_COUNT_DTOR(CToken); #endif - DelTokenCount++; + ++DelTokenCount; mUseCount=0; } @@ -124,7 +124,7 @@ void CToken::DebugDumpToken(nsOutputStream& anOutputStream) { anOutputStream << "[" << GetClassName() << "] "; PRUint32 i=0; PRUint32 theLen=GetStringValue().Length(); - for(i=0;iPeekToken(); if(theToken) { eHTMLTokenTypes theType=eHTMLTokenTypes(theToken->GetTokenType()); @@ -1047,7 +1047,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_start: { - mTagCount++; + ++mTagCount; const nsAString& startValue = aToken->GetStringValue(); result=WriteTag(mStartTag,startValue,aToken->GetAttributeCount(),PR_TRUE); @@ -1107,9 +1107,9 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { case eToken_newline: { const nsAString& newlineValue = aToken->GetStringValue(); - mLineNumber++; + ++mLineNumber; result=WriteTag(mText,newlineValue,0,PR_FALSE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK) StartNewPreBlock(); @@ -1120,7 +1120,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { { const nsAString& wsValue = aToken->GetStringValue(); result=WriteTag(mText,wsValue,0,PR_FALSE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !wsValue.IsEmpty()) { @@ -1135,7 +1135,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { { const nsAString& str = aToken->GetStringValue(); result=WriteTag(mText,str,aToken->GetAttributeCount(),PR_TRUE); - mTokenCount++; + ++mTokenCount; if (NS_VIEWSOURCE_TOKENS_PER_BLOCK > 0 && mTokenCount > NS_VIEWSOURCE_TOKENS_PER_BLOCK && !str.IsEmpty()) { PRUnichar ch = str.Last(); diff --git a/parser/htmlparser/tests/grabpage/grabpage.cpp b/parser/htmlparser/tests/grabpage/grabpage.cpp index 1c412e4d3b8..37b6e65a0c1 100644 --- a/parser/htmlparser/tests/grabpage/grabpage.cpp +++ b/parser/htmlparser/tests/grabpage/grabpage.cpp @@ -209,7 +209,7 @@ PageGrabber::NextFile(const char* aExtension) struct stat sb; int s = stat(cname, &sb); if (s < 0) { - mFileNum++; + ++mFileNum; break; } else { diff --git a/parser/htmlparser/tests/htmlgen/htmlgen.cpp b/parser/htmlparser/tests/htmlgen/htmlgen.cpp index 91409cfaf24..de426e7fd46 100644 --- a/parser/htmlparser/tests/htmlgen/htmlgen.cpp +++ b/parser/htmlparser/tests/htmlgen/htmlgen.cpp @@ -388,7 +388,7 @@ void expandMacros(char* aBuffer,CMacros& aMacroSet){ while(aBuffer[++rPos]){ if('$'==aBuffer[rPos]){ temp[wPos]=0; - rPos++; //skip the $... + ++rPos; //skip the $... int theIndex=aBuffer[rPos]-'0'; char* theMacro=aMacroSet.getMacro(theIndex); if(theMacro){