summaryrefslogtreecommitdiffstats
path: root/mailnews/imap/src
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/imap/src')
-rw-r--r--mailnews/imap/src/nsImapServerResponseParser.cpp18
-rw-r--r--mailnews/imap/src/nsImapServerResponseParser.h3
2 files changed, 12 insertions, 9 deletions
diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp
index b534c4d5b..fb51db217 100644
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -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;
}
diff --git a/mailnews/imap/src/nsImapServerResponseParser.h b/mailnews/imap/src/nsImapServerResponseParser.h
index fb5762b6b..4a21de905 100644
--- a/mailnews/imap/src/nsImapServerResponseParser.h
+++ b/mailnews/imap/src/nsImapServerResponseParser.h
@@ -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;