Bug 995730 - Fix style violations in xpcom/io/. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Wed, 14 May 2014 23:15:46 +0300
changeset 183302 f20eb963186959bde60b7ce8f505bb4903e19063
parent 183301 e836b7e1101399e0255eec9514bc6c3f0f8db490
child 183303 a8775731e2feb3f4a103f0dbb6862e356be44130
push id26789
push userkwierso@gmail.com
push dateThu, 15 May 2014 22:59:59 +0000
treeherdermozilla-central@58c5a3427997 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs995730
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 995730 - Fix style violations in xpcom/io/. r=froydnj
xpcom/io/Base64.cpp
xpcom/io/Base64.h
xpcom/io/CocoaFileUtils.h
xpcom/io/FileUtilsWin.cpp
xpcom/io/FileUtilsWin.h
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/SpecialSystemDirectory.h
xpcom/io/nsAnonymousTemporaryFile.cpp
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsAppFileLocationProvider.h
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsBinaryStream.h
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsDirectoryService.h
xpcom/io/nsDirectoryServiceUtils.h
xpcom/io/nsEscape.cpp
xpcom/io/nsEscape.h
xpcom/io/nsIOUtil.cpp
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsLinebreakConverter.cpp
xpcom/io/nsLinebreakConverter.h
xpcom/io/nsLocalFile.h
xpcom/io/nsLocalFileCommon.cpp
xpcom/io/nsLocalFileUnix.cpp
xpcom/io/nsLocalFileUnix.h
xpcom/io/nsLocalFileWin.cpp
xpcom/io/nsLocalFileWin.h
xpcom/io/nsMultiplexInputStream.cpp
xpcom/io/nsMultiplexInputStream.h
xpcom/io/nsNativeCharsetUtils.cpp
xpcom/io/nsNativeCharsetUtils.h
xpcom/io/nsPipe.h
xpcom/io/nsPipe3.cpp
xpcom/io/nsScriptableBase64Encoder.cpp
xpcom/io/nsScriptableBase64Encoder.h
xpcom/io/nsScriptableInputStream.cpp
xpcom/io/nsScriptableInputStream.h
xpcom/io/nsSegmentedBuffer.cpp
xpcom/io/nsSegmentedBuffer.h
xpcom/io/nsStorageStream.cpp
xpcom/io/nsStorageStream.h
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStreamUtils.h
xpcom/io/nsStringStream.cpp
xpcom/io/nsUnicharInputStream.cpp
xpcom/io/nsUnicharInputStream.h
xpcom/io/nsWildCard.cpp
xpcom/io/nsWildCard.h
--- a/xpcom/io/Base64.cpp
+++ b/xpcom/io/Base64.cpp
@@ -9,111 +9,111 @@
 #include "nsIInputStream.h"
 #include "nsString.h"
 
 #include "plbase64.h"
 
 namespace {
 
 // BEGIN base64 encode code copied and modified from NSPR
-const unsigned char *base = (unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+const unsigned char* base =
+  (unsigned char*)"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                  "abcdefghijklmnopqrstuvwxyz"
+                  "0123456789+/";
 
 template <typename T>
 static void
-Encode3to4(const unsigned char *src, T *dest)
+Encode3to4(const unsigned char* aSrc, T* aDest)
 {
   uint32_t b32 = (uint32_t)0;
   int i, j = 18;
 
-  for( i = 0; i < 3; i++ )
-  {
+  for (i = 0; i < 3; ++i) {
     b32 <<= 8;
-    b32 |= (uint32_t)src[i];
+    b32 |= (uint32_t)aSrc[i];
   }
 
-  for( i = 0; i < 4; i++ )
-  {
-    dest[i] = base[ (uint32_t)((b32>>j) & 0x3F) ];
+  for (i = 0; i < 4; ++i) {
+    aDest[i] = base[(uint32_t)((b32 >> j) & 0x3F)];
     j -= 6;
   }
 }
 
 template <typename T>
 static void
-Encode2to4(const unsigned char *src, T *dest)
+Encode2to4(const unsigned char* aSrc, T* aDest)
 {
-  dest[0] = base[ (uint32_t)((src[0]>>2) & 0x3F) ];
-  dest[1] = base[ (uint32_t)(((src[0] & 0x03) << 4) | ((src[1] >> 4) & 0x0F)) ];
-  dest[2] = base[ (uint32_t)((src[1] & 0x0F) << 2) ];
-  dest[3] = (unsigned char)'=';
+  aDest[0] = base[(uint32_t)((aSrc[0] >> 2) & 0x3F)];
+  aDest[1] = base[(uint32_t)(((aSrc[0] & 0x03) << 4) | ((aSrc[1] >> 4) & 0x0F))];
+  aDest[2] = base[(uint32_t)((aSrc[1] & 0x0F) << 2)];
+  aDest[3] = (unsigned char)'=';
 }
 
 template <typename T>
 static void
-Encode1to4(const unsigned char *src, T *dest)
+Encode1to4(const unsigned char* aSrc, T* aDest)
 {
-  dest[0] = base[ (uint32_t)((src[0]>>2) & 0x3F) ];
-  dest[1] = base[ (uint32_t)((src[0] & 0x03) << 4) ];
-  dest[2] = (unsigned char)'=';
-  dest[3] = (unsigned char)'=';
+  aDest[0] = base[(uint32_t)((aSrc[0] >> 2) & 0x3F)];
+  aDest[1] = base[(uint32_t)((aSrc[0] & 0x03) << 4)];
+  aDest[2] = (unsigned char)'=';
+  aDest[3] = (unsigned char)'=';
 }
 
 template <typename T>
 static void
-Encode(const unsigned char *src, uint32_t srclen, T *dest)
+Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest)
 {
-  while( srclen >= 3 )
-  {
-    Encode3to4(src, dest);
-    src += 3;
-    dest += 4;
-    srclen -= 3;
+  while (aSrcLen >= 3) {
+    Encode3to4(aSrc, aDest);
+    aSrc += 3;
+    aDest += 4;
+    aSrcLen -= 3;
   }
 
-  switch( srclen )
-  {
+  switch (aSrcLen) {
     case 2:
-      Encode2to4(src, dest);
+      Encode2to4(aSrc, aDest);
       break;
     case 1:
-      Encode1to4(src, dest);
+      Encode1to4(aSrc, aDest);
       break;
     case 0:
       break;
     default:
       NS_NOTREACHED("coding error");
   }
 }
 
 // END base64 encode code copied and modified from NSPR.
 
 template <typename T>
-struct EncodeInputStream_State {
+struct EncodeInputStream_State
+{
   unsigned char c[3];
   uint8_t charsOnStack;
   typename T::char_type* buffer;
 };
 
 template <typename T>
 NS_METHOD
-EncodeInputStream_Encoder(nsIInputStream *aStream,
-                          void *aClosure,
-                          const char *aFromSegment,
+EncodeInputStream_Encoder(nsIInputStream* aStream,
+                          void* aClosure,
+                          const char* aFromSegment,
                           uint32_t aToOffset,
                           uint32_t aCount,
-                          uint32_t *aWriteCount)
+                          uint32_t* aWriteCount)
 {
   NS_ASSERTION(aCount > 0, "Er, what?");
 
   EncodeInputStream_State<T>* state =
     static_cast<EncodeInputStream_State<T>*>(aClosure);
 
   // If we have any data left from last time, encode it now.
   uint32_t countRemaining = aCount;
-  const unsigned char *src = (const unsigned char*)aFromSegment;
+  const unsigned char* src = (const unsigned char*)aFromSegment;
   if (state->charsOnStack) {
     unsigned char firstSet[4];
     if (state->charsOnStack == 1) {
       firstSet[0] = state->c[0];
       firstSet[1] = src[0];
       firstSet[2] = (countRemaining > 1) ? src[1] : '\0';
       firstSet[3] = '\0';
     } else /* state->charsOnStack == 2 */ {
@@ -149,119 +149,127 @@ EncodeInputStream_Encoder(nsIInputStream
     state->charsOnStack = countRemaining;
   }
 
   return NS_OK;
 }
 
 template <typename T>
 nsresult
-EncodeInputStream(nsIInputStream *aInputStream,
-                  T &aDest,
+EncodeInputStream(nsIInputStream* aInputStream,
+                  T& aDest,
                   uint32_t aCount,
                   uint32_t aOffset)
 {
   nsresult rv;
   uint64_t count64 = aCount;
 
   if (!aCount) {
     rv = aInputStream->Available(&count64);
-    if (NS_WARN_IF(NS_FAILED(rv)))
+    if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
+    }
     // if count64 is over 4GB, it will be failed at the below condition,
     // then will return NS_ERROR_OUT_OF_MEMORY
     aCount = (uint32_t)count64;
   }
 
   uint64_t countlong =
     (count64 + 2) / 3 * 4; // +2 due to integer math.
-  if (countlong + aOffset > UINT32_MAX)
+  if (countlong + aOffset > UINT32_MAX) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   uint32_t count = uint32_t(countlong);
 
   aDest.SetLength(count + aOffset);
-  if (aDest.Length() != count + aOffset)
+  if (aDest.Length() != count + aOffset) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   EncodeInputStream_State<T> state;
   state.charsOnStack = 0;
   state.c[2] = '\0';
   state.buffer = aOffset + aDest.BeginWriting();
 
   while (1) {
     uint32_t read = 0;
 
     rv = aInputStream->ReadSegments(&EncodeInputStream_Encoder<T>,
                                     (void*)&state,
                                     aCount,
                                     &read);
     if (NS_FAILED(rv)) {
-      if (rv == NS_BASE_STREAM_WOULD_BLOCK)
+      if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
         NS_RUNTIMEABORT("Not implemented for async streams!");
-      if (rv == NS_ERROR_NOT_IMPLEMENTED)
+      }
+      if (rv == NS_ERROR_NOT_IMPLEMENTED) {
         NS_RUNTIMEABORT("Requires a stream that implements ReadSegments!");
+      }
       return rv;
     }
 
-    if (!read)
+    if (!read) {
       break;
+    }
   }
 
   // Finish encoding if anything is left
-  if (state.charsOnStack)
+  if (state.charsOnStack) {
     Encode(state.c, state.charsOnStack, state.buffer);
+  }
 
-  if (aDest.Length())
+  if (aDest.Length()) {
     // May belong to an nsCString with an unallocated buffer, so only null
     // terminate if there is a need to.
     *aDest.EndWriting() = '\0';
+  }
 
   return NS_OK;
 }
 
 } // namespace (anonymous)
 
 namespace mozilla {
 
 nsresult
-Base64EncodeInputStream(nsIInputStream *aInputStream,
-                        nsACString &aDest,
+Base64EncodeInputStream(nsIInputStream* aInputStream,
+                        nsACString& aDest,
                         uint32_t aCount,
                         uint32_t aOffset)
 {
   return EncodeInputStream<nsACString>(aInputStream, aDest, aCount, aOffset);
 }
 
 nsresult
-Base64EncodeInputStream(nsIInputStream *aInputStream,
-                        nsAString &aDest,
+Base64EncodeInputStream(nsIInputStream* aInputStream,
+                        nsAString& aDest,
                         uint32_t aCount,
                         uint32_t aOffset)
 {
   return EncodeInputStream<nsAString>(aInputStream, aDest, aCount, aOffset);
 }
 
 nsresult
-Base64Encode(const nsACString &aBinaryData, nsACString &aString)
+Base64Encode(const nsACString& aBinaryData, nsACString& aString)
 {
   // Check for overflow.
   if (aBinaryData.Length() > (UINT32_MAX / 4) * 3) {
     return NS_ERROR_FAILURE;
   }
 
   // Don't ask PR_Base64Encode to encode empty strings
   if (aBinaryData.IsEmpty()) {
     aString.Truncate();
     return NS_OK;
   }
 
   uint32_t stringLen = ((aBinaryData.Length() + 2) / 3) * 4;
 
-  char *buffer;
+  char* buffer;
 
   // Add one byte for null termination.
   if (aString.SetCapacity(stringLen + 1, fallible_t()) &&
       (buffer = aString.BeginWriting()) &&
       PL_Base64Encode(aBinaryData.BeginReading(), aBinaryData.Length(), buffer)) {
     // PL_Base64Encode doesn't null terminate the buffer for us when we pass
     // the buffer in. Do that manually.
     buffer[stringLen] = '\0';
@@ -270,48 +278,48 @@ Base64Encode(const nsACString &aBinaryDa
     return NS_OK;
   }
 
   aString.Truncate();
   return NS_ERROR_INVALID_ARG;
 }
 
 nsresult
-Base64Encode(const nsAString &aString, nsAString &aBinaryData)
+Base64Encode(const nsAString& aString, nsAString& aBinaryData)
 {
   NS_LossyConvertUTF16toASCII string(aString);
   nsAutoCString binaryData;
 
   nsresult rv = Base64Encode(string, binaryData);
   if (NS_SUCCEEDED(rv)) {
     CopyASCIItoUTF16(binaryData, aBinaryData);
   } else {
     aBinaryData.Truncate();
   }
 
   return rv;
 }
 
 nsresult
-Base64Decode(const nsACString &aString, nsACString &aBinaryData)
+Base64Decode(const nsACString& aString, nsACString& aBinaryData)
 {
   // Check for overflow.
   if (aString.Length() > UINT32_MAX / 3) {
     return NS_ERROR_FAILURE;
   }
 
   // Don't ask PR_Base64Decode to decode the empty string
   if (aString.IsEmpty()) {
     aBinaryData.Truncate();
     return NS_OK;
   }
 
   uint32_t binaryDataLen = ((aString.Length() * 3) / 4);
 
-  char *buffer;
+  char* buffer;
 
   // Add one byte for null termination.
   if (aBinaryData.SetCapacity(binaryDataLen + 1, fallible_t()) &&
       (buffer = aBinaryData.BeginWriting()) &&
       PL_Base64Decode(aString.BeginReading(), aString.Length(), buffer)) {
     // PL_Base64Decode doesn't null terminate the buffer for us when we pass
     // the buffer in. Do that manually, taking into account the number of '='
     // characters we were passed.
@@ -328,17 +336,17 @@ Base64Decode(const nsACString &aString, 
     return NS_OK;
   }
 
   aBinaryData.Truncate();
   return NS_ERROR_INVALID_ARG;
 }
 
 nsresult
-Base64Decode(const nsAString &aBinaryData, nsAString &aString)
+Base64Decode(const nsAString& aBinaryData, nsAString& aString)
 {
   NS_LossyConvertUTF16toASCII binaryData(aBinaryData);
   nsAutoCString string;
 
   nsresult rv = Base64Decode(binaryData, string);
   if (NS_SUCCEEDED(rv)) {
     CopyASCIItoUTF16(string, aString);
   } else {
--- a/xpcom/io/Base64.h
+++ b/xpcom/io/Base64.h
@@ -8,31 +8,31 @@
 
 #include "nsString.h"
 
 class nsIInputStream;
 
 namespace mozilla {
 
 nsresult
-Base64EncodeInputStream(nsIInputStream *aInputStream,
-                        nsACString &aDest,
+Base64EncodeInputStream(nsIInputStream* aInputStream,
+                        nsACString& aDest,
                         uint32_t aCount,
                         uint32_t aOffset = 0);
 nsresult
-Base64EncodeInputStream(nsIInputStream *aInputStream,
-                        nsAString &aDest,
+Base64EncodeInputStream(nsIInputStream* aInputStream,
+                        nsAString& aDest,
                         uint32_t aCount,
                         uint32_t aOffset = 0);
 
 nsresult
-Base64Encode(const nsACString &aString, nsACString &aBinary);
+Base64Encode(const nsACString& aString, nsACString& aBinary);
 nsresult
-Base64Encode(const nsAString &aString, nsAString &aBinaryData);
+Base64Encode(const nsAString& aString, nsAString& aBinaryData);
 
 nsresult
-Base64Decode(const nsACString &aBinaryData, nsACString &aString);
+Base64Decode(const nsACString& aBinaryData, nsACString& aString);
 nsresult
-Base64Decode(const nsAString &aBinaryData, nsAString &aString);
+Base64Decode(const nsAString& aBinaryData, nsAString& aString);
 
 } // namespace mozilla
 
 #endif
--- a/xpcom/io/CocoaFileUtils.h
+++ b/xpcom/io/CocoaFileUtils.h
@@ -10,18 +10,18 @@
 #ifndef CocoaFileUtils_h_
 #define CocoaFileUtils_h_
 
 #include "nscore.h"
 #include <CoreFoundation/CoreFoundation.h>
 
 namespace CocoaFileUtils {
 
-nsresult RevealFileInFinder(CFURLRef url);
-nsresult OpenURL(CFURLRef url);
-nsresult GetFileCreatorCode(CFURLRef url, OSType *creatorCode);
-nsresult SetFileCreatorCode(CFURLRef url, OSType creatorCode);
-nsresult GetFileTypeCode(CFURLRef url, OSType *typeCode);
-nsresult SetFileTypeCode(CFURLRef url, OSType typeCode);
+nsresult RevealFileInFinder(CFURLRef aUrl);
+nsresult OpenURL(CFURLRef aUrl);
+nsresult GetFileCreatorCode(CFURLRef aUrl, OSType* aCreatorCode);
+nsresult SetFileCreatorCode(CFURLRef aUrl, OSType aCreatorCode);
+nsresult GetFileTypeCode(CFURLRef aUrl, OSType* aTypeCode);
+nsresult SetFileTypeCode(CFURLRef aUrl, OSType aTypeCode);
 
 } // namespace CocoaFileUtils
 
 #endif
--- a/xpcom/io/FileUtilsWin.cpp
+++ b/xpcom/io/FileUtilsWin.cpp
@@ -12,18 +12,24 @@
 #include "nsWindowsHelpers.h"
 
 namespace {
 
 // Scoped type used by HandleToFilename
 struct ScopedMappedViewTraits
 {
   typedef void* type;
-  static void* empty() { return nullptr; }
-  static void release(void* ptr) { UnmapViewOfFile(ptr); }
+  static void* empty()
+  {
+    return nullptr;
+  }
+  static void release(void* aPtr)
+  {
+    UnmapViewOfFile(aPtr);
+  }
 };
 typedef mozilla::Scoped<ScopedMappedViewTraits> ScopedMappedView;
 
 } // anonymous namespace
 
 namespace mozilla {
 
 bool
--- a/xpcom/io/FileUtilsWin.h
+++ b/xpcom/io/FileUtilsWin.h
@@ -29,17 +29,17 @@ NtPathToDosPath(const nsAString& aNtPath
       Substring(aNtPath, 0, symLinkPrefixLen).Equals(symLinkPrefix)) {
     // Symbolic link for DOS device. Just strip off the prefix.
     aDosPath = aNtPath;
     aDosPath.Cut(0, 4);
     return true;
   }
   nsAutoString logicalDrives;
   DWORD len = 0;
-  while(true) {
+  while (true) {
     len = GetLogicalDriveStringsW(len, reinterpret_cast<wchar_t*>(logicalDrives.BeginWriting()));
     if (!len) {
       return false;
     } else if (len > logicalDrives.Length()) {
       logicalDrives.SetLength(len);
     } else {
       break;
     }
@@ -51,17 +51,18 @@ NtPathToDosPath(const nsAString& aNtPath
   wchar_t driveTemplate[] = L" :";
   do {
     // Unfortunately QueryDosDevice doesn't support the idiom for querying the
     // output buffer size, so it may require retries.
     driveTemplate[0] = *cur;
     DWORD targetPathLen = 0;
     SetLastError(ERROR_SUCCESS);
     while (true) {
-      targetPathLen = QueryDosDeviceW(driveTemplate, reinterpret_cast<wchar_t*>(targetPath.BeginWriting()),
+      targetPathLen = QueryDosDeviceW(driveTemplate,
+                                      reinterpret_cast<wchar_t*>(targetPath.BeginWriting()),
                                       targetPath.Length());
       if (targetPathLen || GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
         break;
       }
       targetPath.SetLength(targetPath.Length() * 2);
     }
     if (targetPathLen) {
       // Need to use wcslen here because targetPath contains embedded NULL chars
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -51,83 +51,86 @@ using mozilla::IsWin7OrLater;
 #define MAXPATHLEN 1024
 #endif
 #endif
 
 #ifdef XP_WIN
 typedef HRESULT (WINAPI* nsGetKnownFolderPath)(GUID& rfid,
                                                DWORD dwFlags,
                                                HANDLE hToken,
-                                               PWSTR *ppszPath);
+                                               PWSTR* ppszPath);
 
 static nsGetKnownFolderPath gGetKnownFolderPath = nullptr;
 #endif
 
-void StartupSpecialSystemDirectory()
+void
+StartupSpecialSystemDirectory()
 {
 #if defined (XP_WIN)
   // SHGetKnownFolderPath is only available on Windows Vista
   // so that we need to use GetProcAddress to get the pointer.
   HMODULE hShell32DLLInst = GetModuleHandleW(L"shell32.dll");
-  if(hShell32DLLInst)
-  {
+  if (hShell32DLLInst) {
     gGetKnownFolderPath = (nsGetKnownFolderPath)
       GetProcAddress(hShell32DLLInst, "SHGetKnownFolderPath");
   }
 #endif
 }
 
 #if defined (XP_WIN)
 
-static nsresult GetKnownFolder(GUID* guid, nsIFile** aFile)
+static nsresult
+GetKnownFolder(GUID* aGuid, nsIFile** aFile)
 {
-  if (!guid || !gGetKnownFolderPath)
+  if (!aGuid || !gGetKnownFolderPath) {
     return NS_ERROR_FAILURE;
+  }
 
   PWSTR path = nullptr;
-  gGetKnownFolderPath(*guid, 0, nullptr, &path);
+  gGetKnownFolderPath(*aGuid, 0, nullptr, &path);
 
-  if (!path)
+  if (!path) {
     return NS_ERROR_FAILURE;
+  }
 
   nsresult rv = NS_NewLocalFile(nsDependentString(path),
                                 true,
                                 aFile);
 
   CoTaskMemFree(path);
   return rv;
 }
 
 static nsresult
-GetWindowsFolder(int folder, nsIFile** aFile)
+GetWindowsFolder(int aFolder, nsIFile** aFile)
 {
   WCHAR path_orig[MAX_PATH + 3];
-  WCHAR *path = path_orig+1;
-  HRESULT result = SHGetSpecialFolderPathW(nullptr, path, folder, true);
+  WCHAR* path = path_orig + 1;
+  HRESULT result = SHGetSpecialFolderPathW(nullptr, path, aFolder, true);
 
-  if (!SUCCEEDED(result))
+  if (!SUCCEEDED(result)) {
     return NS_ERROR_FAILURE;
+  }
 
   // Append the trailing slash
   int len = wcslen(path);
-  if (len > 1 && path[len - 1] != L'\\')
-  {
+  if (len > 1 && path[len - 1] != L'\\') {
     path[len]   = L'\\';
     path[++len] = L'\0';
   }
 
   return NS_NewLocalFile(nsDependentString(path, len), true, aFile);
 }
 
 __inline HRESULT
 SHLoadLibraryFromKnownFolder(REFKNOWNFOLDERID aFolderId, DWORD aMode,
-                             REFIID riid, void **ppv)
+                             REFIID riid, void** ppv)
 {
   *ppv = nullptr;
-  IShellLibrary *plib;
+  IShellLibrary* plib;
   HRESULT hr = CoCreateInstance(CLSID_ShellLibrary, nullptr,
                                 CLSCTX_INPROC_SERVER,
                                 IID_PPV_ARGS(&plib));
   if (SUCCEEDED(hr)) {
     hr = plib->LoadLibraryFromKnownFolder(aFolderId, aMode);
     if (SUCCEEDED(hr)) {
       hr = plib->QueryInterface(riid, ppv);
     }
@@ -141,18 +144,19 @@ SHLoadLibraryFromKnownFolder(REFKNOWNFOL
  * save-to location for the Windows Library passed in through aFolderId.
  * Otherwise falls back on pre-win7 GetWindowsFolder.
  */
 static nsresult
 GetLibrarySaveToPath(int aFallbackFolderId, REFKNOWNFOLDERID aFolderId,
                      nsIFile** aFile)
 {
   // Skip off checking for library support if the os is Vista or lower.
-  if (!IsWin7OrLater())
+  if (!IsWin7OrLater()) {
     return GetWindowsFolder(aFallbackFolderId, aFile);
+  }
 
   nsRefPtr<IShellLibrary> shellLib;
   nsRefPtr<IShellItem> savePath;
   HRESULT hr =
     SHLoadLibraryFromKnownFolder(aFolderId, STGM_READ,
                                  IID_IShellLibrary, getter_AddRefs(shellLib));
 
   if (shellLib &&
@@ -173,55 +177,57 @@ GetLibrarySaveToPath(int aFallbackFolder
   return GetWindowsFolder(aFallbackFolderId, aFile);
 }
 
 /**
  * Provides a fallback for getting the path to APPDATA or LOCALAPPDATA by
  * querying the registry when the call to SHGetSpecialFolderPathW is unable to
  * provide these paths (Bug 513958).
  */
-static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
+static nsresult
+GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
 {
   HKEY key;
   NS_NAMED_LITERAL_STRING(keyName,
     "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
   DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, KEY_READ,
                               &key);
-  if (res != ERROR_SUCCESS)
+  if (res != ERROR_SUCCESS) {
     return NS_ERROR_FAILURE;
+  }
 
   WCHAR path[MAX_PATH + 2];
   DWORD type, size;
   res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
                          nullptr, &type, (LPBYTE)&path, &size);
   ::RegCloseKey(key);
   // The call to RegQueryValueExW must succeed, the type must be REG_SZ, the
   // buffer size must not equal 0, and the buffer size be a multiple of 2.
-  if (res != ERROR_SUCCESS || type != REG_SZ || size == 0 || size % 2 != 0)
+  if (res != ERROR_SUCCESS || type != REG_SZ || size == 0 || size % 2 != 0) {
     return NS_ERROR_FAILURE;
+  }
 
   // Append the trailing slash
   int len = wcslen(path);
-  if (len > 1 && path[len - 1] != L'\\')
-  {
+  if (len > 1 && path[len - 1] != L'\\') {
     path[len]   = L'\\';
     path[++len] = L'\0';
   }
 
   return NS_NewLocalFile(nsDependentString(path, len), true, aFile);
 }
 
 #endif // XP_WIN
 
 #if defined(XP_UNIX)
 static nsresult
 GetUnixHomeDir(nsIFile** aFile)
 {
 #ifdef VMS
-  char *pHome;
+  char* pHome;
   pHome = getenv("HOME");
   if (*pHome == '/') {
     return NS_NewNativeLocalFile(nsDependentCString(pHome),
                                  true,
                                  aFile);
   } else {
     return NS_NewNativeLocalFile(nsDependentCString(decc$translate_vms(pHome)),
                                  true,
@@ -257,134 +263,147 @@ GetUnixHomeDir(nsIFile** aFile)
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   SOFTWARE.
 */
 
-static char *
-xdg_user_dir_lookup (const char *type)
+static char*
+xdg_user_dir_lookup(const char* aType)
 {
-  FILE *file;
-  char *home_dir, *config_home, *config_file;
+  FILE* file;
+  char* home_dir;
+  char* config_home;
+  char* config_file;
   char buffer[512];
-  char *user_dir;
-  char *p, *d;
+  char* user_dir;
+  char* p;
+  char* d;
   int len;
   int relative;
 
-  home_dir = getenv ("HOME");
-
-  if (home_dir == nullptr)
-    goto error;
-
-  config_home = getenv ("XDG_CONFIG_HOME");
-  if (config_home == nullptr || config_home[0] == 0)
-  {
-    config_file = (char*) malloc (strlen (home_dir) + strlen ("/.config/user-dirs.dirs") + 1);
-    if (config_file == nullptr)
-      goto error;
+  home_dir = getenv("HOME");
 
-    strcpy (config_file, home_dir);
-    strcat (config_file, "/.config/user-dirs.dirs");
-  }
-  else
-  {
-    config_file = (char*) malloc (strlen (config_home) + strlen ("/user-dirs.dirs") + 1);
-    if (config_file == nullptr)
-      goto error;
-
-    strcpy (config_file, config_home);
-    strcat (config_file, "/user-dirs.dirs");
+  if (!home_dir) {
+    goto error;
   }
 
-  file = fopen (config_file, "r");
-  free (config_file);
-  if (file == nullptr)
+  config_home = getenv("XDG_CONFIG_HOME");
+  if (!config_home || config_home[0] == 0) {
+    config_file = (char*)malloc(strlen(home_dir) +
+                                strlen("/.config/user-dirs.dirs") + 1);
+    if (!config_file) {
+      goto error;
+    }
+
+    strcpy(config_file, home_dir);
+    strcat(config_file, "/.config/user-dirs.dirs");
+  } else {
+    config_file = (char*)malloc(strlen(config_home) +
+                                strlen("/user-dirs.dirs") + 1);
+    if (!config_file) {
+      goto error;
+    }
+
+    strcpy(config_file, config_home);
+    strcat(config_file, "/user-dirs.dirs");
+  }
+
+  file = fopen(config_file, "r");
+  free(config_file);
+  if (!file) {
     goto error;
+  }
 
   user_dir = nullptr;
-  while (fgets (buffer, sizeof (buffer), file))
-  {
+  while (fgets(buffer, sizeof(buffer), file)) {
     /* Remove newline at end */
-    len = strlen (buffer);
-    if (len > 0 && buffer[len-1] == '\n')
-      buffer[len-1] = 0;
+    len = strlen(buffer);
+    if (len > 0 && buffer[len - 1] == '\n') {
+      buffer[len - 1] = 0;
+    }
 
     p = buffer;
-    while (*p == ' ' || *p == '\t')
+    while (*p == ' ' || *p == '\t') {
       p++;
+    }
 
-    if (strncmp (p, "XDG_", 4) != 0)
+    if (strncmp(p, "XDG_", 4) != 0) {
       continue;
+    }
     p += 4;
-    if (strncmp (p, type, strlen (type)) != 0)
+    if (strncmp(p, aType, strlen(aType)) != 0) {
       continue;
-    p += strlen (type);
-    if (strncmp (p, "_DIR", 4) != 0)
+    }
+    p += strlen(aType);
+    if (strncmp(p, "_DIR", 4) != 0) {
       continue;
+    }
     p += 4;
 
-    while (*p == ' ' || *p == '\t')
+    while (*p == ' ' || *p == '\t') {
       p++;
+    }
 
-    if (*p != '=')
+    if (*p != '=') {
       continue;
+    }
     p++;
 
-    while (*p == ' ' || *p == '\t')
+    while (*p == ' ' || *p == '\t') {
       p++;
+    }
 
-    if (*p != '"')
+    if (*p != '"') {
       continue;
+    }
     p++;
 
     relative = 0;
-    if (strncmp (p, "$HOME/", 6) == 0)
-    {
+    if (strncmp(p, "$HOME/", 6) == 0) {
       p += 6;
       relative = 1;
+    } else if (*p != '/') {
+      continue;
     }
-    else if (*p != '/')
-      continue;
 
-    if (relative)
-    {
-      user_dir = (char*) malloc (strlen (home_dir) + 1 + strlen (p) + 1);
-      if (user_dir == nullptr)
+    if (relative) {
+      user_dir = (char*)malloc(strlen(home_dir) + 1 + strlen(p) + 1);
+      if (!user_dir) {
         goto error2;
+      }
 
-      strcpy (user_dir, home_dir);
-      strcat (user_dir, "/");
-    }
-    else
-    {
-      user_dir = (char*) malloc (strlen (p) + 1);
-      if (user_dir == nullptr)
+      strcpy(user_dir, home_dir);
+      strcat(user_dir, "/");
+    } else {
+      user_dir = (char*)malloc(strlen(p) + 1);
+      if (!user_dir) {
         goto error2;
+      }
 
       *user_dir = 0;
     }
 
-    d = user_dir + strlen (user_dir);
-    while (*p && *p != '"')
-    {
-      if ((*p == '\\') && (*(p+1) != 0))
+    d = user_dir + strlen(user_dir);
+    while (*p && *p != '"') {
+      if ((*p == '\\') && (*(p + 1) != 0)) {
         p++;
+      }
       *d++ = *p++;
     }
     *d = 0;
   }
 error2:
-  fclose (file);
+  fclose(file);
 
-  if (user_dir)
+  if (user_dir) {
     return user_dir;
+  }
 
 error:
   return nullptr;
 }
 
 static const char xdg_user_dirs[] =
   "DESKTOP\0"
   "DOCUMENTS\0"
@@ -405,51 +424,53 @@ static const uint8_t xdg_user_dir_offset
   54,
   64
 };
 
 static nsresult
 GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory,
                         nsIFile** aFile)
 {
-  char *dir = xdg_user_dir_lookup
-    (xdg_user_dirs + xdg_user_dir_offsets[aSystemDirectory -
-                                          Unix_XDG_Desktop]);
+  char* dir = xdg_user_dir_lookup(
+    xdg_user_dirs + xdg_user_dir_offsets[aSystemDirectory - Unix_XDG_Desktop]);
 
   nsresult rv;
   nsCOMPtr<nsIFile> file;
   if (dir) {
     rv = NS_NewNativeLocalFile(nsDependentCString(dir), true,
                                getter_AddRefs(file));
     free(dir);
   } else if (Unix_XDG_Desktop == aSystemDirectory) {
     // for the XDG desktop dir, fall back to HOME/Desktop
     // (for historical compatibility)
     rv = GetUnixHomeDir(getter_AddRefs(file));
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
     rv = file->AppendNative(NS_LITERAL_CSTRING("Desktop"));
-  }
-  else {
+  } else {
     // no fallback for the other XDG dirs
     rv = NS_ERROR_FAILURE;
   }
 
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   bool exists;
   rv = file->Exists(&exists);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
   if (!exists) {
     rv = file->Create(nsIFile::DIRECTORY_TYPE, 0755);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
   }
 
   *aFile = nullptr;
   file.swap(*aFile);
 
   return NS_OK;
 }
 #endif
@@ -459,74 +480,78 @@ GetSpecialSystemDirectory(SystemDirector
                           nsIFile** aFile)
 {
 #if defined(XP_WIN)
   WCHAR path[MAX_PATH];
 #else
   char path[MAXPATHLEN];
 #endif
 
-  switch (aSystemSystemDirectory)
-  {
+  switch (aSystemSystemDirectory) {
     case OS_CurrentWorkingDirectory:
 #if defined(XP_WIN)
-      if (!_wgetcwd(path, MAX_PATH))
+      if (!_wgetcwd(path, MAX_PATH)) {
         return NS_ERROR_FAILURE;
+      }
       return NS_NewLocalFile(nsDependentString(path),
                              true,
                              aFile);
 #else
-      if(!getcwd(path, MAXPATHLEN))
+      if (!getcwd(path, MAXPATHLEN)) {
         return NS_ERROR_FAILURE;
+      }
 #endif
 
 #if !defined(XP_WIN)
       return NS_NewNativeLocalFile(nsDependentCString(path),
                                    true,
                                    aFile);
 #endif
 
     case OS_DriveDirectory:
 #if defined (XP_WIN)
     {
       int32_t len = ::GetWindowsDirectoryW(path, MAX_PATH);
-      if (len == 0)
+      if (len == 0) {
         break;
-      if (path[1] == char16_t(':') && path[2] == char16_t('\\'))
+      }
+      if (path[1] == char16_t(':') && path[2] == char16_t('\\')) {
         path[3] = 0;
+      }
 
       return NS_NewLocalFile(nsDependentString(path),
                              true,
                              aFile);
     }
 #else
     return NS_NewNativeLocalFile(nsDependentCString("/"),
                                  true,
                                  aFile);
 
 #endif
 
     case OS_TemporaryDirectory:
 #if defined (XP_WIN)
     {
       DWORD len = ::GetTempPathW(MAX_PATH, path);
-      if (len == 0)
+      if (len == 0) {
         break;
+      }
       return NS_NewLocalFile(nsDependentString(path, len),
                              true,
                              aFile);
     }
 #elif defined(MOZ_WIDGET_COCOA)
     {
       return GetOSXFolderType(kUserDomain, kTemporaryFolderType, aFile);
     }
 
 #elif defined(XP_UNIX)
     {
-      static const char *tPath = nullptr;
+      static const char* tPath = nullptr;
       if (!tPath) {
         tPath = PR_GetEnv("TMPDIR");
         if (!tPath || !*tPath) {
           tPath = PR_GetEnv("TMP");
           if (!tPath || !*tPath) {
             tPath = PR_GetEnv("TEMP");
             if (!tPath || !*tPath) {
               tPath = "/tmp/";
@@ -537,243 +562,216 @@ GetSpecialSystemDirectory(SystemDirector
       return NS_NewNativeLocalFile(nsDependentCString(tPath),
                                    true,
                                    aFile);
     }
 #else
     break;
 #endif
 #if defined (XP_WIN)
-    case Win_SystemDirectory:
-    {
+    case Win_SystemDirectory: {
       int32_t len = ::GetSystemDirectoryW(path, MAX_PATH);
 
       // Need enough space to add the trailing backslash
-      if (!len || len > MAX_PATH - 2)
+      if (!len || len > MAX_PATH - 2) {
         break;
+      }
       path[len]   = L'\\';
       path[++len] = L'\0';
 
       return NS_NewLocalFile(nsDependentString(path, len),
                              true,
                              aFile);
     }
 
-    case Win_WindowsDirectory:
-    {
+    case Win_WindowsDirectory: {
       int32_t len = ::GetWindowsDirectoryW(path, MAX_PATH);
 
       // Need enough space to add the trailing backslash
-      if (!len || len > MAX_PATH - 2)
+      if (!len || len > MAX_PATH - 2) {
         break;
+      }
 
       path[len]   = L'\\';
       path[++len] = L'\0';
 
       return NS_NewLocalFile(nsDependentString(path, len),
                              true,
                              aFile);
     }
 
-    case Win_ProgramFiles:
-    {
+    case Win_ProgramFiles: {
       return GetWindowsFolder(CSIDL_PROGRAM_FILES, aFile);
     }
 
-    case Win_HomeDirectory:
-    {
+    case Win_HomeDirectory: {
       nsresult rv = GetWindowsFolder(CSIDL_PROFILE, aFile);
-      if (NS_SUCCEEDED(rv))
+      if (NS_SUCCEEDED(rv)) {
         return rv;
+      }
 
       int32_t len;
-      if ((len = ::GetEnvironmentVariableW(L"HOME", path, MAX_PATH)) > 0)
-      {
+      if ((len = ::GetEnvironmentVariableW(L"HOME", path, MAX_PATH)) > 0) {
         // Need enough space to add the trailing backslash
-        if (len > MAX_PATH - 2)
+        if (len > MAX_PATH - 2) {
           break;
+        }
 
         path[len]   = L'\\';
         path[++len] = L'\0';
 
         rv = NS_NewLocalFile(nsDependentString(path, len),
                              true,
                              aFile);
-        if (NS_SUCCEEDED(rv))
+        if (NS_SUCCEEDED(rv)) {
           return rv;
+        }
       }
 
       len = ::GetEnvironmentVariableW(L"HOMEDRIVE", path, MAX_PATH);
-      if (0 < len && len < MAX_PATH)
-      {
+      if (0 < len && len < MAX_PATH) {
         WCHAR temp[MAX_PATH];
         DWORD len2 = ::GetEnvironmentVariableW(L"HOMEPATH", temp, MAX_PATH);
-        if (0 < len2 && len + len2 < MAX_PATH)
+        if (0 < len2 && len + len2 < MAX_PATH) {
           wcsncat(path, temp, len2);
+        }
 
         len = wcslen(path);
 
         // Need enough space to add the trailing backslash
-        if (len > MAX_PATH - 2)
+        if (len > MAX_PATH - 2) {
           break;
+        }
 
         path[len]   = L'\\';
         path[++len] = L'\0';
 
         return NS_NewLocalFile(nsDependentString(path, len),
                                true,
                                aFile);
       }
     }
-    case Win_Desktop:
-    {
+    case Win_Desktop: {
       return GetWindowsFolder(CSIDL_DESKTOP, aFile);
     }
-    case Win_Programs:
-    {
+    case Win_Programs: {
       return GetWindowsFolder(CSIDL_PROGRAMS, aFile);
     }
 
-    case Win_Downloads:
-    {
+    case Win_Downloads: {
       // Defined in KnownFolders.h.
-      GUID folderid_downloads = {0x374de290, 0x123f, 0x4565, {0x91, 0x64,
-                                 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}};
+      GUID folderid_downloads = {
+        0x374de290, 0x123f, 0x4565,
+        { 0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b }
+      };
       nsresult rv = GetKnownFolder(&folderid_downloads, aFile);
       // On WinXP, there is no downloads folder, default
       // to 'Desktop'.
-      if(NS_ERROR_FAILURE == rv)
-      {
+      if (NS_ERROR_FAILURE == rv) {
         rv = GetWindowsFolder(CSIDL_DESKTOP, aFile);
       }
       return rv;
     }
 
-    case Win_Controls:
-    {
+    case Win_Controls: {
       return GetWindowsFolder(CSIDL_CONTROLS, aFile);
     }
-    case Win_Printers:
-    {
+    case Win_Printers: {
       return GetWindowsFolder(CSIDL_PRINTERS, aFile);
     }
-    case Win_Personal:
-    {
+    case Win_Personal: {
       return GetWindowsFolder(CSIDL_PERSONAL, aFile);
     }
-    case Win_Favorites:
-    {
+    case Win_Favorites: {
       return GetWindowsFolder(CSIDL_FAVORITES, aFile);
     }
-    case Win_Startup:
-    {
+    case Win_Startup: {
       return GetWindowsFolder(CSIDL_STARTUP, aFile);
     }
-    case Win_Recent:
-    {
+    case Win_Recent: {
       return GetWindowsFolder(CSIDL_RECENT, aFile);
     }
-    case Win_Sendto:
-    {
+    case Win_Sendto: {
       return GetWindowsFolder(CSIDL_SENDTO, aFile);
     }
-    case Win_Bitbucket:
-    {
+    case Win_Bitbucket: {
       return GetWindowsFolder(CSIDL_BITBUCKET, aFile);
     }
-    case Win_Startmenu:
-    {
+    case Win_Startmenu: {
       return GetWindowsFolder(CSIDL_STARTMENU, aFile);
     }
-    case Win_Desktopdirectory:
-    {
+    case Win_Desktopdirectory: {
       return GetWindowsFolder(CSIDL_DESKTOPDIRECTORY, aFile);
     }
-    case Win_Drives:
-    {
+    case Win_Drives: {
       return GetWindowsFolder(CSIDL_DRIVES, aFile);
     }
-    case Win_Network:
-    {
+    case Win_Network: {
       return GetWindowsFolder(CSIDL_NETWORK, aFile);
     }
-    case Win_Nethood:
-    {
+    case Win_Nethood: {
       return GetWindowsFolder(CSIDL_NETHOOD, aFile);
     }
-    case Win_Fonts:
-    {
+    case Win_Fonts: {
       return GetWindowsFolder(CSIDL_FONTS, aFile);
     }
-    case Win_Templates:
-    {
+    case Win_Templates: {
       return GetWindowsFolder(CSIDL_TEMPLATES, aFile);
     }
-    case Win_Common_Startmenu:
-    {
+    case Win_Common_Startmenu: {
       return GetWindowsFolder(CSIDL_COMMON_STARTMENU, aFile);
     }
-    case Win_Common_Programs:
-    {
+    case Win_Common_Programs: {
       return GetWindowsFolder(CSIDL_COMMON_PROGRAMS, aFile);
     }
-    case Win_Common_Startup:
-    {
+    case Win_Common_Startup: {
       return GetWindowsFolder(CSIDL_COMMON_STARTUP, aFile);
     }
-    case Win_Common_Desktopdirectory:
-    {
+    case Win_Common_Desktopdirectory: {
       return GetWindowsFolder(CSIDL_COMMON_DESKTOPDIRECTORY, aFile);
     }
-    case Win_Common_AppData:
-    {
+    case Win_Common_AppData: {
       return GetWindowsFolder(CSIDL_COMMON_APPDATA, aFile);
     }
-    case Win_Printhood:
-    {
+    case Win_Printhood: {
       return GetWindowsFolder(CSIDL_PRINTHOOD, aFile);
     }
-    case Win_Cookies:
-    {
+    case Win_Cookies: {
       return GetWindowsFolder(CSIDL_COOKIES, aFile);
     }
-    case Win_Appdata:
-    {
+    case Win_Appdata: {
       nsresult rv = GetWindowsFolder(CSIDL_APPDATA, aFile);
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         rv = GetRegWindowsAppDataFolder(false, aFile);
+      }
       return rv;
     }
-    case Win_LocalAppdata:
-    {
+    case Win_LocalAppdata: {
       nsresult rv = GetWindowsFolder(CSIDL_LOCAL_APPDATA, aFile);
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         rv = GetRegWindowsAppDataFolder(true, aFile);
+      }
       return rv;
     }
-    case Win_Documents:
-    {
+    case Win_Documents: {
       return GetLibrarySaveToPath(CSIDL_MYDOCUMENTS,
                                   FOLDERID_DocumentsLibrary,
                                   aFile);
     }
-    case Win_Pictures:
-    {
+    case Win_Pictures: {
       return GetLibrarySaveToPath(CSIDL_MYPICTURES,
                                   FOLDERID_PicturesLibrary,
                                   aFile);
     }
-    case Win_Music:
-    {
+    case Win_Music: {
       return GetLibrarySaveToPath(CSIDL_MYMUSIC,
                                   FOLDERID_MusicLibrary,
                                   aFile);
     }
-    case Win_Videos:
-    {
+    case Win_Videos: {
       return GetLibrarySaveToPath(CSIDL_MYVIDEO,
                                   FOLDERID_VideosLibrary,
                                   aFile);
     }
 #endif  // XP_WIN
 
 #if defined(XP_UNIX)
     case Unix_LocalDirectory:
@@ -802,26 +800,26 @@ GetSpecialSystemDirectory(SystemDirector
     default:
       break;
   }
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 #if defined (MOZ_WIDGET_COCOA)
 nsresult
-GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile **localFile)
+GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile** aLocalFile)
 {
   OSErr err;
   FSRef fsRef;
   nsresult rv = NS_ERROR_FAILURE;
 
   err = ::FSFindFolder(aDomain, aFolderType, kCreateFolder, &fsRef);
-  if (err == noErr)
-  {
-    NS_NewLocalFile(EmptyString(), true, localFile);
-    nsCOMPtr<nsILocalFileMac> localMacFile(do_QueryInterface(*localFile));
-    if (localMacFile)
+  if (err == noErr) {
+    NS_NewLocalFile(EmptyString(), true, aLocalFile);
+    nsCOMPtr<nsILocalFileMac> localMacFile(do_QueryInterface(*aLocalFile));
+    if (localMacFile) {
       rv = localMacFile->InitWithFSRef(&fsRef);
+    }
   }
   return rv;
 }
 #endif
 
--- a/xpcom/io/SpecialSystemDirectory.h
+++ b/xpcom/io/SpecialSystemDirectory.h
@@ -17,20 +17,20 @@
 #endif
 
 extern void StartupSpecialSystemDirectory();
 
 
 enum SystemDirectories {
   OS_DriveDirectory         =   1,
   OS_TemporaryDirectory     =   2,
-  OS_CurrentProcessDirectory=   3,
-  OS_CurrentWorkingDirectory=   4,
-  XPCOM_CurrentProcessComponentDirectory=   5,
-  XPCOM_CurrentProcessComponentRegistry=   6,
+  OS_CurrentProcessDirectory =  3,
+  OS_CurrentWorkingDirectory =  4,
+  XPCOM_CurrentProcessComponentDirectory = 5,
+  XPCOM_CurrentProcessComponentRegistry =  6,
 
   Moz_BinDirectory          =   100 ,
   Mac_SystemDirectory       =   101,
   Mac_DesktopDirectory      =   102,
   Mac_TrashDirectory        =   103,
   Mac_StartupDirectory      =   104,
   Mac_ShutdownDirectory     =   105,
   Mac_AppleMenuDirectory    =   106,
@@ -93,12 +93,12 @@ enum SystemDirectories {
   Unix_XDG_Videos           =   311
 };
 
 nsresult
 GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
                           nsIFile** aFile);
 #ifdef MOZ_WIDGET_COCOA
 nsresult
-GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile **localFile);
+GetOSXFolderType(short aDomain, OSType aFolderType, nsIFile** aLocalFile);
 #endif
 
 #endif
--- a/xpcom/io/nsAnonymousTemporaryFile.cpp
+++ b/xpcom/io/nsAnonymousTemporaryFile.cpp
@@ -45,68 +45,76 @@ using namespace mozilla;
 //   3. Content processes can access the system temp dir
 //      (NS_GetSpecialDirectory fails on NS_APP_USER_PROFILE_LOCAL_50_DIR
 //      for content process for example, which is where we previously stored
 //      temp files on Windows). This argument applies to all platforms, not
 //      just Windows.
 static nsresult
 GetTempDir(nsIFile** aTempDir)
 {
-  if (NS_WARN_IF(!aTempDir))
+  if (NS_WARN_IF(!aTempDir)) {
     return NS_ERROR_INVALID_ARG;
+  }
   nsCOMPtr<nsIFile> tmpFile;
   nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile));
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
 #ifdef XP_WIN
   // On windows DELETE_ON_CLOSE is unreliable, so we store temporary files
   // in a subdir of the temp dir and delete that in an idle service observer
   // to ensure it's been cleared.
   rv = tmpFile->AppendNative(nsDependentCString("mozilla-temp-files"));
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
   rv = tmpFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
-  if (rv != NS_ERROR_FILE_ALREADY_EXISTS && NS_WARN_IF(NS_FAILED(rv)))
+  if (rv != NS_ERROR_FILE_ALREADY_EXISTS && NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 #endif
 
   tmpFile.forget(aTempDir);
 
   return NS_OK;
 }
 
 nsresult
 NS_OpenAnonymousTemporaryFile(PRFileDesc** aOutFileDesc)
 {
-  if (NS_WARN_IF(!aOutFileDesc))
+  if (NS_WARN_IF(!aOutFileDesc)) {
     return NS_ERROR_INVALID_ARG;
+  }
   nsresult rv;
 
   nsCOMPtr<nsIFile> tmpFile;
   rv = GetTempDir(getter_AddRefs(tmpFile));
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   // Give the temp file a name with a random element. CreateUnique will also
   // append a counter to the name if it encounters a name collision. Adding
   // a random element to the name reduces the likelihood of a name collision,
   // so that CreateUnique() doesn't end up trying a lot of name variants in
   // its "try appending an incrementing counter" loop, as file IO can be
   // expensive on some mobile flash drives.
   nsAutoCString name("mozilla-temp-");
   name.AppendInt(rand());
 
   rv = tmpFile->AppendNative(name);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0700);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = tmpFile->OpenNSPRFileDesc(PR_RDWR | nsIFile::DELETE_ON_CLOSE,
                                  PR_IRWXU, aOutFileDesc);
 
   return rv;
 }
 
 #ifdef XP_WIN
@@ -130,52 +138,60 @@ NS_OpenAnonymousTemporaryFile(PRFileDesc
 // temp files that were supposed to be deleted on application exit were actually
 // deleted, as they may not be if we previously crashed. See bugs 572579 and
 // 785662. This is only needed on some versions of Windows,
 // nsIFile::DELETE_ON_CLOSE works on other platforms.
 // This class adds itself as a shutdown observer so that it can cancel the
 // idle observer and its timer on shutdown. Note: the observer and idle
 // services hold references to instances of this object, and those references
 // are what keep this object alive.
-class nsAnonTempFileRemover MOZ_FINAL : public nsIObserver {
+class nsAnonTempFileRemover MOZ_FINAL : public nsIObserver
+{
 public:
   NS_DECL_ISUPPORTS
 
-  nsAnonTempFileRemover() {
+  nsAnonTempFileRemover()
+  {
     MOZ_COUNT_CTOR(nsAnonTempFileRemover);
   }
 
-  ~nsAnonTempFileRemover() {
+  ~nsAnonTempFileRemover()
+  {
     MOZ_COUNT_DTOR(nsAnonTempFileRemover);
   }
 
-  nsresult Init() {
+  nsresult Init()
+  {
     // We add the idle observer in a timer, so that the app has enough
     // time to start up before we add the idle observer. If we register the
     // idle observer too early, it will be registered before the fake idle
     // service is installed when running in xpcshell, and this interferes with
     // the fake idle service, causing xpcshell-test failures.
     mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
-    if (NS_WARN_IF(!mTimer))
+    if (NS_WARN_IF(!mTimer)) {
       return NS_ERROR_FAILURE;
+    }
     nsresult rv = mTimer->Init(this,
                                SCHEDULE_TIMEOUT_MS,
                                nsITimer::TYPE_ONE_SHOT);
-    if (NS_WARN_IF(NS_FAILED(rv)))
+    if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
+    }
 
     // Register shutdown observer so we can cancel the timer if we shutdown before
     // the timer runs.
     nsCOMPtr<nsIObserverService> obsSrv = services::GetObserverService();
-    if (NS_WARN_IF(!obsSrv))
+    if (NS_WARN_IF(!obsSrv)) {
       return NS_ERROR_FAILURE;
+    }
     return obsSrv->AddObserver(this, XPCOM_SHUTDOWN_TOPIC, false);
   }
 
-  void Cleanup() {
+  void Cleanup()
+  {
     // Cancel timer.
     if (mTimer) {
       mTimer->Cancel();
       mTimer = nullptr;
     }
     // Remove idle service observer.
     nsCOMPtr<nsIIdleService> idleSvc =
       do_GetService("@mozilla.org/widget/idleservice;1");
@@ -184,63 +200,69 @@ public:
     }
     // Remove shutdown observer.
     nsCOMPtr<nsIObserverService> obsSrv = services::GetObserverService();
     if (obsSrv) {
       obsSrv->RemoveObserver(this, XPCOM_SHUTDOWN_TOPIC);
     }
   }
 
-  NS_IMETHODIMP Observe(nsISupports *aSubject,
-                        const char *aTopic,
-                        const char16_t *aData)
+  NS_IMETHODIMP Observe(nsISupports* aSubject,
+                        const char* aTopic,
+                        const char16_t* aData)
   {
     if (nsCRT::strcmp(aTopic, NS_TIMER_CALLBACK_TOPIC) == 0 &&
         NS_FAILED(RegisterIdleObserver())) {
       Cleanup();
     } else if (nsCRT::strcmp(aTopic, OBSERVER_TOPIC_IDLE) == 0) {
       // The user has been idle for a while, clean up the temp files.
       // The idle service will drop its reference to this object after
       // we exit, destroying this object.
       RemoveAnonTempFileFiles();
       Cleanup();
     } else if (nsCRT::strcmp(aTopic, XPCOM_SHUTDOWN_TOPIC) == 0) {
       Cleanup();
     }
     return NS_OK;
   }
 
-  nsresult RegisterIdleObserver() {
+  nsresult RegisterIdleObserver()
+  {
     // Add this as an idle observer. When we've been idle for
     // TEMP_FILE_IDLE_TIME_S seconds, we'll get a notification, and we'll then
     // try to delete any stray temp files.
     nsCOMPtr<nsIIdleService> idleSvc =
       do_GetService("@mozilla.org/widget/idleservice;1");
-    if (!idleSvc)
+    if (!idleSvc) {
       return NS_ERROR_FAILURE;
+    }
     return idleSvc->AddIdleObserver(this, TEMP_FILE_IDLE_TIME_S);
   }
 
-  void RemoveAnonTempFileFiles() {
+  void RemoveAnonTempFileFiles()
+  {
     nsCOMPtr<nsIFile> tmpDir;
     nsresult rv = GetTempDir(getter_AddRefs(tmpDir));
-    if (NS_WARN_IF(NS_FAILED(rv)))
+    if (NS_WARN_IF(NS_FAILED(rv))) {
       return;
+    }
 
     // Remove the directory recursively.
     tmpDir->Remove(true);
   }
 
 private:
   nsCOMPtr<nsITimer> mTimer;
 };
 
 NS_IMPL_ISUPPORTS(nsAnonTempFileRemover, nsIObserver)
 
-nsresult CreateAnonTempFileRemover() {
+nsresult
+CreateAnonTempFileRemover()
+{
   // Create a temp file remover. If Init() succeeds, the temp file remover is kept
   // alive by a reference held by the observer service, since the temp file remover
   // is a shutdown observer. We only create the temp file remover if we're running
   // in the main process; there's no point in doing the temp file removal multiple
   // times per startup.
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     return NS_OK;
   }
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -70,307 +70,328 @@
 nsAppFileLocationProvider::nsAppFileLocationProvider()
 {
 }
 
 //*****************************************************************************
 // nsAppFileLocationProvider::nsISupports
 //*****************************************************************************
 
-NS_IMPL_ISUPPORTS(nsAppFileLocationProvider, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2)
+NS_IMPL_ISUPPORTS(nsAppFileLocationProvider,
+                  nsIDirectoryServiceProvider,
+                  nsIDirectoryServiceProvider2)
 
 //*****************************************************************************
 // nsAppFileLocationProvider::nsIDirectoryServiceProvider
 //*****************************************************************************
 
 NS_IMETHODIMP
-nsAppFileLocationProvider::GetFile(const char *prop, bool *persistent, nsIFile **_retval)
+nsAppFileLocationProvider::GetFile(const char* aProp, bool* aPersistent,
+                                   nsIFile** aResult)
 {
-  if (NS_WARN_IF(!prop))
+  if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsCOMPtr<nsIFile>  localFile;
   nsresult rv = NS_ERROR_FAILURE;
 
-  *_retval = nullptr;
-  *persistent = true;
+  *aResult = nullptr;
+  *aPersistent = true;
 
 #ifdef MOZ_WIDGET_COCOA
   FSRef fileRef;
   nsCOMPtr<nsILocalFileMac> macFile;
 #endif
 
-  if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0)
-  {
+  if (nsCRT::strcmp(aProp, NS_APP_APPLICATION_REGISTRY_DIR) == 0) {
     rv = GetProductDirectory(getter_AddRefs(localFile));
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0)
-  {
+  } else if (nsCRT::strcmp(aProp, NS_APP_APPLICATION_REGISTRY_FILE) == 0) {
     rv = GetProductDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
+    if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendNative(APP_REGISTRY_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_DEFAULTS_50_DIR) == 0)
-  {
-    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
-      rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_PREF_DEFAULTS_50_DIR) == 0)
-  {
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_DEFAULTS_50_DIR) == 0) {
     rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
-      if (NS_SUCCEEDED(rv))
-        rv = localFile->AppendRelativeNativePath(DEFAULTS_PREF_DIR_NAME);
     }
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0 ||
-           nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0)
-  {
+  } else if (nsCRT::strcmp(aProp, NS_APP_PREF_DEFAULTS_50_DIR) == 0) {
+    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
+    if (NS_SUCCEEDED(rv)) {
+      rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
+      if (NS_SUCCEEDED(rv)) {
+        rv = localFile->AppendRelativeNativePath(DEFAULTS_PREF_DIR_NAME);
+      }
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0 ||
+             nsCRT::strcmp(aProp, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0) {
     rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendRelativeNativePath(DEFAULTS_DIR_NAME);
-      if (NS_SUCCEEDED(rv))
+      if (NS_SUCCEEDED(rv)) {
         rv = localFile->AppendRelativeNativePath(DEFAULTS_PROFILE_DIR_NAME);
+      }
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_ROOT_DIR) == 0) {
+    rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile));
+  } else if (nsCRT::strcmp(aProp, NS_APP_USER_PROFILES_LOCAL_ROOT_DIR) == 0) {
+    rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile), true);
+  } else if (nsCRT::strcmp(aProp, NS_APP_RES_DIR) == 0) {
+    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
+    if (NS_SUCCEEDED(rv)) {
+      rv = localFile->AppendRelativeNativePath(RES_DIR_NAME);
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_CHROME_DIR) == 0) {
+    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
+    if (NS_SUCCEEDED(rv)) {
+      rv = localFile->AppendRelativeNativePath(CHROME_DIR_NAME);
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_PLUGINS_DIR) == 0) {
+    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
+    if (NS_SUCCEEDED(rv)) {
+      rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
     }
   }
-  else if (nsCRT::strcmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0)
-  {
-    rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile));
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_USER_PROFILES_LOCAL_ROOT_DIR) == 0)
-  {
-    rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile), true);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_RES_DIR) == 0)
-  {
-    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
-      rv = localFile->AppendRelativeNativePath(RES_DIR_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_CHROME_DIR) == 0)
-  {
-    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
-      rv = localFile->AppendRelativeNativePath(CHROME_DIR_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR) == 0)
-  {
-    rv = CloneMozBinDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
-      rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
-  }
 #ifdef MOZ_WIDGET_COCOA
-  else if (nsCRT::strcmp(prop, NS_MACOSX_USER_PLUGIN_DIR) == 0)
-  {
+  else if (nsCRT::strcmp(aProp, NS_MACOSX_USER_PLUGIN_DIR) == 0) {
     if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
       rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
-      if (NS_SUCCEEDED(rv))
+      if (NS_SUCCEEDED(rv)) {
         localFile = macFile;
+      }
     }
-  }
-  else if (nsCRT::strcmp(prop, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0)
-  {
+  } else if (nsCRT::strcmp(aProp, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0) {
     if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
       rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
-      if (NS_SUCCEEDED(rv))
+      if (NS_SUCCEEDED(rv)) {
         localFile = macFile;
+      }
     }
-  }
-  else if (nsCRT::strcmp(prop, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0)
-  {
-    static const char *const java2PluginDirPath =
+  } else if (nsCRT::strcmp(aProp, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0) {
+    static const char* const java2PluginDirPath =
       "/System/Library/Java/Support/Deploy.bundle/Contents/Resources/";
     rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true, getter_AddRefs(localFile));
   }
 #else
-  else if (nsCRT::strcmp(prop, NS_ENV_PLUGINS_DIR) == 0)
-  {
+  else if (nsCRT::strcmp(aProp, NS_ENV_PLUGINS_DIR) == 0) {
     NS_ERROR("Don't use nsAppFileLocationProvider::GetFile(NS_ENV_PLUGINS_DIR, ...). "
              "Use nsAppFileLocationProvider::GetFiles(...).");
-    const char *pathVar = PR_GetEnv("MOZ_PLUGIN_PATH");
+    const char* pathVar = PR_GetEnv("MOZ_PLUGIN_PATH");
     if (pathVar && *pathVar)
       rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), true,
                                  getter_AddRefs(localFile));
-  }
-  else if (nsCRT::strcmp(prop, NS_USER_PLUGINS_DIR) == 0)
-  {
+  } else if (nsCRT::strcmp(aProp, NS_USER_PLUGINS_DIR) == 0) {
 #ifdef ENABLE_SYSTEM_EXTENSION_DIRS
     rv = GetProductDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
+    if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
+    }
 #else
     rv = NS_ERROR_FAILURE;
 #endif
   }
 #ifdef XP_UNIX
-  else if (nsCRT::strcmp(prop, NS_SYSTEM_PLUGINS_DIR) == 0) {
+  else if (nsCRT::strcmp(aProp, NS_SYSTEM_PLUGINS_DIR) == 0) {
 #ifdef ENABLE_SYSTEM_EXTENSION_DIRS
-    static const char *const sysLPlgDir =
+    static const char* const sysLPlgDir =
 #if defined(HAVE_USR_LIB64_DIR) && defined(__LP64__)
       "/usr/lib64/mozilla/plugins";
 #elif defined(__OpenBSD__) || defined (__FreeBSD__)
       "/usr/local/lib/mozilla/plugins";
 #else
       "/usr/lib/mozilla/plugins";
 #endif
     rv = NS_NewNativeLocalFile(nsDependentCString(sysLPlgDir),
                                false, getter_AddRefs(localFile));
 #else
     rv = NS_ERROR_FAILURE;
 #endif
   }
 #endif
 #endif
-  else if (nsCRT::strcmp(prop, NS_APP_SEARCH_DIR) == 0)
-  {
+  else if (nsCRT::strcmp(aProp, NS_APP_SEARCH_DIR) == 0) {
     rv = CloneMozBinDirectory(getter_AddRefs(localFile));
-    if (NS_SUCCEEDED(rv))
+    if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendRelativeNativePath(SEARCH_DIR_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_USER_SEARCH_DIR) == 0)
-  {
-    rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, _retval);
-    if (NS_SUCCEEDED(rv))
-      rv = (*_retval)->AppendNative(SEARCH_DIR_NAME);
-  }
-  else if (nsCRT::strcmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0)
-  {
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_USER_SEARCH_DIR) == 0) {
+    rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, aResult);
+    if (NS_SUCCEEDED(rv)) {
+      rv = (*aResult)->AppendNative(SEARCH_DIR_NAME);
+    }
+  } else if (nsCRT::strcmp(aProp, NS_APP_INSTALL_CLEANUP_DIR) == 0) {
     // This is cloned so that embeddors will have a hook to override
     // with their own cleanup dir.  See bugzilla bug #105087
     rv = CloneMozBinDirectory(getter_AddRefs(localFile));
   }
 
-  if (localFile && NS_SUCCEEDED(rv))
-    return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval);
+  if (localFile && NS_SUCCEEDED(rv)) {
+    return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)aResult);
+  }
 
   return rv;
 }
 
 
-NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile **aLocalFile)
+NS_METHOD
+nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile** aLocalFile)
 {
-  if (NS_WARN_IF(!aLocalFile))
+  if (NS_WARN_IF(!aLocalFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
   nsresult rv;
 
-  if (!mMozBinDirectory)
-  {
+  if (!mMozBinDirectory) {
     // Get the mozilla bin directory
     // 1. Check the directory service first for NS_XPCOM_CURRENT_PROCESS_DIR
     //    This will be set if a directory was passed to NS_InitXPCOM
     // 2. If that doesn't work, set it to be the current process directory
     nsCOMPtr<nsIProperties>
     directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
-    rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory));
+    rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
+                               getter_AddRefs(mMozBinDirectory));
     if (NS_FAILED(rv)) {
-      rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory));
-      if (NS_FAILED(rv))
+      rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
+                                 getter_AddRefs(mMozBinDirectory));
+      if (NS_FAILED(rv)) {
         return rv;
+      }
     }
   }
 
   nsCOMPtr<nsIFile> aFile;
   rv = mMozBinDirectory->Clone(getter_AddRefs(aFile));
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   NS_IF_ADDREF(*aLocalFile = aFile);
   return NS_OK;
 }
 
 
 //----------------------------------------------------------------------------------------
 // GetProductDirectory - Gets the directory which contains the application data folder
 //
 // UNIX   : ~/.mozilla/
 // WIN    : <Application Data folder on user's machine>\Mozilla
 // Mac    : :Documents:Mozilla:
 //----------------------------------------------------------------------------------------
-NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, bool aLocal)
+NS_METHOD
+nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+                                               bool aLocal)
 {
-  if (NS_WARN_IF(!aLocalFile))
+  if (NS_WARN_IF(!aLocalFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsresult rv;
   bool exists;
   nsCOMPtr<nsIFile> localDir;
 
 #if defined(MOZ_WIDGET_COCOA)
   FSRef fsRef;
   OSType folderType = aLocal ? (OSType) kCachedDataFolderType : (OSType) kDomainLibraryFolderType;
   OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
-  if (err) return NS_ERROR_FAILURE;
+  if (err) {
+    return NS_ERROR_FAILURE;
+  }
   NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localDir));
-  if (!localDir) return NS_ERROR_FAILURE;
+  if (!localDir) {
+    return NS_ERROR_FAILURE;
+  }
   nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir));
   rv = localDirMac->InitWithFSRef(&fsRef);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 #elif defined(XP_WIN)
   nsCOMPtr<nsIProperties> directoryService =
     do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR;
   rv = directoryService->Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(localDir));
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 #elif defined(XP_UNIX)
   rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, getter_AddRefs(localDir));
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 #else
 #error dont_know_how_to_get_product_dir_on_your_platform
 #endif
 
   rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   rv = localDir->Exists(&exists);
 
-  if (NS_SUCCEEDED(rv) && !exists)
+  if (NS_SUCCEEDED(rv) && !exists) {
     rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
+  }
 
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   *aLocalFile = localDir;
   NS_ADDREF(*aLocalFile);
 
   return rv;
 }
 
 
 //----------------------------------------------------------------------------------------
 // GetDefaultUserProfileRoot - Gets the directory which contains each user profile dir
 //
 // UNIX   : ~/.mozilla/
 // WIN    : <Application Data folder on user's machine>\Mozilla\Profiles
 // Mac    : :Documents:Mozilla:Profiles:
 //----------------------------------------------------------------------------------------
-NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile **aLocalFile, bool aLocal)
+NS_METHOD
+nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile** aLocalFile,
+                                                     bool aLocal)
 {
-  if (NS_WARN_IF(!aLocalFile))
+  if (NS_WARN_IF(!aLocalFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsresult rv;
   nsCOMPtr<nsIFile> localDir;
 
   rv = GetProductDirectory(getter_AddRefs(localDir), aLocal);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
 #if defined(MOZ_WIDGET_COCOA) || defined(XP_WIN)
   // These 3 platforms share this part of the path - do them as one
   rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("Profiles"));
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   bool exists;
   rv = localDir->Exists(&exists);
-  if (NS_SUCCEEDED(rv) && !exists)
+  if (NS_SUCCEEDED(rv) && !exists) {
     rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
-  if (NS_FAILED(rv)) return rv;
+  }
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 #endif
 
   *aLocalFile = localDir;
   NS_ADDREF(*aLocalFile);
 
   return rv;
 }
 
@@ -382,66 +403,68 @@ class nsAppDirectoryEnumerator : public 
 {
 public:
   NS_DECL_ISUPPORTS
 
   /**
    * aKeyList is a null-terminated list of properties which are provided by aProvider
    * They do not need to be publicly defined keys.
    */
-  nsAppDirectoryEnumerator(nsIDirectoryServiceProvider *aProvider,
+  nsAppDirectoryEnumerator(nsIDirectoryServiceProvider* aProvider,
                            const char* aKeyList[]) :
     mProvider(aProvider),
     mCurrentKey(aKeyList)
   {
   }
 
-  NS_IMETHOD HasMoreElements(bool *result)
+  NS_IMETHOD HasMoreElements(bool* aResult)
   {
-    while (!mNext && *mCurrentKey)
-    {
+    while (!mNext && *mCurrentKey) {
       bool dontCare;
       nsCOMPtr<nsIFile> testFile;
       (void)mProvider->GetFile(*mCurrentKey++, &dontCare, getter_AddRefs(testFile));
       // Don't return a file which does not exist.
       bool exists;
-      if (testFile && NS_SUCCEEDED(testFile->Exists(&exists)) && exists)
+      if (testFile && NS_SUCCEEDED(testFile->Exists(&exists)) && exists) {
         mNext = testFile;
+      }
     }
-    *result = mNext != nullptr;
+    *aResult = mNext != nullptr;
     return NS_OK;
   }
 
-  NS_IMETHOD GetNext(nsISupports **result)
+  NS_IMETHOD GetNext(nsISupports** aResult)
   {
-    if (NS_WARN_IF(!result))
+    if (NS_WARN_IF(!aResult)) {
       return NS_ERROR_INVALID_ARG;
-    *result = nullptr;
+    }
+    *aResult = nullptr;
 
     bool hasMore;
     HasMoreElements(&hasMore);
-    if (!hasMore)
+    if (!hasMore) {
       return NS_ERROR_FAILURE;
+    }
 
-    *result = mNext;
-    NS_IF_ADDREF(*result);
+    *aResult = mNext;
+    NS_IF_ADDREF(*aResult);
     mNext = nullptr;
 
-    return *result ? NS_OK : NS_ERROR_FAILURE;
+    return *aResult ? NS_OK : NS_ERROR_FAILURE;
   }
 
   // Virtual destructor since subclass nsPathsDirectoryEnumerator
   // does not re-implement Release()
 
   virtual ~nsAppDirectoryEnumerator()
   {
   }
 
 protected:
-  nsIDirectoryServiceProvider *mProvider;
+  nsIDirectoryServiceProvider* mProvider;
   const char** mCurrentKey;
   nsCOMPtr<nsIFile> mNext;
 };
 
 NS_IMPL_ISUPPORTS(nsAppDirectoryEnumerator, nsISimpleEnumerator)
 
 /* nsPathsDirectoryEnumerator and PATH_SEPARATOR
  * are not used on MacOS/X. */
@@ -456,107 +479,117 @@ class nsPathsDirectoryEnumerator : publi
 {
 public:
   /**
    * aKeyList is a null-terminated list.
    * The first element is a path list.
    * The remainder are properties provided by aProvider.
    * They do not need to be publicly defined keys.
    */
-  nsPathsDirectoryEnumerator(nsIDirectoryServiceProvider *aProvider,
+  nsPathsDirectoryEnumerator(nsIDirectoryServiceProvider* aProvider,
                              const char* aKeyList[]) :
-    nsAppDirectoryEnumerator(aProvider, aKeyList+1),
+    nsAppDirectoryEnumerator(aProvider, aKeyList + 1),
     mEndPath(aKeyList[0])
   {
   }
 
-  NS_IMETHOD HasMoreElements(bool *result)
+  NS_IMETHOD HasMoreElements(bool* aResult)
   {
     if (mEndPath)
-      while (!mNext && *mEndPath)
-      {
-        const char *pathVar = mEndPath;
+      while (!mNext && *mEndPath) {
+        const char* pathVar = mEndPath;
 
         // skip PATH_SEPARATORs at the begining of the mEndPath
-        while (*pathVar == PATH_SEPARATOR) pathVar++;
+        while (*pathVar == PATH_SEPARATOR) {
+          ++pathVar;
+        }
 
-        do { ++mEndPath; } while (*mEndPath && *mEndPath != PATH_SEPARATOR);
+        do {
+          ++mEndPath;
+        } while (*mEndPath && *mEndPath != PATH_SEPARATOR);
 
         nsCOMPtr<nsIFile> localFile;
         NS_NewNativeLocalFile(Substring(pathVar, mEndPath),
                               true,
                               getter_AddRefs(localFile));
-        if (*mEndPath == PATH_SEPARATOR)
+        if (*mEndPath == PATH_SEPARATOR) {
           ++mEndPath;
+        }
         // Don't return a "file" (directory) which does not exist.
         bool exists;
         if (localFile &&
             NS_SUCCEEDED(localFile->Exists(&exists)) &&
-            exists)
+            exists) {
           mNext = localFile;
+        }
       }
-    if (mNext)
-      *result = true;
-    else
-      nsAppDirectoryEnumerator::HasMoreElements(result);
+    if (mNext) {
+      *aResult = true;
+    } else {
+      nsAppDirectoryEnumerator::HasMoreElements(aResult);
+    }
 
     return NS_OK;
   }
 
 protected:
-  const char *mEndPath;
+  const char* mEndPath;
 };
 
 NS_IMETHODIMP
-nsAppFileLocationProvider::GetFiles(const char *prop, nsISimpleEnumerator **_retval)
+nsAppFileLocationProvider::GetFiles(const char* aProp,
+                                    nsISimpleEnumerator** aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = nullptr;
+  }
+  *aResult = nullptr;
   nsresult rv = NS_ERROR_FAILURE;
 
-  if (!nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR_LIST))
-  {
+  if (!nsCRT::strcmp(aProp, NS_APP_PLUGINS_DIR_LIST)) {
 #ifdef MOZ_WIDGET_COCOA
     // As of Java for Mac OS X 10.5 Update 10, Apple has (in effect) deprecated Java Plugin2 on
     // on OS X 10.5, and removed the soft link to it from /Library/Internet Plug-Ins/.  Java
     // Plugin2 is still present and usable, but there are no longer any links to it in the
     // "normal" locations.  So we won't be able to find it unless we look in the "non-normal"
     // location where it actually is.  Safari can use the WebKit-specific JavaPluginCocoa.bundle,
     // which (of course) is still fully supported on OS X 10.5.  But we have no alternative to
     // using Java Plugin2.  For more information see bug 668639.
-    static const char* keys[] = { NS_APP_PLUGINS_DIR, NS_MACOSX_USER_PLUGIN_DIR,
-                                  NS_MACOSX_LOCAL_PLUGIN_DIR,
-                                  IsOSXLeopard() ? NS_MACOSX_JAVA2_PLUGIN_DIR : nullptr, nullptr };
-    *_retval = new nsAppDirectoryEnumerator(this, keys);
+    static const char* keys[] = {
+      NS_APP_PLUGINS_DIR,
+      NS_MACOSX_USER_PLUGIN_DIR,
+      NS_MACOSX_LOCAL_PLUGIN_DIR,
+      IsOSXLeopard() ? NS_MACOSX_JAVA2_PLUGIN_DIR : nullptr,
+      nullptr
+    };
+    *aResult = new nsAppDirectoryEnumerator(this, keys);
 #else
 #ifdef XP_UNIX
     static const char* keys[] = { nullptr, NS_USER_PLUGINS_DIR, NS_APP_PLUGINS_DIR, NS_SYSTEM_PLUGINS_DIR, nullptr };
 #else
     static const char* keys[] = { nullptr, NS_USER_PLUGINS_DIR, NS_APP_PLUGINS_DIR, nullptr };
 #endif
     if (!keys[0] && !(keys[0] = PR_GetEnv("MOZ_PLUGIN_PATH"))) {
       static const char nullstr = 0;
       keys[0] = &nullstr;
     }
-    *_retval = new nsPathsDirectoryEnumerator(this, keys);
+    *aResult = new nsPathsDirectoryEnumerator(this, keys);
 #endif
-    NS_IF_ADDREF(*_retval);
-    rv = *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+    NS_IF_ADDREF(*aResult);
+    rv = *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
   }
-  if (!nsCRT::strcmp(prop, NS_APP_SEARCH_DIR_LIST))
-  {
+  if (!nsCRT::strcmp(aProp, NS_APP_SEARCH_DIR_LIST)) {
     static const char* keys[] = { nullptr, NS_APP_SEARCH_DIR, NS_APP_USER_SEARCH_DIR, nullptr };
     if (!keys[0] && !(keys[0] = PR_GetEnv("MOZ_SEARCH_ENGINE_PATH"))) {
       static const char nullstr = 0;
       keys[0] = &nullstr;
     }
-    *_retval = new nsPathsDirectoryEnumerator(this, keys);
-    NS_IF_ADDREF(*_retval);
-    rv = *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+    *aResult = new nsPathsDirectoryEnumerator(this, keys);
+    NS_IF_ADDREF(*aResult);
+    rv = *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
   }
   return rv;
 }
 
 #if defined(MOZ_WIDGET_COCOA)
 bool
 nsAppFileLocationProvider::IsOSXLeopard()
 {
--- a/xpcom/io/nsAppFileLocationProvider.h
+++ b/xpcom/io/nsAppFileLocationProvider.h
@@ -22,30 +22,32 @@ class nsAppFileLocationProvider MOZ_FINA
 public:
   nsAppFileLocationProvider();
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
 private:
-  ~nsAppFileLocationProvider() {}
+  ~nsAppFileLocationProvider()
+  {
+  }
 
 protected:
-  NS_METHOD CloneMozBinDirectory(nsIFile **aLocalFile);
+  NS_METHOD CloneMozBinDirectory(nsIFile** aLocalFile);
   /**
   * Get the product directory. This is a user-specific directory for storing
   * application settings (e.g. the Application Data directory on windows
   * systems).
   * @param aLocal If true, should try to get a directory that is only stored
   *               locally (ie not transferred with roaming profiles)
   */
-  NS_METHOD GetProductDirectory(nsIFile **aLocalFile,
+  NS_METHOD GetProductDirectory(nsIFile** aLocalFile,
                                 bool aLocal = false);
-  NS_METHOD GetDefaultUserProfileRoot(nsIFile **aLocalFile,
+  NS_METHOD GetDefaultUserProfileRoot(nsIFile** aLocalFile,
                                       bool aLocal = false);
 
 #if defined(MOZ_WIDGET_COCOA)
   static bool IsOSXLeopard();
 #endif
 
   nsCOMPtr<nsIFile> mMozBinDirectory;
 };
--- a/xpcom/io/nsBinaryStream.cpp
+++ b/xpcom/io/nsBinaryStream.cpp
@@ -25,217 +25,246 @@
 #include "nsISerializable.h"
 #include "nsIClassInfo.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIURI.h" // for NS_IURI_IID
 #include "mozilla/Endian.h"
 
 #include "jsfriendapi.h"
 
-NS_IMPL_ISUPPORTS(nsBinaryOutputStream, nsIObjectOutputStream, nsIBinaryOutputStream, nsIOutputStream)
+NS_IMPL_ISUPPORTS(nsBinaryOutputStream,
+                  nsIObjectOutputStream,
+                  nsIBinaryOutputStream,
+                  nsIOutputStream)
 
 NS_IMETHODIMP
 nsBinaryOutputStream::Flush()
 {
-  if (NS_WARN_IF(!mOutputStream))
+  if (NS_WARN_IF(!mOutputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mOutputStream->Flush();
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::Close()
 {
-  if (NS_WARN_IF(!mOutputStream))
+  if (NS_WARN_IF(!mOutputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mOutputStream->Close();
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::Write(const char *aBuf, uint32_t aCount, uint32_t *aActualBytes)
+nsBinaryOutputStream::Write(const char* aBuf, uint32_t aCount,
+                            uint32_t* aActualBytes)
 {
-  if (NS_WARN_IF(!mOutputStream))
+  if (NS_WARN_IF(!mOutputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mOutputStream->Write(aBuf, aCount, aActualBytes);
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::WriteFrom(nsIInputStream *inStr, uint32_t count, uint32_t *_retval)
+nsBinaryOutputStream::WriteFrom(nsIInputStream* aInStr, uint32_t aCount,
+                                uint32_t* aResult)
 {
   NS_NOTREACHED("WriteFrom");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, uint32_t count, uint32_t *_retval)
+nsBinaryOutputStream::WriteSegments(nsReadSegmentFun aReader, void* aClosure,
+                                    uint32_t aCount, uint32_t* aResult)
 {
   NS_NOTREACHED("WriteSegments");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::IsNonBlocking(bool *aNonBlocking)
+nsBinaryOutputStream::IsNonBlocking(bool* aNonBlocking)
 {
-  if (NS_WARN_IF(!mOutputStream))
+  if (NS_WARN_IF(!mOutputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mOutputStream->IsNonBlocking(aNonBlocking);
 }
 
 nsresult
-nsBinaryOutputStream::WriteFully(const char *aBuf, uint32_t aCount)
+nsBinaryOutputStream::WriteFully(const char* aBuf, uint32_t aCount)
 {
-  if (NS_WARN_IF(!mOutputStream))
+  if (NS_WARN_IF(!mOutputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
 
   nsresult rv;
   uint32_t bytesWritten;
 
   rv = mOutputStream->Write(aBuf, aCount, &bytesWritten);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesWritten != aCount)
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesWritten != aCount) {
     return NS_ERROR_FAILURE;
+  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::SetOutputStream(nsIOutputStream *aOutputStream)
+nsBinaryOutputStream::SetOutputStream(nsIOutputStream* aOutputStream)
 {
-  if (NS_WARN_IF(!aOutputStream))
+  if (NS_WARN_IF(!aOutputStream)) {
     return NS_ERROR_INVALID_ARG;
+  }
   mOutputStream = aOutputStream;
   mBufferAccess = do_QueryInterface(aOutputStream);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteBoolean(bool aBoolean)
 {
   return Write8(aBoolean);
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::Write8(uint8_t aByte)
 {
-  return WriteFully((const char*)&aByte, sizeof aByte);
+  return WriteFully((const char*)&aByte, sizeof(aByte));
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::Write16(uint16_t a16)
+nsBinaryOutputStream::Write16(uint16_t aNum)
 {
-  a16 = mozilla::NativeEndian::swapToBigEndian(a16);
-  return WriteFully((const char*)&a16, sizeof a16);
+  aNum = mozilla::NativeEndian::swapToBigEndian(aNum);
+  return WriteFully((const char*)&aNum, sizeof(aNum));
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::Write32(uint32_t a32)
+nsBinaryOutputStream::Write32(uint32_t aNum)
 {
-  a32 = mozilla::NativeEndian::swapToBigEndian(a32);
-  return WriteFully((const char*)&a32, sizeof a32);
+  aNum = mozilla::NativeEndian::swapToBigEndian(aNum);
+  return WriteFully((const char*)&aNum, sizeof(aNum));
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::Write64(uint64_t a64)
+nsBinaryOutputStream::Write64(uint64_t aNum)
 {
   nsresult rv;
   uint32_t bytesWritten;
 
-  a64 = mozilla::NativeEndian::swapToBigEndian(a64);
-  rv = Write(reinterpret_cast<char*>(&a64), sizeof a64, &bytesWritten);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesWritten != sizeof a64)
+  aNum = mozilla::NativeEndian::swapToBigEndian(aNum);
+  rv = Write(reinterpret_cast<char*>(&aNum), sizeof(aNum), &bytesWritten);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesWritten != sizeof(aNum)) {
     return NS_ERROR_FAILURE;
+  }
   return rv;
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteFloat(float aFloat)
 {
-  NS_ASSERTION(sizeof(float) == sizeof (uint32_t),
+  NS_ASSERTION(sizeof(float) == sizeof(uint32_t),
                "False assumption about sizeof(float)");
   return Write32(*reinterpret_cast<uint32_t*>(&aFloat));
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteDouble(double aDouble)
 {
   NS_ASSERTION(sizeof(double) == sizeof(uint64_t),
                "False assumption about sizeof(double)");
   return Write64(*reinterpret_cast<uint64_t*>(&aDouble));
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::WriteStringZ(const char *aString)
+nsBinaryOutputStream::WriteStringZ(const char* aString)
 {
   uint32_t length;
   nsresult rv;
 
   length = strlen(aString);
   rv = Write32(length);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   return WriteFully(aString, length);
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteWStringZ(const char16_t* aString)
 {
   uint32_t length, byteCount;
   nsresult rv;
 
   length = NS_strlen(aString);
   rv = Write32(length);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  if (length == 0)
+  if (length == 0) {
     return NS_OK;
+  }
   byteCount = length * sizeof(char16_t);
 
 #ifdef IS_BIG_ENDIAN
   rv = WriteBytes(reinterpret_cast<const char*>(aString), byteCount);
 #else
   // XXX use WriteSegments here to avoid copy!
-  char16_t *copy, temp[64];
+  char16_t* copy;
+  char16_t temp[64];
   if (length <= 64) {
     copy = temp;
   } else {
     copy = reinterpret_cast<char16_t*>(moz_malloc(byteCount));
-    if (!copy)
+    if (!copy) {
       return NS_ERROR_OUT_OF_MEMORY;
+    }
   }
   NS_ASSERTION((uintptr_t(aString) & 0x1) == 0, "aString not properly aligned");
   mozilla::NativeEndian::copyAndSwapToBigEndian(copy, aString, length);
   rv = WriteBytes(reinterpret_cast<const char*>(copy), byteCount);
-  if (copy != temp)
+  if (copy != temp) {
     moz_free(copy);
+  }
 #endif
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteUtf8Z(const char16_t* aString)
 {
   return WriteStringZ(NS_ConvertUTF16toUTF8(aString).get());
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::WriteBytes(const char *aString, uint32_t aLength)
+nsBinaryOutputStream::WriteBytes(const char* aString, uint32_t aLength)
 {
   nsresult rv;
   uint32_t bytesWritten;
 
   rv = Write(aString, aLength, &bytesWritten);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesWritten != aLength)
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesWritten != aLength) {
     return NS_ERROR_FAILURE;
+  }
   return rv;
 }
 
 NS_IMETHODIMP
-nsBinaryOutputStream::WriteByteArray(uint8_t *aBytes, uint32_t aLength)
+nsBinaryOutputStream::WriteByteArray(uint8_t* aBytes, uint32_t aLength)
 {
-  return WriteBytes(reinterpret_cast<char *>(aBytes), aLength);
+  return WriteBytes(reinterpret_cast<char*>(aBytes), aLength);
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteObject(nsISupports* aObject, bool aIsStrongRef)
 {
   return WriteCompoundObject(aObject, NS_GET_IID(nsISupports),
                              aIsStrongRef);
 }
@@ -251,101 +280,116 @@ NS_IMETHODIMP
 nsBinaryOutputStream::WriteCompoundObject(nsISupports* aObject,
                                           const nsIID& aIID,
                                           bool aIsStrongRef)
 {
   nsCOMPtr<nsIClassInfo> classInfo = do_QueryInterface(aObject);
   nsCOMPtr<nsISerializable> serializable = do_QueryInterface(aObject);
 
   // Can't deal with weak refs
-  if (NS_WARN_IF(!aIsStrongRef))
+  if (NS_WARN_IF(!aIsStrongRef)) {
     return NS_ERROR_UNEXPECTED;
-  if (NS_WARN_IF(!classInfo) || NS_WARN_IF(!serializable))
+  }
+  if (NS_WARN_IF(!classInfo) || NS_WARN_IF(!serializable)) {
     return NS_ERROR_NOT_AVAILABLE;
+  }
 
   nsCID cid;
   nsresult rv = classInfo->GetClassIDNoAlloc(&cid);
   if (NS_SUCCEEDED(rv)) {
     rv = WriteID(cid);
   } else {
-    nsCID *cidptr = nullptr;
+    nsCID* cidptr = nullptr;
     rv = classInfo->GetClassID(&cidptr);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = WriteID(*cidptr);
 
     NS_Free(cidptr);
   }
 
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = WriteID(aIID);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   return serializable->Write(this);
 }
 
 NS_IMETHODIMP
 nsBinaryOutputStream::WriteID(const nsIID& aIID)
 {
   nsresult rv = Write32(aIID.m0);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = Write16(aIID.m1);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = Write16(aIID.m2);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   for (int i = 0; i < 8; ++i) {
     rv = Write8(aIID.m3[i]);
-    if (NS_WARN_IF(NS_FAILED(rv)))
+    if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP_(char*)
 nsBinaryOutputStream::GetBuffer(uint32_t aLength, uint32_t aAlignMask)
 {
-  if (mBufferAccess)
+  if (mBufferAccess) {
     return mBufferAccess->GetBuffer(aLength, aAlignMask);
+  }
   return nullptr;
 }
 
 NS_IMETHODIMP_(void)
 nsBinaryOutputStream::PutBuffer(char* aBuffer, uint32_t aLength)
 {
-  if (mBufferAccess)
+  if (mBufferAccess) {
     mBufferAccess->PutBuffer(aBuffer, aLength);
+  }
 }
 
-NS_IMPL_ISUPPORTS(nsBinaryInputStream, nsIObjectInputStream, nsIBinaryInputStream, nsIInputStream)
+NS_IMPL_ISUPPORTS(nsBinaryInputStream,
+                  nsIObjectInputStream,
+                  nsIBinaryInputStream,
+                  nsIInputStream)
 
 NS_IMETHODIMP
 nsBinaryInputStream::Available(uint64_t* aResult)
 {
-  if (NS_WARN_IF(!mInputStream))
+  if (NS_WARN_IF(!mInputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mInputStream->Available(aResult);
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::Read(char* aBuffer, uint32_t aCount, uint32_t *aNumRead)
+nsBinaryInputStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aNumRead)
 {
-  if (NS_WARN_IF(!mInputStream))
+  if (NS_WARN_IF(!mInputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
 
   // mInputStream might give us short reads, so deal with that.
   uint32_t totalRead = 0;
 
   uint32_t bytesRead;
   do {
     nsresult rv = mInputStream->Read(aBuffer, aCount, &bytesRead);
     if (rv == NS_BASE_STREAM_WOULD_BLOCK && totalRead != 0) {
@@ -368,32 +412,33 @@ nsBinaryInputStream::Read(char* aBuffer,
 }
 
 
 // when forwarding ReadSegments to mInputStream, we need to make sure
 // 'this' is being passed to the writer each time. To do this, we need
 // a thunking function which keeps the real input stream around.
 
 // the closure wrapper
-struct ReadSegmentsClosure {
+struct ReadSegmentsClosure
+{
   nsIInputStream* mRealInputStream;
   void* mRealClosure;
   nsWriteSegmentFun mRealWriter;
   nsresult mRealResult;
   uint32_t mBytesRead;  // to properly implement aToOffset
 };
 
 // the thunking function
 static NS_METHOD
 ReadSegmentForwardingThunk(nsIInputStream* aStream,
-                           void *aClosure,
+                           void* aClosure,
                            const char* aFromSegment,
                            uint32_t aToOffset,
                            uint32_t aCount,
-                           uint32_t *aWriteCount)
+                           uint32_t* aWriteCount)
 {
   ReadSegmentsClosure* thunkClosure =
     reinterpret_cast<ReadSegmentsClosure*>(aClosure);
 
   NS_ASSERTION(NS_SUCCEEDED(thunkClosure->mRealResult),
                "How did this get to be a failure status?");
 
   thunkClosure->mRealResult =
@@ -403,163 +448,176 @@ ReadSegmentForwardingThunk(nsIInputStrea
                               thunkClosure->mBytesRead + aToOffset,
                               aCount, aWriteCount);
 
   return thunkClosure->mRealResult;
 }
 
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, uint32_t count, uint32_t *_retval)
+nsBinaryInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
+                                  uint32_t aCount, uint32_t* aResult)
 {
-  if (NS_WARN_IF(!mInputStream))
+  if (NS_WARN_IF(!mInputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
 
-  ReadSegmentsClosure thunkClosure = { this, closure, writer, NS_OK, 0 };
+  ReadSegmentsClosure thunkClosure = { this, aClosure, aWriter, NS_OK, 0 };
 
   // mInputStream might give us short reads, so deal with that.
   uint32_t bytesRead;
   do {
     nsresult rv = mInputStream->ReadSegments(ReadSegmentForwardingThunk,
                                              &thunkClosure,
-                                             count, &bytesRead);
+                                             aCount, &bytesRead);
 
     if (rv == NS_BASE_STREAM_WOULD_BLOCK && thunkClosure.mBytesRead != 0) {
       // We already read some data.  Return it.
       break;
     }
 
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     thunkClosure.mBytesRead += bytesRead;
-    count -= bytesRead;
-  } while (count != 0 && bytesRead != 0 &&
+    aCount -= bytesRead;
+  } while (aCount != 0 && bytesRead != 0 &&
            NS_SUCCEEDED(thunkClosure.mRealResult));
 
-  *_retval = thunkClosure.mBytesRead;
+  *aResult = thunkClosure.mBytesRead;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::IsNonBlocking(bool *aNonBlocking)
+nsBinaryInputStream::IsNonBlocking(bool* aNonBlocking)
 {
-  if (NS_WARN_IF(!mInputStream))
+  if (NS_WARN_IF(!mInputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mInputStream->IsNonBlocking(aNonBlocking);
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::Close()
 {
-  if (NS_WARN_IF(!mInputStream))
+  if (NS_WARN_IF(!mInputStream)) {
     return NS_ERROR_UNEXPECTED;
+  }
   return mInputStream->Close();
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::SetInputStream(nsIInputStream *aInputStream)
+nsBinaryInputStream::SetInputStream(nsIInputStream* aInputStream)
 {
-  if (NS_WARN_IF(!aInputStream))
+  if (NS_WARN_IF(!aInputStream)) {
     return NS_ERROR_INVALID_ARG;
+  }
   mInputStream = aInputStream;
   mBufferAccess = do_QueryInterface(aInputStream);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadBoolean(bool* aBoolean)
 {
   uint8_t byteResult;
   nsresult rv = Read8(&byteResult);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   *aBoolean = !!byteResult;
   return rv;
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::Read8(uint8_t* aByte)
 {
   nsresult rv;
   uint32_t bytesRead;
 
   rv = Read(reinterpret_cast<char*>(aByte), sizeof(*aByte), &bytesRead);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesRead != 1)
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesRead != 1) {
     return NS_ERROR_FAILURE;
+  }
   return rv;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::Read16(uint16_t* a16)
+nsBinaryInputStream::Read16(uint16_t* aNum)
 {
-  nsresult rv;
   uint32_t bytesRead;
-
-  rv = Read(reinterpret_cast<char*>(a16), sizeof *a16, &bytesRead);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesRead != sizeof *a16)
+  nsresult rv = Read(reinterpret_cast<char*>(aNum), sizeof(*aNum), &bytesRead);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesRead != sizeof(*aNum)) {
     return NS_ERROR_FAILURE;
-  *a16 = mozilla::NativeEndian::swapFromBigEndian(*a16);
+  }
+  *aNum = mozilla::NativeEndian::swapFromBigEndian(*aNum);
   return rv;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::Read32(uint32_t* a32)
+nsBinaryInputStream::Read32(uint32_t* aNum)
 {
-  nsresult rv;
   uint32_t bytesRead;
-
-  rv = Read(reinterpret_cast<char*>(a32), sizeof *a32, &bytesRead);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesRead != sizeof *a32)
+  nsresult rv = Read(reinterpret_cast<char*>(aNum), sizeof(*aNum), &bytesRead);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesRead != sizeof(*aNum)) {
     return NS_ERROR_FAILURE;
-  *a32 = mozilla::NativeEndian::swapFromBigEndian(*a32);
+  }
+  *aNum = mozilla::NativeEndian::swapFromBigEndian(*aNum);
   return rv;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::Read64(uint64_t* a64)
+nsBinaryInputStream::Read64(uint64_t* aNum)
 {
-  nsresult rv;
   uint32_t bytesRead;
-
-  rv = Read(reinterpret_cast<char*>(a64), sizeof *a64, &bytesRead);
-  if (NS_FAILED(rv)) return rv;
-  if (bytesRead != sizeof *a64)
+  nsresult rv = Read(reinterpret_cast<char*>(aNum), sizeof(*aNum), &bytesRead);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (bytesRead != sizeof(*aNum)) {
     return NS_ERROR_FAILURE;
-  *a64 = mozilla::NativeEndian::swapFromBigEndian(*a64);
+  }
+  *aNum = mozilla::NativeEndian::swapFromBigEndian(*aNum);
   return rv;
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadFloat(float* aFloat)
 {
-  NS_ASSERTION(sizeof(float) == sizeof (uint32_t),
+  NS_ASSERTION(sizeof(float) == sizeof(uint32_t),
                "False assumption about sizeof(float)");
   return Read32(reinterpret_cast<uint32_t*>(aFloat));
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadDouble(double* aDouble)
 {
   NS_ASSERTION(sizeof(double) == sizeof(uint64_t),
                "False assumption about sizeof(double)");
   return Read64(reinterpret_cast<uint64_t*>(aDouble));
 }
 
 static NS_METHOD
 WriteSegmentToCString(nsIInputStream* aStream,
-                      void *aClosure,
+                      void* aClosure,
                       const char* aFromSegment,
                       uint32_t aToOffset,
                       uint32_t aCount,
-                      uint32_t *aWriteCount)
+                      uint32_t* aWriteCount)
 {
   nsACString* outString = static_cast<nsACString*>(aClosure);
 
   outString->Append(aFromSegment, aCount);
 
   *aWriteCount = aCount;
 
   return NS_OK;
@@ -567,33 +625,39 @@ WriteSegmentToCString(nsIInputStream* aS
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadCString(nsACString& aString)
 {
   nsresult rv;
   uint32_t length, bytesRead;
 
   rv = Read32(&length);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   aString.Truncate();
   rv = ReadSegments(WriteSegmentToCString, &aString, length, &bytesRead);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  if (bytesRead != length)
+  if (bytesRead != length) {
     return NS_ERROR_FAILURE;
+  }
 
   return NS_OK;
 }
 
 
 // sometimes, WriteSegmentToString will be handed an odd-number of
 // bytes, which means we only have half of the last char16_t
-struct WriteStringClosure {
-  char16_t *mWriteCursor;
+struct WriteStringClosure
+{
+  char16_t* mWriteCursor;
   bool mHasCarryoverByte;
   char mCarryoverByte;
 };
 
 // there are a few cases we have to account for here:
 // * even length buffer, no carryover - easy, just append
 // * odd length buffer, no carryover - the last byte needs to be saved
 //                                     for carryover
@@ -606,27 +670,27 @@ struct WriteStringClosure {
 //                              this gives you an odd length buffer,
 //                              so you have to save the last byte for
 //                              the next carryover
 
 
 // same version of the above, but with correct casting and endian swapping
 static NS_METHOD
 WriteSegmentToString(nsIInputStream* aStream,
-                     void *aClosure,
+                     void* aClosure,
                      const char* aFromSegment,
                      uint32_t aToOffset,
                      uint32_t aCount,
-                     uint32_t *aWriteCount)
+                     uint32_t* aWriteCount)
 {
   NS_PRECONDITION(aCount > 0, "Why are we being told to write 0 bytes?");
   NS_PRECONDITION(sizeof(char16_t) == 2, "We can't handle other sizes!");
 
   WriteStringClosure* closure = static_cast<WriteStringClosure*>(aClosure);
-  char16_t *cursor = closure->mWriteCursor;
+  char16_t* cursor = closure->mWriteCursor;
 
   // we're always going to consume the whole buffer no matter what
   // happens, so take care of that right now.. that allows us to
   // tweak aCount later. Do NOT move this!
   *aWriteCount = aCount;
 
   // if the last Write had an odd-number of bytes read, then
   if (closure->mHasCarryoverByte) {
@@ -642,26 +706,26 @@ WriteSegmentToString(nsIInputStream* aSt
     // is relative to the ORIGINAL buffer
     ++aFromSegment;
     --aCount;
 
     closure->mHasCarryoverByte = false;
   }
 
   // this array is possibly unaligned... be careful how we access it!
-  const char16_t *unicodeSegment =
+  const char16_t* unicodeSegment =
     reinterpret_cast<const char16_t*>(aFromSegment);
 
   // calculate number of full characters in segment (aCount could be odd!)
   uint32_t segmentLength = aCount / sizeof(char16_t);
 
   // copy all data into our aligned buffer.  byte swap if necessary.
   // cursor may be unaligned, so we cannot use copyAndSwapToBigEndian directly
   memcpy(cursor, unicodeSegment, segmentLength * sizeof(char16_t));
-  char16_t *end = cursor + segmentLength;
+  char16_t* end = cursor + segmentLength;
   mozilla::NativeEndian::swapToBigEndianInPlace(cursor, segmentLength);
   closure->mWriteCursor = end;
 
   // remember this is the modifed aCount and aFromSegment,
   // so that will take into account the fact that we might have
   // skipped the first byte in the buffer
   if (aCount % sizeof(char16_t) != 0) {
     // we must have had a carryover byte, that we'll need the next
@@ -676,187 +740,211 @@ WriteSegmentToString(nsIInputStream* aSt
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadString(nsAString& aString)
 {
   nsresult rv;
   uint32_t length, bytesRead;
 
   rv = Read32(&length);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   if (length == 0) {
     aString.Truncate();
     return NS_OK;
   }
 
   // pre-allocate output buffer, and get direct access to buffer...
-  if (!aString.SetLength(length, mozilla::fallible_t()))
+  if (!aString.SetLength(length, mozilla::fallible_t())) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   nsAString::iterator start;
   aString.BeginWriting(start);
 
   WriteStringClosure closure;
   closure.mWriteCursor = start.get();
   closure.mHasCarryoverByte = false;
 
   rv = ReadSegments(WriteSegmentToString, &closure,
-                    length*sizeof(char16_t), &bytesRead);
-  if (NS_FAILED(rv)) return rv;
+                    length * sizeof(char16_t), &bytesRead);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   NS_ASSERTION(!closure.mHasCarryoverByte, "some strange stream corruption!");
 
-  if (bytesRead != length*sizeof(char16_t))
+  if (bytesRead != length * sizeof(char16_t)) {
     return NS_ERROR_FAILURE;
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadBytes(uint32_t aLength, char* *_rval)
+nsBinaryInputStream::ReadBytes(uint32_t aLength, char** aResult)
 {
   nsresult rv;
   uint32_t bytesRead;
   char* s;
 
   s = reinterpret_cast<char*>(moz_malloc(aLength));
-  if (!s)
+  if (!s) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   rv = Read(s, aLength, &bytesRead);
   if (NS_FAILED(rv)) {
     moz_free(s);
     return rv;
   }
   if (bytesRead != aLength) {
     moz_free(s);
     return NS_ERROR_FAILURE;
   }
 
-  *_rval = s;
+  *aResult = s;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t* *_rval)
+nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t** aResult)
 {
-  return ReadBytes(aLength, reinterpret_cast<char **>(_rval));
+  return ReadBytes(aLength, reinterpret_cast<char**>(aResult));
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength, JS::Handle<JS::Value> aBuffer, JSContext* cx)
+nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
+                                     JS::Handle<JS::Value> aBuffer,
+                                     JSContext* aCx)
 {
   if (!aBuffer.isObject()) {
     return NS_ERROR_FAILURE;
   }
-  JS::RootedObject buffer(cx, &aBuffer.toObject());
+  JS::RootedObject buffer(aCx, &aBuffer.toObject());
   if (!JS_IsArrayBufferObject(buffer) ||
       JS_GetArrayBufferByteLength(buffer) < aLength) {
     return NS_ERROR_FAILURE;
   }
-  uint8_t* data = JS_GetStableArrayBufferData(cx, buffer);
+  uint8_t* data = JS_GetStableArrayBufferData(aCx, buffer);
   if (!data) {
     return NS_ERROR_FAILURE;
   }
 
   uint32_t bytesRead;
   nsresult rv = Read(reinterpret_cast<char*>(data), aLength, &bytesRead);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
   if (bytesRead != aLength) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadObject(bool aIsStrongRef, nsISupports* *aObject)
+nsBinaryInputStream::ReadObject(bool aIsStrongRef, nsISupports** aObject)
 {
   nsCID cid;
   nsIID iid;
   nsresult rv = ReadID(&cid);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = ReadID(&iid);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   // HACK: Intercept old (pre-gecko6) nsIURI IID, and replace with
   // the updated IID, so that we're QI'ing to an actual interface.
   // (As soon as we drop support for upgrading from pre-gecko6, we can
   // remove this chunk.)
-  static const nsIID oldURIiid =
-    { 0x7a22cc0, 0xce5, 0x11d3,
-      { 0x93, 0x31, 0x0, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }};
+  static const nsIID oldURIiid = {
+    0x7a22cc0, 0xce5, 0x11d3,
+    { 0x93, 0x31, 0x0, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }
+  };
 
   // hackaround for bug 670542
-  static const nsIID oldURIiid2 =
-    { 0xd6d04c36, 0x0fa4, 0x4db3,
-      { 0xbe, 0x05, 0x4a, 0x18, 0x39, 0x71, 0x03, 0xe2 }};
+  static const nsIID oldURIiid2 = {
+    0xd6d04c36, 0x0fa4, 0x4db3,
+    { 0xbe, 0x05, 0x4a, 0x18, 0x39, 0x71, 0x03, 0xe2 }
+  };
 
   // hackaround for bug 682031
-  static const nsIID oldURIiid3 =
-    { 0x12120b20, 0x0929, 0x40e9,
-      { 0x88, 0xcf, 0x6e, 0x08, 0x76, 0x6e, 0x8b, 0x23 }};
+  static const nsIID oldURIiid3 = {
+    0x12120b20, 0x0929, 0x40e9,
+    { 0x88, 0xcf, 0x6e, 0x08, 0x76, 0x6e, 0x8b, 0x23 }
+  };
 
   if (iid.Equals(oldURIiid) ||
       iid.Equals(oldURIiid2) ||
       iid.Equals(oldURIiid3)) {
     const nsIID newURIiid = NS_IURI_IID;
     iid = newURIiid;
   }
   // END HACK
 
   nsCOMPtr<nsISupports> object = do_CreateInstance(cid, &rv);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   nsCOMPtr<nsISerializable> serializable = do_QueryInterface(object);
-  if (NS_WARN_IF(!serializable))
+  if (NS_WARN_IF(!serializable)) {
     return NS_ERROR_UNEXPECTED;
+  }
 
   rv = serializable->Read(this);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   return object->QueryInterface(iid, reinterpret_cast<void**>(aObject));
 }
 
 NS_IMETHODIMP
-nsBinaryInputStream::ReadID(nsID *aResult)
+nsBinaryInputStream::ReadID(nsID* aResult)
 {
   nsresult rv = Read32(&aResult->m0);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = Read16(&aResult->m1);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   rv = Read16(&aResult->m2);
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   for (int i = 0; i < 8; ++i) {
     rv = Read8(&aResult->m3[i]);
-    if (NS_WARN_IF(NS_FAILED(rv)))
+    if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP_(char*)
 nsBinaryInputStream::GetBuffer(uint32_t aLength, uint32_t aAlignMask)
 {
-  if (mBufferAccess)
+  if (mBufferAccess) {
     return mBufferAccess->GetBuffer(aLength, aAlignMask);
+  }
   return nullptr;
 }
 
 NS_IMETHODIMP_(void)
 nsBinaryInputStream::PutBuffer(char* aBuffer, uint32_t aLength)
 {
-  if (mBufferAccess)
+  if (mBufferAccess) {
     mBufferAccess->PutBuffer(aBuffer, aLength);
+  }
 }
--- a/xpcom/io/nsBinaryStream.h
+++ b/xpcom/io/nsBinaryStream.h
@@ -23,35 +23,39 @@
 
 #define NS_BINARYOUTPUTSTREAM_CONTRACTID "@mozilla.org/binaryoutputstream;1"
 
 // Derive from nsIObjectOutputStream so this class can be used as a superclass
 // by nsObjectOutputStream.
 class nsBinaryOutputStream : public nsIObjectOutputStream
 {
 public:
-  nsBinaryOutputStream() {}
+  nsBinaryOutputStream()
+  {
+  }
   // virtual dtor since subclasses call our Release()
-  virtual ~nsBinaryOutputStream() {}
+  virtual ~nsBinaryOutputStream()
+  {
+  }
 
 protected:
   // nsISupports methods
   NS_DECL_ISUPPORTS
 
   // nsIOutputStream methods
   NS_DECL_NSIOUTPUTSTREAM
 
   // nsIBinaryOutputStream methods
   NS_DECL_NSIBINARYOUTPUTSTREAM
 
   // nsIObjectOutputStream methods
   NS_DECL_NSIOBJECTOUTPUTSTREAM
 
   // Call Write(), ensuring that all proffered data is written
-  nsresult WriteFully(const char *aBuf, uint32_t aCount);
+  nsresult WriteFully(const char* aBuf, uint32_t aCount);
 
   nsCOMPtr<nsIOutputStream>       mOutputStream;
   nsCOMPtr<nsIStreamBufferAccess> mBufferAccess;
 };
 
 #define NS_BINARYINPUTSTREAM_CID        \
 { /* c521a612-2aad-46db-b6ab-3b821fb150b1 */       \
    0xc521a612,                                     \
@@ -62,19 +66,23 @@ protected:
 
 #define NS_BINARYINPUTSTREAM_CONTRACTID "@mozilla.org/binaryinputstream;1"
 
 // Derive from nsIObjectInputStream so this class can be used as a superclass
 // by nsObjectInputStream.
 class nsBinaryInputStream : public nsIObjectInputStream
 {
 public:
-  nsBinaryInputStream() {}
+  nsBinaryInputStream()
+  {
+  }
   // virtual dtor since subclasses call our Release()
-  virtual ~nsBinaryInputStream() {}
+  virtual ~nsBinaryInputStream()
+  {
+  }
 
 protected:
   // nsISupports methods
   NS_DECL_ISUPPORTS
 
   // nsIInputStream methods
   NS_DECL_NSIINPUTSTREAM
 
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -50,101 +50,100 @@ using namespace mozilla;
 #define HOME_DIR NS_UNIX_HOME_DIR
 #endif
 
 //----------------------------------------------------------------------------------------
 nsresult
 nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile)
 //----------------------------------------------------------------------------------------
 {
-  if (NS_WARN_IF(!aFile))
+  if (NS_WARN_IF(!aFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
   *aFile = nullptr;
 
   //  Set the component registry location:
-  if (!gService)
+  if (!gService) {
     return NS_ERROR_FAILURE;
+  }
 
   nsresult rv;
 
   nsCOMPtr<nsIProperties> dirService;
   rv = nsDirectoryService::Create(nullptr,
                                   NS_GET_IID(nsIProperties),
                                   getter_AddRefs(dirService));  // needs to be around for life of product
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
-  if (dirService)
-  {
+  if (dirService) {
     nsCOMPtr <nsIFile> aLocalFile;
     dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile));
-    if (aLocalFile)
-    {
+    if (aLocalFile) {
       *aFile = aLocalFile;
       NS_ADDREF(*aFile);
       return NS_OK;
     }
   }
 
   nsLocalFile* localFile = new nsLocalFile;
-
   if (localFile == nullptr)
     return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(localFile);
 
-
-
 #ifdef XP_WIN
   wchar_t buf[MAX_PATH + 1];
   SetLastError(ERROR_SUCCESS);
   if (GetModuleFileNameW(0, buf, mozilla::ArrayLength(buf)) &&
       GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
     // chop off the executable name by finding the rightmost backslash
     wchar_t* lastSlash = wcsrchr(buf, L'\\');
-    if (lastSlash)
+    if (lastSlash) {
       *(lastSlash + 1) = L'\0';
+    }
 
     localFile->InitWithPath(nsDependentString(buf));
     *aFile = localFile;
     return NS_OK;
   }
 
 #elif defined(MOZ_WIDGET_COCOA)
   // Works even if we're not bundled.
   CFBundleRef appBundle = CFBundleGetMainBundle();
-  if (appBundle != nullptr)
-  {
+  if (appBundle) {
     CFURLRef bundleURL = CFBundleCopyExecutableURL(appBundle);
-    if (bundleURL != nullptr)
-    {
-      CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, bundleURL);
-      if (parentURL)
-      {
+    if (bundleURL) {
+      CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(
+        kCFAllocatorDefault, bundleURL);
+      if (parentURL) {
         // Pass true for the "resolveAgainstBase" arg to CFURLGetFileSystemRepresentation.
         // This will resolve the relative portion of the CFURL against it base, giving a full
         // path, which CFURLCopyFileSystemPath doesn't do.
         char buffer[PATH_MAX];
-        if (CFURLGetFileSystemRepresentation(parentURL, true, (UInt8 *)buffer, sizeof(buffer)))
-        {
+        if (CFURLGetFileSystemRepresentation(parentURL, true,
+                                             (UInt8*)buffer, sizeof(buffer))) {
 #ifdef DEBUG_conrad
           printf("nsDirectoryService - CurrentProcessDir is: %s\n", buffer);
 #endif
           rv = localFile->InitWithNativePath(nsDependentCString(buffer));
-          if (NS_SUCCEEDED(rv))
+          if (NS_SUCCEEDED(rv)) {
             *aFile = localFile;
+          }
         }
         CFRelease(parentURL);
       }
       CFRelease(bundleURL);
     }
   }
 
   NS_ASSERTION(*aFile, "nsDirectoryService - Could not determine CurrentProcessDir.\n");
-  if (*aFile)
+  if (*aFile) {
     return NS_OK;
+  }
 
 #elif defined(XP_UNIX)
 
   // In the absence of a good way to get the executable directory let
   // us try this for unix:
   //    - if MOZILLA_FIVE_HOME is defined, that is it
   //    - else give the current directory
   char buf[MAXPATHLEN];
@@ -154,45 +153,42 @@ nsDirectoryService::GetCurrentProcessDir
   //
   // The idea here is to allow for builds that have a default MOZILLA_FIVE_HOME
   // regardless of the environment.  This makes it easier to write apps that
   // embed mozilla without having to worry about setting up the environment
   //
   // We do this by putenv()ing the default value into the environment.  Note that
   // we only do this if it is not already set.
 #ifdef MOZ_DEFAULT_MOZILLA_FIVE_HOME
-  const char *home = PR_GetEnv("MOZILLA_FIVE_HOME");
-  if (!home || !*home)
-  {
+  const char* home = PR_GetEnv("MOZILLA_FIVE_HOME");
+  if (!home || !*home) {
     putenv("MOZILLA_FIVE_HOME=" MOZ_DEFAULT_MOZILLA_FIVE_HOME);
   }
 #endif
 
-  char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
-  if (moz5 && *moz5)
-  {
+  char* moz5 = PR_GetEnv("MOZILLA_FIVE_HOME");
+  if (moz5 && *moz5) {
     if (realpath(moz5, buf)) {
       localFile->InitWithNativePath(nsDependentCString(buf));
       *aFile = localFile;
       return NS_OK;
     }
   }
 #if defined(DEBUG)
   static bool firstWarning = true;
 
-  if((!moz5 || !*moz5) && firstWarning) {
+  if ((!moz5 || !*moz5) && firstWarning) {
     // Warn that MOZILLA_FIVE_HOME not set, once.
     printf("Warning: MOZILLA_FIVE_HOME not set.\n");
     firstWarning = false;
   }
 #endif /* DEBUG */
 
   // Fall back to current directory.
-  if (getcwd(buf, sizeof(buf)))
-  {
+  if (getcwd(buf, sizeof(buf))) {
     localFile->InitWithNativePath(nsDependentCString(buf));
     *aFile = localFile;
     return NS_OK;
   }
 
 #endif
 
   NS_RELEASE(localFile);
@@ -204,25 +200,26 @@ nsDirectoryService::GetCurrentProcessDir
 nsDirectoryService* nsDirectoryService::gService = nullptr;
 
 nsDirectoryService::nsDirectoryService()
   : mHashtable(256)
 {
 }
 
 nsresult
-nsDirectoryService::Create(nsISupports *outer, REFNSIID aIID, void **aResult)
+nsDirectoryService::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
 {
-  if (NS_WARN_IF(!aResult))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  if (NS_WARN_IF(outer))
+  }
+  if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
+  }
 
-  if (!gService)
-  {
+  if (!gService) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   return gService->QueryInterface(aIID, aResult);
 }
 
 #define DIR_ATOM(name_, value_) nsIAtom* nsDirectoryService::name_ = nullptr;
 #include "nsDirectoryServiceAtomList.h"
@@ -251,644 +248,497 @@ nsDirectoryService::RealInit()
   NS_ASSERTION(!gService,
                "nsDirectoryService::RealInit Mustn't initialize twice!");
 
   nsRefPtr<nsDirectoryService> self = new nsDirectoryService();
 
   NS_RegisterStaticAtoms(directory_atoms);
 
   // Let the list hold the only reference to the provider.
-  nsAppFileLocationProvider *defaultProvider = new nsAppFileLocationProvider;
+  nsAppFileLocationProvider* defaultProvider = new nsAppFileLocationProvider;
   self->mProviders.AppendElement(defaultProvider);
 
   self.swap(gService);
 }
 
 nsDirectoryService::~nsDirectoryService()
 {
 }
 
-NS_IMPL_ISUPPORTS(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2)
+NS_IMPL_ISUPPORTS(nsDirectoryService,
+                  nsIProperties,
+                  nsIDirectoryService,
+                  nsIDirectoryServiceProvider,
+                  nsIDirectoryServiceProvider2)
 
 
 NS_IMETHODIMP
-nsDirectoryService::Undefine(const char* prop)
+nsDirectoryService::Undefine(const char* aProp)
 {
-  if (NS_WARN_IF(!prop))
+  if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
-  nsDependentCString key(prop);
-  if (!mHashtable.Get(key, nullptr))
+  nsDependentCString key(aProp);
+  if (!mHashtable.Get(key, nullptr)) {
     return NS_ERROR_FAILURE;
+  }
 
   mHashtable.Remove(key);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::GetKeys(uint32_t *count, char ***keys)
+nsDirectoryService::GetKeys(uint32_t* aCount, char*** aKeys)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 struct FileData
 {
-  FileData(const char* aProperty,
-           const nsIID& aUUID) :
-    property(aProperty),
-    data(nullptr),
-    persistent(true),
-    uuid(aUUID) {}
+  FileData(const char* aProperty, const nsIID& aUUID)
+    : property(aProperty)
+    , data(nullptr)
+    , persistent(true)
+    , uuid(aUUID)
+  {
+  }
 
   const char*   property;
   nsISupports*  data;
   bool          persistent;
   const nsIID&  uuid;
 };
 
-static bool FindProviderFile(nsIDirectoryServiceProvider* aElement,
-                             FileData* aData)
+static bool
+FindProviderFile(nsIDirectoryServiceProvider* aElement, FileData* aData)
 {
   nsresult rv;
   if (aData->uuid.Equals(NS_GET_IID(nsISimpleEnumerator))) {
     // Not all providers implement this iface
     nsCOMPtr<nsIDirectoryServiceProvider2> prov2 = do_QueryInterface(aElement);
-    if (prov2)
-    {
+    if (prov2) {
       nsCOMPtr<nsISimpleEnumerator> newFiles;
       rv = prov2->GetFiles(aData->property, getter_AddRefs(newFiles));
       if (NS_SUCCEEDED(rv) && newFiles) {
         if (aData->data) {
           nsCOMPtr<nsISimpleEnumerator> unionFiles;
 
           NS_NewUnionEnumerator(getter_AddRefs(unionFiles),
-                                (nsISimpleEnumerator*) aData->data, newFiles);
+                                (nsISimpleEnumerator*)aData->data, newFiles);
 
-          if (unionFiles)
-            unionFiles.swap(* (nsISimpleEnumerator**) &aData->data);
-        }
-        else
-        {
+          if (unionFiles) {
+            unionFiles.swap(*(nsISimpleEnumerator**)&aData->data);
+          }
+        } else {
           NS_ADDREF(aData->data = newFiles);
         }
 
         aData->persistent = false; // Enumerators can never be persistent
         return rv == NS_SUCCESS_AGGREGATE_RESULT;
       }
     }
-  }
-  else
-  {
+  } else {
     rv = aElement->GetFile(aData->property, &aData->persistent,
-                           (nsIFile **)&aData->data);
-    if (NS_SUCCEEDED(rv) && aData->data)
+                           (nsIFile**)&aData->data);
+    if (NS_SUCCEEDED(rv) && aData->data) {
       return false;
+    }
   }
 
   return true;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result)
+nsDirectoryService::Get(const char* aProp, const nsIID& aUuid, void** aResult)
 {
-  if (NS_WARN_IF(!prop))
+  if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
-  nsDependentCString key(prop);
+  nsDependentCString key(aProp);
 
   nsCOMPtr<nsIFile> cachedFile = mHashtable.Get(key);
 
   if (cachedFile) {
     nsCOMPtr<nsIFile> cloneFile;
     cachedFile->Clone(getter_AddRefs(cloneFile));
-    return cloneFile->QueryInterface(uuid, result);
+    return cloneFile->QueryInterface(aUuid, aResult);
   }
 
   // it is not one of our defaults, lets check any providers
-  FileData fileData(prop, uuid);
+  FileData fileData(aProp, aUuid);
 
   for (int32_t i = mProviders.Length() - 1; i >= 0; i--) {
     if (!FindProviderFile(mProviders[i], &fileData)) {
       break;
     }
   }
-  if (fileData.data)
-  {
-    if (fileData.persistent)
-    {
-      Set(prop, static_cast<nsIFile*>(fileData.data));
+  if (fileData.data) {
+    if (fileData.persistent) {
+      Set(aProp, static_cast<nsIFile*>(fileData.data));
     }
-    nsresult rv = (fileData.data)->QueryInterface(uuid, result);
+    nsresult rv = (fileData.data)->QueryInterface(aUuid, aResult);
     NS_RELEASE(fileData.data);  // addref occurs in FindProviderFile()
     return rv;
   }
 
   FindProviderFile(static_cast<nsIDirectoryServiceProvider*>(this), &fileData);
-  if (fileData.data)
-  {
-    if (fileData.persistent)
-    {
-      Set(prop, static_cast<nsIFile*>(fileData.data));
+  if (fileData.data) {
+    if (fileData.persistent) {
+      Set(aProp, static_cast<nsIFile*>(fileData.data));
     }
-    nsresult rv = (fileData.data)->QueryInterface(uuid, result);
+    nsresult rv = (fileData.data)->QueryInterface(aUuid, aResult);
     NS_RELEASE(fileData.data);  // addref occurs in FindProviderFile()
     return rv;
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::Set(const char* prop, nsISupports* value)
+nsDirectoryService::Set(const char* aProp, nsISupports* aValue)
 {
-  if (NS_WARN_IF(!prop))
+  if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
-  nsDependentCString key(prop);
-  if (mHashtable.Get(key, nullptr) || !value) {
+  nsDependentCString key(aProp);
+  if (mHashtable.Get(key, nullptr) || !aValue) {
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIFile> ourFile = do_QueryInterface(value);
+  nsCOMPtr<nsIFile> ourFile = do_QueryInterface(aValue);
   if (ourFile) {
     nsCOMPtr<nsIFile> cloneFile;
-    ourFile->Clone (getter_AddRefs (cloneFile));
+    ourFile->Clone(getter_AddRefs(cloneFile));
     mHashtable.Put(key, cloneFile);
 
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::Has(const char *prop, bool *_retval)
+nsDirectoryService::Has(const char* aProp, bool* aResult)
 {
-  if (NS_WARN_IF(!prop))
+  if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
-  *_retval = false;
+  *aResult = false;
   nsCOMPtr<nsIFile> value;
-  nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));
-  if (NS_FAILED(rv))
+  nsresult rv = Get(aProp, NS_GET_IID(nsIFile), getter_AddRefs(value));
+  if (NS_FAILED(rv)) {
     return NS_OK;
+  }
 
-  if (value)
-  {
-    *_retval = true;
+  if (value) {
+    *aResult = true;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::RegisterProvider(nsIDirectoryServiceProvider *prov)
+nsDirectoryService::RegisterProvider(nsIDirectoryServiceProvider* aProv)
 {
-  if (!prov)
+  if (!aProv) {
     return NS_ERROR_FAILURE;
+  }
 
-  mProviders.AppendElement(prov);
+  mProviders.AppendElement(aProv);
   return NS_OK;
 }
 
 void
 nsDirectoryService::RegisterCategoryProviders()
 {
   nsCOMPtr<nsICategoryManager> catman
   (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
-  if (!catman)
+  if (!catman) {
     return;
+  }
 
   nsCOMPtr<nsISimpleEnumerator> entries;
   catman->EnumerateCategory(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
                             getter_AddRefs(entries));
 
   nsCOMPtr<nsIUTF8StringEnumerator> strings(do_QueryInterface(entries));
-  if (!strings)
+  if (!strings) {
     return;
+  }
 
   bool more;
   while (NS_SUCCEEDED(strings->HasMore(&more)) && more) {
     nsAutoCString entry;
     strings->GetNext(entry);
 
     nsXPIDLCString contractID;
     catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), getter_Copies(contractID));
 
     if (contractID) {
       nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
-      if (provider)
+      if (provider) {
         RegisterProvider(provider);
+      }
     }
   }
 }
 
 NS_IMETHODIMP
-nsDirectoryService::UnregisterProvider(nsIDirectoryServiceProvider *prov)
+nsDirectoryService::UnregisterProvider(nsIDirectoryServiceProvider* aProv)
 {
-  if (!prov)
+  if (!aProv) {
     return NS_ERROR_FAILURE;
+  }
 
-  mProviders.RemoveElement(prov);
+  mProviders.RemoveElement(aProv);
   return NS_OK;
 }
 
 // DO NOT ADD ANY LOCATIONS TO THIS FUNCTION UNTIL YOU TALK TO: dougt@netscape.com.
 // This is meant to be a place of xpcom or system specific file locations, not
 // application specific locations.  If you need the later, register a callback for
 // your application.
 
 NS_IMETHODIMP
-nsDirectoryService::GetFile(const char *prop, bool *persistent, nsIFile **_retval)
+nsDirectoryService::GetFile(const char* aProp, bool* aPersistent,
+                            nsIFile** aResult)
 {
   nsCOMPtr<nsIFile> localFile;
   nsresult rv = NS_ERROR_FAILURE;
 
-  *_retval = nullptr;
-  *persistent = true;
+  *aResult = nullptr;
+  *aPersistent = true;
 
-  nsCOMPtr<nsIAtom> inAtom = do_GetAtom(prop);
+  nsCOMPtr<nsIAtom> inAtom = do_GetAtom(aProp);
 
   // check to see if it is one of our defaults
 
   if (inAtom == nsDirectoryService::sCurrentProcess ||
-      inAtom == nsDirectoryService::sOS_CurrentProcessDirectory )
-  {
+      inAtom == nsDirectoryService::sOS_CurrentProcessDirectory) {
     rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
   }
 
   // Unless otherwise set, the core pieces of the GRE exist
   // in the current process directory.
-  else if (inAtom == nsDirectoryService::sGRE_Directory)
-  {
+  else if (inAtom == nsDirectoryService::sGRE_Directory) {
     rv = GetCurrentProcessDirectory(getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_DriveDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_DriveDirectory) {
     rv = GetSpecialSystemDirectory(OS_DriveDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_TemporaryDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_TemporaryDirectory) {
     rv = GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_CurrentProcessDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_CurrentProcessDirectory) {
     rv = GetSpecialSystemDirectory(OS_CurrentProcessDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_CurrentWorkingDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_CurrentWorkingDirectory) {
     rv = GetSpecialSystemDirectory(OS_CurrentWorkingDirectory, getter_AddRefs(localFile));
   }
 
 #if defined(MOZ_WIDGET_COCOA)
-  else if (inAtom == nsDirectoryService::sDirectory)
-  {
+  else if (inAtom == nsDirectoryService::sDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kSystemFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sTrashDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sTrashDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kTrashFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sStartupDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sStartupDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kStartupFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sShutdownDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sShutdownDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kShutdownFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sAppleMenuDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sAppleMenuDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kAppleMenuFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sControlPanelDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sControlPanelDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kControlPanelFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sExtensionDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sExtensionDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kExtensionFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sFontsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sFontsDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kFontsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPreferencesDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sPreferencesDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kPreferencesFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sDocumentsDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sInternetSearchDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sInternetSearchDirectory) {
     rv = GetOSXFolderType(kClassicDomain, kInternetSearchSitesFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserLibDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserLibDirectory) {
     rv = GetOSXFolderType(kUserDomain, kDomainLibraryFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_HomeDirectory) {
     rv = GetOSXFolderType(kUserDomain, kDomainTopLevelFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory) {
     // 10.5 and later, we can use kDownloadsFolderType which is defined in
     // Folders.h as "down".  However, in order to support 10.4 still, we
     // cannot use the named constant.  We'll use it's value, and if it
     // fails, fall back to the desktop.
 #ifndef kDownloadsFolderType
 #define kDownloadsFolderType 'down'
 #endif
 
     rv = GetOSXFolderType(kUserDomain, kDownloadsFolderType,
                           getter_AddRefs(localFile));
     if (NS_FAILED(rv)) {
       rv = GetOSXFolderType(kUserDomain, kDesktopFolderType,
                             getter_AddRefs(localFile));
     }
-  }
-  else if (inAtom == nsDirectoryService::sUserDesktopDirectory ||
-           inAtom == nsDirectoryService::sOS_DesktopDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserDesktopDirectory ||
+             inAtom == nsDirectoryService::sOS_DesktopDirectory) {
     rv = GetOSXFolderType(kUserDomain, kDesktopFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalDesktopDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalDesktopDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kDesktopFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserApplicationsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserApplicationsDirectory) {
     rv = GetOSXFolderType(kUserDomain, kApplicationsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalApplicationsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalApplicationsDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kApplicationsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserDocumentsDirectory) {
     rv = GetOSXFolderType(kUserDomain, kDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalDocumentsDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserInternetPlugInDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserInternetPlugInDirectory) {
     rv = GetOSXFolderType(kUserDomain, kInternetPlugInFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalInternetPlugInDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalInternetPlugInDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kInternetPlugInFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserFrameworksDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserFrameworksDirectory) {
     rv = GetOSXFolderType(kUserDomain, kFrameworksFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalFrameworksDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalFrameworksDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kFrameworksFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sUserPreferencesDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sUserPreferencesDirectory) {
     rv = GetOSXFolderType(kUserDomain, kPreferencesFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalPreferencesDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalPreferencesDirectory) {
     rv = GetOSXFolderType(kLocalDomain, kPreferencesFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPictureDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sPictureDocumentsDirectory) {
     rv = GetOSXFolderType(kUserDomain, kPictureDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sMovieDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sMovieDocumentsDirectory) {
     rv = GetOSXFolderType(kUserDomain, kMovieDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sMusicDocumentsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sMusicDocumentsDirectory) {
     rv = GetOSXFolderType(kUserDomain, kMusicDocumentsFolderType, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sInternetSitesDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sInternetSitesDirectory) {
     rv = GetOSXFolderType(kUserDomain, kInternetSitesFolderType, getter_AddRefs(localFile));
   }
 #elif defined (XP_WIN)
-  else if (inAtom == nsDirectoryService::sSystemDirectory)
-  {
+  else if (inAtom == nsDirectoryService::sSystemDirectory) {
     rv = GetSpecialSystemDirectory(Win_SystemDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sWindowsDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sWindowsDirectory) {
     rv = GetSpecialSystemDirectory(Win_WindowsDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sWindowsProgramFiles)
-  {
+  } else if (inAtom == nsDirectoryService::sWindowsProgramFiles) {
     rv = GetSpecialSystemDirectory(Win_ProgramFiles, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_HomeDirectory) {
     rv = GetSpecialSystemDirectory(Win_HomeDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDesktop)
-  {
+  } else if (inAtom == nsDirectoryService::sDesktop) {
     rv = GetSpecialSystemDirectory(Win_Desktop, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPrograms)
-  {
+  } else if (inAtom == nsDirectoryService::sPrograms) {
     rv = GetSpecialSystemDirectory(Win_Programs, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sControls)
-  {
+  } else if (inAtom == nsDirectoryService::sControls) {
     rv = GetSpecialSystemDirectory(Win_Controls, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPrinters)
-  {
+  } else if (inAtom == nsDirectoryService::sPrinters) {
     rv = GetSpecialSystemDirectory(Win_Printers, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPersonal)
-  {
+  } else if (inAtom == nsDirectoryService::sPersonal) {
     rv = GetSpecialSystemDirectory(Win_Personal, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sFavorites)
-  {
+  } else if (inAtom == nsDirectoryService::sFavorites) {
     rv = GetSpecialSystemDirectory(Win_Favorites, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sStartup)
-  {
+  } else if (inAtom == nsDirectoryService::sStartup) {
     rv = GetSpecialSystemDirectory(Win_Startup, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sRecent)
-  {
+  } else if (inAtom == nsDirectoryService::sRecent) {
     rv = GetSpecialSystemDirectory(Win_Recent, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sSendto)
-  {
+  } else if (inAtom == nsDirectoryService::sSendto) {
     rv = GetSpecialSystemDirectory(Win_Sendto, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sBitbucket)
-  {
+  } else if (inAtom == nsDirectoryService::sBitbucket) {
     rv = GetSpecialSystemDirectory(Win_Bitbucket, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sStartmenu)
-  {
+  } else if (inAtom == nsDirectoryService::sStartmenu) {
     rv = GetSpecialSystemDirectory(Win_Startmenu, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDesktopdirectory ||
-           inAtom == nsDirectoryService::sOS_DesktopDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sDesktopdirectory ||
+             inAtom == nsDirectoryService::sOS_DesktopDirectory) {
     rv = GetSpecialSystemDirectory(Win_Desktopdirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDrives)
-  {
+  } else if (inAtom == nsDirectoryService::sDrives) {
     rv = GetSpecialSystemDirectory(Win_Drives, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sNetwork)
-  {
+  } else if (inAtom == nsDirectoryService::sNetwork) {
     rv = GetSpecialSystemDirectory(Win_Network, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sNethood)
-  {
+  } else if (inAtom == nsDirectoryService::sNethood) {
     rv = GetSpecialSystemDirectory(Win_Nethood, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sFonts)
-  {
+  } else if (inAtom == nsDirectoryService::sFonts) {
     rv = GetSpecialSystemDirectory(Win_Fonts, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sTemplates)
-  {
+  } else if (inAtom == nsDirectoryService::sTemplates) {
     rv = GetSpecialSystemDirectory(Win_Templates, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sCommon_Startmenu)
-  {
+  } else if (inAtom == nsDirectoryService::sCommon_Startmenu) {
     rv = GetSpecialSystemDirectory(Win_Common_Startmenu, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sCommon_Programs)
-  {
+  } else if (inAtom == nsDirectoryService::sCommon_Programs) {
     rv = GetSpecialSystemDirectory(Win_Common_Programs, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sCommon_Startup)
-  {
+  } else if (inAtom == nsDirectoryService::sCommon_Startup) {
     rv = GetSpecialSystemDirectory(Win_Common_Startup, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sCommon_Desktopdirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sCommon_Desktopdirectory) {
     rv = GetSpecialSystemDirectory(Win_Common_Desktopdirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sCommon_AppData)
-  {
+  } else if (inAtom == nsDirectoryService::sCommon_AppData) {
     rv = GetSpecialSystemDirectory(Win_Common_AppData, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sAppdata)
-  {
+  } else if (inAtom == nsDirectoryService::sAppdata) {
     rv = GetSpecialSystemDirectory(Win_Appdata, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLocalAppdata)
-  {
+  } else if (inAtom == nsDirectoryService::sLocalAppdata) {
     rv = GetSpecialSystemDirectory(Win_LocalAppdata, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPrinthood)
-  {
+  } else if (inAtom == nsDirectoryService::sPrinthood) {
     rv = GetSpecialSystemDirectory(Win_Printhood, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sWinCookiesDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sWinCookiesDirectory) {
     rv = GetSpecialSystemDirectory(Win_Cookies, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory) {
     rv = GetSpecialSystemDirectory(Win_Downloads, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sDocs)
-  {
+  } else if (inAtom == nsDirectoryService::sDocs) {
     rv = GetSpecialSystemDirectory(Win_Documents, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sPictures)
-  {
+  } else if (inAtom == nsDirectoryService::sPictures) {
     rv = GetSpecialSystemDirectory(Win_Pictures, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sMusic)
-  {
+  } else if (inAtom == nsDirectoryService::sMusic) {
     rv = GetSpecialSystemDirectory(Win_Music, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sVideos)
-  {
+  } else if (inAtom == nsDirectoryService::sVideos) {
     rv = GetSpecialSystemDirectory(Win_Videos, getter_AddRefs(localFile));
   }
 #elif defined (XP_UNIX)
 
-  else if (inAtom == nsDirectoryService::sLocalDirectory)
-  {
+  else if (inAtom == nsDirectoryService::sLocalDirectory) {
     rv = GetSpecialSystemDirectory(Unix_LocalDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sLibDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sLibDirectory) {
     rv = GetSpecialSystemDirectory(Unix_LibDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sOS_HomeDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sOS_HomeDirectory) {
     rv = GetSpecialSystemDirectory(Unix_HomeDirectory, getter_AddRefs(localFile));
-  }
-  else if (inAtom == nsDirectoryService::sXDGDesktop ||
-           inAtom == nsDirectoryService::sOS_DesktopDirectory)
-  {
+  } else if (inAtom == nsDirectoryService::sXDGDesktop ||
+             inAtom == nsDirectoryService::sOS_DesktopDirectory) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Desktop, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGDocuments)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGDocuments) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Documents, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGDownload ||
-           inAtom == nsDirectoryService::sDefaultDownloadDirectory)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGDownload ||
+             inAtom == nsDirectoryService::sDefaultDownloadDirectory) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Download, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGMusic)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGMusic) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Music, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGPictures)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGPictures) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Pictures, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGPublicShare)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGPublicShare) {
     rv = GetSpecialSystemDirectory(Unix_XDG_PublicShare, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGTemplates)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGTemplates) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Templates, getter_AddRefs(localFile));
-    *persistent = false;
-  }
-  else if (inAtom == nsDirectoryService::sXDGVideos)
-  {
+    *aPersistent = false;
+  } else if (inAtom == nsDirectoryService::sXDGVideos) {
     rv = GetSpecialSystemDirectory(Unix_XDG_Videos, getter_AddRefs(localFile));
-    *persistent = false;
+    *aPersistent = false;
   }
 #endif
 
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
-  if (!localFile)
+  if (!localFile) {
     return NS_ERROR_FAILURE;
+  }
 
-  localFile.forget(_retval);
+  localFile.forget(aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDirectoryService::GetFiles(const char *prop, nsISimpleEnumerator **_retval)
+nsDirectoryService::GetFiles(const char* aProp, nsISimpleEnumerator** aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = nullptr;
+  }
+  *aResult = nullptr;
 
   return NS_ERROR_FAILURE;
 }
--- a/xpcom/io/nsDirectoryService.h
+++ b/xpcom/io/nsDirectoryService.h
@@ -13,19 +13,20 @@
 #include "nsIAtom.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 
 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR       "MozBinD"   // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
                                                             // CANNOT be used to GET a location
 #define NS_DIRECTORY_SERVICE_CID  {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
 
-class nsDirectoryService MOZ_FINAL : public nsIDirectoryService,
-                                     public nsIProperties,
-                                     public nsIDirectoryServiceProvider2
+class nsDirectoryService MOZ_FINAL
+  : public nsIDirectoryService
+  , public nsIProperties
+  , public nsIDirectoryServiceProvider2
 {
 public:
 
   // nsISupports interface
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSIPROPERTIES
 
@@ -37,25 +38,25 @@ public:
 
   nsDirectoryService();
   ~nsDirectoryService();
 
   static void RealInit();
   void RegisterCategoryProviders();
 
   static nsresult
-  Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
+  Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
   static nsDirectoryService* gService;
 
 private:
   nsresult GetCurrentProcessDirectory(nsIFile** aFile);
 
   nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable;
-  nsTArray<nsCOMPtr<nsIDirectoryServiceProvider> > mProviders;
+  nsTArray<nsCOMPtr<nsIDirectoryServiceProvider>> mProviders;
 
 public:
 
 #define DIR_ATOM(name_, value_) static nsIAtom* name_;
 #include "nsDirectoryServiceAtomList.h"
 #undef DIR_ATOM
 
 };
--- a/xpcom/io/nsDirectoryServiceUtils.h
+++ b/xpcom/io/nsDirectoryServiceUtils.h
@@ -10,20 +10,21 @@
 #include "nsIServiceManager.h"
 #include "nsIProperties.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCOMPtr.h"
 #include "nsXPCOMCID.h"
 #include "nsIFile.h"
 
 inline nsresult
-NS_GetSpecialDirectory(const char* specialDirName, nsIFile* *result)
+NS_GetSpecialDirectory(const char* aSpecialDirName, nsIFile** aResult)
 {
   nsresult rv;
   nsCOMPtr<nsIProperties> serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
-  return serv->Get(specialDirName, NS_GET_IID(nsIFile),
-                   reinterpret_cast<void**>(result));
+  return serv->Get(aSpecialDirName, NS_GET_IID(nsIFile),
+                   reinterpret_cast<void**>(aResult));
 }
 
 #endif
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -33,271 +33,259 @@ const int netCharType[256] =
 /* decode % escaped hex codes into character values
  */
 #define UNHEX(C) \
     ((C >= '0' && C <= '9') ? C - '0' : \
      ((C >= 'A' && C <= 'F') ? C - 'A' + 10 : \
      ((C >= 'a' && C <= 'f') ? C - 'a' + 10 : 0)))
 
 
-#define IS_OK(C) (netCharType[((unsigned int) (C))] & (flags))
+#define IS_OK(C) (netCharType[((unsigned int)(C))] & (aFlags))
 #define HEX_ESCAPE '%'
 
 //----------------------------------------------------------------------------------------
-static char* nsEscapeCount(
-  const char * str,
-  nsEscapeMask flags,
-  size_t* out_len)
+static char*
+nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
 //----------------------------------------------------------------------------------------
 {
-  if (!str)
+  if (!aStr) {
     return 0;
+  }
 
-  size_t i, len = 0, charsToEscape = 0;
+  size_t len = 0;
+  size_t charsToEscape = 0;
   static const char hexChars[] = "0123456789ABCDEF";
 
-  const unsigned char* src = (const unsigned char *) str;
-  while (*src)
-  {
+  const unsigned char* src = (const unsigned char*)aStr;
+  while (*src) {
     len++;
-    if (!IS_OK(*src++))
+    if (!IS_OK(*src++)) {
       charsToEscape++;
+    }
   }
 
   // calculate how much memory should be allocated
   // original length + 2 bytes for each escaped character + terminating '\0'
   // do the sum in steps to check for overflow
   size_t dstSize = len + 1 + charsToEscape;
-  if (dstSize <= len)
+  if (dstSize <= len) {
     return 0;
+  }
   dstSize += charsToEscape;
-  if (dstSize < len)
+  if (dstSize < len) {
     return 0;
+  }
 
   // fail if we need more than 4GB
   // size_t is likely to be long unsigned int but nsMemory::Alloc(size_t)
   // calls NS_Alloc_P(size_t) which calls PR_Malloc(uint32_t), so there is
   // no chance to allocate more than 4GB using nsMemory::Alloc()
-  if (dstSize > UINT32_MAX)
+  if (dstSize > UINT32_MAX) {
     return 0;
+  }
 
-  char* result = (char *)nsMemory::Alloc(dstSize);
-  if (!result)
+  char* result = (char*)nsMemory::Alloc(dstSize);
+  if (!result) {
     return 0;
+  }
 
-  unsigned char* dst = (unsigned char *) result;
-  src = (const unsigned char *) str;
-  if (flags == url_XPAlphas)
-  {
-    for (i = 0; i < len; i++)
-    {
+  unsigned char* dst = (unsigned char*)result;
+  src = (const unsigned char*)aStr;
+  if (aFlags == url_XPAlphas) {
+    for (size_t i = 0; i < len; ++i) {
       unsigned char c = *src++;
-      if (IS_OK(c))
+      if (IS_OK(c)) {
         *dst++ = c;
-      else if (c == ' ')
-        *dst++ = '+'; /* convert spaces to pluses */
-      else
-      {
+      } else if (c == ' ') {
+        *dst++ = '+';  /* convert spaces to pluses */
+      } else {
         *dst++ = HEX_ESCAPE;
         *dst++ = hexChars[c >> 4];  /* high nibble */
         *dst++ = hexChars[c & 0x0f];  /* low nibble */
       }
     }
-  }
-  else
-  {
-    for (i = 0; i < len; i++)
-    {
+  } else {
+    for (size_t i = 0; i < len; ++i) {
       unsigned char c = *src++;
-      if (IS_OK(c))
+      if (IS_OK(c)) {
         *dst++ = c;
-      else
-      {
+      } else {
         *dst++ = HEX_ESCAPE;
         *dst++ = hexChars[c >> 4];  /* high nibble */
         *dst++ = hexChars[c & 0x0f];  /* low nibble */
       }
     }
   }
 
   *dst = '\0';     /* tack on eos */
-  if(out_len)
-    *out_len = dst - (unsigned char *) result;
+  if (aOutLen) {
+    *aOutLen = dst - (unsigned char*)result;
+  }
   return result;
 }
 
 //----------------------------------------------------------------------------------------
-char* nsEscape(const char * str, nsEscapeMask flags)
+char*
+nsEscape(const char* aStr, nsEscapeMask aFlags)
 //----------------------------------------------------------------------------------------
 {
-  if(!str)
+  if (!aStr) {
     return nullptr;
-  return nsEscapeCount(str, flags, nullptr);
+  }
+  return nsEscapeCount(aStr, aFlags, nullptr);
 }
 
 //----------------------------------------------------------------------------------------
-char* nsUnescape(char * str)
+char*
+nsUnescape(char* aStr)
 //----------------------------------------------------------------------------------------
 {
-  nsUnescapeCount(str);
-  return str;
+  nsUnescapeCount(aStr);
+  return aStr;
 }
 
 //----------------------------------------------------------------------------------------
-int32_t nsUnescapeCount(char * str)
+int32_t
+nsUnescapeCount(char* aStr)
 //----------------------------------------------------------------------------------------
 {
-  char *src = str;
-  char *dst = str;
+  char* src = aStr;
+  char* dst = aStr;
   static const char hexChars[] = "0123456789ABCDEFabcdef";
 
   char c1[] = " ";
   char c2[] = " ";
   char* const pc1 = c1;
   char* const pc2 = c2;
 
   if (!*src) {
     // A null string was passed in.  Nothing to escape.
     // Returns early as the string might not actually be mutable with
     // length 0.
     return 0;
   }
 
-  while (*src)
-  {
-    c1[0] = *(src+1);
-    if (*(src+1) == '\0')
+  while (*src) {
+    c1[0] = *(src + 1);
+    if (*(src + 1) == '\0') {
       c2[0] = '\0';
-    else
-      c2[0] = *(src+2);
+    } else {
+      c2[0] = *(src + 2);
+    }
 
     if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexChars) == 0 ||
-        PL_strpbrk(pc2, hexChars) == 0 )
+        PL_strpbrk(pc2, hexChars) == 0) {
       *dst++ = *src++;
-    else
-    {
+    } else {
       src++; /* walk over escape */
-      if (*src)
-      {
+      if (*src) {
         *dst = UNHEX(*src) << 4;
         src++;
       }
-      if (*src)
-      {
+      if (*src) {
         *dst = (*dst + UNHEX(*src));
         src++;
       }
       dst++;
     }
   }
 
   *dst = 0;
-  return (int)(dst - str);
+  return (int)(dst - aStr);
 
 } /* NET_UnEscapeCnt */
 
 
-char *
-nsEscapeHTML(const char * string)
+char*
+nsEscapeHTML(const char* aString)
 {
-  char *rv = nullptr;
+  char* rv = nullptr;
   /* XXX Hardcoded max entity len. The +1 is for the trailing null. */
-  uint32_t len = strlen(string);
-  if (len >= (UINT32_MAX / 6))
+  uint32_t len = strlen(aString);
+  if (len >= (UINT32_MAX / 6)) {
     return nullptr;
+  }
 
-  rv = (char *)NS_Alloc( (6 * len) + 1 );
-  char *ptr = rv;
+  rv = (char*)NS_Alloc((6 * len) + 1);
+  char* ptr = rv;
 
-  if(rv)
-  {
-    for(; *string != '\0'; string++)
-    {
-      if(*string == '<')
-      {
+  if (rv) {
+    for (; *aString != '\0'; ++aString) {
+      if (*aString == '<') {
         *ptr++ = '&';
         *ptr++ = 'l';
         *ptr++ = 't';
         *ptr++ = ';';
-      }
-      else if(*string == '>')
-      {
+      } else if (*aString == '>') {
         *ptr++ = '&';
         *ptr++ = 'g';
         *ptr++ = 't';
         *ptr++ = ';';
-      }
-      else if(*string == '&')
-      {
+      } else if (*aString == '&') {
         *ptr++ = '&';
         *ptr++ = 'a';
         *ptr++ = 'm';
         *ptr++ = 'p';
         *ptr++ = ';';
-      }
-      else if (*string == '"')
-      {
+      } else if (*aString == '"') {
         *ptr++ = '&';
         *ptr++ = 'q';
         *ptr++ = 'u';
         *ptr++ = 'o';
         *ptr++ = 't';
         *ptr++ = ';';
-      }
-      else if (*string == '\'')
-      {
+      } else if (*aString == '\'') {
         *ptr++ = '&';
         *ptr++ = '#';
         *ptr++ = '3';
         *ptr++ = '9';
         *ptr++ = ';';
-      }
-      else
-      {
-        *ptr++ = *string;
+      } else {
+        *ptr++ = *aString;
       }
     }
     *ptr = '\0';
   }
 
-  return(rv);
+  return rv;
 }
 
-char16_t *
-nsEscapeHTML2(const char16_t *aSourceBuffer, int32_t aSourceBufferLen)
+char16_t*
+nsEscapeHTML2(const char16_t* aSourceBuffer, int32_t aSourceBufferLen)
 {
   // Calculate the length, if the caller didn't.
   if (aSourceBufferLen < 0) {
     aSourceBufferLen = NS_strlen(aSourceBuffer);
   }
 
   /* XXX Hardcoded max entity len. */
   if (uint32_t(aSourceBufferLen) >=
-      ((UINT32_MAX - sizeof(char16_t)) / (6 * sizeof(char16_t))) )
+      ((UINT32_MAX - sizeof(char16_t)) / (6 * sizeof(char16_t)))) {
     return nullptr;
+  }
 
-  char16_t *resultBuffer = (char16_t *)nsMemory::Alloc(aSourceBufferLen *
-    6 * sizeof(char16_t) + sizeof(char16_t('\0')));
-  char16_t *ptr = resultBuffer;
+  char16_t* resultBuffer = (char16_t*)nsMemory::Alloc(
+    aSourceBufferLen * 6 * sizeof(char16_t) + sizeof(char16_t('\0')));
+  char16_t* ptr = resultBuffer;
 
   if (resultBuffer) {
     int32_t i;
 
-    for(i = 0; i < aSourceBufferLen; i++) {
-      if(aSourceBuffer[i] == '<') {
+    for (i = 0; i < aSourceBufferLen; ++i) {
+      if (aSourceBuffer[i] == '<') {
         *ptr++ = '&';
         *ptr++ = 'l';
         *ptr++ = 't';
         *ptr++ = ';';
-      } else if(aSourceBuffer[i] == '>') {
+      } else if (aSourceBuffer[i] == '>') {
         *ptr++ = '&';
         *ptr++ = 'g';
         *ptr++ = 't';
         *ptr++ = ';';
-      } else if(aSourceBuffer[i] == '&') {
+      } else if (aSourceBuffer[i] == '&') {
         *ptr++ = '&';
         *ptr++ = 'a';
         *ptr++ = 'm';
         *ptr++ = 'p';
         *ptr++ = ';';
       } else if (aSourceBuffer[i] == '"') {
         *ptr++ = '&';
         *ptr++ = 'q';
@@ -332,17 +320,17 @@ const int EscapeChars[256] =
   1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008,1008,   0,1008,   0, 768,  /* 3x  0123456789:;<=>?  */
   1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,  /* 4x  @ABCDEFGHIJKLMNO  */
   1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896, 896, 896, 896,1023,  /* 5x  PQRSTUVWXYZ[\]^_  */
      0,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,  /* 6x  `abcdefghijklmno  */
   1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, 896,1012, 896,1023,   0,  /* 7x  pqrstuvwxyz{|}~   */
      0    /* 8x  DEL               */
 };
 
-#define NO_NEED_ESC(C) (EscapeChars[((unsigned int) (C))] & (flags))
+#define NO_NEED_ESC(C) (EscapeChars[((unsigned int)(C))] & (aFlags))
 
 //----------------------------------------------------------------------------------------
 
 /* returns an escaped string */
 
 /* use the following flags to specify which
    part of an URL you want to escape:
 
@@ -362,144 +350,142 @@ const int EscapeChars[256] =
    that already look escaped, which means it already includes
    a valid hexcode. This is done to avoid multiple escapes of
    a string. Use the following flags to force escaping of a
    string:
 
    esc_Forced        =  1024
 */
 
-bool NS_EscapeURL(const char *part,
-                  int32_t partLen,
-                  uint32_t flags,
-                  nsACString &result)
+bool
+NS_EscapeURL(const char* aPart, int32_t aPartLen, uint32_t aFlags,
+             nsACString& aResult)
 {
-  if (!part) {
+  if (!aPart) {
     NS_NOTREACHED("null pointer");
     return false;
   }
 
-  int i = 0;
   static const char hexChars[] = "0123456789ABCDEF";
-  if (partLen < 0)
-    partLen = strlen(part);
-  bool forced = !!(flags & esc_Forced);
-  bool ignoreNonAscii = !!(flags & esc_OnlyASCII);
-  bool ignoreAscii = !!(flags & esc_OnlyNonASCII);
-  bool writing = !!(flags & esc_AlwaysCopy);
-  bool colon = !!(flags & esc_Colon);
+  if (aPartLen < 0) {
+    aPartLen = strlen(aPart);
+  }
+  bool forced = !!(aFlags & esc_Forced);
+  bool ignoreNonAscii = !!(aFlags & esc_OnlyASCII);
+  bool ignoreAscii = !!(aFlags & esc_OnlyNonASCII);
+  bool writing = !!(aFlags & esc_AlwaysCopy);
+  bool colon = !!(aFlags & esc_Colon);
 
-  const unsigned char* src = (const unsigned char *) part;
+  const unsigned char* src = (const unsigned char*)aPart;
 
   char tempBuffer[100];
   unsigned int tempBufferPos = 0;
 
   bool previousIsNonASCII = false;
-  for (i = 0; i < partLen; i++)
-  {
+  for (int i = 0; i < aPartLen; ++i) {
     unsigned char c = *src++;
 
     // if the char has not to be escaped or whatever follows % is
     // a valid escaped string, just copy the char.
     //
     // Also the % will not be escaped until forced
     // See bugzilla bug 61269 for details why we changed this
     //
     // And, we will not escape non-ascii characters if requested.
     // On special request we will also escape the colon even when
     // not covered by the matrix.
     // ignoreAscii is not honored for control characters (C0 and DEL)
     //
     // And, we should escape the '|' character when it occurs after any
-    // non-ASCII character as it may be part of a multi-byte character.
+    // non-ASCII character as it may be aPart of a multi-byte character.
     //
     // 0x20..0x7e are the valid ASCII characters. We also escape spaces
     // (0x20) since they are not legal in URLs.
     if ((NO_NEED_ESC(c) || (c == HEX_ESCAPE && !forced)
          || (c > 0x7f && ignoreNonAscii)
          || (c > 0x20 && c < 0x7f && ignoreAscii))
         && !(c == ':' && colon)
-        && !(previousIsNonASCII && c == '|' && !ignoreNonAscii))
-    {
-      if (writing)
+        && !(previousIsNonASCII && c == '|' && !ignoreNonAscii)) {
+      if (writing) {
         tempBuffer[tempBufferPos++] = c;
-    }
-    else /* do the escape magic */
-    {
-      if (!writing)
-      {
-        result.Append(part, i);
+      }
+    } else { /* do the escape magic */
+      if (!writing) {
+        aResult.Append(aPart, i);
         writing = true;
       }
       tempBuffer[tempBufferPos++] = HEX_ESCAPE;
       tempBuffer[tempBufferPos++] = hexChars[c >> 4]; /* high nibble */
       tempBuffer[tempBufferPos++] = hexChars[c & 0x0f]; /* low nibble */
     }
 
-    if (tempBufferPos >= sizeof(tempBuffer) - 4)
-    {
+    if (tempBufferPos >= sizeof(tempBuffer) - 4) {
       NS_ASSERTION(writing, "should be writing");
       tempBuffer[tempBufferPos] = '\0';
-      result += tempBuffer;
+      aResult += tempBuffer;
       tempBufferPos = 0;
     }
 
     previousIsNonASCII = (c > 0x7f);
   }
   if (writing) {
     tempBuffer[tempBufferPos] = '\0';
-    result += tempBuffer;
+    aResult += tempBuffer;
   }
   return writing;
 }
 
 #define ISHEX(c) memchr(hexChars, c, sizeof(hexChars)-1)
 
-bool NS_UnescapeURL(const char *str, int32_t len, uint32_t flags, nsACString &result)
+bool
+NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
+               nsACString& aResult)
 {
-  if (!str) {
+  if (!aStr) {
     NS_NOTREACHED("null pointer");
     return false;
   }
 
-  if (len < 0)
-    len = strlen(str);
+  if (aLen < 0) {
+    aLen = strlen(aStr);
+  }
 
-  bool ignoreNonAscii = !!(flags & esc_OnlyASCII);
-  bool ignoreAscii = !!(flags & esc_OnlyNonASCII);
-  bool writing = !!(flags & esc_AlwaysCopy);
-  bool skipControl = !!(flags & esc_SkipControl);
+  bool ignoreNonAscii = !!(aFlags & esc_OnlyASCII);
+  bool ignoreAscii = !!(aFlags & esc_OnlyNonASCII);
+  bool writing = !!(aFlags & esc_AlwaysCopy);
+  bool skipControl = !!(aFlags & esc_SkipControl);
 
   static const char hexChars[] = "0123456789ABCDEFabcdef";
 
-  const char *last = str;
-  const char *p = str;
+  const char* last = aStr;
+  const char* p = aStr;
 
-  for (int i=0; i<len; ++i, ++p) {
-    //printf("%c [i=%d of len=%d]\n", *p, i, len);
-    if (*p == HEX_ESCAPE && i < len-2) {
-      unsigned char *p1 = ((unsigned char *) p) + 1;
-      unsigned char *p2 = ((unsigned char *) p) + 2;
+  for (int i = 0; i < aLen; ++i, ++p) {
+    //printf("%c [i=%d of aLen=%d]\n", *p, i, aLen);
+    if (*p == HEX_ESCAPE && i < aLen - 2) {
+      unsigned char* p1 = (unsigned char*)p + 1;
+      unsigned char* p2 = (unsigned char*)p + 2;
       if (ISHEX(*p1) && ISHEX(*p2) &&
           ((*p1 < '8' && !ignoreAscii) || (*p1 >= '8' && !ignoreNonAscii)) &&
           !(skipControl &&
             (*p1 < '2' || (*p1 == '7' && (*p2 == 'f' || *p2 == 'F'))))) {
         //printf("- p1=%c p2=%c\n", *p1, *p2);
         writing = true;
         if (p > last) {
           //printf("- p=%p, last=%p\n", p, last);
-          result.Append(last, p - last);
+          aResult.Append(last, p - last);
           last = p;
         }
         char u = (UNHEX(*p1) << 4) + UNHEX(*p2);
         //printf("- u=%c\n", u);
-        result.Append(u);
+        aResult.Append(u);
         i += 2;
         p += 2;
         last += 3;
       }
     }
   }
-  if (writing && last < str + len)
-    result.Append(last, str + len - last);
+  if (writing && last < aStr + aLen) {
+    aResult.Append(last, aStr + aLen - last);
+  }
 
   return writing;
 }
--- a/xpcom/io/nsEscape.h
+++ b/xpcom/io/nsEscape.h
@@ -14,51 +14,51 @@
 #include "nsString.h"
 
 /**
  * Valid mask values for nsEscape
  * Note: these values are copied in nsINetUtil.idl. Any changes should be kept
  * in sync.
  */
 typedef enum {
-  url_All       = 0       /**< %-escape every byte unconditionally */
-, url_XAlphas   = 1u << 0 /**< Normal escape - leave alphas intact, escape the rest */
-, url_XPAlphas  = 1u << 1 /**< As url_XAlphas, but convert spaces (0x20) to '+' and plus to %2B */
-, url_Path      = 1u << 2 /**< As url_XAlphas, but don't escape slash ('/') */
+  url_All       = 0,       // %-escape every byte unconditionally
+  url_XAlphas   = 1u << 0, // Normal escape - leave alphas intact, escape the rest
+  url_XPAlphas  = 1u << 1, // As url_XAlphas, but convert spaces (0x20) to '+' and plus to %2B
+  url_Path      = 1u << 2  // As url_XAlphas, but don't escape slash ('/')
 } nsEscapeMask;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
  * Escape the given string according to mask
  * @param str The string to escape
  * @param mask How to escape the string
  * @return A newly allocated escaped string that must be free'd with
  *         nsCRT::free, or null on failure
  */
-char * nsEscape(const char * str, nsEscapeMask mask);
+char* nsEscape(const char* aStr, nsEscapeMask aMask);
 
-char * nsUnescape(char * str);
+char* nsUnescape(char* aStr);
 /* decode % escaped hex codes into character values,
  * modifies the parameter, returns the same buffer
  */
 
-int32_t nsUnescapeCount (char * str);
+int32_t nsUnescapeCount(char* aStr);
 /* decode % escaped hex codes into character values,
  * modifies the parameter buffer, returns the length of the result
  * (result may contain \0's).
  */
 
-char *
-nsEscapeHTML(const char * string);
+char*
+nsEscapeHTML(const char* aString);
 
-char16_t *
-nsEscapeHTML2(const char16_t *aSourceBuffer,
+char16_t*
+nsEscapeHTML2(const char16_t* aSourceBuffer,
               int32_t aSourceBufferLen = -1);
 /*
  * Escape problem char's for HTML display
  */
 
 
 #ifdef __cplusplus
 }
@@ -105,76 +105,83 @@ enum EscapeMask {
  *
  * @param  str     url segment string
  * @param  len     url segment string length (-1 if unknown)
  * @param  flags   url segment type flag
  * @param  result  result buffer, untouched if part is already escaped
  *
  * @return TRUE if escaping was performed, FALSE otherwise.
  */
-bool NS_EscapeURL(const char *str,
-                  int32_t len,
-                  uint32_t flags,
-                  nsACString &result);
+bool NS_EscapeURL(const char* aStr,
+                  int32_t aLen,
+                  uint32_t aFlags,
+                  nsACString& aResult);
 
 /**
  * Expands URL escape sequences... beware embedded null bytes!
  *
  * @param  str     url string to unescape
  * @param  len     length of |str|
  * @param  flags   only esc_OnlyNonASCII, esc_SkipControl and esc_AlwaysCopy
  *                 are recognized
  * @param  result  result buffer, untouched if |str| is already unescaped
  *
  * @return TRUE if unescaping was performed, FALSE otherwise.
  */
-bool NS_UnescapeURL(const char *str,
-                    int32_t len,
-                    uint32_t flags,
-                    nsACString &result);
+bool NS_UnescapeURL(const char* aStr,
+                    int32_t aLen,
+                    uint32_t aFlags,
+                    nsACString& aResult);
 
 /** returns resultant string length **/
-inline int32_t NS_UnescapeURL(char *str) {
-  return nsUnescapeCount(str);
+inline int32_t
+NS_UnescapeURL(char* aStr)
+{
+  return nsUnescapeCount(aStr);
 }
 
 /**
  * String friendly versions...
  */
-inline const nsCSubstring &
-NS_EscapeURL(const nsCSubstring &str, uint32_t flags, nsCSubstring &result) {
-  if (NS_EscapeURL(str.Data(), str.Length(), flags, result))
-    return result;
-  return str;
+inline const nsCSubstring&
+NS_EscapeURL(const nsCSubstring& aStr, uint32_t aFlags, nsCSubstring& aResult)
+{
+  if (NS_EscapeURL(aStr.Data(), aStr.Length(), aFlags, aResult)) {
+    return aResult;
+  }
+  return aStr;
 }
-inline const nsCSubstring &
-NS_UnescapeURL(const nsCSubstring &str, uint32_t flags, nsCSubstring &result) {
-  if (NS_UnescapeURL(str.Data(), str.Length(), flags, result))
-    return result;
-  return str;
+inline const nsCSubstring&
+NS_UnescapeURL(const nsCSubstring& aStr, uint32_t aFlags, nsCSubstring& aResult)
+{
+  if (NS_UnescapeURL(aStr.Data(), aStr.Length(), aFlags, aResult)) {
+    return aResult;
+  }
+  return aStr;
 }
 
 /**
  * CString version of nsEscape. Returns true on success, false
  * on out of memory. To reverse this function, use NS_UnescapeURL.
  */
 inline bool
 NS_Escape(const nsCString& aOriginal, nsCString& aEscaped,
           nsEscapeMask aMask)
 {
   char* esc = nsEscape(aOriginal.get(), aMask);
-  if (! esc)
+  if (! esc) {
     return false;
+  }
   aEscaped.Adopt(esc);
   return true;
 }
 
 /**
  * Inline unescape of mutable string object.
  */
-inline nsCString &
-NS_UnescapeURL(nsCString &str)
+inline nsCString&
+NS_UnescapeURL(nsCString& aStr)
 {
-  str.SetLength(nsUnescapeCount(str.BeginWriting()));
-  return str;
+  aStr.SetLength(nsUnescapeCount(aStr.BeginWriting()));
+  return aStr;
 }
 
 #endif //  _ESCAPE_H_
--- a/xpcom/io/nsIOUtil.cpp
+++ b/xpcom/io/nsIOUtil.cpp
@@ -6,24 +6,26 @@
 #include "nsIOUtil.h"
 #include "nsIInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsStreamUtils.h"
 
 NS_IMPL_ISUPPORTS(nsIOUtil, nsIIOUtil)
 
 NS_IMETHODIMP
-nsIOUtil::InputStreamIsBuffered(nsIInputStream* aStream, bool* _retval)
+nsIOUtil::InputStreamIsBuffered(nsIInputStream* aStream, bool* aResult)
 {
-  if (NS_WARN_IF(!aStream))
+  if (NS_WARN_IF(!aStream)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = NS_InputStreamIsBuffered(aStream);
+  }
+  *aResult = NS_InputStreamIsBuffered(aStream);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsIOUtil::OutputStreamIsBuffered(nsIOutputStream* aStream, bool* _retval)
+nsIOUtil::OutputStreamIsBuffered(nsIOutputStream* aStream, bool* aResult)
 {
-  if (NS_WARN_IF(!aStream))
+  if (NS_WARN_IF(!aStream)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = NS_OutputStreamIsBuffered(aStream);
+  }
+  *aResult = NS_OutputStreamIsBuffered(aStream);
   return NS_OK;
 }
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -21,19 +21,20 @@ using namespace mozilla;
 
 #ifdef LOG
 #undef LOG
 #endif
 #ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetTeeLog()
 {
-  static PRLogModuleInfo *sLog;
-  if (!sLog)
+  static PRLogModuleInfo* sLog;
+  if (!sLog) {
     sLog = PR_NewLogModule("nsInputStreamTee");
+  }
   return sLog;
 }
 #define LOG(args) PR_LOG(GetTeeLog(), PR_LOG_DEBUG, args)
 #else
 #define LOG(args)
 #endif
 
 class nsInputStreamTee MOZ_FINAL : public nsIInputStreamTee
@@ -43,43 +44,47 @@ public:
   NS_DECL_NSIINPUTSTREAM
   NS_DECL_NSIINPUTSTREAMTEE
 
   nsInputStreamTee();
   bool SinkIsValid();
   void InvalidateSink();
 
 private:
-  ~nsInputStreamTee() {}
+  ~nsInputStreamTee()
+  {
+  }
 
-  nsresult TeeSegment(const char *buf, uint32_t count);
+  nsresult TeeSegment(const char* aBuf, uint32_t aCount);
 
-  static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
-                                   uint32_t, uint32_t, uint32_t *);
+  static NS_METHOD WriteSegmentFun(nsIInputStream*, void*, const char*,
+                                   uint32_t, uint32_t, uint32_t*);
 
 private:
   nsCOMPtr<nsIInputStream>  mSource;
   nsCOMPtr<nsIOutputStream> mSink;
   nsCOMPtr<nsIEventTarget>  mEventTarget;
   nsWriteSegmentFun         mWriter;  // for implementing ReadSegments
-  void                      *mClosure; // for implementing ReadSegments
+  void*                     mClosure; // for implementing ReadSegments
   nsAutoPtr<Mutex>          mLock; // synchronize access to mSinkIsValid
   bool                      mSinkIsValid; // False if TeeWriteEvent fails
 };
 
-class nsInputStreamTeeWriteEvent : public nsRunnable {
+class nsInputStreamTeeWriteEvent : public nsRunnable
+{
 public:
   // aTee's lock is held across construction of this object
-  nsInputStreamTeeWriteEvent(const char *aBuf, uint32_t aCount,
-                             nsIOutputStream  *aSink,
-                             nsInputStreamTee *aTee)
+  nsInputStreamTeeWriteEvent(const char* aBuf, uint32_t aCount,
+                             nsIOutputStream* aSink, nsInputStreamTee* aTee)
   {
     // copy the buffer - will be free'd by dtor
-    mBuf = (char *)malloc(aCount);
-    if (mBuf) memcpy(mBuf, (char *)aBuf, aCount);
+    mBuf = (char*)malloc(aCount);
+    if (mBuf) {
+      memcpy(mBuf, (char*)aBuf, aCount);
+    }
     mCount = aCount;
     mSink = aSink;
     bool isNonBlocking;
     mSink->IsNonBlocking(&isNonBlocking);
     NS_ASSERTION(isNonBlocking == false, "mSink is nonblocking");
     mTee = aTee;
   }
 
@@ -104,44 +109,46 @@ public:
 
     uint32_t totalBytesWritten = 0;
     while (mCount) {
       nsresult rv;
       uint32_t bytesWritten = 0;
       rv = mSink->Write(mBuf + totalBytesWritten, mCount, &bytesWritten);
       if (NS_FAILED(rv)) {
         LOG(("nsInputStreamTeeWriteEvent::Run[%p] error %x in writing",
-             this,rv));
+             this, rv));
         mTee->InvalidateSink();
         break;
       }
       totalBytesWritten += bytesWritten;
       NS_ASSERTION(bytesWritten <= mCount, "wrote too much");
       mCount -= bytesWritten;
     }
     return NS_OK;
   }
 
 protected:
   virtual ~nsInputStreamTeeWriteEvent()
   {
-    if (mBuf) free(mBuf);
+    if (mBuf) {
+      free(mBuf);
+    }
     mBuf = nullptr;
   }
 
 private:
-  char *mBuf;
+  char* mBuf;
   uint32_t mCount;
   nsCOMPtr<nsIOutputStream> mSink;
   // back pointer to the tee that created this runnable
   nsRefPtr<nsInputStreamTee> mTee;
 };
 
 nsInputStreamTee::nsInputStreamTee(): mLock(nullptr)
-                                    , mSinkIsValid(true)
+  , mSinkIsValid(true)
 {
 }
 
 bool
 nsInputStreamTee::SinkIsValid()
 {
   MutexAutoLock lock(*mLock);
   return mSinkIsValid;
@@ -150,208 +157,225 @@ nsInputStreamTee::SinkIsValid()
 void
 nsInputStreamTee::InvalidateSink()
 {
   MutexAutoLock lock(*mLock);
   mSinkIsValid = false;
 }
 
 nsresult
-nsInputStreamTee::TeeSegment(const char *buf, uint32_t count)
+nsInputStreamTee::TeeSegment(const char* aBuf, uint32_t aCount)
 {
-  if (!mSink) return NS_OK; // nothing to do
+  if (!mSink) {
+    return NS_OK;  // nothing to do
+  }
   if (mLock) { // asynchronous case
     NS_ASSERTION(mEventTarget, "mEventTarget is null, mLock is not null.");
     if (!SinkIsValid()) {
       return NS_OK; // nothing to do
     }
     nsRefPtr<nsIRunnable> event =
-      new nsInputStreamTeeWriteEvent(buf, count, mSink, this);
+      new nsInputStreamTeeWriteEvent(aBuf, aCount, mSink, this);
     LOG(("nsInputStreamTee::TeeSegment [%p] dispatching write %u bytes\n",
-         this, count));
+         this, aCount));
     return mEventTarget->Dispatch(event, NS_DISPATCH_NORMAL);
   } else { // synchronous case
     NS_ASSERTION(!mEventTarget, "mEventTarget is not null, mLock is null.");
     nsresult rv;
     uint32_t totalBytesWritten = 0;
-    while (count) {
+    while (aCount) {
       uint32_t bytesWritten = 0;
-      rv = mSink->Write(buf + totalBytesWritten, count, &bytesWritten);
+      rv = mSink->Write(aBuf + totalBytesWritten, aCount, &bytesWritten);
       if (NS_FAILED(rv)) {
         // ok, this is not a fatal error... just drop our reference to mSink
         // and continue on as if nothing happened.
         NS_WARNING("Write failed (non-fatal)");
         // catch possible misuse of the input stream tee
         NS_ASSERTION(rv != NS_BASE_STREAM_WOULD_BLOCK, "sink must be a blocking stream");
         mSink = 0;
         break;
       }
       totalBytesWritten += bytesWritten;
-      NS_ASSERTION(bytesWritten <= count, "wrote too much");
-      count -= bytesWritten;
+      NS_ASSERTION(bytesWritten <= aCount, "wrote too much");
+      aCount -= bytesWritten;
     }
     return NS_OK;
   }
 }
 
 NS_METHOD
-nsInputStreamTee::WriteSegmentFun(nsIInputStream *in, void *closure, const char *fromSegment,
-                                  uint32_t offset, uint32_t count, uint32_t *writeCount)
+nsInputStreamTee::WriteSegmentFun(nsIInputStream* aIn, void* aClosure,
+                                  const char* aFromSegment, uint32_t aOffset,
+                                  uint32_t aCount, uint32_t* aWriteCount)
 {
-  nsInputStreamTee *tee = reinterpret_cast<nsInputStreamTee *>(closure);
-
-  nsresult rv = tee->mWriter(in, tee->mClosure, fromSegment, offset, count, writeCount);
-  if (NS_FAILED(rv) || (*writeCount == 0)) {
-    NS_ASSERTION((NS_FAILED(rv) ? (*writeCount == 0) : true),
+  nsInputStreamTee* tee = reinterpret_cast<nsInputStreamTee*>(aClosure);
+  nsresult rv = tee->mWriter(aIn, tee->mClosure, aFromSegment, aOffset,
+                             aCount, aWriteCount);
+  if (NS_FAILED(rv) || (*aWriteCount == 0)) {
+    NS_ASSERTION((NS_FAILED(rv) ? (*aWriteCount == 0) : true),
                  "writer returned an error with non-zero writeCount");
     return rv;
   }
 
-  return tee->TeeSegment(fromSegment, *writeCount);
+  return tee->TeeSegment(aFromSegment, *aWriteCount);
 }
 
 NS_IMPL_ISUPPORTS(nsInputStreamTee,
                   nsIInputStreamTee,
                   nsIInputStream)
 NS_IMETHODIMP
 nsInputStreamTee::Close()
 {
-  if (NS_WARN_IF(!mSource))
+  if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
+  }
   nsresult rv = mSource->Close();
   mSource = 0;
   mSink = 0;
   return rv;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::Available(uint64_t *avail)
+nsInputStreamTee::Available(uint64_t* aAvail)
 {
-  if (NS_WARN_IF(!mSource))
+  if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
-  return mSource->Available(avail);
+  }
+  return mSource->Available(aAvail);
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::Read(char *buf, uint32_t count, uint32_t *bytesRead)
+nsInputStreamTee::Read(char* aBuf, uint32_t aCount, uint32_t* aBytesRead)
 {
-  if (NS_WARN_IF(!mSource))
+  if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
+  }
 
-  nsresult rv = mSource->Read(buf, count, bytesRead);
-  if (NS_FAILED(rv) || (*bytesRead == 0))
+  nsresult rv = mSource->Read(aBuf, aCount, aBytesRead);
+  if (NS_FAILED(rv) || (*aBytesRead == 0)) {
     return rv;
+  }
 
-  return TeeSegment(buf, *bytesRead);
+  return TeeSegment(aBuf, *aBytesRead);
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::ReadSegments(nsWriteSegmentFun writer,
-                               void *closure,
-                               uint32_t count,
-                               uint32_t *bytesRead)
+nsInputStreamTee::ReadSegments(nsWriteSegmentFun aWriter,
+                               void* aClosure,
+                               uint32_t aCount,
+                               uint32_t* aBytesRead)
 {
-  if (NS_WARN_IF(!mSource))
+  if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
+  }
 
-  mWriter = writer;
-  mClosure = closure;
+  mWriter = aWriter;
+  mClosure = aClosure;
 
-  return mSource->ReadSegments(WriteSegmentFun, this, count, bytesRead);
+  return mSource->ReadSegments(WriteSegmentFun, this, aCount, aBytesRead);
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::IsNonBlocking(bool *result)
+nsInputStreamTee::IsNonBlocking(bool* aResult)
 {
-  if (NS_WARN_IF(!mSource))
+  if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
-  return mSource->IsNonBlocking(result);
+  }
+  return mSource->IsNonBlocking(aResult);
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::SetSource(nsIInputStream *source)
+nsInputStreamTee::SetSource(nsIInputStream* aSource)
 {
-  mSource = source;
+  mSource = aSource;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::GetSource(nsIInputStream **source)
+nsInputStreamTee::GetSource(nsIInputStream** aSource)
 {
-  NS_IF_ADDREF(*source = mSource);
+  NS_IF_ADDREF(*aSource = mSource);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::SetSink(nsIOutputStream *sink)
+nsInputStreamTee::SetSink(nsIOutputStream* aSink)
 {
 #ifdef DEBUG
-  if (sink) {
+  if (aSink) {
     bool nonBlocking;
-    nsresult rv = sink->IsNonBlocking(&nonBlocking);
-    if (NS_FAILED(rv) || nonBlocking)
-      NS_ERROR("sink should be a blocking stream");
+    nsresult rv = aSink->IsNonBlocking(&nonBlocking);
+    if (NS_FAILED(rv) || nonBlocking) {
+      NS_ERROR("aSink should be a blocking stream");
+    }
   }
 #endif
-  mSink = sink;
+  mSink = aSink;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::GetSink(nsIOutputStream **sink)
+nsInputStreamTee::GetSink(nsIOutputStream** aSink)
 {
-  NS_IF_ADDREF(*sink = mSink);
+  NS_IF_ADDREF(*aSink = mSink);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::SetEventTarget(nsIEventTarget *anEventTarget)
+nsInputStreamTee::SetEventTarget(nsIEventTarget* aEventTarget)
 {
-  mEventTarget = anEventTarget;
+  mEventTarget = aEventTarget;
   if (mEventTarget) {
     // Only need synchronization if this is an async tee
     mLock = new Mutex("nsInputStreamTee.mLock");
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsInputStreamTee::GetEventTarget(nsIEventTarget **anEventTarget)
+nsInputStreamTee::GetEventTarget(nsIEventTarget** aEventTarget)
 {
-  NS_IF_ADDREF(*anEventTarget = mEventTarget);
+  NS_IF_ADDREF(*aEventTarget = mEventTarget);
   return NS_OK;
 }
 
 
 nsresult
-NS_NewInputStreamTeeAsync(nsIInputStream **result,
-                          nsIInputStream *source,
-                          nsIOutputStream *sink,
-                          nsIEventTarget *anEventTarget)
+NS_NewInputStreamTeeAsync(nsIInputStream** aResult,
+                          nsIInputStream* aSource,
+                          nsIOutputStream* aSink,
+                          nsIEventTarget* aEventTarget)
 {
   nsresult rv;
 
   nsCOMPtr<nsIInputStreamTee> tee = new nsInputStreamTee();
-  if (!tee)
+  if (!tee) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-  rv = tee->SetSource(source);
-  if (NS_FAILED(rv)) return rv;
+  rv = tee->SetSource(aSource);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  rv = tee->SetSink(sink);
-  if (NS_FAILED(rv)) return rv;
+  rv = tee->SetSink(aSink);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  rv = tee->SetEventTarget(anEventTarget);
-  if (NS_FAILED(rv)) return rv;
+  rv = tee->SetEventTarget(aEventTarget);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  NS_ADDREF(*result = tee);
+  NS_ADDREF(*aResult = tee);
   return rv;
 }
 
 nsresult
-NS_NewInputStreamTee(nsIInputStream **result,
-                     nsIInputStream *source,
-                     nsIOutputStream *sink)
+NS_NewInputStreamTee(nsIInputStream** aResult,
+                     nsIInputStream* aSource,
+                     nsIOutputStream* aSink)
 {
-  return NS_NewInputStreamTeeAsync(result, source, sink, nullptr);
+  return NS_NewInputStreamTeeAsync(aResult, aSource, aSink, nullptr);
 }
 
 #undef LOG
--- a/xpcom/io/nsLinebreakConverter.cpp
+++ b/xpcom/io/nsLinebreakConverter.cpp
@@ -9,17 +9,18 @@
 #include "nsCRT.h"
 
 
 /*----------------------------------------------------------------------------
 	GetLinebreakString
 
 	Could make this inline
 ----------------------------------------------------------------------------*/
-static const char* GetLinebreakString(nsLinebreakConverter::ELinebreakType aBreakType)
+static const char*
+GetLinebreakString(nsLinebreakConverter::ELinebreakType aBreakType)
 {
   static const char* const sLinebreaks[] = {
     "",             // any
     NS_LINEBREAK,   // platform
     LFSTR,          // content
     CRLF,           // net
     CRSTR,          // Mac
     LFSTR,          // Unix
@@ -33,433 +34,450 @@ static const char* GetLinebreakString(ns
 
 
 /*----------------------------------------------------------------------------
 	AppendLinebreak
 
 	Wee inline method to append a line break. Modifies ioDest.
 ----------------------------------------------------------------------------*/
 template<class T>
-void AppendLinebreak(T*& ioDest, const char* lineBreakStr)
+void
+AppendLinebreak(T*& aIoDest, const char* aLineBreakStr)
 {
-  *ioDest++ = *lineBreakStr;
+  *aIoDest++ = *aLineBreakStr;
 
-  if (lineBreakStr[1])
-    *ioDest++ = lineBreakStr[1];
+  if (aLineBreakStr[1]) {
+    *aIoDest++ = aLineBreakStr[1];
+  }
 }
 
 /*----------------------------------------------------------------------------
 	CountChars
 
 	Counts occurrences of breakStr in aSrc
 ----------------------------------------------------------------------------*/
 template<class T>
-int32_t CountLinebreaks(const T* aSrc, int32_t inLen, const char* breakStr)
+int32_t
+CountLinebreaks(const T* aSrc, int32_t aInLen, const char* aBreakStr)
 {
   const T* src = aSrc;
-  const T* srcEnd = aSrc + inLen;
+  const T* srcEnd = aSrc + aInLen;
   int32_t theCount = 0;
 
-  while (src < srcEnd)
-  {
-    if (*src == *breakStr)
-    {
+  while (src < srcEnd) {
+    if (*src == *aBreakStr) {
       src++;
 
-      if (breakStr[1])
-      {
-        if (src < srcEnd && *src == breakStr[1])
-        {
+      if (aBreakStr[1]) {
+        if (src < srcEnd && *src == aBreakStr[1]) {
           src++;
           theCount++;
         }
-      }
-      else
-      {
+      } else {
         theCount++;
       }
-    }
-    else
-    {
+    } else {
       src++;
     }
   }
 
   return theCount;
 }
 
 
 /*----------------------------------------------------------------------------
 	ConvertBreaks
 
 	ioLen *includes* a terminating null, if any
 ----------------------------------------------------------------------------*/
 template<class T>
-static T* ConvertBreaks(const T* inSrc, int32_t& ioLen, const char* srcBreak, const char* destBreak)
+static T*
+ConvertBreaks(const T* aInSrc, int32_t& aIoLen, const char* aSrcBreak,
+              const char* aDestBreak)
 {
-  NS_ASSERTION(inSrc && srcBreak && destBreak, "Got a null string");
+  NS_ASSERTION(aInSrc && aSrcBreak && aDestBreak, "Got a null string");
 
   T* resultString = nullptr;
 
   // handle the no conversion case
-  if (nsCRT::strcmp(srcBreak, destBreak) == 0)
-  {
-    resultString = (T *)nsMemory::Alloc(sizeof(T) * ioLen);
-    if (!resultString) return nullptr;
-    memcpy(resultString, inSrc, sizeof(T) * ioLen); // includes the null, if any
+  if (nsCRT::strcmp(aSrcBreak, aDestBreak) == 0) {
+    resultString = (T*)nsMemory::Alloc(sizeof(T) * aIoLen);
+    if (!resultString) {
+      return nullptr;
+    }
+    memcpy(resultString, aInSrc, sizeof(T) * aIoLen); // includes the null, if any
     return resultString;
   }
 
-  int32_t srcBreakLen = strlen(srcBreak);
-  int32_t destBreakLen = strlen(destBreak);
+  int32_t srcBreakLen = strlen(aSrcBreak);
+  int32_t destBreakLen = strlen(aDestBreak);
 
   // handle the easy case, where the string length does not change, and the
   // breaks are only 1 char long, i.e. CR <-> LF
-  if (srcBreakLen == destBreakLen && srcBreakLen == 1)
-  {
-    resultString = (T *)nsMemory::Alloc(sizeof(T) * ioLen);
-    if (!resultString) return nullptr;
+  if (srcBreakLen == destBreakLen && srcBreakLen == 1) {
+    resultString = (T*)nsMemory::Alloc(sizeof(T) * aIoLen);
+    if (!resultString) {
+      return nullptr;
+    }
 
-    const T* src = inSrc;
-    const T* srcEnd = inSrc + ioLen;		// includes null, if any
-    T*       dst = resultString;
+    const T* src = aInSrc;
+    const T* srcEnd = aInSrc + aIoLen;  // includes null, if any
+    T* dst = resultString;
 
-    char srcBreakChar = *srcBreak;        // we know it's one char long already
-    char dstBreakChar = *destBreak;
+    char srcBreakChar = *aSrcBreak;  // we know it's one char long already
+    char dstBreakChar = *aDestBreak;
 
-    while (src < srcEnd)
-    {
-      if (*src == srcBreakChar)
-      {
+    while (src < srcEnd) {
+      if (*src == srcBreakChar) {
         *dst++ = dstBreakChar;
         src++;
-      }
-      else
-      {
+      } else {
         *dst++ = *src++;
       }
     }
 
-    // ioLen does not change
-  }
-  else
-  {
+    // aIoLen does not change
+  } else {
     // src and dest termination is different length. Do it a slower way.
 
     // count linebreaks in src. Assumes that chars in 2-char linebreaks are unique.
-    int32_t numLinebreaks = CountLinebreaks(inSrc, ioLen, srcBreak);
+    int32_t numLinebreaks = CountLinebreaks(aInSrc, aIoLen, aSrcBreak);
 
-    int32_t newBufLen = ioLen - (numLinebreaks * srcBreakLen) + (numLinebreaks * destBreakLen);
-    resultString = (T *)nsMemory::Alloc(sizeof(T) * newBufLen);
-    if (!resultString) return nullptr;
+    int32_t newBufLen =
+      aIoLen - (numLinebreaks * srcBreakLen) + (numLinebreaks * destBreakLen);
+    resultString = (T*)nsMemory::Alloc(sizeof(T) * newBufLen);
+    if (!resultString) {
+      return nullptr;
+    }
 
-    const T* src = inSrc;
-    const T* srcEnd = inSrc + ioLen;		// includes null, if any
-    T*       dst = resultString;
+    const T* src = aInSrc;
+    const T* srcEnd = aInSrc + aIoLen;  // includes null, if any
+    T* dst = resultString;
 
-    while (src < srcEnd)
-    {
-      if (*src == *srcBreak)
-      {
-        *dst++ = *destBreak;
-        if (destBreak[1])
-          *dst++ = destBreak[1];
+    while (src < srcEnd) {
+      if (*src == *aSrcBreak) {
+        *dst++ = *aDestBreak;
+        if (aDestBreak[1]) {
+          *dst++ = aDestBreak[1];
+        }
 
         src++;
-        if (src < srcEnd && srcBreak[1] && *src == srcBreak[1])
+        if (src < srcEnd && aSrcBreak[1] && *src == aSrcBreak[1]) {
           src++;
-      }
-      else
-      {
+        }
+      } else {
         *dst++ = *src++;
       }
     }
 
-    ioLen = newBufLen;
+    aIoLen = newBufLen;
   }
 
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
   ConvertBreaksInSitu
 
   Convert breaks in situ. Can only do this if the linebreak length
   does not change.
 ----------------------------------------------------------------------------*/
 template<class T>
-static void ConvertBreaksInSitu(T* inSrc, int32_t inLen, char srcBreak, char destBreak)
+static void
+ConvertBreaksInSitu(T* aInSrc, int32_t aInLen, char aSrcBreak, char aDestBreak)
 {
-  T* src = inSrc;
-  T* srcEnd = inSrc + inLen;
+  T* src = aInSrc;
+  T* srcEnd = aInSrc + aInLen;
 
-  while (src < srcEnd)
-  {
-    if (*src == srcBreak)
-      *src = destBreak;
+  while (src < srcEnd) {
+    if (*src == aSrcBreak) {
+      *src = aDestBreak;
+    }
 
     src++;
   }
 }
 
 
 /*----------------------------------------------------------------------------
   ConvertUnknownBreaks
 
   Convert unknown line breaks to the specified break.
 
   This will convert CRLF pairs to one break, and single CR or LF to a break.
 ----------------------------------------------------------------------------*/
 template<class T>
-static T* ConvertUnknownBreaks(const T* inSrc, int32_t& ioLen, const char* destBreak)
+static T*
+ConvertUnknownBreaks(const T* aInSrc, int32_t& aIoLen, const char* aDestBreak)
 {
-  const T* src = inSrc;
-  const T* srcEnd = inSrc + ioLen;		// includes null, if any
+  const T* src = aInSrc;
+  const T* srcEnd = aInSrc + aIoLen;  // includes null, if any
 
-  int32_t destBreakLen = strlen(destBreak);
+  int32_t destBreakLen = strlen(aDestBreak);
   int32_t finalLen = 0;
 
-  while (src < srcEnd)
-  {
-    if (*src == nsCRT::CR)
-    {
-      if (src < srcEnd && src[1] == nsCRT::LF)
-      {
+  while (src < srcEnd) {
+    if (*src == nsCRT::CR) {
+      if (src < srcEnd && src[1] == nsCRT::LF) {
         // CRLF
         finalLen += destBreakLen;
         src++;
-      }
-      else
-      {
+      } else {
         // Lone CR
         finalLen += destBreakLen;
       }
-    }
-    else if (*src == nsCRT::LF)
-    {
+    } else if (*src == nsCRT::LF) {
       // Lone LF
       finalLen += destBreakLen;
-    }
-    else
-    {
+    } else {
       finalLen++;
     }
     src++;
   }
 
-  T* resultString = (T *)nsMemory::Alloc(sizeof(T) * finalLen);
-  if (!resultString) return nullptr;
+  T* resultString = (T*)nsMemory::Alloc(sizeof(T) * finalLen);
+  if (!resultString) {
+    return nullptr;
+  }
 
-  src = inSrc;
-  srcEnd = inSrc + ioLen;		// includes null, if any
+  src = aInSrc;
+  srcEnd = aInSrc + aIoLen;  // includes null, if any
 
   T* dst = resultString;
 
-  while (src < srcEnd)
-  {
-    if (*src == nsCRT::CR)
-    {
-      if (src < srcEnd && src[1] == nsCRT::LF)
-      {
+  while (src < srcEnd) {
+    if (*src == nsCRT::CR) {
+      if (src < srcEnd && src[1] == nsCRT::LF) {
         // CRLF
-        AppendLinebreak(dst, destBreak);
+        AppendLinebreak(dst, aDestBreak);
         src++;
+      } else {
+        // Lone CR
+        AppendLinebreak(dst, aDestBreak);
       }
-      else
-      {
-        // Lone CR
-        AppendLinebreak(dst, destBreak);
-      }
-    }
-    else if (*src == nsCRT::LF)
-    {
+    } else if (*src == nsCRT::LF) {
       // Lone LF
-      AppendLinebreak(dst, destBreak);
-    }
-    else
-    {
+      AppendLinebreak(dst, aDestBreak);
+    } else {
       *dst++ = *src;
     }
     src++;
   }
 
-  ioLen = finalLen;
+  aIoLen = finalLen;
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
 	ConvertLineBreaks
 
 ----------------------------------------------------------------------------*/
-char* nsLinebreakConverter::ConvertLineBreaks(const char* aSrc,
-    ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen)
+char*
+nsLinebreakConverter::ConvertLineBreaks(const char* aSrc,
+                                        ELinebreakType aSrcBreaks,
+                                        ELinebreakType aDestBreaks,
+                                        int32_t aSrcLen, int32_t* aOutLen)
 {
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
-  if (!aSrc) return nullptr;
+  if (!aSrc) {
+    return nullptr;
+  }
 
   int32_t sourceLen = (aSrcLen == kIgnoreLen) ? strlen(aSrc) + 1 : aSrcLen;
 
   char* resultString;
-  if (aSrcBreaks == eLinebreakAny)
+  if (aSrcBreaks == eLinebreakAny) {
     resultString = ConvertUnknownBreaks(aSrc, sourceLen, GetLinebreakString(aDestBreaks));
-  else
-    resultString = ConvertBreaks(aSrc, sourceLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
+  } else
+    resultString = ConvertBreaks(aSrc, sourceLen,
+                                 GetLinebreakString(aSrcBreaks),
+                                 GetLinebreakString(aDestBreaks));
 
-  if (outLen)
-    *outLen = sourceLen;
+  if (aOutLen) {
+    *aOutLen = sourceLen;
+  }
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
 	ConvertLineBreaksInSitu
 
 ----------------------------------------------------------------------------*/
-nsresult nsLinebreakConverter::ConvertLineBreaksInSitu(char **ioBuffer, ELinebreakType aSrcBreaks,
-    ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen)
+nsresult
+nsLinebreakConverter::ConvertLineBreaksInSitu(char** aIoBuffer,
+                                              ELinebreakType aSrcBreaks,
+                                              ELinebreakType aDestBreaks,
+                                              int32_t aSrcLen, int32_t* aOutLen)
 {
-  NS_ASSERTION(ioBuffer && *ioBuffer, "Null pointer passed");
-  if (!ioBuffer || !*ioBuffer) return NS_ERROR_NULL_POINTER;
+  NS_ASSERTION(aIoBuffer && *aIoBuffer, "Null pointer passed");
+  if (!aIoBuffer || !*aIoBuffer) {
+    return NS_ERROR_NULL_POINTER;
+  }
 
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
 
-  int32_t sourceLen = (aSrcLen == kIgnoreLen) ? strlen(*ioBuffer) + 1 : aSrcLen;
+  int32_t sourceLen = (aSrcLen == kIgnoreLen) ? strlen(*aIoBuffer) + 1 : aSrcLen;
 
   // can we convert in-place?
   const char* srcBreaks = GetLinebreakString(aSrcBreaks);
   const char* dstBreaks = GetLinebreakString(aDestBreaks);
 
-  if ( (aSrcBreaks != eLinebreakAny) &&
-       (strlen(srcBreaks) == 1) &&
-       (strlen(dstBreaks) == 1) )
-  {
-    ConvertBreaksInSitu(*ioBuffer, sourceLen, *srcBreaks, *dstBreaks);
-    if (outLen)
-      *outLen = sourceLen;
-  }
-  else
-  {
+  if (aSrcBreaks != eLinebreakAny &&
+      strlen(srcBreaks) == 1 &&
+      strlen(dstBreaks) == 1) {
+    ConvertBreaksInSitu(*aIoBuffer, sourceLen, *srcBreaks, *dstBreaks);
+    if (aOutLen) {
+      *aOutLen = sourceLen;
+    }
+  } else {
     char* destBuffer;
 
-    if (aSrcBreaks == eLinebreakAny)
-      destBuffer = ConvertUnknownBreaks(*ioBuffer, sourceLen, dstBreaks);
-    else
-      destBuffer = ConvertBreaks(*ioBuffer, sourceLen, srcBreaks, dstBreaks);
+    if (aSrcBreaks == eLinebreakAny) {
+      destBuffer = ConvertUnknownBreaks(*aIoBuffer, sourceLen, dstBreaks);
+    } else {
+      destBuffer = ConvertBreaks(*aIoBuffer, sourceLen, srcBreaks, dstBreaks);
+    }
 
-    if (!destBuffer) return NS_ERROR_OUT_OF_MEMORY;
-    *ioBuffer = destBuffer;
-    if (outLen)
-      *outLen = sourceLen;
+    if (!destBuffer) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    *aIoBuffer = destBuffer;
+    if (aOutLen) {
+      *aOutLen = sourceLen;
+    }
   }
 
   return NS_OK;
 }
 
 
 /*----------------------------------------------------------------------------
 	ConvertUnicharLineBreaks
 
 ----------------------------------------------------------------------------*/
-char16_t* nsLinebreakConverter::ConvertUnicharLineBreaks(const char16_t* aSrc,
-    ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen)
+char16_t*
+nsLinebreakConverter::ConvertUnicharLineBreaks(const char16_t* aSrc,
+                                               ELinebreakType aSrcBreaks,
+                                               ELinebreakType aDestBreaks,
+                                               int32_t aSrcLen,
+                                               int32_t* aOutLen)
 {
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
-  if (!aSrc) return nullptr;
+  if (!aSrc) {
+    return nullptr;
+  }
 
   int32_t bufLen = (aSrcLen == kIgnoreLen) ? NS_strlen(aSrc) + 1 : aSrcLen;
 
   char16_t* resultString;
-  if (aSrcBreaks == eLinebreakAny)
+  if (aSrcBreaks == eLinebreakAny) {
     resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks));
-  else
-    resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks), GetLinebreakString(aDestBreaks));
+  } else
+    resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks),
+                                 GetLinebreakString(aDestBreaks));
 
-  if (outLen)
-    *outLen = bufLen;
+  if (aOutLen) {
+    *aOutLen = bufLen;
+  }
   return resultString;
 }
 
 
 /*----------------------------------------------------------------------------
 	ConvertStringLineBreaks
 
 ----------------------------------------------------------------------------*/
-nsresult nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(char16_t **ioBuffer,
-    ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks, int32_t aSrcLen, int32_t* outLen)
+nsresult
+nsLinebreakConverter::ConvertUnicharLineBreaksInSitu(
+    char16_t** aIoBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks,
+    int32_t aSrcLen, int32_t* aOutLen)
 {
-  NS_ASSERTION(ioBuffer && *ioBuffer, "Null pointer passed");
-  if (!ioBuffer || !*ioBuffer) return NS_ERROR_NULL_POINTER;
+  NS_ASSERTION(aIoBuffer && *aIoBuffer, "Null pointer passed");
+  if (!aIoBuffer || !*aIoBuffer) {
+    return NS_ERROR_NULL_POINTER;
+  }
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
 
-  int32_t sourceLen = (aSrcLen == kIgnoreLen) ? NS_strlen(*ioBuffer) + 1 : aSrcLen;
+  int32_t sourceLen =
+    (aSrcLen == kIgnoreLen) ? NS_strlen(*aIoBuffer) + 1 : aSrcLen;
 
   // can we convert in-place?
   const char* srcBreaks = GetLinebreakString(aSrcBreaks);
   const char* dstBreaks = GetLinebreakString(aDestBreaks);
 
-  if ( (aSrcBreaks != eLinebreakAny) &&
-       (strlen(srcBreaks) == 1) &&
-       (strlen(dstBreaks) == 1) )
-  {
-    ConvertBreaksInSitu(*ioBuffer, sourceLen, *srcBreaks, *dstBreaks);
-    if (outLen)
-      *outLen = sourceLen;
-  }
-  else
-  {
+  if ((aSrcBreaks != eLinebreakAny) &&
+      (strlen(srcBreaks) == 1) &&
+      (strlen(dstBreaks) == 1)) {
+    ConvertBreaksInSitu(*aIoBuffer, sourceLen, *srcBreaks, *dstBreaks);
+    if (aOutLen) {
+      *aOutLen = sourceLen;
+    }
+  } else {
     char16_t* destBuffer;
 
-    if (aSrcBreaks == eLinebreakAny)
-      destBuffer = ConvertUnknownBreaks(*ioBuffer, sourceLen, dstBreaks);
-    else
-      destBuffer = ConvertBreaks(*ioBuffer, sourceLen, srcBreaks, dstBreaks);
+    if (aSrcBreaks == eLinebreakAny) {
+      destBuffer = ConvertUnknownBreaks(*aIoBuffer, sourceLen, dstBreaks);
+    } else {
+      destBuffer = ConvertBreaks(*aIoBuffer, sourceLen, srcBreaks, dstBreaks);
+    }
 
-    if (!destBuffer) return NS_ERROR_OUT_OF_MEMORY;
-    *ioBuffer = destBuffer;
-    if (outLen)
-      *outLen = sourceLen;
+    if (!destBuffer) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    *aIoBuffer = destBuffer;
+    if (aOutLen) {
+      *aOutLen = sourceLen;
+    }
   }
 
   return NS_OK;
 }
 
 /*----------------------------------------------------------------------------
 	ConvertStringLineBreaks
 
 ----------------------------------------------------------------------------*/
-nsresult nsLinebreakConverter::ConvertStringLineBreaks(nsString& ioString,
-    ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks)
+nsresult
+nsLinebreakConverter::ConvertStringLineBreaks(nsString& aIoString,
+                                              ELinebreakType aSrcBreaks,
+                                              ELinebreakType aDestBreaks)
 {
 
   NS_ASSERTION(aDestBreaks != eLinebreakAny &&
                aSrcBreaks != eLinebreakSpace, "Invalid parameter");
 
   // nothing to do
-  if (ioString.IsEmpty()) return NS_OK;
+  if (aIoString.IsEmpty()) {
+    return NS_OK;
+  }
 
   nsresult rv;
 
   // remember the old buffer in case
   // we blow it away later
   nsString::char_iterator stringBuf;
-  ioString.BeginWriting(stringBuf);
+  aIoString.BeginWriting(stringBuf);
 
   int32_t    newLen;
 
   rv = ConvertUnicharLineBreaksInSitu(&stringBuf,
                                       aSrcBreaks, aDestBreaks,
-                                      ioString.Length() + 1, &newLen);
-  if (NS_FAILED(rv)) return rv;
+                                      aIoString.Length() + 1, &newLen);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
-  if (stringBuf != ioString.get())
-    ioString.Adopt(stringBuf);
+  if (stringBuf != aIoString.get()) {
+    aIoString.Adopt(stringBuf);
+  }
 
   return NS_OK;
 }
 
 
 
--- a/xpcom/io/nsLinebreakConverter.h
+++ b/xpcom/io/nsLinebreakConverter.h
@@ -73,17 +73,19 @@ public:
    * Convert line breaks in the supplied string, changing the string buffer (i.e. in-place conversion)
    * @param ioString: the string to be converted.
    * @param aSrcBreaks: the line breaks in the source. If unknown, pass eLinebreakAny.
    *              If known, pass the known value, as this may be more efficient.
    * @param aDestBreaks: the line breaks you want in the output.
    * @param aSrcLen: length of the source, in characters. If -1, the source is assumed to be a null-
    *              terminated string.
    */
-  static nsresult ConvertStringLineBreaks(nsString& ioString, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks);
+  static nsresult ConvertStringLineBreaks(nsString& aIoString,
+                                          ELinebreakType aSrcBreaks,
+                                          ELinebreakType aDestBreaks);
 
 
   /* ConvertLineBreaksInSitu
    * Convert line breaks in place if possible. NOTE: THIS MAY REALLOCATE THE BUFFER,
    * BUT IT WON'T FREE THE OLD BUFFER (because it doesn't know how). So be prepared
    * to keep a copy of the old pointer, and free it if this passes back a new pointer.
    * ALSO NOTE: DON'T PASS A STATIC STRING POINTER TO THIS FUNCTION.
    *
@@ -91,32 +93,38 @@ public:
    *              to be null terminated, otherwise it must be at least aSrcLen long.
    * @param aSrcBreaks: the line breaks in the source. If unknown, pass eLinebreakAny.
    *              If known, pass the known value, as this may be more efficient.
    * @param aDestBreaks: the line breaks you want in the output.
    * @param aSrcLen: length of the source. If -1, the source is assumed to be a null-
    *              terminated string.
    * @param aOutLen: used to return character length of returned buffer, if not null.
    */
-  static nsresult ConvertLineBreaksInSitu(char **ioBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks,
-                                          int32_t aSrcLen = kIgnoreLen, int32_t* aOutLen = nullptr);
+  static nsresult ConvertLineBreaksInSitu(char** aIoBuffer,
+                                          ELinebreakType aSrcBreaks,
+                                          ELinebreakType aDestBreaks,
+                                          int32_t aSrcLen = kIgnoreLen,
+                                          int32_t* aOutLen = nullptr);
 
 
   /* ConvertUnicharLineBreaksInSitu
    * Convert line breaks in place if possible. NOTE: THIS MAY REALLOCATE THE BUFFER,
    * BUT IT WON'T FREE THE OLD BUFFER (because it doesn't know how). So be prepared
    * to keep a copy of the old pointer, and free it if this passes back a new pointer.
    *
    * @param ioBuffer: the source buffer. if aSrcLen == kIgnoreLen this string is assumed
    *              to be null terminated, otherwise it must be at least aSrcLen long.
    * @param aSrcBreaks: the line breaks in the source. If unknown, pass eLinebreakAny.
    *              If known, pass the known value, as this may be more efficient.
    * @param aDestBreaks: the line breaks you want in the output.
    * @param aSrcLen: length of the source in characters. If -1, the source is assumed to be a null-
    *              terminated string.
    * @param aOutLen: used to return character length of returned buffer, if not null.
    */
-  static nsresult ConvertUnicharLineBreaksInSitu(char16_t **ioBuffer, ELinebreakType aSrcBreaks, ELinebreakType aDestBreaks,
-                                                 int32_t aSrcLen = kIgnoreLen, int32_t* aOutLen = nullptr);
+  static nsresult ConvertUnicharLineBreaksInSitu(char16_t** aIoBuffer,
+                                                 ELinebreakType aSrcBreaks,
+                                                 ELinebreakType aDestBreaks,
+                                                 int32_t aSrcLen = kIgnoreLen,
+                                                 int32_t* aOutLen = nullptr);
 
 };
 
 #endif // nsLinebreakConverter_h_
--- a/xpcom/io/nsLocalFile.h
+++ b/xpcom/io/nsLocalFile.h
@@ -44,19 +44,19 @@
 #include "nsLocalFileUnix.h"
 #else
 #error NOT_IMPLEMENTED
 #endif
 
 #define NSRESULT_FOR_RETURN(ret) (((ret) < 0) ? NSRESULT_FOR_ERRNO() : NS_OK)
 
 inline nsresult
-nsresultForErrno(int err)
+nsresultForErrno(int aErr)
 {
-  switch (err) {
+  switch (aErr) {
     case 0:
       return NS_OK;
 #ifdef EDQUOT
     case EDQUOT: /* Quota exceeded */
       // FALLTHROUGH to return NS_ERROR_FILE_DISK_FULL
 #endif
     case ENOSPC:
       return NS_ERROR_FILE_DISK_FULL;
--- a/xpcom/io/nsLocalFileCommon.cpp
+++ b/xpcom/io/nsLocalFileCommon.cpp
@@ -16,279 +16,306 @@
 #include "nsNativeCharsetUtils.h"
 #include "nsUTF8Utils.h"
 
 #ifdef XP_WIN
 #include <string.h>
 #endif
 
 
-void NS_StartupLocalFile()
+void
+NS_StartupLocalFile()
 {
   nsLocalFile::GlobalInit();
 }
 
-void NS_ShutdownLocalFile()
+void
+NS_ShutdownLocalFile()
 {
   nsLocalFile::GlobalShutdown();
 }
 
 #if !defined(MOZ_WIDGET_COCOA) && !defined(XP_WIN)
 NS_IMETHODIMP
-nsLocalFile::InitWithFile(nsIFile *aFile)
+nsLocalFile::InitWithFile(nsIFile* aFile)
 {
-  if (NS_WARN_IF(!aFile))
+  if (NS_WARN_IF(!aFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsAutoCString path;
   aFile->GetNativePath(path);
-  if (path.IsEmpty())
+  if (path.IsEmpty()) {
     return NS_ERROR_INVALID_ARG;
+  }
   return InitWithNativePath(path);
 }
 #endif
 
 #define kMaxFilenameLength 255
 #define kMaxExtensionLength 100
 #define kMaxSequenceNumberLength 5 // "-9999"
 // requirement: kMaxExtensionLength < kMaxFilenameLength - kMaxSequenceNumberLength
 
 NS_IMETHODIMP
-nsLocalFile::CreateUnique(uint32_t type, uint32_t attributes)
+nsLocalFile::CreateUnique(uint32_t aType, uint32_t aAttributes)
 {
   nsresult rv;
   bool longName;
 
 #ifdef XP_WIN
   nsAutoString pathName, leafName, rootName, suffix;
   rv = GetPath(pathName);
 #else
   nsAutoCString pathName, leafName, rootName, suffix;
   rv = GetNativePath(pathName);
 #endif
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   longName = (pathName.Length() + kMaxSequenceNumberLength >
               kMaxFilenameLength);
-  if (!longName)
-  {
-    rv = Create(type, attributes);
-    if (rv != NS_ERROR_FILE_ALREADY_EXISTS)
+  if (!longName) {
+    rv = Create(aType, aAttributes);
+    if (rv != NS_ERROR_FILE_ALREADY_EXISTS) {
       return rv;
+    }
   }
 
 #ifdef XP_WIN
   rv = GetLeafName(leafName);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   const int32_t lastDot = leafName.RFindChar(char16_t('.'));
 #else
   rv = GetNativeLeafName(leafName);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   const int32_t lastDot = leafName.RFindChar('.');
 #endif
 
-  if (lastDot == kNotFound)
-  {
+  if (lastDot == kNotFound) {
     rootName = leafName;
-  }
-  else
-  {
+  } else {
     suffix = Substring(leafName, lastDot);      // include '.'
     rootName = Substring(leafName, 0, lastDot); // strip suffix and dot
   }
 
-  if (longName)
-  {
+  if (longName) {
     int32_t maxRootLength = (kMaxFilenameLength -
                              (pathName.Length() - leafName.Length()) -
                              suffix.Length() - kMaxSequenceNumberLength);
 
     // We cannot create an item inside a directory whose name is too long.
     // Also, ensure that at least one character remains after we truncate
     // the root name, as we don't want to end up with an empty leaf name.
-    if (maxRootLength < 2)
+    if (maxRootLength < 2) {
       return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+    }
 
 #ifdef XP_WIN
     // ensure that we don't cut the name in mid-UTF16-character
     rootName.SetLength(NS_IS_LOW_SURROGATE(rootName[maxRootLength]) ?
                        maxRootLength - 1 : maxRootLength);
     SetLeafName(rootName + suffix);
 #else
-    if (NS_IsNativeUTF8())
-    {
+    if (NS_IsNativeUTF8()) {
       // ensure that we don't cut the name in mid-UTF8-character
       // (assume the name is valid UTF8 to begin with)
-      while (UTF8traits::isInSeq(rootName[maxRootLength]))
+      while (UTF8traits::isInSeq(rootName[maxRootLength])) {
         --maxRootLength;
+      }
 
       // Another check to avoid ending up with an empty leaf name.
-      if (maxRootLength == 0 && suffix.IsEmpty())
+      if (maxRootLength == 0 && suffix.IsEmpty()) {
         return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+      }
     }
 
     rootName.SetLength(maxRootLength);
     SetNativeLeafName(rootName + suffix);
 #endif
-    nsresult rv = Create(type, attributes);
-    if (rv != NS_ERROR_FILE_ALREADY_EXISTS)
+    nsresult rv = Create(aType, aAttributes);
+    if (rv != NS_ERROR_FILE_ALREADY_EXISTS) {
       return rv;
+    }
   }
 
-  for (int indx = 1; indx < 10000; indx++)
-  {
+  for (int indx = 1; indx < 10000; ++indx) {
     // start with "Picture-1.jpg" after "Picture.jpg" exists
 #ifdef XP_WIN
     SetLeafName(rootName +
                 NS_ConvertASCIItoUTF16(nsPrintfCString("-%d", indx)) +
                 suffix);
 #else
     SetNativeLeafName(rootName + nsPrintfCString("-%d", indx) + suffix);
 #endif
-    rv = Create(type, attributes);
-    if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS)
+    rv = Create(aType, aAttributes);
+    if (NS_SUCCEEDED(rv) || rv != NS_ERROR_FILE_ALREADY_EXISTS) {
       return rv;
+    }
   }
 
   // The disk is full, sort of
   return NS_ERROR_FILE_TOO_BIG;
 }
 
 #if defined(XP_WIN)
 static const char16_t kPathSeparatorChar       = '\\';
 #elif defined(XP_UNIX)
 static const char16_t kPathSeparatorChar       = '/';
 #else
 #error Need to define file path separator for your platform
 #endif
 
-static int32_t SplitPath(char16_t *path, char16_t **nodeArray, int32_t arrayLen)
+static int32_t
+SplitPath(char16_t* aPath, char16_t** aNodeArray, int32_t aArrayLen)
 {
-  if (*path == 0)
+  if (*aPath == 0) {
     return 0;
+  }
 
-  char16_t **nodePtr = nodeArray;
-  if (*path == kPathSeparatorChar)
-    path++;
-  *nodePtr++ = path;
+  char16_t** nodePtr = aNodeArray;
+  if (*aPath == kPathSeparatorChar) {
+    aPath++;
+  }
+  *nodePtr++ = aPath;
 
-  for (char16_t *cp = path; *cp != 0; cp++) {
+  for (char16_t* cp = aPath; *cp != 0; ++cp) {
     if (*cp == kPathSeparatorChar) {
       *cp++ = 0;
-      if (*cp == 0)
+      if (*cp == 0) {
         break;
-      if (nodePtr - nodeArray >= arrayLen)
+      }
+      if (nodePtr - aNodeArray >= aArrayLen) {
         return -1;
+      }
       *nodePtr++ = cp;
     }
   }
-  return nodePtr - nodeArray;
+  return nodePtr - aNodeArray;
 }
 
 
 NS_IMETHODIMP
-nsLocalFile::GetRelativeDescriptor(nsIFile *fromFile, nsACString& _retval)
+nsLocalFile::GetRelativeDescriptor(nsIFile* aFromFile, nsACString& aResult)
 {
-  if (NS_WARN_IF(!fromFile))
+  if (NS_WARN_IF(!aFromFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
   const int32_t kMaxNodesInPath = 32;
 
   //
-  // _retval will be UTF-8 encoded
+  // aResult will be UTF-8 encoded
   //
 
   nsresult rv;
-  _retval.Truncate(0);
+  aResult.Truncate(0);
 
   nsAutoString thisPath, fromPath;
-  char16_t *thisNodes[kMaxNodesInPath], *fromNodes[kMaxNodesInPath];
-  int32_t  thisNodeCnt, fromNodeCnt, nodeIndex;
+  char16_t* thisNodes[kMaxNodesInPath];
+  char16_t* fromNodes[kMaxNodesInPath];
+  int32_t thisNodeCnt, fromNodeCnt, nodeIndex;
 
   rv = GetPath(thisPath);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-  rv = fromFile->GetPath(fromPath);
-  if (NS_FAILED(rv))
+  }
+  rv = aFromFile->GetPath(fromPath);
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   // get raw pointer to mutable string buffer
-  char16_t *thisPathPtr; thisPath.BeginWriting(thisPathPtr);
-  char16_t *fromPathPtr; fromPath.BeginWriting(fromPathPtr);
+  char16_t* thisPathPtr;
+  thisPath.BeginWriting(thisPathPtr);
+  char16_t* fromPathPtr;
+  fromPath.BeginWriting(fromPathPtr);
 
   thisNodeCnt = SplitPath(thisPathPtr, thisNodes, kMaxNodesInPath);
   fromNodeCnt = SplitPath(fromPathPtr, fromNodes, kMaxNodesInPath);
-  if (thisNodeCnt < 0 || fromNodeCnt < 0)
+  if (thisNodeCnt < 0 || fromNodeCnt < 0) {
     return NS_ERROR_FAILURE;
+  }
 
   for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) {
 #ifdef XP_WIN
-    if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex])))
+    if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex]))) {
       break;
+    }
 #else
-    if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex]))
+    if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex])) {
       break;
+    }
 #endif
   }
 
   int32_t branchIndex = nodeIndex;
-  for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; nodeIndex++)
-    _retval.AppendLiteral("../");
+  for (nodeIndex = branchIndex; nodeIndex < fromNodeCnt; ++nodeIndex) {
+    aResult.AppendLiteral("../");
+  }
   for (nodeIndex = branchIndex; nodeIndex < thisNodeCnt; nodeIndex++) {
     NS_ConvertUTF16toUTF8 nodeStr(thisNodes[nodeIndex]);
-    _retval.Append(nodeStr);
-    if (nodeIndex + 1 < thisNodeCnt)
-      _retval.Append('/');
+    aResult.Append(nodeStr);
+    if (nodeIndex + 1 < thisNodeCnt) {
+      aResult.Append('/');
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::SetRelativeDescriptor(nsIFile *fromFile, const nsACString& relativeDesc)
+nsLocalFile::SetRelativeDescriptor(nsIFile* aFromFile,
+                                   const nsACString& aRelativeDesc)
 {
   NS_NAMED_LITERAL_CSTRING(kParentDirStr, "../");
 
   nsCOMPtr<nsIFile> targetFile;
-  nsresult rv = fromFile->Clone(getter_AddRefs(targetFile));
-  if (NS_FAILED(rv))
+  nsresult rv = aFromFile->Clone(getter_AddRefs(targetFile));
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   //
-  // relativeDesc is UTF-8 encoded
+  // aRelativeDesc is UTF-8 encoded
   //
 
   nsCString::const_iterator strBegin, strEnd;
-  relativeDesc.BeginReading(strBegin);
-  relativeDesc.EndReading(strEnd);
+  aRelativeDesc.BeginReading(strBegin);
+  aRelativeDesc.EndReading(strEnd);
 
   nsCString::const_iterator nodeBegin(strBegin), nodeEnd(strEnd);
   nsCString::const_iterator pos(strBegin);
 
   nsCOMPtr<nsIFile> parentDir;
   while (FindInReadable(kParentDirStr, nodeBegin, nodeEnd)) {
     rv = targetFile->GetParent(getter_AddRefs(parentDir));
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
-    if (!parentDir)
+    }
+    if (!parentDir) {
       return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+    }
     targetFile = parentDir;
 
     nodeBegin = nodeEnd;
     pos = nodeEnd;
     nodeEnd = strEnd;
   }
 
   nodeBegin = nodeEnd = pos;
   while (nodeEnd != strEnd) {
     FindCharInReadable('/', nodeEnd, strEnd);
     targetFile->Append(NS_ConvertUTF8toUTF16(Substring(nodeBegin, nodeEnd)));
-    if (nodeEnd != strEnd) // If there's more left in the string, inc over the '/' nodeEnd is on.
+    if (nodeEnd != strEnd) { // If there's more left in the string, inc over the '/' nodeEnd is on.
       ++nodeEnd;
+    }
     nodeBegin = nodeEnd;
   }
 
   return InitWithFile(targetFile);
 }
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -16,17 +16,17 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <utime.h>
 #include <dirent.h>
 #include <ctype.h>
 #include <locale.h>
 #if defined(VMS)
-    #include <fabdef.h>
+#include <fabdef.h>
 #endif
 
 #if defined(HAVE_SYS_QUOTA_H) && defined(HAVE_LINUX_QUOTA_H)
 #define USE_LINUX_QUOTACTL
 #include <sys/quota.h>
 #endif
 
 #include "xpcom-private.h"
@@ -84,42 +84,42 @@ using namespace mozilla;
 
 #define CHECK_mPath()                           \
     PR_BEGIN_MACRO                              \
         if (mPath.IsEmpty())                    \
             return NS_ERROR_NOT_INITIALIZED;    \
     PR_END_MACRO
 
 /* directory enumerator */
-class
-nsDirEnumeratorUnix MOZ_FINAL : public nsISimpleEnumerator,
-                                public nsIDirectoryEnumerator
+class nsDirEnumeratorUnix MOZ_FINAL
+  : public nsISimpleEnumerator
+  , public nsIDirectoryEnumerator
 {
 public:
   nsDirEnumeratorUnix();
 
   // nsISupports interface
   NS_DECL_ISUPPORTS
 
   // nsISimpleEnumerator interface
   NS_DECL_NSISIMPLEENUMERATOR
 
   // nsIDirectoryEnumerator interface
   NS_DECL_NSIDIRECTORYENUMERATOR
 
-  NS_IMETHOD Init(nsLocalFile *parent, bool ignored);
+  NS_IMETHOD Init(nsLocalFile* aParent, bool aIgnored);
 
 private:
   ~nsDirEnumeratorUnix();
 
 protected:
   NS_IMETHOD GetNextEntry();
 
-  DIR           *mDir;
-  struct dirent *mEntry;
+  DIR*           mDir;
+  struct dirent* mEntry;
   nsCString      mParentPath;
 };
 
 nsDirEnumeratorUnix::nsDirEnumeratorUnix() :
   mDir(nullptr),
   mEntry(nullptr)
 {
 }
@@ -127,88 +127,95 @@ nsDirEnumeratorUnix::nsDirEnumeratorUnix
 nsDirEnumeratorUnix::~nsDirEnumeratorUnix()
 {
   Close();
 }
 
 NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator, nsIDirectoryEnumerator)
 
 NS_IMETHODIMP
-nsDirEnumeratorUnix::Init(nsLocalFile *parent, bool resolveSymlinks /*ignored*/)
+nsDirEnumeratorUnix::Init(nsLocalFile* aParent,
+                          bool aResolveSymlinks /*ignored*/)
 {
   nsAutoCString dirPath;
-  if (NS_FAILED(parent->GetNativePath(dirPath)) ||
+  if (NS_FAILED(aParent->GetNativePath(dirPath)) ||
       dirPath.IsEmpty()) {
     return NS_ERROR_FILE_INVALID_PATH;
   }
 
-  if (NS_FAILED(parent->GetNativePath(mParentPath)))
+  if (NS_FAILED(aParent->GetNativePath(mParentPath))) {
     return NS_ERROR_FAILURE;
+  }
 
   mDir = opendir(dirPath.get());
-  if (!mDir)
+  if (!mDir) {
     return NSRESULT_FOR_ERRNO();
+  }
   return GetNextEntry();
 }
 
 NS_IMETHODIMP
-nsDirEnumeratorUnix::HasMoreElements(bool *result)
+nsDirEnumeratorUnix::HasMoreElements(bool* aResult)
 {
-  *result = mDir && mEntry;
-  if (!*result)
+  *aResult = mDir && mEntry;
+  if (!*aResult) {
     Close();
+  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDirEnumeratorUnix::GetNext(nsISupports **_retval)
+nsDirEnumeratorUnix::GetNext(nsISupports** aResult)
 {
   nsCOMPtr<nsIFile> file;
   nsresult rv = GetNextFile(getter_AddRefs(file));
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-  NS_IF_ADDREF(*_retval = file);
+  }
+  NS_IF_ADDREF(*aResult = file);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDirEnumeratorUnix::GetNextEntry()
 {
   do {
     errno = 0;
     mEntry = readdir(mDir);
 
     // end of dir or error
-    if (!mEntry)
+    if (!mEntry) {
       return NSRESULT_FOR_ERRNO();
+    }
 
     // keep going past "." and ".."
   } while (mEntry->d_name[0] == '.'     &&
            (mEntry->d_name[1] == '\0'    ||   // .\0
             (mEntry->d_name[1] == '.'     &&
              mEntry->d_name[2] == '\0')));      // ..\0
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDirEnumeratorUnix::GetNextFile(nsIFile **_retval)
+nsDirEnumeratorUnix::GetNextFile(nsIFile** aResult)
 {
   nsresult rv;
   if (!mDir || !mEntry) {
-    *_retval = nullptr;
+    *aResult = nullptr;
     return NS_OK;
   }
 
   nsCOMPtr<nsIFile> file = new nsLocalFile();
 
   if (NS_FAILED(rv = file->InitWithNativePath(mParentPath)) ||
-      NS_FAILED(rv = file->AppendNative(nsDependentCString(mEntry->d_name))))
+      NS_FAILED(rv = file->AppendNative(nsDependentCString(mEntry->d_name)))) {
     return rv;
-
-  file.forget(_retval);
+  }
+
+  file.forget(aResult);
   return GetNextEntry();
 }
 
 NS_IMETHODIMP
 nsDirEnumeratorUnix::Close()
 {
   if (mDir) {
     closedir(mDir);
@@ -216,18 +223,18 @@ nsDirEnumeratorUnix::Close()
   }
   return NS_OK;
 }
 
 nsLocalFile::nsLocalFile()
 {
 }
 
-nsLocalFile::nsLocalFile(const nsLocalFile& other)
-  : mPath(other.mPath)
+nsLocalFile::nsLocalFile(const nsLocalFile& aOther)
+  : mPath(aOther.mPath)
 {
 }
 
 #ifdef MOZ_WIDGET_COCOA
 NS_IMPL_ISUPPORTS(nsLocalFile,
                   nsILocalFileMac,
                   nsILocalFile,
                   nsIFile,
@@ -235,114 +242,123 @@ NS_IMPL_ISUPPORTS(nsLocalFile,
 #else
 NS_IMPL_ISUPPORTS(nsLocalFile,
                   nsILocalFile,
                   nsIFile,
                   nsIHashable)
 #endif
 
 nsresult
-nsLocalFile::nsLocalFileConstructor(nsISupports *outer,
-                                    const nsIID &aIID,
-                                    void **aInstancePtr)
+nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter,
+                                    const nsIID& aIID,
+                                    void** aInstancePtr)
 {
-  if (NS_WARN_IF(!aInstancePtr))
+  if (NS_WARN_IF(!aInstancePtr)) {
     return NS_ERROR_INVALID_ARG;
-  if (NS_WARN_IF(outer))
+  }
+  if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
+  }
 
   *aInstancePtr = nullptr;
 
   nsCOMPtr<nsIFile> inst = new nsLocalFile();
   return inst->QueryInterface(aIID, aInstancePtr);
 }
 
 bool
-nsLocalFile::FillStatCache() {
+nsLocalFile::FillStatCache()
+{
   if (STAT(mPath.get(), &mCachedStat) == -1) {
     // try lstat it may be a symlink
     if (LSTAT(mPath.get(), &mCachedStat) == -1) {
       return false;
     }
   }
   return true;
 }
 
 NS_IMETHODIMP
-nsLocalFile::Clone(nsIFile **file)
+nsLocalFile::Clone(nsIFile** aFile)
 {
   // Just copy-construct ourselves
   nsRefPtr<nsLocalFile> copy = new nsLocalFile(*this);
-  copy.forget(file);
+  copy.forget(aFile);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::InitWithNativePath(const nsACString &filePath)
+nsLocalFile::InitWithNativePath(const nsACString& aFilePath)
 {
-  if (filePath.Equals("~") || Substring(filePath, 0, 2).EqualsLiteral("~/")) {
+  if (aFilePath.Equals("~") ||
+      Substring(aFilePath, 0, 2).EqualsLiteral("~/")) {
     nsCOMPtr<nsIFile> homeDir;
     nsAutoCString homePath;
     if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_HOME_DIR,
                                          getter_AddRefs(homeDir))) ||
         NS_FAILED(homeDir->GetNativePath(homePath))) {
       return NS_ERROR_FAILURE;
     }
 
     mPath = homePath;
-    if (filePath.Length() > 2)
-      mPath.Append(Substring(filePath, 1, filePath.Length() - 1));
+    if (aFilePath.Length() > 2) {
+      mPath.Append(Substring(aFilePath, 1, aFilePath.Length() - 1));
+    }
   } else {
-    if (filePath.IsEmpty() || filePath.First() != '/')
+    if (aFilePath.IsEmpty() || aFilePath.First() != '/') {
       return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-    mPath = filePath;
+    }
+    mPath = aFilePath;
   }
 
   // trim off trailing slashes
   ssize_t len = mPath.Length();
-  while ((len > 1) && (mPath[len - 1] == '/'))
+  while ((len > 1) && (mPath[len - 1] == '/')) {
     --len;
+  }
   mPath.SetLength(len);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::CreateAllAncestors(uint32_t permissions)
+nsLocalFile::CreateAllAncestors(uint32_t aPermissions)
 {
   // <jband> I promise to play nice
-  char *buffer = mPath.BeginWriting(),
-        *slashp = buffer;
+  char* buffer = mPath.BeginWriting();
+  char* slashp = buffer;
 
 #ifdef DEBUG_NSIFILE
   fprintf(stderr, "nsIFile: before: %s\n", buffer);
 #endif
 
   while ((slashp = strchr(slashp + 1, '/'))) {
     /*
      * Sequences of '/' are equivalent to a single '/'.
      */
-    if (slashp[1] == '/')
+    if (slashp[1] == '/') {
       continue;
+    }
 
     /*
      * If the path has a trailing slash, don't make the last component,
      * because we'll get EEXIST in Create when we try to build the final
      * component again, and it's easier to condition the logic here than
      * there.
      */
-    if (slashp[1] == '\0')
+    if (slashp[1] == '\0') {
       break;
+    }
 
     /* Temporarily NUL-terminate here */
     *slashp = '\0';
 #ifdef DEBUG_NSIFILE
     fprintf(stderr, "nsIFile: mkdir(\"%s\")\n", buffer);
 #endif
-    int mkdir_result = mkdir(buffer, permissions);
+    int mkdir_result = mkdir(buffer, aPermissions);
     int mkdir_errno  = errno;
     if (mkdir_result == -1) {
       /*
        * Always set |errno| to EEXIST if the dir already exists
        * (we have to do this here since the errno value is not consistent
        * in all cases - various reasons like different platform,
        * automounter-controlled dir, etc. can affect it (see bug 125489
        * for details)).
@@ -356,463 +372,512 @@ nsLocalFile::CreateAllAncestors(uint32_t
     *slashp = '/';
 
     /*
      * We could get EEXIST for an existing file -- not directory --
      * with the name of one of our ancestors, but that's OK: we'll get
      * ENOTDIR when we try to make the next component in the path,
      * either here on back in Create, and error out appropriately.
      */
-    if (mkdir_result == -1 && mkdir_errno != EEXIST)
+    if (mkdir_result == -1 && mkdir_errno != EEXIST) {
       return nsresultForErrno(mkdir_errno);
+    }
   }
 
 #ifdef DEBUG_NSIFILE
   fprintf(stderr, "nsIFile: after: %s\n", buffer);
 #endif
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::OpenNSPRFileDesc(int32_t flags, int32_t mode, PRFileDesc **_retval)
+nsLocalFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
+                              PRFileDesc** aResult)
 {
-  *_retval = PR_Open(mPath.get(), flags, mode);
-  if (! *_retval)
+  *aResult = PR_Open(mPath.get(), aFlags, aMode);
+  if (! *aResult) {
     return NS_ErrorAccordingToNSPR();
-
-  if (flags & DELETE_ON_CLOSE) {
+  }
+
+  if (aFlags & DELETE_ON_CLOSE) {
     PR_Delete(mPath.get());
   }
 
 #if defined(HAVE_POSIX_FADVISE)
-  if (flags & OS_READAHEAD) {
-    posix_fadvise(PR_FileDesc2NativeHandle(*_retval), 0, 0,
+  if (aFlags & OS_READAHEAD) {
+    posix_fadvise(PR_FileDesc2NativeHandle(*aResult), 0, 0,
                   POSIX_FADV_SEQUENTIAL);
   }
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::OpenANSIFileDesc(const char *mode, FILE **_retval)
+nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult)
 {
-  *_retval = fopen(mPath.get(), mode);
-  if (! *_retval)
+  *aResult = fopen(mPath.get(), aMode);
+  if (! *aResult) {
     return NS_ERROR_FAILURE;
+  }
 
   return NS_OK;
 }
 
 static int
-do_create(const char *path, int flags, mode_t mode, PRFileDesc **_retval)
+do_create(const char* aPath, int aFlags, mode_t aMode, PRFileDesc** aResult)
 {
-  *_retval = PR_Open(path, flags, mode);
-  return *_retval ? 0 : -1;
+  *aResult = PR_Open(aPath, aFlags, aMode);
+  return *aResult ? 0 : -1;
 }
 
 static int
-do_mkdir(const char *path, int flags, mode_t mode, PRFileDesc **_retval)
+do_mkdir(const char* aPath, int aFlags, mode_t aMode, PRFileDesc** aResult)
 {
-  *_retval = nullptr;
-  return mkdir(path, mode);
+  *aResult = nullptr;
+  return mkdir(aPath, aMode);
 }
 
 nsresult
-nsLocalFile::CreateAndKeepOpen(uint32_t type, int flags,
-                               uint32_t permissions, PRFileDesc **_retval)
+nsLocalFile::CreateAndKeepOpen(uint32_t aType, int aFlags,
+                               uint32_t aPermissions, PRFileDesc** aResult)
 {
-  if (type != NORMAL_FILE_TYPE && type != DIRECTORY_TYPE)
+  if (aType != NORMAL_FILE_TYPE && aType != DIRECTORY_TYPE) {
     return NS_ERROR_FILE_UNKNOWN_TYPE;
-
-  int result;
-  int (*createFunc)(const char *, int, mode_t, PRFileDesc **) =
-    (type == NORMAL_FILE_TYPE) ? do_create : do_mkdir;
-
-  result = createFunc(mPath.get(), flags, permissions, _retval);
+  }
+
+  int (*createFunc)(const char*, int, mode_t, PRFileDesc**) =
+    (aType == NORMAL_FILE_TYPE) ? do_create : do_mkdir;
+
+  int result = createFunc(mPath.get(), aFlags, aPermissions, aResult);
   if (result == -1 && errno == ENOENT) {
     /*
      * If we failed because of missing ancestor components, try to create
      * them and then retry the original creation.
      *
      * Ancestor directories get the same permissions as the file we're
      * creating, with the X bit set for each of (user,group,other) with
      * an R bit in the original permissions.    If you want to do anything
      * fancy like setgid or sticky bits, do it by hand.
      */
-    int dirperm = permissions;
-    if (permissions & S_IRUSR)
+    int dirperm = aPermissions;
+    if (aPermissions & S_IRUSR) {
       dirperm |= S_IXUSR;
-    if (permissions & S_IRGRP)
+    }
+    if (aPermissions & S_IRGRP) {
       dirperm |= S_IXGRP;
-    if (permissions & S_IROTH)
+    }
+    if (aPermissions & S_IROTH) {
       dirperm |= S_IXOTH;
+    }
 
 #ifdef DEBUG_NSIFILE
-    fprintf(stderr, "nsIFile: perm = %o, dirperm = %o\n", permissions,
+    fprintf(stderr, "nsIFile: perm = %o, dirperm = %o\n", aPermissions,
             dirperm);
 #endif
 
-    if (NS_FAILED(CreateAllAncestors(dirperm)))
+    if (NS_FAILED(CreateAllAncestors(dirperm))) {
       return NS_ERROR_FAILURE;
+    }
 
 #ifdef DEBUG_NSIFILE
     fprintf(stderr, "nsIFile: Create(\"%s\") again\n", mPath.get());
 #endif
-    result = createFunc(mPath.get(), flags, permissions, _retval);
+    result = createFunc(mPath.get(), aFlags, aPermissions, aResult);
   }
   return NSRESULT_FOR_RETURN(result);
 }
 
 NS_IMETHODIMP
-nsLocalFile::Create(uint32_t type, uint32_t permissions)
+nsLocalFile::Create(uint32_t aType, uint32_t aPermissions)
 {
-  PRFileDesc *junk = nullptr;
-  nsresult rv = CreateAndKeepOpen(type,
+  PRFileDesc* junk = nullptr;
+  nsresult rv = CreateAndKeepOpen(aType,
                                   PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE |
                                   PR_EXCL,
-                                  permissions,
+                                  aPermissions,
                                   &junk);
-  if (junk)
+  if (junk) {
     PR_Close(junk);
+  }
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::AppendNative(const nsACString &fragment)
+nsLocalFile::AppendNative(const nsACString& aFragment)
 {
-  if (fragment.IsEmpty())
+  if (aFragment.IsEmpty()) {
     return NS_OK;
+  }
 
   // only one component of path can be appended
   nsACString::const_iterator begin, end;
-  if (FindCharInReadable('/', fragment.BeginReading(begin),
-                         fragment.EndReading(end)))
+  if (FindCharInReadable('/', aFragment.BeginReading(begin),
+                         aFragment.EndReading(end))) {
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-
-  return AppendRelativeNativePath(fragment);
+  }
+
+  return AppendRelativeNativePath(aFragment);
 }
 
 NS_IMETHODIMP
-nsLocalFile::AppendRelativeNativePath(const nsACString &fragment)
+nsLocalFile::AppendRelativeNativePath(const nsACString& aFragment)
 {
-  if (fragment.IsEmpty())
+  if (aFragment.IsEmpty()) {
     return NS_OK;
+  }
 
   // No leading '/'
-  if (fragment.First() == '/')
+  if (aFragment.First() == '/') {
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-
-  if (mPath.EqualsLiteral("/"))
-    mPath.Append(fragment);
-  else
-    mPath.Append(NS_LITERAL_CSTRING("/") + fragment);
+  }
+
+  if (mPath.EqualsLiteral("/")) {
+    mPath.Append(aFragment);
+  } else {
+    mPath.Append(NS_LITERAL_CSTRING("/") + aFragment);
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::Normalize()
 {
   char resolved_path[PATH_MAX] = "";
-  char *resolved_path_ptr = nullptr;
+  char* resolved_path_ptr = nullptr;
 
   resolved_path_ptr = realpath(mPath.get(), resolved_path);
 
   // if there is an error, the return is null.
-  if (!resolved_path_ptr)
+  if (!resolved_path_ptr) {
     return NSRESULT_FOR_ERRNO();
+  }
 
   mPath = resolved_path;
   return NS_OK;
 }
 
 void
-nsLocalFile::LocateNativeLeafName(nsACString::const_iterator &begin,
-                                  nsACString::const_iterator &end)
+nsLocalFile::LocateNativeLeafName(nsACString::const_iterator& aBegin,
+                                  nsACString::const_iterator& aEnd)
 {
   // XXX perhaps we should cache this??
 
-  mPath.BeginReading(begin);
-  mPath.EndReading(end);
-
-  nsACString::const_iterator it = end;
-  nsACString::const_iterator stop = begin;
+  mPath.BeginReading(aBegin);
+  mPath.EndReading(aEnd);
+
+  nsACString::const_iterator it = aEnd;
+  nsACString::const_iterator stop = aBegin;
   --stop;
   while (--it != stop) {
     if (*it == '/') {
-      begin = ++it;
+      aBegin = ++it;
       return;
     }
   }
   // else, the entire path is the leaf name (which means this
   // isn't an absolute path... unexpected??)
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetNativeLeafName(nsACString &aLeafName)
+nsLocalFile::GetNativeLeafName(nsACString& aLeafName)
 {
   nsACString::const_iterator begin, end;
   LocateNativeLeafName(begin, end);
   aLeafName = Substring(begin, end);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::SetNativeLeafName(const nsACString &aLeafName)
+nsLocalFile::SetNativeLeafName(const nsACString& aLeafName)
 {
   nsACString::const_iterator begin, end;
   LocateNativeLeafName(begin, end);
   mPath.Replace(begin.get() - mPath.get(), Distance(begin, end), aLeafName);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetNativePath(nsACString &_retval)
+nsLocalFile::GetNativePath(nsACString& aResult)
 {
-  _retval = mPath;
+  aResult = mPath;
   return NS_OK;
 }
 
 nsresult
-nsLocalFile::GetNativeTargetPathName(nsIFile *newParent,
-                                     const nsACString &newName,
-                                     nsACString &_retval)
+nsLocalFile::GetNativeTargetPathName(nsIFile* aNewParent,
+                                     const nsACString& aNewName,
+                                     nsACString& aResult)
 {
   nsresult rv;
   nsCOMPtr<nsIFile> oldParent;
 
-  if (!newParent) {
-    if (NS_FAILED(rv = GetParent(getter_AddRefs(oldParent))))
+  if (!aNewParent) {
+    if (NS_FAILED(rv = GetParent(getter_AddRefs(oldParent)))) {
       return rv;
-    newParent = oldParent.get();
+    }
+    aNewParent = oldParent.get();
   } else {
     // check to see if our target directory exists
     bool targetExists;
-    if (NS_FAILED(rv = newParent->Exists(&targetExists)))
+    if (NS_FAILED(rv = aNewParent->Exists(&targetExists))) {
       return rv;
+    }
 
     if (!targetExists) {
       // XXX create the new directory with some permissions
-      rv = newParent->Create(DIRECTORY_TYPE, 0755);
-      if (NS_FAILED(rv))
+      rv = aNewParent->Create(DIRECTORY_TYPE, 0755);
+      if (NS_FAILED(rv)) {
         return rv;
+      }
     } else {
       // make sure that the target is actually a directory
       bool targetIsDirectory;
-      if (NS_FAILED(rv = newParent->IsDirectory(&targetIsDirectory)))
+      if (NS_FAILED(rv = aNewParent->IsDirectory(&targetIsDirectory))) {
         return rv;
-      if (!targetIsDirectory)
+      }
+      if (!targetIsDirectory) {
         return NS_ERROR_FILE_DESTINATION_NOT_DIR;
+      }
     }
   }
 
   nsACString::const_iterator nameBegin, nameEnd;
-  if (!newName.IsEmpty()) {
-    newName.BeginReading(nameBegin);
-    newName.EndReading(nameEnd);
+  if (!aNewName.IsEmpty()) {
+    aNewName.BeginReading(nameBegin);
+    aNewName.EndReading(nameEnd);
+  } else {
+    LocateNativeLeafName(nameBegin, nameEnd);
   }
-  else
-    LocateNativeLeafName(nameBegin, nameEnd);
 
   nsAutoCString dirName;
-  if (NS_FAILED(rv = newParent->GetNativePath(dirName)))
+  if (NS_FAILED(rv = aNewParent->GetNativePath(dirName))) {
     return rv;
-
-  _retval = dirName
-    + NS_LITERAL_CSTRING("/")
-    + Substring(nameBegin, nameEnd);
+  }
+
+  aResult = dirName + NS_LITERAL_CSTRING("/") + Substring(nameBegin, nameEnd);
   return NS_OK;
 }
 
 nsresult
-nsLocalFile::CopyDirectoryTo(nsIFile *newParent)
+nsLocalFile::CopyDirectoryTo(nsIFile* aNewParent)
 {
   nsresult rv;
   /*
    * dirCheck is used for various boolean test results such as from Equals,
    * Exists, isDir, etc.
    */
   bool dirCheck, isSymlink;
   uint32_t oldPerms;
 
-  if (NS_FAILED(rv = IsDirectory(&dirCheck)))
+  if (NS_FAILED(rv = IsDirectory(&dirCheck))) {
     return rv;
-  if (!dirCheck)
-    return CopyToNative(newParent, EmptyCString());
-
-  if (NS_FAILED(rv = Equals(newParent, &dirCheck)))
+  }
+  if (!dirCheck) {
+    return CopyToNative(aNewParent, EmptyCString());
+  }
+
+  if (NS_FAILED(rv = Equals(aNewParent, &dirCheck))) {
     return rv;
+  }
   if (dirCheck) {
     // can't copy dir to itself
     return NS_ERROR_INVALID_ARG;
   }
 
-  if (NS_FAILED(rv = newParent->Exists(&dirCheck)))
+  if (NS_FAILED(rv = aNewParent->Exists(&dirCheck))) {
     return rv;
+  }
   // get the dirs old permissions
-  if (NS_FAILED(rv = GetPermissions(&oldPerms)))
+  if (NS_FAILED(rv = GetPermissions(&oldPerms))) {
     return rv;
+  }
   if (!dirCheck) {
-    if (NS_FAILED(rv = newParent->Create(DIRECTORY_TYPE, oldPerms)))
+    if (NS_FAILED(rv = aNewParent->Create(DIRECTORY_TYPE, oldPerms))) {
       return rv;
+    }
   } else {    // dir exists lets try to use leaf
     nsAutoCString leafName;
-    if (NS_FAILED(rv = GetNativeLeafName(leafName)))
+    if (NS_FAILED(rv = GetNativeLeafName(leafName))) {
       return rv;
-    if (NS_FAILED(rv = newParent->AppendNative(leafName)))
+    }
+    if (NS_FAILED(rv = aNewParent->AppendNative(leafName))) {
+      return rv;
+    }
+    if (NS_FAILED(rv = aNewParent->Exists(&dirCheck))) {
       return rv;
-    if (NS_FAILED(rv = newParent->Exists(&dirCheck)))
+    }
+    if (dirCheck) {
+      return NS_ERROR_FILE_ALREADY_EXISTS;  // dest exists
+    }
+    if (NS_FAILED(rv = aNewParent->Create(DIRECTORY_TYPE, oldPerms))) {
       return rv;
-    if (dirCheck)
-      return NS_ERROR_FILE_ALREADY_EXISTS; // dest exists
-    if (NS_FAILED(rv = newParent->Create(DIRECTORY_TYPE, oldPerms)))
-      return rv;
+    }
   }
 
   nsCOMPtr<nsISimpleEnumerator> dirIterator;
-  if (NS_FAILED(rv = GetDirectoryEntries(getter_AddRefs(dirIterator))))
+  if (NS_FAILED(rv = GetDirectoryEntries(getter_AddRefs(dirIterator)))) {
     return rv;
+  }
 
   bool hasMore = false;
   while (dirIterator->HasMoreElements(&hasMore), hasMore) {
     nsCOMPtr<nsISupports> supports;
     nsCOMPtr<nsIFile> entry;
     rv = dirIterator->GetNext(getter_AddRefs(supports));
     entry = do_QueryInterface(supports);
-    if (NS_FAILED(rv) || !entry)
+    if (NS_FAILED(rv) || !entry) {
       continue;
-    if (NS_FAILED(rv = entry->IsSymlink(&isSymlink)))
+    }
+    if (NS_FAILED(rv = entry->IsSymlink(&isSymlink))) {
       return rv;
-    if (NS_FAILED(rv = entry->IsDirectory(&dirCheck)))
+    }
+    if (NS_FAILED(rv = entry->IsDirectory(&dirCheck))) {
       return rv;
+    }
     if (dirCheck && !isSymlink) {
       nsCOMPtr<nsIFile> destClone;
-      rv = newParent->Clone(getter_AddRefs(destClone));
+      rv = aNewParent->Clone(getter_AddRefs(destClone));
       if (NS_SUCCEEDED(rv)) {
         if (NS_FAILED(rv = entry->CopyToNative(destClone, EmptyCString()))) {
 #ifdef DEBUG
           nsresult rv2;
           nsAutoCString pathName;
-          if (NS_FAILED(rv2 = entry->GetNativePath(pathName)))
+          if (NS_FAILED(rv2 = entry->GetNativePath(pathName))) {
             return rv2;
+          }
           printf("Operation not supported: %s\n", pathName.get());
 #endif
-          if (rv == NS_ERROR_OUT_OF_MEMORY)
+          if (rv == NS_ERROR_OUT_OF_MEMORY) {
             return rv;
+          }
           continue;
         }
       }
     } else {
-      if (NS_FAILED(rv = entry->CopyToNative(newParent, EmptyCString()))) {
+      if (NS_FAILED(rv = entry->CopyToNative(aNewParent, EmptyCString()))) {
 #ifdef DEBUG
         nsresult rv2;
         nsAutoCString pathName;
-        if (NS_FAILED(rv2 = entry->GetNativePath(pathName)))
+        if (NS_FAILED(rv2 = entry->GetNativePath(pathName))) {
           return rv2;
+        }
         printf("Operation not supported: %s\n", pathName.get());
 #endif
-        if (rv == NS_ERROR_OUT_OF_MEMORY)
+        if (rv == NS_ERROR_OUT_OF_MEMORY) {
           return rv;
+        }
         continue;
       }
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::CopyToNative(nsIFile *newParent, const nsACString &newName)
+nsLocalFile::CopyToNative(nsIFile* aNewParent, const nsACString& aNewName)
 {
   nsresult rv;
   // check to make sure that this has been initialized properly
   CHECK_mPath();
 
-  // we copy the parent here so 'newParent' remains immutable
+  // we copy the parent here so 'aNewParent' remains immutable
   nsCOMPtr <nsIFile> workParent;
-  if (newParent) {
-    if (NS_FAILED(rv = newParent->Clone(getter_AddRefs(workParent))))
+  if (aNewParent) {
+    if (NS_FAILED(rv = aNewParent->Clone(getter_AddRefs(workParent)))) {
       return rv;
+    }
   } else {
-    if (NS_FAILED(rv = GetParent(getter_AddRefs(workParent))))
+    if (NS_FAILED(rv = GetParent(getter_AddRefs(workParent)))) {
       return rv;
+    }
   }
 
   // check to see if we are a directory or if we are a file
   bool isDirectory;
-  if (NS_FAILED(rv = IsDirectory(&isDirectory)))
+  if (NS_FAILED(rv = IsDirectory(&isDirectory))) {
     return rv;
+  }
 
   nsAutoCString newPathName;
   if (isDirectory) {
-    if (!newName.IsEmpty()) {
-      if (NS_FAILED(rv = workParent->AppendNative(newName)))
+    if (!aNewName.IsEmpty()) {
+      if (NS_FAILED(rv = workParent->AppendNative(aNewName))) {
         return rv;
+      }
     } else {
-      if (NS_FAILED(rv = GetNativeLeafName(newPathName)))
+      if (NS_FAILED(rv = GetNativeLeafName(newPathName))) {
         return rv;
-      if (NS_FAILED(rv = workParent->AppendNative(newPathName)))
+      }
+      if (NS_FAILED(rv = workParent->AppendNative(newPathName))) {
         return rv;
+      }
     }
-    if (NS_FAILED(rv = CopyDirectoryTo(workParent)))
+    if (NS_FAILED(rv = CopyDirectoryTo(workParent))) {
       return rv;
+    }
   } else {
-    rv = GetNativeTargetPathName(workParent, newName, newPathName);
-    if (NS_FAILED(rv))
+    rv = GetNativeTargetPathName(workParent, aNewName, newPathName);
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
 #ifdef DEBUG_blizzard
     printf("nsLocalFile::CopyTo() %s -> %s\n", mPath.get(), newPathName.get());
 #endif
 
     // actually create the file.
-    nsLocalFile *newFile = new nsLocalFile();
-    if (!newFile)
+    nsLocalFile* newFile = new nsLocalFile();
+    if (!newFile) {
       return NS_ERROR_OUT_OF_MEMORY;
+    }
 
     nsCOMPtr<nsIFile> fileRef(newFile); // release on exit
 
     rv = newFile->InitWithNativePath(newPathName);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
     // get the old permissions
     uint32_t myPerms;
     GetPermissions(&myPerms);
 
     // Create the new file with the old file's permissions, even if write
     // permission is missing.  We can't create with write permission and
     // then change back to myPerm on all filesystems (FAT on Linux, e.g.).
     // But we can write to a read-only file on all Unix filesystems if we
     // open it successfully for writing.
 
-    PRFileDesc *newFD;
+    PRFileDesc* newFD;
     rv = newFile->CreateAndKeepOpen(NORMAL_FILE_TYPE,
-                                    PR_WRONLY|PR_CREATE_FILE|PR_TRUNCATE,
+                                    PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
                                     myPerms,
                                     &newFD);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
     // open the old file, too
     bool specialFile;
     if (NS_FAILED(rv = IsSpecial(&specialFile))) {
       PR_Close(newFD);
       return rv;
     }
     if (specialFile) {
 #ifdef DEBUG
       printf("Operation not supported: %s\n", mPath.get());
 #endif
       // make sure to clean up properly
       PR_Close(newFD);
       return NS_OK;
     }
 
-    PRFileDesc *oldFD;
+    PRFileDesc* oldFD;
     rv = OpenNSPRFileDesc(PR_RDONLY, myPerms, &oldFD);
     if (NS_FAILED(rv)) {
       // make sure to clean up properly
       PR_Close(newFD);
       return rv;
     }
 
 #ifdef DEBUG_blizzard
@@ -856,17 +921,17 @@ nsLocalFile::CopyToNative(nsIFile *newPa
     }
 
     // TODO/FIXME: If CIFS (and NFS?) may force read/write to return EINTR,
     // we are better off to prepare for retrying. But we need confirmation if
     // EINTR is returned.
 
     // Record error if PR_Read() failed.
     // Must be done before any other I/O which may reset errno.
-    if ( (bytesRead < 0) && (saved_write_error == NS_OK)) {
+    if (bytesRead < 0 && saved_write_error == NS_OK) {
       saved_read_error = NSRESULT_FOR_ERRNO();
     }
 
 #ifdef DEBUG_blizzard
     printf("read %d bytes, wrote %d bytes\n",
            totalRead, totalWritten);
 #endif
 
@@ -892,140 +957,157 @@ nsLocalFile::CopyToNative(nsIFile *newPa
 #if DEBUG
       fprintf(stderr, "ERROR: PR_Close(oldFD) returned error. errno = %d\n", errno);
 #endif
     }
 
     // Let us report the failure to write and read.
     // check for write/read error after cleaning up
     if (bytesRead < 0) {
-      if (saved_write_error != NS_OK)
+      if (saved_write_error != NS_OK) {
         return saved_write_error;
-      else if (saved_read_error != NS_OK)
+      } else if (saved_read_error != NS_OK) {
         return saved_read_error;
+      }
 #if DEBUG
-      else                // sanity check. Die and debug.
+      else {              // sanity check. Die and debug.
         MOZ_ASSERT(0);
+      }
 #endif
     }
 
-    if (saved_write_close_error != NS_OK)
+    if (saved_write_close_error != NS_OK) {
       return saved_write_close_error;
-    if (saved_read_close_error != NS_OK)
+    }
+    if (saved_read_close_error != NS_OK) {
       return saved_read_close_error;
+    }
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::CopyToFollowingLinksNative(nsIFile *newParent, const nsACString &newName)
+nsLocalFile::CopyToFollowingLinksNative(nsIFile* aNewParent,
+                                        const nsACString& aNewName)
 {
-  return CopyToNative(newParent, newName);
+  return CopyToNative(aNewParent, aNewName);
 }
 
 NS_IMETHODIMP
-nsLocalFile::MoveToNative(nsIFile *newParent, const nsACString &newName)
+nsLocalFile::MoveToNative(nsIFile* aNewParent, const nsACString& aNewName)
 {
   nsresult rv;
 
   // check to make sure that this has been initialized properly
   CHECK_mPath();
 
   // check to make sure that we have a new parent
   nsAutoCString newPathName;
-  rv = GetNativeTargetPathName(newParent, newName, newPathName);
-  if (NS_FAILED(rv))
+  rv = GetNativeTargetPathName(aNewParent, aNewName, newPathName);
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   // try for atomic rename, falling back to copy/delete
   if (rename(mPath.get(), newPathName.get()) < 0) {
 #ifdef VMS
     if (errno == EXDEV || errno == ENXIO) {
 #else
     if (errno == EXDEV) {
 #endif
-      rv = CopyToNative(newParent, newName);
-      if (NS_SUCCEEDED(rv))
+      rv = CopyToNative(aNewParent, aNewName);
+      if (NS_SUCCEEDED(rv)) {
         rv = Remove(true);
+      }
     } else {
       rv = NSRESULT_FOR_ERRNO();
     }
   }
 
   if (NS_SUCCEEDED(rv)) {
     // Adjust this
     mPath = newPathName;
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::Remove(bool recursive)
+nsLocalFile::Remove(bool aRecursive)
 {
   CHECK_mPath();
   ENSURE_STAT_CACHE();
 
   bool isSymLink;
 
   nsresult rv = IsSymlink(&isSymLink);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-
-  if (isSymLink || !S_ISDIR(mCachedStat.st_mode))
+  }
+
+  if (isSymLink || !S_ISDIR(mCachedStat.st_mode)) {
     return NSRESULT_FOR_RETURN(unlink(mPath.get()));
-
-  if (recursive) {
-    nsDirEnumeratorUnix *dir = new nsDirEnumeratorUnix();
+  }
+
+  if (aRecursive) {
+    nsDirEnumeratorUnix* dir = new nsDirEnumeratorUnix();
 
     nsCOMPtr<nsISimpleEnumerator> dirRef(dir); // release on exit
 
     rv = dir->Init(this, false);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
 
     bool more;
     while (dir->HasMoreElements(&more), more) {
       nsCOMPtr<nsISupports> item;
       rv = dir->GetNext(getter_AddRefs(item));
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return NS_ERROR_FAILURE;
+      }
 
       nsCOMPtr<nsIFile> file = do_QueryInterface(item, &rv);
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return NS_ERROR_FAILURE;
-      rv = file->Remove(recursive);
+      }
+      rv = file->Remove(aRecursive);
 
 #ifdef ANDROID
       // See bug 580434 - Bionic gives us just deleted files
-      if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
+      if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
         continue;
+      }
 #endif
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return rv;
+      }
     }
   }
 
   return NSRESULT_FOR_RETURN(rmdir(mPath.get()));
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetLastModifiedTime(PRTime *aLastModTime)
+nsLocalFile::GetLastModifiedTime(PRTime* aLastModTime)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aLastModTime))
+  if (NS_WARN_IF(!aLastModTime)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   PRFileInfo64 info;
-  if (PR_GetFileInfo64(mPath.get(), &info) != PR_SUCCESS)
+  if (PR_GetFileInfo64(mPath.get(), &info) != PR_SUCCESS) {
     return NSRESULT_FOR_ERRNO();
+  }
   PRTime modTime = info.modifyTime;
-  if (modTime == 0)
+  if (modTime == 0) {
     *aLastModTime = 0;
-  else
+  } else {
     *aLastModTime = modTime / PR_USEC_PER_MSEC;
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::SetLastModifiedTime(PRTime aLastModTime)
 {
   CHECK_mPath();
@@ -1041,25 +1123,27 @@ nsLocalFile::SetLastModifiedTime(PRTime 
     result = utime(mPath.get(), &ut);
   } else {
     result = utime(mPath.get(), nullptr);
   }
   return NSRESULT_FOR_RETURN(result);
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetLastModifiedTimeOfLink(PRTime *aLastModTimeOfLink)
+nsLocalFile::GetLastModifiedTimeOfLink(PRTime* aLastModTimeOfLink)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aLastModTimeOfLink))
+  if (NS_WARN_IF(!aLastModTimeOfLink)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   struct STAT sbuf;
-  if (LSTAT(mPath.get(), &sbuf) == -1)
+  if (LSTAT(mPath.get(), &sbuf) == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
   *aLastModTimeOfLink = PRTime(sbuf.st_mtime) * PR_MSEC_PER_SEC;
 
   return NS_OK;
 }
 
 /*
  * utime(2) may or may not dereference symlinks, joy.
  */
@@ -1072,77 +1156,84 @@ nsLocalFile::SetLastModifiedTimeOfLink(P
 /*
  * Only send back permissions bits: maybe we want to send back the whole
  * mode_t to permit checks against other file types?
  */
 
 #define NORMALIZE_PERMS(mode)    ((mode)& (S_IRWXU | S_IRWXG | S_IRWXO))
 
 NS_IMETHODIMP
-nsLocalFile::GetPermissions(uint32_t *aPermissions)
+nsLocalFile::GetPermissions(uint32_t* aPermissions)
 {
-  if (NS_WARN_IF(!aPermissions))
+  if (NS_WARN_IF(!aPermissions)) {
     return NS_ERROR_INVALID_ARG;
+  }
   ENSURE_STAT_CACHE();
   *aPermissions = NORMALIZE_PERMS(mCachedStat.st_mode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetPermissionsOfLink(uint32_t *aPermissionsOfLink)
+nsLocalFile::GetPermissionsOfLink(uint32_t* aPermissionsOfLink)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aPermissionsOfLink))
+  if (NS_WARN_IF(!aPermissionsOfLink)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   struct STAT sbuf;
-  if (LSTAT(mPath.get(), &sbuf) == -1)
+  if (LSTAT(mPath.get(), &sbuf) == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
   *aPermissionsOfLink = NORMALIZE_PERMS(sbuf.st_mode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::SetPermissions(uint32_t aPermissions)
 {
   CHECK_mPath();
 
   /*
    * Race condition here: we should use fchmod instead, there's no way to
    * guarantee the name still refers to the same file.
    */
-  if (chmod(mPath.get(), aPermissions) >= 0)
+  if (chmod(mPath.get(), aPermissions) >= 0) {
     return NS_OK;
+  }
 #if defined(ANDROID) && defined(STATFS)
   // For the time being, this is restricted for use by Android, but we
   // will figure out what to do for all platforms in bug 638503
   struct STATFS sfs;
-  if (STATFS(mPath.get(), &sfs) < 0)
+  if (STATFS(mPath.get(), &sfs) < 0) {
     return NSRESULT_FOR_ERRNO();
+  }
 
   // if this is a FAT file system we can't set file permissions
-  if (sfs.f_type == MSDOS_SUPER_MAGIC )
+  if (sfs.f_type == MSDOS_SUPER_MAGIC) {
     return NS_OK;
+  }
 #endif
   return NSRESULT_FOR_ERRNO();
 }
 
 NS_IMETHODIMP
 nsLocalFile::SetPermissionsOfLink(uint32_t aPermissions)
 {
   // There isn't a consistent mechanism for doing this on UNIX platforms. We
   // might want to carefully implement this in the future though.
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFileSize(int64_t *aFileSize)
+nsLocalFile::GetFileSize(int64_t* aFileSize)
 {
-  if (NS_WARN_IF(!aFileSize))
+  if (NS_WARN_IF(!aFileSize)) {
     return NS_ERROR_INVALID_ARG;
+  }
   *aFileSize = 0;
   ENSURE_STAT_CACHE();
 
 #if defined(VMS)
   /* Only two record formats can report correct file content size */
   if ((mCachedStat.st_fab_rfm != FAB$C_STMLF) &&
       (mCachedStat.st_fab_rfm != FAB$C_STMCR)) {
     return NS_ERROR_FAILURE;
@@ -1158,107 +1249,115 @@ nsLocalFile::GetFileSize(int64_t *aFileS
 NS_IMETHODIMP
 nsLocalFile::SetFileSize(int64_t aFileSize)
 {
   CHECK_mPath();
 
 #if defined(ANDROID)
   /* no truncate on bionic */
   int fd = open(mPath.get(), O_WRONLY);
-  if (fd == -1)
+  if (fd == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
 
   int ret = ftruncate(fd, (off_t)aFileSize);
   close(fd);
 
-  if (ret == -1)
+  if (ret == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
 #elif defined(HAVE_TRUNCATE64)
-  if (truncate64(mPath.get(), (off64_t)aFileSize) == -1)
+  if (truncate64(mPath.get(), (off64_t)aFileSize) == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
 #else
   off_t size = (off_t)aFileSize;
-  if (truncate(mPath.get(), size) == -1)
+  if (truncate(mPath.get(), size) == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFileSizeOfLink(int64_t *aFileSize)
+nsLocalFile::GetFileSizeOfLink(int64_t* aFileSize)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aFileSize))
+  if (NS_WARN_IF(!aFileSize)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   struct STAT sbuf;
-  if (LSTAT(mPath.get(), &sbuf) == -1)
+  if (LSTAT(mPath.get(), &sbuf) == -1) {
     return NSRESULT_FOR_ERRNO();
+  }
 
   *aFileSize = (int64_t)sbuf.st_size;
   return NS_OK;
 }
 
 #if defined(USE_LINUX_QUOTACTL)
 /*
  * Searches /proc/self/mountinfo for given device (Major:Minor),
  * returns exported name from /dev
  *
  * Fails when /proc/self/mountinfo or diven device don't exist.
  */
 static bool
-GetDeviceName(int deviceMajor, int deviceMinor, nsACString &deviceName)
+GetDeviceName(int aDeviceMajor, int aDeviceMinor, nsACString& aDeviceName)
 {
   bool ret = false;
 
   const int kMountInfoLineLength = 200;
   const int kMountInfoDevPosition = 6;
 
-  char mountinfo_line[kMountInfoLineLength];
-  char device_num[kMountInfoLineLength];
-
-  snprintf(device_num,kMountInfoLineLength,"%d:%d", deviceMajor, deviceMinor);
-
-  FILE *f = fopen("/proc/self/mountinfo","rt");
-  if(!f)
+  char mountinfoLine[kMountInfoLineLength];
+  char deviceNum[kMountInfoLineLength];
+
+  snprintf(deviceNum, kMountInfoLineLength, "%d:%d", aDeviceMajor, aDeviceMinor);
+
+  FILE* f = fopen("/proc/self/mountinfo", "rt");
+  if (!f) {
     return ret;
+  }
 
   // Expects /proc/self/mountinfo in format:
   // 'ID ID major:minor root mountpoint flags - type devicename flags'
-  while(fgets(mountinfo_line,kMountInfoLineLength,f)) {
-    char *p_dev = strstr(mountinfo_line,device_num);
-
-    int i;
-    for(i = 0; i < kMountInfoDevPosition && p_dev != nullptr; i++) {
-      p_dev = strchr(p_dev,' ');
-      if(p_dev)
+  while (fgets(mountinfoLine, kMountInfoLineLength, f)) {
+    char* p_dev = strstr(mountinfoLine, deviceNum);
+
+    for (int i = 0; i < kMountInfoDevPosition && p_dev; ++i) {
+      p_dev = strchr(p_dev, ' ');
+      if (p_dev) {
         p_dev++;
+      }
     }
 
-    if(p_dev) {
-      char *p_dev_end = strchr(p_dev,' ');
-      if(p_dev_end) {
+    if (p_dev) {
+      char* p_dev_end = strchr(p_dev, ' ');
+      if (p_dev_end) {
         *p_dev_end = '\0';
-        deviceName.Assign(p_dev);
+        aDeviceName.Assign(p_dev);
         ret = true;
         break;
       }
     }
   }
 
   fclose(f);
   return ret;
 }
 #endif
 
 NS_IMETHODIMP
-nsLocalFile::GetDiskSpaceAvailable(int64_t *aDiskSpaceAvailable)
+nsLocalFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable)
 {
-  if (NS_WARN_IF(!aDiskSpaceAvailable))
+  if (NS_WARN_IF(!aDiskSpaceAvailable)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   // These systems have the operations necessary to check disk space.
 
 #ifdef STATFS
 
   // check to make sure that mPath is properly initialized
   CHECK_mPath();
 
@@ -1274,46 +1373,49 @@ nsLocalFile::GetDiskSpaceAvailable(int64
   if (STATFS(mPath.get(), &fs_buf) < 0) {
     // The call to STATFS failed.
 #ifdef DEBUG
     printf("ERROR: GetDiskSpaceAvailable: STATFS call FAILED. \n");
 #endif
     return NS_ERROR_FAILURE;
   }
 
-  *aDiskSpaceAvailable = (int64_t) fs_buf.F_BSIZE * fs_buf.f_bavail;
+  *aDiskSpaceAvailable = (int64_t)fs_buf.F_BSIZE * fs_buf.f_bavail;
 
 #ifdef DEBUG_DISK_SPACE
   printf("DiskSpaceAvailable: %lu bytes\n",
          *aDiskSpaceAvailable);
 #endif
 
 #if defined(USE_LINUX_QUOTACTL)
 
-  if(!FillStatCache()) {
+  if (!FillStatCache()) {
     // Return available size from statfs
     return NS_OK;
   }
 
   nsCString deviceName;
-  if(!GetDeviceName(major(mCachedStat.st_dev), minor(mCachedStat.st_dev), deviceName)) {
+  if (!GetDeviceName(major(mCachedStat.st_dev),
+                     minor(mCachedStat.st_dev),
+                     deviceName)) {
     return NS_OK;
   }
 
   struct dqblk dq;
-  if(!quotactl(QCMD(Q_GETQUOTA, USRQUOTA), deviceName.get(), getuid(), (caddr_t)&dq)
+  if (!quotactl(QCMD(Q_GETQUOTA, USRQUOTA), deviceName.get(),
+                getuid(), (caddr_t)&dq)
 #ifdef QIF_BLIMITS
       && dq.dqb_valid & QIF_BLIMITS
 #endif
-      && dq.dqb_bhardlimit)
-  {
+      && dq.dqb_bhardlimit) {
     int64_t QuotaSpaceAvailable = 0;
-    if (dq.dqb_bhardlimit > dq.dqb_curspace)
+    if (dq.dqb_bhardlimit > dq.dqb_curspace) {
       QuotaSpaceAvailable = int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
-    if(QuotaSpaceAvailable < *aDiskSpaceAvailable) {
+    }
+    if (QuotaSpaceAvailable < *aDiskSpaceAvailable) {
       *aDiskSpaceAvailable = QuotaSpaceAvailable;
     }
   }
 #endif
 
   return NS_OK;
 
 #else
@@ -1330,40 +1432,44 @@ nsLocalFile::GetDiskSpaceAvailable(int64
 #endif
   return NS_ERROR_NOT_IMPLEMENTED;
 
 #endif /* STATFS */
 
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetParent(nsIFile **aParent)
+nsLocalFile::GetParent(nsIFile** aParent)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aParent))
+  if (NS_WARN_IF(!aParent)) {
     return NS_ERROR_INVALID_ARG;
+  }
   *aParent = nullptr;
 
   // if '/' we are at the top of the volume, return null
-  if (mPath.Equals("/"))
+  if (mPath.Equals("/")) {
     return  NS_OK;
+  }
 
   // <brendan, after jband> I promise to play nice
-  char *buffer   = mPath.BeginWriting(),
-        *slashp   = buffer;
+  char* buffer = mPath.BeginWriting();
+  char* slashp = buffer;
 
   // find the last significant slash in buffer
   slashp = strrchr(buffer, '/');
   NS_ASSERTION(slashp, "non-canonical path?");
-  if (!slashp)
+  if (!slashp) {
     return NS_ERROR_FILE_INVALID_PATH;
+  }
 
   // for the case where we are at '/'
-  if (slashp == buffer)
+  if (slashp == buffer) {
     slashp++;
+  }
 
   // temporarily terminate buffer at the last significant slash
   char c = *slashp;
   *slashp = '\0';
 
   nsCOMPtr<nsIFile> localFile;
   nsresult rv = NS_NewNativeLocalFile(nsDependentCString(buffer), true,
                                       getter_AddRefs(localFile));
@@ -1380,93 +1486,103 @@ nsLocalFile::GetParent(nsIFile **aParent
 }
 
 /*
  * The results of Exists, isWritable and isReadable are not cached.
  */
 
 
 NS_IMETHODIMP
-nsLocalFile::Exists(bool *_retval)
+nsLocalFile::Exists(bool* aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-
-  *_retval = (access(mPath.get(), F_OK) == 0);
+  }
+
+  *aResult = (access(mPath.get(), F_OK) == 0);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsLocalFile::IsWritable(bool *_retval)
+nsLocalFile::IsWritable(bool* aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-
-  *_retval = (access(mPath.get(), W_OK) == 0);
-  if (*_retval || errno == EACCES)
+  }
+
+  *aResult = (access(mPath.get(), W_OK) == 0);
+  if (*aResult || errno == EACCES) {
     return NS_OK;
+  }
   return NSRESULT_FOR_ERRNO();
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsReadable(bool *_retval)
+nsLocalFile::IsReadable(bool* aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-
-  *_retval = (access(mPath.get(), R_OK) == 0);
-  if (*_retval || errno == EACCES)
+  }
+
+  *aResult = (access(mPath.get(), R_OK) == 0);
+  if (*aResult || errno == EACCES) {
     return NS_OK;
+  }
   return NSRESULT_FOR_ERRNO();
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsExecutable(bool *_retval)
+nsLocalFile::IsExecutable(bool* aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   // Check extension (bug 663899). On certain platforms, the file
   // extension may cause the OS to treat it as executable regardless of
   // the execute bit, such as .jar on Mac OS X. We borrow the code from
   // nsLocalFileWin, slightly modified.
 
   // Don't be fooled by symlinks.
   bool symLink;
   nsresult rv = IsSymlink(&symLink);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   nsAutoString path;
-  if (symLink)
+  if (symLink) {
     GetTarget(path);
-  else
+  } else {
     GetPath(path);
+  }
 
   int32_t dotIdx = path.RFindChar(char16_t('.'));
   if (dotIdx != kNotFound) {
     // Convert extension to lower case.
-    char16_t *p = path.BeginWriting();
-    for(p += dotIdx + 1; *p; p++)
-      *p +=  (*p >= L'A' && *p <= L'Z') ? 'a' - 'A' : 0;
+    char16_t* p = path.BeginWriting();
+    for (p += dotIdx + 1; *p; ++p) {
+      *p += (*p >= L'A' && *p <= L'Z') ? 'a' - 'A' : 0;
+    }
 
     // Search for any of the set of executable extensions.
-    static const char * const executableExts[] = {
-      "air",         // Adobe AIR installer
-      "jar"};        // java application bundle
+    static const char* const executableExts[] = {
+      "air",  // Adobe AIR installer
+      "jar"   // java application bundle
+    };
     nsDependentSubstring ext = Substring(path, dotIdx + 1);
     for (size_t i = 0; i < ArrayLength(executableExts); i++) {
       if (ext.EqualsASCII(executableExts[i])) {
         // Found a match.  Set result and quit.
-        *_retval = true;
+        *aResult = true;
         return NS_OK;
       }
     }
   }
 
   // On OS X, then query Launch Services.
 #ifdef MOZ_WIDGET_COCOA
   // Certain Mac applications, such as Classic applications, which
@@ -1478,174 +1594,190 @@ nsLocalFile::IsExecutable(bool *_retval)
   }
 
   LSRequestedInfo theInfoRequest = kLSRequestAllInfo;
   LSItemInfoRecord theInfo;
   OSStatus result = ::LSCopyItemInfoForURL(url, theInfoRequest, &theInfo);
   ::CFRelease(url);
   if (result == noErr) {
     if ((theInfo.flags & kLSItemInfoIsApplication) != 0) {
-      *_retval = true;
+      *aResult = true;
       return NS_OK;
     }
   }
 #endif
 
   // Then check the execute bit.
-  *_retval = (access(mPath.get(), X_OK) == 0);
+  *aResult = (access(mPath.get(), X_OK) == 0);
 #ifdef SOLARIS
   // On Solaris, access will always return 0 for root user, however
   // the file is only executable if S_IXUSR | S_IXGRP | S_IXOTH is set.
   // See bug 351950, https://bugzilla.mozilla.org/show_bug.cgi?id=351950
-  if (*_retval) {
+  if (*aResult) {
     struct STAT buf;
 
-    *_retval = (STAT(mPath.get(), &buf) == 0);
-    if (*_retval || errno == EACCES) {
-      *_retval = *_retval &&
-        (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH ));
+    *aResult = (STAT(mPath.get(), &buf) == 0);
+    if (*aResult || errno == EACCES) {
+      *aResult = *aResult && (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH));
       return NS_OK;
     }
 
     return NSRESULT_FOR_ERRNO();
   }
 #endif
-  if (*_retval || errno == EACCES)
+  if (*aResult || errno == EACCES) {
     return NS_OK;
+  }
   return NSRESULT_FOR_ERRNO();
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsDirectory(bool *_retval)
+nsLocalFile::IsDirectory(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = false;
+  }
+  *aResult = false;
   ENSURE_STAT_CACHE();
-  *_retval = S_ISDIR(mCachedStat.st_mode);
+  *aResult = S_ISDIR(mCachedStat.st_mode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsFile(bool *_retval)
+nsLocalFile::IsFile(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = false;
+  }
+  *aResult = false;
   ENSURE_STAT_CACHE();
-  *_retval = S_ISREG(mCachedStat.st_mode);
+  *aResult = S_ISREG(mCachedStat.st_mode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsHidden(bool *_retval)
+nsLocalFile::IsHidden(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
   nsACString::const_iterator begin, end;
   LocateNativeLeafName(begin, end);
-  *_retval = (*begin == '.');
+  *aResult = (*begin == '.');
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsSymlink(bool *_retval)
+nsLocalFile::IsSymlink(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
   CHECK_mPath();
 
   struct STAT symStat;
-  if (LSTAT(mPath.get(), &symStat) == -1)
+  if (LSTAT(mPath.get(), &symStat) == -1) {
     return NSRESULT_FOR_ERRNO();
-  *_retval=S_ISLNK(symStat.st_mode);
+  }
+  *aResult = S_ISLNK(symStat.st_mode);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsSpecial(bool *_retval)
+nsLocalFile::IsSpecial(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
   ENSURE_STAT_CACHE();
-  *_retval = S_ISCHR(mCachedStat.st_mode)   ||
+  *aResult = S_ISCHR(mCachedStat.st_mode)   ||
              S_ISBLK(mCachedStat.st_mode)   ||
 #ifdef S_ISSOCK
              S_ISSOCK(mCachedStat.st_mode)  ||
 #endif
              S_ISFIFO(mCachedStat.st_mode);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::Equals(nsIFile *inFile, bool *_retval)
+nsLocalFile::Equals(nsIFile* aInFile, bool* aResult)
 {
-  if (NS_WARN_IF(!inFile))
+  if (NS_WARN_IF(!aInFile)) {
     return NS_ERROR_INVALID_ARG;
-  if (NS_WARN_IF(!_retval))
+  }
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = false;
+  }
+  *aResult = false;
 
   nsAutoCString inPath;
-  nsresult rv = inFile->GetNativePath(inPath);
-  if (NS_FAILED(rv))
+  nsresult rv = aInFile->GetNativePath(inPath);
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   // We don't need to worry about "/foo/" vs. "/foo" here
   // because trailing slashes are stripped on init.
-  *_retval = !strcmp(inPath.get(), mPath.get());
+  *aResult = !strcmp(inPath.get(), mPath.get());
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::Contains(nsIFile *inFile, bool *_retval)
+nsLocalFile::Contains(nsIFile* aInFile, bool* aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!inFile))
+  if (NS_WARN_IF(!aInFile)) {
     return NS_ERROR_INVALID_ARG;
-  if (NS_WARN_IF(!_retval))
+  }
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsAutoCString inPath;
   nsresult rv;
 
-  if (NS_FAILED(rv = inFile->GetNativePath(inPath)))
+  if (NS_FAILED(rv = aInFile->GetNativePath(inPath))) {
     return rv;
-
-  *_retval = false;
+  }
+
+  *aResult = false;
 
   ssize_t len = mPath.Length();
   if (strncmp(mPath.get(), inPath.get(), len) == 0) {
-    // Now make sure that the |inFile|'s path has a separator at len,
+    // Now make sure that the |aInFile|'s path has a separator at len,
     // which implies that it has more components after len.
-    if (inPath[len] == '/')
-      *_retval = true;
+    if (inPath[len] == '/') {
+      *aResult = true;
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetNativeTarget(nsACString &_retval)
+nsLocalFile::GetNativeTarget(nsACString& aResult)
 {
   CHECK_mPath();
-  _retval.Truncate();
+  aResult.Truncate();
 
   struct STAT symStat;
-  if (LSTAT(mPath.get(), &symStat) == -1)
+  if (LSTAT(mPath.get(), &symStat) == -1) {
     return NSRESULT_FOR_ERRNO();
-
-  if (!S_ISLNK(symStat.st_mode))
+  }
+
+  if (!S_ISLNK(symStat.st_mode)) {
     return NS_ERROR_FILE_INVALID_PATH;
+  }
 
   int32_t size = (int32_t)symStat.st_size;
-  char *target = (char *)nsMemory::Alloc(size + 1);
-  if (!target)
+  char* target = (char*)nsMemory::Alloc(size + 1);
+  if (!target) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   if (readlink(mPath.get(), target, (size_t)size) < 0) {
     nsMemory::Free(target);
     return NSRESULT_FOR_ERRNO();
   }
   target[size] = '\0';
 
   nsresult rv = NS_OK;
@@ -1654,41 +1786,46 @@ nsLocalFile::GetNativeTarget(nsACString 
   while (true) {
     if (maxLinks-- == 0) {
       rv = NS_ERROR_FILE_UNRESOLVABLE_SYMLINK;
       break;
     }
 
     if (target[0] != '/') {
       nsCOMPtr<nsIFile> parent;
-      if (NS_FAILED(rv = self->GetParent(getter_AddRefs(parent))))
+      if (NS_FAILED(rv = self->GetParent(getter_AddRefs(parent)))) {
+        break;
+      }
+      if (NS_FAILED(rv = parent->AppendRelativeNativePath(nsDependentCString(target)))) {
         break;
-      if (NS_FAILED(rv = parent->AppendRelativeNativePath(nsDependentCString(target))))
+      }
+      if (NS_FAILED(rv = parent->GetNativePath(aResult))) {
         break;
-      if (NS_FAILED(rv = parent->GetNativePath(_retval)))
-        break;
+      }
       self = parent;
     } else {
-      _retval = target;
+      aResult = target;
     }
 
-    const nsPromiseFlatCString &flatRetval = PromiseFlatCString(_retval);
+    const nsPromiseFlatCString& flatRetval = PromiseFlatCString(aResult);
 
     // Any failure in testing the current target we'll just interpret
     // as having reached our destiny.
-    if (LSTAT(flatRetval.get(), &symStat) == -1)
+    if (LSTAT(flatRetval.get(), &symStat) == -1) {
       break;
+    }
 
     // And of course we're done if it isn't a symlink.
-    if (!S_ISLNK(symStat.st_mode))
+    if (!S_ISLNK(symStat.st_mode)) {
       break;
+    }
 
     int32_t newSize = (int32_t)symStat.st_size;
     if (newSize > size) {
-      char *newTarget = (char *)nsMemory::Realloc(target, newSize + 1);
+      char* newTarget = (char*)nsMemory::Realloc(target, newSize + 1);
       if (!newTarget) {
         rv = NS_ERROR_OUT_OF_MEMORY;
         break;
       }
       target = newTarget;
       size = newSize;
     }
 
@@ -1697,93 +1834,99 @@ nsLocalFile::GetNativeTarget(nsACString 
       rv = NSRESULT_FOR_ERRNO();
       break;
     }
     target[linkLen] = '\0';
   }
 
   nsMemory::Free(target);
 
-  if (NS_FAILED(rv))
-    _retval.Truncate();
+  if (NS_FAILED(rv)) {
+    aResult.Truncate();
+  }
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFollowLinks(bool *aFollowLinks)
+nsLocalFile::GetFollowLinks(bool* aFollowLinks)
 {
   *aFollowLinks = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::SetFollowLinks(bool aFollowLinks)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator **entries)
+nsLocalFile::GetDirectoryEntries(nsISimpleEnumerator** aEntries)
 {
   nsRefPtr<nsDirEnumeratorUnix> dir = new nsDirEnumeratorUnix();
 
   nsresult rv = dir->Init(this, false);
   if (NS_FAILED(rv)) {
-    *entries = nullptr;
+    *aEntries = nullptr;
   } else {
-    dir.forget(entries);
+    dir.forget(aEntries);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::Load(PRLibrary **_retval)
+nsLocalFile::Load(PRLibrary** aResult)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   nsTraceRefcnt::SetActivityIsLegal(false);
 #endif
 
-  *_retval = PR_LoadLibrary(mPath.get());
+  *aResult = PR_LoadLibrary(mPath.get());
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   nsTraceRefcnt::SetActivityIsLegal(true);
 #endif
 
-  if (!*_retval)
+  if (!*aResult) {
     return NS_ERROR_FAILURE;
+  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetPersistentDescriptor(nsACString &aPersistentDescriptor)
+nsLocalFile::GetPersistentDescriptor(nsACString& aPersistentDescriptor)
 {
   return GetNativePath(aPersistentDescriptor);
 }
 
 NS_IMETHODIMP
-nsLocalFile::SetPersistentDescriptor(const nsACString &aPersistentDescriptor)
+nsLocalFile::SetPersistentDescriptor(const nsACString& aPersistentDescriptor)
 {
 #ifdef MOZ_WIDGET_COCOA
-  if (aPersistentDescriptor.IsEmpty())
+  if (aPersistentDescriptor.IsEmpty()) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   // Support pathnames as user-supplied descriptors if they begin with '/'
   // or '~'.  These characters do not collide with the base64 set used for
   // encoding alias records.
   char first = aPersistentDescriptor.First();
-  if (first == '/' || first == '~')
+  if (first == '/' || first == '~') {
     return InitWithNativePath(aPersistentDescriptor);
+  }
 
   uint32_t dataSize = aPersistentDescriptor.Length();
-  char* decodedData = PL_Base64Decode(PromiseFlatCString(aPersistentDescriptor).get(), dataSize, nullptr);
+  char* decodedData = PL_Base64Decode(
+    PromiseFlatCString(aPersistentDescriptor).get(), dataSize, nullptr);
   if (!decodedData) {
     NS_ERROR("SetPersistentDescriptor was given bad data");
     return NS_ERROR_FAILURE;
   }
 
   // Cast to an alias record and resolve.
   AliasRecord aliasHeader = *(AliasPtr)decodedData;
   int32_t aliasSize = ::GetAliasSizeFromPtr(&aliasHeader);
@@ -1792,70 +1935,80 @@ nsLocalFile::SetPersistentDescriptor(con
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv = NS_OK;
 
   // Move the now-decoded data into the Handle.
   // The size of the decoded data is 3/4 the size of the encoded data. See plbase64.h
   Handle  newHandle = nullptr;
-  if (::PtrToHand(decodedData, &newHandle, aliasSize) != noErr)
+  if (::PtrToHand(decodedData, &newHandle, aliasSize) != noErr) {
     rv = NS_ERROR_OUT_OF_MEMORY;
+  }
   PR_Free(decodedData);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   Boolean changed;
   FSRef resolvedFSRef;
   OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef, &changed);
 
   rv = MacErrorMapper(err);
   DisposeHandle(newHandle);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   return InitWithFSRef(&resolvedFSRef);
 #else
   return InitWithNativePath(aPersistentDescriptor);
 #endif
 }
 
 NS_IMETHODIMP
 nsLocalFile::Reveal()
 {
 #ifdef MOZ_WIDGET_GTK
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
   nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
-  if (!giovfs && !gnomevfs)
+  if (!giovfs && !gnomevfs) {
     return NS_ERROR_FAILURE;
+  }
 
   bool isDirectory;
-  if (NS_FAILED(IsDirectory(&isDirectory)))
+  if (NS_FAILED(IsDirectory(&isDirectory))) {
     return NS_ERROR_FAILURE;
+  }
 
   if (isDirectory) {
-    if (giovfs)
+    if (giovfs) {
       return giovfs->ShowURIForInput(mPath);
-    else
+    } else
       /* Fallback to GnomeVFS */
+    {
       return gnomevfs->ShowURIForInput(mPath);
+    }
   } else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
     return NS_OK;
   } else {
     nsCOMPtr<nsIFile> parentDir;
     nsAutoCString dirPath;
-    if (NS_FAILED(GetParent(getter_AddRefs(parentDir))))
+    if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) {
       return NS_ERROR_FAILURE;
-    if (NS_FAILED(parentDir->GetNativePath(dirPath)))
+    }
+    if (NS_FAILED(parentDir->GetNativePath(dirPath))) {
       return NS_ERROR_FAILURE;
-
-    if (giovfs)
+    }
+
+    if (giovfs) {
       return giovfs->ShowURIForInput(dirPath);
-    else
+    } else {
       return gnomevfs->ShowURIForInput(dirPath);
+    }
   }
 #elif defined(MOZ_WIDGET_COCOA)
   CFURLRef url;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
     nsresult rv = CocoaFileUtils::RevealFileInFinder(url);
     ::CFRelease(url);
     return rv;
   }
@@ -1890,49 +2043,52 @@ nsLocalFile::Launch()
   }
 
   return NS_ERROR_FAILURE;
 #elif defined(MOZ_WIDGET_ANDROID)
   // Try to get a mimetype, if this fails just use the file uri alone
   nsresult rv;
   nsAutoCString type;
   nsCOMPtr<nsIMIMEService> mimeService(do_GetService("@mozilla.org/mime;1", &rv));
-  if (NS_SUCCEEDED(rv))
+  if (NS_SUCCEEDED(rv)) {
     rv = mimeService->GetTypeFromFile(this, type);
+  }
 
   nsAutoCString fileUri = NS_LITERAL_CSTRING("file://") + mPath;
-  return mozilla::widget::android::GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri),
+  return widget::android::GeckoAppShell::OpenUriExternal(
+    NS_ConvertUTF8toUTF16(fileUri),
     NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE;
 #elif defined(MOZ_WIDGET_COCOA)
   CFURLRef url;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
     nsresult rv = CocoaFileUtils::OpenURL(url);
     ::CFRelease(url);
     return rv;
   }
   return NS_ERROR_FAILURE;
 #else
   return NS_ERROR_FAILURE;
 #endif
 }
 
 nsresult
-NS_NewNativeLocalFile(const nsACString &path, bool followSymlinks, nsIFile **result)
+NS_NewNativeLocalFile(const nsACString& aPath, bool aFollowSymlinks,
+                      nsIFile** aResult)
 {
   nsRefPtr<nsLocalFile> file = new nsLocalFile();
 
-  file->SetFollowLinks(followSymlinks);
-
-  if (!path.IsEmpty()) {
-    nsresult rv = file->InitWithNativePath(path);
+  file->SetFollowLinks(aFollowSymlinks);
+
+  if (!aPath.IsEmpty()) {
+    nsresult rv = file->InitWithNativePath(aPath);
     if (NS_FAILED(rv)) {
       return rv;
     }
   }
-  file.forget(result);
+  file.forget(aResult);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // unicode support
 //-----------------------------------------------------------------------------
 
 #define SET_UCS(func, ucsArg) \
@@ -1958,77 +2114,78 @@ NS_NewNativeLocalFile(const nsACString &
         nsresult rv = NS_CopyUnicodeToNative(ucsArg, buf); \
         if (NS_FAILED(rv)) \
             return rv; \
         return (func)(opaqueArg, buf); \
     }
 
 // Unicode interface Wrapper
 nsresult
-nsLocalFile::InitWithPath(const nsAString &filePath)
+nsLocalFile::InitWithPath(const nsAString& aFilePath)
 {
-  SET_UCS(InitWithNativePath, filePath);
+  SET_UCS(InitWithNativePath, aFilePath);
 }
 nsresult
-nsLocalFile::Append(const nsAString &node)
+nsLocalFile::Append(const nsAString& aNode)
 {
-  SET_UCS(AppendNative, node);
+  SET_UCS(AppendNative, aNode);
 }
 nsresult
-nsLocalFile::AppendRelativePath(const nsAString &node)
+nsLocalFile::AppendRelativePath(const nsAString& aNode)
 {
-  SET_UCS(AppendRelativeNativePath, node);
+  SET_UCS(AppendRelativeNativePath, aNode);
 }
 nsresult
-nsLocalFile::GetLeafName(nsAString &aLeafName)
+nsLocalFile::GetLeafName(nsAString& aLeafName)
 {
   GET_UCS(GetNativeLeafName, aLeafName);
 }
 nsresult
-nsLocalFile::SetLeafName(const nsAString &aLeafName)
+nsLocalFile::SetLeafName(const nsAString& aLeafName)
 {
   SET_UCS(SetNativeLeafName, aLeafName);
 }
 nsresult
-nsLocalFile::GetPath(nsAString &_retval)
+nsLocalFile::GetPath(nsAString& aResult)
 {
-  return NS_CopyNativeToUnicode(mPath, _retval);
+  return NS_CopyNativeToUnicode(mPath, aResult);
+}
+nsresult
+nsLocalFile::CopyTo(nsIFile* aNewParentDir, const nsAString& aNewName)
+{
+  SET_UCS_2ARGS_2(CopyToNative , aNewParentDir, aNewName);
 }
 nsresult
-nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString &newName)
+nsLocalFile::CopyToFollowingLinks(nsIFile* aNewParentDir,
+                                  const nsAString& aNewName)
 {
-  SET_UCS_2ARGS_2(CopyToNative , newParentDir, newName);
+  SET_UCS_2ARGS_2(CopyToFollowingLinksNative , aNewParentDir, aNewName);
 }
 nsresult
-nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString &newName)
+nsLocalFile::MoveTo(nsIFile* aNewParentDir, const nsAString& aNewName)
 {
-  SET_UCS_2ARGS_2(CopyToFollowingLinksNative , newParentDir, newName);
-}
-nsresult
-nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString &newName)
-{
-  SET_UCS_2ARGS_2(MoveToNative, newParentDir, newName);
+  SET_UCS_2ARGS_2(MoveToNative, aNewParentDir, aNewName);
 }
 
 NS_IMETHODIMP
-nsLocalFile::RenameTo(nsIFile *newParentDir, const nsAString &newName)
+nsLocalFile::RenameTo(nsIFile* aNewParentDir, const nsAString& aNewName)
 {
   nsresult rv;
 
   // check to make sure that this has been initialized properly
   CHECK_mPath();
 
   // check to make sure that we have a new parent
   nsAutoCString newPathName;
   nsAutoCString newNativeName;
-  rv = NS_CopyUnicodeToNative(newName, newNativeName);
+  rv = NS_CopyUnicodeToNative(aNewName, newNativeName);
   if (NS_FAILED(rv)) {
     return rv;
   }
-  rv = GetNativeTargetPathName(newParentDir, newNativeName, newPathName);
+  rv = GetNativeTargetPathName(aNewParentDir, newNativeName, newPathName);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // try for atomic rename
   if (rename(mPath.get(), newPathName.get()) < 0) {
 #ifdef VMS
     if (errno == EXDEV || errno == ENXIO) {
@@ -2040,50 +2197,51 @@ nsLocalFile::RenameTo(nsIFile *newParent
       rv = NSRESULT_FOR_ERRNO();
     }
   }
 
   return rv;
 }
 
 nsresult
-nsLocalFile::GetTarget(nsAString &_retval)
+nsLocalFile::GetTarget(nsAString& aResult)
 {
-  GET_UCS(GetNativeTarget, _retval);
+  GET_UCS(GetNativeTarget, aResult);
 }
 
 // nsIHashable
 
 NS_IMETHODIMP
-nsLocalFile::Equals(nsIHashable* aOther, bool *aResult)
+nsLocalFile::Equals(nsIHashable* aOther, bool* aResult)
 {
   nsCOMPtr<nsIFile> otherFile(do_QueryInterface(aOther));
   if (!otherFile) {
     *aResult = false;
     return NS_OK;
   }
 
   return Equals(otherFile, aResult);
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetHashCode(uint32_t *aResult)
+nsLocalFile::GetHashCode(uint32_t* aResult)
 {
   *aResult = HashString(mPath);
   return NS_OK;
 }
 
 nsresult
-NS_NewLocalFile(const nsAString &path, bool followLinks, nsIFile* *result)
+NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult)
 {
   nsAutoCString buf;
-  nsresult rv = NS_CopyUnicodeToNative(path, buf);
-  if (NS_FAILED(rv))
+  nsresult rv = NS_CopyUnicodeToNative(aPath, buf);
+  if (NS_FAILED(rv)) {
     return rv;
-  return NS_NewNativeLocalFile(buf, followLinks, result);
+  }
+  return NS_NewNativeLocalFile(buf, aFollowLinks, aResult);
 }
 
 //-----------------------------------------------------------------------------
 // global init/shutdown
 //-----------------------------------------------------------------------------
 
 void
 nsLocalFile::GlobalInit()
@@ -2098,18 +2256,17 @@ nsLocalFile::GlobalShutdown()
 // nsILocalFileMac
 
 #ifdef MOZ_WIDGET_COCOA
 
 static nsresult MacErrorMapper(OSErr inErr)
 {
   nsresult outErr;
 
-  switch (inErr)
-  {
+  switch (inErr) {
     case noErr:
       outErr = NS_OK;
       break;
 
     case fnfErr:
     case afpObjectNotFound:
     case afpDirNotFound:
       outErr = NS_ERROR_FILE_NOT_FOUND;
@@ -2156,19 +2313,20 @@ static nsresult CFStringReftoUTF8(CFStri
   // first see if the conversion would succeed and find the length of the result
   CFIndex usedBufLen, inStrLen = ::CFStringGetLength(aInStrRef);
   CFIndex charsConverted = ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen),
                                               kCFStringEncodingUTF8, 0, false,
                                               nullptr, 0, &usedBufLen);
   if (charsConverted == inStrLen) {
     // all characters converted, do the actual conversion
     aOutStr.SetLength(usedBufLen);
-    if (aOutStr.Length() != (unsigned int)usedBufLen)
+    if (aOutStr.Length() != (unsigned int)usedBufLen) {
       return NS_ERROR_OUT_OF_MEMORY;
-    UInt8 *buffer = (UInt8*)aOutStr.BeginWriting();
+    }
+    UInt8* buffer = (UInt8*)aOutStr.BeginWriting();
     ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen), kCFStringEncodingUTF8,
                        0, false, buffer, usedBufLen, &usedBufLen);
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
 }
 
@@ -2180,104 +2338,110 @@ nsLocalFile::InitWithCFURL(CFURLRef aCFU
     nsDependentCString nativePath((char*)path);
     return InitWithNativePath(nativePath);
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsLocalFile::InitWithFSRef(const FSRef *aFSRef)
+nsLocalFile::InitWithFSRef(const FSRef* aFSRef)
 {
-  if (NS_WARN_IF(!aFSRef))
+  if (NS_WARN_IF(!aFSRef)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   CFURLRef newURLRef = ::CFURLCreateFromFSRef(kCFAllocatorDefault, aFSRef);
   if (newURLRef) {
     nsresult rv = InitWithCFURL(newURLRef);
     ::CFRelease(newURLRef);
     return rv;
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetCFURL(CFURLRef *_retval)
+nsLocalFile::GetCFURL(CFURLRef* aResult)
 {
   CHECK_mPath();
 
   bool isDir;
   IsDirectory(&isDir);
-  *_retval = ::CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
+  *aResult = ::CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
                                                        (UInt8*)mPath.get(),
                                                        mPath.Length(),
                                                        isDir);
 
-  return (*_retval ? NS_OK : NS_ERROR_FAILURE);
+  return (*aResult ? NS_OK : NS_ERROR_FAILURE);
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFSRef(FSRef *_retval)
+nsLocalFile::GetFSRef(FSRef* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsresult rv = NS_ERROR_FAILURE;
 
   CFURLRef url = nullptr;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
-    if (::CFURLGetFSRef(url, _retval)) {
+    if (::CFURLGetFSRef(url, aResult)) {
       rv = NS_OK;
     }
     ::CFRelease(url);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFSSpec(FSSpec *_retval)
+nsLocalFile::GetFSSpec(FSSpec* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   FSRef fsRef;
   nsresult rv = GetFSRef(&fsRef);
   if (NS_SUCCEEDED(rv)) {
-    OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, _retval, nullptr);
+    OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, aResult, nullptr);
     return MacErrorMapper(err);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFileSizeWithResFork(int64_t *aFileSizeWithResFork)
+nsLocalFile::GetFileSizeWithResFork(int64_t* aFileSizeWithResFork)
 {
-  if (NS_WARN_IF(!aFileSizeWithResFork))
+  if (NS_WARN_IF(!aFileSizeWithResFork)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   FSRef fsRef;
   nsresult rv = GetFSRef(&fsRef);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   FSCatalogInfo catalogInfo;
   OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoDataSizes + kFSCatInfoRsrcSizes,
                                  &catalogInfo, nullptr, nullptr, nullptr);
-  if (err != noErr)
+  if (err != noErr) {
     return MacErrorMapper(err);
+  }
 
   *aFileSizeWithResFork = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFileType(OSType *aFileType)
+nsLocalFile::GetFileType(OSType* aFileType)
 {
   CFURLRef url;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
     nsresult rv = CocoaFileUtils::GetFileTypeCode(url, aFileType);
     ::CFRelease(url);
     return rv;
   }
   return NS_ERROR_FAILURE;
@@ -2291,17 +2455,17 @@ nsLocalFile::SetFileType(OSType aFileTyp
     nsresult rv = CocoaFileUtils::SetFileTypeCode(url, aFileType);
     ::CFRelease(url);
     return rv;
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetFileCreator(OSType *aFileCreator)
+nsLocalFile::GetFileCreator(OSType* aFileCreator)
 {
   CFURLRef url;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
     nsresult rv = CocoaFileUtils::GetFileCreatorCode(url, aFileCreator);
     ::CFRelease(url);
     return rv;
   }
   return NS_ERROR_FAILURE;
@@ -2315,183 +2479,201 @@ nsLocalFile::SetFileCreator(OSType aFile
     nsresult rv = CocoaFileUtils::SetFileCreatorCode(url, aFileCreator);
     ::CFRelease(url);
     return rv;
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsLocalFile::LaunchWithDoc(nsIFile *aDocToLoad, bool aLaunchInBackground)
+nsLocalFile::LaunchWithDoc(nsIFile* aDocToLoad, bool aLaunchInBackground)
 {
   bool isExecutable;
   nsresult rv = IsExecutable(&isExecutable);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-  if (!isExecutable)
+  }
+  if (!isExecutable) {
     return NS_ERROR_FILE_EXECUTION_FAILED;
+  }
 
   FSRef appFSRef, docFSRef;
   rv = GetFSRef(&appFSRef);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   if (aDocToLoad) {
     nsCOMPtr<nsILocalFileMac> macDoc = do_QueryInterface(aDocToLoad);
     rv = macDoc->GetFSRef(&docFSRef);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
+    }
   }
 
   LSLaunchFlags theLaunchFlags = kLSLaunchDefaults;
   LSLaunchFSRefSpec thelaunchSpec;
 
-  if (aLaunchInBackground)
+  if (aLaunchInBackground) {
     theLaunchFlags |= kLSLaunchDontSwitch;
+  }
   memset(&thelaunchSpec, 0, sizeof(LSLaunchFSRefSpec));
 
   thelaunchSpec.appRef = &appFSRef;
   if (aDocToLoad) {
     thelaunchSpec.numDocs = 1;
     thelaunchSpec.itemRefs = &docFSRef;
   }
   thelaunchSpec.launchFlags = theLaunchFlags;
 
   OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
-  if (err != noErr)
+  if (err != noErr) {
     return MacErrorMapper(err);
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground)
+nsLocalFile::OpenDocWithApp(nsIFile* aAppToOpenWith, bool aLaunchInBackground)
 {
   FSRef docFSRef;
   nsresult rv = GetFSRef(&docFSRef);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   if (!aAppToOpenWith) {
     OSErr err = ::LSOpenFSRef(&docFSRef, nullptr);
     return MacErrorMapper(err);
   }
 
   nsCOMPtr<nsILocalFileMac> appFileMac = do_QueryInterface(aAppToOpenWith, &rv);
-  if (!appFileMac)
+  if (!appFileMac) {
     return rv;
+  }
 
   bool isExecutable;
   rv = appFileMac->IsExecutable(&isExecutable);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-  if (!isExecutable)
+  }
+  if (!isExecutable) {
     return NS_ERROR_FILE_EXECUTION_FAILED;
+  }
 
   FSRef appFSRef;
   rv = appFileMac->GetFSRef(&appFSRef);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   LSLaunchFlags theLaunchFlags = kLSLaunchDefaults;
   LSLaunchFSRefSpec thelaunchSpec;
 
-  if (aLaunchInBackground)
+  if (aLaunchInBackground) {
     theLaunchFlags |= kLSLaunchDontSwitch;
+  }
   memset(&thelaunchSpec, 0, sizeof(LSLaunchFSRefSpec));
 
   thelaunchSpec.appRef = &appFSRef;
   thelaunchSpec.numDocs = 1;
   thelaunchSpec.itemRefs = &docFSRef;
   thelaunchSpec.launchFlags = theLaunchFlags;
 
   OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
-  if (err != noErr)
+  if (err != noErr) {
     return MacErrorMapper(err);
+  }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::IsPackage(bool *_retval)
+nsLocalFile::IsPackage(bool* aResult)
 {
-  if (NS_WARN_IF(!_retval))
+  if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
-  *_retval = false;
+  }
+  *aResult = false;
 
   CFURLRef url;
   nsresult rv = GetCFURL(&url);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   LSItemInfoRecord info;
   OSStatus status = ::LSCopyItemInfoForURL(url, kLSRequestBasicFlagsOnly, &info);
 
   ::CFRelease(url);
 
   if (status != noErr) {
     return NS_ERROR_FAILURE;
   }
 
-  *_retval = !!(info.flags & kLSItemInfoIsPackage);
+  *aResult = !!(info.flags & kLSItemInfoIsPackage);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetBundleDisplayName(nsAString& outBundleName)
+nsLocalFile::GetBundleDisplayName(nsAString& aOutBundleName)
 {
   bool isPackage = false;
   nsresult rv = IsPackage(&isPackage);
-  if (NS_FAILED(rv) || !isPackage)
+  if (NS_FAILED(rv) || !isPackage) {
     return NS_ERROR_FAILURE;
+  }
 
   nsAutoString name;
   rv = GetLeafName(name);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   int32_t length = name.Length();
   if (Substring(name, length - 4, length).EqualsLiteral(".app")) {
     // 4 characters in ".app"
-    outBundleName = Substring(name, 0, length - 4);
-  }
-  else {
-    outBundleName = name;
+    aOutBundleName = Substring(name, 0, length - 4);
+  } else {
+    aOutBundleName = name;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
+nsLocalFile::GetBundleIdentifier(nsACString& aOutBundleIdentifier)
 {
   nsresult rv = NS_ERROR_FAILURE;
 
   CFURLRef urlRef;
   if (NS_SUCCEEDED(GetCFURL(&urlRef))) {
     CFBundleRef bundle = ::CFBundleCreate(nullptr, urlRef);
     if (bundle) {
       CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle);
-      if (bundleIdentifier)
-        rv = CFStringReftoUTF8(bundleIdentifier, outBundleIdentifier);
+      if (bundleIdentifier) {
+        rv = CFStringReftoUTF8(bundleIdentifier, aOutBundleIdentifier);
+      }
       ::CFRelease(bundle);
     }
     ::CFRelease(urlRef);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocalFile::GetBundleContentsLastModifiedTime(int64_t *aLastModTime)
+nsLocalFile::GetBundleContentsLastModifiedTime(int64_t* aLastModTime)
 {
   CHECK_mPath();
-  if (NS_WARN_IF(!aLastModTime))
+  if (NS_WARN_IF(!aLastModTime)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   bool isPackage = false;
   nsresult rv = IsPackage(&isPackage);
   if (NS_FAILED(rv) || !isPackage) {
     return GetLastModifiedTime(aLastModTime);
   }
 
   nsAutoCString infoPlistPath(mPath);
@@ -2505,52 +2687,56 @@ nsLocalFile::GetBundleContentsLastModifi
     *aLastModTime = 0;
   } else {
     *aLastModTime = modTime / int64_t(PR_USEC_PER_MSEC);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsLocalFile::InitWithFile(nsIFile *aFile)
+NS_IMETHODIMP nsLocalFile::InitWithFile(nsIFile* aFile)
 {
-  if (NS_WARN_IF(!aFile))
+  if (NS_WARN_IF(!aFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsAutoCString nativePath;
   nsresult rv = aFile->GetNativePath(nativePath);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   return InitWithNativePath(nativePath);
 }
 
 nsresult
-NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowLinks, nsILocalFileMac** result)
+NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowLinks,
+                         nsILocalFileMac** aResult)
 {
   nsRefPtr<nsLocalFile> file = new nsLocalFile();
 
   file->SetFollowLinks(aFollowLinks);
 
   nsresult rv = file->InitWithFSRef(aFSRef);
   if (NS_FAILED(rv)) {
     return rv;
   }
-  file.forget(result);
+  file.forget(aResult);
   return NS_OK;
 }
 
 nsresult
-NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowLinks, nsILocalFileMac** result)
+NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowLinks,
+                         nsILocalFileMac** aResult)
 {
   nsRefPtr<nsLocalFile> file = new nsLocalFile();
 
   file->SetFollowLinks(aFollowLinks);
 
   nsresult rv = file->InitWithCFURL(aURL);
   if (NS_FAILED(rv)) {
     return rv;
   }
-  file.forget(result);
+  file.forget(aResult);
   return NS_OK;
 }
 
 #endif
--- a/xpcom/io/nsLocalFileUnix.h
+++ b/xpcom/io/nsLocalFileUnix.h
@@ -74,61 +74,65 @@
   #define LSTAT lstat64
   #define HAVE_STATS64 1
 #else
   #define STAT stat
   #define LSTAT lstat
 #endif
 
 
-class nsLocalFile MOZ_FINAL :
+class nsLocalFile MOZ_FINAL
 #ifdef MOZ_WIDGET_COCOA
-  public nsILocalFileMac,
+  : public nsILocalFileMac
 #else
-  public nsILocalFile,
+  : public nsILocalFile
 #endif
-  public nsIHashable
+  , public nsIHashable
 {
 public:
   NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
 
   nsLocalFile();
 
-  static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
+  static nsresult nsLocalFileConstructor(nsISupports* aOuter,
+                                         const nsIID& aIID,
+                                         void** aInstancePtr);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIFILE
   NS_DECL_NSILOCALFILE
 #ifdef MOZ_WIDGET_COCOA
   NS_DECL_NSILOCALFILEMAC
 #endif
   NS_DECL_NSIHASHABLE
 
 public:
   static void GlobalInit();
   static void GlobalShutdown();
 
 private:
-  nsLocalFile(const nsLocalFile& other);
-  ~nsLocalFile() {}
+  nsLocalFile(const nsLocalFile& aOther);
+  ~nsLocalFile()
+  {
+  }
 
 protected:
   // This stat cache holds the *last stat* - it does not invalidate.
   // Call "FillStatCache" whenever you want to stat our file.
   struct STAT  mCachedStat;
   nsCString    mPath;
 
-  void LocateNativeLeafName(nsACString::const_iterator &,
-                            nsACString::const_iterator &);
+  void LocateNativeLeafName(nsACString::const_iterator&,
+                            nsACString::const_iterator&);
 
-  nsresult CopyDirectoryTo(nsIFile *newParent);
-  nsresult CreateAllAncestors(uint32_t permissions);
-  nsresult GetNativeTargetPathName(nsIFile *newParent,
-                                   const nsACString &newName,
-                                   nsACString &_retval);
+  nsresult CopyDirectoryTo(nsIFile* aNewParent);
+  nsresult CreateAllAncestors(uint32_t aPermissions);
+  nsresult GetNativeTargetPathName(nsIFile* aNewParent,
+                                   const nsACString& aNewName,
+                                   nsACString& aResult);
 
   bool FillStatCache();
 
-  nsresult CreateAndKeepOpen(uint32_t type, int flags,
-                             uint32_t permissions, PRFileDesc **_retval);
+  nsresult CreateAndKeepOpen(uint32_t aType, int aFlags,
+                             uint32_t aPermissions, PRFileDesc** aResult);
 };
 
 #endif /* _nsLocalFileUNIX_H_ */
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -82,17 +82,18 @@ class AsyncLocalFileWinDone : public nsR
 public:
   AsyncLocalFileWinDone() :
     mWorkerThread(do_GetCurrentThread())
   {
     // Objects of this type must only be created on worker threads
     MOZ_ASSERT(!NS_IsMainThread());
   }
 
-  NS_IMETHOD Run() {
+  NS_IMETHOD Run()
+  {
     // This event shuts down the worker thread and so must be main thread.
     MOZ_ASSERT(NS_IsMainThread());
 
     // If we don't destroy the thread when we're done with it, it will hang
     // around forever... and that is bad!
     mWorkerThread->Shutdown();
     return NS_OK;
   }
@@ -106,28 +107,29 @@ private:
  * be performed.
 */
 class AsyncLocalFileWinOperation : public nsRunnable
 {
 public:
   enum FileOp { RevealOp, LaunchOp };
 
   AsyncLocalFileWinOperation(AsyncLocalFileWinOperation::FileOp aOperation,
-                             const nsAString &aResolvedPath) :
+                             const nsAString& aResolvedPath) :
     mOperation(aOperation),
     mResolvedPath(aResolvedPath)
   {
   }
 
-  NS_IMETHOD Run() {
+  NS_IMETHOD Run()
+  {
     MOZ_ASSERT(!NS_IsMainThread(),
                "AsyncLocalFileWinOperation should not be run on the main thread!");
 
     CoInitialize(nullptr);
-    switch(mOperation) {
+    switch (mOperation) {
       case RevealOp: {
         Reveal();
       }
       break;
       case LaunchOp: {
         Launch();
       }
       break;
@@ -147,17 +149,17 @@ private:
     DWORD attributes = GetFileAttributesW(mResolvedPath.get());
     if (INVALID_FILE_ATTRIBUTES == attributes) {
       return NS_ERROR_FILE_INVALID_PATH;
     }
 
     HRESULT hr;
     if (attributes & FILE_ATTRIBUTE_DIRECTORY) {
       // We have a directory so we should open the directory itself.
-      ITEMIDLIST *dir = ILCreateFromPathW(mResolvedPath.get());
+      ITEMIDLIST* dir = ILCreateFromPathW(mResolvedPath.get());
       if (!dir) {
         return NS_ERROR_FAILURE;
       }
 
       const ITEMIDLIST* selection[] = { dir };
       UINT count = ArrayLength(selection);
 
       //Perform the open of the directory.
@@ -170,23 +172,23 @@ private:
       if (len > MAX_PATH) {
         return NS_ERROR_FILE_INVALID_PATH;
       }
       WCHAR parentDirectoryPath[MAX_PATH + 1] = { 0 };
       wcsncpy(parentDirectoryPath, mResolvedPath.get(), MAX_PATH);
       PathRemoveFileSpecW(parentDirectoryPath);
 
       // We have a file so we should open the parent directory.
-      ITEMIDLIST *dir = ILCreateFromPathW(parentDirectoryPath);
+      ITEMIDLIST* dir = ILCreateFromPathW(parentDirectoryPath);
       if (!dir) {
         return NS_ERROR_FAILURE;
       }
 
       // Set the item in the directory to select to the file we want to reveal.
-      ITEMIDLIST *item = ILCreateFromPathW(mResolvedPath.get());
+      ITEMIDLIST* item = ILCreateFromPathW(mResolvedPath.get());
       if (!item) {
         CoTaskMemFree(dir);
         return NS_ERROR_FAILURE;
       }
 
       const ITEMIDLIST* selection[] = { item };
       UINT count = ArrayLength(selection);
 
@@ -235,18 +237,19 @@ private:
     // if the file has no association, we launch windows'
     // "what do you want to do" dialog
     if (r == SE_ERR_NOASSOC) {
       nsAutoString shellArg;
       shellArg.Assign(NS_LITERAL_STRING("shell32.dll,OpenAs_RunDLL ") +
                       mResolvedPath);
       seinfo.lpFile = L"RUNDLL32.EXE";
       seinfo.lpParameters = shellArg.get();
-      if (ShellExecuteExW(&seinfo))
+      if (ShellExecuteExW(&seinfo)) {
         return NS_OK;
+      }
       r = GetLastError();
     }
     if (r < 32) {
       switch (r) {
         case 0:
         case SE_ERR_OOM:
           return NS_ERROR_OUT_OF_MEMORY;
         case ERROR_FILE_NOT_FOUND:
@@ -307,25 +310,25 @@ private:
 class ShortcutResolver
 {
 public:
   ShortcutResolver();
   // nonvirtual since we're not subclassed
   ~ShortcutResolver();
 
   nsresult Init();
-  nsresult Resolve(const WCHAR* in, WCHAR* out);
-  nsresult SetShortcut(bool updateExisting,
-                       const WCHAR* shortcutPath,
-                       const WCHAR* targetPath,
-                       const WCHAR* workingDir,
-                       const WCHAR* args,
-                       const WCHAR* description,
-                       const WCHAR* iconFile,
-                       int32_t iconIndex);
+  nsresult Resolve(const WCHAR* aIn, WCHAR* aOut);
+  nsresult SetShortcut(bool aUpdateExisting,
+                       const WCHAR* aShortcutPath,
+                       const WCHAR* aTargetPath,
+                       const WCHAR* aWorkingDir,
+                       const WCHAR* aArgs,
+                       const WCHAR* aDescription,
+                       const WCHAR* aIconFile,
+                       int32_t aIconIndex);
 
 private:
   Mutex                  mLock;
   nsRefPtr<IPersistFile> mPersistFile;
   nsRefPtr<IShellLinkW>  mShellLink;
 };
 
 ShortcutResolver::ShortcutResolver() :
@@ -353,130 +356,135 @@ ShortcutResolver::Init()
     mShellLink = nullptr;
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 // |out| must be an allocated buffer of size MAX_PATH
 nsresult
-ShortcutResolver::Resolve(const WCHAR* in, WCHAR* out)
+ShortcutResolver::Resolve(const WCHAR* aIn, WCHAR* aOut)
 {
-  if (!mShellLink)
+  if (!mShellLink) {
     return NS_ERROR_FAILURE;
+  }
 
   MutexAutoLock lock(mLock);
 
-  if (FAILED(mPersistFile->Load(in, STGM_READ)) ||
+  if (FAILED(mPersistFile->Load(aIn, STGM_READ)) ||
       FAILED(mShellLink->Resolve(nullptr, SLR_NO_UI)) ||
-      FAILED(mShellLink->GetPath(out, MAX_PATH, nullptr, SLGP_UNCPRIORITY)))
+      FAILED(mShellLink->GetPath(aOut, MAX_PATH, nullptr, SLGP_UNCPRIORITY))) {
     return NS_ERROR_FAILURE;
+  }
   return NS_OK;
 }
 
 nsresult
-ShortcutResolver::SetShortcut(bool updateExisting,
-                              const WCHAR* shortcutPath,
-                              const WCHAR* targetPath,
-                              const WCHAR* workingDir,
-                              const WCHAR* args,
-                              const WCHAR* description,
-                              const WCHAR* iconPath,
-                              int32_t iconIndex)
+ShortcutResolver::SetShortcut(bool aUpdateExisting,
+                              const WCHAR* aShortcutPath,
+                              const WCHAR* aTargetPath,
+                              const WCHAR* aWorkingDir,
+                              const WCHAR* aArgs,
+                              const WCHAR* aDescription,
+                              const WCHAR* aIconPath,
+                              int32_t aIconIndex)
 {
   if (!mShellLink) {
     return NS_ERROR_FAILURE;
   }
 
-  if (!shortcutPath) {
+  if (!aShortcutPath) {
     return NS_ERROR_FAILURE;
   }
 
   MutexAutoLock lock(mLock);
 
-  if (updateExisting) {
-    if (FAILED(mPersistFile->Load(shortcutPath, STGM_READWRITE))) {
+  if (aUpdateExisting) {
+    if (FAILED(mPersistFile->Load(aShortcutPath, STGM_READWRITE))) {
       return NS_ERROR_FAILURE;
     }
   } else {
-    if (!targetPath) {
+    if (!aTargetPath) {
       return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
     }
 
     // Since we reuse our IPersistFile, we have to clear out any values that
     // may be left over from previous calls to SetShortcut.
     if (FAILED(mShellLink->SetWorkingDirectory(L""))
         || FAILED(mShellLink->SetArguments(L""))
         || FAILED(mShellLink->SetDescription(L""))
         || FAILED(mShellLink->SetIconLocation(L"", 0))) {
       return NS_ERROR_FAILURE;
     }
   }
 
-  if (targetPath && FAILED(mShellLink->SetPath(targetPath))) {
+  if (aTargetPath && FAILED(mShellLink->SetPath(aTargetPath))) {
     return NS_ERROR_FAILURE;
   }
 
-  if (workingDir && FAILED(mShellLink->SetWorkingDirectory(workingDir))) {
+  if (aWorkingDir && FAILED(mShellLink->SetWorkingDirectory(aWorkingDir))) {
     return NS_ERROR_FAILURE;
   }
 
-  if (args && FAILED(mShellLink->SetArguments(args))) {
+  if (aArgs && FAILED(mShellLink->SetArguments(aArgs))) {
     return NS_ERROR_FAILURE;
   }
 
-  if (description && FAILED(mShellLink->SetDescription(description))) {
+  if (aDescription && FAILED(mShellLink->SetDescription(aDescription))) {
     return NS_ERROR_FAILURE;
   }
 
-  if (iconPath && FAILED(mShellLink->SetIconLocation(iconPath, iconIndex))) {
+  if (aIconPath && FAILED(mShellLink->SetIconLocation(aIconPath, aIconIndex))) {
     return NS_ERROR_FAILURE;
   }
 
-  if (FAILED(mPersistFile->Save(shortcutPath,
+  if (FAILED(mPersistFile->Save(aShortcutPath,
                                 TRUE))) {
     // Second argument indicates whether the file path specified in the
     // first argument should become the "current working file" for this
     // IPersistFile
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
-static ShortcutResolver * gResolver = nullptr;
-
-static nsresult NS_CreateShortcutResolver()
+static ShortcutResolver* gResolver = nullptr;
+
+static nsresult
+NS_CreateShortcutResolver()
 {
   gResolver = new ShortcutResolver();
-  if (!gResolver)
+  if (!gResolver) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   return gResolver->Init();
 }
 
-static void NS_DestroyShortcutResolver()
+static void
+NS_DestroyShortcutResolver()
 {
   delete gResolver;
   gResolver = nullptr;
 }
 
 
 //-----------------------------------------------------------------------------
 // static helper functions
 //-----------------------------------------------------------------------------
 
 // certainly not all the error that can be
 // encountered, but many of them common ones
-static nsresult ConvertWinError(DWORD winErr)
+static nsresult
+ConvertWinError(DWORD aWinErr)
 {
   nsresult rv;
 
-  switch (winErr)
-  {
+  switch (aWinErr) {
     case ERROR_FILE_NOT_FOUND:
     case ERROR_PATH_NOT_FOUND:
     case ERROR_INVALID_DRIVE:
       rv = NS_ERROR_FILE_NOT_FOUND;
       break;
     case ERROR_ACCESS_DENIED:
     case ERROR_NOT_SAME_DEVICE:
       rv = NS_ERROR_FILE_ACCESS_DENIED;
@@ -524,33 +532,32 @@ static nsresult ConvertWinError(DWORD wi
 // as suggested in the MSDN documentation on SetFilePointer
 static __int64
 MyFileSeek64(HANDLE aHandle, __int64 aDistance, DWORD aMoveMethod)
 {
   LARGE_INTEGER li;
 
   li.QuadPart = aDistance;
   li.LowPart = SetFilePointer(aHandle, li.LowPart, &li.HighPart, aMoveMethod);
-  if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
-  {
+  if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) {
     li.QuadPart = -1;
   }
 
   return li.QuadPart;
 }
 
 static bool
-IsShortcutPath(const nsAString &path)
+IsShortcutPath(const nsAString& aPath)
 {
   // Under Windows, the shortcuts are just files with a ".lnk" extension.
   // Note also that we don't resolve links in the middle of paths.
   // i.e. "c:\foo.lnk\bar.txt" is invalid.
-  NS_ABORT_IF_FALSE(!path.IsEmpty(), "don't pass an empty string");
-  int32_t len = path.Length();
-  return len >= 4 && (StringTail(path, 4).LowerCaseEqualsASCII(".lnk"));
+  NS_ABORT_IF_FALSE(!aPath.IsEmpty(), "don't pass an empty string");
+  int32_t len = aPath.Length();
+  return len >= 4 && (StringTail(aPath, 4).LowerCaseEqualsASCII(".lnk"));
 }
 
 //-----------------------------------------------------------------------------
 // We need the following three definitions to make |OpenFile| convert a file
 // handle to an NSPR file descriptor correctly when |O_APPEND| flag is
 // specified. It is defined in a private header of NSPR (primpl.h) we can't
 // include. As a temporary workaround until we decide how to extend
 // |PR_ImportFile|, we define it here. Currently, |_PR_HAVE_PEEK_BUFFER|
@@ -562,25 +569,27 @@ IsShortcutPath(const nsAString &path)
 // need to be changed to match the definitions for WinNT.
 //-----------------------------------------------------------------------------
 typedef enum {
   _PR_TRI_TRUE = 1,
   _PR_TRI_FALSE = 0,
   _PR_TRI_UNKNOWN = -1
 } _PRTriStateBool;
 
-struct _MDFileDesc {
+struct _MDFileDesc
+{
   PROsfd osfd;
 };
 
-struct PRFilePrivate {
+struct PRFilePrivate
+{
   int32_t state;
   bool nonblocking;
   _PRTriStateBool inheritable;
-  PRFileDesc *next;
+  PRFileDesc* next;
   int lockCount;      /*   0: not locked
                        *  -1: a native lockfile call is in progress
                        * > 0: # times the file is locked */
   bool    appendMode;
   _MDFileDesc md;
 };
 
 //-----------------------------------------------------------------------------
@@ -589,355 +598,377 @@ struct PRFilePrivate {
 // UTF-16 APIs are implemented on all the supported platforms (or at least
 // Windows 9x/ME) in NSPR. Currently, they're only implemented on
 // Windows NT4 or later. (bug 330665)
 //-----------------------------------------------------------------------------
 
 // copied from nsprpub/pr/src/{io/prfile.c | md/windows/w95io.c} :
 // PR_Open and _PR_MD_OPEN
 nsresult
-OpenFile(const nsAFlatString &name, int osflags, int mode,
-         PRFileDesc **fd)
+OpenFile(const nsAFlatString& aName, int aOsflags, int aMode, PRFileDesc** aFd)
 {
   int32_t access = 0;
 
   int32_t disposition = 0;
   int32_t attributes = 0;
 
-  if (osflags & PR_SYNC)
+  if (aOsflags & PR_SYNC) {
     attributes = FILE_FLAG_WRITE_THROUGH;
-  if (osflags & PR_RDONLY || osflags & PR_RDWR)
+  }
+  if (aOsflags & PR_RDONLY || aOsflags & PR_RDWR) {
     access |= GENERIC_READ;
-  if (osflags & PR_WRONLY || osflags & PR_RDWR)
+  }
+  if (aOsflags & PR_WRONLY || aOsflags & PR_RDWR) {
     access |= GENERIC_WRITE;
-
-  if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL )
+  }
+
+  if (aOsflags & PR_CREATE_FILE && aOsflags & PR_EXCL) {
     disposition = CREATE_NEW;
-  else if (osflags & PR_CREATE_FILE) {
-    if (osflags & PR_TRUNCATE)
+  } else if (aOsflags & PR_CREATE_FILE) {
+    if (aOsflags & PR_TRUNCATE) {
       disposition = CREATE_ALWAYS;
-    else
+    } else {
       disposition = OPEN_ALWAYS;
+    }
   } else {
-    if (osflags & PR_TRUNCATE)
+    if (aOsflags & PR_TRUNCATE) {
       disposition = TRUNCATE_EXISTING;
-    else
+    } else {
       disposition = OPEN_EXISTING;
+    }
   }
 
-  if (osflags & nsIFile::DELETE_ON_CLOSE) {
+  if (aOsflags & nsIFile::DELETE_ON_CLOSE) {
     attributes |= FILE_FLAG_DELETE_ON_CLOSE;
   }
 
-  if (osflags & nsIFile::OS_READAHEAD) {
+  if (aOsflags & nsIFile::OS_READAHEAD) {
     attributes |= FILE_FLAG_SEQUENTIAL_SCAN;
   }
 
   // If no write permissions are requested, and if we are possibly creating
   // the file, then set the new file as read only.
   // The flag has no effect if we happen to open the file.
-  if (!(mode & (PR_IWUSR | PR_IWGRP | PR_IWOTH)) &&
+  if (!(aMode & (PR_IWUSR | PR_IWGRP | PR_IWOTH)) &&
       disposition != OPEN_EXISTING) {
     attributes |= FILE_ATTRIBUTE_READONLY;
   }
 
-  HANDLE file = ::CreateFileW(name.get(), access,
-                              FILE_SHARE_READ|FILE_SHARE_WRITE,
+  HANDLE file = ::CreateFileW(aName.get(), access,
+                              FILE_SHARE_READ | FILE_SHARE_WRITE,
                               nullptr, disposition, attributes, nullptr);
 
   if (file == INVALID_HANDLE_VALUE) {
-    *fd = nullptr;
+    *aFd = nullptr;
     return ConvertWinError(GetLastError());
   }
 
-  *fd = PR_ImportFile((PROsfd) file);
-  if (*fd) {
+  *aFd = PR_ImportFile((PROsfd) file);
+  if (*aFd) {
     // On Windows, _PR_HAVE_O_APPEND is not defined so that we have to
     // add it manually. (see |PR_Open| in nsprpub/pr/src/io/prfile.c)
-    (*fd)->secret->appendMode = (PR_APPEND & osflags) ? true : false;
+    (*aFd)->secret->appendMode = (PR_APPEND & aOsflags) ? true : false;
     return NS_OK;
   }
 
   nsresult rv = NS_ErrorAccordingToNSPR();
 
   CloseHandle(file);
 
   return rv;
 }
 
 // copied from nsprpub/pr/src/{io/prfile.c | md/windows/w95io.c} :
 // PR_FileTimeToPRTime and _PR_FileTimeToPRTime
-static
-void FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm)
+static void
+FileTimeToPRTime(const FILETIME* aFiletime, PRTime* aPrtm)
 {
 #ifdef __GNUC__
   const PRTime _pr_filetime_offset = 116444736000000000LL;
 #else
   const PRTime _pr_filetime_offset = 116444736000000000i64;
 #endif
 
   PR_ASSERT(sizeof(FILETIME) == sizeof(PRTime));
-  ::CopyMemory(prtm, filetime, sizeof(PRTime));
+  ::CopyMemory(aPrtm, aFiletime, sizeof(PRTime));
 #ifdef __GNUC__
-  *prtm = (*prtm - _pr_filetime_offset) / 10LL;
+  *aPrtm = (*aPrtm - _pr_filetime_offset) / 10LL;
 #else
-  *prtm = (*prtm - _pr_filetime_offset) / 10i64;
+  *aPrtm = (*aPrtm - _pr_filetime_offset) / 10i64;
 #endif
 }
 
 // copied from nsprpub/pr/src/{io/prfile.c | md/windows/w95io.c} with some
 // changes : PR_GetFileInfo64, _PR_MD_GETFILEINFO64
 static nsresult
-GetFileInfo(const nsAFlatString &name, PRFileInfo64 *info)
+GetFileInfo(const nsAFlatString& aName, PRFileInfo64* aInfo)
 {
   WIN32_FILE_ATTRIBUTE_DATA fileData;
 
-  if (name.IsEmpty() || name.FindCharInSet(MOZ_UTF16("?*")) != kNotFound)
+  if (aName.IsEmpty() || aName.FindCharInSet(MOZ_UTF16("?*")) != kNotFound) {
     return NS_ERROR_INVALID_ARG;
-
-  if (!::GetFileAttributesExW(name.get(), GetFileExInfoStandard, &fileData))
+  }
+
+  if (!::GetFileAttributesExW(aName.get(), GetFileExInfoStandard, &fileData)) {
     return ConvertWinError(GetLastError());
+  }
 
   if (fileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-    info->type = PR_FILE_DIRECTORY;
+    aInfo->type = PR_FILE_DIRECTORY;
   } else {
-    info->type = PR_FILE_FILE;
+    aInfo->type = PR_FILE_FILE;
   }
 
-  info->size = fileData.nFileSizeHigh;
-  info->size = (info->size << 32) + fileData.nFileSizeLow;
-
-  FileTimeToPRTime(&fileData.ftLastWriteTime, &info->modifyTime);
+  aInfo->size = fileData.nFileSizeHigh;
+  aInfo->size = (aInfo->size << 32) + fileData.nFileSizeLow;
+
+  FileTimeToPRTime(&fileData.ftLastWriteTime, &aInfo->modifyTime);
 
   if (0 == fileData.ftCreationTime.dwLowDateTime &&
       0 == fileData.ftCreationTime.dwHighDateTime) {
-    info->creationTime = info->modifyTime;
+    aInfo->creationTime = aInfo->modifyTime;
   } else {
-    FileTimeToPRTime(&fileData.ftCreationTime, &info->creationTime);
+    FileTimeToPRTime(&fileData.ftCreationTime, &aInfo->creationTime);
   }
 
   return NS_OK;
 }
 
 struct nsDir
 {
   HANDLE handle;
   WIN32_FIND_DATAW data;
   bool firstEntry;
 };
 
 static nsresult
-OpenDir(const nsAFlatString &name, nsDir * *dir)
+OpenDir(const nsAFlatString& aName, nsDir** aDir)
 {
-  if (NS_WARN_IF(!dir))
+  if (NS_WARN_IF(!aDir)) {
     return NS_ERROR_INVALID_ARG;
-
-  *dir = nullptr;
-  if (name.Length() + 3 >= MAX_PATH)
+  }
+
+  *aDir = nullptr;
+  if (aName.Length() + 3 >= MAX_PATH) {
     return NS_ERROR_FILE_NAME_TOO_LONG;
-
-  nsDir *d  = PR_NEW(nsDir);
-  if (!d)
+  }
+
+  nsDir* d  = PR_NEW(nsDir);
+  if (!d) {
     return NS_ERROR_OUT_OF_MEMORY;
-
-  nsAutoString filename(name);
-
-  //If 'name' ends in a slash or backslash, do not append
-  //another backslash.
-  if (filename.Last() == L'/' || filename.Last() == L'\\')
+  }
+
+  nsAutoString filename(aName);
+
+  // If |aName| ends in a slash or backslash, do not append another backslash.
+  if (filename.Last() == L'/' || filename.Last() == L'\\') {
     filename.Append('*');
-  else
+  } else {
     filename.AppendLiteral("\\*");
+  }
 
   filename.ReplaceChar(L'/', L'\\');
 
   // FindFirstFileW Will have a last error of ERROR_DIRECTORY if
   // <file_path>\* is passed in.  If <unknown_path>\* is passed in then
   // ERROR_PATH_NOT_FOUND will be the last error.
-  d->handle = ::FindFirstFileW(filename.get(), &(d->data) );
+  d->handle = ::FindFirstFileW(filename.get(), &(d->data));
 
   if (d->handle == INVALID_HANDLE_VALUE) {
     PR_Free(d);
     return ConvertWinError(GetLastError());
   }
   d->firstEntry = true;
 
-  *dir = d;
+  *aDir = d;
   return NS_OK;
 }
 
 static nsresult
-ReadDir(nsDir *dir, PRDirFlags flags, nsString& name)
+ReadDir(nsDir* aDir, PRDirFlags aFlags, nsString& aName)
 {
-  name.Truncate();
-  if (NS_WARN_IF(!dir))
+  aName.Truncate();
+  if (NS_WARN_IF(!aDir)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   while (1) {
     BOOL rv;
-    if (dir->firstEntry)
-    {
-      dir->firstEntry = false;
+    if (aDir->firstEntry) {
+      aDir->firstEntry = false;
       rv = 1;
-    } else
-      rv = ::FindNextFileW(dir->handle, &(dir->data));
-
-    if (rv == 0)
+    } else {
+      rv = ::FindNextFileW(aDir->handle, &(aDir->data));
+    }
+
+    if (rv == 0) {
       break;
-
-    const wchar_t *fileName;
+    }
+
+    const wchar_t* fileName;
     nsString tmp;
-    fileName = (dir)->data.cFileName;
-
-    if ((flags & PR_SKIP_DOT) &&
-        (fileName[0] == L'.') && (fileName[1] == L'\0'))
+    fileName = (aDir)->data.cFileName;
+
+    if ((aFlags & PR_SKIP_DOT) &&
+        (fileName[0] == L'.') && (fileName[1] == L'\0')) {
       continue;
-    if ((flags & PR_SKIP_DOT_DOT) &&
+    }
+    if ((aFlags & PR_SKIP_DOT_DOT) &&
         (fileName[0] == L'.') && (fileName[1] == L'.') &&
-        (fileName[2] == L'\0'))
+        (fileName[2] == L'\0')) {
       continue;
-
-    DWORD attrib =  dir->data.dwFileAttributes;
-    if ((flags & PR_SKIP_HIDDEN) && (attrib & FILE_ATTRIBUTE_HIDDEN))
+    }
+
+    DWORD attrib =  aDir->data.dwFileAttributes;
+    if ((aFlags & PR_SKIP_HIDDEN) && (attrib & FILE_ATTRIBUTE_HIDDEN)) {
       continue;
-
-    if (fileName == tmp.get())
-      name = tmp;
-    else
-      name = fileName;
+    }
+
+    if (fileName == tmp.get()) {
+      aName = tmp;
+    } else {
+      aName = fileName;
+    }
     return NS_OK;
   }
 
   DWORD err = GetLastError();
   return err == ERROR_NO_MORE_FILES ? NS_OK : ConvertWinError(err);
 }
 
 static nsresult
-CloseDir(nsDir *&d)
+CloseDir(nsDir*& aDir)
 {
-  if (NS_WARN_IF(!d))
+  if (NS_WARN_IF(!aDir)) {
     return NS_ERROR_INVALID_ARG;
-
-  BOOL isOk = FindClose(d->handle);
+  }
+
+  BOOL isOk = FindClose(aDir->handle);
   // PR_DELETE also nulls out the passed in pointer.
-  PR_DELETE(d);
+  PR_DELETE(aDir);
   return isOk ? NS_OK : ConvertWinError(GetLastError());
 }
 
 //-----------------------------------------------------------------------------
 // nsDirEnumerator
 //-----------------------------------------------------------------------------
 
-class nsDirEnumerator MOZ_FINAL : public nsISimpleEnumerator,
-  public nsIDirectoryEnumerator
+class nsDirEnumerator MOZ_FINAL
+  : public nsISimpleEnumerator
+  , public nsIDirectoryEnumerator
 {
 public:
 
   NS_DECL_ISUPPORTS
 
   nsDirEnumerator() : mDir(nullptr)
   {
   }
 
-  nsresult Init(nsIFile* parent)
+  nsresult Init(nsIFile* aParent)
   {
     nsAutoString filepath;
-    parent->GetTarget(filepath);
-
-    if (filepath.IsEmpty())
-    {
-      parent->GetPath(filepath);
+    aParent->GetTarget(filepath);
+
+    if (filepath.IsEmpty()) {
+      aParent->GetPath(filepath);
     }
 
-    if (filepath.IsEmpty())
-    {
+    if (filepath.IsEmpty()) {
       return NS_ERROR_UNEXPECTED;
     }
 
     // IsDirectory is not needed here because OpenDir will return
     // NS_ERROR_FILE_NOT_DIRECTORY if the passed in path is a file.
     nsresult rv = OpenDir(filepath, &mDir);
-    if (NS_FAILED(rv))
+    if (NS_FAILED(rv)) {
       return rv;
-
-    mParent = parent;
+    }
+
+    mParent = aParent;
     return NS_OK;
   }
 
-  NS_IMETHOD HasMoreElements(bool *result)
+  NS_IMETHOD HasMoreElements(bool* aResult)
   {
     nsresult rv;
-    if (mNext == nullptr && mDir)
-    {
+    if (!mNext && mDir) {
       nsString name;
       rv = ReadDir(mDir, PR_SKIP_BOTH, name);
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return rv;
-      if (name.IsEmpty())
-      {
+      }
+      if (name.IsEmpty()) {
         // end of dir entries
-        if (NS_FAILED(CloseDir(mDir)))
+        if (NS_FAILED(CloseDir(mDir))) {
           return NS_ERROR_FAILURE;
-
-        *result = false;
+        }
+
+        *aResult = false;
         return NS_OK;
       }
 
       nsCOMPtr<nsIFile> file;
       rv = mParent->Clone(getter_AddRefs(file));
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return rv;
+      }
 
       rv = file->Append(name);
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return rv;
+      }
 
       mNext = do_QueryInterface(file);
     }
-    *result = mNext != nullptr;
-    if (!*result)
+    *aResult = mNext != nullptr;
+    if (!*aResult) {
       Close();
+    }
     return NS_OK;
   }
 
-  NS_IMETHOD GetNext(nsISupports **result)
+  NS_IMETHOD GetNext(nsISupports** aResult)
   {
     nsresult rv;
     bool hasMore;
     rv = HasMoreElements(&hasMore);
-    if (NS_FAILED(rv)) return rv;
-
-    *result = mNext;        // might return nullptr
-    NS_IF_ADDREF(*result);
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
+
+    *aResult = mNext;        // might return nullptr
+    NS_IF_ADDREF(*aResult);
 
     mNext = nullptr;
     return NS_OK;
   }
 
-  NS_IMETHOD GetNextFile(nsIFile **result)
+  NS_IMETHOD GetNextFile(nsIFile** aResult)
   {
-    *result = nullptr;
+    *aResult = nullptr;
     bool hasMore = false;
     nsresult rv = HasMoreElements(&hasMore);
-    if (NS_FAILED(rv) || !hasMore)
+    if (NS_FAILED(rv) || !hasMore) {
       return rv;
-    *result = mNext;
-    NS_IF_ADDREF(*result);
+    }
+    *aResult = mNext;
+    NS_IF_ADDREF(*aResult);
     mNext = nullptr;
     return NS_OK;
   }
 
   NS_IMETHOD Close()
   {
-    if (mDir)
-    {
+    if (mDir) {
       nsresult rv = CloseDir(mDir);
       NS_ASSERTION(NS_SUCCEEDED(rv), "close failed");
-      if (NS_FAILED(rv))
+      if (NS_FAILED(rv)) {
         return NS_ERROR_FAILURE;
+      }
     }
     return NS_OK;
   }
 
   // dtor can be non-virtual since there are no subclasses, but must be
   // public to use the class on the stack.
   ~nsDirEnumerator()
   {
@@ -960,30 +991,32 @@ NS_IMPL_ISUPPORTS(nsDirEnumerator, nsISi
 nsLocalFile::nsLocalFile()
   : mDirty(true)
   , mResolveDirty(true)
   , mFollowSymlinks(false)
 {
 }
 
 nsresult
-nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
+nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
+                                    void** aInstancePtr)
 {
-  if (NS_WARN_IF(!aInstancePtr))
+  if (NS_WARN_IF(!aInstancePtr)) {
     return NS_ERROR_INVALID_ARG;
-  if (NS_WARN_IF(outer))
+  }
+  if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
+  }
 
   nsLocalFile* inst = new nsLocalFile();
   if (inst == nullptr)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
-  if (NS_FAILED(rv))
-  {
+  if (NS_FAILED(rv)) {
     delete inst;
     return rv;
   }
   return NS_OK;
 }
 
 
 //-----------------------------------------------------------------------------
@@ -996,101 +1029,106 @@ NS_IMPL_ISUPPORTS(nsLocalFile,
                   nsILocalFileWin,
                   nsIHashable)
 
 
 //-----------------------------------------------------------------------------
 // nsLocalFile <private>
 //-----------------------------------------------------------------------------
 
-nsLocalFile::nsLocalFile(const nsLocalFile& other)
+nsLocalFile::nsLocalFile(const nsLocalFile& aOther)
   : mDirty(true)
   , mResolveDirty(true)
-  , mFollowSymlinks(other.mFollowSymlinks)
-  , mWorkingPath(other.mWorkingPath)
+  , mFollowSymlinks(aOther.mFollowSymlinks)
+  , mWorkingPath(aOther.mWorkingPath)
 {
 }
 
 // Resolve the shortcut file from mWorkingPath and write the path
 // it points to into mResolvedPath.
 nsresult
 nsLocalFile::ResolveShortcut()
 {
   // we can't do anything without the resolver
-  if (!gResolver)
+  if (!gResolver) {
     return NS_ERROR_FAILURE;
+  }
 
   mResolvedPath.SetLength(MAX_PATH);
-  if (mResolvedPath.Length() != MAX_PATH)
+  if (mResolvedPath.Length() != MAX_PATH) {
     return NS_ERROR_OUT_OF_MEMORY;
-
-  wchar_t *resolvedPath = wwc(mResolvedPath.BeginWriting());
+  }
+
+  wchar_t* resolvedPath = wwc(mResolvedPath.BeginWriting());
 
   // resolve this shortcut
   nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
 
   size_t len = NS_FAILED(rv) ? 0 : wcslen(resolvedPath);
   mResolvedPath.SetLength(len);
 
   return rv;
 }
 
 // Resolve any shortcuts and stat the resolved path. After a successful return
 // the path is guaranteed valid and the members of mFileInfo64 can be used.
 nsresult
 nsLocalFile::ResolveAndStat()
 {
   // if we aren't dirty then we are already done
-  if (!mDirty)
+  if (!mDirty) {
     return NS_OK;
+  }
 
   // we can't resolve/stat anything that isn't a valid NSPR addressable path
-  if (mWorkingPath.IsEmpty())
+  if (mWorkingPath.IsEmpty()) {
     return NS_ERROR_FILE_INVALID_PATH;
+  }
 
   // this is usually correct
   mResolvedPath.Assign(mWorkingPath);
 
   // slutty hack designed to work around bug 134796 until it is fixed
   nsAutoString nsprPath(mWorkingPath.get());
-  if (mWorkingPath.Length() == 2 && mWorkingPath.CharAt(1) == L':')
+  if (mWorkingPath.Length() == 2 && mWorkingPath.CharAt(1) == L':') {
     nsprPath.Append('\\');
+  }
 
   // first we will see if the working path exists. If it doesn't then
   // there is nothing more that can be done
   nsresult rv = GetFileInfo(nsprPath, &mFileInfo64);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   // if this isn't a shortcut file or we aren't following symlinks then we're done
-  if (!mFollowSymlinks
-      || mFileInfo64.type != PR_FILE_FILE
-      || !IsShortcutPath(mWorkingPath))
-  {
+  if (!mFollowSymlinks ||
+      mFileInfo64.type != PR_FILE_FILE ||
+      !IsShortcutPath(mWorkingPath)) {
     mDirty = false;
     mResolveDirty = false;
     return NS_OK;
   }
 
   // we need to resolve this shortcut to what it points to, this will
   // set mResolvedPath. Even if it fails we need to have the resolved
   // path equal to working path for those functions that always use
   // the resolved path.
   rv = ResolveShortcut();
-  if (NS_FAILED(rv))
-  {
+  if (NS_FAILED(rv)) {
     mResolvedPath.Assign(mWorkingPath);
     return rv;
   }
   mResolveDirty = false;
 
   // get the details of the resolved path
   rv = GetFileInfo(mResolvedPath, &mFileInfo64);
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   mDirty = false;
   return NS_OK;
 }
 
 /**
  * Fills the mResolvedPath member variable with the file or symlink target
  * if follow symlinks is on.  This is a copy of the Resolve parts from
@@ -1136,320 +1174,332 @@ nsLocalFile::Resolve()
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsLocalFile::nsIFile,nsILocalFile
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
-nsLocalFile::Clone(nsIFile **file)
+nsLocalFile::Clone(nsIFile** aFile)
 {
   // Just copy-construct ourselves
-  *file = new nsLocalFile(*this);
-  if (!*file)
+  *aFile = new nsLocalFile(*this);
+  if (!*aFile) {
     return NS_ERROR_OUT_OF_MEMORY;
-
-  NS_ADDREF(*file);
+  }
+
+  NS_ADDREF(*aFile);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocalFile::InitWithFile(nsIFile *aFile)
+nsLocalFile::InitWithFile(nsIFile* aFile)
 {
-  if (NS_WARN_IF(!aFile))
+  if (NS_WARN_IF(!aFile)) {
     return NS_ERROR_INVALID_ARG;
+  }
 
   nsAutoString path;
   aFile->GetPath(path);
-  if (path.IsEmpty())
+  if (path.IsEmpty()) {
     return NS_ERROR_INVALID_ARG;
+  }
   return InitWithPath(path);
 }
 
 NS_IMETHODIMP
-nsLocalFile::InitWithPath(const nsAString &filePath)
+nsLocalFile::InitWithPath(const nsAString& aFilePath)
 {
   MakeDirty();
 
   nsAString::const_iterator begin, end;
-  filePath.BeginReading(begin);
-  filePath.EndReading(end);
+  aFilePath.BeginReading(begin);
+  aFilePath.EndReading(end);
 
   // input string must not be empty
-  if (begin == end)
+  if (begin == end) {
     return NS_ERROR_FAILURE;
+  }
 
   char16_t firstChar = *begin;
   char16_t secondChar = *(++begin);
 
   // just do a sanity check.  if it has any forward slashes, it is not a Native path
   // on windows.  Also, it must have a colon at after the first char.
-  if (FindCharInReadable(L'/', begin, end))
+  if (FindCharInReadable(L'/', begin, end)) {
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-
-  if (secondChar != L':' && (secondChar != L'\\' || firstChar != L'\\'))
+  }
+
+  if (secondChar != L':' && (secondChar != L'\\' || firstChar != L'\\')) {
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
+  }
 
   if (secondChar == L':') {
     // Make sure we have a valid drive, later code assumes the drive letter
     // is a single char a-z or A-Z.
-    if (PathGetDriveNumberW(filePath.Data()) == -1) {
+    if (PathGetDriveNumberW(aFilePath.Data()) == -1) {
       return NS_ERROR_FILE_UNRECOGNIZED_PATH;
     }
   }
 
-  mWorkingPath = filePath;
+  mWorkingPath = aFilePath;
   // kill any trailing '\'
-  if (mWorkingPath.Last() == L'\\')
+  if (mWorkingPath.Last() == L'\\') {
     mWorkingPath.Truncate(mWorkingPath.Length() - 1);
+  }
 
   return NS_OK;
 
 }
 
 NS_IMETHODIMP
-nsLocalFile::OpenNSPRFileDesc(int32_t flags, int32_t mode, PRFileDesc **_retval)
+nsLocalFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
+                              PRFileDesc** aResult)
 {
   nsresult rv = Resolve();
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
-
-  return OpenFile(mResolvedPath, flags, mode, _retval);
+  }
+
+  return OpenFile(mResolvedPath, aFlags, aMode, aResult);
 }
 
 
 NS_IMETHODIMP
-nsLocalFile::OpenANSIFileDesc(const char *mode, FILE * *_retval)
+nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult)
 {
   nsresult rv = ResolveAndStat();
-  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)
+  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) {
     return rv;
-
-  *_retval = _wfopen(mResolvedPath.get(), NS_ConvertASCIItoUTF16(mode).get());
-  if (*_retval)
+  }
+
+  *aResult = _wfopen(mResolvedPath.get(), NS_ConvertASCIItoUTF16(aMode).get());
+  if (*aResult) {
     return NS_OK;
+  }
 
   return NS_ERROR_FAILURE;
 }
 
 
 
 NS_IMETHODIMP
-nsLocalFile::Create(uint32_t type, uint32_t attributes)
+nsLocalFile::Create(uint32_t aType, uint32_t aAttributes)
 {
-  if (type != NORMAL_FILE_TYPE && type != DIRECTORY_TYPE)
+  if (aType != NORMAL_FILE_TYPE && aType != DIRECTORY_TYPE) {
     return NS_ERROR_FILE_UNKNOWN_TYPE;
+  }
 
   nsresult rv = ResolveAndStat();
-  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)
+  if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) {
     return rv;
+  }
 
   // create directories to target
   //
   // A given local file can be either one of these forms:
   //
   //   - normal:    X:\some\path\on\this\drive
   //                       ^--- start here
   //
   //   - UNC path:  \\machine\volume\some\path\on\this\drive
   //                                     ^--- start here
   //
   // Skip the first 'X:\' for the first form, and skip the first full
   // '\\machine\volume\' segment for the second form.
 
   wchar_t* path = wwc(mResolvedPath.BeginWriting());
 
-  if (path[0] == L'\\' && path[1] == L'\\')
-  {
+  if (path[0] == L'\\' && path[1] == L'\\') {
     // dealing with a UNC path here; skip past '\\machine\'
     path = wcschr(path + 2, L'\\');
-    if (!path)
+    if (!path) {
       return NS_ERROR_FILE_INVALID_PATH;
+    }
     ++path;
   }
 
   // search for first slash after the drive (or volume) name
   wchar_t* slash = wcschr(path, L'\\');
 
   nsresult directoryCreateError = NS_OK;
-  if (slash)
-  {
+  if (slash) {
     // skip the first '\\'
     ++slash;
     slash = wcschr(slash, L'\\');
 
-    while (slash)
-    {
+    while (slash) {
       *slash = L'\0';
 
       if (!::CreateDirectoryW(mResolvedPath.get(), nullptr)) {
         rv = ConvertWinError(GetLastError());
         if (NS_ERROR_FILE_NOT_FOUND == rv &&
             NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) {
           // If a previous CreateDirectory failed due to access, return that.
           return NS_ERROR_FILE_ACCESS_DENIED;
         }
         // perhaps the base path already exists, or perhaps we don't have
         // permissions to create the directory.  NOTE: access denied could
         // occur on a parent directory even though it exists.
-        else if (NS_ERROR_FILE_ALREADY_EXISTS != rv &&
-                 NS_ERROR_FILE_ACCESS_DENIED != rv) {
+        else if (rv != NS_ERROR_FILE_ALREADY_EXISTS &&
+                 rv != NS_ERROR_FILE_ACCESS_DENIED) {
           return rv;
         }
 
         directoryCreateError = rv;
       }
       *slash = L'\\';
       ++slash;
       slash = wcschr(slash, L'\\');
     }
   }
 
-  if (type == NORMAL_FILE_TYPE)
-  {
+  if (aType == NORMAL_FILE_TYPE) {
     PRFileDesc* file;
     rv = OpenFile(mResolvedPath,
-                  PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes,
-                  &file);
-    if (file)
+                  PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL,
+                  aAttributes, &file);
+    if (file) {
       PR_Close(file);
-
-    if (rv == NS_ERROR_FILE_ACCESS_DENIED)
-    {
+    }
+
+    if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
       // need to return already-exists for directories (bug 452217)
       bool isdir;
-      if (NS_SUCCEEDED(IsDirectory(&isdir)) && isdir)
+      if (NS_SUCCEEDED(IsDirectory(&isdir)) && isdir) {
         rv = NS_ERROR_FILE_ALREADY_EXISTS;
+      }
     } else if (NS_ERROR_FILE_NOT_FOUND == rv &&
                NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) {
       // If a previous CreateDirectory failed due to access, return that.
       return NS_ERROR_FILE_ACCESS_DENIED;
     }
     return rv;
   }
 
-  if (type == DIRECTORY_TYPE)