зеркало из https://github.com/mozilla/pjs.git
cleanup imap parser syntax error line handling a little, 312572, r/sr=bienvenu
This commit is contained in:
Родитель
ea2955ba39
Коммит
ad2a41ccbc
|
@ -53,7 +53,6 @@ fLineOfTokens(nsnull),
|
||||||
fStartOfLineOfTokens(nsnull),
|
fStartOfLineOfTokens(nsnull),
|
||||||
fCurrentTokenPlaceHolder(nsnull),
|
fCurrentTokenPlaceHolder(nsnull),
|
||||||
fAtEndOfLine(PR_FALSE),
|
fAtEndOfLine(PR_FALSE),
|
||||||
fSyntaxErrorLine(nsnull),
|
|
||||||
fSyntaxError(PR_FALSE),
|
fSyntaxError(PR_FALSE),
|
||||||
fDisconnected(PR_FALSE)
|
fDisconnected(PR_FALSE)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +62,6 @@ nsIMAPGenericParser::~nsIMAPGenericParser()
|
||||||
{
|
{
|
||||||
PR_FREEIF( fCurrentLine );
|
PR_FREEIF( fCurrentLine );
|
||||||
PR_FREEIF( fStartOfLineOfTokens);
|
PR_FREEIF( fStartOfLineOfTokens);
|
||||||
PR_FREEIF( fSyntaxErrorLine );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsIMAPGenericParser::HandleMemoryFailure()
|
void nsIMAPGenericParser::HandleMemoryFailure()
|
||||||
|
@ -88,21 +86,8 @@ PRBool nsIMAPGenericParser::LastCommandSuccessful()
|
||||||
void nsIMAPGenericParser::SetSyntaxError(PRBool error)
|
void nsIMAPGenericParser::SetSyntaxError(PRBool error)
|
||||||
{
|
{
|
||||||
fSyntaxError = error;
|
fSyntaxError = error;
|
||||||
PR_FREEIF( fSyntaxErrorLine );
|
NS_ASSERTION(!error, "syntax error in generic parser");
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
NS_ASSERTION(PR_FALSE, "syntax error in generic parser");
|
|
||||||
fSyntaxErrorLine = PL_strdup(fCurrentLine);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
fSyntaxErrorLine = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *nsIMAPGenericParser::CreateSyntaxErrorLine()
|
|
||||||
{
|
|
||||||
return PL_strdup(fSyntaxErrorLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PRBool nsIMAPGenericParser::SyntaxError()
|
PRBool nsIMAPGenericParser::SyntaxError()
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,8 +66,6 @@ public:
|
||||||
PRBool Connected();
|
PRBool Connected();
|
||||||
virtual void SetConnected(PRBool error);
|
virtual void SetConnected(PRBool error);
|
||||||
|
|
||||||
char *CreateSyntaxErrorLine();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// This is a pure virtual member which must be overridden in the derived class
|
// This is a pure virtual member which must be overridden in the derived class
|
||||||
|
@ -103,8 +101,6 @@ protected:
|
||||||
char *fStartOfLineOfTokens;
|
char *fStartOfLineOfTokens;
|
||||||
char *fCurrentTokenPlaceHolder;
|
char *fCurrentTokenPlaceHolder;
|
||||||
PRBool fAtEndOfLine;
|
PRBool fAtEndOfLine;
|
||||||
|
|
||||||
char *fSyntaxErrorLine;
|
|
||||||
PRBool fSyntaxError;
|
PRBool fSyntaxError;
|
||||||
private:
|
private:
|
||||||
PRBool fDisconnected;
|
PRBool fDisconnected;
|
||||||
|
|
|
@ -2928,17 +2928,17 @@ void nsImapServerResponseParser::SetSyntaxError(PRBool error)
|
||||||
nsIMAPGenericParser::SetSyntaxError(error);
|
nsIMAPGenericParser::SetSyntaxError(error);
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
if (!fSyntaxErrorLine)
|
if (!fCurrentLine)
|
||||||
{
|
{
|
||||||
HandleMemoryFailure();
|
HandleMemoryFailure();
|
||||||
fServerConnection.Log("PARSER", ("Internal Syntax Error: <no line>"), nsnull);
|
fServerConnection.Log("PARSER", ("Internal Syntax Error: <no line>"), nsnull);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!nsCRT::strcmp(fSyntaxErrorLine, CRLF))
|
if (!nsCRT::strcmp(fCurrentLine, CRLF))
|
||||||
fServerConnection.Log("PARSER", "Internal Syntax Error: <CRLF>", nsnull);
|
fServerConnection.Log("PARSER", "Internal Syntax Error: <CRLF>", nsnull);
|
||||||
else
|
else
|
||||||
fServerConnection.Log("PARSER", "Internal Syntax Error: %s", fSyntaxErrorLine);
|
fServerConnection.Log("PARSER", "Internal Syntax Error: %s", fCurrentLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче