From 8262e57ceb5cd1b09365953eec0212b498ee9b32 Mon Sep 17 00:00:00 2001 From: "bienvenu%nventure.com" Date: Fri, 30 Sep 2005 14:25:42 +0000 Subject: [PATCH] remove imap parser method at_end_of_line, patch by Hans-a.Engel@unibas.ch, r/sr=bienvenu --- mailnews/imap/src/nsIMAPGenericParser.cpp | 11 ++----- mailnews/imap/src/nsIMAPGenericParser.h | 1 - .../imap/src/nsImapServerResponseParser.cpp | 32 +++++++++---------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/mailnews/imap/src/nsIMAPGenericParser.cpp b/mailnews/imap/src/nsIMAPGenericParser.cpp index e98d901f18f..e1f6895a46b 100644 --- a/mailnews/imap/src/nsIMAPGenericParser.cpp +++ b/mailnews/imap/src/nsIMAPGenericParser.cpp @@ -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); diff --git a/mailnews/imap/src/nsIMAPGenericParser.h b/mailnews/imap/src/nsIMAPGenericParser.h index a30b9411d06..2ada0f15f18 100644 --- a/mailnews/imap/src/nsIMAPGenericParser.h +++ b/mailnews/imap/src/nsIMAPGenericParser.h @@ -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(); diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp index 54c740953e5..37d0c81ad85 100644 --- a/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -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)