Bug 1463266 - replace tabs with spaces in mailnews/compose. rs=white-space-only
authorJorg K <jorgk@jorgk.com>
Thu, 31 May 2018 23:55:34 +0200
changeset 31285 1940b43f2306a0aa1c5e45dd311256f359bcdb28
parent 31284 2463d996da66ca52cab5cf840fcf24569962ff52
child 31286 8f2b699fd1ac390b1899491bae6cfac78da3d166
push id2249
push userclokep@gmail.com
push dateTue, 26 Jun 2018 01:48:25 +0000
treeherdercomm-beta@93c72f9a5f79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhite-space-only
bugs1463266
Bug 1463266 - replace tabs with spaces in mailnews/compose. rs=white-space-only [skip-blame]
mailnews/compose/src/nsMsgAppleCodes.h
mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
mailnews/compose/src/nsMsgAppleEncode.cpp
mailnews/compose/src/nsMsgAttachment.cpp
mailnews/compose/src/nsMsgCompUtils.cpp
mailnews/compose/src/nsMsgComposeContentHandler.h
mailnews/compose/src/nsMsgComposeProgressParams.h
mailnews/compose/src/nsMsgComposeService.h
mailnews/compose/src/nsMsgCopy.cpp
mailnews/compose/src/nsMsgCopy.h
mailnews/compose/src/nsMsgQuote.cpp
mailnews/compose/src/nsMsgQuote.h
mailnews/compose/src/nsMsgSendPart.h
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsSmtpService.h
mailnews/compose/src/nsSmtpUrl.cpp
--- a/mailnews/compose/src/nsMsgAppleCodes.h
+++ b/mailnews/compose/src/nsMsgAppleCodes.h
@@ -1,96 +1,96 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
-**	AD_Codes.h
+**  AD_Codes.h
 **
-**	---------------
+**  ---------------
 **
-**		Head file for Apple Decode/Encode essential codes.
+**  Head file for Apple Decode/Encode essential codes.
 **
 **
 */
 
 #ifndef ad_codes_h
 #define ad_codes_h
 
 /*
 ** applefile definitions used
 */
 #if PRAGMA_STRUCT_ALIGN
   #pragma options align=mac68k
 #endif
 
-#define APPLESINGLE_MAGIC	0x00051600L
-#define APPLEDOUBLE_MAGIC 	0x00051607L
-#define VERSION 			0x00020000
+#define APPLESINGLE_MAGIC 0x00051600L
+#define APPLEDOUBLE_MAGIC 0x00051607L
+#define VERSION 0x00020000
 
-#define NUM_ENTRIES 		6
+#define NUM_ENTRIES  6
 
-#define ENT_DFORK   		1L
-#define ENT_RFORK   		2L
-#define ENT_NAME    		3L
-#define ENT_COMMENT 		4L
-#define ENT_DATES   		8L
-#define ENT_FINFO   		9L
-#define CONVERT_TIME 		1265437696L
+#define ENT_DFORK    1L
+#define ENT_RFORK    2L
+#define ENT_NAME     3L
+#define ENT_COMMENT  4L
+#define ENT_DATES    8L
+#define ENT_FINFO    9L
+#define CONVERT_TIME 1265437696L
 
 /*
 ** data type used in the encoder/decoder.
 */
 typedef struct ap_header
 {
-	int32_t 	magic;
-	int32_t	version;
-	char 	fill[16];
-	int16_t 	entries;
+  int32_t   magic;
+  int32_t   version;
+  char      fill[16];
+  int16_t   entries;
 
 } ap_header;
 
 typedef struct ap_entry
 {
-	int32_t  id;
-	int32_t	offset;
-	int32_t	length;
-	
+  int32_t  id;
+  int32_t  offset;
+  int32_t  length;
+
 } ap_entry;
 
 typedef struct ap_dates
 {
-	int32_t create, modify, backup, access;
+  int32_t create, modify, backup, access;
 
 } ap_dates;
 
-typedef struct myFInfo			/* the mac FInfo structure for the cross platform. */
-{	
-	int32_t	fdType, fdCreator;
-	int16_t	fdFlags;
-	int32_t	fdLocation;			/* it really should  be a pointer, but just a place-holder  */
-	int16_t	fdFldr;	
+typedef struct myFInfo      /* the mac FInfo structure for the cross platform. */
+{
+  int32_t  fdType, fdCreator;
+  int16_t  fdFlags;
+  int32_t  fdLocation;      /* it really should  be a pointer, but just a place-holder  */
+  int16_t  fdFldr;
 
-}	myFInfo;
+}  myFInfo;
 
 PR_BEGIN_EXTERN_C
 /*
-**	string utils.
+**  string utils.
 */
 int write_stream(appledouble_encode_object *p_ap_encode_obj, const char *s,int len);
 
 int fill_apple_mime_header(appledouble_encode_object *p_ap_encode_obj);
 int ap_encode_file_infor(appledouble_encode_object *p_ap_encode_obj);
 int ap_encode_header(appledouble_encode_object* p_ap_encode_obj, bool firstTime);
-int ap_encode_data(  appledouble_encode_object* p_ap_encode_obj, bool firstTime);
+int ap_encode_data(appledouble_encode_object* p_ap_encode_obj, bool firstTime);
 
 /*
-**	the prototypes for the ap_decoder.
+**  the prototypes for the ap_decoder.
 */
 int  fetch_a_line(appledouble_decode_object* p_ap_decode_obj, char *buff);
 int  ParseFileHeader(appledouble_decode_object* p_ap_decode_obj);
 int  ap_seek_part_start(appledouble_decode_object* p_ap_decode_obj);
 void parse_param(char *p, char **param, char**define, char **np);
 int  ap_seek_to_boundary(appledouble_decode_object* p_ap_decode_obj, bool firstime);
 int  ap_parse_header(appledouble_decode_object* p_ap_decode_obj,bool firstime);
 int  ap_decode_file_infor(appledouble_decode_object* p_ap_decode_obj);
--- a/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
@@ -1,54 +1,54 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
-*
-*   apple-double.c
-*	--------------
-*
-*  	  The codes to do apple double encoding/decoding.
-*		
-*		02aug95		mym		created.
-*		
-*/
+ *
+ *  apple-double.c
+ *  --------------
+ *
+ *  The codes to do apple double encoding/decoding.
+ *
+ *  02aug95  mym  created.
+ *
+ */
 #include "nsID.h"
 #include "nscore.h"
 #include "nsString.h"
 #include "nsMsgAppleDouble.h"
 #include "nsMsgAppleCodes.h"
 #include "nsMsgCompUtils.h"
 #include "nsCExternalHandlerService.h"
 #include "nsIMIMEService.h"
 #include "nsMimeTypes.h"
 #include "prmem.h"
 #include "nsNetUtil.h"
 
 
-void	
-MacGetFileType(nsIFile   *fs,
-               bool         *useDefault,
-               char         **fileType,
-               char         **encoding)
+void
+MacGetFileType(nsIFile *fs,
+               bool    *useDefault,
+               char    **fileType,
+               char    **encoding)
 {
-	if ((fs == NULL) || (fileType == NULL) || (encoding == NULL))
-		return;
+  if ((fs == NULL) || (fileType == NULL) || (encoding == NULL))
+    return;
 
   bool exists = false;
   fs->Exists(&exists);
   if (!exists)
     return;
 
-	*useDefault = TRUE;
-	*fileType = NULL;
-	*encoding = NULL;
+  *useDefault = TRUE;
+  *fileType = NULL;
+  *encoding = NULL;
 
   nsCOMPtr<nsILocalFileMac> macFile = do_QueryInterface(fs);
   FSRef fsRef;
   FSCatalogInfo catalogInfo;
   OSErr err = errFileOpen;
   if (NS_SUCCEEDED(macFile->GetFSRef(&fsRef)))
     err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &catalogInfo, nullptr, nullptr, nullptr);
 
@@ -57,17 +57,17 @@ MacGetFileType(nsIFile   *fs,
   else
   {
     // At this point, we should call the mime service and
     // see what we can find out?
     nsresult      rv;
     nsCOMPtr <nsIURI> tURI;
     if (NS_SUCCEEDED(NS_NewFileURI(getter_AddRefs(tURI), fs)) && tURI)
     {
-      nsCOMPtr<nsIMIMEService> mimeFinder (do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
+      nsCOMPtr<nsIMIMEService> mimeFinder(do_GetService(NS_MIMESERVICE_CONTRACTID, &rv));
       if (NS_SUCCEEDED(rv) && mimeFinder)
       {
         nsAutoCString mimeType;
         rv = mimeFinder->GetTypeFromURI(tURI, mimeType);
         if (NS_SUCCEEDED(rv))
         {
           *fileType = ToNewCString(mimeType);
           return;
@@ -78,189 +78,189 @@ MacGetFileType(nsIFile   *fs,
     // If we hit here, return something...default to this...
     *fileType = strdup(APPLICATION_OCTET_STREAM);
   }
 }
 
 //#pragma cplusplus reset
 
 /*
-*	ap_encode_init
-*	--------------
-*	
-*	Setup the encode envirment
-*/
+ *  ap_encode_init
+ *  --------------
+ *
+ *  Setup the encode envirment
+ */
 
-int ap_encode_init( appledouble_encode_object *p_ap_encode_obj,
-                    const char                *fname,
-                    char                      *separator)
+int ap_encode_init(appledouble_encode_object *p_ap_encode_obj,
+                   const char                *fname,
+                   char                      *separator)
 {
   nsCOMPtr <nsIFile> myFile;
   NS_NewNativeLocalFile(nsDependentCString(fname), true, getter_AddRefs(myFile));
   bool exists;
   if (myFile && NS_SUCCEEDED(myFile->Exists(&exists)) && !exists)
     return -1;
 
   nsCOMPtr<nsILocalFileMac> macFile = do_QueryInterface(myFile);
   nsAutoCString path;
   macFile->GetNativePath(path);
 
-	memset(p_ap_encode_obj, 0, sizeof(appledouble_encode_object));
-	
-	/*
-	**	Fill out the source file inforamtion.
-	*/	
+  memset(p_ap_encode_obj, 0, sizeof(appledouble_encode_object));
+
+  /*
+  **  Fill out the source file inforamtion.
+  */
   memcpy(p_ap_encode_obj->fname, path.get(), path.Length());
   p_ap_encode_obj->fname[path.Length()] = '\0';
-	
-	p_ap_encode_obj->boundary = strdup(separator);
-	return noErr;
+
+  p_ap_encode_obj->boundary = strdup(separator);
+  return noErr;
 }
 
 /*
-**	ap_encode_next
-**	--------------
-**		
-**		return :
-**			noErr	:	everything is ok
-**			errDone	:	when encoding is done.
-**			errors	:	otherwise.
+**  ap_encode_next
+**  --------------
+**
+**  return :
+**  noErr  :  everything is ok
+**  errDone:  when encoding is done.
+**  errors :  otherwise.
 */
 int ap_encode_next(
-	appledouble_encode_object* p_ap_encode_obj,
-	char 	*to_buff,
-	int32_t 	buff_size,
-	int32_t* 	real_size)
+  appledouble_encode_object* p_ap_encode_obj,
+  char     *to_buff,
+  int32_t  buff_size,
+  int32_t* real_size)
 {
-	int status;
-	
-	/*
-	** 	install the out buff now.
-	*/
-	p_ap_encode_obj->outbuff     = to_buff;
-	p_ap_encode_obj->s_outbuff 	 = buff_size;
-	p_ap_encode_obj->pos_outbuff = 0;
-	
-	/*
-	**	first copy the outstandind data in the overflow buff to the out buffer.
-	*/
-	if (p_ap_encode_obj->s_overflow)
-	{
-		status = write_stream(p_ap_encode_obj,
-		                      (const char*)(p_ap_encode_obj->b_overflow),
-		                      p_ap_encode_obj->s_overflow);
-		if (status != noErr)
-			return status;
-				
-		p_ap_encode_obj->s_overflow = 0;
-	}
+  int status;
+
+  /*
+  **   install the out buff now.
+  */
+  p_ap_encode_obj->outbuff = to_buff;
+  p_ap_encode_obj->s_outbuff = buff_size;
+  p_ap_encode_obj->pos_outbuff = 0;
+
+  /*
+  **  first copy the outstandind data in the overflow buff to the out buffer.
+  */
+  if (p_ap_encode_obj->s_overflow)
+  {
+    status = write_stream(p_ap_encode_obj,
+                          (const char*)(p_ap_encode_obj->b_overflow),
+                          p_ap_encode_obj->s_overflow);
+    if (status != noErr)
+      return status;
+
+    p_ap_encode_obj->s_overflow = 0;
+  }
+
+  /*
+  ** go the next processing stage based on the current state.
+  */
+  switch (p_ap_encode_obj->state)
+  {
+    case kInit:
+      /*
+      ** We are in the  starting position, fill out the header.
+      */
+      status = fill_apple_mime_header(p_ap_encode_obj);
+      if (status != noErr)
+        break;          /* some error happens */
+
+      p_ap_encode_obj->state = kDoingHeaderPortion;
+      status = ap_encode_header(p_ap_encode_obj, true);
+                    /* it is the first time to calling     */
+      if (status == errDone)
+      {
+        p_ap_encode_obj->state = kDoneHeaderPortion;
+      }
+      else
+      {
+        break;          /* we need more work on header portion.  */
+      }
 
-	/*
-	** go the next processing stage based on the current state.
-	*/
-	switch (p_ap_encode_obj->state)
-	{
-		case kInit:
-			/*
-			** We are in the  starting position, fill out the header.
-			*/
-			status = fill_apple_mime_header(p_ap_encode_obj);
-			if (status != noErr)
-				break;					/* some error happens */
-				
-			p_ap_encode_obj->state = kDoingHeaderPortion;
-			status = ap_encode_header(p_ap_encode_obj, true);
-										/* it is the first time to calling 		*/							
-			if (status == errDone)
-			{
-				p_ap_encode_obj->state = kDoneHeaderPortion;
-			}
-			else
-			{
-				break;					/* we need more work on header portion.	*/
-			}			
-				
-			/*
-			** we are done with the header, so let's go to the data port.
-			*/
-			p_ap_encode_obj->state = kDoingDataPortion;
-			status = ap_encode_data(p_ap_encode_obj, true);		 	
-										/* it is first time call do data portion */
-							
-			if (status == errDone)
-			{
-				p_ap_encode_obj->state  = kDoneDataPortion;
-				status = noErr;
-			}
-			break;
+      /*
+      ** we are done with the header, so let's go to the data port.
+      */
+      p_ap_encode_obj->state = kDoingDataPortion;
+      status = ap_encode_data(p_ap_encode_obj, true);     
+                    /* it is first time call do data portion */
+
+      if (status == errDone)
+      {
+        p_ap_encode_obj->state  = kDoneDataPortion;
+        status = noErr;
+      }
+      break;
+
+    case kDoingHeaderPortion:
+
+      status = ap_encode_header(p_ap_encode_obj, false); 
+                    /* continue with the header portion.  */
+      if (status == errDone)
+      {
+        p_ap_encode_obj->state = kDoneHeaderPortion;
+      }
+      else
+      {
+        break;          /* we need more work on header portion.  */
+      }
 
-		case kDoingHeaderPortion:
-		
-			status = ap_encode_header(p_ap_encode_obj, false); 			
-										/* continue with the header portion.	*/
-			if (status == errDone)
-			{
-				p_ap_encode_obj->state = kDoneHeaderPortion;
-			}
-			else
-			{
-				break;					/* we need more work on header portion.	*/				
-			}
-			
-			/*
-			** start the data portion.
-			*/
-			p_ap_encode_obj->state = kDoingDataPortion;
-			status = ap_encode_data(p_ap_encode_obj, true); 					
-										/* it is the first time calling 		*/
-			if (status == errDone)
-			{
-				p_ap_encode_obj->state  = kDoneDataPortion;
-				status = noErr;
-			}
-			break;
+      /*
+      ** start the data portion.
+      */
+      p_ap_encode_obj->state = kDoingDataPortion;
+      status = ap_encode_data(p_ap_encode_obj, true); 
+                    /* it is the first time calling     */
+      if (status == errDone)
+      {
+        p_ap_encode_obj->state  = kDoneDataPortion;
+        status = noErr;
+      }
+      break;
+
+    case kDoingDataPortion:
 
-		case kDoingDataPortion:
-		
-			status = ap_encode_data(p_ap_encode_obj, false); 				
-										/* it is not the first time				*/
-													
-			if (status == errDone)
-			{
-				p_ap_encode_obj->state = kDoneDataPortion;
-				status = noErr;
-			}
-			break;
+      status = ap_encode_data(p_ap_encode_obj, false); 
+                    /* it is not the first time        */
 
-		case kDoneDataPortion:
-				status = errDone;		/* we are really done.					*/
+      if (status == errDone)
+      {
+        p_ap_encode_obj->state = kDoneDataPortion;
+        status = noErr;
+      }
+      break;
 
-			break;
-	}
-	
-	*real_size = p_ap_encode_obj->pos_outbuff;
-	return status;
+    case kDoneDataPortion:
+      status = errDone;    /* we are really done.          */
+
+      break;
+  }
+
+  *real_size = p_ap_encode_obj->pos_outbuff;
+  return status;
 }
 
 /*
-**	ap_encode_end
-**	-------------
+**  ap_encode_end
+**  -------------
 **
-**	clear the apple encoding.
+**  clear the apple encoding.
 */
 
 int ap_encode_end(
-	appledouble_encode_object *p_ap_encode_obj,
-	bool is_aborting)
+  appledouble_encode_object *p_ap_encode_obj,
+  bool is_aborting)
 {
-	/*
-	** clear up the apple doubler.
-	*/
-	if (p_ap_encode_obj == NULL)
-		return noErr;
+  /*
+  ** clear up the apple doubler.
+  */
+  if (p_ap_encode_obj == NULL)
+    return noErr;
 
-	if (p_ap_encode_obj->fileId)			/* close the file if it is open.	*/
+  if (p_ap_encode_obj->fileId)      /* close the file if it is open.  */
     ::FSCloseFork(p_ap_encode_obj->fileId);
 
-	PR_FREEIF(p_ap_encode_obj->boundary);		/* the boundary string.				*/
-	
-	return noErr;
+  PR_FREEIF(p_ap_encode_obj->boundary);    /* the boundary string.        */
+
+  return noErr;
 }
--- a/mailnews/compose/src/nsMsgAppleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleEncode.cpp
@@ -2,703 +2,702 @@
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  *
  *   apple_double_encode.c
- *	 ---------------------
+ *   ---------------------
  *
- *    The routines doing the Apple Double Encoding.
- *		
- *			2aug95	mym	Created.
- *		
+ *   The routines doing the Apple Double Encoding.
+ *
+ *   2aug95  mym  Created.
+ *
  */
 
 #include "nscore.h"
 #include "nsString.h"
 #include "mozilla/ArrayUtils.h"
 #include "nsMimeTypes.h"
 #include "prprf.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMsgAppleDouble.h"
 #include "nsMsgAppleCodes.h"
 #include "nsILocalFileMac.h"
 
 /*
-**	Local Functions prototypes.
+**  Local Functions prototypes.
 */
-static int output64chunk( appledouble_encode_object* p_ap_encode_obj,
-				int c1, int c2, int c3, int pads);
-				
+static int output64chunk(appledouble_encode_object* p_ap_encode_obj,
+                         int c1, int c2, int c3, int pads);
+
 static int to64(appledouble_encode_object* p_ap_encode_obj,
-				char	*p,
-				int 	in_size);
+                char *p,
+                int  in_size);
 
 static int finish64(appledouble_encode_object* p_ap_encode_obj);
 
 
-#define BUFF_LEFT(p)	((p)->s_outbuff - (p)->pos_outbuff)	
+#define BUFF_LEFT(p)  ((p)->s_outbuff - (p)->pos_outbuff)
 
 /*
-**	write_stream.
+**  write_stream.
 */
 int write_stream(
-	appledouble_encode_object *p_ap_encode_obj,
-	const char *out_string,
-	int len)
-{	
-	if (p_ap_encode_obj->pos_outbuff + len < p_ap_encode_obj->s_outbuff)
-	{
-		memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
-		       out_string,
-		       len);
-		p_ap_encode_obj->pos_outbuff += len;
-		return noErr;
-	}
-	else
-	{
-		/*
-		**	If the buff doesn't have enough space, use the overflow buffer then.
-		*/
-		int s_len = p_ap_encode_obj->s_outbuff - p_ap_encode_obj->pos_outbuff;
-		
-		memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
-		       out_string,
-		       s_len);
-		memcpy(p_ap_encode_obj->b_overflow + p_ap_encode_obj->s_overflow,
-		       out_string + s_len,
-		       p_ap_encode_obj->s_overflow += (len - s_len));
-		p_ap_encode_obj->pos_outbuff += s_len;
-		return errEOB;
-	}
+  appledouble_encode_object *p_ap_encode_obj,
+  const char *out_string,
+  int len)
+{
+  if (p_ap_encode_obj->pos_outbuff + len < p_ap_encode_obj->s_outbuff)
+  {
+    memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
+           out_string,
+           len);
+    p_ap_encode_obj->pos_outbuff += len;
+    return noErr;
+  }
+  else
+  {
+    /*
+    **  If the buff doesn't have enough space, use the overflow buffer then.
+    */
+    int s_len = p_ap_encode_obj->s_outbuff - p_ap_encode_obj->pos_outbuff;
+
+    memcpy(p_ap_encode_obj->outbuff + p_ap_encode_obj->pos_outbuff,
+           out_string,
+           s_len);
+    memcpy(p_ap_encode_obj->b_overflow + p_ap_encode_obj->s_overflow,
+           out_string + s_len,
+           p_ap_encode_obj->s_overflow += (len - s_len));
+    p_ap_encode_obj->pos_outbuff += s_len;
+    return errEOB;
+  }
 }
 
 int fill_apple_mime_header(
-	appledouble_encode_object *p_ap_encode_obj)
+  appledouble_encode_object *p_ap_encode_obj)
 {
-	int  status;
-	
-	char tmpstr[266];
-	
-#if 0	
-//	strcpy(tmpstr, "Content-Type: multipart/mixed; boundary=\"-\"\n\n---\n");
-//	status = write_stream(p_ap_encode_env,
-//						tmpstr,
-//						strlen(tmpstr));
-//	if (status != noErr)
-//		return status;
+  int  status;
+
+  char tmpstr[266];
+
+#if 0
+//  strcpy(tmpstr, "Content-Type: multipart/mixed; boundary=\"-\"\n\n---\n");
+//  status = write_stream(p_ap_encode_env,
+//            tmpstr,
+//            strlen(tmpstr));
+//  if (status != noErr)
+//    return status;
 
-	PR_snprintf(tmpstr, sizeof(tmpstr),
-			"Content-Type: multipart/appledouble; boundary=\"=\"; name=\"");
-	status = write_stream(p_ap_encode_obj, (const char*)tmpstr, strlen(tmpstr));
-	if (status != noErr)
-		return status;
-		
-	status = write_stream(p_ap_encode_obj,
-						p_ap_encode_obj->fname,
-						strlen(p_ap_encode_obj->fname));
-	if (status != noErr)
-		return status;
-		
-	PR_snprintf(tmpstr, sizeof(tmpstr),
-			"\"\r\nContent-Disposition: inline; filename=\"%s\"\r\n\r\n\r\n--=\r\n",
-			p_ap_encode_obj->fname);
+  PR_snprintf(tmpstr, sizeof(tmpstr),
+              "Content-Type: multipart/appledouble; boundary=\"=\"; name=\"");
+  status = write_stream(p_ap_encode_obj, (const char*)tmpstr, strlen(tmpstr));
+  if (status != noErr)
+    return status;
+
+  status = write_stream(p_ap_encode_obj,
+                        p_ap_encode_obj->fname,
+                        strlen(p_ap_encode_obj->fname));
+  if (status != noErr)
+    return status;
+
+  PR_snprintf(tmpstr, sizeof(tmpstr),
+              "\"\r\nContent-Disposition: inline; filename=\"%s\"\r\n\r\n\r\n--=\r\n",
+              p_ap_encode_obj->fname);
 #endif /* 0 */
-	PR_snprintf(tmpstr, sizeof(tmpstr), "--%s" CRLF, p_ap_encode_obj->boundary);
-	status = write_stream(p_ap_encode_obj, (const char*)tmpstr, strlen(tmpstr));
-	return status;
+  PR_snprintf(tmpstr, sizeof(tmpstr), "--%s" CRLF, p_ap_encode_obj->boundary);
+  status = write_stream(p_ap_encode_obj, (const char*)tmpstr, strlen(tmpstr));
+  return status;
 }
 
 int ap_encode_file_infor(
-	appledouble_encode_object *p_ap_encode_obj)
+  appledouble_encode_object *p_ap_encode_obj)
+{
+  ap_header  head;
+  ap_entry   entries[NUM_ENTRIES];
+  ap_dates   dates;
+  short      i;
+  long       comlen;
+  char       comment[256];
+  int        status;
+
+  nsCOMPtr <nsIFile> resFile;
+  NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true,
+                        getter_AddRefs(resFile));
+  if (!resFile)
+      return errFileOpen;
+
+  FSRef ref;
+  nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(resFile);
+  if (NS_FAILED(macFile->GetFSRef(&ref)))
+      return errFileOpen;
+
+  FSCatalogInfo catalogInfo;
+  if (::FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catalogInfo, nullptr, nullptr, nullptr) != noErr)
+  {
+    return errFileOpen;
+  }
+
+  /* get a file comment, if possible */
+#if 1
+  // Carbon doesn't support GetWDInfo(). (Bug 555684)
+
+  // not sure why working directories are needed here...
+  comlen = 0;
+#else
+  long     procID;
+  procID = 0;
+  GetWDInfo(p_ap_encode_obj->vRefNum, &fpb->ioVRefNum, &fpb->ioDirID, &procID);
+  IOParam   vinfo;
+  memset((void *) &vinfo, '\0', sizeof (vinfo));
+  GetVolParmsInfoBuffer vp;
+  vinfo.ioCompletion  = nil;
+  vinfo.ioVRefNum   = fpb->ioVRefNum;
+  vinfo.ioBuffer     = (Ptr) &vp;
+  vinfo.ioReqCount   = sizeof (vp);
+  comlen = 0;
+  if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr &&
+    ((vp.vMAttrib >> bHasDesktopMgr) & 1))
+  {
+    DTPBRec   dtp;
+    memset((void *) &dtp, '\0', sizeof (dtp));
+    dtp.ioVRefNum = fpb->ioVRefNum;
+    if (PBDTGetPath(&dtp) == noErr)
+    {
+      dtp.ioCompletion = nil;
+      dtp.ioDTBuffer = (Ptr) comment;
+      dtp.ioNamePtr  = fpb->ioNamePtr;
+      dtp.ioDirID    = fpb->ioFlParID;
+      if (PBDTGetCommentSync(&dtp) == noErr)
+        comlen = dtp.ioDTActCount;
+    }
+  }
+#endif /* ! 1 */
+
+  /* write header */
+//  head.magic = dfork ? APPLESINGLE_MAGIC : APPLEDOUBLE_MAGIC;
+  head.magic   = APPLEDOUBLE_MAGIC;    /* always do apple double */
+  head.version = VERSION;
+  memset(head.fill, '\0', sizeof (head.fill));
+  head.entries = NUM_ENTRIES - 1;
+  status = to64(p_ap_encode_obj,
+                (char *) &head,
+                sizeof (head));
+  if (status != noErr)
+    return status;
+
+  /* write entry descriptors */
+  nsAutoCString leafname;
+  macFile->GetNativeLeafName(leafname);
+  entries[0].offset = sizeof (head) + sizeof (ap_entry) * head.entries;
+  entries[0].id   = ENT_NAME;
+  entries[0].length = leafname.Length();
+  entries[1].id   = ENT_FINFO;
+  entries[1].length = sizeof (FInfo) + sizeof (FXInfo);
+  entries[2].id   = ENT_DATES;
+  entries[2].length = sizeof (ap_dates);
+  entries[3].id   = ENT_COMMENT;
+  entries[3].length = comlen;
+  entries[4].id   = ENT_RFORK;
+  entries[4].length = catalogInfo.rsrcLogicalSize;
+  entries[5].id   = ENT_DFORK;
+  entries[5].length = catalogInfo.dataLogicalSize;
+
+  /* correct the link in the entries. */
+  for (i = 1; i < NUM_ENTRIES; ++i)
+  {
+    entries[i].offset = entries[i-1].offset + entries[i-1].length;
+  }
+  status = to64(p_ap_encode_obj,
+                (char *) entries,
+                sizeof (ap_entry) * head.entries);
+  if (status != noErr)
+    return status;
+
+  /* write name */
+  status = to64(p_ap_encode_obj,
+                (char *) leafname.get(),
+                leafname.Length());
+  if (status != noErr)
+    return status;
+
+  /* write finder info */
+  status = to64(p_ap_encode_obj,
+                (char *) &catalogInfo.finderInfo,
+                sizeof (FInfo));
+  if (status != noErr)
+    return status;
+
+  status = to64(p_ap_encode_obj,
+                (char *) &catalogInfo.extFinderInfo,
+                sizeof (FXInfo));
+  if (status != noErr)
+    return status;
+
+  /* write dates */
+  dates.create = catalogInfo.createDate.lowSeconds + CONVERT_TIME;
+  dates.modify = catalogInfo.contentModDate.lowSeconds + CONVERT_TIME;
+  dates.backup = catalogInfo.backupDate.lowSeconds + CONVERT_TIME;
+  dates.access = catalogInfo.accessDate.lowSeconds + CONVERT_TIME;
+  status = to64(p_ap_encode_obj,
+                (char *) &dates,
+                sizeof (ap_dates));
+  if (status != noErr)
+    return status;
+
+  /* write comment */
+  if (comlen)
+  {
+    status = to64(p_ap_encode_obj,
+                  comment,
+                  comlen * sizeof(char));
+  }
+  /*
+  **  Get some help information on deciding the file type.
+  */
+  if (((FileInfo*)(&catalogInfo.finderInfo))->fileType == 'TEXT' ||
+      ((FileInfo*)(&catalogInfo.finderInfo))->fileType == 'text')
+  {
+    p_ap_encode_obj->text_file_type = true;
+  }
+
+  return status;
+}
+/*
+**  ap_encode_header
+**
+**    encode the file header and the resource fork.
+**
+*/
+int ap_encode_header(
+  appledouble_encode_object* p_ap_encode_obj,
+  bool    firstime)
 {
-	ap_header	head;
-	ap_entry 	entries[NUM_ENTRIES];
-	ap_dates 	dates;
-	short 		i;
-	long 		comlen;
-	char 		comment[256];
-	int	 		status;
+  char     rd_buff[256];
+  FSIORefNum fileId;
+  OSErr  retval = noErr;
+  int      status;
+  ByteCount inCount;
+
+  if (firstime)
+  {
+    PL_strcpy(rd_buff,
+      "Content-Type: application/applefile\r\nContent-Transfer-Encoding: base64\r\n\r\n");
+    status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
+    if (status != noErr)
+      return status;
+
+    status = ap_encode_file_infor(p_ap_encode_obj);
+    if (status != noErr)
+      return status;
+
+    /*
+    ** preparing to encode the resource fork.
+    */
+    nsCOMPtr <nsIFile> myFile;
+    NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true, getter_AddRefs(myFile));
+    if (!myFile)
+      return errFileOpen;
+
+    FSRef ref;
+    nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(myFile);
+    if (NS_FAILED(macFile->GetFSRef(&ref)))
+      return errFileOpen;
+
+    HFSUniStr255 forkName;
+    ::FSGetResourceForkName(&forkName);
+    retval = ::FSOpenFork(&ref, forkName.length, forkName.unicode, fsRdPerm, &p_ap_encode_obj->fileId);
+    if (retval != noErr)
+      return retval;
+  }
+
+  fileId = p_ap_encode_obj->fileId;
+  while (retval == noErr)
+  {
+    if (BUFF_LEFT(p_ap_encode_obj) < 400)
+      break;
+
+    inCount = 0;
+    retval = ::FSReadFork(fileId, fsAtMark, 0, 256, rd_buff, &inCount);
+    if (inCount)
+    {
+      status = to64(p_ap_encode_obj,
+                    rd_buff,
+                    inCount);
+      if (status != noErr)
+        return status;
+    }
+  }
+
+  if (retval == eofErr)
+  {
+    ::FSCloseFork(fileId);
+    p_ap_encode_obj->fileId = 0;
+
+    status = finish64(p_ap_encode_obj);
+    if (status != noErr)
+      return status;
+
+    /*
+    ** write out the boundary
+    */
+    PR_snprintf(rd_buff, sizeof(rd_buff),
+                CRLF "--%s" CRLF,
+                p_ap_encode_obj->boundary);
+
+    status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
+    if (status == noErr)
+      status = errDone;
+  }
+  return status;
+}
 
+#if 0
+// This is unused for now and Clang complains about that is it is ifdefed out
+static void replace(char *p, int len, char frm, char to)
+{
+  for (; len > 0; len--, p++)
+    if (*p == frm)  *p = to;
+}
+#endif
+
+/* Description of the various file formats and their magic numbers     */
+struct magic
+{
+    const char *name;    /* Name of the file format */
+    const char *num;     /* The magic number */
+    int        len;      /* Length (0 means strlen(magicnum)) */
+};
+
+/* The magic numbers of the file formats we know about */
+static struct magic magic[] =
+{
+    { "image/gif",   "GIF",         0 },
+    { "image/jpeg", "\377\330\377",   0 },
+    { "video/mpeg", "\0\0\001\263",    4 },
+    { "application/postscript", "%!", 0 },
+};
+static int num_magic = MOZ_ARRAY_LENGTH(magic);
+
+static const char *text_type    = TEXT_PLAIN;          /* the text file type. */
+static const char *default_type = APPLICATION_OCTET_STREAM;
+
+
+/*
+ * Determines the format of the file "inputf".  The name
+ * of the file format (or NULL on error) is returned.
+ */
+static const char *magic_look(char *inbuff, int numread)
+{
+  int i, j;
+
+  for (i=0; i<num_magic; i++)
+  {
+    if (magic[i].len == 0)
+      magic[i].len = strlen(magic[i].num);
+  }
+
+  for (i=0; i<num_magic; i++)
+  {
+    if (numread >= magic[i].len)
+    {
+      for (j=0; j<magic[i].len; j++)
+      {
+        if (inbuff[j] != magic[i].num[j]) break;
+      }
+      
+      if (j == magic[i].len)
+        return magic[i].name;
+    }
+  }
+
+  return default_type;
+}
+/*
+**  ap_encode_data
+**
+**  ---------------
+**
+**    encode on the data fork.
+**
+*/
+int ap_encode_data(
+  appledouble_encode_object* p_ap_encode_obj,
+  bool firstime)
+{
+  char       rd_buff[256];
+  FSIORefNum fileId;
+  OSErr      retval = noErr;
+  ByteCount  in_count;
+  int        status;
+
+  if (firstime)
+  {
+    const char* magic_type;
+
+    /*
+    ** preparing to encode the data fork.
+    */
     nsCOMPtr <nsIFile> resFile;
     NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true,
                           getter_AddRefs(resFile));
     if (!resFile)
         return errFileOpen;
 
     FSRef ref;
     nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(resFile);
     if (NS_FAILED(macFile->GetFSRef(&ref)))
         return errFileOpen;
 
-    FSCatalogInfo catalogInfo;
-    if (::FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catalogInfo, nullptr, nullptr, nullptr) != noErr)
-	{
-		return errFileOpen;
-	}
-
-	/* get a file comment, if possible */
-#if 1
-    // Carbon doesn't support GetWDInfo(). (Bug 555684)
-
-    // not sure why working directories are needed here...
-    comlen = 0;
-#else
-	long 		procID;
-	procID = 0;
-	GetWDInfo(p_ap_encode_obj->vRefNum, &fpb->ioVRefNum, &fpb->ioDirID, &procID);
-	IOParam 	vinfo;
-	memset((void *) &vinfo, '\0', sizeof (vinfo));
-	GetVolParmsInfoBuffer vp;
-	vinfo.ioCompletion  = nil;
-	vinfo.ioVRefNum 	= fpb->ioVRefNum;
-	vinfo.ioBuffer 		= (Ptr) &vp;
-	vinfo.ioReqCount 	= sizeof (vp);
-	comlen = 0;
-	if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr &&
-		((vp.vMAttrib >> bHasDesktopMgr) & 1))
-	{
-		DTPBRec 	dtp;
-		memset((void *) &dtp, '\0', sizeof (dtp));
-		dtp.ioVRefNum = fpb->ioVRefNum;
-		if (PBDTGetPath(&dtp) == noErr)
-		{
-			dtp.ioCompletion = nil;
-			dtp.ioDTBuffer = (Ptr) comment;
-			dtp.ioNamePtr  = fpb->ioNamePtr;
-			dtp.ioDirID    = fpb->ioFlParID;
-			if (PBDTGetCommentSync(&dtp) == noErr)
-				comlen = dtp.ioDTActCount;
-		}
-	}
-#endif /* ! 1 */
-	
-	/* write header */
-//	head.magic = dfork ? APPLESINGLE_MAGIC : APPLEDOUBLE_MAGIC;
-	head.magic   = APPLEDOUBLE_MAGIC;		/* always do apple double */
-	head.version = VERSION;
-	memset(head.fill, '\0', sizeof (head.fill));
-	head.entries = NUM_ENTRIES - 1;
-	status = to64(p_ap_encode_obj,
-					(char *) &head,
-					sizeof (head));				
-	if (status != noErr)
-		return status;
-
-	/* write entry descriptors */
-    nsAutoCString leafname;
-    macFile->GetNativeLeafName(leafname);
-	entries[0].offset = sizeof (head) + sizeof (ap_entry) * head.entries;
-	entries[0].id 	= ENT_NAME;
-    entries[0].length = leafname.Length();
-	entries[1].id 	= ENT_FINFO;
-	entries[1].length = sizeof (FInfo) + sizeof (FXInfo);
-	entries[2].id 	= ENT_DATES;
-	entries[2].length = sizeof (ap_dates);
-	entries[3].id 	= ENT_COMMENT;
-	entries[3].length = comlen;
-	entries[4].id 	= ENT_RFORK;
-    entries[4].length = catalogInfo.rsrcLogicalSize;
-	entries[5].id 	= ENT_DFORK;
-    entries[5].length = catalogInfo.dataLogicalSize;
-
-	/* correct the link in the entries. */
-	for (i = 1; i < NUM_ENTRIES; ++i)
-	{
-		entries[i].offset = entries[i-1].offset + entries[i-1].length;
-	}
-	status = to64(p_ap_encode_obj,
-					(char *) entries,
-					sizeof (ap_entry) * head.entries);
-	if (status != noErr)
-		return status;
-
-	/* write name */
-	status = to64(p_ap_encode_obj,
-					(char *) leafname.get(),
-					leafname.Length());
-	if (status != noErr)
-		return status;
-	
-	/* write finder info */
-	status = to64(p_ap_encode_obj,
-					(char *) &catalogInfo.finderInfo,
-					sizeof (FInfo));
-	if (status != noErr)
-		return status;
-					
-	status = to64(p_ap_encode_obj,
-					(char *) &catalogInfo.extFinderInfo,
-					sizeof (FXInfo));
-	if (status != noErr)
-		return status;
+    HFSUniStr255 forkName;
+    ::FSGetDataForkName(&forkName);
+    retval = ::FSOpenFork(&ref, forkName.length, forkName.unicode, fsRdPerm, &fileId);
+    if (retval != noErr)
+        return retval;
 
-	/* write dates */
-    dates.create = catalogInfo.createDate.lowSeconds + CONVERT_TIME;
-    dates.modify = catalogInfo.contentModDate.lowSeconds + CONVERT_TIME;
-    dates.backup = catalogInfo.backupDate.lowSeconds + CONVERT_TIME;
-    dates.access = catalogInfo.accessDate.lowSeconds + CONVERT_TIME;
-	status = to64(p_ap_encode_obj,
-					(char *) &dates,
-					sizeof (ap_dates));
-	if (status != noErr)
-		return status;
-	
-	/* write comment */
-	if (comlen)
-	{
-		status = to64(p_ap_encode_obj,
-					comment,
-					comlen * sizeof(char));
-	}
-	/*
-	**	Get some help information on deciding the file type.
-	*/
-    if (((FileInfo*)(&catalogInfo.finderInfo))->fileType == 'TEXT' ||
-        ((FileInfo*)(&catalogInfo.finderInfo))->fileType == 'text')
-	{
-		p_ap_encode_obj->text_file_type = true;
-	}
-	
-	return status;	
-}
-/*
-**	ap_encode_header
-**
-**		encode the file header and the resource fork.
-**
-*/
-int ap_encode_header(
-	appledouble_encode_object* p_ap_encode_obj,
-	bool    firstime)
-{
-	char   	rd_buff[256];
-    FSIORefNum fileId;
-	OSErr	retval = noErr;
-	int    	status;
-    ByteCount inCount;
-	
-	if (firstime)
-	{
-    PL_strcpy(rd_buff,
-			"Content-Type: application/applefile\r\nContent-Transfer-Encoding: base64\r\n\r\n");
-		status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
-		if (status != noErr)
-			return status;
-			
-		status = ap_encode_file_infor(p_ap_encode_obj);
-		if (status != noErr)
-			return status;
-		
-		/*
-		** preparing to encode the resource fork.
-		*/
-        nsCOMPtr <nsIFile> myFile;
-        NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true, getter_AddRefs(myFile));
-        if (!myFile)
-            return errFileOpen;
-
-        FSRef ref;
-        nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(myFile);
-        if (NS_FAILED(macFile->GetFSRef(&ref)))
-            return errFileOpen;
-
-        HFSUniStr255 forkName;
-        ::FSGetResourceForkName(&forkName);
-        retval = ::FSOpenFork(&ref, forkName.length, forkName.unicode, fsRdPerm, &p_ap_encode_obj->fileId);
-        if (retval != noErr)
-            return retval;
-	}
-
-	fileId = p_ap_encode_obj->fileId;
-	while (retval == noErr)
-	{
-		if (BUFF_LEFT(p_ap_encode_obj) < 400)
-			break;
-			
-        inCount = 0;
-        retval = ::FSReadFork(fileId, fsAtMark, 0, 256, rd_buff, &inCount);
-		if (inCount)
-		{
-			status = to64(p_ap_encode_obj,
-							rd_buff,
-							inCount);
-			if (status != noErr)
-				return status;
-		}
-	}
-	
-	if (retval == eofErr)
-	{
-        ::FSCloseFork(fileId);
-        p_ap_encode_obj->fileId = 0;
+    p_ap_encode_obj->fileId = fileId;
 
-		status = finish64(p_ap_encode_obj);
-		if (status != noErr)
-			return status;
-		
-		/*
-		** write out the boundary
-		*/
-		PR_snprintf(rd_buff, sizeof(rd_buff),
-						CRLF "--%s" CRLF,
-						p_ap_encode_obj->boundary);
-					
-		status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
-		if (status == noErr)
-			status = errDone;
-	}
-	return status;
-}
-
-#if 0
-// This is unused for now and Clang complains about that is it is ifdefed out
-static void replace(char *p, int len, char frm, char to)
-{
-	for (; len > 0; len--, p++)
-		if (*p == frm)	*p = to;
-}
-#endif
-
-/* Description of the various file formats and their magic numbers 		*/
-struct magic
-{
-    const char *name;			/* Name of the file format */
-    const char *num;			/* The magic number */
-    int        len;			/* Length (0 means strlen(magicnum)) */
-};
-
-/* The magic numbers of the file formats we know about */
-static struct magic magic[] =
-{
-    { "image/gif", 	"GIF", 			  0 },
-    { "image/jpeg", "\377\330\377",   0 },
-    { "video/mpeg", "\0\0\001\263",	  4 },
-    { "application/postscript", "%!", 0 },
-};
-static int num_magic = MOZ_ARRAY_LENGTH(magic);
-
-static const char *text_type    = TEXT_PLAIN;					/* the text file type. */
-static const char *default_type = APPLICATION_OCTET_STREAM;
-
-
-/*
- * Determines the format of the file "inputf".  The name
- * of the file format (or NULL on error) is returned.
- */
-static const char *magic_look(char *inbuff, int numread)
-{
-    int i, j;
-
-	for (i=0; i<num_magic; i++)
-	{
-	   	if (magic[i].len == 0)
-	   		magic[i].len = strlen(magic[i].num);
-	}
-
-    for (i=0; i<num_magic; i++)
+    if (!p_ap_encode_obj->text_file_type)
     {
-		if (numread >= magic[i].len)
-		{
-	    	for (j=0; j<magic[i].len; j++)
-	    	{
-				if (inbuff[j] != magic[i].num[j]) break;
-	    	}
-	    	
-	    	if (j == magic[i].len)
-	    		return magic[i].name;
-		}
-    }
-
-    return default_type;
-}
-/*
-**	ap_encode_data
-**
-**	---------------
-**
-**		encode on the data fork.
-**
-*/
-int ap_encode_data(
-	appledouble_encode_object* p_ap_encode_obj,
-	bool firstime)
-{
-	char   		rd_buff[256];
-    FSIORefNum fileId;
-	OSErr		retval = noErr;
-    ByteCount in_count;
-	int			status;
-	
-	if (firstime)
-	{	
-		const char* magic_type;
-			
-		/*
-		** preparing to encode the data fork.
-		*/
-        nsCOMPtr <nsIFile> resFile;
-        NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true,
-                              getter_AddRefs(resFile));
-        if (!resFile)
-            return errFileOpen;
-
-        FSRef ref;
-        nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(resFile);
-        if (NS_FAILED(macFile->GetFSRef(&ref)))
-            return errFileOpen;
-
-        HFSUniStr255 forkName;
-        ::FSGetDataForkName(&forkName);
-        retval = ::FSOpenFork(&ref, forkName.length, forkName.unicode, fsRdPerm, &fileId);
-        if (retval != noErr)
-            return retval;
-
-		p_ap_encode_obj->fileId = fileId;
-			
-		
-		if (!p_ap_encode_obj->text_file_type)
-		{	
       /*
-      **	do a smart check for the file type.
+      **  do a smart check for the file type.
       */
       in_count = 0;
       retval = ::FSReadFork(fileId, fsFromStart, 0, 256, rd_buff, &in_count);
       magic_type = magic_look(rd_buff, in_count);
 
       /* don't forget to rewind the index to start point. */
       ::FSSetForkPosition(fileId, fsFromStart, 0);
       /* and reset retVal just in case... */
       if (retval == eofErr)
         retval = noErr;
-		}
-		else
-		{
-			magic_type = text_type;		/* we already know it is a text type.	*/
-		}
+    }
+    else
+    {
+      magic_type = text_type;    /* we already know it is a text type.  */
+    }
 
-		/*
-		**	the data portion header information.
-		*/
+    /*
+    **  the data portion header information.
+    */
         nsAutoCString leafName;
         resFile->GetNativeLeafName(leafName);
-		PR_snprintf(rd_buff, sizeof(rd_buff),
-			"Content-Type: %s; name=\"%s\"" CRLF "Content-Transfer-Encoding: base64" CRLF "Content-Disposition: inline; filename=\"%s\"" CRLF CRLF,
-			magic_type,
-			leafName.get(),
-			leafName.get());
-			
-		status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
-		if (status != noErr)
-			return status;
-	}
-	
-	while (retval == noErr)
-	{
-		if (BUFF_LEFT(p_ap_encode_obj) < 400)
-			break;
-			
-        in_count = 0;
-        retval = ::FSReadFork(p_ap_encode_obj->fileId, fsAtMark, 0, 256, rd_buff, &in_count);
-		if (in_count)
-		{
+    PR_snprintf(rd_buff, sizeof(rd_buff),
+      "Content-Type: %s; name=\"%s\"" CRLF "Content-Transfer-Encoding: base64" CRLF "Content-Disposition: inline; filename=\"%s\"" CRLF CRLF,
+      magic_type,
+      leafName.get(),
+      leafName.get());
+
+    status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
+    if (status != noErr)
+      return status;
+  }
+
+  while (retval == noErr)
+  {
+    if (BUFF_LEFT(p_ap_encode_obj) < 400)
+      break;
+
+    in_count = 0;
+    retval = ::FSReadFork(p_ap_encode_obj->fileId, fsAtMark, 0, 256, rd_buff, &in_count);
+    if (in_count)
+    {
 #if 0
-/*			replace(rd_buff, in_count, '\r', '\n');	 						*/
+/*      replace(rd_buff, in_count, '\r', '\n');               */
 #endif
-/* ** may be need to do character set conversion here for localization.	**  */		
-			status = to64(p_ap_encode_obj,
-						rd_buff,
-						in_count);
-			if (status != noErr)
-				return status;
-		}
-	}
-	
-	if (retval == eofErr)
-	{
-        ::FSCloseFork(p_ap_encode_obj->fileId);
-        p_ap_encode_obj->fileId = 0;
+/* ** may be need to do character set conversion here for localization.  **  */
+      status = to64(p_ap_encode_obj,
+                    rd_buff,
+                    in_count);
+      if (status != noErr)
+        return status;
+    }
+  }
+
+  if (retval == eofErr)
+  {
+    ::FSCloseFork(p_ap_encode_obj->fileId);
+    p_ap_encode_obj->fileId = 0;
 
-		status = finish64(p_ap_encode_obj);
-		if (status != noErr)
-			return status;
-		
-		/* write out the boundary 	*/
-		
-		PR_snprintf(rd_buff, sizeof(rd_buff),
-						CRLF "--%s--" CRLF CRLF,
-						p_ap_encode_obj->boundary);
-	
-		status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
-	
-		if (status == noErr)				
-			status = errDone;
-	}
-	return status;
+    status = finish64(p_ap_encode_obj);
+    if (status != noErr)
+      return status;
+
+    /* write out the boundary   */
+
+    PR_snprintf(rd_buff, sizeof(rd_buff),
+                CRLF "--%s--" CRLF CRLF,
+                p_ap_encode_obj->boundary);
+
+    status = write_stream(p_ap_encode_obj, (const char*)rd_buff, strlen(rd_buff));
+
+    if (status == noErr)
+      status = errDone;
+  }
+  return status;
 }
 
 static char basis_64[] =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 /*
-**	convert the stream in the inbuff to 64 format and put it in the out buff.
+**  convert the stream in the inbuff to 64 format and put it in the out buff.
 **  To make the life easier, the caller will responcable of the checking of the outbuff's bundary.
 */
 static int
 to64(appledouble_encode_object* p_ap_encode_obj,
-	char	*p,
-	int 	in_size)
+  char  *p,
+  int   in_size)
 {
-	int 	status;
-    int c1, c2, c3, ct;
-    unsigned char *inbuff = (unsigned char*)p;
+  int   status;
+  int c1, c2, c3, ct;
+  unsigned char *inbuff = (unsigned char*)p;
+
+  ct = p_ap_encode_obj->ct;      /* the char count left last time. */
+
+  /*
+  **   resume the left state of the last conversion.
+  */
+  switch (p_ap_encode_obj->state64)
+  {
+    case 0:
+      p_ap_encode_obj->c1 = c1 = *inbuff ++;
+      if (--in_size <= 0)
+      {
+        p_ap_encode_obj->state64 = 1;
+        return noErr;
+      }
+      p_ap_encode_obj->c2 = c2 = *inbuff ++;
+      if (--in_size <= 0)
+      {
+        p_ap_encode_obj->state64 = 2;
+        return noErr;
+      }
+      c3 = *inbuff ++;    --in_size;
+      break;
+    case 1:
+      c1 = p_ap_encode_obj->c1;
+      p_ap_encode_obj->c2 = c2 = *inbuff ++;
+      if (--in_size <= 0)
+      {
+        p_ap_encode_obj->state64 = 2;
+        return noErr;
+      }
+      c3 = *inbuff ++;    --in_size;
+      break;
+    case 2:
+      c1 = p_ap_encode_obj->c1;
+      c2 = p_ap_encode_obj->c2;
+      c3 = *inbuff ++;    --in_size;
+      break;
+  }
 
-	ct = p_ap_encode_obj->ct;			/* the char count left last time. */
-	
-	/*
-	**	 resume the left state of the last conversion.
-	*/
-	switch (p_ap_encode_obj->state64)
-	{
-		case 0:
-			p_ap_encode_obj->c1 = c1 = *inbuff ++;
-			if (--in_size <= 0)
-			{
-				p_ap_encode_obj->state64 = 1;
-				return noErr;
-			}
-			p_ap_encode_obj->c2 = c2 = *inbuff ++;
-			if (--in_size <= 0)
-			{
-				p_ap_encode_obj->state64 = 2;
-				return noErr;
-			}
-			c3 = *inbuff ++;		--in_size;
-			break;
-		case 1:
-			c1 = p_ap_encode_obj->c1;
-			p_ap_encode_obj->c2 = c2 = *inbuff ++;
-			if (--in_size <= 0)
-			{
-				p_ap_encode_obj->state64 = 2;
-				return noErr;
-			}
-			c3 = *inbuff ++;		--in_size;
-			break;
-		case 2:
-			c1 = p_ap_encode_obj->c1;
-			c2 = p_ap_encode_obj->c2;
-			c3 = *inbuff ++;		--in_size;
-			break;
-	}
-	
-    while (in_size >= 0)
+  while (in_size >= 0)
+  {
+    status = output64chunk(p_ap_encode_obj,
+                           c1,
+                           c2,
+                           c3,
+                           0);
+    if (status != noErr)
+      return status;
+  
+    ct += 4;
+    if (ct > 71)
+    {
+      status = write_stream(p_ap_encode_obj,
+                CRLF,
+                2);
+      if (status != noErr)
+        return status;
+    
+      ct = 0;
+    }
+
+    if (in_size <= 0)
     {
-    	status = output64chunk(p_ap_encode_obj,
-    							c1,
-    							c2,
-    							c3,
-    							0);
-    	if (status != noErr)
-    		return status;
-    		
-    	ct += 4;
-        if (ct > 71)
-        {
-        	status = write_stream(p_ap_encode_obj,
-        						CRLF,
-        						2);
-        	if (status != noErr)
-        		return status;
-        		
-            ct = 0;
-        }
+      p_ap_encode_obj->state64 = 0;
+      break;
+    }
 
-		if (in_size <= 0)
-		{
-			p_ap_encode_obj->state64 = 0;
-			break;
-		}
-		
-		c1 = (int)*inbuff++;
-		if (--in_size <= 0)
-		{
-			p_ap_encode_obj->c1 = c1;
-			p_ap_encode_obj->state64 = 1;
-			break;
-		}
-		c2 = *inbuff++;
-		if (--in_size <= 0)
-		{
-			p_ap_encode_obj->c1 	 = c1;
-			p_ap_encode_obj->c2 	 = c2;
-			p_ap_encode_obj->state64 = 2;
-			break;
-		}
-		c3 = *inbuff++;
-		in_size--;
+    c1 = (int)*inbuff++;
+    if (--in_size <= 0)
+    {
+      p_ap_encode_obj->c1 = c1;
+      p_ap_encode_obj->state64 = 1;
+      break;
     }
-    p_ap_encode_obj->ct = ct;
-    return status;
+    c2 = *inbuff++;
+    if (--in_size <= 0)
+    {
+      p_ap_encode_obj->c1    = c1;
+      p_ap_encode_obj->c2    = c2;
+      p_ap_encode_obj->state64 = 2;
+      break;
+    }
+    c3 = *inbuff++;
+    in_size--;
+  }
+  p_ap_encode_obj->ct = ct;
+  return status;
 }
 
 /*
 ** clear the left base64 encodes.
 */
 static int
 finish64(appledouble_encode_object* p_ap_encode_obj)
 {
-	int status;
-	
-	switch (p_ap_encode_obj->state64)
-	{
-		case 0:
-			break;
-		case 1:
-			status = output64chunk(p_ap_encode_obj,
-									p_ap_encode_obj->c1,
-									0,
-									0,
-									2);
-			break;
-		case 2:
-			status = output64chunk(p_ap_encode_obj,
-									p_ap_encode_obj->c1,
-									p_ap_encode_obj->c2,
-									0,
-									1);
-			break;
-	}
-	status = write_stream(p_ap_encode_obj, CRLF, 2);
-	p_ap_encode_obj->state64 = 0;
-	p_ap_encode_obj->ct	  	 = 0;
-	return status;
+  int status;
+
+  switch (p_ap_encode_obj->state64)
+  {
+    case 0:
+      break;
+    case 1:
+      status = output64chunk(p_ap_encode_obj,
+                             p_ap_encode_obj->c1,
+                             0,
+                             0,
+                             2);
+      break;
+    case 2:
+      status = output64chunk(p_ap_encode_obj,
+                             p_ap_encode_obj->c1,
+                             p_ap_encode_obj->c2,
+                             0,
+                             1);
+      break;
+  }
+  status = write_stream(p_ap_encode_obj, CRLF, 2);
+  p_ap_encode_obj->state64 = 0;
+  p_ap_encode_obj->ct       = 0;
+  return status;
 }
 
 static int output64chunk(
-	appledouble_encode_object* p_ap_encode_obj,
-	int c1, int c2, int c3, int pads)
+  appledouble_encode_object* p_ap_encode_obj,
+  int c1, int c2, int c3, int pads)
 {
-	char tmpstr[32];
-	char *p = tmpstr;
-	
-    *p++ = basis_64[c1>>2];
-    *p++ = basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
-    if (pads == 2)
-    {
-        *p++ = '=';
-        *p++ = '=';
-    }
-    else if (pads)
-    {
-        *p++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
-        *p++ = '=';
-    }
-    else
-    {
-        *p++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
-        *p++ = basis_64[c3 & 0x3F];
-    }
-    return write_stream(p_ap_encode_obj, (const char*) tmpstr, p-tmpstr);
+  char tmpstr[32];
+  char *p = tmpstr;
+
+  *p++ = basis_64[c1>>2];
+  *p++ = basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)];
+  if (pads == 2)
+  {
+      *p++ = '=';
+      *p++ = '=';
+  }
+  else if (pads)
+  {
+      *p++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
+      *p++ = '=';
+  }
+  else
+  {
+      *p++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)];
+      *p++ = basis_64[c3 & 0x3F];
+  }
+  return write_stream(p_ap_encode_obj, (const char*) tmpstr, p-tmpstr);
 }
--- a/mailnews/compose/src/nsMsgAttachment.cpp
+++ b/mailnews/compose/src/nsMsgAttachment.cpp
@@ -251,12 +251,12 @@ nsresult nsMsgAttachment::DeleteAttachme
     {
       rv = urlFile->IsFile(&isAFile);
       NS_ASSERTION(NS_SUCCEEDED(rv), "IsFile() call failed!");
     }
   }
 
   // remove it if it's a valid file
   if (isAFile)
-	  rv = urlFile->Remove(false);
+    rv = urlFile->Remove(false);
 
   return rv;
 }
--- a/mailnews/compose/src/nsMsgCompUtils.cpp
+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
@@ -827,18 +827,18 @@ CONTENT_LOC_HACK:
         buf.AppendLiteral("%20");
       else if (*s == '\t')
         buf.AppendLiteral("%09");
       else if (*s == '\n')
         buf.AppendLiteral("%0A");
       else if (*s == '\r')
         buf.AppendLiteral("%0D");
       else {
-	      tmp[0]=*s;
-	      buf.Append(tmp);
+        tmp[0]=*s;
+        buf.Append(tmp);
       }
       s++;
       col += (buf.Length() - ot);
     }
     buf.AppendLiteral("\"" CRLF);
 
     /* rhp: this is to try to get around this fun problem with Content-Location */
     if (!useContentLocation) {
--- a/mailnews/compose/src/nsMsgComposeContentHandler.h
+++ b/mailnews/compose/src/nsMsgComposeContentHandler.h
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIContentHandler.h"
 #include "nsIMsgIdentity.h"
 
 class nsMsgComposeContentHandler : public nsIContentHandler
 {
 public:
-	nsMsgComposeContentHandler();
+  nsMsgComposeContentHandler();
 
-	NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
   NS_DECL_NSICONTENTHANDLER
 private:
-	virtual ~nsMsgComposeContentHandler();
+  virtual ~nsMsgComposeContentHandler();
   nsresult GetBestIdentity(nsIInterfaceRequestor* aWindowContext,
                            nsIMsgIdentity **identity);
 };
--- a/mailnews/compose/src/nsMsgComposeProgressParams.h
+++ b/mailnews/compose/src/nsMsgComposeProgressParams.h
@@ -3,18 +3,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIMsgComposeProgressParams.h"
 
 class nsMsgComposeProgressParams : public nsIMsgComposeProgressParams
 {
 public:
-	NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGCOMPOSEPROGRESSPARAMS
 
-	nsMsgComposeProgressParams();
+  nsMsgComposeProgressParams();
 
 private:
-	virtual ~nsMsgComposeProgressParams();
+  virtual ~nsMsgComposeProgressParams();
   nsString                          m_subject;
   MSG_DeliverMode                   m_deliveryMode;
 };
--- a/mailnews/compose/src/nsMsgComposeService.h
+++ b/mailnews/compose/src/nsMsgComposeService.h
@@ -18,29 +18,29 @@
 #define ICOMMANDLINEHANDLER nsICommandLineHandler
 
 class nsMsgComposeService :
   public nsIMsgComposeService,
   public ICOMMANDLINEHANDLER,
   public nsSupportsWeakReference
 {
 public:
-	nsMsgComposeService();
+  nsMsgComposeService();
 
-	NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
   NS_DECL_NSIMSGCOMPOSESERVICE
   NS_DECL_NSICOMMANDLINEHANDLER
 
   nsresult Init();
   void Reset();
   void DeleteCachedWindows();
   nsresult AddGlobalHtmlDomains();
 
 private:
-	virtual ~nsMsgComposeService();
+  virtual ~nsMsgComposeService();
   bool mLogComposePerformance;
 
   nsresult LoadDraftOrTemplate(const nsACString& aMsgURI, nsMimeOutputType aOutType,
                                nsIMsgIdentity * aIdentity, const char * aOriginalMsgURI,
                                nsIMsgDBHdr * aOrigMsgHdr, bool aForwardInline,
                                bool overrideComposeFormat,
                                nsIMsgWindow *aMsgWindow);
 
--- a/mailnews/compose/src/nsMsgCopy.cpp
+++ b/mailnews/compose/src/nsMsgCopy.cpp
@@ -189,17 +189,17 @@ nsMsgCopy::StartCopyOperation(nsIMsgIden
     if (!dstFolder || NS_FAILED(rv))
       return NS_MSG_UNABLE_TO_SAVE_DRAFT;
   }
   else if (aMode == nsIMsgSend::nsMsgSaveAsTemplate) // SaveAsTemplate (Templates)
   {
     rv = GetTemplatesFolder(aUserIdentity, getter_AddRefs(dstFolder), &waitForUrl);
     isDraft = false;
     if (!dstFolder || NS_FAILED(rv))
-	    return NS_MSG_UNABLE_TO_SAVE_TEMPLATE;
+      return NS_MSG_UNABLE_TO_SAVE_TEMPLATE;
   }
   else // SaveInSentFolder (Sent) -  nsMsgDeliverNow or nsMsgSendUnsent
   {
     rv = GetSentFolder(aUserIdentity, getter_AddRefs(dstFolder), &waitForUrl);
     isDraft = false;
     if (!dstFolder || NS_FAILED(rv))
       return NS_MSG_COULDNT_OPEN_FCC_FOLDER;
   }
@@ -529,17 +529,17 @@ LocateMessageFolder(nsIMsgIdentity   *us
 //
 // Figure out if a folder is local or not and return a boolean to
 // say so.
 //
 nsresult
 MessageFolderIsLocal(nsIMsgIdentity   *userIdentity,
                      nsMsgDeliverMode aFolderType,
                      const char       *aFolderURI,
-		     bool 	      *aResult)
+                     bool            *aResult)
 {
   nsresult rv;
 
   if (!aFolderURI) return NS_ERROR_NULL_POINTER;
 
   nsCOMPtr <nsIURL> url;
   rv = NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID).SetSpec(nsDependentCString(aFolderURI))
                                                      .Finalize(url);
--- a/mailnews/compose/src/nsMsgCopy.h
+++ b/mailnews/compose/src/nsMsgCopy.h
@@ -42,21 +42,21 @@ public:
   NS_IMETHOD SetMessageKey(nsMsgKey aMessageKey) override;
 
   NS_IMETHOD GetMessageId(nsACString& aMessageId) override;
 
   NS_IMETHOD OnStopCopy(nsresult aStatus) override;
 
   NS_IMETHOD SetMsgComposeAndSendObject(nsIMsgSend *obj);
 
-  bool                            mCopyInProgress;
+  bool mCopyInProgress;
 
 private:
   virtual ~CopyListener();
-  nsCOMPtr<nsIMsgSend>       mComposeAndSend;
+  nsCOMPtr<nsIMsgSend> mComposeAndSend;
 };
 
 //
 // This is a class that deals with processing remote attachments. It implements
 // an nsIStreamListener interface to deal with incoming data
 //
 class nsMsgCopy : public nsIUrlListener
 {
@@ -67,54 +67,54 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLLISTENER
 
 
   //////////////////////////////////////////////////////////////////////
   // Object methods...
   //////////////////////////////////////////////////////////////////////
   //
-  nsresult              StartCopyOperation(nsIMsgIdentity       *aUserIdentity,
+  nsresult              StartCopyOperation(nsIMsgIdentity   *aUserIdentity,
                                            nsIFile          *aFile,
-                                           nsMsgDeliverMode     aMode,
-                                           nsIMsgSend           *aMsgSendObj,
-                                           const char           *aSavePref,
-                                           nsIMsgDBHdr          *aMsgToReplace);
+                                           nsMsgDeliverMode aMode,
+                                           nsIMsgSend       *aMsgSendObj,
+                                           const char       *aSavePref,
+                                           nsIMsgDBHdr      *aMsgToReplace);
 
   nsresult              DoCopy(nsIFile *aDiskFile, nsIMsgFolder *dstFolder,
                                nsIMsgDBHdr *aMsgToReplace, bool aIsDraft,
                                nsIMsgWindow *msgWindow,
                                nsIMsgSend   *aMsgSendObj);
 
-  nsresult	GetUnsentMessagesFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
-  nsresult	GetDraftsFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
-  nsresult	GetTemplatesFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
-  nsresult	GetSentFolder(nsIMsgIdentity *userIdentity,  nsIMsgFolder **msgFolder, bool *waitForUrl);
-  nsresult   CreateIfMissing(nsIMsgFolder **folder, bool *waitForUrl);
+  nsresult GetUnsentMessagesFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
+  nsresult GetDraftsFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
+  nsresult GetTemplatesFolder(nsIMsgIdentity *userIdentity, nsIMsgFolder **msgFolder, bool *waitForUrl);
+  nsresult GetSentFolder(nsIMsgIdentity *userIdentity,  nsIMsgFolder **msgFolder, bool *waitForUrl);
+  nsresult CreateIfMissing(nsIMsgFolder **folder, bool *waitForUrl);
 
 
   //
   // Vars for implementation...
   //
-  nsIFile                     *mFile;     // the file we are sending...
-  nsMsgDeliverMode                mMode;
-  nsCOMPtr<nsIMsgFolder>          mDstFolder;
-  nsCOMPtr<nsIMsgDBHdr>           mMsgToReplace;
-  bool                            mIsDraft;
-  nsCOMPtr<nsIMsgSend>            mMsgSendObj;
-  char                            *mSavePref;
+  nsIFile                *mFile;     // the file we are sending...
+  nsMsgDeliverMode       mMode;
+  nsCOMPtr<nsIMsgFolder> mDstFolder;
+  nsCOMPtr<nsIMsgDBHdr>  mMsgToReplace;
+  bool                   mIsDraft;
+  nsCOMPtr<nsIMsgSend>   mMsgSendObj;
+  char                   *mSavePref;
 
 private:
   virtual ~nsMsgCopy();
 };
 
 // Useful function for the back end...
-nsresult	LocateMessageFolder(nsIMsgIdentity   *userIdentity,
-                                       nsMsgDeliverMode aFolderType,
-                                       const char       *aSaveURI,
-				       nsIMsgFolder **msgFolder);
+nsresult LocateMessageFolder(nsIMsgIdentity   *userIdentity,
+                             nsMsgDeliverMode aFolderType,
+                             const char       *aSaveURI,
+                             nsIMsgFolder **msgFolder);
 
-nsresult	MessageFolderIsLocal(nsIMsgIdentity   *userIdentity,
-                                       nsMsgDeliverMode aFolderType,
-                                       const char       *aSaveURI,
-				       bool		*aResult);
+nsresult MessageFolderIsLocal(nsIMsgIdentity   *userIdentity,
+                              nsMsgDeliverMode aFolderType,
+                              const char       *aSaveURI,
+                              bool             *aResult);
 
 #endif /* _nsMsgCopy_H_ */
--- a/mailnews/compose/src/nsMsgQuote.cpp
+++ b/mailnews/compose/src/nsMsgQuote.cpp
@@ -34,17 +34,17 @@ nsMsgQuoteListener::nsMsgQuoteListener()
 }
 
 nsMsgQuoteListener::~nsMsgQuoteListener()
 {
 }
 
 NS_IMETHODIMP nsMsgQuoteListener::SetMsgQuote(nsIMsgQuote * msgQuote)
 {
-	mMsgQuote = do_GetWeakReference(msgQuote);
+  mMsgQuote = do_GetWeakReference(msgQuote);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgQuoteListener::GetMsgQuote(nsIMsgQuote ** aMsgQuote)
 {
   nsresult rv = NS_OK;
   if (aMsgQuote)
   {
--- a/mailnews/compose/src/nsMsgQuote.h
+++ b/mailnews/compose/src/nsMsgQuote.h
@@ -13,40 +13,40 @@
 #include "nsCOMPtr.h"
 #include "nsWeakReference.h"
 
 class nsMsgQuote;
 
 class nsMsgQuoteListener: public nsIMsgQuoteListener
 {
 public:
-	nsMsgQuoteListener();
+  nsMsgQuoteListener();
 
-	NS_DECL_THREADSAFE_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
 
-	// nsIMimeStreamConverterListener support
-	NS_DECL_NSIMIMESTREAMCONVERTERLISTENER
+  // nsIMimeStreamConverterListener support
+  NS_DECL_NSIMIMESTREAMCONVERTERLISTENER
   NS_DECL_NSIMSGQUOTELISTENER
 
 private:
-	virtual ~nsMsgQuoteListener();
+  virtual ~nsMsgQuoteListener();
   nsWeakPtr mMsgQuote;
 };
 
 class nsMsgQuote: public nsIMsgQuote, public nsSupportsWeakReference {
 public:
   nsMsgQuote();
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMSGQUOTE
 
 private:
   virtual ~nsMsgQuote();
   //
   // Implementation data...
   //
   nsCOMPtr<nsIMsgQuotingOutputStreamListener> mStreamListener;
-  bool			mQuoteHeaders;
+  bool mQuoteHeaders;
   nsCOMPtr<nsIMsgQuoteListener> mQuoteListener;
   nsCOMPtr<nsIChannel> mQuoteChannel;
 };
 
 #endif /* __nsMsgQuote_h__ */
--- a/mailnews/compose/src/nsMsgSendPart.h
+++ b/mailnews/compose/src/nsMsgSendPart.h
@@ -12,90 +12,90 @@
 
 namespace mozilla {
 namespace mailnews {
 class MimeEncoder;
 }
 }
 
 typedef int (*MSG_SendPartWriteFunc)(const char* line, int32_t size,
-									                   bool isheader, void* closure);
+                                     bool isheader, void* closure);
 
 class nsMsgSendPart {
   typedef mozilla::mailnews::MimeEncoder MimeEncoder;
 public:
     nsMsgSendPart(nsIMsgSend* state, const char *part_charset = NULL);
-    virtual ~nsMsgSendPart();	  // Note that the destructor also destroys
-								                // any children that were added.
+    virtual ~nsMsgSendPart();  // Note that the destructor also destroys
+                               // any children that were added.
 
     virtual nsresult  Write();
 
     virtual nsresult    SetFile(nsIFile *filename);
-    const nsIFile  *GetFile() {return m_file;}
+    const nsIFile       *GetFile() {return m_file;}
 
     virtual nsresult  SetBuffer(const char* buffer);
     const char        *GetBuffer() {return m_buffer;}
 
     virtual nsresult  SetType(const char* type);
     const char        *GetType() {return m_type;}
 
     const char        *GetCharsetName() {return m_charset_name;}
 
     virtual nsresult  SetOtherHeaders(const char* other);
     const char        *SetOtherHeaders() {return m_other;}
-	  virtual nsresult  AppendOtherHeaders(const char* moreother);
+    virtual nsresult  AppendOtherHeaders(const char* moreother);
 
-	  virtual nsresult  SetMimeDeliveryState(nsIMsgSend* state);
+    virtual nsresult  SetMimeDeliveryState(nsIMsgSend* state);
 
   // Note that the nsMsgSendPart class will take over ownership of the
   // MimeEncoderData* object, deleting it when it chooses.  (This is
   // necessary because deleting these objects is the only current way to
   // flush out the data in them.)
   void                SetEncoder(MimeEncoder* encoder) {m_encoder = encoder;}
   MimeEncoder         *GetEncoder() {return m_encoder;}
 
-	void                SetStripSensitiveHeaders(bool value)
+  void                SetStripSensitiveHeaders(bool value)
                       {
-		                    m_strip_sensitive_headers = value;
-	                    }
-	bool                GetStripSensitiveHeaders() {return m_strip_sensitive_headers;}
+                        m_strip_sensitive_headers = value;
+                      }
+  bool                GetStripSensitiveHeaders() {return m_strip_sensitive_headers;}
 
   virtual nsresult    AddChild(nsMsgSendPart* child);
 
-	int32_t             GetNumChildren() {return m_numchildren;}
-	nsMsgSendPart       *GetChild(int32_t which);
-	nsMsgSendPart       *DetachChild(int32_t which);
+  int32_t             GetNumChildren() {return m_numchildren;}
+  nsMsgSendPart       *GetChild(int32_t which);
+  nsMsgSendPart       *DetachChild(int32_t which);
 
-	virtual nsresult    SetMainPart(bool value);
-	bool                IsMainPart()
+  virtual nsresult    SetMainPart(bool value);
+  bool                IsMainPart()
                       {
                         return m_mainpart;
                       }
   nsCString           m_partNum;
 protected:
-	nsresult            CopyString(char** dest, const char* src);
-	nsresult            PushBody(const char* buffer, int32_t length);
+  nsresult            CopyString(char** dest, const char* src);
+  nsresult            PushBody(const char* buffer, int32_t length);
 
-	nsCOMPtr<nsIMsgSend> m_state;
-	nsMsgSendPart       *m_parent;
+  nsCOMPtr<nsIMsgSend> m_state;
+  nsMsgSendPart       *m_parent;
   nsCOMPtr <nsIFile>   m_file;
-	char                *m_buffer;
+  char                *m_buffer;
   char                *m_type;
   char                *m_other;
   char                m_charset_name[64+1];        // charset name associated with this part
-	bool                m_strip_sensitive_headers;
+  bool                m_strip_sensitive_headers;
   nsAutoPtr<MimeEncoder> m_encoder;
 
-	nsMsgSendPart       **m_children;
-	int32_t             m_numchildren;
+  nsMsgSendPart       **m_children;
+  int32_t             m_numchildren;
 
-	// Data used while actually writing.
+  // Data used while actually writing.
   bool                m_firstBlock;
   bool                m_needIntlConversion;
 
-	bool                m_mainpart;
+  bool                m_mainpart;
 
-	bool                m_just_hit_CR;
+  bool                m_just_hit_CR;
 
-	static int32_t      M_counter;
+  static int32_t      M_counter;
 };
 
 #endif /* _MsgSendPart_H_ */
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -159,29 +159,29 @@ nsresult nsExplainErrorDetails(nsISmtpUr
      traditional ASCII range of 1- 127 decimal to be transmitted in an esmtp-value. Because the ENVID and
      ORCPT parameters may need to convey values outside this range, the esmtp-values for these parameters are
      encoded as "xtext". "xtext" is formally defined as follows:
 
      xtext = *( xchar / hexchar )
 
      xchar = any ASCII CHAR between "!" (33) and "~" (126) inclusive, except for "+" and "=".
 
-	; "hexchar"s are intended to encode octets that cannot appear
-	; as ASCII characters within an esmtp-value.
+    ; "hexchar"s are intended to encode octets that cannot appear
+    ; as ASCII characters within an esmtp-value.
 
-		 hexchar = ASCII "+" immediately followed by two upper case hexadecimal digits
+         hexchar = ASCII "+" immediately followed by two upper case hexadecimal digits
 
-	When encoding an octet sequence as xtext:
+    When encoding an octet sequence as xtext:
 
-	+ Any ASCII CHAR between "!" and "~" inclusive, except for "+" and "=",
-		 MAY be encoded as itself. (A CHAR in this range MAY instead be encoded as a "hexchar", at the
-		 implementor's discretion.)
+    + Any ASCII CHAR between "!" and "~" inclusive, except for "+" and "=",
+         MAY be encoded as itself. (A CHAR in this range MAY instead be encoded as a "hexchar", at the
+         implementor's discretion.)
 
-	+ ASCII CHARs that fall outside the range above must be encoded as
-		 "hexchar".
+    + ASCII CHARs that fall outside the range above must be encoded as
+         "hexchar".
 
  */
 /* caller must free the return buffer */
 static char *
 esmtp_value_encode(const char *addr)
 {
   char *buffer = (char *) PR_Malloc(512); /* esmtp ORCPT allow up to 500 chars encoded addresses */
   char *bp = buffer, *bpEnd = buffer+500;
@@ -1890,41 +1890,39 @@ void nsSmtpProtocol::SendMessageInFile()
 
   UpdateStatus("smtpDeliveringMail");
   m_nextState = SMTP_RESPONSE;
   m_nextStateAfterResponse = SMTP_SEND_MESSAGE_RESPONSE;
 }
 
 void nsSmtpProtocol::SendPostData()
 {
-	// mscott: as a first pass, I'm writing everything at once and am not
-	// doing it in chunks...
+  // mscott: as a first pass, I'm writing everything at once and am not
+  // doing it in chunks...
 
-	/* returns 0 on done and negative on error
-	 * positive if it needs to continue.
-	 */
+  /* returns 0 on done and negative on error
+   * positive if it needs to continue.
+   */
 
-	// check to see if url is a file..if it is...call our file handler...
-	bool postMessageInFile = true;
-	m_runningURL->GetPostMessage(&postMessageInFile);
-	if (postMessageInFile)
-	{
-		SendMessageInFile();
-	}
+  // check to see if url is a file..if it is...call our file handler...
+  bool postMessageInFile = true;
+  m_runningURL->GetPostMessage(&postMessageInFile);
+  if (postMessageInFile)
+  {
+    SendMessageInFile();
+  }
 
-	/* Update the thermo and the status bar.  This is done by hand, rather
-	   than using the FE_GraphProgress* functions, because there seems to be
-	   no way to make FE_GraphProgress shut up and not display anything more
-	   when all the data has arrived.  At the end, we want to show the
-	   "message sent; waiting for reply" status; FE_GraphProgress gets in
-	   the way of that.  See bug #23414. */
+  /* Update the thermo and the status bar.  This is done by hand, rather
+     than using the FE_GraphProgress* functions, because there seems to be
+     no way to make FE_GraphProgress shut up and not display anything more
+     when all the data has arrived.  At the end, we want to show the
+     "message sent; waiting for reply" status; FE_GraphProgress gets in
+     the way of that.  See bug #23414. */
 }
 
-
-
 nsresult nsSmtpProtocol::SendMessageResponse()
 {
   if((m_responseCode/10 != 25))
   {
     mozilla::DebugOnly<nsresult> rv = nsExplainErrorDetails(m_runningURL,
                                                             NS_ERROR_SENDING_MESSAGE,
                                                             m_responseText.get(), nullptr);
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to explain SMTP error");
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -165,24 +165,24 @@ private:
     // Communication methods --> Reading and writing protocol
     ////////////////////////////////////////////////////////////////////////////////////////
 
     void UpdateStatus(const char* aStatusName);
     void UpdateStatusWithString(const char16_t * aStatusString);
 
     ////////////////////////////////////////////////////////////////////////////////////////
     // Protocol Methods --> This protocol is state driven so each protocol method is
-    //						designed to re-act to the current "state". I've attempted to
-    //						group them together based on functionality.
+    //                      designed to re-act to the current "state". I've attempted to
+    //                      group them together based on functionality.
     ////////////////////////////////////////////////////////////////////////////////////////
 
     nsresult SmtpResponse(nsIInputStream * inputStream, uint32_t length);
     nsresult ExtensionLoginResponse(nsIInputStream * inputStream, uint32_t length);
     nsresult SendHeloResponse(nsIInputStream * inputStream, uint32_t length);
-    nsresult SendEhloResponse(nsIInputStream * inputStream, uint32_t length);	
+    nsresult SendEhloResponse(nsIInputStream * inputStream, uint32_t length);
     nsresult SendQuit(SmtpState aNextStateAfterResponse = SMTP_DONE);
 
     nsresult AuthGSSAPIFirst();
     nsresult AuthGSSAPIStep();
     nsresult AuthLoginStep0();
     void     AuthLoginStep0Response();
     nsresult AuthLoginStep1();
     nsresult AuthLoginStep2();
--- a/mailnews/compose/src/nsSmtpService.cpp
+++ b/mailnews/compose/src/nsSmtpService.cpp
@@ -99,17 +99,17 @@ NS_IMETHODIMP nsSmtpService::SendMailMes
   {
     if (!aPassword.IsEmpty())
       smtpServer->SetPassword(aPassword);
 
     // this ref counts urlToRun
     rv = NS_MsgBuildSmtpUrl(aFilePath, smtpServer, aRecipients, aSenderIdentity, aSender,
                             aUrlListener, aStatusFeedback,
                             aNotificationCallbacks, &urlToRun, aRequestDSN);
-    if (NS_SUCCEEDED(rv) && urlToRun)	
+    if (NS_SUCCEEDED(rv) && urlToRun)
       rv = NS_MsgLoadSmtpUrl(urlToRun, nullptr, aRequest);
 
     if (aURL) // does the caller want a handle on the url?
       *aURL = urlToRun; // transfer our ref count to the caller....
     else
       NS_IF_RELEASE(urlToRun);
   }
 
--- a/mailnews/compose/src/nsSmtpService.h
+++ b/mailnews/compose/src/nsSmtpService.h
@@ -19,36 +19,36 @@
 // on line (as part of the N2 project). So I reserve the right to change my mind and take
 // this service away =).
 ////////////////////////////////////////////////////////////////////////////////////////
 
 class nsSmtpService : public nsISmtpService, public nsIProtocolHandler
 {
 public:
 
-	nsSmtpService();
-	
-	NS_DECL_ISUPPORTS
+  nsSmtpService();
+
+  NS_DECL_ISUPPORTS
 
-	////////////////////////////////////////////////////////////////////////
-	// we support the nsISmtpService interface
-	////////////////////////////////////////////////////////////////////////
-	NS_DECL_NSISMTPSERVICE
+  ////////////////////////////////////////////////////////////////////////
+  // we support the nsISmtpService interface
+  ////////////////////////////////////////////////////////////////////////
+  NS_DECL_NSISMTPSERVICE
 
-	//////////////////////////////////////////////////////////////////////////
-	// we support the nsIProtocolHandler interface
-	//////////////////////////////////////////////////////////////////////////
+  //////////////////////////////////////////////////////////////////////////
+  // we support the nsIProtocolHandler interface
+  //////////////////////////////////////////////////////////////////////////
   NS_DECL_NSIPROTOCOLHANDLER
 
 protected:
     nsresult loadSmtpServers();
 
 
 private:
-	virtual ~nsSmtpService();
+  virtual ~nsSmtpService();
     static bool findServerByKey(nsISmtpServer *aServer, void *aData);
     static bool findServerByHostname(nsISmtpServer *aServer, void *aData);
 
     nsresult createKeyedServer(const char* key,
                                nsISmtpServer **aResult = nullptr);
     nsresult saveKeyList();
 
     nsCOMArray<nsISmtpServer> mSmtpServers;
--- a/mailnews/compose/src/nsSmtpUrl.cpp
+++ b/mailnews/compose/src/nsSmtpUrl.cpp
@@ -381,138 +381,138 @@ nsMailtoUrl::GetNewsHostPart(nsACString 
 }
 
 //////////////////////////////////////////////////////////////////////////////
 // Begin nsIURI support
 //////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP nsMailtoUrl::GetSpec(nsACString &aSpec)
 {
-	return m_baseURL->GetSpec(aSpec);
+  return m_baseURL->GetSpec(aSpec);
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetPrePath(nsACString &aPrePath)
 {
-	return m_baseURL->GetPrePath(aPrePath);
+  return m_baseURL->GetPrePath(aPrePath);
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetScheme(nsACString &aScheme)
 {
-	return m_baseURL->GetScheme(aScheme);
+  return m_baseURL->GetScheme(aScheme);
 }
 
 nsresult nsMailtoUrl::SetScheme(const nsACString &aScheme)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetScheme(aScheme).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetUserPass(nsACString &aUserPass)
 {
-	return m_baseURL->GetUserPass(aUserPass);
+  return m_baseURL->GetUserPass(aUserPass);
 }
 
 nsresult nsMailtoUrl::SetUserPass(const nsACString &aUserPass)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetUserPass(aUserPass).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetUsername(nsACString &aUsername)
 {
-	return m_baseURL->GetUsername(aUsername);
+  return m_baseURL->GetUsername(aUsername);
 }
 
 nsresult nsMailtoUrl::SetUsername(const nsACString &aUsername)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetUsername(aUsername).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetPassword(nsACString &aPassword)
 {
-	return m_baseURL->GetPassword(aPassword);
+  return m_baseURL->GetPassword(aPassword);
 }
 
 nsresult nsMailtoUrl::SetPassword(const nsACString &aPassword)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetPassword(aPassword).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetHostPort(nsACString &aHostPort)
 {
-	return m_baseURL->GetHost(aHostPort);
+  return m_baseURL->GetHost(aHostPort);
 }
 
 nsresult nsMailtoUrl::SetHostPort(const nsACString &aHostPort)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetHostPort(aHostPort).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetHost(nsACString &aHost)
 {
-	return m_baseURL->GetHost(aHost);
+  return m_baseURL->GetHost(aHost);
 }
 
 nsresult nsMailtoUrl::SetHost(const nsACString &aHost)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetHost(aHost).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetPort(int32_t *aPort)
 {
-	return m_baseURL->GetPort(aPort);
+  return m_baseURL->GetPort(aPort);
 }
 
 nsresult nsMailtoUrl::SetPort(int32_t aPort)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetPort(aPort).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetPathQueryRef(nsACString &aPath)
 {
-	return m_baseURL->GetPathQueryRef(aPath);
+  return m_baseURL->GetPathQueryRef(aPath);
 }
 
 nsresult nsMailtoUrl::SetPathQueryRef(const nsACString &aPath)
 {
   nsresult rv = NS_MutateURI(m_baseURL).SetPathQueryRef(aPath).Finalize(m_baseURL);
   NS_ENSURE_SUCCESS(rv, rv);
-	return ParseUrl();
+  return ParseUrl();
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetAsciiHost(nsACString &aHostA)
 {
-	return m_baseURL->GetAsciiHost(aHostA);
+  return m_baseURL->GetAsciiHost(aHostA);
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetAsciiHostPort(nsACString &aHostPortA)
 {
-	return m_baseURL->GetAsciiHostPort(aHostPortA);
+  return m_baseURL->GetAsciiHostPort(aHostPortA);
 }
 
 NS_IMETHODIMP nsMailtoUrl::GetAsciiSpec(nsACString &aSpecA)
 {
-	return m_baseURL->GetAsciiSpec(aSpecA);
+  return m_baseURL->GetAsciiSpec(aSpecA);
 }
 
 NS_IMETHODIMP nsMailtoUrl::SchemeIs(const char *aScheme, bool *_retval)
 {
-	return m_baseURL->SchemeIs(aScheme, _retval);
+  return m_baseURL->SchemeIs(aScheme, _retval);
 }
 
 NS_IMETHODIMP nsMailtoUrl::Equals(nsIURI *other, bool *_retval)
 {
   // The passed-in URI might be an nsMailtoUrl. Pass our inner URL to its
   // Equals method. The other nsMailtoUrl will then pass its inner URL to
   // to the Equals method of our inner URL. Other URIs will return false.
   if (other)