Bug 1516320 - Follow-up: Initialise IsQP member variable where appropriate. r=darktrojan DONTBUILD
authorJorg K <jorgk@jorgk.com>
Thu, 27 Dec 2018 09:59:00 +0100
changeset 33209 b3f44f8462f9
parent 33208 e8fcc4360ac4
child 33210 9fe194930e8d
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1516320
Bug 1516320 - Follow-up: Initialise IsQP member variable where appropriate. r=darktrojan DONTBUILD
mailnews/base/search/src/nsMsgBodyHandler.cpp
--- a/mailnews/base/search/src/nsMsgBodyHandler.cpp
+++ b/mailnews/base/search/src/nsMsgBodyHandler.cpp
@@ -71,16 +71,17 @@ nsMsgBodyHandler::nsMsgBodyHandler(nsIMs
 
 void nsMsgBodyHandler::Initialize()
 // common initialization code regardless of what body type we are handling...
 {
   // Default transformations for local message search and MAPI access
   m_stripHeaders = true;
   m_partIsHtml = false;
   m_base64part = false;
+  m_partIsQP = false;
   m_isMultipart = false;
   m_partIsText = true; // Default is text/plain, maybe proven otherwise later.
   m_pastMsgHeaders = false;
   m_pastPartHeaders = false;
   m_inMessageAttachment = false;
   m_headerBytesRead = 0;
 }
 
@@ -314,16 +315,18 @@ int32_t nsMsgBodyHandler::ApplyTransform
     // Get ready to sniff new part headers, but do not reset m_pastMsgHeaders
     // since it will screw the body line count.
     m_pastPartHeaders = false;
     m_partIsHtml = false;
     // If we ever see a multipart message, each part needs to set 'm_partIsText',
     // so no more defaulting to 'true' when the part is done.
     m_partIsText = false;
 
+    // Note: we cannot reset 'm_partIsQP' yet since we still need it to process
+    // the last buffer returned here. Parsing the next part will set a new value.
     return buf.Length();
   }
 
   if (!m_partIsText)
   {
     // Ignore non-text parts
     buf.Truncate();
     eatThisLine = true;
@@ -400,27 +403,29 @@ void nsMsgBodyHandler::SniffPossibleMIME
       m_partIsHtml = true;
     }
     else if (lowerCaseLine.Find("multipart/", /* ignoreCase = */ true) != -1)
     {
       if (m_isMultipart)
       {
         // Nested multipart, get ready for new headers.
         m_base64part = false;
+        m_partIsQP = false;
         m_pastPartHeaders = false;
         m_partIsHtml = false;
         m_partIsText = false;
       }
       m_isMultipart = true;
       m_partCharset.Truncate();
     }
     else if (lowerCaseLine.Find("message/", /* ignoreCase = */ true) != -1)
     {
       // Initialise again.
       m_base64part = false;
+      m_partIsQP = false;
       m_pastPartHeaders = false;
       m_partIsHtml = false;
       m_partIsText = true;  // Default is text/plain, maybe proven otherwise later.
       m_inMessageAttachment = true;
     }
     else if (lowerCaseLine.Find("text/", /* ignoreCase = */ true) != -1)
       m_partIsText = true;
     else if (lowerCaseLine.Find("text/", /* ignoreCase = */ true) == -1)