зеркало из https://github.com/mozilla/pjs.git
fix imap parser problem with quoted strings with escape characters, this caused some messages not to load r/a=sspitzer, sr=mscott 195645
This commit is contained in:
Родитель
372fcfee78
Коммит
faadc51d09
|
@ -76,7 +76,7 @@ char *strtoken_r(char ** stringp, const char *delim, int skip)
|
|||
/*
|
||||
* Skip (span) leading delimiters (s += strspn(s, delim)).
|
||||
*/
|
||||
cont:
|
||||
cont:
|
||||
c = *s;
|
||||
for (spanp = delim; (sc = *spanp++) != 0;) {
|
||||
if (c == sc) {
|
||||
|
@ -125,16 +125,16 @@ char *strtoken_r(char ** stringp, const char *delim, int skip)
|
|||
|
||||
|
||||
nsIMAPGenericParser::nsIMAPGenericParser() :
|
||||
fNextToken(nsnull),
|
||||
fCurrentLine(nsnull),
|
||||
fLineOfTokens(nsnull),
|
||||
fStartOfLineOfTokens(nsnull),
|
||||
fCurrentTokenPlaceHolder(nsnull),
|
||||
fAtEndOfLine(PR_FALSE),
|
||||
fTokenizerAdvanced(PR_FALSE),
|
||||
fSyntaxErrorLine(nsnull),
|
||||
fSyntaxError(PR_FALSE),
|
||||
fDisconnected(PR_FALSE)
|
||||
fNextToken(nsnull),
|
||||
fCurrentLine(nsnull),
|
||||
fLineOfTokens(nsnull),
|
||||
fStartOfLineOfTokens(nsnull),
|
||||
fCurrentTokenPlaceHolder(nsnull),
|
||||
fAtEndOfLine(PR_FALSE),
|
||||
fTokenizerAdvanced(PR_FALSE),
|
||||
fSyntaxErrorLine(nsnull),
|
||||
fSyntaxError(PR_FALSE),
|
||||
fDisconnected(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ char *nsIMAPGenericParser::CreateQuoted(PRBool /*skipToEnd*/)
|
|||
+ 1; // one char past opening '"'
|
||||
|
||||
int charIndex = 0;
|
||||
int tokenIndex = 0;
|
||||
int escapeCharsCut = 0;
|
||||
PRBool closeQuoteFound = PR_FALSE;
|
||||
nsCString returnString(currentChar);
|
||||
|
||||
|
@ -468,7 +468,7 @@ char *nsIMAPGenericParser::CreateQuoted(PRBool /*skipToEnd*/)
|
|||
charIndex++;
|
||||
|
||||
// account for charIndex not reflecting the eat of the escape character
|
||||
tokenIndex++;
|
||||
escapeCharsCut++;
|
||||
}
|
||||
else
|
||||
charIndex++;
|
||||
|
@ -491,13 +491,13 @@ char *nsIMAPGenericParser::CreateQuoted(PRBool /*skipToEnd*/)
|
|||
// fCurrentTokenPlaceHolder -= charDiff;
|
||||
// if (!nsCRT::strcmp(fCurrentTokenPlaceHolder, CRLF))
|
||||
// fAtEndOfLine = PR_TRUE;
|
||||
AdvanceTokenizerStartingPoint ((fNextToken - fLineOfTokens) + returnString.Length() + 2);
|
||||
AdvanceTokenizerStartingPoint ((fNextToken - fLineOfTokens) + returnString.Length() + escapeCharsCut + 2);
|
||||
if (!nsCRT::strcmp(fLineOfTokens, CRLF))
|
||||
fAtEndOfLine = PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
fCurrentTokenPlaceHolder += tokenIndex + charIndex + 1 - strlen(fNextToken);
|
||||
fCurrentTokenPlaceHolder += escapeCharsCut + charIndex + 1 - strlen(fNextToken);
|
||||
if (!*fCurrentTokenPlaceHolder)
|
||||
*fCurrentTokenPlaceHolder = ' '; // put the token delimiter back
|
||||
/* if (!nsCRT::strcmp(fNextToken, CRLF))
|
||||
|
|
Загрузка…
Ссылка в новой задаче