fixed build warnings and eliminated a few bugs

This commit is contained in:
rickg%netscape.com 1999-07-17 10:06:04 +00:00
parent d9e8081acc
commit dc3f0c0ad0
8 changed files with 58 additions and 14 deletions

View File

@ -370,7 +370,7 @@ void CNavDTD::RecycleNode(nsCParserNode* aNode) {
if(aNode) {
CToken* theToken=0;
while(theToken=(CToken*)aNode->PopAttributeToken()){
while(theToken=((CToken*)aNode->PopAttributeToken())){
gRecycler->RecycleToken(theToken);
}
@ -402,7 +402,7 @@ CNavDTD::~CNavDTD(){
if(mTokenizer)
delete (nsHTMLTokenizer*)mTokenizer;
nsCParserNode* theNode=0;
while(theNode=(nsCParserNode*)mSharedNodes.Pop()){
while(theNode=((nsCParserNode*)mSharedNodes.Pop())){
delete theNode;
}
NS_IF_RELEASE(mDTDDebug);
@ -815,6 +815,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
* @param eHTMLTags tag to be searched for in stack
* @return topmost index of tag on stack
*/
#if 0
static
PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) {
int i=0;
@ -825,7 +826,7 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) {
}
return kNotFound;
}
#endif
/**
* Call this to find the index of a given child, or (if not found)

View File

@ -111,6 +111,7 @@ static RTFEntry gRTFTable[] = {
* @param
* @return
*/
#if 0
static
const char* GetTagName(eRTFTags aTag) {
PRInt32 cnt=sizeof(gRTFTable)/sizeof(RTFEntry);
@ -128,6 +129,7 @@ const char* GetTagName(eRTFTags aTag) {
}
return "";
}
#endif
/**
* This method gets called as part of our COM-like interfaces.

View File

@ -55,7 +55,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) {
CToken* theToken=0;
if(aRecycler) {
while(theToken=(CToken*)aDeque.Pop()){
while(theToken=((CToken*)aDeque.Pop())){
aRecycler->RecycleToken(theToken);
}
}

View File

@ -194,6 +194,11 @@ static void SetFont(const char* aFace,const char* aSize,PRBool aEnable,nsIConten
theNode.Init(theToken,0);
aSink.CloseContainer(theNode);
}
while(theToken=((CToken*)theNode.PopAttributeToken())){
//dump the attributes since they're on the stack...
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
@ -213,12 +218,17 @@ static void SetColor(const char* aColor,PRBool aEnable,nsIContentSink& aSink) {
theNode.Init(theToken,0);
aSink.CloseContainer(theNode);
}
while(theToken=((CToken*)theNode.PopAttributeToken())){
//dump the attributes since they're on the stack...
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) {
nsCParserNode theNode;
static nsCParserNode theNode;
CToken* theToken=0;
if(aEnable){
theToken=gTokenRecycler->CreateTokenOfType(eToken_start,theTag);
@ -230,6 +240,7 @@ static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) {
theNode.Init(theToken);
aSink.CloseContainer(theNode);
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
@ -340,9 +351,12 @@ NS_IMETHODIMP CViewSourceHTML::WillBuildModel(nsString& aFilename,PRBool aNotify
//now let's automatically open the body...
CStartToken theBodyToken(eHTMLTag_body);
theNode.Init(&theBodyToken,0);
CAttributeToken theColor("bgcolor","white");
theNode.AddAttribute(&theColor);
mSink->OpenBody(theNode);
//now let's automatically open the body...
//now let's automatically open the pre...
if(mIsPlaintext) {
CStartToken thePREToken(eHTMLTag_pre);
theNode.Init(&thePREToken,0);
@ -897,7 +911,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
case eToken_instruction:
{
if(!mIsPlaintext){
SetColor("orange",PR_TRUE,*mSink);
SetColor("#D74702",PR_TRUE,*mSink);
SetStyle(eHTMLTag_i,PR_TRUE,*mSink);
}
@ -964,6 +978,11 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
default:
result=NS_OK;
}//switch
while(theContext.mTokenNode.PopAttributeToken()){
//dump the attributes since they're on the stack...
}
return result;
}

View File

@ -370,7 +370,7 @@ void CNavDTD::RecycleNode(nsCParserNode* aNode) {
if(aNode) {
CToken* theToken=0;
while(theToken=(CToken*)aNode->PopAttributeToken()){
while(theToken=((CToken*)aNode->PopAttributeToken())){
gRecycler->RecycleToken(theToken);
}
@ -402,7 +402,7 @@ CNavDTD::~CNavDTD(){
if(mTokenizer)
delete (nsHTMLTokenizer*)mTokenizer;
nsCParserNode* theNode=0;
while(theNode=(nsCParserNode*)mSharedNodes.Pop()){
while(theNode=((nsCParserNode*)mSharedNodes.Pop())){
delete theNode;
}
NS_IF_RELEASE(mDTDDebug);
@ -815,6 +815,7 @@ nsresult CNavDTD::DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag){
* @param eHTMLTags tag to be searched for in stack
* @return topmost index of tag on stack
*/
#if 0
static
PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) {
int i=0;
@ -825,7 +826,7 @@ PRInt32 GetTopmostIndexOf(eHTMLTags aTag,nsEntryStack& aTagStack) {
}
return kNotFound;
}
#endif
/**
* Call this to find the index of a given child, or (if not found)

View File

@ -111,6 +111,7 @@ static RTFEntry gRTFTable[] = {
* @param
* @return
*/
#if 0
static
const char* GetTagName(eRTFTags aTag) {
PRInt32 cnt=sizeof(gRTFTable)/sizeof(RTFEntry);
@ -128,6 +129,7 @@ const char* GetTagName(eRTFTags aTag) {
}
return "";
}
#endif
/**
* This method gets called as part of our COM-like interfaces.

View File

@ -55,7 +55,7 @@ nsCParserNode::nsCParserNode(CToken* aToken,PRInt32 aLineNumber,nsITokenRecycler
static void RecycleTokens(nsITokenRecycler* aRecycler,nsDeque& aDeque) {
CToken* theToken=0;
if(aRecycler) {
while(theToken=(CToken*)aDeque.Pop()){
while(theToken=((CToken*)aDeque.Pop())){
aRecycler->RecycleToken(theToken);
}
}

View File

@ -194,6 +194,11 @@ static void SetFont(const char* aFace,const char* aSize,PRBool aEnable,nsIConten
theNode.Init(theToken,0);
aSink.CloseContainer(theNode);
}
while(theToken=((CToken*)theNode.PopAttributeToken())){
//dump the attributes since they're on the stack...
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
@ -213,12 +218,17 @@ static void SetColor(const char* aColor,PRBool aEnable,nsIContentSink& aSink) {
theNode.Init(theToken,0);
aSink.CloseContainer(theNode);
}
while(theToken=((CToken*)theNode.PopAttributeToken())){
//dump the attributes since they're on the stack...
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) {
nsCParserNode theNode;
static nsCParserNode theNode;
CToken* theToken=0;
if(aEnable){
theToken=gTokenRecycler->CreateTokenOfType(eToken_start,theTag);
@ -230,6 +240,7 @@ static void SetStyle(eHTMLTags theTag,PRBool aEnable,nsIContentSink& aSink) {
theNode.Init(theToken);
aSink.CloseContainer(theNode);
}
if(theToken)
gTokenRecycler->RecycleToken(theToken);
}
@ -340,9 +351,12 @@ NS_IMETHODIMP CViewSourceHTML::WillBuildModel(nsString& aFilename,PRBool aNotify
//now let's automatically open the body...
CStartToken theBodyToken(eHTMLTag_body);
theNode.Init(&theBodyToken,0);
CAttributeToken theColor("bgcolor","white");
theNode.AddAttribute(&theColor);
mSink->OpenBody(theNode);
//now let's automatically open the body...
//now let's automatically open the pre...
if(mIsPlaintext) {
CStartToken thePREToken(eHTMLTag_pre);
theNode.Init(&thePREToken,0);
@ -897,7 +911,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
case eToken_instruction:
{
if(!mIsPlaintext){
SetColor("orange",PR_TRUE,*mSink);
SetColor("#D74702",PR_TRUE,*mSink);
SetStyle(eHTMLTag_i,PR_TRUE,*mSink);
}
@ -964,6 +978,11 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
default:
result=NS_OK;
}//switch
while(theContext.mTokenNode.PopAttributeToken()){
//dump the attributes since they're on the stack...
}
return result;
}