mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 09:57:32 +09:00
Bug 145113 - Make "next chunk starts with newline" flag a member variable to fix MOZ_ASSERT().
Tag #1273
This commit is contained in:
parent
3f68fdb0f4
commit
791626aab1
2 changed files with 12 additions and 9 deletions
|
|
@ -36,6 +36,7 @@ nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProto
|
|||
fSelectedMailboxName(nullptr),
|
||||
fIMAPstate(kNonAuthenticated),
|
||||
fLastChunk(false),
|
||||
fNextChunkStartsWithNewline(false),
|
||||
fServerConnection(imapProtocolConnection),
|
||||
fHostSessionList(nullptr)
|
||||
{
|
||||
|
|
@ -3110,7 +3111,6 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
#endif
|
||||
|
||||
charsReadSoFar = 0;
|
||||
static bool nextChunkStartsWithNewline = false;
|
||||
|
||||
while (ContinueParse() && !fServerConnection.DeathSignalReceived() && (charsReadSoFar < numberOfCharsInThisChunk))
|
||||
{
|
||||
|
|
@ -3125,7 +3125,7 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
// '\r' is not inserted so the beginning line of the next chunk remains
|
||||
// just '\n' and no discard is required.
|
||||
// In any case, this "orphan" line is ignored and not processed below.
|
||||
if (nextChunkStartsWithNewline && (*fCurrentLine == '\r'))
|
||||
if (fNextChunkStartsWithNewline && (*fCurrentLine == '\r'))
|
||||
{
|
||||
// Cause fCurrentLine to point to '\n' which discards the '\r'.
|
||||
char *usableCurrentLine = PL_strdup(fCurrentLine + 1);
|
||||
|
|
@ -3190,11 +3190,11 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
(fCurrentLine + strlen(fCurrentLine) - (charsReadSoFar - numberOfCharsInThisChunk + 1));
|
||||
// Save so original unmodified fCurrentLine is restored below.
|
||||
char saveit1 = displayEndOfLine[1];
|
||||
char saveit2;
|
||||
char saveit2 = 0; // Keep compiler happy.
|
||||
// Determine if EOL is split such that Chunk X has the \r and chunk
|
||||
// X+1 has the \n.
|
||||
nextChunkStartsWithNewline = (displayEndOfLine[0] == '\r');
|
||||
if (nextChunkStartsWithNewline)
|
||||
fNextChunkStartsWithNewline = (displayEndOfLine[0] == '\r');
|
||||
if (fNextChunkStartsWithNewline)
|
||||
{
|
||||
saveit2 = displayEndOfLine[2];
|
||||
// Add the missing newline and terminate the string.
|
||||
|
|
@ -3212,13 +3212,13 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
fServerConnection.HandleMessageDownLoadLine(fCurrentLine, !lastChunk);
|
||||
// Restore fCurrentLine's original content.
|
||||
displayEndOfLine[1] = saveit1;
|
||||
if (nextChunkStartsWithNewline)
|
||||
if (fNextChunkStartsWithNewline)
|
||||
displayEndOfLine[2] = saveit2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not the last line of a chunk.
|
||||
if (!nextChunkStartsWithNewline)
|
||||
if (!fNextChunkStartsWithNewline)
|
||||
{
|
||||
// Process unmodified fCurrentLine string.
|
||||
fServerConnection.HandleMessageDownLoadLine(fCurrentLine,
|
||||
|
|
@ -3230,7 +3230,7 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
// Ignore the orphan '\n' on a line by itself.
|
||||
MOZ_ASSERT(strlen(fCurrentLine) == 1 && fCurrentLine[0] == '\n',
|
||||
"Expect '\n' as only character in this line");
|
||||
nextChunkStartsWithNewline = false;
|
||||
fNextChunkStartsWithNewline = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3253,7 +3253,7 @@ bool nsImapServerResponseParser::msg_fetch_literal(bool chunk, int32_t origin)
|
|||
}
|
||||
else
|
||||
{
|
||||
nextChunkStartsWithNewline = false;
|
||||
fNextChunkStartsWithNewline = false;
|
||||
}
|
||||
return lastChunk;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,6 +256,9 @@ private:
|
|||
int32_t charsReadSoFar;
|
||||
bool fLastChunk;
|
||||
|
||||
// Flags split of \r and \n between chunks in msg_fetch_literal().
|
||||
bool fNextChunkStartsWithNewline;
|
||||
|
||||
// points to the current body shell, if any
|
||||
RefPtr<nsIMAPBodyShell> m_shell;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue