remove imap parser method at_end_of_line, patch by Hans-a.Engel@unibas.ch, r/sr=bienvenu

This commit is contained in:
bienvenu%nventure.com 2005-09-30 14:25:42 +00:00
parent a1e63a999b
commit 2ab19239ae
3 changed files with 19 additions and 25 deletions

View File

@ -124,15 +124,9 @@ PRBool nsIMAPGenericParser::ContinueParse()
return !fSyntaxError && !fDisconnected;
}
PRBool nsIMAPGenericParser::at_end_of_line()
{
return (fAtEndOfLine || (nsCRT::strcmp(fNextToken, CRLF) == 0));
}
void nsIMAPGenericParser::skip_to_CRLF()
{
while (Connected() && !at_end_of_line())
while (Connected() && !fAtEndOfLine)
AdvanceToNextToken();
}
@ -207,6 +201,7 @@ void nsIMAPGenericParser::AdvanceToNextLine()
fStartOfLineOfTokens = nsnull;
fLineOfTokens = nsnull;
fCurrentTokenPlaceHolder = nsnull;
fAtEndOfLine = PR_TRUE;
fNextToken = CRLF;
}
else if (fCurrentLine) // might be NULL if we are would_block ?
@ -480,7 +475,7 @@ char *nsIMAPGenericParser::CreateLiteral()
// next line to ensure that the next call to AdvanceToNextToken()
// would lead to fNextToken=="A3" in our example.
// Note that setting fAtEndOfLine=PR_TRUE is wrong here, since the "\r\n"
// were just some characters from the literal; at_end_of_line() would
// were just some characters from the literal; fAtEndOfLine would
// give a misleading result.
AdvanceToNextLine();
AdvanceTokenizerStartingPoint(0);

View File

@ -89,7 +89,6 @@ protected:
virtual char *CreateQuoted(PRBool skipToEnd = PR_TRUE);
virtual char *CreateParenGroup();
virtual void SetSyntaxError(PRBool error);
virtual PRBool at_end_of_line();
void AdvanceToNextToken();
void AdvanceToNextLine();

View File

@ -142,7 +142,7 @@ void nsImapServerResponseParser::end_of_line()
{
// if current commands failed, don't reset the lex analyzer
// we need the info for the user
if (!at_end_of_line())
if (!fAtEndOfLine)
SetSyntaxError(PR_TRUE);
else if (fProcessingTaggedResponse && !fCurrentCommandFailed)
ResetLexAnalyzer(); // no more tokens until we send a command
@ -613,7 +613,7 @@ void nsImapServerResponseParser::response_data(PRBool advanceToNextLine)
PL_strfree( mailboxName);
}
while ( ContinueParse() &&
!at_end_of_line() )
!fAtEndOfLine )
{
AdvanceToNextToken();
if (!fNextToken)
@ -670,7 +670,7 @@ void nsImapServerResponseParser::response_data(PRBool advanceToNextLine)
}
else if (*fNextToken == ')')
break;
else if (!at_end_of_line())
else if (!fAtEndOfLine)
SetSyntaxError(PR_TRUE);
}
} else SetSyntaxError(PR_TRUE);
@ -735,7 +735,7 @@ void nsImapServerResponseParser::response_data(PRBool advanceToNextLine)
if (customCommand.Equals(fNextToken))
{
nsCAutoString customCommandResponse;
while (Connected() && !at_end_of_line())
while (Connected() && !fAtEndOfLine)
{
AdvanceToNextToken();
customCommandResponse.Append(fNextToken);
@ -1807,7 +1807,7 @@ void nsImapServerResponseParser::parse_folder_flags()
fSupportsUserDefinedFlags |= kImapMsgSupportMDNSentFlag;
fSupportsUserDefinedFlags |= kImapMsgLabelFlags;
}
} while (!at_end_of_line() && ContinueParse());
} while (!fAtEndOfLine && ContinueParse());
if (labelFlags == 31)
fSupportsUserDefinedFlags |= kImapMsgLabelFlags;
@ -1962,7 +1962,7 @@ void nsImapServerResponseParser::resp_text_code()
do
{
AdvanceToNextToken();
} while (!PL_strcasestr(fNextToken, "]") && !at_end_of_line()
} while (!PL_strcasestr(fNextToken, "]") && !fAtEndOfLine
&& ContinueParse());
}
}
@ -2187,7 +2187,7 @@ void nsImapServerResponseParser::capability_data()
fCapabilityFlag |= kHasIdleCapability;
}
} while (fNextToken &&
!at_end_of_line() &&
!fAtEndOfLine &&
ContinueParse());
if (fHostSessionList)
@ -2226,7 +2226,7 @@ void nsImapServerResponseParser::xmailboxinfo_data()
// ignore this for now...
}
}
} while (fNextToken && !at_end_of_line() && ContinueParse());
} while (fNextToken && !fAtEndOfLine && ContinueParse());
}
}
@ -2252,7 +2252,7 @@ void nsImapServerResponseParser::xserverinfo_data()
AdvanceToNextToken();
fManageFiltersUrl = CreateNilString();
}
} while (fNextToken && !at_end_of_line() && ContinueParse());
} while (fNextToken && !fAtEndOfLine && ContinueParse());
}
void nsImapServerResponseParser::language_data()
@ -2265,7 +2265,7 @@ void nsImapServerResponseParser::language_data()
{
// eat each language returned to us
AdvanceToNextToken();
} while (fNextToken && !at_end_of_line() && ContinueParse());
} while (fNextToken && !fAtEndOfLine && ContinueParse());
}
// cram/auth response data ::= "+" SPACE challenge CRLF
@ -2289,7 +2289,7 @@ void nsImapServerResponseParser::namespace_data()
while ((namespaceType != kUnknownNamespace) && ContinueParse())
{
AdvanceToNextToken();
while (at_end_of_line() && ContinueParse())
while (fAtEndOfLine && ContinueParse())
AdvanceToNextToken();
if (!PL_strcasecmp(fNextToken,"NIL"))
{
@ -2395,7 +2395,7 @@ void nsImapServerResponseParser::namespace_data()
void nsImapServerResponseParser::myrights_data()
{
AdvanceToNextToken();
if (ContinueParse() && !at_end_of_line())
if (ContinueParse() && !fAtEndOfLine)
{
char *mailboxName = CreateAstring(); // PL_strdup(fNextToken);
if (mailboxName)
@ -2435,13 +2435,13 @@ void nsImapServerResponseParser::myrights_data()
void nsImapServerResponseParser::acl_data()
{
AdvanceToNextToken();
if (ContinueParse() && !at_end_of_line())
if (ContinueParse() && !fAtEndOfLine)
{
char *mailboxName = CreateAstring(); // PL_strdup(fNextToken);
if (mailboxName && ContinueParse())
{
AdvanceToNextToken();
while (ContinueParse() && !at_end_of_line())
while (ContinueParse() && !fAtEndOfLine)
{
char *userName = CreateAstring(); // PL_strdup(fNextToken);
if (userName && ContinueParse())
@ -2598,7 +2598,7 @@ void nsImapServerResponseParser::quota_data()
AdvanceToNextToken();
quotaroot.Adopt(CreateAstring());
}
while (ContinueParse() && !at_end_of_line());
while (ContinueParse() && !fAtEndOfLine);
}
else if(!PL_strcasecmp(fNextToken, "QUOTA"))
{
@ -2612,7 +2612,7 @@ void nsImapServerResponseParser::quota_data()
{
quotaroot.Adopt(CreateAstring());
if(ContinueParse() && !at_end_of_line())
if(ContinueParse() && !fAtEndOfLine)
{
AdvanceToNextToken();
if(fNextToken)