Bug 1399756 - remove trailing spaces in mailnews/import. rs=white-space-only
authorJorg K <jorgk@jorgk.com>
Mon, 12 Feb 2018 23:37:06 +0100
changeset 31093 f66ed82ee22de04e23ccdf6ffa8d9d9fa26981a4
parent 31092 d85994128300d242293bda5f701a7b8b67c4be07
child 31094 bdfa5f49559ea2934ac930efd731ec5c5d5cc3ae
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewerswhite-space-only
bugs1399756
Bug 1399756 - remove trailing spaces in mailnews/import. rs=white-space-only [skip-blame]
mailnews/import/applemail/src/nsAppleMailImport.h
mailnews/import/applemail/src/nsEmlxHelperUtils.h
mailnews/import/outlook/src/MapiApi.cpp
mailnews/import/outlook/src/MapiMessage.h
mailnews/import/outlook/src/nsOutlookMail.cpp
mailnews/import/outlook/src/nsOutlookMail.h
mailnews/import/outlook/src/rtfDecoder.cpp
mailnews/import/src/nsImportMail.cpp
mailnews/import/vcard/src/nsVCardImport.cpp
--- a/mailnews/import/applemail/src/nsAppleMailImport.h
+++ b/mailnews/import/applemail/src/nsAppleMailImport.h
@@ -14,35 +14,35 @@
 #include "ImportDebug.h"
 
 #define NS_APPLEMAILIMPL_CID \
 { 0x9117a1ea, 0xe012, 0x43b5, { 0xa0, 0x20, 0xcb, 0x8a, 0x66, 0xcc, 0x09, 0xe1 } }
 
 #define NS_APPLEMAILIMPORT_CID \
 { 0x6d3f101c, 0x70ec, 0x4e04, { 0xb6, 0x8d, 0x99, 0x08, 0xd1, 0xae, 0xdd, 0xf3 } }
 
-#define NS_APPLEMAILIMPL_CONTRACTID "@mozilla.org/import/import-appleMailImpl;1" 
+#define NS_APPLEMAILIMPL_CONTRACTID "@mozilla.org/import/import-appleMailImpl;1"
 
 #define kAppleMailSupportsString "mail"
 
 class nsIImportService;
 class nsIMutableArray;
 
 class nsAppleMailImportModule : public nsIImportModule
 {
   public:
 
   nsAppleMailImportModule();
-    
+
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIIMPORTMODULE
 
   private:
   virtual ~nsAppleMailImportModule();
-    
+
   nsCOMPtr<nsIStringBundle> mBundle;
 };
 
 class nsAppleMailImportMail : public nsIImportMail
 {
   public:
 
   nsAppleMailImportMail();
@@ -53,17 +53,17 @@ class nsAppleMailImportMail : public nsI
   nsresult Initialize();
 
   private:
   virtual ~nsAppleMailImportMail();
 
   void FindAccountMailDirs(nsIFile *aRoot, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
   nsresult FindMboxDirs(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
   nsresult AddMboxDir(nsIFile *aFolder, nsIMutableArray *aMailboxDescs, nsIImportService *aImportService);
-    
+
   // aInfoString is the format to a "foo %s" string. It may be NULL if the error string needs no such format.
   void ReportStatus(const char16_t* aErrorName, nsString &aName, nsAString &aStream);
   static void SetLogs(const nsAString& success, const nsAString& error, char16_t **aOutErrorLog, char16_t **aSuccessLog);
 
   nsCOMPtr<nsIStringBundle>  mBundle;
   uint32_t                   mProgress;
   uint16_t                   mCurDepth;
 };
--- a/mailnews/import/applemail/src/nsEmlxHelperUtils.h
+++ b/mailnews/import/applemail/src/nsEmlxHelperUtils.h
@@ -8,17 +8,17 @@
 
 #include "nscore.h"
 #include "nsString.h"
 
 class nsIOutputStream;
 class nsIFile;
 
 class nsEmlxHelperUtils {
-  /* All emlx messages have a "flags" number in the metadata. 
+  /* All emlx messages have a "flags" number in the metadata.
      These are the masks to decode that, found via http://jwz.livejournal.com/505711.html */
   enum EmlxMetadataMask {
     kRead       = 1 << 0,  // read
     // 1 << 1,             // deleted
     kAnswered   = 1 << 2,  // answered
     // 1 << 3,             // encrypted
     kFlagged    = 1 << 4,  // flagged
     // 1 << 5,             // recent
@@ -27,29 +27,29 @@ class nsEmlxHelperUtils {
     kForwarded  = 1 << 8,  // forwarded
     // 1 << 9,             // redirected
     // 3F << 10,           // attachment count (6 bits)
     // 7F << 16,           // priority level (7 bits)
     // 1 << 23,            // signed
     // 1 << 24,            // is junk
     // 1 << 25,            // is not junk
     // 1 << 26,            // font size delta 7 (3 bits)
-    // 1 << 29,            // junk mail level recorded 
+    // 1 << 29,            // junk mail level recorded
     // 1 << 30,            // highlight text in toc
     // 1 << 31             // (unused)
   };
 
   // This method will scan the raw EMLX message buffer for "dangerous" so-called "From-lines" that we need to escape.
   // If it needs to modify any lines, it will return a non-NULL aOutBuffer. If aOutBuffer is NULL, no modification needed
   // to be made.
   static nsresult ConvertToMboxRD(const char *aMessageBufferStart, const char *aMessageBufferEnd, nsCString &aOutBuffer);
 
   // returns an int representing the X-Mozilla-Status flags set (e.g. "read", "flagged") converted from EMLX flags.
   static nsresult ConvertToMozillaStatusFlags(const char *aXMLBufferStart, const char *aXMLBufferEnd, uint32_t *aMozillaStatusFlags);
 
   public:
 
   // add an .emlx message to the mbox output
-  static nsresult AddEmlxMessageToStream(nsIFile *aEmlxFile, nsIOutputStream *aOutoutStream); 
+  static nsresult AddEmlxMessageToStream(nsIFile *aEmlxFile, nsIOutputStream *aOutoutStream);
 
 };
 
-#endif // nsEmlxHelperUtils_h___ 
+#endif // nsEmlxHelperUtils_h___
--- a/mailnews/import/outlook/src/MapiApi.cpp
+++ b/mailnews/import/outlook/src/MapiApi.cpp
@@ -132,17 +132,17 @@ BOOL CMapiApi::GetRTFPropertyDecodedAsUT
   icstream->Release();
 
   if(iunstream) { // Succeeded
     std::string streamData;
     // Stream.Stat doesn't work for this stream!
     bool done = false;
     while (!done) {
       // I think 10K is a good guess to minimize the number of reads while keeping memory usage low
-      const int bufsize = 10240; 
+      const int bufsize = 10240;
       char buf[bufsize];
       ULONG read;
       hr = iunstream->Read(buf, bufsize, &read);
       done = (read < bufsize) || (hr != S_OK);
       if (read)
         streamData.append(buf, read);
     }
     iunstream->Release();
--- a/mailnews/import/outlook/src/MapiMessage.h
+++ b/mailnews/import/outlook/src/MapiMessage.h
@@ -94,17 +94,17 @@ private:
   class CHeaderField {
   public:
     CHeaderField(const char* begin, int len);
     CHeaderField(const char* name, const char* body, bool utf8 = false);
     ~CHeaderField();
     inline bool Valid() const { return m_fname; }
     inline const char* fname() const { return m_fname; }
     inline const char* fbody() const { return m_fbody; }
-    
+
     // txt must be utf-8 or 7-bit; supposed that this function will be called
     // when the charset of the txt is known
     void set_fbody(const char* txt);
 
     void GetUnfoldedString(nsString& dest, const char* fallbackCharset) const;
   private:
     char* m_fname;
     char* m_fbody;
@@ -127,17 +127,17 @@ private:
     fname_equals(const char* search) : m_search(search) {}
     inline bool operator () (const CHeaderField* f) const { return stricmp(f->fname(), m_search) == 0; }
   private:
     const char* m_search;
   }; // class fname_equals
 
   // The common array of special headers' names
   static const char* Specials[hdrMax];
-  
+
   std::vector<CHeaderField*> m_headerFields;
   CHeaderField* m_SpecialHeaders[hdrMax]; // Pointers into the m_headerFields
 
   void ClearHeaderFields();
   void Add(CHeaderField* f);
   static SpecialHeader CheckSpecialHeader(const char* fname);
   const CHeaderField* CFind(const char* name) const;
   inline CHeaderField* Find(const char* name) { return const_cast<CHeaderField*>(CFind(name)); }
@@ -163,17 +163,17 @@ public:
   // attachments when shows the message status, so here we check only for the
   // ordinary attachments.
   inline bool HasAttach() const { return !m_stdattachments.empty(); }
 
   // Retrieve info for message
   inline bool BodyIsHtml(void) const { return m_bodyIsHtml;}
   const char *GetFromLine(int& len) const {
     if (m_fromLine.IsEmpty())
-      return NULL; 
+      return NULL;
     else {
       len = m_fromLine.Length();
       return m_fromLine.get();}
   }
   inline CMapiMessageHeaders *GetHeaders() { return &m_headers; }
   inline const wchar_t *GetBody(void) const { return m_body.get(); }
   inline size_t GetBodyLen(void) const { return m_body.Length(); }
   void GetBody(nsCString& dest) const;
@@ -259,13 +259,13 @@ private:
 
   void    ProcessContentType();
   bool    CheckBodyInCharsetRange(const char* charset);
   void    FormatDateTime(SYSTEMTIME& tm, nsCString& s, bool includeTZ = true);
   void    BuildFromLine(void);
 
   inline static bool IsSpace(char c) {
     return c == ' ' || c == '\r' || c == '\n' || c == '\b' || c == '\t';}
-  inline static bool IsSpace(wchar_t c) { 
+  inline static bool IsSpace(wchar_t c) {
     return ((c & 0xFF) == c) && IsSpace(static_cast<char>(c)); } // Avoid false detections
 };
 
 #endif /* MapiMessage_h__ */
--- a/mailnews/import/outlook/src/nsOutlookMail.cpp
+++ b/mailnews/import/outlook/src/nsOutlookMail.cpp
@@ -658,17 +658,17 @@ nsresult nsOutlookMail::CreateList(const
   properties->cValues = 1;
   properties->aulPropTag [0] = m_mapi.GetEmailPropertyTag(pUserList, 0x8054);
   hr = pUserList->GetProps(properties, 0, &valueCount, &value);
   m_mapi.MAPIFreeBuffer(properties);
   if (HR_FAILED(hr))
     return NS_ERROR_FAILURE;
   if (!value)
     return NS_ERROR_NOT_AVAILABLE;
-  // XXX from here out, value must be freed with MAPIFreeBuffer 
+  // XXX from here out, value must be freed with MAPIFreeBuffer
 
   SBinaryArray *sa=(SBinaryArray *)&value->Value.bin;
   if (!sa || !sa->lpbin) {
     m_mapi.MAPIFreeBuffer(value);
     return NS_ERROR_NULL_POINTER;
   }
 
   LPENTRYID    lpEid;
--- a/mailnews/import/outlook/src/nsOutlookMail.h
+++ b/mailnews/import/outlook/src/nsOutlookMail.h
@@ -17,34 +17,34 @@
 
 class nsIAddrDatabase;
 class nsIImportFieldMap;
 
 class nsOutlookMail {
 public:
   nsOutlookMail();
   ~nsOutlookMail();
-  
+
   nsresult GetMailFolders(nsIArray **pArray);
   nsresult GetAddressBooks(nsIArray **pArray);
   nsresult ImportMailbox(uint32_t *pDoneSoFar, bool *pAbort, int32_t index,
                          const char16_t *pName, nsIMsgFolder *pDest,
                          int32_t *pMsgCount);
   nsresult ImportAddresses(uint32_t *pCount, uint32_t *pTotal, const char16_t *pName, uint32_t id, nsIAddrDatabase *pDb, nsString& errors);
   void  OpenMessageStore(CMapiFolder *pNextFolder);
   static BOOL  WriteData(nsIOutputStream *pDest, const char *pData, int32_t len);
 
 private:
   bool      IsAddressBookNameUnique(nsString& name, nsString& list);
   void      MakeAddressBookNameUnique(nsString& name, nsString& list);
   void      SanitizeValue(nsString& val);
   void      SplitString(nsString& val1, nsString& val2);
   bool      BuildCard(const char16_t *pName, nsIAddrDatabase *pDb, nsIMdbRow *newRow, LPMAPIPROP pUser, nsIImportFieldMap *pFieldMap);
   nsresult  CreateList(const char16_t * pName, nsIAddrDatabase *pDb, LPMAPIPROP pUserList, nsIImportFieldMap *pFieldMap);
-  
+
 private:
   bool              m_gotFolders;
   bool              m_gotAddresses;
   bool              m_haveMapi;
   CMapiFolderList   m_addressList;
   CMapiFolderList   m_storeList;
 
 public:
--- a/mailnews/import/outlook/src/rtfDecoder.cpp
+++ b/mailnews/import/outlook/src/rtfDecoder.cpp
@@ -117,17 +117,17 @@ struct GlobalState {
     st.codepage = 0xFFFFFFFF;
     stack.push(st);
   }
   unsigned int GetCurrentCP()
   {
     if (stack.top().codepage != 0xFFFFFFFF) // \cpg in use
       return stack.top().codepage;
     // \cpg not used; use font settings
-    int f = (stack.top().f != -1) ? stack.top().f : deff; 
+    int f = (stack.top().f != -1) ? stack.top().f : deff;
     if (f != -1) {
       Fonttbl::iterator iter = fonttbl.find(f);
       if (iter != fonttbl.end()) {
         unsigned int cp = iter->second.Codepage();
         if (cp != 0xFFFFFFFF)
           return cp;
       }
     }
@@ -251,17 +251,17 @@ private:
   union {
     Keyword m_keyword;
     char m_pcdata_a;
     wchar_t m_pcdata_w;
     BDATA m_bdata;
   };
   // This function leaves the object in the broken state. Must be followed
   // by a correct initialization.
-  void Clear() 
+  void Clear()
   {
     switch (m_type) {
     case ltBDATA:
       delete[] m_bdata.data;
       break;
     }
 //  m_type = ltError;
   }
@@ -276,34 +276,34 @@ Lexem Lexem::error(ltError);
 // backslash; pos must be in the same sequence and before end!
 Keyword GetKeyword(std::istream& stream)
 {
   Keyword keyword = {"", false, 0};
   char ch;
   if (stream.get(ch).eof())
     return keyword;
   // Control word; maybe delimiter and value
-  if (IS_ALPHA(ch)) { 
+  if (IS_ALPHA(ch)) {
     int i = 0;
     do {
       // We take up to 32 characters into account, skipping over extra
       // characters (allowing for some non-conformant implementation).
       if (i < 32)
         keyword.name[i++] = ch;
     } while (!stream.get(ch).eof() && IS_ALPHA(ch));
     keyword.name[i] = 0; // NULL-terminating
     if (!stream.eof() && (IS_DIGIT(ch) || (ch == '-'))) { // Value begin
       keyword.hasVal = true;
       bool negative = (ch == '-');
       if (negative) stream.get(ch);
       i = 0;
       while (!stream.eof() && IS_DIGIT(ch)) {
         // We take into account only 10 digits, skip other. Older specs stated
         // that we must be ready for an arbitrary number of digits.
-        if (i++ < 10) 
+        if (i++ < 10)
           keyword.val = keyword.val*10 + (ch - '0');
         stream.get(ch);
       }
       if (negative) keyword.val = -keyword.val;
     }
      // End of control word; the space is just a delimiter - skip it
     if (!stream.eof() && !(ch == ' '))
       stream.unget();
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -790,17 +790,17 @@ ImportMailThread(void *stuff)
         }
         if (pSuccess) {
           success.Append(pSuccess);
           free(pSuccess);
         }
 
         pData->currentSize = 0;
         pData->currentTotal += size;
-        
+
         // commit to the db synchronously, but using a proxy since it doesn't like being used
         // elsewhere than from the main thread.
         // OK, we've copied the actual folder/file over if the folder size is not 0
         // (ie, the msg summary is no longer valid) so close the msg database so that
         // when the folder is reopened the folder db can be reconstructed (which
         // validates msg summary and forces folder to be reparsed).
         rv = ProxyForceDBClosed(newFolder);
         fatalError = NS_FAILED(rv);
--- a/mailnews/import/vcard/src/nsVCardImport.cpp
+++ b/mailnews/import/vcard/src/nsVCardImport.cpp
@@ -22,17 +22,17 @@
 #include "nsServiceManagerUtils.h"
 #include "nsTextFormatter.h"
 #include "nsVCardAddress.h"
 #include "nsVCardImport.h"
 
 class ImportVCardAddressImpl : public nsIImportAddressBooks
 {
 public:
-  ImportVCardAddressImpl(nsIStringBundle* aStringBundle); 
+  ImportVCardAddressImpl(nsIStringBundle* aStringBundle);
 
   static nsresult Create(
       nsIImportAddressBooks** aImport, nsIStringBundle* aStringBundle);
 
   // nsISupports interface
   NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIImportAddressBooks interface
@@ -225,17 +225,17 @@ NS_IMETHODIMP ImportVCardAddressImpl::Fi
     return NS_ERROR_FAILURE;
 
   bool isFile = false;
   rv = pLoc->IsFile(&isFile);
   if (NS_FAILED(rv) || !isFile)
     return NS_ERROR_FAILURE;
 
   m_fileLoc = do_QueryInterface(pLoc);
-  
+
   /* Build an address book descriptor based on the file passed in! */
   nsCOMPtr<nsIMutableArray> array(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   if (NS_FAILED(rv)) {
     IMPORT_LOG0("FAILED to allocate the nsIMutableArray\n");
     return rv;
   }
 
   nsString name;
@@ -309,20 +309,20 @@ void ImportVCardAddressImpl::ReportError
   pStream->Append(pText);
   free(pFmt);
   pStream->Append(char16_t('\n'));
 }
 
 void ImportVCardAddressImpl::SetLogs(
     nsString& success, nsString& error,
     char16_t **pError, char16_t **pSuccess)
-{ 
-  if (pError) 
+{
+  if (pError)
     *pError = ToNewUnicode(error);
-  if (pSuccess) 
+  if (pSuccess)
     *pSuccess = ToNewUnicode(success);
 }
 
 NS_IMETHODIMP ImportVCardAddressImpl::ImportAddressBook(
     nsIImportABDescriptor *pSource,
     nsIAddrDatabase *pDestination,
     nsIImportFieldMap *fieldMap,
     nsISupports *aSupportService,