Bug 995730 - Convert xpcom/string/ to Gecko style. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 27 May 2014 10:15:35 +0300
changeset 185144 eb3b772bac41bcc5d684bdf10a12d12e5ccbf54f
parent 185143 cfaa8aa6237017044dc4fa3448194bcfad550722
child 185145 747dc2140460792408f3a799fd00fd5b1a4e6741
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs995730
milestone32.0a1
Bug 995730 - Convert xpcom/string/ to Gecko style. r=froydnj
xpcom/string/public/nsAString.h
xpcom/string/public/nsAlgorithm.h
xpcom/string/public/nsCharTraits.h
xpcom/string/public/nsPrintfCString.h
xpcom/string/public/nsReadableUtils.h
xpcom/string/public/nsString.h
xpcom/string/public/nsStringBuffer.h
xpcom/string/public/nsStringIterator.h
xpcom/string/public/nsTDependentString.h
xpcom/string/public/nsTDependentSubstring.h
xpcom/string/public/nsTLiteralString.h
xpcom/string/public/nsTPromiseFlatString.h
xpcom/string/public/nsTString.h
xpcom/string/public/nsTSubstring.h
xpcom/string/public/nsTSubstringTuple.h
xpcom/string/public/nsUTF8Utils.h
xpcom/string/public/nsXPCOMStrings.h
xpcom/string/src/nsReadableUtils.cpp
xpcom/string/src/nsStringComparator.cpp
xpcom/string/src/nsSubstring.cpp
xpcom/string/src/nsTDependentString.cpp
xpcom/string/src/nsTDependentSubstring.cpp
xpcom/string/src/nsTPromiseFlatString.cpp
xpcom/string/src/nsTString.cpp
xpcom/string/src/nsTStringComparator.cpp
xpcom/string/src/nsTSubstring.cpp
xpcom/string/src/nsTSubstringTuple.cpp
xpcom/string/src/nsUTF8UtilsSSE2.cpp
--- a/xpcom/string/public/nsAString.h
+++ b/xpcom/string/public/nsAString.h
@@ -32,28 +32,32 @@
 /**
  * ASCII case-insensitive comparator.  (for Unicode case-insensitive
  * comparision, see nsUnicharUtils.h)
  */
 class nsCaseInsensitiveCStringComparator
   : public nsCStringComparator
 {
 public:
-  nsCaseInsensitiveCStringComparator() {}
+  nsCaseInsensitiveCStringComparator()
+  {
+  }
   typedef char char_type;
 
-  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
+  virtual int operator()(const char_type*, const char_type*,
+                         uint32_t, uint32_t) const;
 };
 
 class nsCaseInsensitiveCStringArrayComparator
 {
 public:
   template<class A, class B>
-  bool Equals(const A& a, const B& b) const {
-    return a.Equals(b, nsCaseInsensitiveCStringComparator());
+  bool Equals(const A& aStrA, const B& aStrB) const
+  {
+    return aStrA.Equals(aStrB, nsCaseInsensitiveCStringComparator());
   }
 };
 
 // included here for backwards compatibility
 #ifndef nsSubstringTuple_h___
 #include "nsSubstringTuple.h"
 #endif
 
--- a/xpcom/string/public/nsAlgorithm.h
+++ b/xpcom/string/public/nsAlgorithm.h
@@ -5,73 +5,71 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsAlgorithm_h___
 #define nsAlgorithm_h___
 
 #include "nsCharTraits.h"  // for |nsCharSourceTraits|, |nsCharSinkTraits|
 
 template <class T>
-inline
-T
-NS_ROUNDUP( const T& a, const T& b )
+inline T
+NS_ROUNDUP(const T& aA, const T& aB)
 {
-  return ((a + (b - 1)) / b) * b;
+  return ((aA + (aB - 1)) / aB) * aB;
 }
 
 // We use these instead of std::min/max because we can't include the algorithm
 // header in all of XPCOM because the stl wrappers will error out when included
 // in parts of XPCOM. These functions should never be used outside of XPCOM.
 template <class T>
-inline
-const T&
-XPCOM_MIN( const T& a, const T& b )
+inline const T&
+XPCOM_MIN(const T& aA, const T& aB)
 {
-  return b < a ? b : a;
+  return aB < aA ? aB : aA;
 }
 
 // Must return b when a == b in case a is -0
 template <class T>
-inline
-const T&
-XPCOM_MAX( const T& a, const T& b )
+inline const T&
+XPCOM_MAX(const T& aA, const T& aB)
 {
-  return a > b ? a : b;
+  return aA > aB ? aA : aB;
 }
 
 namespace mozilla {
 
 template <class T>
-inline
-const T&
-clamped( const T& a, const T& min, const T& max )
+inline const T&
+clamped(const T& aA, const T& aMin, const T& aMax)
 {
-  NS_ABORT_IF_FALSE(max >= min, "clamped(): max must be greater than or equal to min");
-  return XPCOM_MIN(XPCOM_MAX(a, min), max);
+  NS_ABORT_IF_FALSE(aMax >= aMin,
+                    "clamped(): aMax must be greater than or equal to aMin");
+  return XPCOM_MIN(XPCOM_MAX(aA, aMin), aMax);
 }
 
 }
 
 template <class InputIterator, class T>
-inline
-uint32_t
-NS_COUNT( InputIterator& first, const InputIterator& last, const T& value )
+inline uint32_t
+NS_COUNT(InputIterator& aFirst, const InputIterator& aLast, const T& aValue)
 {
   uint32_t result = 0;
-  for ( ; first != last; ++first )
-    if ( *first == value )
+  for (; aFirst != aLast; ++aFirst)
+    if (*aFirst == aValue) {
       ++result;
+    }
   return result;
 }
 
 template <class InputIterator, class OutputIterator>
-inline
-OutputIterator&
-copy_string( const InputIterator& first, const InputIterator& last, OutputIterator& result )
+inline OutputIterator&
+copy_string(const InputIterator& aFirst, const InputIterator& aLast,
+            OutputIterator& aResult)
 {
   typedef nsCharSourceTraits<InputIterator> source_traits;
   typedef nsCharSinkTraits<OutputIterator>  sink_traits;
 
-  sink_traits::write(result, source_traits::read(first), source_traits::readable_distance(first, last));
-  return result;
+  sink_traits::write(aResult, source_traits::read(aFirst),
+                     source_traits::readable_distance(aFirst, aLast));
+  return aResult;
 }
 
 #endif // !defined(nsAlgorithm_h___)
--- a/xpcom/string/public/nsCharTraits.h
+++ b/xpcom/string/public/nsCharTraits.h
@@ -78,526 +78,504 @@
 
 #define IS_IN_BMP(ucs) (uint32_t(ucs) < PLANE1_BASE)
 #define UCS2_REPLACEMENT_CHAR char16_t(0xFFFD)
 
 #define UCS_END uint32_t(0x00110000)
 #define IS_VALID_CHAR(c) ((uint32_t(c) < UCS_END) && !IS_SURROGATE(c))
 #define ENSURE_VALID_CHAR(c) (IS_VALID_CHAR(c) ? (c) : UCS2_REPLACEMENT_CHAR)
 
-template <class CharT> struct nsCharTraits {};
+template <class CharT>
+struct nsCharTraits
+{
+};
 
 template <>
 struct nsCharTraits<char16_t>
 {
   typedef char16_t char_type;
   typedef uint16_t  unsigned_char_type;
   typedef char      incompatible_char_type;
 
   static char_type* const sEmptyBuffer;
 
-  static
-  void
-  assign( char_type& lhs, char_type rhs )
+  static void
+  assign(char_type& aLhs, char_type aRhs)
   {
-    lhs = rhs;
+    aLhs = aRhs;
   }
 
 
   // integer representation of characters:
   typedef int int_type;
 
-  static
-  char_type
-  to_char_type( int_type c )
+  static char_type
+  to_char_type(int_type aChar)
   {
-    return char_type(c);
+    return char_type(aChar);
   }
 
-  static
-  int_type
-  to_int_type( char_type c )
+  static int_type
+  to_int_type(char_type aChar)
   {
-    return int_type( static_cast<unsigned_char_type>(c) );
+    return int_type(static_cast<unsigned_char_type>(aChar));
   }
 
-  static
-  bool
-  eq_int_type( int_type lhs, int_type rhs )
+  static bool
+  eq_int_type(int_type aLhs, int_type aRhs)
   {
-    return lhs == rhs;
+    return aLhs == aRhs;
   }
 
 
   // |char_type| comparisons:
 
-  static
-  bool
-  eq( char_type lhs, char_type rhs )
+  static bool
+  eq(char_type aLhs, char_type aRhs)
   {
-    return lhs == rhs;
+    return aLhs == aRhs;
   }
 
-  static
-  bool
-  lt( char_type lhs, char_type rhs )
+  static bool
+  lt(char_type aLhs, char_type aRhs)
   {
-    return lhs < rhs;
+    return aLhs < aRhs;
   }
 
 
   // operations on s[n] arrays:
 
-  static
-  char_type*
-  move( char_type* s1, const char_type* s2, size_t n )
+  static char_type*
+  move(char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
+    return static_cast<char_type*>(memmove(aStr1, aStr2,
+                                           aN * sizeof(char_type)));
   }
 
-  static
-  char_type*
-  copy( char_type* s1, const char_type* s2, size_t n )
+  static char_type*
+  copy(char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
+    return static_cast<char_type*>(memcpy(aStr1, aStr2,
+                                          aN * sizeof(char_type)));
   }
 
-  static
-  char_type*
-  copyASCII( char_type* s1, const char* s2, size_t n )
+  static char_type*
+  copyASCII(char_type* aStr1, const char* aStr2, size_t aN)
   {
-    for (char_type* s = s1; n--; ++s, ++s2) {
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      *s = *s2;
+    for (char_type* s = aStr1; aN--; ++s, ++aStr2) {
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      *s = *aStr2;
     }
-    return s1;
+    return aStr1;
   }
 
-  static
-  char_type*
-  assign( char_type* s, size_t n, char_type c )
+  static char_type*
+  assign(char_type* aStr, size_t aN, char_type aChar)
   {
-    char_type* result = s;
-    while ( n-- )
-      assign(*s++, c);
+    char_type* result = aStr;
+    while (aN--) {
+      assign(*aStr++, aChar);
+    }
     return result;
   }
 
-  static
-  int
-  compare( const char_type* s1, const char_type* s2, size_t n )
+  static int
+  compare(const char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      if ( !eq(*s1, *s2) )
-        return to_int_type(*s1) - to_int_type(*s2);
+    for (; aN--; ++aStr1, ++aStr2) {
+      if (!eq(*aStr1, *aStr2)) {
+        return to_int_type(*aStr1) - to_int_type(*aStr2);
+      }
     }
 
     return 0;
   }
 
-  static
-  int
-  compareASCII( const char_type* s1, const char* s2, size_t n )
+  static int
+  compareASCII(const char_type* aStr1, const char* aStr2, size_t aN)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
-        return to_int_type(*s1) - to_int_type(*s2);
+    for (; aN--; ++aStr1, ++aStr2) {
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      if (!eq_int_type(to_int_type(*aStr1), to_int_type(*aStr2))) {
+        return to_int_type(*aStr1) - to_int_type(*aStr2);
+      }
     }
 
     return 0;
   }
 
   // this version assumes that s2 is null-terminated and s1 has length n.
   // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
   // we return 1.
-  static
-  int
-  compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  static int
+  compareASCIINullTerminated(const char_type* aStr1, size_t aN,
+                             const char* aStr2)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      if ( !*s2 )
+    for (; aN--; ++aStr1, ++aStr2) {
+      if (!*aStr2) {
         return 1;
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
-        return to_int_type(*s1) - to_int_type(*s2);
+      }
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      if (!eq_int_type(to_int_type(*aStr1), to_int_type(*aStr2))) {
+        return to_int_type(*aStr1) - to_int_type(*aStr2);
+      }
     }
 
-    if ( *s2 )
+    if (*aStr2) {
       return -1;
+    }
 
     return 0;
   }
 
   /**
    * Convert c to its lower-case form, but only if c is in the ASCII
    * range. Otherwise leave it alone.
    */
-  static
-  char_type
-  ASCIIToLower( char_type c )
+  static char_type
+  ASCIIToLower(char_type aChar)
   {
-    if (c >= 'A' && c <= 'Z')
-      return char_type(c + ('a' - 'A'));
+    if (aChar >= 'A' && aChar <= 'Z') {
+      return char_type(aChar + ('a' - 'A'));
+    }
 
-    return c;
+    return aChar;
   }
 
-  static
-  int
-  compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
+  static int
+  compareLowerCaseToASCII(const char_type* aStr1, const char* aStr2, size_t aN)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+    for (; aN--; ++aStr1, ++aStr2) {
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*aStr2 >= 'A' && *aStr2 <= 'Z'),
                    "Unexpected uppercase character");
-      char_type lower_s1 = ASCIIToLower(*s1);
-      if ( lower_s1 != to_char_type(*s2) )
-        return to_int_type(lower_s1) - to_int_type(*s2);
+      char_type lower_s1 = ASCIIToLower(*aStr1);
+      if (lower_s1 != to_char_type(*aStr2)) {
+        return to_int_type(lower_s1) - to_int_type(*aStr2);
+      }
     }
 
     return 0;
   }
 
   // this version assumes that s2 is null-terminated and s1 has length n.
   // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
   // we return 1.
-  static
-  int
-  compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  static int
+  compareLowerCaseToASCIINullTerminated(const char_type* aStr1,
+                                        size_t aN, const char* aStr2)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      if ( !*s2 )
+    for (; aN--; ++aStr1, ++aStr2) {
+      if (!*aStr2) {
         return 1;
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+      }
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*aStr2 >= 'A' && *aStr2 <= 'Z'),
                    "Unexpected uppercase character");
-      char_type lower_s1 = ASCIIToLower(*s1);
-      if ( lower_s1 != to_char_type(*s2) )
-        return to_int_type(lower_s1) - to_int_type(*s2);
+      char_type lower_s1 = ASCIIToLower(*aStr1);
+      if (lower_s1 != to_char_type(*aStr2)) {
+        return to_int_type(lower_s1) - to_int_type(*aStr2);
+      }
     }
 
-    if ( *s2 )
+    if (*aStr2) {
       return -1;
+    }
 
     return 0;
   }
 
-  static
-  size_t
-  length( const char_type* s )
+  static size_t
+  length(const char_type* aStr)
   {
     size_t result = 0;
-    while ( !eq(*s++, char_type(0)) )
+    while (!eq(*aStr++, char_type(0))) {
       ++result;
+    }
     return result;
   }
 
-  static
-  const char_type*
-  find( const char_type* s, size_t n, char_type c )
+  static const char_type*
+  find(const char_type* aStr, size_t aN, char_type aChar)
   {
-    while ( n-- )
-    {
-      if ( eq(*s, c) )
-        return s;
-      ++s;
+    while (aN--) {
+      if (eq(*aStr, aChar)) {
+        return aStr;
+      }
+      ++aStr;
     }
 
     return 0;
   }
 };
 
 template <>
 struct nsCharTraits<char>
 {
   typedef char           char_type;
   typedef unsigned char  unsigned_char_type;
   typedef char16_t      incompatible_char_type;
 
   static char_type* const sEmptyBuffer;
 
-  static
-  void
-  assign( char_type& lhs, char_type rhs )
+  static void
+  assign(char_type& aLhs, char_type aRhs)
   {
-    lhs = rhs;
+    aLhs = aRhs;
   }
 
 
   // integer representation of characters:
 
   typedef int int_type;
 
-  static
-  char_type
-  to_char_type( int_type c )
+  static char_type
+  to_char_type(int_type aChar)
   {
-    return char_type(c);
+    return char_type(aChar);
   }
 
-  static
-  int_type
-  to_int_type( char_type c )
+  static int_type
+  to_int_type(char_type aChar)
   {
-    return int_type( static_cast<unsigned_char_type>(c) );
+    return int_type(static_cast<unsigned_char_type>(aChar));
   }
 
-  static
-  bool
-  eq_int_type( int_type lhs, int_type rhs )
+  static bool
+  eq_int_type(int_type aLhs, int_type aRhs)
   {
-    return lhs == rhs;
+    return aLhs == aRhs;
   }
 
 
   // |char_type| comparisons:
 
-  static
-  bool
-  eq( char_type lhs, char_type rhs )
+  static bool eq(char_type aLhs, char_type aRhs)
   {
-    return lhs == rhs;
+    return aLhs == aRhs;
   }
 
-  static
-  bool
-  lt( char_type lhs, char_type rhs )
+  static bool
+  lt(char_type aLhs, char_type aRhs)
   {
-    return lhs < rhs;
+    return aLhs < aRhs;
   }
 
 
   // operations on s[n] arrays:
 
-  static
-  char_type*
-  move( char_type* s1, const char_type* s2, size_t n )
+  static char_type*
+  move(char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
+    return static_cast<char_type*>(memmove(aStr1, aStr2,
+                                           aN * sizeof(char_type)));
   }
 
-  static
-  char_type*
-  copy( char_type* s1, const char_type* s2, size_t n )
+  static char_type*
+  copy(char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
+    return static_cast<char_type*>(memcpy(aStr1, aStr2,
+                                          aN * sizeof(char_type)));
   }
 
-  static
-  char_type*
-  copyASCII( char_type* s1, const char* s2, size_t n )
+  static char_type*
+  copyASCII(char_type* aStr1, const char* aStr2, size_t aN)
   {
-    return copy(s1, s2, n);
+    return copy(aStr1, aStr2, aN);
   }
 
-  static
-  char_type*
-  assign( char_type* s, size_t n, char_type c )
+  static char_type*
+  assign(char_type* aStr, size_t aN, char_type aChar)
   {
-    return static_cast<char_type*>(memset(s, to_int_type(c), n));
+    return static_cast<char_type*>(memset(aStr, to_int_type(aChar), aN));
   }
 
-  static
-  int
-  compare( const char_type* s1, const char_type* s2, size_t n )
+  static int
+  compare(const char_type* aStr1, const char_type* aStr2, size_t aN)
   {
-    return memcmp(s1, s2, n);
+    return memcmp(aStr1, aStr2, aN);
   }
 
-  static
-  int
-  compareASCII( const char_type* s1, const char* s2, size_t n )
+  static int
+  compareASCII(const char_type* aStr1, const char* aStr2, size_t aN)
   {
 #ifdef DEBUG
-    for (size_t i = 0; i < n; ++i)
-    {
-      NS_ASSERTION(!(s2[i] & ~0x7F), "Unexpected non-ASCII character");
+    for (size_t i = 0; i < aN; ++i) {
+      NS_ASSERTION(!(aStr2[i] & ~0x7F), "Unexpected non-ASCII character");
     }
 #endif
-    return compare(s1, s2, n);
+    return compare(aStr1, aStr2, aN);
   }
 
   // this version assumes that s2 is null-terminated and s1 has length n.
   // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
   // we return 1.
-  static
-  int
-  compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  static int
+  compareASCIINullTerminated(const char_type* aStr1, size_t aN,
+                             const char* aStr2)
   {
-    // can't use strcmp here because we don't want to stop when s1
+    // can't use strcmp here because we don't want to stop when aStr1
     // contains a null
-    for ( ; n--; ++s1, ++s2 )
-    {
-      if ( !*s2 )
+    for (; aN--; ++aStr1, ++aStr2) {
+      if (!*aStr2) {
         return 1;
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      if ( *s1 != *s2 )
-        return to_int_type(*s1) - to_int_type(*s2);
+      }
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      if (*aStr1 != *aStr2) {
+        return to_int_type(*aStr1) - to_int_type(*aStr2);
+      }
     }
 
-    if ( *s2 )
+    if (*aStr2) {
       return -1;
+    }
 
     return 0;
   }
 
   /**
    * Convert c to its lower-case form, but only if c is ASCII.
    */
-  static
-  char_type
-  ASCIIToLower( char_type c )
+  static char_type
+  ASCIIToLower(char_type aChar)
   {
-    if (c >= 'A' && c <= 'Z')
-      return char_type(c + ('a' - 'A'));
+    if (aChar >= 'A' && aChar <= 'Z') {
+      return char_type(aChar + ('a' - 'A'));
+    }
 
-    return c;
+    return aChar;
   }
 
-  static
-  int
-  compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
+  static int
+  compareLowerCaseToASCII(const char_type* aStr1, const char* aStr2, size_t aN)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+    for (; aN--; ++aStr1, ++aStr2) {
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*aStr2 >= 'A' && *aStr2 <= 'Z'),
                    "Unexpected uppercase character");
-      char_type lower_s1 = ASCIIToLower(*s1);
-      if ( lower_s1 != *s2 )
-        return to_int_type(lower_s1) - to_int_type(*s2);
+      char_type lower_s1 = ASCIIToLower(*aStr1);
+      if (lower_s1 != *aStr2) {
+        return to_int_type(lower_s1) - to_int_type(*aStr2);
+      }
     }
     return 0;
   }
 
   // this version assumes that s2 is null-terminated and s1 has length n.
   // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
   // we return 1.
-  static
-  int
-  compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  static int
+  compareLowerCaseToASCIINullTerminated(const char_type* aStr1, size_t aN,
+                                        const char* aStr2)
   {
-    for ( ; n--; ++s1, ++s2 )
-    {
-      if ( !*s2 )
+    for (; aN--; ++aStr1, ++aStr2) {
+      if (!*aStr2) {
         return 1;
-      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+      }
+      NS_ASSERTION(!(*aStr2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*aStr2 >= 'A' && *aStr2 <= 'Z'),
                    "Unexpected uppercase character");
-      char_type lower_s1 = ASCIIToLower(*s1);
-      if ( lower_s1 != *s2 )
-        return to_int_type(lower_s1) - to_int_type(*s2);
+      char_type lower_s1 = ASCIIToLower(*aStr1);
+      if (lower_s1 != *aStr2) {
+        return to_int_type(lower_s1) - to_int_type(*aStr2);
+      }
     }
 
-    if ( *s2 )
+    if (*aStr2) {
       return -1;
+    }
 
     return 0;
   }
 
-  static
-  size_t
-  length( const char_type* s )
+  static size_t
+  length(const char_type* aStr)
   {
-    return strlen(s);
+    return strlen(aStr);
   }
 
-  static
-  const char_type*
-  find( const char_type* s, size_t n, char_type c )
+  static const char_type*
+  find(const char_type* aStr, size_t aN, char_type aChar)
   {
-    return reinterpret_cast<const char_type*>(memchr(s, to_int_type(c), n));
+    return reinterpret_cast<const char_type*>(memchr(aStr, to_int_type(aChar),
+                                                     aN));
   }
 };
 
 template <class InputIterator>
 struct nsCharSourceTraits
 {
   typedef typename InputIterator::difference_type difference_type;
 
-  static
-  uint32_t
-  readable_distance( const InputIterator& first, const InputIterator& last )
+  static uint32_t
+  readable_distance(const InputIterator& aFirst, const InputIterator& aLast)
   {
     // assumes single fragment
-    return uint32_t(last.get() - first.get());
+    return uint32_t(aLast.get() - aFirst.get());
   }
 
-  static
-  const typename InputIterator::value_type*
-  read( const InputIterator& iter )
+  static const typename InputIterator::value_type*
+  read(const InputIterator& aIter)
   {
-    return iter.get();
+    return aIter.get();
   }
 
-  static
-  void
-  advance( InputIterator& s, difference_type n )
+  static void
+  advance(InputIterator& aStr, difference_type aN)
   {
-    s.advance(n);
+    aStr.advance(aN);
   }
 };
 
 template <class CharT>
 struct nsCharSourceTraits<CharT*>
 {
   typedef ptrdiff_t difference_type;
 
-  static
-  uint32_t
-  readable_distance( CharT* s )
+  static uint32_t
+  readable_distance(CharT* aStr)
   {
-    return uint32_t(nsCharTraits<CharT>::length(s));
+    return uint32_t(nsCharTraits<CharT>::length(aStr));
     // return numeric_limits<uint32_t>::max();
   }
 
-  static
-  uint32_t
-  readable_distance( CharT* first, CharT* last )
+  static uint32_t
+  readable_distance(CharT* aFirst, CharT* aLast)
   {
-    return uint32_t(last-first);
+    return uint32_t(aLast - aFirst);
   }
 
-  static
-  const CharT*
-  read( CharT* s )
+  static const CharT*
+  read(CharT* aStr)
   {
-    return s;
+    return aStr;
   }
 
-  static
-  void
-  advance( CharT*& s, difference_type n )
+  static void
+  advance(CharT*& aStr, difference_type aN)
   {
-    s += n;
+    aStr += aN;
   }
 };
 
 template <class OutputIterator>
 struct nsCharSinkTraits
 {
-  static
-  void
-  write( OutputIterator& iter, const typename OutputIterator::value_type* s, uint32_t n )
+  static void
+  write(OutputIterator& aIter, const typename OutputIterator::value_type* aStr,
+        uint32_t aN)
   {
-    iter.write(s, n);
+    aIter.write(aStr, aN);
   }
 };
 
 template <class CharT>
 struct nsCharSinkTraits<CharT*>
 {
-  static
-  void
-  write( CharT*& iter, const CharT* s, uint32_t n )
+  static void
+  write(CharT*& aIter, const CharT* aStr, uint32_t aN)
   {
-    nsCharTraits<CharT>::move(iter, s, n);
-    iter += n;
+    nsCharTraits<CharT>::move(aIter, aStr, aN);
+    aIter += aN;
   }
 };
 
 #endif // !defined(nsCharTraits_h___)
--- a/xpcom/string/public/nsPrintfCString.h
+++ b/xpcom/string/public/nsPrintfCString.h
@@ -20,22 +20,22 @@
  *
  * See also nsCString::AppendPrintf().
  */
 class nsPrintfCString : public nsFixedCString
 {
   typedef nsCString string_type;
 
 public:
-  explicit nsPrintfCString( const char_type* format, ... )
+  explicit nsPrintfCString(const char_type* aFormat, ...)
     : nsFixedCString(mLocalBuffer, kLocalBufferSize, 0)
   {
     va_list ap;
-    va_start(ap, format);
-    AppendPrintf(format, ap);
+    va_start(ap, aFormat);
+    AppendPrintf(aFormat, ap);
     va_end(ap);
   }
 
 private:
   static const uint32_t kLocalBufferSize = 16;
   char_type mLocalBuffer[kLocalBufferSize];
 };
 
--- a/xpcom/string/public/nsReadableUtils.h
+++ b/xpcom/string/public/nsReadableUtils.h
@@ -12,142 +12,149 @@
  * I guess all the routines in this file are all mis-named.
  * According to our conventions, they should be |NS_xxx|.
  */
 
 #include "nsAString.h"
 
 #include "nsTArrayForwardDeclare.h"
 
-inline size_t Distance( const nsReadingIterator<char16_t>& start, const nsReadingIterator<char16_t>& end )
+inline size_t
+Distance(const nsReadingIterator<char16_t>& aStart,
+         const nsReadingIterator<char16_t>& aEnd)
 {
-  return end.get() - start.get();
+  return aEnd.get() - aStart.get();
 }
-inline size_t Distance( const nsReadingIterator<char>& start, const nsReadingIterator<char>& end )
+inline size_t
+Distance(const nsReadingIterator<char>& aStart,
+         const nsReadingIterator<char>& aEnd)
 {
-  return end.get() - start.get();
+  return aEnd.get() - aStart.get();
 }
 
-void LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest );
-void CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest );
+void LossyCopyUTF16toASCII(const nsAString& aSource, nsACString& aDest);
+void CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
 
-void LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest );
-void CopyASCIItoUTF16( const char* aSource, nsAString& aDest );
+void LossyCopyUTF16toASCII(const char16_t* aSource, nsACString& aDest);
+void CopyASCIItoUTF16(const char* aSource, nsAString& aDest);
 
-void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
-void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
+void CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
+void CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
 
-void CopyUTF16toUTF8( const char16_t* aSource, nsACString& aDest );
-void CopyUTF8toUTF16( const char* aSource, nsAString& aDest );
+void CopyUTF16toUTF8(const char16_t* aSource, nsACString& aDest);
+void CopyUTF8toUTF16(const char* aSource, nsAString& aDest);
 
-void LossyAppendUTF16toASCII( const nsAString& aSource, nsACString& aDest );
-void AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest );
-bool AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest,
-                         const mozilla::fallible_t& ) NS_WARN_UNUSED_RESULT;
+void LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest);
+void AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
+NS_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const nsACString& aSource,
+                                              nsAString& aDest,
+                                              const mozilla::fallible_t&);
 
-void LossyAppendUTF16toASCII( const char16_t* aSource, nsACString& aDest );
-void AppendASCIItoUTF16( const char* aSource, nsAString& aDest );
+void LossyAppendUTF16toASCII(const char16_t* aSource, nsACString& aDest);
+void AppendASCIItoUTF16(const char* aSource, nsAString& aDest);
 
-void AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
-bool AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest,
-                        const mozilla::fallible_t& ) NS_WARN_UNUSED_RESULT;
-void AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
-bool AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest,
-                        const mozilla::fallible_t& ) NS_WARN_UNUSED_RESULT;
+void AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
+NS_WARN_UNUSED_RESULT bool AppendUTF16toUTF8(const nsAString& aSource,
+                                             nsACString& aDest,
+                                             const mozilla::fallible_t&);
+void AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
+NS_WARN_UNUSED_RESULT bool AppendUTF8toUTF16(const nsACString& aSource,
+                                             nsAString& aDest,
+                                             const mozilla::fallible_t&);
 
-void AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest );
-void AppendUTF8toUTF16( const char* aSource, nsAString& aDest );
+void AppendUTF16toUTF8(const char16_t* aSource, nsACString& aDest);
+void AppendUTF8toUTF16(const char* aSource, nsAString& aDest);
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
-inline void AppendUTF16toUTF8( char16ptr_t aSource, nsACString& aDest )
+inline void AppendUTF16toUTF8(char16ptr_t aSource, nsACString& aDest)
 {
   return AppendUTF16toUTF8(static_cast<const char16_t*>(aSource), aDest);
 }
 #endif
 
 /**
  * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
  *
  * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
  * Performs a lossy encoding conversion by chopping 16-bit wide characters down to 8-bits wide while copying |aSource| to your new buffer.
  * This conversion is not well defined; but it reproduces legacy string behavior.
  * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
  *
  * @param aSource a 16-bit wide string
  * @return a new |char| buffer you must free with |nsMemory::Free|.
  */
-char* ToNewCString( const nsAString& aSource );
+char* ToNewCString(const nsAString& aSource);
 
 
 /**
  * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
  *
  * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
  * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
  *
  * @param aSource an 8-bit wide string
  * @return a new |char| buffer you must free with |nsMemory::Free|.
  */
-char* ToNewCString( const nsACString& aSource );
+char* ToNewCString(const nsACString& aSource);
 
 /**
  * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
  *
  * Allocates and returns a new |char| buffer which you must free with
  * |nsMemory::Free|.
  * Performs an encoding conversion from a UTF-16 string to a UTF-8 string
  * copying |aSource| to your new buffer.
  * The new buffer is zero-terminated, but that may not help you if |aSource|
  * contains embedded nulls.
  *
  * @param aSource a UTF-16 string (made of char16_t's)
  * @param aUTF8Count the number of 8-bit units that was returned
  * @return a new |char| buffer you must free with |nsMemory::Free|.
  */
 
-char* ToNewUTF8String( const nsAString& aSource, uint32_t *aUTF8Count = nullptr );
+char* ToNewUTF8String(const nsAString& aSource, uint32_t* aUTF8Count = nullptr);
 
 
 /**
  * Returns a new |char16_t| buffer containing a zero-terminated copy of
  * |aSource|.
  *
  * Allocates and returns a new |char16_t| buffer which you must free with
  * |nsMemory::Free|.
  * The new buffer is zero-terminated, but that may not help you if |aSource|
  * contains embedded nulls.
  *
  * @param aSource a UTF-16 string
  * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
  */
-char16_t* ToNewUnicode( const nsAString& aSource );
+char16_t* ToNewUnicode(const nsAString& aSource);
 
 
 /**
  * Returns a new |char16_t| buffer containing a zero-terminated copy of |aSource|.
  *
  * Allocates and returns a new |char16_t| buffer which you must free with |nsMemory::Free|.
  * Performs an encoding conversion by 0-padding 8-bit wide characters up to 16-bits wide while copying |aSource| to your new buffer.
  * This conversion is not well defined; but it reproduces legacy string behavior.
  * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
  *
  * @param aSource an 8-bit wide string (a C-string, NOT UTF-8)
  * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
  */
-char16_t* ToNewUnicode( const nsACString& aSource );
+char16_t* ToNewUnicode(const nsACString& aSource);
 
 /**
  * Returns the required length for a char16_t buffer holding
  * a copy of aSource, using UTF-8 to UTF-16 conversion.
  * The length does NOT include any space for zero-termination.
  *
  * @param aSource an 8-bit wide string, UTF-8 encoded
  * @return length of UTF-16 encoded string copy, not zero-terminated
  */
-uint32_t CalcUTF8ToUnicodeLength( const nsACString& aSource );
+uint32_t CalcUTF8ToUnicodeLength(const nsACString& aSource);
 
 /**
  * Copies the source string into the specified buffer, converting UTF-8 to
  * UTF-16 in the process. The conversion is well defined for valid UTF-8
  * strings.
  * The copied string will be zero-terminated! Any embedded nulls will be
  * copied nonetheless. It is the caller's responsiblity to ensure the buffer
  * is large enough to hold the string copy plus one char16_t for
@@ -157,97 +164,98 @@ uint32_t CalcUTF8ToUnicodeLength( const 
  * @see UTF8ToNewUnicode( const nsACString&, uint32_t* )
  *
  * @param aSource an 8-bit wide string, UTF-8 encoded
  * @param aBuffer the buffer holding the converted string copy
  * @param aUTF16Count receiving optionally the number of 16-bit units that
  *                    were copied
  * @return aBuffer pointer, for convenience
  */
-char16_t* UTF8ToUnicodeBuffer( const nsACString& aSource,
-                               char16_t *aBuffer,
-                               uint32_t *aUTF16Count = nullptr );
+char16_t* UTF8ToUnicodeBuffer(const nsACString& aSource,
+                              char16_t* aBuffer,
+                              uint32_t* aUTF16Count = nullptr);
 
 /**
  * Returns a new |char16_t| buffer containing a zero-terminated copy
  * of |aSource|.
  *
  * Allocates and returns a new |char| buffer which you must free with
  * |nsMemory::Free|.  Performs an encoding conversion from UTF-8 to UTF-16
  * while copying |aSource| to your new buffer.  This conversion is well defined
  * for a valid UTF-8 string.  The new buffer is zero-terminated, but that
  * may not help you if |aSource| contains embedded nulls.
  *
  * @param aSource an 8-bit wide string, UTF-8 encoded
  * @param aUTF16Count the number of 16-bit units that was returned
  * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
  *         (UTF-16 encoded)
  */
-char16_t* UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count = nullptr );
+char16_t* UTF8ToNewUnicode(const nsACString& aSource,
+                           uint32_t* aUTF16Count = nullptr);
 
 /**
  * Copies |aLength| 16-bit code units from the start of |aSource| to the
  * |char16_t| buffer |aDest|.
  *
  * After this operation |aDest| is not null terminated.
  *
  * @param aSource a UTF-16 string
  * @param aSrcOffset start offset in the source string
  * @param aDest a |char16_t| buffer
  * @param aLength the number of 16-bit code units to copy
  * @return pointer to destination buffer - identical to |aDest|
  */
-char16_t* CopyUnicodeTo( const nsAString& aSource,
-                         uint32_t aSrcOffset,
-                         char16_t* aDest,
-                         uint32_t aLength );
+char16_t* CopyUnicodeTo(const nsAString& aSource,
+                        uint32_t aSrcOffset,
+                        char16_t* aDest,
+                        uint32_t aLength);
 
 
 /**
  * Copies 16-bit characters between iterators |aSrcStart| and
  * |aSrcEnd| to the writable string |aDest|. Similar to the
  * |nsString::Mid| method.
  *
  * After this operation |aDest| is not null terminated.
  *
  * @param aSrcStart start source iterator
  * @param aSrcEnd end source iterator
  * @param aDest destination for the copy
  */
-void CopyUnicodeTo( const nsAString::const_iterator& aSrcStart,
-                    const nsAString::const_iterator& aSrcEnd,
-                    nsAString& aDest );
+void CopyUnicodeTo(const nsAString::const_iterator& aSrcStart,
+                   const nsAString::const_iterator& aSrcEnd,
+                   nsAString& aDest);
 
 /**
  * Appends 16-bit characters between iterators |aSrcStart| and
  * |aSrcEnd| to the writable string |aDest|.
  *
  * After this operation |aDest| is not null terminated.
  *
  * @param aSrcStart start source iterator
  * @param aSrcEnd end source iterator
  * @param aDest destination for the copy
  */
-void AppendUnicodeTo( const nsAString::const_iterator& aSrcStart,
-                      const nsAString::const_iterator& aSrcEnd,
-                      nsAString& aDest );
+void AppendUnicodeTo(const nsAString::const_iterator& aSrcStart,
+                     const nsAString::const_iterator& aSrcEnd,
+                     nsAString& aDest);
 
 /**
  * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
  *
  * @param aString a 16-bit wide string to scan
  */
-bool IsASCII( const nsAString& aString );
+bool IsASCII(const nsAString& aString);
 
 /**
  * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
  *
  * @param aString a 8-bit wide string to scan
  */
-bool IsASCII( const nsACString& aString );
+bool IsASCII(const nsACString& aString);
 
 /**
  * Returns |true| if |aString| is a valid UTF-8 string.
  * XXX This is not bullet-proof and nor an all-purpose UTF-8 validator.
  * It is mainly written to replace and roughly equivalent to
  *
  *    str.Equals(NS_ConvertUTF16toUTF8(NS_ConvertUTF8toUTF16(str)))
  *
@@ -270,139 +278,150 @@ bool IsASCII( const nsACString& aString 
  * when aRejectNonChar is true (the default), any codepoint whose low
  *   16 bits are 0xFFFE or 0xFFFF
 
  *
  * @param aString an 8-bit wide string to scan
  * @param aRejectNonChar a boolean to control the rejection of utf-8
  *        non characters
  */
-bool IsUTF8( const nsACString& aString, bool aRejectNonChar = true );
+bool IsUTF8(const nsACString& aString, bool aRejectNonChar = true);
 
 bool ParseString(const nsACString& aAstring, char aDelimiter,
                  nsTArray<nsCString>& aArray);
 
 /**
  * Converts case in place in the argument string.
  */
-void ToUpperCase( nsACString& );
+void ToUpperCase(nsACString&);
 
-void ToLowerCase( nsACString& );
+void ToLowerCase(nsACString&);
 
-void ToUpperCase( nsCSubstring& );
+void ToUpperCase(nsCSubstring&);
 
-void ToLowerCase( nsCSubstring& );
+void ToLowerCase(nsCSubstring&);
 
 /**
  * Converts case from string aSource to aDest.
  */
-void ToUpperCase( const nsACString& aSource, nsACString& aDest );
+void ToUpperCase(const nsACString& aSource, nsACString& aDest);
 
-void ToLowerCase( const nsACString& aSource, nsACString& aDest );
+void ToLowerCase(const nsACString& aSource, nsACString& aDest);
 
 /**
  * Finds the leftmost occurrence of |aPattern|, if any in the range |aSearchStart|..|aSearchEnd|.
  *
  * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
  * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
  *
  * Currently, this is equivalent to the O(m*n) implementation previously on |ns[C]String|.
  * If we need something faster, then we can implement that later.
  */
 
-bool FindInReadable( const nsAString& aPattern, nsAString::const_iterator&, nsAString::const_iterator&, const nsStringComparator& = nsDefaultStringComparator() );
-bool FindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator&, const nsCStringComparator& = nsDefaultCStringComparator() );
+bool FindInReadable(const nsAString& aPattern, nsAString::const_iterator&,
+                    nsAString::const_iterator&,
+                    const nsStringComparator& = nsDefaultStringComparator());
+bool FindInReadable(const nsACString& aPattern, nsACString::const_iterator&,
+                    nsACString::const_iterator&,
+                    const nsCStringComparator& = nsDefaultCStringComparator());
 
 /* sometimes we don't care about where the string was, just that we
  * found it or not */
-inline bool FindInReadable( const nsAString& aPattern, const nsAString& aSource, const nsStringComparator& compare = nsDefaultStringComparator() )
+inline bool
+FindInReadable(const nsAString& aPattern, const nsAString& aSource,
+               const nsStringComparator& aCompare = nsDefaultStringComparator())
 {
   nsAString::const_iterator start, end;
   aSource.BeginReading(start);
   aSource.EndReading(end);
-  return FindInReadable(aPattern, start, end, compare);
+  return FindInReadable(aPattern, start, end, aCompare);
 }
 
-inline bool FindInReadable( const nsACString& aPattern, const nsACString& aSource, const nsCStringComparator& compare = nsDefaultCStringComparator() )
+inline bool
+FindInReadable(const nsACString& aPattern, const nsACString& aSource,
+               const nsCStringComparator& aCompare = nsDefaultCStringComparator())
 {
   nsACString::const_iterator start, end;
   aSource.BeginReading(start);
   aSource.EndReading(end);
-  return FindInReadable(aPattern, start, end, compare);
+  return FindInReadable(aPattern, start, end, aCompare);
 }
 
 
-bool CaseInsensitiveFindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator& );
+bool CaseInsensitiveFindInReadable(const nsACString& aPattern,
+                                   nsACString::const_iterator&,
+                                   nsACString::const_iterator&);
 
 /**
  * Finds the rightmost occurrence of |aPattern|
  * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
  * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
  *
  */
-bool RFindInReadable( const nsAString& aPattern, nsAString::const_iterator&, nsAString::const_iterator&, const nsStringComparator& = nsDefaultStringComparator() );
-bool RFindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator&, const nsCStringComparator& = nsDefaultCStringComparator() );
+bool RFindInReadable(const nsAString& aPattern, nsAString::const_iterator&,
+                     nsAString::const_iterator&,
+                     const nsStringComparator& = nsDefaultStringComparator());
+bool RFindInReadable(const nsACString& aPattern, nsACString::const_iterator&,
+                     nsACString::const_iterator&,
+                     const nsCStringComparator& = nsDefaultCStringComparator());
 
 /**
 * Finds the leftmost occurrence of |aChar|, if any in the range
 * |aSearchStart|..|aSearchEnd|.
 *
 * Returns |true| if a match was found, and adjusts |aSearchStart| to
 * point to the match.  If no match was found, returns |false| and
 * makes |aSearchStart == aSearchEnd|.
 */
-bool FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd );
-bool FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const nsACString::const_iterator& aSearchEnd );
+bool FindCharInReadable(char16_t aChar, nsAString::const_iterator& aSearchStart,
+                        const nsAString::const_iterator& aSearchEnd);
+bool FindCharInReadable(char aChar, nsACString::const_iterator& aSearchStart,
+                        const nsACString::const_iterator& aSearchEnd);
 
 /**
 * Finds the number of occurences of |aChar| in the string |aStr|
 */
-uint32_t CountCharInReadable( const nsAString& aStr,
-                              char16_t aChar );
-uint32_t CountCharInReadable( const nsACString& aStr,
-                              char aChar );
+uint32_t CountCharInReadable(const nsAString& aStr,
+                             char16_t aChar);
+uint32_t CountCharInReadable(const nsACString& aStr,
+                             char aChar);
 
-bool
-StringBeginsWith( const nsAString& aSource, const nsAString& aSubstring,
-                  const nsStringComparator& aComparator =
-                    nsDefaultStringComparator() );
-bool
-StringBeginsWith( const nsACString& aSource, const nsACString& aSubstring,
-                  const nsCStringComparator& aComparator =
-                    nsDefaultCStringComparator() );
-bool
-StringEndsWith( const nsAString& aSource, const nsAString& aSubstring,
-                const nsStringComparator& aComparator =
-                  nsDefaultStringComparator() );
-bool
-StringEndsWith( const nsACString& aSource, const nsACString& aSubstring,
-                const nsCStringComparator& aComparator =
-                  nsDefaultCStringComparator() );
+bool StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
+                      const nsStringComparator& aComparator =
+                        nsDefaultStringComparator());
+bool StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
+                      const nsCStringComparator& aComparator =
+                        nsDefaultCStringComparator());
+bool StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
+                    const nsStringComparator& aComparator =
+                      nsDefaultStringComparator());
+bool StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
+                    const nsCStringComparator& aComparator =
+                      nsDefaultCStringComparator());
 
 const nsAFlatString& EmptyString();
 const nsAFlatCString& EmptyCString();
 
 const nsAFlatString& NullString();
 const nsAFlatCString& NullCString();
 
 /**
 * Compare a UTF-8 string to an UTF-16 string.
 *
 * Returns 0 if the strings are equal, -1 if aUTF8String is less
 * than aUTF16Count, and 1 in the reverse case.  In case of fatal
 * error (eg the strings are not valid UTF8 and UTF16 respectively),
 * this method will return INT32_MIN.
 */
-int32_t
-CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
-                   const nsASingleFragmentString& aUTF16String);
+int32_t CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
+                           const nsASingleFragmentString& aUTF16String);
 
-void
-AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest);
+void AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest);
 
 template<class T>
-inline bool EnsureStringLength(T& aStr, uint32_t aLen)
+inline bool
+EnsureStringLength(T& aStr, uint32_t aLen)
 {
   aStr.SetLength(aLen);
   return (aStr.Length() == aLen);
 }
 
 #endif // !defined(nsReadableUtils_h___)
--- a/xpcom/string/public/nsString.h
+++ b/xpcom/string/public/nsString.h
@@ -50,156 +50,156 @@ static_assert(sizeof(nsCString::char_typ
 
 
 /**
  * A helper class that converts a UTF-16 string to ASCII in a lossy manner
  */
 class NS_LossyConvertUTF16toASCII : public nsAutoCString
 {
 public:
-  explicit
-  NS_LossyConvertUTF16toASCII( const char16_t* aString )
+  explicit NS_LossyConvertUTF16toASCII(const char16_t* aString)
   {
     LossyAppendUTF16toASCII(aString, *this);
   }
 
-  NS_LossyConvertUTF16toASCII( const char16_t* aString, uint32_t aLength )
+  NS_LossyConvertUTF16toASCII(const char16_t* aString, uint32_t aLength)
   {
     LossyAppendUTF16toASCII(Substring(aString, aLength), *this);
   }
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
-  explicit
-  NS_LossyConvertUTF16toASCII( char16ptr_t aString )
-    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString)) {}
+  explicit NS_LossyConvertUTF16toASCII(char16ptr_t aString)
+    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString))
+  {
+  }
 
-  NS_LossyConvertUTF16toASCII( char16ptr_t aString, uint32_t aLength )
-    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString), aLength) {}
+  NS_LossyConvertUTF16toASCII(char16ptr_t aString, uint32_t aLength)
+    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString), aLength)
+  {
+  }
 #endif
 
-  explicit
-  NS_LossyConvertUTF16toASCII( const nsAString& aString )
+  explicit NS_LossyConvertUTF16toASCII(const nsAString& aString)
   {
     LossyAppendUTF16toASCII(aString, *this);
   }
 
 private:
   // NOT TO BE IMPLEMENTED
-  NS_LossyConvertUTF16toASCII( char ) MOZ_DELETE;
+  NS_LossyConvertUTF16toASCII(char) MOZ_DELETE;
 };
 
 
 class NS_ConvertASCIItoUTF16 : public nsAutoString
 {
 public:
-  explicit
-  NS_ConvertASCIItoUTF16( const char* aCString )
+  explicit NS_ConvertASCIItoUTF16(const char* aCString)
   {
     AppendASCIItoUTF16(aCString, *this);
   }
 
-  NS_ConvertASCIItoUTF16( const char* aCString, uint32_t aLength )
+  NS_ConvertASCIItoUTF16(const char* aCString, uint32_t aLength)
   {
     AppendASCIItoUTF16(Substring(aCString, aLength), *this);
   }
 
-  explicit
-  NS_ConvertASCIItoUTF16( const nsACString& aCString )
+  explicit NS_ConvertASCIItoUTF16(const nsACString& aCString)
   {
     AppendASCIItoUTF16(aCString, *this);
   }
 
 private:
   // NOT TO BE IMPLEMENTED
-  NS_ConvertASCIItoUTF16( char16_t ) MOZ_DELETE;
+  NS_ConvertASCIItoUTF16(char16_t) MOZ_DELETE;
 };
 
 
 /**
  * A helper class that converts a UTF-16 string to UTF-8
  */
 class NS_ConvertUTF16toUTF8 : public nsAutoCString
 {
 public:
-  explicit
-  NS_ConvertUTF16toUTF8( const char16_t* aString )
+  explicit NS_ConvertUTF16toUTF8(const char16_t* aString)
   {
     AppendUTF16toUTF8(aString, *this);
   }
 
-  NS_ConvertUTF16toUTF8( const char16_t* aString, uint32_t aLength )
+  NS_ConvertUTF16toUTF8(const char16_t* aString, uint32_t aLength)
   {
     AppendUTF16toUTF8(Substring(aString, aLength), *this);
   }
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
-  NS_ConvertUTF16toUTF8( char16ptr_t aString ) : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString)) {}
+  NS_ConvertUTF16toUTF8(char16ptr_t aString)
+    : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString))
+  {
+  }
 
-  NS_ConvertUTF16toUTF8( char16ptr_t aString, uint32_t aLength )
-    : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength) {}
+  NS_ConvertUTF16toUTF8(char16ptr_t aString, uint32_t aLength)
+    : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength)
+  {
+  }
 #endif
 
-  explicit
-  NS_ConvertUTF16toUTF8( const nsAString& aString )
+  explicit NS_ConvertUTF16toUTF8(const nsAString& aString)
   {
     AppendUTF16toUTF8(aString, *this);
   }
 
 private:
   // NOT TO BE IMPLEMENTED
-  NS_ConvertUTF16toUTF8( char ) MOZ_DELETE;
+  NS_ConvertUTF16toUTF8(char) MOZ_DELETE;
 };
 
 
 class NS_ConvertUTF8toUTF16 : public nsAutoString
 {
 public:
-  explicit
-  NS_ConvertUTF8toUTF16( const char* aCString )
+  explicit NS_ConvertUTF8toUTF16(const char* aCString)
   {
     AppendUTF8toUTF16(aCString, *this);
   }
 
-  NS_ConvertUTF8toUTF16( const char* aCString, uint32_t aLength )
+  NS_ConvertUTF8toUTF16(const char* aCString, uint32_t aLength)
   {
     AppendUTF8toUTF16(Substring(aCString, aLength), *this);
   }
 
-  explicit
-  NS_ConvertUTF8toUTF16( const nsACString& aCString )
+  explicit NS_ConvertUTF8toUTF16(const nsACString& aCString)
   {
     AppendUTF8toUTF16(aCString, *this);
   }
 
 private:
   // NOT TO BE IMPLEMENTED
-  NS_ConvertUTF8toUTF16( char16_t ) MOZ_DELETE;
+  NS_ConvertUTF8toUTF16(char16_t) MOZ_DELETE;
 };
 
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
 
 inline char16_t*
-wwc(wchar_t *str)
+wwc(wchar_t* aStr)
 {
-  return reinterpret_cast<char16_t*>(str);
+  return reinterpret_cast<char16_t*>(aStr);
 }
 
 inline wchar_t*
-wwc(char16_t *str)
+wwc(char16_t* aStr)
 {
-  return reinterpret_cast<wchar_t*>(str);
+  return reinterpret_cast<wchar_t*>(aStr);
 }
 
 #else
 
 inline char16_t*
-wwc(char16_t *str)
+wwc(char16_t* aStr)
 {
-  return str;
+  return aStr;
 }
 
 #endif
 
 // the following are included/declared for backwards compatibility
 typedef nsAutoString nsVoidableString;
 
 #include "nsDependentString.h"
--- a/xpcom/string/public/nsStringBuffer.h
+++ b/xpcom/string/public/nsStringBuffer.h
@@ -40,30 +40,30 @@ public:
    * buffer by calling the Data method to fetch the raw data pointer.  Care
    * must be taken to properly null terminate the character array.  The
    * storage size can be greater than the length of the actual string
    * (i.e., it is not required that the null terminator appear in the last
    * storage unit of the string buffer's data).
    *
    * @return new string buffer or null if out of memory.
    */
-  static already_AddRefed<nsStringBuffer> Alloc(size_t storageSize);
+  static already_AddRefed<nsStringBuffer> Alloc(size_t aStorageSize);
 
   /**
    * Resizes the given string buffer to the specified storage size.  This
    * method must not be called on a readonly string buffer.  Use this API
    * carefully!!
    *
    * This method behaves like the ANSI-C realloc function.  (i.e., If the
    * allocation fails, null will be returned and the given string buffer
    * will remain unmodified.)
    *
    * @see IsReadonly
    */
-  static nsStringBuffer* Realloc(nsStringBuffer* buf, size_t storageSize);
+  static nsStringBuffer* Realloc(nsStringBuffer* aBuf, size_t aStorageSize);
 
   /**
    * Increment the reference count on this string buffer.
    */
   void NS_FASTCALL AddRef();
 
   /**
    * Decrement the reference count on this string buffer.  The string
@@ -71,27 +71,27 @@ public:
    */
   void NS_FASTCALL Release();
 
   /**
    * This method returns the string buffer corresponding to the given data
    * pointer.  The data pointer must have been returned previously by a
    * call to the nsStringBuffer::Data method.
    */
-  static nsStringBuffer* FromData(void* data)
+  static nsStringBuffer* FromData(void* aData)
   {
-    return reinterpret_cast<nsStringBuffer*> (data) - 1;
+    return reinterpret_cast<nsStringBuffer*>(aData) - 1;
   }
 
   /**
    * This method returns the data pointer for this string buffer.
    */
   void* Data() const
   {
-    return const_cast<char*> (reinterpret_cast<const char*> (this + 1));
+    return const_cast<char*>(reinterpret_cast<const char*>(this + 1));
   }
 
   /**
    * This function returns the storage size of a string buffer in bytes.
    * This value is the same value that was originally passed to Alloc (or
    * Realloc).
    */
   uint32_t StorageSize() const
@@ -115,37 +115,35 @@ public:
   /**
    * The FromString methods return a string buffer for the given string
    * object or null if the string object does not have a string buffer.
    * The reference count of the string buffer is NOT incremented by these
    * methods.  If the caller wishes to hold onto the returned value, then
    * the returned string buffer must have its reference count incremented
    * via a call to the AddRef method.
    */
-  static nsStringBuffer* FromString(const nsAString &str);
-  static nsStringBuffer* FromString(const nsACString &str);
+  static nsStringBuffer* FromString(const nsAString& aStr);
+  static nsStringBuffer* FromString(const nsACString& aStr);
 
   /**
    * The ToString methods assign this string buffer to a given string
    * object.  If the string object does not support sharable string
    * buffers, then its value will be set to a copy of the given string
    * buffer.  Otherwise, these methods increment the reference count of the
    * given string buffer.  It is important to specify the length (in
    * storage units) of the string contained in the string buffer since the
    * length of the string may be less than its storage size.  The string
    * must have a null terminator at the offset specified by |len|.
    *
    * NOTE: storage size is measured in bytes even for wide strings;
    *       however, string length is always measured in storage units
    *       (2-byte units for wide strings).
    */
-  void ToString(uint32_t len, nsAString &str,
-                bool aMoveOwnership = false);
-  void ToString(uint32_t len, nsACString &str,
-                bool aMoveOwnership = false);
+  void ToString(uint32_t aLen, nsAString& aStr, bool aMoveOwnership = false);
+  void ToString(uint32_t aLen, nsACString& aStr, bool aMoveOwnership = false);
 
   /**
    * This measures the size.  It should only be used if the StringBuffer is
    * unshared.  This is checked.
    */
   size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   /**
--- a/xpcom/string/public/nsStringIterator.h
+++ b/xpcom/string/public/nsStringIterator.h
@@ -34,115 +34,106 @@ private:
   // we supported multi-fragment strings, but now it is really just
   // extra baggage.  we should remove mStart and mEnd at some point.
 
   const CharT* mStart;
   const CharT* mEnd;
   const CharT* mPosition;
 
 public:
-  nsReadingIterator() { }
+  nsReadingIterator()
+  {
+  }
   // nsReadingIterator( const nsReadingIterator<CharT>& );                    // auto-generated copy-constructor OK
   // nsReadingIterator<CharT>& operator=( const nsReadingIterator<CharT>& );  // auto-generated copy-assignment operator OK
 
-  inline void normalize_forward() {}
-  inline void normalize_backward() {}
+  inline void normalize_forward()
+  {
+  }
+  inline void normalize_backward()
+  {
+  }
 
-  pointer
-  start() const
+  pointer start() const
   {
     return mStart;
   }
 
-  pointer
-  end() const
+  pointer end() const
   {
     return mEnd;
   }
 
-  pointer
-  get() const
+  pointer get() const
   {
     return mPosition;
   }
 
-  CharT
-  operator*() const
+  CharT operator*() const
   {
     return *get();
   }
 
 #if 0
   // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
   //  don't like this when |CharT| is a type without members.
-  pointer
-  operator->() const
+  pointer operator->() const
   {
     return get();
   }
 #endif
 
-  self_type&
-  operator++()
+  self_type& operator++()
   {
     ++mPosition;
     return *this;
   }
 
-  self_type
-  operator++( int )
+  self_type operator++(int)
   {
     self_type result(*this);
     ++mPosition;
     return result;
   }
 
-  self_type&
-  operator--()
+  self_type& operator--()
   {
     --mPosition;
     return *this;
   }
 
-  self_type
-  operator--( int )
+  self_type operator--(int)
   {
     self_type result(*this);
     --mPosition;
     return result;
   }
 
-  difference_type
-  size_forward() const
+  difference_type size_forward() const
   {
     return mEnd - mPosition;
   }
 
-  difference_type
-  size_backward() const
+  difference_type size_backward() const
   {
     return mPosition - mStart;
   }
 
-  self_type&
-  advance( difference_type n )
+  self_type& advance(difference_type aN)
   {
-    if (n > 0)
-    {
-      difference_type step = XPCOM_MIN(n, size_forward());
+    if (aN > 0) {
+      difference_type step = XPCOM_MIN(aN, size_forward());
 
-      NS_ASSERTION(step>0, "can't advance a reading iterator beyond the end of a string");
+      NS_ASSERTION(step > 0, "can't advance a reading iterator beyond the end of a string");
 
       mPosition += step;
-    }
-    else if (n < 0)
-    {
-      difference_type step = XPCOM_MAX(n, -size_backward());
+    } else if (aN < 0) {
+      difference_type step = XPCOM_MAX(aN, -size_backward());
 
-      NS_ASSERTION(step<0, "can't advance (backward) a reading iterator beyond the end of a string");
+      NS_ASSERTION(step < 0, "can't advance (backward) a reading iterator beyond the end of a string");
 
       mPosition += step;
     }
     return *this;
   }
 };
 
 /**
@@ -168,161 +159,152 @@ private:
   // we supported multi-fragment strings, but now it is really just
   // extra baggage.  we should remove mStart and mEnd at some point.
 
   CharT* mStart;
   CharT* mEnd;
   CharT* mPosition;
 
 public:
-  nsWritingIterator() { }
+  nsWritingIterator()
+  {
+  }
   // nsWritingIterator( const nsWritingIterator<CharT>& );                    // auto-generated copy-constructor OK
   // nsWritingIterator<CharT>& operator=( const nsWritingIterator<CharT>& );  // auto-generated copy-assignment operator OK
 
-  inline void normalize_forward() {}
-  inline void normalize_backward() {}
+  inline void normalize_forward()
+  {
+  }
+  inline void normalize_backward()
+  {
+  }
 
-  pointer
-  start() const
+  pointer start() const
   {
     return mStart;
   }
 
-  pointer
-  end() const
+  pointer end() const
   {
     return mEnd;
   }
 
-  pointer
-  get() const
+  pointer get() const
   {
     return mPosition;
   }
 
-  reference
-  operator*() const
+  reference operator*() const
   {
     return *get();
   }
 
 #if 0
   // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
   //  don't like this when |CharT| is a type without members.
   pointer
   operator->() const
   {
     return get();
   }
 #endif
 
-  self_type&
-  operator++()
+  self_type& operator++()
   {
     ++mPosition;
     return *this;
   }
 
-  self_type
-  operator++( int )
+  self_type operator++(int)
   {
     self_type result(*this);
     ++mPosition;
     return result;
   }
 
-  self_type&
-  operator--()
+  self_type& operator--()
   {
     --mPosition;
     return *this;
   }
 
-  self_type
-  operator--( int )
+  self_type operator--(int)
   {
     self_type result(*this);
     --mPosition;
     return result;
   }
 
-  difference_type
-  size_forward() const
+  difference_type size_forward() const
   {
     return mEnd - mPosition;
   }
 
-  difference_type
-  size_backward() const
+  difference_type size_backward() const
   {
     return mPosition - mStart;
   }
 
-  self_type&
-  advance( difference_type n )
+  self_type& advance(difference_type aN)
   {
-    if (n > 0)
-    {
-      difference_type step = XPCOM_MIN(n, size_forward());
+    if (aN > 0) {
+      difference_type step = XPCOM_MIN(aN, size_forward());
 
-      NS_ASSERTION(step>0, "can't advance a writing iterator beyond the end of a string");
+      NS_ASSERTION(step > 0, "can't advance a writing iterator beyond the end of a string");
 
       mPosition += step;
-    }
-    else if (n < 0)
-    {
-      difference_type step = XPCOM_MAX(n, -size_backward());
+    } else if (aN < 0) {
+      difference_type step = XPCOM_MAX(aN, -size_backward());
 
-      NS_ASSERTION(step<0, "can't advance (backward) a writing iterator beyond the end of a string");
+      NS_ASSERTION(step < 0, "can't advance (backward) a writing iterator beyond the end of a string");
 
       mPosition += step;
     }
     return *this;
   }
 
-  void
-  write( const value_type* s, uint32_t n )
+  void write(const value_type* aS, uint32_t aN)
   {
     NS_ASSERTION(size_forward() > 0, "You can't |write| into an |nsWritingIterator| with no space!");
 
-    nsCharTraits<value_type>::move(mPosition, s, n);
-    advance( difference_type(n) );
+    nsCharTraits<value_type>::move(mPosition, aS, aN);
+    advance(difference_type(aN));
   }
 };
 
 template <class CharT>
-inline
-bool
-operator==( const nsReadingIterator<CharT>& lhs, const nsReadingIterator<CharT>& rhs )
+inline bool
+operator==(const nsReadingIterator<CharT>& aLhs,
+           const nsReadingIterator<CharT>& aRhs)
 {
-  return lhs.get() == rhs.get();
+  return aLhs.get() == aRhs.get();
 }
 
 template <class CharT>
-inline
-bool
-operator!=( const nsReadingIterator<CharT>& lhs, const nsReadingIterator<CharT>& rhs )
+inline bool
+operator!=(const nsReadingIterator<CharT>& aLhs,
+           const nsReadingIterator<CharT>& aRhs)
 {
-  return lhs.get() != rhs.get();
+  return aLhs.get() != aRhs.get();
 }
 
 
 //
 // |nsWritingIterator|s
 //
 
 template <class CharT>
-inline
-bool
-operator==( const nsWritingIterator<CharT>& lhs, const nsWritingIterator<CharT>& rhs )
+inline bool
+operator==(const nsWritingIterator<CharT>& aLhs,
+           const nsWritingIterator<CharT>& aRhs)
 {
-  return lhs.get() == rhs.get();
+  return aLhs.get() == aRhs.get();
 }
 
 template <class CharT>
-inline
-bool
-operator!=( const nsWritingIterator<CharT>& lhs, const nsWritingIterator<CharT>& rhs )
+inline bool
+operator!=(const nsWritingIterator<CharT>& aLhs,
+           const nsWritingIterator<CharT>& aRhs)
 {
-  return lhs.get() != rhs.get();
+  return aLhs.get() != aRhs.get();
 }
 
 #endif /* !defined(nsStringIterator_h___) */
--- a/xpcom/string/public/nsTDependentString.h
+++ b/xpcom/string/public/nsTDependentString.h
@@ -15,84 +15,92 @@
  * of objects of this type must take care to ensure that a
  * nsTDependentString continues to reference valid memory for the
  * duration of its use.
  */
 class nsTDependentString_CharT : public nsTString_CharT
 {
 public:
 
-  typedef nsTDependentString_CharT    self_type;
+  typedef nsTDependentString_CharT self_type;
 
 public:
 
   /**
    * constructors
    */
 
-  nsTDependentString_CharT( const char_type* start, const char_type* end )
-    : string_type(const_cast<char_type*>(start), uint32_t(end - start), F_TERMINATED)
+  nsTDependentString_CharT(const char_type* aStart, const char_type* aEnd)
+    : string_type(const_cast<char_type*>(aStart),
+                  uint32_t(aEnd - aStart), F_TERMINATED)
   {
     AssertValidDepedentString();
   }
 
-  nsTDependentString_CharT( const char_type* data, uint32_t length )
-    : string_type(const_cast<char_type*>(data), length, F_TERMINATED)
+  nsTDependentString_CharT(const char_type* aData, uint32_t aLength)
+    : string_type(const_cast<char_type*>(aData), aLength, F_TERMINATED)
   {
     AssertValidDepedentString();
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  nsTDependentString_CharT( char16ptr_t data, uint32_t length )
-    : nsTDependentString_CharT(static_cast<const char16_t*>(data), length) {}
+  nsTDependentString_CharT(char16ptr_t aData, uint32_t aLength)
+    : nsTDependentString_CharT(static_cast<const char16_t*>(aData), aLength)
+  {
+  }
 #endif
 
   explicit
-  nsTDependentString_CharT( const char_type* data )
-    : string_type(const_cast<char_type*>(data), uint32_t(char_traits::length(data)), F_TERMINATED)
+  nsTDependentString_CharT(const char_type* aData)
+    : string_type(const_cast<char_type*>(aData),
+                  uint32_t(char_traits::length(aData)), F_TERMINATED)
   {
     AssertValidDepedentString();
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   explicit
-  nsTDependentString_CharT( char16ptr_t data )
-    : nsTDependentString_CharT( static_cast<const char16_t*>(data)) {}
+  nsTDependentString_CharT(char16ptr_t aData)
+    : nsTDependentString_CharT(static_cast<const char16_t*>(aData))
+  {
+  }
 #endif
 
-  nsTDependentString_CharT( const string_type& str, uint32_t startPos )
+  nsTDependentString_CharT(const string_type& aStr, uint32_t aStartPos)
     : string_type()
   {
-    Rebind(str, startPos);
+    Rebind(aStr, aStartPos);
   }
 
   // Create a nsTDependentSubstring to be bound later
   nsTDependentString_CharT()
-    : string_type() {}
+    : string_type()
+  {
+  }
 
   // XXX are you sure??
   // auto-generated copy-constructor OK
   // auto-generated copy-assignment operator OK
   // auto-generated destructor OK
 
 
   /**
    * allow this class to be bound to a different string...
    */
 
   using nsTString_CharT::Rebind;
-  void Rebind( const char_type* data )
+  void Rebind(const char_type* aData)
   {
-    Rebind(data, uint32_t(char_traits::length(data)));
+    Rebind(aData, uint32_t(char_traits::length(aData)));
   }
 
-  void Rebind( const char_type* start, const char_type* end )
+  void Rebind(const char_type* aStart, const char_type* aEnd)
   {
-    Rebind(start, uint32_t(end - start));
+    Rebind(aStart, uint32_t(aEnd - aStart));
   }
 
-  void Rebind( const string_type&, uint32_t startPos );
+  void Rebind(const string_type&, uint32_t aStartPos);
 
 private:
 
   // NOT USED
-  nsTDependentString_CharT( const substring_tuple_type& ) MOZ_DELETE;
+  nsTDependentString_CharT(const substring_tuple_type&) MOZ_DELETE;
 };
--- a/xpcom/string/public/nsTDependentSubstring.h
+++ b/xpcom/string/public/nsTDependentSubstring.h
@@ -15,96 +15,110 @@
  * NAMES:
  *   nsDependentSubstring for wide characters
  *   nsDependentCSubstring for narrow characters
  */
 class nsTDependentSubstring_CharT : public nsTSubstring_CharT
 {
 public:
 
-  typedef nsTDependentSubstring_CharT    self_type;
+  typedef nsTDependentSubstring_CharT self_type;
 
 public:
 
-  void Rebind( const substring_type&, uint32_t startPos, uint32_t length = size_type(-1) );
-
-  void Rebind( const char_type* data, size_type length );
+  void Rebind(const substring_type&, uint32_t aStartPos,
+              uint32_t aLength = size_type(-1));
 
-  void Rebind( const char_type* start, const char_type* end )
+  void Rebind(const char_type* aData, size_type aLength);
+
+  void Rebind(const char_type* aStart, const char_type* aEnd)
   {
-    Rebind(start, size_type(end - start));
+    Rebind(aStart, size_type(aEnd - aStart));
   }
 
-  nsTDependentSubstring_CharT( const substring_type& str, uint32_t startPos, uint32_t length = size_type(-1) )
+  nsTDependentSubstring_CharT(const substring_type& aStr, uint32_t aStartPos,
+                              uint32_t aLength = size_type(-1))
     : substring_type()
   {
-    Rebind(str, startPos, length);
+    Rebind(aStr, aStartPos, aLength);
+  }
+
+  nsTDependentSubstring_CharT(const char_type* aData, size_type aLength)
+    : substring_type(const_cast<char_type*>(aData), aLength, F_NONE)
+  {
   }
 
-  nsTDependentSubstring_CharT( const char_type* data, size_type length )
-    : substring_type(const_cast<char_type*>(data), length, F_NONE) {}
-
-  nsTDependentSubstring_CharT( const char_type* start, const char_type* end )
-    : substring_type(const_cast<char_type*>(start), uint32_t(end - start), F_NONE) {}
+  nsTDependentSubstring_CharT(const char_type* aStart, const char_type* aEnd)
+    : substring_type(const_cast<char_type*>(aStart), uint32_t(aEnd - aStart),
+                     F_NONE)
+  {
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  nsTDependentSubstring_CharT( char16ptr_t data, size_type length )
-    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(data), length) {}
+  nsTDependentSubstring_CharT(char16ptr_t aData, size_type aLength)
+    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(aData), aLength)
+  {
+  }
 
-  nsTDependentSubstring_CharT( char16ptr_t start, char16ptr_t end )
-    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(start), static_cast<const char16_t*>(end)) {}
+  nsTDependentSubstring_CharT(char16ptr_t aStart, char16ptr_t aEnd)
+    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(aStart),
+                                  static_cast<const char16_t*>(aEnd))
+  {
+  }
 #endif
 
-  nsTDependentSubstring_CharT( const const_iterator& start, const const_iterator& end )
-    : substring_type(const_cast<char_type*>(start.get()), uint32_t(end.get() - start.get()), F_NONE) {}
+  nsTDependentSubstring_CharT(const const_iterator& aStart,
+                              const const_iterator& aEnd)
+    : substring_type(const_cast<char_type*>(aStart.get()),
+                     uint32_t(aEnd.get() - aStart.get()), F_NONE)
+  {
+  }
 
   // Create a nsTDependentSubstring to be bound later
   nsTDependentSubstring_CharT()
-    : substring_type() {}
+    : substring_type()
+  {
+  }
 
   // auto-generated copy-constructor OK (XXX really?? what about base class copy-ctor?)
 
 private:
   // NOT USED
-  void operator=( const self_type& );        // we're immutable, you can't assign into a substring
+  void operator=(const self_type&);  // we're immutable, you can't assign into a substring
 };
 
-inline
-const nsTDependentSubstring_CharT
-Substring( const nsTSubstring_CharT& str, uint32_t startPos, uint32_t length = uint32_t(-1) )
+inline const nsTDependentSubstring_CharT
+Substring(const nsTSubstring_CharT& aStr, uint32_t aStartPos,
+          uint32_t aLength = uint32_t(-1))
 {
-  return nsTDependentSubstring_CharT(str, startPos, length);
+  return nsTDependentSubstring_CharT(aStr, aStartPos, aLength);
 }
 
-inline
-const nsTDependentSubstring_CharT
-Substring( const nsReadingIterator<CharT>& start, const nsReadingIterator<CharT>& end )
+inline const nsTDependentSubstring_CharT
+Substring(const nsReadingIterator<CharT>& aStart,
+          const nsReadingIterator<CharT>& aEnd)
 {
-  return nsTDependentSubstring_CharT(start.get(), end.get());
+  return nsTDependentSubstring_CharT(aStart.get(), aEnd.get());
 }
 
-inline
-const nsTDependentSubstring_CharT
-Substring( const CharT* data, uint32_t length )
+inline const nsTDependentSubstring_CharT
+Substring(const CharT* aData, uint32_t aLength)
 {
-  return nsTDependentSubstring_CharT(data, length);
+  return nsTDependentSubstring_CharT(aData, aLength);
 }
 
-inline
-const nsTDependentSubstring_CharT
-Substring( const CharT* start, const CharT* end )
+inline const nsTDependentSubstring_CharT
+Substring(const CharT* aStart, const CharT* aEnd)
 {
-  return nsTDependentSubstring_CharT(start, end);
+  return nsTDependentSubstring_CharT(aStart, aEnd);
 }
 
-inline
-const nsTDependentSubstring_CharT
-StringHead( const nsTSubstring_CharT& str, uint32_t count )
+inline const nsTDependentSubstring_CharT
+StringHead(const nsTSubstring_CharT& aStr, uint32_t aCount)
 {
-  return nsTDependentSubstring_CharT(str, 0, count);
+  return nsTDependentSubstring_CharT(aStr, 0, aCount);
 }
 
-inline
-const nsTDependentSubstring_CharT
-StringTail( const nsTSubstring_CharT& str, uint32_t count )
+inline const nsTDependentSubstring_CharT
+StringTail(const nsTSubstring_CharT& aStr, uint32_t aCount)
 {
-  return nsTDependentSubstring_CharT(str, str.Length() - count, count);
+  return nsTDependentSubstring_CharT(aStr, aStr.Length() - aCount, aCount);
 }
--- a/xpcom/string/public/nsTLiteralString.h
+++ b/xpcom/string/public/nsTLiteralString.h
@@ -14,28 +14,28 @@
  * character sequence.  This class does not own its data. The data is
  * assumed to be permanent. In practice this is true because this code
  * is only usable by and for libxul.
  */
 class nsTLiteralString_CharT : public nsTString_CharT
 {
 public:
 
-  typedef nsTLiteralString_CharT    self_type;
+  typedef nsTLiteralString_CharT self_type;
 
 public:
 
   /**
    * constructor
    */
 
   template<size_type N>
-  nsTLiteralString_CharT( const char_type (&str)[N] )
-    : string_type(const_cast<char_type*>(str), N - 1, F_TERMINATED | F_LITERAL)
+  nsTLiteralString_CharT(const char_type (&aStr)[N])
+    : string_type(const_cast<char_type*>(aStr), N - 1, F_TERMINATED | F_LITERAL)
   {
   }
 
 private:
 
   // NOT TO BE IMPLEMENTED
   template<size_type N>
-  nsTLiteralString_CharT( char_type (&str)[N] ) MOZ_DELETE;
+  nsTLiteralString_CharT(char_type (&aStr)[N]) MOZ_DELETE;
 };
--- a/xpcom/string/public/nsTPromiseFlatString.h
+++ b/xpcom/string/public/nsTPromiseFlatString.h
@@ -57,50 +57,50 @@
  * copying.  In the event that you end up assigning the result into a sharing
  * string (e.g., |nsTString|), the right thing happens.
  */
 
 class nsTPromiseFlatString_CharT : public nsTString_CharT
 {
 public:
 
-  typedef nsTPromiseFlatString_CharT    self_type;
+  typedef nsTPromiseFlatString_CharT self_type;
 
 private:
 
-  void Init( const substring_type& );
+  void Init(const substring_type&);
 
   // NOT TO BE IMPLEMENTED
-  void operator=( const self_type& ) MOZ_DELETE;
+  void operator=(const self_type&) MOZ_DELETE;
 
   // NOT TO BE IMPLEMENTED
   nsTPromiseFlatString_CharT() MOZ_DELETE;
 
   // NOT TO BE IMPLEMENTED
-  nsTPromiseFlatString_CharT( const string_type& str ) MOZ_DELETE;
+  nsTPromiseFlatString_CharT(const string_type& aStr) MOZ_DELETE;
 
 public:
 
   explicit
-  nsTPromiseFlatString_CharT( const substring_type& str )
+  nsTPromiseFlatString_CharT(const substring_type& aStr)
     : string_type()
   {
-    Init(str);
+    Init(aStr);
   }
 
   explicit
-  nsTPromiseFlatString_CharT( const substring_tuple_type& tuple )
+  nsTPromiseFlatString_CharT(const substring_tuple_type& aTuple)
     : string_type()
   {
     // nothing else to do here except assign the value of the tuple
     // into ourselves.
-    Assign(tuple);
+    Assign(aTuple);
   }
 };
 
 // We template this so that the constructor is chosen based on the type of the
 // parameter. This allows us to reject attempts to promise a flat flat string.
 template<class T>
 const nsTPromiseFlatString_CharT
-TPromiseFlatString_CharT( const T& string )
+TPromiseFlatString_CharT(const T& aString)
 {
-  return nsTPromiseFlatString_CharT(string);
+  return nsTPromiseFlatString_CharT(aString);
 }
--- a/xpcom/string/public/nsTString.h
+++ b/xpcom/string/public/nsTString.h
@@ -16,72 +16,98 @@
  *
  * This class is also known as nsAFlat[C]String, where "flat" is used
  * to denote a null-terminated string.
  */
 class nsTString_CharT : public nsTSubstring_CharT
 {
 public:
 
-  typedef nsTString_CharT    self_type;
+  typedef nsTString_CharT self_type;
 
 public:
 
   /**
    * constructors
    */
 
   nsTString_CharT()
-    : substring_type() {}
+    : substring_type()
+  {
+  }
 
   explicit
-  nsTString_CharT( const char_type* data, size_type length = size_type(-1) )
+  nsTString_CharT(const char_type* aData, size_type aLength = size_type(-1))
     : substring_type()
   {
-    Assign(data, length);
+    Assign(aData, aLength);
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   explicit
-  nsTString_CharT( char16ptr_t data, size_type length = size_type(-1) )
+  nsTString_CharT(char16ptr_t aStr, size_type aLength = size_type(-1))
     : substring_type()
   {
-    Assign(static_cast<const char16_t*>(data), length);
+    Assign(static_cast<const char16_t*>(aStr), aLength);
   }
 #endif
 
-  nsTString_CharT( const self_type& str )
+  nsTString_CharT(const self_type& aStr)
     : substring_type()
   {
-    Assign(str);
+    Assign(aStr);
   }
 
-  MOZ_IMPLICIT nsTString_CharT( const substring_tuple_type& tuple )
+  MOZ_IMPLICIT nsTString_CharT(const substring_tuple_type& aTuple)
     : substring_type()
   {
-    Assign(tuple);
+    Assign(aTuple);
   }
 
   explicit
-  nsTString_CharT( const substring_type& readable )
+  nsTString_CharT(const substring_type& aReadable)
     : substring_type()
   {
-    Assign(readable);
+    Assign(aReadable);
   }
 
 
   // |operator=| does not inherit, so we must define our own
-  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
-  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
-  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
+  self_type& operator=(char_type aChar)
+  {
+    Assign(aChar);
+    return *this;
+  }
+  self_type& operator=(const char_type* aData)
+  {
+    Assign(aData);
+    return *this;
+  }
+  self_type& operator=(const self_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  self_type& operator=( const char16ptr_t data )            { Assign(static_cast<const char16_t*>(data)); return *this; }
+  self_type& operator=(const char16ptr_t aStr)
+  {
+    Assign(static_cast<const char16_t*>(aStr));
+    return *this;
+  }
 #endif
-  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
-  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+  self_type& operator=(const substring_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 
   /**
    * returns the null-terminated string
    */
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   char16ptr_t get() const
 #else
@@ -94,25 +120,25 @@ public:
 
   /**
    * returns character at specified index.
    *
    * NOTE: unlike nsTSubstring::CharAt, this function allows you to index
    *       the null terminator character.
    */
 
-  char_type CharAt( index_type i ) const
+  char_type CharAt(index_type aIndex) const
   {
-    NS_ASSERTION(i <= mLength, "index exceeds allowable range");
-    return mData[i];
+    NS_ASSERTION(aIndex <= mLength, "index exceeds allowable range");
+    return mData[aIndex];
   }
 
-  char_type operator[]( index_type i ) const
+  char_type operator[](index_type aIndex) const
   {
-    return CharAt(i);
+    return CharAt(aIndex);
   }
 
 
 #if MOZ_STRING_WITH_OBSOLETE_API
 
 
   /**
    *  Search for the given substring within this string.
@@ -120,24 +146,29 @@ public:
    *  @param   aString is substring to be sought in this
    *  @param   aIgnoreCase selects case sensitivity
    *  @param   aOffset tells us where in this string to start searching
    *  @param   aCount tells us how far from the offset we are to search. Use
    *           -1 to search the whole string.
    *  @return  offset in string, or kNotFound
    */
 
-  int32_t Find( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
-  int32_t Find( const char* aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find(const nsCString& aString, bool aIgnoreCase = false,
+               int32_t aOffset = 0, int32_t aCount = -1) const;
+  int32_t Find(const char* aString, bool aIgnoreCase = false,
+               int32_t aOffset = 0, int32_t aCount = -1) const;
 
 #ifdef CharT_is_PRUnichar
-  int32_t Find( const nsAFlatString& aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
-  int32_t Find( const char16_t* aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find(const nsAFlatString& aString, int32_t aOffset = 0,
+               int32_t aCount = -1) const;
+  int32_t Find(const char16_t* aString, int32_t aOffset = 0,
+               int32_t aCount = -1) const;
 #ifdef MOZ_USE_CHAR16_WRAPPER
-  int32_t Find( char16ptr_t aString, int32_t aOffset=0, int32_t aCount=-1 ) const
+  int32_t Find(char16ptr_t aString, int32_t aOffset = 0,
+               int32_t aCount = -1) const
   {
     return Find(static_cast<const char16_t*>(aString), aOffset, aCount);
   }
 #endif
 #endif
 
 
   /**
@@ -147,143 +178,151 @@ public:
    * @param   aIgnoreCase tells us whether or not to do caseless compare
    * @param   aOffset tells us where in this string to start searching.
    *          Use -1 to search from the end of the string.
    * @param   aCount tells us how many iterations to make starting at the
    *          given offset.
    * @return  offset in string, or kNotFound
    */
 
-  int32_t RFind( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
-  int32_t RFind( const char* aCString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFind(const nsCString& aString, bool aIgnoreCase = false,
+                int32_t aOffset = -1, int32_t aCount = -1) const;
+  int32_t RFind(const char* aCString, bool aIgnoreCase = false,
+                int32_t aOffset = -1, int32_t aCount = -1) const;
 
 #ifdef CharT_is_PRUnichar
-  int32_t RFind( const nsAFlatString& aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
-  int32_t RFind( const char16_t* aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFind(const nsAFlatString& aString, int32_t aOffset = -1,
+                int32_t aCount = -1) const;
+  int32_t RFind(const char16_t* aString, int32_t aOffset = -1,
+                int32_t aCount = -1) const;
 #endif
 
 
   /**
    *  Search for given char within this string
    *
    *  @param   aChar is the character to search for
    *  @param   aOffset tells us where in this string to start searching
    *  @param   aCount tells us how far from the offset we are to search.
    *           Use -1 to search the whole string.
    *  @return  offset in string, or kNotFound
    */
 
   // int32_t FindChar( char16_t aChar, int32_t aOffset=0, int32_t aCount=-1 ) const;
-  int32_t RFindChar( char16_t aChar, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFindChar(char16_t aChar, int32_t aOffset = -1,
+                    int32_t aCount = -1) const;
 
 
   /**
    * This method searches this string for the first character found in
    * the given string.
    *
    * @param aString contains set of chars to be found
    * @param aOffset tells us where in this string to start searching
    *        (counting from left)
    * @return offset in string, or kNotFound
    */
 
-  int32_t FindCharInSet( const char* aString, int32_t aOffset=0 ) const;
-  int32_t FindCharInSet( const self_type& aString, int32_t aOffset=0 ) const
+  int32_t FindCharInSet(const char* aString, int32_t aOffset = 0) const;
+  int32_t FindCharInSet(const self_type& aString, int32_t aOffset = 0) const
   {
     return FindCharInSet(aString.get(), aOffset);
   }
 
 #ifdef CharT_is_PRUnichar
-  int32_t FindCharInSet( const char16_t* aString, int32_t aOffset=0 ) const;
+  int32_t FindCharInSet(const char16_t* aString, int32_t aOffset = 0) const;
 #endif
 
 
   /**
    * This method searches this string for the last character found in
    * the given string.
    *
    * @param aString contains set of chars to be found
    * @param aOffset tells us where in this string to start searching
    *        (counting from left)
    * @return offset in string, or kNotFound
    */
 
-  int32_t RFindCharInSet( const char_type* aString, int32_t aOffset=-1 ) const;
-  int32_t RFindCharInSet( const self_type& aString, int32_t aOffset=-1 ) const
+  int32_t RFindCharInSet(const char_type* aString, int32_t aOffset = -1) const;
+  int32_t RFindCharInSet(const self_type& aString, int32_t aOffset = -1) const
   {
     return RFindCharInSet(aString.get(), aOffset);
   }
 
 
   /**
    * Compares a given string to this string.
    *
    * @param   aString is the string to be compared
    * @param   aIgnoreCase tells us how to treat case
    * @param   aCount tells us how many chars to compare
    * @return  -1,0,1
    */
 
 #ifdef CharT_is_char
-  int32_t Compare( const char* aString, bool aIgnoreCase=false, int32_t aCount=-1 ) const;
+  int32_t Compare(const char* aString, bool aIgnoreCase = false,
+                  int32_t aCount = -1) const;
 #endif
 
 
   /**
    * Equality check between given string and this string.
    *
    * @param   aString is the string to check
    * @param   aIgnoreCase tells us how to treat case
    * @param   aCount tells us how many chars to compare
    * @return  boolean
    */
 #ifdef CharT_is_char
-  bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const {
+  bool EqualsIgnoreCase(const char* aString, int32_t aCount = -1) const
+  {
     return Compare(aString, true, aCount) == 0;
   }
 #else
-  bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const;
+  bool EqualsIgnoreCase(const char* aString, int32_t aCount = -1) const;
 
 
 #endif // !CharT_is_PRUnichar
 
   /**
    * Perform string to double-precision float conversion.
    *
    * @param   aErrorCode will contain error if one occurs
    * @return  double-precision float rep of string value
    */
-  double ToDouble( nsresult* aErrorCode ) const;
+  double ToDouble(nsresult* aErrorCode) const;
 
   /**
    * Perform string to single-precision float conversion.
    *
    * @param   aErrorCode will contain error if one occurs
    * @return  single-precision float rep of string value
    */
-  float ToFloat( nsresult* aErrorCode ) const {
+  float ToFloat(nsresult* aErrorCode) const
+  {
     return (float)ToDouble(aErrorCode);
   }
 
 
   /**
    * Perform string to int conversion.
    * @param   aErrorCode will contain error if one occurs
    * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
    * @return  int rep of string value, and possible (out) error code
    */
-  int32_t ToInteger( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
+  int32_t ToInteger(nsresult* aErrorCode, uint32_t aRadix = kRadix10) const;
 
   /**
    * Perform string to 64-bit int conversion.
    * @param   aErrorCode will contain error if one occurs
    * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
    * @return  64-bit int rep of string value, and possible (out) error code
    */
-  int64_t ToInteger64( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
+  int64_t ToInteger64(nsresult* aErrorCode, uint32_t aRadix = kRadix10) const;
 
 
   /**
    * |Left|, |Mid|, and |Right| are annoying signatures that seem better almost
    * any _other_ way than they are now.  Consider these alternatives
    *
    * aWritable = aReadable.Left(17);   // ...a member function that returns a |Substring|
    * aWritable = Left(aReadable, 17);  // ...a global function that returns a |Substring|
@@ -293,177 +332,205 @@ public:
    *
    * aReadable.Left(aWritable, 17);    // ...a member function that does the assignment
    *
    * or maybe just stamping them out in favor of |Substring|, they are just duplicate functionality
    *
    * aWritable = Substring(aReadable, 0, 17);
    */
 
-  size_type Mid( self_type& aResult, uint32_t aStartPos, uint32_t aCount ) const;
+  size_type Mid(self_type& aResult, uint32_t aStartPos, uint32_t aCount) const;
 
-  size_type Left( self_type& aResult, size_type aCount ) const
+  size_type Left(self_type& aResult, size_type aCount) const
   {
     return Mid(aResult, 0, aCount);
   }
 
-  size_type Right( self_type& aResult, size_type aCount ) const
+  size_type Right(self_type& aResult, size_type aCount) const
   {
     aCount = XPCOM_MIN(mLength, aCount);
     return Mid(aResult, mLength - aCount, aCount);
   }
 
 
   /**
    * Set a char inside this string at given index
    *
    * @param aChar is the char you want to write into this string
    * @param anIndex is the ofs where you want to write the given char
    * @return TRUE if successful
    */
 
-  bool SetCharAt( char16_t aChar, uint32_t aIndex );
+  bool SetCharAt(char16_t aChar, uint32_t aIndex);
 
 
   /**
    *  These methods are used to remove all occurrences of the
    *  characters found in aSet from this string.
    *
    *  @param  aSet -- characters to be cut from this
    */
-  void StripChars( const char* aSet );
+  void StripChars(const char* aSet);
 
 
   /**
    *  This method strips whitespace throughout the string.
    */
   void StripWhitespace();
 
 
   /**
    *  swaps occurence of 1 string for another
    */
 
-  void ReplaceChar( char_type aOldChar, char_type aNewChar );
-  void ReplaceChar( const char* aSet, char_type aNewChar );
+  void ReplaceChar(char_type aOldChar, char_type aNewChar);
+  void ReplaceChar(const char* aSet, char_type aNewChar);
 #ifdef CharT_is_PRUnichar
-  void ReplaceChar( const char16_t* aSet, char16_t aNewChar );
+  void ReplaceChar(const char16_t* aSet, char16_t aNewChar);
 #endif
-  void ReplaceSubstring( const self_type& aTarget, const self_type& aNewValue);
-  void ReplaceSubstring( const char_type* aTarget, const char_type* aNewValue);
+  void ReplaceSubstring(const self_type& aTarget, const self_type& aNewValue);
+  void ReplaceSubstring(const char_type* aTarget, const char_type* aNewValue);
 
 
   /**
    *  This method trims characters found in aTrimSet from
    *  either end of the underlying string.
    *
    *  @param   aSet -- contains chars to be trimmed from both ends
    *  @param   aEliminateLeading
    *  @param   aEliminateTrailing
    *  @param   aIgnoreQuotes -- if true, causes surrounding quotes to be ignored
    *  @return  this
    */
-  void Trim( const char* aSet, bool aEliminateLeading=true, bool aEliminateTrailing=true, bool aIgnoreQuotes=false );
+  void Trim(const char* aSet, bool aEliminateLeading = true,
+            bool aEliminateTrailing = true, bool aIgnoreQuotes = false);
 
   /**
    *  This method strips whitespace from string.
    *  You can control whether whitespace is yanked from start and end of
    *  string as well.
    *
    *  @param   aEliminateLeading controls stripping of leading ws
    *  @param   aEliminateTrailing controls stripping of trailing ws
    */
-  void CompressWhitespace( bool aEliminateLeading=true, bool aEliminateTrailing=true );
+  void CompressWhitespace(bool aEliminateLeading = true,
+                          bool aEliminateTrailing = true);
 
 
   /**
    * assign/append/insert with _LOSSY_ conversion
    */
 
-  void AssignWithConversion( const nsTAString_IncompatibleCharT& aString );
-  void AssignWithConversion( const incompatible_char_type* aData, int32_t aLength=-1 );
+  void AssignWithConversion(const nsTAString_IncompatibleCharT& aString);
+  void AssignWithConversion(const incompatible_char_type* aData,
+                            int32_t aLength = -1);
 
 #endif // !MOZ_STRING_WITH_OBSOLETE_API
 
   /**
    * Allow this string to be bound to a character buffer
    * until the string is rebound or mutated; the caller
    * must ensure that the buffer outlives the string.
    */
-  void Rebind( const char_type* data, size_type length );
+  void Rebind(const char_type* aData, size_type aLength);
 
   /**
    * verify restrictions for dependent strings
    */
   void AssertValidDepedentString()
   {
     NS_ASSERTION(mData, "nsTDependentString must wrap a non-NULL buffer");
     NS_ASSERTION(mLength != size_type(-1), "nsTDependentString has bogus length");
-    NS_ASSERTION(mData[mLength] == 0, "nsTDependentString must wrap only null-terminated strings. You are probably looking for nsTDependentSubstring.");
+    NS_ASSERTION(mData[mLength] == 0,
+                 "nsTDependentString must wrap only null-terminated strings. "
+                 "You are probably looking for nsTDependentSubstring.");
   }
 
 
 protected:
 
   explicit
-  nsTString_CharT( uint32_t flags )
-    : substring_type(flags) {}
+  nsTString_CharT(uint32_t aFlags)
+    : substring_type(aFlags)
+  {
+  }
 
   // allow subclasses to initialize fields directly
-  nsTString_CharT( char_type* data, size_type length, uint32_t flags )
-    : substring_type(data, length, flags) {}
+  nsTString_CharT(char_type* aData, size_type aLength, uint32_t aFlags)
+    : substring_type(aData, aLength, aFlags)
+  {
+  }
 };
 
 
 class nsTFixedString_CharT : public nsTString_CharT
 {
 public:
 
-  typedef nsTFixedString_CharT    self_type;
-  typedef nsTFixedString_CharT    fixed_string_type;
+  typedef nsTFixedString_CharT self_type;
+  typedef nsTFixedString_CharT fixed_string_type;
 
 public:
 
   /**
-   * @param data
+   * @param aData
    *        fixed-size buffer to be used by the string (the contents of
    *        this buffer may be modified by the string)
-   * @param storageSize
+   * @param aStorageSize
    *        the size of the fixed buffer
-   * @param length (optional)
+   * @param aLength (optional)
    *        the length of the string already contained in the buffer
    */
 
-  nsTFixedString_CharT( char_type* data, size_type storageSize )
-    : string_type(data, uint32_t(char_traits::length(data)), F_TERMINATED | F_FIXED | F_CLASS_FIXED)
-    , mFixedCapacity(storageSize - 1)
-    , mFixedBuf(data)
-  {}
+  nsTFixedString_CharT(char_type* aData, size_type aStorageSize)
+    : string_type(aData, uint32_t(char_traits::length(aData)),
+                  F_TERMINATED | F_FIXED | F_CLASS_FIXED)
+    , mFixedCapacity(aStorageSize - 1)
+    , mFixedBuf(aData)
+  {
+  }
 
-  nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length )
-    : string_type(data, length, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
-    , mFixedCapacity(storageSize - 1)
-    , mFixedBuf(data)
+  nsTFixedString_CharT(char_type* aData, size_type aStorageSize,
+                       size_type aLength)
+    : string_type(aData, aLength, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
+    , mFixedCapacity(aStorageSize - 1)
+    , mFixedBuf(aData)
   {
     // null-terminate
-    mFixedBuf[length] = char_type(0);
+    mFixedBuf[aLength] = char_type(0);
   }
 
   // |operator=| does not inherit, so we must define our own
-  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
-  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
-  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
-  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+  self_type& operator=(char_type aChar)
+  {
+    Assign(aChar);
+    return *this;
+  }
+  self_type& operator=(const char_type* aData)
+  {
+    Assign(aData);
+    return *this;
+  }
+  self_type& operator=(const substring_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 
 protected:
 
   friend class nsTSubstring_CharT;
 
   size_type  mFixedCapacity;
-  char_type *mFixedBuf;
+  char_type* mFixedBuf;
 };
 
 
 /**
  * nsTAutoString_CharT
  *
  * Subclass of nsTString_CharT that adds support for stack-based string
  * allocation.  It is normally not a good idea to use this class on the
@@ -473,110 +540,142 @@ protected:
  * NAMES:
  *   nsAutoString for wide characters
  *   nsAutoCString for narrow characters
  */
 class nsTAutoString_CharT : public nsTFixedString_CharT
 {
 public:
 
-  typedef nsTAutoString_CharT    self_type;
+  typedef nsTAutoString_CharT self_type;
 
 public:
 
   /**
    * constructors
    */
 
   nsTAutoString_CharT()
     : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-  {}
-
-  explicit
-  nsTAutoString_CharT( char_type c )
-    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
   {
-    Assign(c);
   }
 
   explicit
-  nsTAutoString_CharT( const char_type* data, size_type length = size_type(-1) )
+  nsTAutoString_CharT(char_type aChar)
     : fixed_string_type(mStorage, kDefaultStorageSize, 0)
   {
-    Assign(data, length);
+    Assign(aChar);
+  }
+
+  explicit
+  nsTAutoString_CharT(const char_type* aData, size_type aLength = size_type(-1))
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(aData, aLength);
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   explicit
-  nsTAutoString_CharT( char16ptr_t data, size_type length = size_type(-1) )
-    : nsTAutoString_CharT(static_cast<const char16_t*>(data), length)
-  {}
+  nsTAutoString_CharT(char16ptr_t aData, size_type aLength = size_type(-1))
+    : nsTAutoString_CharT(static_cast<const char16_t*>(aData), aLength)
+  {
+  }
 #endif
 
-  nsTAutoString_CharT( const self_type& str )
+  nsTAutoString_CharT(const self_type& aStr)
     : fixed_string_type(mStorage, kDefaultStorageSize, 0)
   {
-    Assign(str);
+    Assign(aStr);
   }
 
   explicit
-  nsTAutoString_CharT( const substring_type& str )
+  nsTAutoString_CharT(const substring_type& aStr)
     : fixed_string_type(mStorage, kDefaultStorageSize, 0)
   {
-    Assign(str);
+    Assign(aStr);
   }
 
-  MOZ_IMPLICIT nsTAutoString_CharT( const substring_tuple_type& tuple )
+  MOZ_IMPLICIT nsTAutoString_CharT(const substring_tuple_type& aTuple)
     : fixed_string_type(mStorage, kDefaultStorageSize, 0)
   {
-    Assign(tuple);
+    Assign(aTuple);
   }
 
   // |operator=| does not inherit, so we must define our own
-  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
-  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
+  self_type& operator=(char_type aChar)
+  {
+    Assign(aChar);
+    return *this;
+  }
+  self_type& operator=(const char_type* aData)
+  {
+    Assign(aData);
+    return *this;
+  }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  self_type& operator=( char16ptr_t data )                  { Assign(data);  return *this; }
+  self_type& operator=(char16ptr_t aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
 #endif
-  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
-  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
-  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+  self_type& operator=(const self_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 
-  enum { kDefaultStorageSize = 64 };
+  enum
+  {
+    kDefaultStorageSize = 64
+  };
 
 private:
 
   char_type mStorage[kDefaultStorageSize];
 };
 
 
 //
 // nsAutoString stores pointers into itself which are invalidated when an
 // nsTArray is resized, so nsTArray must not be instantiated with nsAutoString
 // elements!
 //
 template<class E> class nsTArrayElementTraits;
 template<>
-class nsTArrayElementTraits<nsTAutoString_CharT> {
+class nsTArrayElementTraits<nsTAutoString_CharT>
+{
 public:
   template<class A> struct Dont_Instantiate_nsTArray_of;
   template<class A> struct Instead_Use_nsTArray_of;
 
-  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-  Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT>*
+  Construct(Instead_Use_nsTArray_of<nsTString_CharT>* aE)
+  {
     return 0;
   }
   template<class A>
-  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-  Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e,
-            const A &arg) {
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT>*
+  Construct(Instead_Use_nsTArray_of<nsTString_CharT>* aE, const A& aArg)
+  {
     return 0;
   }
-  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-  Destruct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT>*
+  Destruct(Instead_Use_nsTArray_of<nsTString_CharT>* aE)
+  {
     return 0;
   }
 };
 
 /**
  * nsTXPIDLString extends nsTString such that:
  *
  *   (1) mData can be null
@@ -587,28 +686,30 @@ public:
  * NAMES:
  *   nsXPIDLString for wide characters
  *   nsXPIDLCString for narrow characters
  */
 class nsTXPIDLString_CharT : public nsTString_CharT
 {
 public:
 
-  typedef nsTXPIDLString_CharT    self_type;
+  typedef nsTXPIDLString_CharT self_type;
 
 public:
 
   nsTXPIDLString_CharT()
-    : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED) {}
+    : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED)
+  {
+  }
 
   // copy-constructor required to avoid default
-  nsTXPIDLString_CharT( const self_type& str )
+  nsTXPIDLString_CharT(const self_type& aStr)
     : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED)
   {
-    Assign(str);
+    Assign(aStr);
   }
 
   // return nullptr if we are voided
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   char16ptr_t get() const
 #else
   const char_type* get() const
 #endif
@@ -619,27 +720,47 @@ public:
   // this case operator is the reason why this class cannot just be a
   // typedef for nsTString
   operator const char_type*() const
   {
     return get();
   }
 
   // need this to diambiguous operator[int]
-  char_type operator[]( int32_t i ) const
+  char_type operator[](int32_t aIndex) const
   {
-    return CharAt(index_type(i));
+    return CharAt(index_type(aIndex));
   }
 
   // |operator=| does not inherit, so we must define our own
-  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
-  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
-  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
-  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
-  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+  self_type& operator=(char_type aChar)
+  {
+    Assign(aChar);
+    return *this;
+  }
+  self_type& operator=(const char_type* aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const self_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 };
 
 
 /**
  * getter_Copies support for use with raw string out params:
  *
  *    NS_IMETHOD GetBlah(char**);
  *
@@ -650,37 +771,39 @@ public:
  *      // ...
  *    }
  */
 class MOZ_STACK_CLASS nsTGetterCopies_CharT
 {
 public:
   typedef CharT char_type;
 
-  explicit nsTGetterCopies_CharT(nsTSubstring_CharT& str)
-    : mString(str), mData(nullptr) {}
+  explicit nsTGetterCopies_CharT(nsTSubstring_CharT& aStr)
+    : mString(aStr)
+    , mData(nullptr)
+  {
+  }
 
   ~nsTGetterCopies_CharT()
   {
     mString.Adopt(mData); // OK if mData is null
   }
 
   operator char_type**()
   {
     return &mData;
   }
 
 private:
-  nsTSubstring_CharT&      mString;
-  char_type*            mData;
+  nsTSubstring_CharT& mString;
+  char_type* mData;
 };
 
-inline
-nsTGetterCopies_CharT
-getter_Copies( nsTSubstring_CharT& aString )
+inline nsTGetterCopies_CharT
+getter_Copies(nsTSubstring_CharT& aString)
 {
   return nsTGetterCopies_CharT(aString);
 }
 
 
 /**
  * nsTAdoptingString extends nsTXPIDLString such that:
  *
@@ -688,41 +811,52 @@ getter_Copies( nsTSubstring_CharT& aStri
  * the value of what's given, and make what's given forget its
  * value. Note that this class violates constness in a few
  * places. Be careful!
  */
 class nsTAdoptingString_CharT : public nsTXPIDLString_CharT
 {
 public:
 
-  typedef nsTAdoptingString_CharT    self_type;
+  typedef nsTAdoptingString_CharT self_type;
 
 public:
 
-  explicit nsTAdoptingString_CharT() {}
-  explicit nsTAdoptingString_CharT(char_type* str, size_type length = size_type(-1))
+  explicit nsTAdoptingString_CharT()
   {
-    Adopt(str, length);
+  }
+  explicit nsTAdoptingString_CharT(char_type* aStr,
+                                   size_type aLength = size_type(-1))
+  {
+    Adopt(aStr, aLength);
   }
 
   // copy-constructor required to adopt on copy. Note that this
-  // will violate the constness of |str| in the operator=()
-  // call. |str| will be truncated as a side-effect of this
+  // will violate the constness of |aStr| in the operator=()
+  // call. |aStr| will be truncated as a side-effect of this
   // constructor.
-  nsTAdoptingString_CharT( const self_type& str )
+  nsTAdoptingString_CharT(const self_type& aStr)
   {
-    *this = str;
+    *this = aStr;
   }
 
   // |operator=| does not inherit, so we must define our own
-  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
-  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+  self_type& operator=(const substring_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 
   // Adopt(), if possible, when assigning to a self_type&. Note
-  // that this violates the constness of str, str is always
+  // that this violates the constness of aStr, aStr is always
   // truncated when this operator is called.
-  self_type& operator=( const self_type& str );
+  self_type& operator=(const self_type& aStr);
 
 private:
-  self_type& operator=( const char_type* data ) MOZ_DELETE;
-  self_type& operator=( char_type* data ) MOZ_DELETE;
+  self_type& operator=(const char_type* aData) MOZ_DELETE;
+  self_type& operator=(char_type* aData) MOZ_DELETE;
 };
 
--- a/xpcom/string/public/nsTSubstring.h
+++ b/xpcom/string/public/nsTSubstring.h
@@ -15,34 +15,40 @@
 /**
  * The base for string comparators
  */
 class nsTStringComparator_CharT
 {
 public:
   typedef CharT char_type;
 
-  nsTStringComparator_CharT() {}
+  nsTStringComparator_CharT()
+  {
+  }
 
-  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const = 0;
+  virtual int operator()(const char_type*, const char_type*,
+                         uint32_t, uint32_t) const = 0;
 };
 
 
 /**
  * The default string comparator (case-sensitive comparision)
  */
 class nsTDefaultStringComparator_CharT
   : public nsTStringComparator_CharT
 {
 public:
   typedef CharT char_type;
 
-  nsTDefaultStringComparator_CharT() {}
+  nsTDefaultStringComparator_CharT()
+  {
+  }
 
-  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
+  virtual int operator()(const char_type*, const char_type*,
+                         uint32_t, uint32_t) const;
 };
 
 /**
  * nsTSubstring is the most abstract class in the string hierarchy. It
  * represents a single contiguous array of characters, which may or may not
  * be null-terminated. This type is not instantiated directly.  A sub-class
  * is instantiated instead.  For example, see nsTString.
  *
@@ -79,137 +85,148 @@ public:
   typedef const char_type*                    const_char_iterator;
 
   typedef uint32_t                            size_type;
   typedef uint32_t                            index_type;
 
 public:
 
   // this acts like a virtual destructor
-  ~nsTSubstring_CharT() { Finalize(); }
+  ~nsTSubstring_CharT()
+  {
+    Finalize();
+  }
 
   /**
    * reading iterators
    */
 
-  const_char_iterator BeginReading() const { return mData; }
-  const_char_iterator EndReading() const { return mData + mLength; }
+  const_char_iterator BeginReading() const
+  {
+    return mData;
+  }
+  const_char_iterator EndReading() const
+  {
+    return mData + mLength;
+  }
 
   /**
    * deprecated reading iterators
    */
 
-  const_iterator& BeginReading( const_iterator& iter ) const
+  const_iterator& BeginReading(const_iterator& aIter) const
   {
-    iter.mStart = mData;
-    iter.mEnd = mData + mLength;
-    iter.mPosition = iter.mStart;
-    return iter;
+    aIter.mStart = mData;
+    aIter.mEnd = mData + mLength;
+    aIter.mPosition = aIter.mStart;
+    return aIter;
   }
 
-  const_iterator& EndReading( const_iterator& iter ) const
+  const_iterator& EndReading(const_iterator& aIter) const
   {
-    iter.mStart = mData;
-    iter.mEnd = mData + mLength;
-    iter.mPosition = iter.mEnd;
-    return iter;
+    aIter.mStart = mData;
+    aIter.mEnd = mData + mLength;
+    aIter.mPosition = aIter.mEnd;
+    return aIter;
   }
 
-  const_char_iterator& BeginReading( const_char_iterator& iter ) const
+  const_char_iterator& BeginReading(const_char_iterator& aIter) const
   {
-    return iter = mData;
+    return aIter = mData;
   }
 
-  const_char_iterator& EndReading( const_char_iterator& iter ) const
+  const_char_iterator& EndReading(const_char_iterator& aIter) const
   {
-    return iter = mData + mLength;
+    return aIter = mData + mLength;
   }
 
 
   /**
    * writing iterators
    */
 
   char_iterator BeginWriting()
   {
-    if (!EnsureMutable())
+    if (!EnsureMutable()) {
       NS_ABORT_OOM(mLength);
+    }
 
     return mData;
   }
 
-  char_iterator BeginWriting( const fallible_t& )
+  char_iterator BeginWriting(const fallible_t&)
   {
     return EnsureMutable() ? mData : char_iterator(0);
   }
 
   char_iterator EndWriting()
   {
-    if (!EnsureMutable())
+    if (!EnsureMutable()) {
       NS_ABORT_OOM(mLength);
+    }
 
     return mData + mLength;
   }
 
-  char_iterator EndWriting( const fallible_t& )
+  char_iterator EndWriting(const fallible_t&)
   {
     return EnsureMutable() ? (mData + mLength) : char_iterator(0);
   }
 
-  char_iterator& BeginWriting( char_iterator& iter )
+  char_iterator& BeginWriting(char_iterator& aIter)
   {
-    return iter = BeginWriting();
+    return aIter = BeginWriting();
   }
 
-  char_iterator& BeginWriting( char_iterator& iter, const fallible_t& )
+  char_iterator& BeginWriting(char_iterator& aIter, const fallible_t&)
   {
-    return iter = BeginWriting(fallible_t());
+    return aIter = BeginWriting(fallible_t());
   }
 
-  char_iterator& EndWriting( char_iterator& iter )
+  char_iterator& EndWriting(char_iterator& aIter)
   {
-    return iter = EndWriting();
+    return aIter = EndWriting();
   }
 
-  char_iterator& EndWriting( char_iterator& iter, const fallible_t& )
+  char_iterator& EndWriting(char_iterator& aIter, const fallible_t&)
   {
-    return iter = EndWriting(fallible_t());
+    return aIter = EndWriting(fallible_t());
   }
 
   /**
    * deprecated writing iterators
    */
 
-  iterator& BeginWriting( iterator& iter )
+  iterator& BeginWriting(iterator& aIter)
   {
-    char_type *data = BeginWriting();
-    iter.mStart = data;
-    iter.mEnd = data + mLength;
-    iter.mPosition = iter.mStart;
-    return iter;
+    char_type* data = BeginWriting();
+    aIter.mStart = data;
+    aIter.mEnd = data + mLength;
+    aIter.mPosition = aIter.mStart;
+    return aIter;
   }
 
-  iterator& EndWriting( iterator& iter )
+  iterator& EndWriting(iterator& aIter)
   {
-    char_type *data = BeginWriting();
-    iter.mStart = data;
-    iter.mEnd = data + mLength;
-    iter.mPosition = iter.mEnd;
-    return iter;
+    char_type* data = BeginWriting();
+    aIter.mStart = data;
+    aIter.mEnd = data + mLength;
+    aIter.mPosition = aIter.mEnd;
+    return aIter;
   }
 
   /**
    * accessors
    */
 
   // returns pointer to string data (not necessarily null-terminated)
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
   char16ptr_t Data() const
 #else
-  const char_type *Data() const
+  const char_type* Data() const
 #endif
   {
     return mData;
   }
 
   size_type Length() const
   {
     return mLength;
@@ -235,627 +252,784 @@ public:
     return (mFlags & F_VOIDED) != 0;
   }
 
   bool IsTerminated() const
   {
     return (mFlags & F_TERMINATED) != 0;
   }
 
-  char_type CharAt( index_type i ) const
+  char_type CharAt(index_type aIndex) const
   {
-    NS_ASSERTION(i < mLength, "index exceeds allowable range");
-    return mData[i];
+    NS_ASSERTION(aIndex < mLength, "index exceeds allowable range");
+    return mData[aIndex];
   }
 
-  char_type operator[]( index_type i ) const
+  char_type operator[](index_type aIndex) const
   {
-    return CharAt(i);
+    return CharAt(aIndex);
   }
 
   char_type First() const
   {
     NS_ASSERTION(mLength > 0, "|First()| called on an empty string");
     return mData[0];
   }
 
-  inline
-  char_type Last() const
+  inline   char_type Last() const
   {
     NS_ASSERTION(mLength > 0, "|Last()| called on an empty string");
     return mData[mLength - 1];
   }
 
-  size_type NS_FASTCALL CountChar( char_type ) const;
-  int32_t NS_FASTCALL FindChar( char_type, index_type offset = 0 ) const;
+  size_type NS_FASTCALL CountChar(char_type) const;
+  int32_t NS_FASTCALL FindChar(char_type, index_type aOffset = 0) const;
 
 
   /**
    * equality
    */
 
-  bool NS_FASTCALL Equals( const self_type& ) const;
-  bool NS_FASTCALL Equals( const self_type&, const comparator_type& ) const;
+  bool NS_FASTCALL Equals(const self_type&) const;
+  bool NS_FASTCALL Equals(const self_type&, const comparator_type&) const;
 
-  bool NS_FASTCALL Equals( const char_type* data ) const;
-  bool NS_FASTCALL Equals( const char_type* data, const comparator_type& comp ) const;
+  bool NS_FASTCALL Equals(const char_type* aData) const;
+  bool NS_FASTCALL Equals(const char_type* aData,
+                          const comparator_type& aComp) const;
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  bool NS_FASTCALL Equals( char16ptr_t data ) const
+  bool NS_FASTCALL Equals(char16ptr_t aData) const
   {
-    return Equals(static_cast<const char16_t*>(data));
+    return Equals(static_cast<const char16_t*>(aData));
   }
-  bool NS_FASTCALL Equals( char16ptr_t data, const comparator_type& comp ) const
+  bool NS_FASTCALL Equals(char16ptr_t aData, const comparator_type& aComp) const
   {
-    return Equals(static_cast<const char16_t*>(data), comp);
+    return Equals(static_cast<const char16_t*>(aData), aComp);
   }
 #endif
 
   /**
    * An efficient comparison with ASCII that can be used even
    * for wide strings. Call this version when you know the
    * length of 'data'.
    */
-  bool NS_FASTCALL EqualsASCII( const char* data, size_type len ) const;
+  bool NS_FASTCALL EqualsASCII(const char* aData, size_type aLen) const;
   /**
    * An efficient comparison with ASCII that can be used even
    * for wide strings. Call this version when 'data' is
    * null-terminated.
    */
-  bool NS_FASTCALL EqualsASCII( const char* data ) const;
+  bool NS_FASTCALL EqualsASCII(const char* aData) const;
 
   // EqualsLiteral must ONLY be applied to an actual literal string, or
   // a char array *constant* declared without an explicit size.
   // Do not attempt to use it with a regular char* pointer, or with a
   // non-constant char array variable. Use EqualsASCII for them.
   // The template trick to acquire the array length at compile time without
   // using a macro is due to Corey Kosak, with much thanks.
   template<int N>
-  inline bool EqualsLiteral( const char (&str)[N] ) const
+  inline bool EqualsLiteral(const char (&aStr)[N]) const
   {
-    return EqualsASCII(str, N-1);
+    return EqualsASCII(aStr, N - 1);
   }
 
   // The LowerCaseEquals methods compare the ASCII-lowercase version of
   // this string (lowercasing only ASCII uppercase characters) to some
   // ASCII/Literal string. The ASCII string is *not* lowercased for
   // you. If you compare to an ASCII or literal string that contains an
   // uppercase character, it is guaranteed to return false. We will
   // throw assertions too.
-  bool NS_FASTCALL LowerCaseEqualsASCII( const char* data, size_type len ) const;
-  bool NS_FASTCALL LowerCaseEqualsASCII( const char* data ) const;
+  bool NS_FASTCALL LowerCaseEqualsASCII(const char* aData,
+                                        size_type aLen) const;
+  bool NS_FASTCALL LowerCaseEqualsASCII(const char* aData) const;
 
   // LowerCaseEqualsLiteral must ONLY be applied to an actual
   // literal string, or a char array *constant* declared without an
   // explicit size.  Do not attempt to use it with a regular char*
   // pointer, or with a non-constant char array variable. Use
   // LowerCaseEqualsASCII for them.
   template<int N>
-  inline bool LowerCaseEqualsLiteral( const char (&str)[N] ) const
+  inline bool LowerCaseEqualsLiteral(const char (&aStr)[N]) const
   {
-    return LowerCaseEqualsASCII(str, N-1);
+    return LowerCaseEqualsASCII(aStr, N - 1);
   }
 
   /**
    * assignment
    */
 
-  void NS_FASTCALL Assign( char_type c );
-  bool NS_FASTCALL Assign( char_type c, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL Assign(char_type aChar);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(char_type aChar,
+                                                const fallible_t&);
 
-  void NS_FASTCALL Assign( const char_type* data );
-  void NS_FASTCALL Assign( const char_type* data, size_type length );
-  bool NS_FASTCALL Assign( const char_type* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL Assign(const char_type* aData);
+  void NS_FASTCALL Assign(const char_type* aData, size_type aLength);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const char_type* aData,
+                                                size_type aLength,
+                                                const fallible_t&);
 
-  void NS_FASTCALL Assign( const self_type& );
-  bool NS_FASTCALL Assign( const self_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL Assign(const self_type&);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const self_type&,
+                                                const fallible_t&);
 
-  void NS_FASTCALL Assign( const substring_tuple_type& );
-  bool NS_FASTCALL Assign( const substring_tuple_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL Assign(const substring_tuple_type&);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Assign(const substring_tuple_type&,
+                                                const fallible_t&);
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  void Assign (char16ptr_t data)
+  void Assign(char16ptr_t aData)
   {
-    Assign(static_cast<const char16_t*>(data));
+    Assign(static_cast<const char16_t*>(aData));
+  }
+
+  NS_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData, const fallible_t&)
+  {
+    return Assign(static_cast<const char16_t*>(aData), fallible_t());
   }
 
-  bool Assign(char16ptr_t data, const fallible_t&) NS_WARN_UNUSED_RESULT
+  void Assign(char16ptr_t aData, size_type aLength)
   {
-    return Assign(static_cast<const char16_t*>(data), fallible_t());
+    Assign(static_cast<const char16_t*>(aData), aLength);
   }
 
-  void Assign (char16ptr_t data, size_type length)
+  NS_WARN_UNUSED_RESULT bool Assign(char16ptr_t aData, size_type aLength,
+                                    const fallible_t&)
   {
-    Assign(static_cast<const char16_t*>(data), length);
-  }
-
-  bool Assign(char16ptr_t data, size_type length, const fallible_t&) NS_WARN_UNUSED_RESULT
-  {
-    return Assign(static_cast<const char16_t*>(data), length, fallible_t());
+    return Assign(static_cast<const char16_t*>(aData), aLength, fallible_t());
   }
 #endif
 
-  void NS_FASTCALL AssignASCII( const char* data, size_type length );
-  bool NS_FASTCALL AssignASCII( const char* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL AssignASCII(const char* aData, size_type aLength);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
+                                                     size_type aLength,
+                                                     const fallible_t&);
 
-  void NS_FASTCALL AssignASCII( const char* data )
+  void NS_FASTCALL AssignASCII(const char* aData)
   {
-    AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)));
+    AssignASCII(aData, mozilla::SafeCast<size_type, size_t>(strlen(aData)));
   }
-  bool NS_FASTCALL AssignASCII( const char* data, const fallible_t& ) NS_WARN_UNUSED_RESULT
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL AssignASCII(const char* aData,
+                                                     const fallible_t&)
   {
-    return AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)), fallible_t());
+    return AssignASCII(aData,
+                       mozilla::SafeCast<size_type, size_t>(strlen(aData)),
+                       fallible_t());
   }
 
   // AssignLiteral must ONLY be applied to an actual literal string, or
   // a char array *constant* declared without an explicit size.
   // Do not attempt to use it with a regular char* pointer, or with a
   // non-constant char array variable. Use AssignASCII for those.
   // There are not fallible version of these methods because they only really
   // apply to small allocations that we wouldn't want to check anyway.
   template<int N>
-  void AssignLiteral( const char_type (&str)[N] )
-  { AssignLiteral(str, N - 1); }
+  void AssignLiteral(const char_type (&aStr)[N])
+  {
+    AssignLiteral(aStr, N - 1);
+  }
 #ifdef CharT_is_PRUnichar
   template<int N>
-  void AssignLiteral( const char (&str)[N] )
-  { AssignASCII(str, N-1); }
+  void AssignLiteral(const char (&aStr)[N])
+  {
+    AssignASCII(aStr, N - 1);
+  }
 #endif
 
-  self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-  self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
+  self_type& operator=(char_type aChar)
+  {
+    Assign(aChar);
+    return *this;
+  }
+  self_type& operator=(const char_type* aData)
+  {
+    Assign(aData);
+    return *this;
+  }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  self_type& operator=( char16ptr_t data )                                                  { Assign(data);     return *this; }
+  self_type& operator=(char16ptr_t aData)
+  {
+    Assign(aData);
+    return *this;
+  }
 #endif
-  self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
-  self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+  self_type& operator=(const self_type& aStr)
+  {
+    Assign(aStr);
+    return *this;
+  }
+  self_type& operator=(const substring_tuple_type& aTuple)
+  {
+    Assign(aTuple);
+    return *this;
+  }
 
-  void NS_FASTCALL Adopt( char_type* data, size_type length = size_type(-1) );
+  void NS_FASTCALL Adopt(char_type* aData, size_type aLength = size_type(-1));
 
 
   /**
    * buffer manipulation
    */
 
-  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c );
-  bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
-  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length = size_type(-1) );
-  bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
-  void Replace( index_type cutStart, size_type cutLength, const self_type& str )      { Replace(cutStart, cutLength, str.Data(), str.Length()); }
-  bool Replace( index_type cutStart, size_type cutLength, const self_type& str, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
-  { return Replace(cutStart, cutLength, str.Data(), str.Length(), mozilla::fallible_t()); }
-  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const substring_tuple_type& tuple );
+  void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
+                           char_type aChar);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
+                                                 size_type aCutLength,
+                                                 char_type aChar,
+                                                 const mozilla::fallible_t&);
+  void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
+                           const char_type* aData,
+                           size_type aLength = size_type(-1));
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL Replace(index_type aCutStart,
+                                                 size_type aCutLength,
+                                                 const char_type* aData,
+                                                 size_type aLength,
+                                                 const mozilla::fallible_t&);
+  void Replace(index_type aCutStart, size_type aCutLength,
+               const self_type& aStr)
+  {
+    Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length());
+  }
+  NS_WARN_UNUSED_RESULT bool Replace(index_type aCutStart,
+                                     size_type aCutLength,
+                                     const self_type& aStr,
+                                     const mozilla::fallible_t&)
+  {
+    return Replace(aCutStart, aCutLength, aStr.Data(), aStr.Length(),
+                   mozilla::fallible_t());
+  }
+  void NS_FASTCALL Replace(index_type aCutStart, size_type aCutLength,
+                           const substring_tuple_type& aTuple);
 
-  void NS_FASTCALL ReplaceASCII( index_type cutStart, size_type cutLength, const char* data, size_type length = size_type(-1) );
+  void NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
+                                const char* aData,
+                                size_type aLength = size_type(-1));
 
   // ReplaceLiteral must ONLY be applied to an actual literal string.
   // Do not attempt to use it with a regular char* pointer, or with a char
   // array variable. Use Replace or ReplaceASCII for those.
   template<int N>
-  void ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type (&str)[N] ) { ReplaceLiteral(cutStart, cutLength, str, N - 1); }
+  void ReplaceLiteral(index_type aCutStart, size_type aCutLength,
+                      const char_type (&aStr)[N])
+  {
+    ReplaceLiteral(aCutStart, aCutLength, aStr, N - 1);
+  }
 
-  void Append( char_type c )                                                                 { Replace(mLength, 0, c); }
-  bool Append( char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT                { return Replace(mLength, 0, c, mozilla::fallible_t()); }
-  void Append( const char_type* data, size_type length = size_type(-1) )                     { Replace(mLength, 0, data, length); }
-  bool Append( const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
-  { return Replace(mLength, 0, data, length, mozilla::fallible_t()); }
+  void Append(char_type aChar)
+  {
+    Replace(mLength, 0, aChar);
+  }
+  NS_WARN_UNUSED_RESULT bool Append(char_type aChar,
+                                    const mozilla::fallible_t&)
+  {
+    return Replace(mLength, 0, aChar, mozilla::fallible_t());
+  }
+  void Append(const char_type* aData, size_type aLength = size_type(-1))
+  {
+    Replace(mLength, 0, aData, aLength);
+  }
+  NS_WARN_UNUSED_RESULT bool Append(const char_type* aData, size_type aLength,
+                                    const mozilla::fallible_t&)
+  {
+    return Replace(mLength, 0, aData, aLength, mozilla::fallible_t());
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  void Append( char16ptr_t data, size_type length = size_type(-1) )                            { Append(static_cast<const char16_t*>(data), length); }
+  void Append(char16ptr_t aData, size_type aLength = size_type(-1))
+  {
+    Append(static_cast<const char16_t*>(aData), aLength);
+  }
 #endif
 
-  void Append( const self_type& str )                                                        { Replace(mLength, 0, str); }
-  void Append( const substring_tuple_type& tuple )                                           { Replace(mLength, 0, tuple); }
+  void Append(const self_type& aStr)
+  {
+    Replace(mLength, 0, aStr);
+  }
+  void Append(const substring_tuple_type& aTuple)
+  {
+    Replace(mLength, 0, aTuple);
+  }
 
-  void AppendASCII( const char* data, size_type length = size_type(-1) )                     { ReplaceASCII(mLength, 0, data, length); }
+  void AppendASCII(const char* aData, size_type aLength = size_type(-1))
+  {
+    ReplaceASCII(mLength, 0, aData, aLength);
+  }
 
   /**
    * Append a formatted string to the current string. Uses the format
    * codes documented in prprf.h
    */
-  void AppendPrintf( const char* format, ... );
-  void AppendPrintf( const char* format, va_list ap );
-  void AppendInt( int32_t aInteger )
-  { AppendPrintf( "%d", aInteger ); }
-  void AppendInt( int32_t aInteger, int aRadix )
+  void AppendPrintf(const char* aFormat, ...);
+  void AppendPrintf(const char* aFormat, va_list aAp);
+  void AppendInt(int32_t aInteger)
+  {
+    AppendPrintf("%d", aInteger);
+  }
+  void AppendInt(int32_t aInteger, int aRadix)
   {
-    const char *fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x";
-    AppendPrintf( fmt, aInteger );
+    const char* fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x";
+    AppendPrintf(fmt, aInteger);
   }
-  void AppendInt( uint32_t aInteger )
-  { AppendPrintf( "%u", aInteger ); }
-  void AppendInt( uint32_t aInteger, int aRadix )
+  void AppendInt(uint32_t aInteger)
+  {
+    AppendPrintf("%u", aInteger);
+  }
+  void AppendInt(uint32_t aInteger, int aRadix)
   {
-    const char *fmt = aRadix == 10 ? "%u" : aRadix == 8 ? "%o" : "%x";
-    AppendPrintf( fmt, aInteger );
+    const char* fmt = aRadix == 10 ? "%u" : aRadix == 8 ? "%o" : "%x";
+    AppendPrintf(fmt, aInteger);
   }
-  void AppendInt( int64_t aInteger )
-  { AppendPrintf( "%lld", aInteger ); }
-  void AppendInt( int64_t aInteger, int aRadix )
+  void AppendInt(int64_t aInteger)
+  {
+    AppendPrintf("%lld", aInteger);
+  }
+  void AppendInt(int64_t aInteger, int aRadix)
   {
-    const char *fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx";
-    AppendPrintf( fmt, aInteger );
+    const char* fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx";
+    AppendPrintf(fmt, aInteger);
   }
-  void AppendInt( uint64_t aInteger )
-  { AppendPrintf( "%llu", aInteger ); }
-  void AppendInt( uint64_t aInteger, int aRadix )
+  void AppendInt(uint64_t aInteger)
   {
-    const char *fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx";
-    AppendPrintf( fmt, aInteger );
+    AppendPrintf("%llu", aInteger);
+  }
+  void AppendInt(uint64_t aInteger, int aRadix)
+  {
+    const char* fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx";
+    AppendPrintf(fmt, aInteger);
   }
 
   /**
    * Append the given float to this string
    */
-  void NS_FASTCALL AppendFloat( float aFloat );
-  void NS_FASTCALL AppendFloat( double aFloat );
+  void NS_FASTCALL AppendFloat(float aFloat);
+  void NS_FASTCALL AppendFloat(double aFloat);
 public:
 
   // AppendLiteral must ONLY be applied to an actual literal string.
   // Do not attempt to use it with a regular char* pointer, or with a char
   // array variable. Use Append or AppendASCII for those.
   template<int N>
-  void AppendLiteral( const char_type (&str)[N] )                                             { ReplaceLiteral(mLength, 0, str, N - 1); }
+  void AppendLiteral(const char_type (&aStr)[N])
+  {
+    ReplaceLiteral(mLength, 0, aStr, N - 1);
+  }
 #ifdef CharT_is_PRUnichar
   template<int N>
-  void AppendLiteral( const char (&str)[N] )
-  { AppendASCII(str, N-1); }
+  void AppendLiteral(const char (&aStr)[N])
+  {
+    AppendASCII(aStr, N - 1);
+  }
 #endif
 
-  self_type& operator+=( char_type c )                                                       { Append(c);        return *this; }
-  self_type& operator+=( const char_type* data )                                             { Append(data);     return *this; }
+  self_type& operator+=(char_type aChar)
+  {
+    Append(aChar);
+    return *this;
+  }
+  self_type& operator+=(const char_type* aData)
+  {
+    Append(aData);
+    return *this;
+  }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  self_type& operator+=( char16ptr_t data )                                                  { Append(data);     return *this; }
+  self_type& operator+=(char16ptr_t aData)
+  {
+    Append(aData);
+    return *this;
+  }
 #endif
-  self_type& operator+=( const self_type& str )                                              { Append(str);      return *this; }
-  self_type& operator+=( const substring_tuple_type& tuple )                                 { Append(tuple);    return *this; }
+  self_type& operator+=(const self_type& aStr)
+  {
+    Append(aStr);
+    return *this;
+  }
+  self_type& operator+=(const substring_tuple_type& aTuple)
+  {
+    Append(aTuple);
+    return *this;
+  }
 
-  void Insert( char_type c, index_type pos )                                                 { Replace(pos, 0, c); }
-  void Insert( const char_type* data, index_type pos, size_type length = size_type(-1) )     { Replace(pos, 0, data, length); }
+  void Insert(char_type aChar, index_type aPos)
+  {
+    Replace(aPos, 0, aChar);
+  }
+  void Insert(const char_type* aData, index_type aPos,
+              size_type aLength = size_type(-1))
+  {
+    Replace(aPos, 0, aData, aLength);
+  }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  void Insert( char16ptr_t data, index_type pos, size_type length = size_type(-1) )
-  { Insert(static_cast<const char16_t*>(data), pos, length); }
+  void Insert(char16ptr_t aData, index_type aPos,
+              size_type aLength = size_type(-1))
+  {
+    Insert(static_cast<const char16_t*>(aData), aPos, aLength);
+  }
 #endif
-  void Insert( const self_type& str, index_type pos )                                        { Replace(pos, 0, str); }
-  void Insert( const substring_tuple_type& tuple, index_type pos )                           { Replace(pos, 0, tuple); }
+  void Insert(const self_type& aStr, index_type aPos)
+  {
+    Replace(aPos, 0, aStr);
+  }
+  void Insert(const substring_tuple_type& aTuple, index_type aPos)
+  {
+    Replace(aPos, 0, aTuple);
+  }
 
   // InsertLiteral must ONLY be applied to an actual literal string.
   // Do not attempt to use it with a regular char* pointer, or with a char
   // array variable. Use Insert for those.
   template<int N>
-  void InsertLiteral( const char_type (&str)[N], index_type pos )                            { ReplaceLiteral(pos, 0, str, N - 1); }
+  void InsertLiteral(const char_type (&aStr)[N], index_type aPos)
+  {
+    ReplaceLiteral(aPos, 0, aStr, N - 1);
+  }
 
-  void Cut( index_type cutStart, size_type cutLength )                                       { Replace(cutStart, cutLength, char_traits::sEmptyBuffer, 0); }
+  void Cut(index_type aCutStart, size_type aCutLength)
+  {
+    Replace(aCutStart, aCutLength, char_traits::sEmptyBuffer, 0);
+  }
 
 
   /**
    * buffer sizing
    */
 
   /**
    * Attempts to set the capacity to the given size in number of
    * characters, without affecting the length of the string.
    * There is no need to include room for the null terminator: it is
    * the job of the string class.
    * Also ensures that the buffer is mutable.
    */
-  void NS_FASTCALL SetCapacity( size_type newCapacity );
-  bool NS_FASTCALL SetCapacity( size_type newCapacity, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL SetCapacity(size_type aNewCapacity);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL SetCapacity(size_type aNewCapacity,
+                                                     const fallible_t&);
 
-  void NS_FASTCALL SetLength( size_type newLength );
-  bool NS_FASTCALL SetLength( size_type newLength, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL SetLength(size_type aNewLength);
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL SetLength(size_type aNewLength,
+                                                   const fallible_t&);
 
-  void Truncate( size_type newLength = 0 )
+  void Truncate(size_type aNewLength = 0)
   {
-    NS_ASSERTION(newLength <= mLength, "Truncate cannot make string longer");
-    SetLength(newLength);
+    NS_ASSERTION(aNewLength <= mLength, "Truncate cannot make string longer");
+    SetLength(aNewLength);
   }
 
 
   /**
    * buffer access
    */
 
 
   /**
    * Get a const pointer to the string's internal buffer.  The caller
    * MUST NOT modify the characters at the returned address.
    *
    * @returns The length of the buffer in characters.
    */
-  inline size_type GetData( const char_type** data ) const
+  inline size_type GetData(const char_type** aData) const
   {
-    *data = mData;
+    *aData = mData;
     return mLength;
   }
 
   /**
    * Get a pointer to the string's internal buffer, optionally resizing
    * the buffer first.  If size_type(-1) is passed for newLen, then the
    * current length of the string is used.  The caller MAY modify the
    * characters at the returned address (up to but not exceeding the
    * length of the string).
    *
    * @returns The length of the buffer in characters or 0 if unable to
    * satisfy the request due to low-memory conditions.
    */
-  size_type GetMutableData( char_type** data, size_type newLen = size_type(-1) )
+  size_type GetMutableData(char_type** aData, size_type aNewLen = size_type(-1))
   {
-    if (!EnsureMutable(newLen))
-      NS_ABORT_OOM(newLen == size_type(-1) ? mLength : newLen);
+    if (!EnsureMutable(aNewLen)) {
+      NS_ABORT_OOM(aNewLen == size_type(-1) ? mLength : aNewLen);
+    }
 
-    *data = mData;
+    *aData = mData;
     return mLength;
   }
 
-  size_type GetMutableData( char_type** data, size_type newLen, const fallible_t& )
+  size_type GetMutableData(char_type** aData, size_type aNewLen, const fallible_t&)
   {
-    if (!EnsureMutable(newLen))
-    {
-      *data = nullptr;
+    if (!EnsureMutable(aNewLen)) {
+      *aData = nullptr;
       return 0;
     }
 
-    *data = mData;
+    *aData = mData;
     return mLength;
   }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-  size_type GetMutableData( wchar_t** data, size_type newLen = size_type(-1) )
+  size_type GetMutableData(wchar_t** aData, size_type aNewLen = size_type(-1))
   {
-    return GetMutableData(reinterpret_cast<char16_t**>(data), newLen);
+    return GetMutableData(reinterpret_cast<char16_t**>(aData), aNewLen);
   }
 
-  size_type GetMutableData( wchar_t** data, size_type newLen, const fallible_t& )
+  size_type GetMutableData(wchar_t** aData, size_type aNewLen, const fallible_t&)
   {
-    return GetMutableData(reinterpret_cast<char16_t**>(data), newLen, fallible_t());
+    return GetMutableData(reinterpret_cast<char16_t**>(aData), aNewLen, fallible_t());
   }
 #endif
 
 
   /**
    * string data is never null, but can be marked void.  if true, the
    * string will be truncated.  @see nsTSubstring::IsVoid
    */
 
-  void NS_FASTCALL SetIsVoid( bool );
+  void NS_FASTCALL SetIsVoid(bool);
 
   /**
    *  This method is used to remove all occurrences of aChar from this
    * string.
    *
    *  @param  aChar -- char to be stripped
    *  @param  aOffset -- where in this string to start stripping chars
    */
 
-  void StripChar( char_type aChar, int32_t aOffset=0 );
+  void StripChar(char_type aChar, int32_t aOffset = 0);
 
   /**
    *  This method is used to remove all occurrences of aChars from this
    * string.
    *
    *  @param  aChars -- chars to be stripped
    *  @param  aOffset -- where in this string to start stripping chars
    */
 
-  void StripChars( const char_type* aChars, uint32_t aOffset=0 );
+  void StripChars(const char_type* aChars, uint32_t aOffset = 0);
 
   /**
    * If the string uses a shared buffer, this method
    * clears the pointer without releasing the buffer.
    */
   void ForgetSharedBuffer()
   {
-    if (mFlags & nsSubstring::F_SHARED)
-    {
+    if (mFlags & nsSubstring::F_SHARED) {
       mData = char_traits::sEmptyBuffer;
       mLength = 0;
       mFlags = F_TERMINATED;
     }
   }
 
 public:
 
   /**
    * this is public to support automatic conversion of tuple to string
    * base type, which helps avoid converting to nsTAString.
    */
-  MOZ_IMPLICIT nsTSubstring_CharT(const substring_tuple_type& tuple)
-    : mData(nullptr),
-      mLength(0),
-      mFlags(F_NONE)
+  MOZ_IMPLICIT nsTSubstring_CharT(const substring_tuple_type& aTuple)
+    : mData(nullptr)
+    , mLength(0)
+    , mFlags(F_NONE)
   {
-    Assign(tuple);
+    Assign(aTuple);
   }
 
   /**
    * allows for direct initialization of a nsTSubstring object.
    *
    * NOTE: this constructor is declared public _only_ for convenience
    * inside the string implementation.
    */
   // XXXbz or can I just include nscore.h and use NS_BUILD_REFCNT_LOGGING?
 #if defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING)
 #define XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
-  nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags );
+  nsTSubstring_CharT(char_type* aData, size_type aLength, uint32_t aFlags);
 #else
 #undef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
-  nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags )
-    : mData(data),
-      mLength(length),
-      mFlags(flags) {}
+  nsTSubstring_CharT(char_type* aData, size_type aLength, uint32_t aFlags)
+    : mData(aData)
+    , mLength(aLength)
+    , mFlags(aFlags)
+  {
+  }
 #endif /* DEBUG || FORCE_BUILD_REFCNT_LOGGING */
 
-  size_t SizeOfExcludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfExcludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
-  size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
 
-  size_t SizeOfExcludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfExcludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
-  size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
 
   /**
    * WARNING: Only use these functions if you really know what you are
    * doing, because they can easily lead to double-counting strings.  If
    * you do use them, please explain clearly in a comment why it's safe
    * and won't lead to double-counting.
    */
-  size_t SizeOfExcludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfExcludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
-  size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
+  size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf)
   const;
 
 protected:
 
   friend class nsTObsoleteAStringThunk_CharT;
   friend class nsTSubstringTuple_CharT;
 
   // XXX GCC 3.4 needs this :-(
   friend class nsTPromiseFlatString_CharT;
 
   char_type*  mData;
   size_type   mLength;
   uint32_t    mFlags;
 
   // default initialization
   nsTSubstring_CharT()
-    : mData(char_traits::sEmptyBuffer),
-      mLength(0),
-      mFlags(F_TERMINATED) {}
+    : mData(char_traits::sEmptyBuffer)
+    ,  mLength(0)
+    ,  mFlags(F_TERMINATED)
+  {
+  }
 
   // version of constructor that leaves mData and mLength uninitialized
   explicit
-  nsTSubstring_CharT( uint32_t flags )
-    : mFlags(flags) {}
+  nsTSubstring_CharT(uint32_t aFlags)
+    : mFlags(aFlags)
+  {
+  }
 
   // copy-constructor, constructs as dependent on given object
   // (NOTE: this is for internal use only)
-  nsTSubstring_CharT( const self_type& str )
-    : mData(str.mData),
-      mLength(str.mLength),
-      mFlags(str.mFlags & (F_TERMINATED | F_VOIDED)) {}
+  nsTSubstring_CharT(const self_type& aStr)
+    : mData(aStr.mData)
+    ,  mLength(aStr.mLength)
+    ,  mFlags(aStr.mFlags & (F_TERMINATED | F_VOIDED))
+  {
+  }
 
   /**
    * this function releases mData and does not change the value of
    * any of its member variables.  in other words, this function acts
    * like a destructor.
    */
   void NS_FASTCALL Finalize();
 
   /**
    * this function prepares mData to be mutated.
    *
-   * @param capacity     specifies the required capacity of mData
-   * @param old_data     returns null or the old value of mData
-   * @param old_flags    returns 0 or the old value of mFlags
+   * @param aCapacity    specifies the required capacity of mData
+   * @param aOldData     returns null or the old value of mData
+   * @param aOldFlags    returns 0 or the old value of mFlags
    *
    * if mData is already mutable and of sufficient capacity, then this
    * function will return immediately.  otherwise, it will either resize
    * mData or allocate a new shared buffer.  if it needs to allocate a
    * new buffer, then it will return the old buffer and the corresponding
    * flags.  this allows the caller to decide when to free the old data.
    *
    * this function returns false if is unable to allocate sufficient
    * memory.
    *
    * XXX we should expose a way for subclasses to free old_data.
    */
-  bool NS_FASTCALL MutatePrep( size_type capacity, char_type** old_data, uint32_t* old_flags );
+  bool NS_FASTCALL MutatePrep(size_type aCapacity,
+                              char_type** aOldData, uint32_t* aOldFlags);
 
   /**
    * this function prepares a section of mData to be modified.  if
    * necessary, this function will reallocate mData and possibly move
    * existing data to open up the specified section.
    *
-   * @param cutStart     specifies the starting offset of the section
-   * @param cutLength    specifies the length of the section to be replaced
-   * @param newLength    specifies the length of the new section
+   * @param aCutStart    specifies the starting offset of the section
+   * @param aCutLength   specifies the length of the section to be replaced
+   * @param aNewLength   specifies the length of the new section
    *
    * for example, suppose mData contains the string "abcdef" then
    *
    *   ReplacePrep(2, 3, 4);
    *
    * would cause mData to look like "ab____f" where the characters
    * indicated by '_' have an unspecified value and can be freely
    * modified.  this function will null-terminate mData upon return.
    *
    * this function returns false if is unable to allocate sufficient
    * memory.
    */
-  bool ReplacePrep(index_type cutStart, size_type cutLength,
-                   size_type newLength) NS_WARN_UNUSED_RESULT
+  NS_WARN_UNUSED_RESULT bool ReplacePrep(index_type aCutStart,
+                                         size_type aCutLength,
+                                         size_type aNewLength)
   {
-    cutLength = XPCOM_MIN(cutLength, mLength - cutStart);
-    uint32_t newTotalLen = mLength - cutLength + newLength;
-    if (cutStart == mLength && Capacity() > newTotalLen) {
+    aCutLength = XPCOM_MIN(aCutLength, mLength - aCutStart);
+    uint32_t newTotalLen = mLength - aCutLength + aNewLength;
+    if (aCutStart == mLength && Capacity() > newTotalLen)
+    {
       mFlags &= ~F_VOIDED;
       mData[newTotalLen] = char_type(0);
       mLength = newTotalLen;
       return true;
     }
-    return ReplacePrepInternal(cutStart, cutLength, newLength, newTotalLen);
+    return ReplacePrepInternal(aCutStart, aCutLength, aNewLength, newTotalLen);
   }
 
-  bool NS_FASTCALL ReplacePrepInternal(index_type cutStart,
-                                       size_type cutLength,
-                                       size_type newFragLength,
-                                       size_type newTotalLength)
-  NS_WARN_UNUSED_RESULT;
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL ReplacePrepInternal(
+    index_type aCutStart,
+    size_type aCutLength,
+    size_type aNewFragLength,
+    size_type aNewTotalLength);
 
   /**
    * returns the number of writable storage units starting at mData.
    * the value does not include space for the null-terminator character.
    *
    * NOTE: this function returns 0 if mData is immutable (or the buffer
    *       is 0-sized).
    */
   size_type NS_FASTCALL Capacity() const;
 
   /**
    * this helper function can be called prior to directly manipulating
    * the contents of mData.  see, for example, BeginWriting.
    */
-  bool NS_FASTCALL EnsureMutable( size_type newLen = size_type(-1) ) NS_WARN_UNUSED_RESULT;
+  NS_WARN_UNUSED_RESULT bool NS_FASTCALL EnsureMutable(
+    size_type aNewLen = size_type(-1));
 
   /**
    * returns true if this string overlaps with the given string fragment.
    */
-  bool IsDependentOn( const char_type *start, const char_type *end ) const
+  bool IsDependentOn(const char_type* aStart, const char_type* aEnd) const
   {
     /**
      * if it _isn't_ the case that one fragment starts after the other ends,
      * or ends before the other starts, then, they conflict:
      *
-     *   !(f2.begin >= f1.end || f2.end <= f1.begin)
+     *   !(f2.begin >= f1.aEnd || f2.aEnd <= f1.begin)
      *
      * Simplified, that gives us:
      */
-    return ( start < (mData + mLength) && end > mData );
+    return (aStart < (mData + mLength) && aEnd > mData);
   }
 
   /**
    * this helper function stores the specified dataFlags in mFlags
    */
-  void SetDataFlags(uint32_t dataFlags)
+  void SetDataFlags(uint32_t aDataFlags)
   {
-    NS_ASSERTION((dataFlags & 0xFFFF0000) == 0, "bad flags");
-    mFlags = dataFlags | (mFlags & 0xFFFF0000);
+    NS_ASSERTION((aDataFlags & 0xFFFF0000) == 0, "bad flags");
+    mFlags = aDataFlags | (mFlags & 0xFFFF0000);
   }
 
-  void NS_FASTCALL ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type* data, size_type length );
+  void NS_FASTCALL ReplaceLiteral(index_type aCutStart, size_type aCutLength,
+                                  const char_type* aData, size_type aLength);
 
-  static int AppendFunc( void* arg, const char* s, uint32_t len);
+  static int AppendFunc(void* aArg, const char* aStr, uint32_t aLen);
 
 public:
 
   // NOTE: this method is declared public _only_ for convenience for
   // callers who don't have access to the original nsLiteralString_CharT.
-  void NS_FASTCALL AssignLiteral( const char_type* data, size_type length );
+  void NS_FASTCALL AssignLiteral(const char_type* aData, size_type aLength);
 
   // mFlags is a bitwise combination of the following flags.  the meaning
   // and interpretation of these flags is an implementation detail.
   //
   // NOTE: these flags are declared public _only_ for convenience inside
   // the string implementation.
 
   enum
@@ -904,53 +1078,63 @@ public:
   //   non-terminated substrings are always dependent.
   //
   //   F_VOIDED implies F_TERMINATED, and moreover it implies that mData
   //   points to char_traits::sEmptyBuffer.  Therefore, F_VOIDED is
   //   mutually exclusive with F_SHARED, F_OWNED, and F_FIXED.
   //
 };
 
-int NS_FASTCALL Compare( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs, const nsTStringComparator_CharT& = nsTDefaultStringComparator_CharT() );
+int NS_FASTCALL
+Compare(const nsTSubstring_CharT::base_string_type& aLhs,
+        const nsTSubstring_CharT::base_string_type& aRhs,
+        const nsTStringComparator_CharT& = nsTDefaultStringComparator_CharT());
 
 
-inline
-bool operator!=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator!=(const nsTSubstring_CharT::base_string_type& aLhs,
+           const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return !lhs.Equals(rhs);
+  return !aLhs.Equals(aRhs);
 }
 
-inline
-bool operator< ( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator<(const nsTSubstring_CharT::base_string_type& aLhs,
+          const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return Compare(lhs, rhs)< 0;
+  return Compare(aLhs, aRhs) < 0;
 }
 
-inline
-bool operator<=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator<=(const nsTSubstring_CharT::base_string_type& aLhs,
+           const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return Compare(lhs, rhs)<=0;
+  return Compare(aLhs, aRhs) <= 0;
 }
 
-inline
-bool operator==( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator==(const nsTSubstring_CharT::base_string_type& aLhs,
+           const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return lhs.Equals(rhs);
+  return aLhs.Equals(aRhs);
 }
 
-inline
-bool operator==( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::char_type* rhs )
+inline bool
+operator==(const nsTSubstring_CharT::base_string_type& aLhs,
+           const nsTSubstring_CharT::char_type* aRhs)
 {
-  return lhs.Equals(rhs);
+  return aLhs.Equals(aRhs);
 }
 
 
-inline
-bool operator>=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator>=(const nsTSubstring_CharT::base_string_type& aLhs,
+           const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return Compare(lhs, rhs)>=0;
+  return Compare(aLhs, aRhs) >= 0;
 }
 
-inline
-bool operator> ( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
+inline bool
+operator>(const nsTSubstring_CharT::base_string_type& aLhs,
+          const nsTSubstring_CharT::base_string_type& aRhs)
 {
-  return Compare(lhs, rhs)> 0;
+  return Compare(aLhs, aRhs) > 0;
 }
--- a/xpcom/string/public/nsTSubstringTuple.h
+++ b/xpcom/string/public/nsTSubstringTuple.h
@@ -23,56 +23,62 @@ public:
 
   typedef nsTSubstringTuple_CharT    self_type;
   typedef nsTSubstring_CharT         substring_type;
   typedef nsTSubstring_CharT         base_string_type;
   typedef uint32_t                   size_type;
 
 public:
 
-  nsTSubstringTuple_CharT(const base_string_type* a, const base_string_type* b)
+  nsTSubstringTuple_CharT(const base_string_type* aStrA,
+                          const base_string_type* aStrB)
     : mHead(nullptr)
-    , mFragA(a)
-    , mFragB(b) {}
+    , mFragA(aStrA)
+    , mFragB(aStrB)
+  {
+  }
 
-  nsTSubstringTuple_CharT(const self_type& head, const base_string_type* b)
-    : mHead(&head)
-    , mFragA(nullptr) // this fragment is ignored when head != nullptr
-    , mFragB(b) {}
+  nsTSubstringTuple_CharT(const self_type& aHead,
+                          const base_string_type* aStrB)
+    : mHead(&aHead)
+    , mFragA(nullptr) // this fragment is ignored when aHead != nullptr
+    , mFragB(aStrB)
+  {
+  }
 
   /**
    * computes the aggregate string length
    */
   size_type Length() const;
 
   /**
    * writes the aggregate string to the given buffer.  bufLen is assumed
    * to be equal to or greater than the value returned by the Length()
    * method.  the string written to |buf| is not null-terminated.
    */
-  void WriteTo(char_type *buf, uint32_t bufLen) const;
+  void WriteTo(char_type* aBuf, uint32_t aBufLen) const;
 
   /**
    * returns true if this tuple is dependent on (i.e., overlapping with)
    * the given char sequence.
    */
-  bool IsDependentOn(const char_type *start, const char_type *end) const;
+  bool IsDependentOn(const char_type* aStart, const char_type* aEnd) const;
 
 private:
 
   const self_type*        mHead;
   const base_string_type* mFragA;
   const base_string_type* mFragB;
 };
 
-inline
-const nsTSubstringTuple_CharT
-operator+(const nsTSubstringTuple_CharT::base_string_type& a, const nsTSubstringTuple_CharT::base_string_type& b)
+inline const nsTSubstringTuple_CharT
+operator+(const nsTSubstringTuple_CharT::base_string_type& aStrA,
+          const nsTSubstringTuple_CharT::base_string_type& aStrB)
 {
-  return nsTSubstringTuple_CharT(&a, &b);
+  return nsTSubstringTuple_CharT(&aStrA, &aStrB);
 }
 
-inline
-const nsTSubstringTuple_CharT
-operator+(const nsTSubstringTuple_CharT& head, const nsTSubstringTuple_CharT::base_string_type& b)
+inline const nsTSubstringTuple_CharT
+operator+(const nsTSubstringTuple_CharT& aHead,
+          const nsTSubstringTuple_CharT::base_string_type& aStrB)
 {
-  return nsTSubstringTuple_CharT(head, &b);
+  return nsTSubstringTuple_CharT(aHead, &aStrB);
 }
--- a/xpcom/string/public/nsUTF8Utils.h
+++ b/xpcom/string/public/nsUTF8Utils.h
@@ -13,153 +13,153 @@
 #include "nscore.h"
 #include "mozilla/SSE.h"
 
 #include "nsCharTraits.h"
 
 class UTF8traits
 {
 public:
-  static bool isASCII(char c) { return (c & 0x80) == 0x00; }
-  static bool isInSeq(char c) { return (c & 0xC0) == 0x80; }
-  static bool is2byte(char c) { return (c & 0xE0) == 0xC0; }
-  static bool is3byte(char c) { return (c & 0xF0) == 0xE0; }
-  static bool is4byte(char c) { return (c & 0xF8) == 0xF0; }
-  static bool is5byte(char c) { return (c & 0xFC) == 0xF8; }
-  static bool is6byte(char c) { return (c & 0xFE) == 0xFC; }
+  static bool isASCII(char aChar)
+  {
+    return (aChar & 0x80) == 0x00;
+  }
+  static bool isInSeq(char aChar)
+  {
+    return (aChar & 0xC0) == 0x80;
+  }
+  static bool is2byte(char aChar)
+  {
+    return (aChar & 0xE0) == 0xC0;
+  }
+  static bool is3byte(char aChar)
+  {
+    return (aChar & 0xF0) == 0xE0;
+  }
+  static bool is4byte(char aChar)
+  {
+    return (aChar & 0xF8) == 0xF0;
+  }
+  static bool is5byte(char aChar)
+  {
+    return (aChar & 0xFC) == 0xF8;
+  }
+  static bool is6byte(char aChar)
+  {
+    return (aChar & 0xFE) == 0xFC;
+  }
 };
 
 /**
  * Extract the next UCS-4 character from the buffer and return it.  The
  * pointer passed in is advanced to the start of the next character in the
  * buffer.  If non-null, the parameters err and overlong are filled in to
  * indicate that the character was represented by an overlong sequence, or
  * that an error occurred.
  */
 
 class UTF8CharEnumerator
 {
 public:
-  static uint32_t NextChar(const char **buffer, const char *end,
-                           bool *err)
+  static uint32_t NextChar(const char** aBuffer, const char* aEnd, bool* aErr)
   {
-    NS_ASSERTION(buffer && *buffer, "null buffer!");
+    NS_ASSERTION(aBuffer && *aBuffer, "null buffer!");
 
-    const char *p = *buffer;
-    *err = false;
+    const char* p = *aBuffer;
+    *aErr = false;
 
-    if (p >= end)
-    {
-      *err = true;
+    if (p >= aEnd) {
+      *aErr = true;
 
       return 0;
     }
 
     char c = *p++;
 
-    if ( UTF8traits::isASCII(c) )
-    {
-      *buffer = p;
+    if (UTF8traits::isASCII(c)) {
+      *aBuffer = p;
       return c;
     }
 
     uint32_t ucs4;
     uint32_t minUcs4;
     int32_t state = 0;
 
     if (!CalcState(c, ucs4, minUcs4, state)) {
       NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
-      *err = true;
+      *aErr = true;
 
       return 0;
     }
 
-    while ( state-- )
-    {
-      if (p == end)
-      {
-        *err = true;
+    while (state--) {
+      if (p == aEnd) {
+        *aErr = true;
 
         return 0;
       }
 
       c = *p++;
 
-      if (!AddByte(c, state, ucs4))
-      {
-        *err = true;
+      if (!AddByte(c, state, ucs4)) {
+        *aErr = true;
 
         return 0;
       }
     }
 
-    if ( ucs4 < minUcs4 )
-    {
+    if (ucs4 < minUcs4) {
       // Overlong sequence
       ucs4 = UCS2_REPLACEMENT_CHAR;
-    }
-    else if ( ucs4 >= 0xD800 &&
-              (ucs4 <= 0xDFFF || ucs4 >= UCS_END))
-    {
+    } else if (ucs4 >= 0xD800 &&
+               (ucs4 <= 0xDFFF || ucs4 >= UCS_END)) {
       // Surrogates and code points outside the Unicode range.
       ucs4 = UCS2_REPLACEMENT_CHAR;
     }
 
-    *buffer = p;
+    *aBuffer = p;
     return ucs4;
   }
 
 private:
-  static bool CalcState(char c, uint32_t& ucs4, uint32_t& minUcs4,
-                        int32_t& state)
+  static bool CalcState(char aChar, uint32_t& aUcs4, uint32_t& aMinUcs4,
+                        int32_t& aState)
   {
-    if ( UTF8traits::is2byte(c) )
-    {
-      ucs4 = (uint32_t(c) << 6) & 0x000007C0L;
-      state = 1;
-      minUcs4 = 0x00000080;
-    }
-    else if ( UTF8traits::is3byte(c) )
-    {
-      ucs4 = (uint32_t(c) << 12) & 0x0000F000L;
-      state = 2;
-      minUcs4 = 0x00000800;
-    }
-    else if ( UTF8traits::is4byte(c) )
-    {
-      ucs4 = (uint32_t(c) << 18) & 0x001F0000L;
-      state = 3;
-      minUcs4 = 0x00010000;
-    }
-    else if ( UTF8traits::is5byte(c) )
-    {
-      ucs4 = (uint32_t(c) << 24) & 0x03000000L;
-      state = 4;
-      minUcs4 = 0x00200000;
-    }
-    else if ( UTF8traits::is6byte(c) )
-    {
-      ucs4 = (uint32_t(c) << 30) & 0x40000000L;
-      state = 5;
-      minUcs4 = 0x04000000;
-    }
-    else
-    {
+    if (UTF8traits::is2byte(aChar)) {
+      aUcs4 = (uint32_t(aChar) << 6) & 0x000007C0L;
+      aState = 1;
+      aMinUcs4 = 0x00000080;
+    } else if (UTF8traits::is3byte(aChar)) {
+      aUcs4 = (uint32_t(aChar) << 12) & 0x0000F000L;
+      aState = 2;
+      aMinUcs4 = 0x00000800;
+    } else if (UTF8traits::is4byte(aChar)) {
+      aUcs4 = (uint32_t(aChar) << 18) & 0x001F0000L;
+      aState = 3;
+      aMinUcs4 = 0x00010000;
+    } else if (UTF8traits::is5byte(aChar)) {
+      aUcs4 = (uint32_t(aChar) << 24) & 0x03000000L;
+      aState = 4;
+      aMinUcs4 = 0x00200000;
+    } else if (UTF8traits::is6byte(aChar)) {
+      aUcs4 = (uint32_t(aChar) << 30) & 0x40000000L;
+      aState = 5;
+      aMinUcs4 = 0x04000000;
+    } else {
       return false;
     }
 
     return true;
   }
 
-  static bool AddByte(char c, int32_t state, uint32_t& ucs4)
+  static bool AddByte(char aChar, int32_t aState, uint32_t& aUcs4)
   {
-    if ( UTF8traits::isInSeq(c) )
-    {
-      int32_t shift = state * 6;
-      ucs4 |= (uint32_t(c) & 0x3F) << shift;
+    if (UTF8traits::isInSeq(aChar)) {
+      int32_t shift = aState * 6;
+      aUcs4 |= (uint32_t(aChar) & 0x3F) << shift;
       return true;
     }
 
     return false;
   }
 };
 
 
@@ -168,159 +168,160 @@ private:
  * pointer passed in is advanced to the start of the next character in the
  * buffer.  If non-null, the err parameter is filled in if an error occurs.
  */
 
 
 class UTF16CharEnumerator
 {
 public:
-  static uint32_t NextChar(const char16_t **buffer, const char16_t *end,
-                           bool *err = nullptr)
+  static uint32_t NextChar(const char16_t** aBuffer, const char16_t* aEnd,
+                           bool* aErr = nullptr)
   {
-    NS_ASSERTION(buffer && *buffer, "null buffer!");
+    NS_ASSERTION(aBuffer && *aBuffer, "null buffer!");
 
-    const char16_t *p = *buffer;
+    const char16_t* p = *aBuffer;
 
-    if (p >= end)
-    {
+    if (p >= aEnd) {
       NS_ERROR("No input to work with");
-      if (err)
-        *err = true;
+      if (aErr) {
+        *aErr = true;
+      }
 
       return 0;
     }
 
     char16_t c = *p++;
 
-    if (!IS_SURROGATE(c)) // U+0000 - U+D7FF,U+E000 - U+FFFF
-    {
-      if (err)
-        *err = false;
-      *buffer = p;
+    if (!IS_SURROGATE(c)) { // U+0000 - U+D7FF,U+E000 - U+FFFF
+      if (aErr) {
+        *aErr = false;
+      }
+      *aBuffer = p;
       return c;
-    }
-    else if (NS_IS_HIGH_SURROGATE(c)) // U+D800 - U+DBFF
-    {
-      if (p == end)
-      {
-        // Found a high surrogate the end of the buffer. Flag this
+    } else if (NS_IS_HIGH_SURROGATE(c)) { // U+D800 - U+DBFF
+      if (p == aEnd) {
+        // Found a high surrogate at the end of the buffer. Flag this
         // as an error and return the Unicode replacement
         // character 0xFFFD.
 
         NS_WARNING("Unexpected end of buffer after high surrogate");
 
-        if (err)
-          *err = true;
-        *buffer = p;
+        if (aErr) {
+          *aErr = true;
+        }
+        *aBuffer = p;
         return 0xFFFD;
       }
 
       // D800- DBFF - High Surrogate
       char16_t h = c;
 
       c = *p++;
 
-      if (NS_IS_LOW_SURROGATE(c))
-      {
+      if (NS_IS_LOW_SURROGATE(c)) {
         // DC00- DFFF - Low Surrogate
         // N = (H - D800) *400 + 10000 + (L - DC00)
         uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
-        if (err)
-          *err = false;
-        *buffer = p;
+        if (aErr) {
+          *aErr = false;
+        }
+        *aBuffer = p;
         return ucs4;
-      }
-      else
-      {
+      } else {
         // Found a high surrogate followed by something other than
         // a low surrogate. Flag this as an error and return the
         // Unicode replacement character 0xFFFD.  Note that the
         // pointer to the next character points to the second 16-bit
         // value, not beyond it, as per Unicode 5.0.0 Chapter 3 C10,
         // only the first code unit of an illegal sequence must be
         // treated as an illegally terminated code unit sequence
         // (also Chapter 3 D91, "isolated [not paired and ill-formed]
         // UTF-16 code units in the range D800..DFFF are ill-formed").
         NS_WARNING("got a High Surrogate but no low surrogate");
 
-        if (err)
-          *err = true;
-        *buffer = p - 1;
+        if (aErr) {
+          *aErr = true;
+        }
+        *aBuffer = p - 1;
         return 0xFFFD;
       }
-    }
-    else // U+DC00 - U+DFFF
-    {
+    } else { // U+DC00 - U+DFFF
       // DC00- DFFF - Low Surrogate
 
       // Found a low surrogate w/o a preceding high surrogate. Flag
       // this as an error and return the Unicode replacement
       // character 0xFFFD.
 
       NS_WARNING("got a low Surrogate but no high surrogate");
-      if (err)
-        *err = true;
-      *buffer = p;
+      if (aErr) {
+        *aErr = true;
+      }
+      *aBuffer = p;
       return 0xFFFD;
     }
 
-    if (err)
-      *err = true;
+    if (aErr) {
+      *aErr = true;
+    }
     return 0;
   }
 };
 
 
 /**
  * A character sink (see |copy_string| in nsAlgorithm.h) for converting
  * UTF-8 to UTF-16
  */
 class ConvertUTF8toUTF16
 {
 public:
   typedef char value_type;
   typedef char16_t buffer_type;
 
-  explicit ConvertUTF8toUTF16( buffer_type* aBuffer )
-    : mStart(aBuffer), mBuffer(aBuffer), mErrorEncountered(false) {}
+  explicit ConvertUTF8toUTF16(buffer_type* aBuffer)
+    : mStart(aBuffer), mBuffer(aBuffer), mErrorEncountered(false)
+  {
+  }
 
-  size_t Length() const { return mBuffer - mStart; }
+  size_t Length() const
+  {
+    return mBuffer - mStart;
+  }
 
-  bool ErrorEncountered() const { return mErrorEncountered; }
+  bool ErrorEncountered() const
+  {
+    return mErrorEncountered;
+  }
 
-  void write( const value_type* start, uint32_t N )
+  void write(const value_type* aStart, uint32_t aN)
   {
-    if ( mErrorEncountered )
+    if (mErrorEncountered) {
       return;
+    }
 
     // algorithm assumes utf8 units won't
     // be spread across fragments
-    const value_type* p = start;
-    const value_type* end = start + N;
+    const value_type* p = aStart;
+    const value_type* end = aStart + aN;
     buffer_type* out = mBuffer;
-    for ( ; p != end /* && *p */; )
-    {
+    for (; p != end /* && *p */;) {
       bool err;
       uint32_t ucs4 = UTF8CharEnumerator::NextChar(&p, end, &err);
 
-      if ( err )
-      {
+      if (err) {
         mErrorEncountered = true;
         mBuffer = out;
         return;
       }
 
-      if ( ucs4 >= PLANE1_BASE )
-      {
+      if (ucs4 >= PLANE1_BASE) {
         *out++ = (buffer_type)H_SURROGATE(ucs4);
         *out++ = (buffer_type)L_SURROGATE(ucs4);
-      }
-      else
-      {
+      } else {
         *out++ = ucs4;
       }
     }
     mBuffer = out;
   }
 
   void write_terminator()
   {
@@ -337,39 +338,45 @@ private:
  * A character sink (see |copy_string| in nsAlgorithm.h) for computing
  * the length of the UTF-16 string equivalent to a UTF-8 string.
  */
 class CalculateUTF8Length
 {
 public:
   typedef char value_type;
 
-  CalculateUTF8Length() : mLength(0), mErrorEncountered(false) { }
+  CalculateUTF8Length()
+    : mLength(0), mErrorEncountered(false)
+  {
+  }
 
-  size_t Length() const { return mLength; }
+  size_t Length() const
+  {
+    return mLength;
+  }
 
-  void write( const value_type* start, uint32_t N )
+  void write(const value_type* aStart, uint32_t aN)
   {
     // ignore any further requests
-    if ( mErrorEncountered )
+    if (mErrorEncountered) {
       return;
+    }
 
     // algorithm assumes utf8 units won't
     // be spread across fragments
-    const value_type* p = start;
-    const value_type* end = start + N;
-    for ( ; p < end /* && *p */; ++mLength )
-    {
-      if ( UTF8traits::isASCII(*p) )
+    const value_type* p = aStart;
+    const value_type* end = aStart + aN;
+    for (; p < end /* && *p */; ++mLength) {
+      if (UTF8traits::isASCII(*p)) {
         p += 1;
-      else if ( UTF8traits::is2byte(*p) )
+      } else if (UTF8traits::is2byte(*p)) {
         p += 2;
-      else if ( UTF8traits::is3byte(*p) )
+      } else if (UTF8traits::is3byte(*p)) {
         p += 3;
-      else if ( UTF8traits::is4byte(*p) ) {
+      } else if (UTF8traits::is4byte(*p)) {
         // Because a UTF-8 sequence of 4 bytes represents a codepoint
         // greater than 0xFFFF, it will become a surrogate pair in the
         // UTF-16 string, so add 1 more to mLength.
         // This doesn't happen with is5byte and is6byte because they
         // are illegal UTF-8 sequences (greater than 0x10FFFF) so get
         // converted to a single replacement character.
 
         // However, there is one case when a 4 byte UTF-8 sequence will
@@ -396,34 +403,32 @@ public:
         // since no UTF16 characters will be written in that case by
         // ConvertUTF8toUTF16. Likewise it doesn't matter what we do if
         // any of the surrogate bits are wrong since no UTF16
         // characters will be written in that case either.
 
         if (p + 4 <= end) {
           uint32_t c = ((uint32_t)(p[0] & 0x07)) << 6 |
                        ((uint32_t)(p[1] & 0x30));
-          if (c >= 0x010 && c < 0x110)
+          if (c >= 0x010 && c < 0x110) {
             ++mLength;
+          }
         }
 
         p += 4;
-      }
-      else if ( UTF8traits::is5byte(*p) )
+      } else if (UTF8traits::is5byte(*p)) {
         p += 5;
-      else if ( UTF8traits::is6byte(*p) )
+      } else if (UTF8traits::is6byte(*p)) {
         p += 6;
-      else // error
-      {
+      } else { // error
         ++mLength; // to account for the decrement below
         break;
       }
     }
-    if ( p != end )
-    {
+    if (p != end) {
       NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
       --mLength; // The last multi-byte char wasn't complete, discard it.
       mErrorEncountered = true;
     }
   }
 
 private:
   size_t mLength;
@@ -440,78 +445,71 @@ class ConvertUTF16toUTF8
 public:
   typedef char16_t value_type;
   typedef char buffer_type;
 
   // The error handling here is more lenient than that in
   // |ConvertUTF8toUTF16|, but it's that way for backwards
   // compatibility.
 
-  explicit ConvertUTF16toUTF8( buffer_type* aBuffer )
-    : mStart(aBuffer), mBuffer(aBuffer) {}
+  explicit ConvertUTF16toUTF8(buffer_type* aBuffer)
+    : mStart(aBuffer), mBuffer(aBuffer)
+  {
+  }
 
-  size_t Size() const { return mBuffer - mStart; }
-
-  void write( const value_type* start, uint32_t N )
+  size_t Size() const
   {
-    buffer_type *out = mBuffer; // gcc isn't smart enough to do this!
+    return mBuffer - mStart;
+  }
 
-    for (const value_type *p = start, *end = start + N; p < end; ++p )
-    {
+  void write(const value_type* aStart, uint32_t aN)
+  {
+    buffer_type* out = mBuffer; // gcc isn't smart enough to do this!
+
+    for (const value_type* p = aStart, *end = aStart + aN; p < end; ++p) {
       value_type c = *p;
-      if (! (c & 0xFF80)) // U+0000 - U+007F
-      {
+      if (!(c & 0xFF80)) { // U+0000 - U+007F
         *out++ = (char)c;
-      }
-      else if (! (c & 0xF800)) // U+0100 - U+07FF
-      {
+      } else if (!(c & 0xF800)) { // U+0100 - U+07FF
         *out++ = 0xC0 | (char)(c >> 6);
         *out++ = 0x80 | (char)(0x003F & c);
-      }
-      else if (!IS_SURROGATE(c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
-      {
+      } else if (!IS_SURROGATE(c)) { // U+0800 - U+D7FF,U+E000 - U+FFFF
         *out++ = 0xE0 | (char)(c >> 12);
         *out++ = 0x80 | (char)(0x003F & (c >> 6));
-        *out++ = 0x80 | (char)(0x003F & c );
-      }
-      else if (NS_IS_HIGH_SURROGATE(c)) // U+D800 - U+DBFF
-      {
+        *out++ = 0x80 | (char)(0x003F & c);
+      } else if (NS_IS_HIGH_SURROGATE(c)) { // U+D800 - U+DBFF
         // D800- DBFF - High Surrogate
         value_type h = c;
 
         ++p;
-        if (p == end)
-        {
+        if (p == end) {
           // Treat broken characters as the Unicode
           // replacement character 0xFFFD (0xEFBFBD in
           // UTF-8)
           *out++ = '\xEF';
           *out++ = '\xBF';
           *out++ = '\xBD';
 
           NS_WARNING("String ending in half a surrogate pair!");
 
           break;
         }
         c = *p;
 
-        if (NS_IS_LOW_SURROGATE(c))
-        {
+        if (NS_IS_LOW_SURROGATE(c)) {
           // DC00- DFFF - Low Surrogate
           // N = (H - D800) *400 + 10000 + ( L - DC00 )
           uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
 
           // 0001 0000-001F FFFF
           *out++ = 0xF0 | (char)(ucs4 >> 18);
           *out++ = 0x80 | (char)(0x003F & (ucs4 >> 12));
           *out++ = 0x80 | (char)(0x003F & (ucs4 >> 6));
           *out++ = 0x80 | (char)(0x003F & ucs4);
-        }
-        else
-        {
+        } else {
           // Treat broken characters as the Unicode
           // replacement character 0xFFFD (0xEFBFBD in
           // UTF-8)
           *out++ = '\xEF';
           *out++ = '\xBF';
           *out++ = '\xBD';
 
           // The pointer to the next character points to the second
@@ -520,19 +518,17 @@ public:
           // sequence must be treated as an illegally terminated
           // code unit sequence (also Chapter 3 D91, "isolated [not
           // paired and ill-formed] UTF-16 code units in the range
           // D800..DFFF are ill-formed").
           p--;
 
           NS_WARNING("got a High Surrogate but no low surrogate");
         }
-      }
-      else // U+DC00 - U+DFFF
-      {
+      } else { // U+DC00 - U+DFFF
         // Treat broken characters as the Unicode replacement
         // character 0xFFFD (0xEFBFBD in UTF-8)
         *out++ = '\xEF';
         *out++ = '\xBF';
         *out++ = '\xBD';
 
         // DC00- DFFF - Low Surrogate
         NS_WARNING("got a low Surrogate but no high surrogate");
@@ -558,71 +554,70 @@ private:
  * UTF-16 data as 0xFFFD (0xEFBFBD in UTF-8).
  */
 class CalculateUTF8Size
 {
 public:
   typedef char16_t value_type;
 
   CalculateUTF8Size()
-    : mSize(0) { }
+    : mSize(0)
+  {
+  }
 
-  size_t Size() const { return mSize; }
+  size_t Size() const
+  {
+    return mSize;
+  }
 
-  void write( const value_type* start, uint32_t N )
+  void write(const value_type* aStart, uint32_t aN)
   {
     // Assume UCS2 surrogate pairs won't be spread across fragments.
-    for (const value_type *p = start, *end = start + N; p < end; ++p )
-    {
+    for (const value_type* p = aStart, *end = aStart + aN; p < end; ++p) {
       value_type c = *p;
-      if (! (c & 0xFF80)) // U+0000 - U+007F
+      if (!(c & 0xFF80)) { // U+0000 - U+007F
         mSize += 1;
-      else if (! (c & 0xF800)) // U+0100 - U+07FF
+      } else if (!(c & 0xF800)) { // U+0100 - U+07FF
         mSize += 2;
-      else if (0xD800 != (0xF800 & c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
+      } else if (0xD800 != (0xF800 & c)) { // U+0800 - U+D7FF,U+E000 - U+FFFF
         mSize += 3;
-      else if (0xD800 == (0xFC00 & c)) // U+D800 - U+DBFF
-      {
+      } else if (0xD800 == (0xFC00 & c)) { // U+D800 - U+DBFF
         ++p;
-        if (p == end)
-        {
+        if (p == end) {
           // Treat broken characters as the Unicode
           // replacement character 0xFFFD (0xEFBFBD in
           // UTF-8)
           mSize += 3;
 
           NS_WARNING("String ending in half a surrogate pair!");
 
           break;
         }
         c = *p;
 
-        if (0xDC00 == (0xFC00 & c))
+        if (0xDC00 == (0xFC00 & c)) {
           mSize += 4;
-        else
-        {
+        } else {
           // Treat broken characters as the Unicode
           // replacement character 0xFFFD (0xEFBFBD in
           // UTF-8)
           mSize += 3;
 
           // The next code unit is the second 16-bit value, not
           // the one beyond it, as per Unicode 5.0.0 Chapter 3 C10,
           // only the first code unit of an illegal sequence must
           // be treated as an illegally terminated code unit
           // sequence (also Chapter 3 D91, "isolated [not paired and
           // ill-formed] UTF-16 code units in the range D800..DFFF
           // are ill-formed").
           p--;
 
           NS_WARNING("got a high Surrogate but no low surrogate");
         }
-      }
-      else // U+DC00 - U+DFFF
-      {
+      } else { // U+DC00 - U+DFFF
         // Treat broken characters as the Unicode replacement
         // character 0xFFFD (0xEFBFBD in UTF-8)
         mSize += 3;
 
         NS_WARNING("got a low Surrogate but no high surrogate");
       }
     }
   }
@@ -639,36 +634,38 @@ private:
 class LossyConvertEncoding8to16
 {
 public:
   typedef char value_type;
   typedef char input_type;
   typedef char16_t output_type;
 
 public:
-  explicit LossyConvertEncoding8to16( char16_t* aDestination ) :
-    mDestination(aDestination) { }
+  explicit LossyConvertEncoding8to16(char16_t* aDestination) :
+    mDestination(aDestination)
+  {
+  }
 
   void
-  write( const char* aSource, uint32_t aSourceLength )
+  write(const char* aSource, uint32_t aSourceLength)
   {
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
-    if (mozilla::supports_sse2())
-    {
+    if (mozilla::supports_sse2()) {
       write_sse2(aSource, aSourceLength);
       return;
     }
 #endif
     const char* done_writing = aSource + aSourceLength;
-    while ( aSource < done_writing )
+    while (aSource < done_writing) {
       *mDestination++ = (char16_t)(unsigned char)(*aSource++);
+    }
   }
 
   void
-  write_sse2( const char* aSource, uint32_t aSourceLength );
+  write_sse2(const char* aSource, uint32_t aSourceLength);
 
   void
   write_terminator()
   {
     *mDestination = (char16_t)(0);
   }
 
 private:
@@ -681,42 +678,45 @@ private:
  */
 class LossyConvertEncoding16to8
 {
 public:
   typedef char16_t value_type;
   typedef char16_t input_type;
   typedef char output_type;
 
-  explicit LossyConvertEncoding16to8( char* aDestination ) : mDestination(aDestination) { }
+  explicit LossyConvertEncoding16to8(char* aDestination)
+    : mDestination(aDestination)
+  {
+  }
 
   void
-  write( const char16_t* aSource, uint32_t aSourceLength)
+  write(const char16_t* aSource, uint32_t aSourceLength)
   {
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
-    if (mozilla::supports_sse2())
-    {
+    if (mozilla::supports_sse2()) {
       write_sse2(aSource, aSourceLength);
       return;
     }
 #endif
     const char16_t* done_writing = aSource + aSourceLength;
-    while ( aSource < done_writing )
+    while (aSource < done_writing) {
       *mDestination++ = (char)(*aSource++);
+    }
   }
 
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
   void
-  write_sse2( const char16_t* aSource, uint32_t aSourceLength );
+  write_sse2(const char16_t* aSource, uint32_t aSourceLength);
 #endif
 
   void
   write_terminator()
   {
     *mDestination = '\0';
   }
 
 private:
-  char *mDestination;
+  char* mDestination;
 };
 #endif // MOZILLA_INTERNAL_API
 
 #endif /* !defined(nsUTF8Utils_h_) */
--- a/xpcom/string/public/nsXPCOMStrings.h
+++ b/xpcom/string/public/nsXPCOMStrings.h
@@ -102,25 +102,26 @@ class nsStringContainer;
  * cause problems since the the struct is only accessed via the casts to
  * nsString.
  * We use protected instead of private to avoid compiler warnings about
  * the members being unused.
  */
 struct nsStringContainer_base
 {
 protected:
-  void *d1;
+  void* d1;
   uint32_t d2;
   uint32_t d3;
 };
 
 /**
  * Flags that may be OR'd together to pass to NS_StringContainerInit2:
  */
-enum {
+enum
+{
   /* Data passed into NS_StringContainerInit2 is not copied; instead, the
    * string references the passed in data pointer directly.  The caller must
    * ensure that the data is valid for the lifetime of the string container.
    * This flag should not be combined with NS_STRING_CONTAINER_INIT_ADOPT. */
   NS_STRING_CONTAINER_INIT_DEPEND    = (1 << 1),
 
   /* Data passed into NS_StringContainerInit2 is not copied; instead, the
    * string takes ownership over the data pointer.  The caller must have
@@ -137,18 +138,17 @@ enum {
  * NS_StringContainerInit
  *
  * @param aContainer    string container reference
  * @return              NS_OK if string container successfully initialized
  *
  * This function may allocate additional memory for aContainer.  When
  * aContainer is no longer needed, NS_StringContainerFinish should be called.
  */
-XPCOM_API(nsresult)
-NS_StringContainerInit(nsStringContainer &aContainer);
+XPCOM_API(nsresult) NS_StringContainerInit(nsStringContainer& aContainer);
 
 /**
  * NS_StringContainerInit2
  *
  * @param aContainer    string container reference
  * @param aData         character buffer (may be null)
  * @param aDataLength   number of characters stored at aData (may pass
  *                      UINT32_MAX if aData is null-terminated)
@@ -159,30 +159,29 @@ NS_StringContainerInit(nsStringContainer
  *
  * This function resembles NS_StringContainerInit but provides further
  * options that permit more efficient memory usage.  When aContainer is
  * no longer needed, NS_StringContainerFinish should be called.
  *
  * NOTE: NS_StringContainerInit2(container, nullptr, 0, 0) is equivalent to
  * NS_StringContainerInit(container).
  */
-XPCOM_API(nsresult)
-NS_StringContainerInit2
-  (nsStringContainer &aContainer, const char16_t *aData = nullptr,
-   uint32_t aDataLength = UINT32_MAX, uint32_t aFlags = 0);
+XPCOM_API(nsresult) NS_StringContainerInit2(nsStringContainer& aContainer,
+                                            const char16_t* aData = nullptr,
+                                            uint32_t aDataLength = UINT32_MAX,
+                                            uint32_t aFlags = 0);
 
 /**
  * NS_StringContainerFinish
  *
  * @param aContainer    string container reference
  *
  * This function frees any memory owned by aContainer.
  */
-XPCOM_API(void)
-NS_StringContainerFinish(nsStringContainer &aContainer);
+XPCOM_API(void) NS_StringContainerFinish(nsStringContainer& aContainer);
 
 /* ------------------------------------------------------------------------- */
 
 /**
  * NS_StringGetData
  *
  * This function returns a const character pointer to the string's internal
  * buffer, the length of the string, and a boolean value indicating whether
@@ -191,20 +190,19 @@ NS_StringContainerFinish(nsStringContain
  * @param aStr          abstract string reference
  * @param aData         out param that will hold the address of aStr's
  *                      internal buffer
  * @param aTerminated   if non-null, this out param will be set to indicate
  *                      whether or not aStr's internal buffer is null-
  *                      terminated
  * @return              length of aStr's internal buffer
  */
-XPCOM_API(uint32_t)
-NS_StringGetData
-  (const nsAString &aStr, const char16_t **aData,
-   bool *aTerminated = nullptr);
+XPCOM_API(uint32_t) NS_StringGetData(const nsAString& aStr,
+                                     const char16_t** aData,
+                                     bool* aTerminated = nullptr);
 
 /**
  * NS_StringGetMutableData
  *
  * This function provides mutable access to a string's internal buffer.  It
  * returns a pointer to an array of characters that may be modified.  The
  * returned pointer remains valid until the string object is passed to some
  * other string function.
@@ -223,33 +221,31 @@ NS_StringGetData
  *                      internal buffer or null if the function failed
  * @return              number of characters or zero if the function failed
  *
  * This function does not necessarily null-terminate aStr after resizing its
  * internal buffer.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(uint32_t)
-NS_StringGetMutableData
-  (nsAString &aStr, uint32_t aDataLength, char16_t **aData);
+XPCOM_API(uint32_t) NS_StringGetMutableData(nsAString& aStr,
+                                            uint32_t aDataLength,
+                                            char16_t** aData);
 
 /**
  * NS_StringCloneData
  *
  * This function returns a null-terminated copy of the string's
  * internal buffer.
  *
  * @param aStr          abstract string reference
  * @return              null-terminated copy of the string's internal buffer
  *                      (it must be free'd using using nsMemory::Free)
  */
-XPCOM_API(char16_t *)
-NS_StringCloneData
-  (const nsAString &aStr);
+XPCOM_API(char16_t*) NS_StringCloneData(const nsAString& aStr);
 
 /**
  * NS_StringSetData
  *
  * This function copies aData into aStr.
  *
  * @param aStr          abstract string reference
  * @param aData         character buffer
@@ -258,20 +254,18 @@ NS_StringCloneData
  *                      a null character)
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr after copying data
  * from aData.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_StringSetData
-  (nsAString &aStr, const char16_t *aData,
-   uint32_t aDataLength = UINT32_MAX);
+XPCOM_API(nsresult) NS_StringSetData(nsAString& aStr, const char16_t* aData,
+                                     uint32_t aDataLength = UINT32_MAX);
 
 /**
  * NS_StringSetDataRange
  *
  * This function copies aData into a section of aStr.  As a result it can be
  * used to insert new characters into the string.
  *
  * @param aStr          abstract string reference
@@ -289,39 +283,38 @@ NS_StringSetData
  *                      a null character)
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr after copying data
  * from aData.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_StringSetDataRange
-  (nsAString &aStr, uint32_t aCutOffset, uint32_t aCutLength,
-   const char16_t *aData, uint32_t aDataLength = UINT32_MAX);
+XPCOM_API(nsresult) NS_StringSetDataRange(nsAString& aStr,
+                                          uint32_t aCutOffset, uint32_t aCutLength,
+                                          const char16_t* aData,
+                                          uint32_t aDataLength = UINT32_MAX);
 
 /**
  * NS_StringCopy
  *
  * This function makes aDestStr have the same value as aSrcStr.  It is
  * provided as an optimization.
  *
  * @param aDestStr      abstract string reference to be modified
  * @param aSrcStr       abstract string reference containing source string
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aDestStr after copying
  * data from aSrcStr.  The behavior depends on the implementation of the
  * abstract string, aDestStr.  If aDestStr is a reference to a
  * nsStringContainer, then its data will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_StringCopy
-  (nsAString &aDestStr, const nsAString &aSrcStr);
+XPCOM_API(nsresult) NS_StringCopy(nsAString& aDestStr,
+                                  const nsAString& aSrcStr);
 
 /**
  * NS_StringAppendData
  *
  * This function appends data to the existing value of aStr.
  *
  * @param aStr          abstract string reference to be modified
  * @param aData         character buffer
@@ -330,17 +323,17 @@ NS_StringCopy
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
-NS_StringAppendData(nsAString &aStr, const char16_t *aData,
+NS_StringAppendData(nsAString& aStr, const char16_t* aData,
                     uint32_t aDataLength = UINT32_MAX)
 {
   return NS_StringSetDataRange(aStr, UINT32_MAX, 0, aData, aDataLength);
 }
 
 /**
  * NS_StringInsertData
  *
@@ -355,17 +348,17 @@ NS_StringAppendData(nsAString &aStr, con
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
-NS_StringInsertData(nsAString &aStr, uint32_t aOffset, const char16_t *aData,
+NS_StringInsertData(nsAString& aStr, uint32_t aOffset, const char16_t* aData,
                     uint32_t aDataLength = UINT32_MAX)
 {
   return NS_StringSetDataRange(aStr, aOffset, 0, aData, aDataLength);
 }
 
 /**
  * NS_StringCutData
  *
@@ -373,38 +366,36 @@ NS_StringInsertData(nsAString &aStr, uin
  * at the specified offset.
  *
  * @param aStr          abstract string reference to be modified
  * @param aCutOffset    specifies where in the string to insert aData
  * @param aCutLength    number of characters to remove
  * @return              NS_OK if function succeeded
  */
 inline NS_HIDDEN_(nsresult)
-NS_StringCutData(nsAString &aStr, uint32_t aCutOffset, uint32_t aCutLength)
+NS_StringCutData(nsAString& aStr, uint32_t aCutOffset, uint32_t aCutLength)
 {
   return NS_StringSetDataRange(aStr, aCutOffset, aCutLength, nullptr, 0);
 }
 
 /**
  * NS_StringSetIsVoid
  *
  * This function marks a string as being a "void string".  Any data in the
  * string will be lost.
  */
-XPCOM_API(void)
-NS_StringSetIsVoid(nsAString& aStr, const bool aIsVoid);
+XPCOM_API(void) NS_StringSetIsVoid(nsAString& aStr, const bool aIsVoid);
 
 /**
  * NS_StringGetIsVoid
  *
  * This function provides a way to test if a string is a "void string", as
  * marked by NS_StringSetIsVoid.
  */
-XPCOM_API(bool)
-NS_StringGetIsVoid(const nsAString& aStr);
+XPCOM_API(bool) NS_StringGetIsVoid(const nsAString& aStr);
 
 /* ------------------------------------------------------------------------- */
 
 /**
  * nsCStringContainer
  *
  * This is an opaque data type that is large enough to hold the canonical
  * implementation of nsACString.  The binary structure of this class is an
@@ -415,17 +406,18 @@ NS_StringGetIsVoid(const nsAString& aStr
  *
  * @see nsStringContainer for use cases and further documentation.
  */
 class nsCStringContainer;
 
 /**
  * Flags that may be OR'd together to pass to NS_StringContainerInit2:
  */
-enum {
+enum
+{
   /* Data passed into NS_CStringContainerInit2 is not copied; instead, the
    * string references the passed in data pointer directly.  The caller must
    * ensure that the data is valid for the lifetime of the string container.
    * This flag should not be combined with NS_CSTRING_CONTAINER_INIT_ADOPT. */
   NS_CSTRING_CONTAINER_INIT_DEPEND    = (1 << 1),
 
   /* Data passed into NS_CStringContainerInit2 is not copied; instead, the
    * string takes ownership over the data pointer.  The caller must have
@@ -442,18 +434,17 @@ enum {
  * NS_CStringContainerInit
  *
  * @param aContainer    string container reference
  * @return              NS_OK if string container successfully initialized
  *
  * This function may allocate additional memory for aContainer.  When
  * aContainer is no longer needed, NS_CStringContainerFinish should be called.
  */
-XPCOM_API(nsresult)
-NS_CStringContainerInit(nsCStringContainer &aContainer);
+XPCOM_API(nsresult) NS_CStringContainerInit(nsCStringContainer& aContainer);
 
 /**
  * NS_CStringContainerInit2
  *
  * @param aContainer    string container reference
  * @param aData         character buffer (may be null)
  * @param aDataLength   number of characters stored at aData (may pass
  *                      UINT32_MAX if aData is null-terminated)
@@ -464,30 +455,29 @@ NS_CStringContainerInit(nsCStringContain
  *
  * This function resembles NS_CStringContainerInit but provides further
  * options that permit more efficient memory usage.  When aContainer is
  * no longer needed, NS_CStringContainerFinish should be called.
  *
  * NOTE: NS_CStringContainerInit2(container, nullptr, 0, 0) is equivalent to
  * NS_CStringContainerInit(container).
  */
-XPCOM_API(nsresult)
-NS_CStringContainerInit2
-  (nsCStringContainer &aContainer, const char *aData = nullptr,
-   uint32_t aDataLength = UINT32_MAX, uint32_t aFlags = 0);
+XPCOM_API(nsresult) NS_CStringContainerInit2(nsCStringContainer& aContainer,
+                                             const char* aData = nullptr,
+                                             uint32_t aDataLength = UINT32_MAX,
+                                             uint32_t aFlags = 0);
 
 /**
  * NS_CStringContainerFinish
  *
  * @param aContainer    string container reference
  *
  * This function frees any memory owned by aContainer.
  */
-XPCOM_API(void)
-NS_CStringContainerFinish(nsCStringContainer &aContainer);
+XPCOM_API(void) NS_CStringContainerFinish(nsCStringContainer& aContainer);
 
 /* ------------------------------------------------------------------------- */
 
 /**
  * NS_CStringGetData
  *
  * This function returns a const character pointer to the string's internal
  * buffer, the length of the string, and a boolean value indicating whether
@@ -496,20 +486,19 @@ NS_CStringContainerFinish(nsCStringConta
  * @param aStr          abstract string reference
  * @param aData         out param that will hold the address of aStr's
  *                      internal buffer
  * @param aTerminated   if non-null, this out param will be set to indicate
  *                      whether or not aStr's internal buffer is null-
  *                      terminated
  * @return              length of aStr's internal buffer
  */
-XPCOM_API(uint32_t)
-NS_CStringGetData
-  (const nsACString &aStr, const char **aData,
-   bool *aTerminated = nullptr);
+XPCOM_API(uint32_t) NS_CStringGetData(const nsACString& aStr,
+                                      const char** aData,
+                                      bool* aTerminated = nullptr);
 
 /**
  * NS_CStringGetMutableData
  *
  * This function provides mutable access to a string's internal buffer.  It
  * returns a pointer to an array of characters that may be modified.  The
  * returned pointer remains valid until the string object is passed to some
  * other string function.
@@ -528,33 +517,31 @@ NS_CStringGetData
  *                      internal buffer or null if the function failed
  * @return              number of characters or zero if the function failed
  *
  * This function does not necessarily null-terminate aStr after resizing its
  * internal buffer.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(uint32_t)
-NS_CStringGetMutableData
-  (nsACString &aStr, uint32_t aDataLength, char **aData);
+XPCOM_API(uint32_t) NS_CStringGetMutableData(nsACString& aStr,
+                                             uint32_t aDataLength,
+                                             char** aData);
 
 /**
  * NS_CStringCloneData
  *
  * This function returns a null-terminated copy of the string's
  * internal buffer.
  *
  * @param aStr          abstract string reference
  * @return              null-terminated copy of the string's internal buffer
  *                      (it must be free'd using using nsMemory::Free)
  */
-XPCOM_API(char *)
-NS_CStringCloneData
-  (const nsACString &aStr);
+XPCOM_API(char*) NS_CStringCloneData(const nsACString& aStr);
 
 /**
  * NS_CStringSetData
  *
  * This function copies aData into aStr.
  *
  * @param aStr          abstract string reference
  * @param aData         character buffer
@@ -563,20 +550,18 @@ NS_CStringCloneData
  *                      a null character)
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr after copying data
  * from aData.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_CStringSetData
-  (nsACString &aStr, const char *aData,
-   uint32_t aDataLength = UINT32_MAX);
+XPCOM_API(nsresult) NS_CStringSetData(nsACString& aStr, const char* aData,
+                                      uint32_t aDataLength = UINT32_MAX);
 
 /**
  * NS_CStringSetDataRange
  *
  * This function copies aData into a section of aStr.  As a result it can be
  * used to insert new characters into the string.
  *
  * @param aStr          abstract string reference
@@ -594,39 +579,39 @@ NS_CStringSetData
  *                      a null character)
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr after copying data
  * from aData.  The behavior depends on the implementation of the abstract
  * string, aStr.  If aStr is a reference to a nsStringContainer, then its data
  * will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_CStringSetDataRange
-  (nsACString &aStr, uint32_t aCutOffset, uint32_t aCutLength,
-   const char *aData, uint32_t aDataLength = UINT32_MAX);
+XPCOM_API(nsresult) NS_CStringSetDataRange(nsACString& aStr,
+                                           uint32_t aCutOffset,
+                                           uint32_t aCutLength,
+                                           const char* aData,
+                                           uint32_t aDataLength = UINT32_MAX);
 
 /**
  * NS_CStringCopy
  *
  * This function makes aDestStr have the same value as aSrcStr.  It is
  * provided as an optimization.
  *
  * @param aDestStr      abstract string reference to be modified
  * @param aSrcStr       abstract string reference containing source string
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aDestStr after copying
  * data from aSrcStr.  The behavior depends on the implementation of the
  * abstract string, aDestStr.  If aDestStr is a reference to a
  * nsStringContainer, then its data will be null-terminated by this function.
  */
-XPCOM_API(nsresult)
-NS_CStringCopy
-  (nsACString &aDestStr, const nsACString &aSrcStr);
+XPCOM_API(nsresult) NS_CStringCopy(nsACString& aDestStr,
+                                   const nsACString& aSrcStr);
 
 /**
  * NS_CStringAppendData
  *
  * This function appends data to the existing value of aStr.
  *
  * @param aStr          abstract string reference to be modified
  * @param aData         character buffer
@@ -635,17 +620,17 @@ NS_CStringCopy
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
-NS_CStringAppendData(nsACString &aStr, const char *aData,
+NS_CStringAppendData(nsACString& aStr, const char* aData,
                      uint32_t aDataLength = UINT32_MAX)
 {
   return NS_CStringSetDataRange(aStr, UINT32_MAX, 0, aData, aDataLength);
 }
 
 /**
  * NS_CStringInsertData
  *
@@ -660,17 +645,17 @@ NS_CStringAppendData(nsACString &aStr, c
  * @return              NS_OK if function succeeded
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
-NS_CStringInsertData(nsACString &aStr, uint32_t aOffset, const char *aData,
+NS_CStringInsertData(nsACString& aStr, uint32_t aOffset, const char* aData,
                      uint32_t aDataLength = UINT32_MAX)
 {
   return NS_CStringSetDataRange(aStr, aOffset, 0, aData, aDataLength);
 }
 
 /**
  * NS_CStringCutData
  *
@@ -678,45 +663,44 @@ NS_CStringInsertData(nsACString &aStr, u
  * at the specified offset.
  *
  * @param aStr          abstract string reference to be modified
  * @param aCutOffset    specifies where in the string to insert aData
  * @param aCutLength    number of characters to remove
  * @return              NS_OK if function succeeded
  */
 inline NS_HIDDEN_(nsresult)
-NS_CStringCutData(nsACString &aStr, uint32_t aCutOffset, uint32_t aCutLength)
+NS_CStringCutData(nsACString& aStr, uint32_t aCutOffset, uint32_t aCutLength)
 {
   return NS_CStringSetDataRange(aStr, aCutOffset, aCutLength, nullptr, 0);
 }
 
 /**
  * NS_CStringSetIsVoid
  *
  * This function marks a string as being a "void string".  Any data in the
  * string will be lost.
  */
-XPCOM_API(void)
-NS_CStringSetIsVoid(nsACString& aStr, const bool aIsVoid);
+XPCOM_API(void) NS_CStringSetIsVoid(nsACString& aStr, const bool aIsVoid);
 
 /**
  * NS_CStringGetIsVoid
  *
  * This function provides a way to test if a string is a "void string", as
  * marked by NS_CStringSetIsVoid.
  */
-XPCOM_API(bool)
-NS_CStringGetIsVoid(const nsACString& aStr);
+XPCOM_API(bool) NS_CStringGetIsVoid(const nsACString& aStr);
 
 /* ------------------------------------------------------------------------- */
 
 /**
  * Encodings that can be used with the following conversion routines.
  */
-enum nsCStringEncoding {
+enum nsCStringEncoding
+{
   /* Conversion between ASCII and UTF-16 assumes that all bytes in the source
    * string are 7-bit ASCII and can be inflated to UTF-16 by inserting null
    * bytes.  Reverse conversion is done by truncating every other byte.  The
    * conversion may result in loss and/or corruption of information if the
    * strings do not strictly contain ASCII data. */
   NS_CSTRING_ENCODING_ASCII = 0,
 
   /* Conversion between UTF-8 and UTF-16 is non-lossy. */
@@ -735,30 +719,30 @@ enum nsCStringEncoding {
  * This function converts the characters in a nsACString to an array of UTF-16
  * characters, in the platform endianness.  The result is stored in a nsAString
  * object.
  *
  * @param aSource       abstract string reference containing source string
  * @param aSrcEncoding  character encoding of the source string
  * @param aDest         abstract string reference to hold the result
  */
-XPCOM_API(nsresult)
-NS_CStringToUTF16(const nsACString &aSource, nsCStringEncoding aSrcEncoding,
-                  nsAString &aDest);
+XPCOM_API(nsresult) NS_CStringToUTF16(const nsACString& aSource,
+                                      nsCStringEncoding aSrcEncoding,
+                                      nsAString& aDest);
 
 /**
  * NS_UTF16ToCString
  *
  * This function converts the UTF-16 characters in a nsAString to a single-byte
  * encoding.  The result is stored in a nsACString object.  In some cases this
  * conversion may be lossy.  In such cases, the conversion may succeed with a
  * return code indicating loss of information.  The exact behavior is not
  * specified at this time.
  *
  * @param aSource       abstract string reference containing source string
  * @param aDestEncoding character encoding of the resulting string
  * @param aDest         abstract string reference to hold the result
  */
-XPCOM_API(nsresult)
-NS_UTF16ToCString(const nsAString &aSource, nsCStringEncoding aDestEncoding,
-                  nsACString &aDest);
+XPCOM_API(nsresult) NS_UTF16ToCString(const nsAString& aSource,
+                                      nsCStringEncoding aDestEncoding,
+                                      nsACString& aDest);
 
 #endif // nsXPCOMStrings_h__
--- a/xpcom/string/src/nsReadableUtils.cpp
+++ b/xpcom/string/src/nsReadableUtils.cpp
@@ -7,77 +7,77 @@
 #include "nsReadableUtils.h"
 
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsUTF8Utils.h"
 
 void
-LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest )
+LossyCopyUTF16toASCII(const nsAString& aSource, nsACString& aDest)
 {
   aDest.Truncate();
   LossyAppendUTF16toASCII(aSource, aDest);
 }
 
 void
-CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest )
+CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest)
 {
   aDest.Truncate();
   AppendASCIItoUTF16(aSource, aDest);
 }
 
 void
-LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest )
+LossyCopyUTF16toASCII(const char16_t* aSource, nsACString& aDest)
 {
   aDest.Truncate();
   if (aSource) {
     LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
   }
 }
 
 void
-CopyASCIItoUTF16( const char* aSource, nsAString& aDest )
+CopyASCIItoUTF16(const char* aSource, nsAString& aDest)
 {
   aDest.Truncate();
   if (aSource) {
     AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
   }
 }
 
 void
-CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
+CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest)
 {
   aDest.Truncate();
   AppendUTF16toUTF8(aSource, aDest);
 }
 
 void
-CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
+CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest)
 {
   aDest.Truncate();
   AppendUTF8toUTF16(aSource, aDest);
 }
 
 void
-CopyUTF16toUTF8( const char16_t* aSource, nsACString& aDest )
+CopyUTF16toUTF8(const char16_t* aSource, nsACString& aDest)
 {
   aDest.Truncate();
   AppendUTF16toUTF8(aSource, aDest);
 }
 
 void
-CopyUTF8toUTF16( const char* aSource, nsAString& aDest )
+CopyUTF8toUTF16(const char* aSource, nsAString& aDest)
 {
   aDest.Truncate();
   AppendUTF8toUTF16(aSource, aDest);
 }
 
 void
-LossyAppendUTF16toASCII( const nsAString& aSource, nsACString& aDest )
+LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest)
 {
   uint32_t old_dest_length = aDest.Length();
   aDest.SetLength(old_dest_length + aSource.Length());
 
   nsAString::const_iterator fromBegin, fromEnd;
 
   nsACString::iterator dest;
   aDest.BeginWriting(dest);
@@ -86,26 +86,26 @@ LossyAppendUTF16toASCII( const nsAString
 
   // right now, this won't work on multi-fragment destinations
   LossyConvertEncoding16to8 converter(dest.get());
 
   copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
 }
 
 void
-AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest )
+AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest)
 {
   if (!AppendASCIItoUTF16(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
-AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest,
-                    const mozilla::fallible_t& )
+AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest,
+                   const mozilla::fallible_t&)
 {
   uint32_t old_dest_length = aDest.Length();
   if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) {
     return false;
   }
 
   nsACString::const_iterator fromBegin, fromEnd;
 
@@ -117,52 +117,51 @@ AppendASCIItoUTF16( const nsACString& aS
   // right now, this won't work on multi-fragment destinations
   LossyConvertEncoding8to16 converter(dest.get());
 
   copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
   return true;
 }
 
 void
-LossyAppendUTF16toASCII( const char16_t* aSource, nsACString& aDest )
+LossyAppendUTF16toASCII(const char16_t* aSource, nsACString& aDest)
 {
   if (aSource) {
     LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
   }
 }
 
 void
-AppendASCIItoUTF16( const char* aSource, nsAString& aDest )
+AppendASCIItoUTF16(const char* aSource, nsAString& aDest)
 {
   if (aSource) {
     AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
   }
 }
 
 void
-AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
+AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest)
 {
   if (!AppendUTF16toUTF8(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
-AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest,
-                   const mozilla::fallible_t& )
+AppendUTF16toUTF8(const nsAString& aSource, nsACString& aDest,
+                  const mozilla::fallible_t&)
 {
   nsAString::const_iterator source_start, source_end;
   CalculateUTF8Size calculator;
   copy_string(aSource.BeginReading(source_start),
               aSource.EndReading(source_end), calculator);
 
   uint32_t count = calculator.Size();
 
-  if (count)
-  {
+  if (count) {
     uint32_t old_dest_length = aDest.Length();
 
     // Grow the buffer if we need to.
     if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
       return false;
     }
 
     // All ready? Time to convert
@@ -175,37 +174,36 @@ AppendUTF16toUTF8( const nsAString& aSou
                  "Unexpected disparity between CalculateUTF8Size and "
                  "ConvertUTF16toUTF8");
   }
 
   return true;
 }
 
 void
-AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
+AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest)
 {
   if (!AppendUTF8toUTF16(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
-AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest,
-                   const mozilla::fallible_t& )
+AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest,
+                  const mozilla::fallible_t&)
 {
   nsACString::const_iterator source_start, source_end;
   CalculateUTF8Length calculator;
   copy_string(aSource.BeginReading(source_start),
               aSource.EndReading(source_end), calculator);
 
   uint32_t count = calculator.Length();
 
   // Avoid making the string mutable if we're appending an empty string
-  if (count)
-  {
+  if (count) {
     uint32_t old_dest_length = aDest.Length();
 
     // Grow the buffer if we need to.
     if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
       return false;
     }
 
     // All ready? Time to convert
@@ -213,36 +211,35 @@ AppendUTF8toUTF16( const nsACString& aSo
     ConvertUTF8toUTF16 converter(aDest.BeginWriting() + old_dest_length);
     copy_string(aSource.BeginReading(source_start),
                 aSource.EndReading(source_end), converter);
 
     NS_ASSERTION(converter.ErrorEncountered() ||
                  converter.Length() == count,
                  "CalculateUTF8Length produced the wrong length");
 
-    if (converter.ErrorEncountered())
-    {
+    if (converter.ErrorEncountered()) {
       NS_ERROR("Input wasn't UTF8 or incorrect length was calculated");
       aDest.SetLength(old_dest_length);
     }
   }
 
   return true;
 }
 
 void
-AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest )
+AppendUTF16toUTF8(const char16_t* aSource, nsACString& aDest)
 {
   if (aSource) {
     AppendUTF16toUTF8(nsDependentString(aSource), aDest);
   }
 }
 
 void
-AppendUTF8toUTF16( const char* aSource, nsAString& aDest )
+AppendUTF8toUTF16(const char* aSource, nsAString& aDest)
 {
   if (aSource) {
     AppendUTF8toUTF16(nsDependentCString(aSource), aDest);
   }
 }
 
 
 /**
@@ -250,392 +247,401 @@ AppendUTF8toUTF16( const char* aSource, 
  *
  * @param aSource an string you will eventually be making a copy of
  * @return a new buffer (of the type specified by the second parameter) which you must free with |nsMemory::Free|.
  *
  */
 template <class FromStringT, class ToCharT>
 inline
 ToCharT*
-AllocateStringCopy( const FromStringT& aSource, ToCharT* )
+AllocateStringCopy(const FromStringT& aSource, ToCharT*)
 {
-  return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length()+1) * sizeof(ToCharT)));
+  return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length() + 1) * sizeof(ToCharT)));
 }
 
 
 char*
-ToNewCString( const nsAString& aSource )
+ToNewCString(const nsAString& aSource)
 {
   char* result = AllocateStringCopy(aSource, (char*)0);
-  if (!result)
+  if (!result) {
     return nullptr;
+  }
 
   nsAString::const_iterator fromBegin, fromEnd;
   LossyConvertEncoding16to8 converter(result);
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter).write_terminator();
   return result;
 }
 
 char*
-ToNewUTF8String( const nsAString& aSource, uint32_t *aUTF8Count )
+ToNewUTF8String(const nsAString& aSource, uint32_t* aUTF8Count)
 {
   nsAString::const_iterator start, end;
   CalculateUTF8Size calculator;
   copy_string(aSource.BeginReading(start), aSource.EndReading(end),
               calculator);
 
-  if (aUTF8Count)
+  if (aUTF8Count) {
     *aUTF8Count = calculator.Size();
+  }
 
-  char *result = static_cast<char*>
+  char* result = static_cast<char*>
                  (nsMemory::Alloc(calculator.Size() + 1));
-  if (!result)
+  if (!result) {
     return nullptr;
+  }
 
   ConvertUTF16toUTF8 converter(result);
   copy_string(aSource.BeginReading(start), aSource.EndReading(end),
               converter).write_terminator();
   NS_ASSERTION(calculator.Size() == converter.Size(), "length mismatch");
 
   return result;
 }
 
 char*
-ToNewCString( const nsACString& aSource )
+ToNewCString(const nsACString& aSource)
 {
   // no conversion needed, just allocate a buffer of the correct length and copy into it
 
   char* result = AllocateStringCopy(aSource, (char*)0);
-  if (!result)
+  if (!result) {
     return nullptr;
+  }
 
   nsACString::const_iterator fromBegin, fromEnd;
   char* toBegin = result;
   *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0);
   return result;
 }
 
 char16_t*
-ToNewUnicode( const nsAString& aSource )
+ToNewUnicode(const nsAString& aSource)
 {
   // no conversion needed, just allocate a buffer of the correct length and copy into it
 
   char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
-  if (!result)
+  if (!result) {
     return nullptr;
+  }
 
   nsAString::const_iterator fromBegin, fromEnd;
   char16_t* toBegin = result;
   *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0);
   return result;
 }
 
 char16_t*
-ToNewUnicode( const nsACString& aSource )
+ToNewUnicode(const nsACString& aSource)
 {
   char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
-  if (!result)
+  if (!result) {
     return nullptr;
+  }
 
   nsACString::const_iterator fromBegin, fromEnd;
   LossyConvertEncoding8to16 converter(result);
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter).write_terminator();
   return result;
 }
 
 uint32_t
-CalcUTF8ToUnicodeLength( const nsACString& aSource)
+CalcUTF8ToUnicodeLength(const nsACString& aSource)
 {
   nsACString::const_iterator start, end;
   CalculateUTF8Length calculator;
   copy_string(aSource.BeginReading(start), aSource.EndReading(end),
               calculator);
   return calculator.Length();
 }
 
 char16_t*
-UTF8ToUnicodeBuffer( const nsACString& aSource, char16_t* aBuffer, uint32_t *aUTF16Count )
+UTF8ToUnicodeBuffer(const nsACString& aSource, char16_t* aBuffer,
+                    uint32_t* aUTF16Count)
 {
   nsACString::const_iterator start, end;
   ConvertUTF8toUTF16 converter(aBuffer);
   copy_string(aSource.BeginReading(start),
               aSource.EndReading(end),
               converter).write_terminator();
-  if (aUTF16Count)
+  if (aUTF16Count) {
     *aUTF16Count = converter.Length();
+  }
   return aBuffer;
 }
 
 char16_t*
-UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count )
+UTF8ToNewUnicode(const nsACString& aSource, uint32_t* aUTF16Count)
 {
   const uint32_t length = CalcUTF8ToUnicodeLength(aSource);
   const size_t buffer_size = (length + 1) * sizeof(char16_t);
-  char16_t *buffer = static_cast<char16_t*>(nsMemory::Alloc(buffer_size));
-  if (!buffer)
+  char16_t* buffer = static_cast<char16_t*>(nsMemory::Alloc(buffer_size));
+  if (!buffer) {
     return nullptr;
+  }
 
   uint32_t copied;
   UTF8ToUnicodeBuffer(aSource, buffer, &copied);
   NS_ASSERTION(length == copied, "length mismatch");
 
-  if (aUTF16Count)
+  if (aUTF16Count) {
     *aUTF16Count = copied;
+  }
   return buffer;
 }
 
 char16_t*
-CopyUnicodeTo( const nsAString& aSource, uint32_t aSrcOffset, char16_t* aDest, uint32_t aLength )
+CopyUnicodeTo(const nsAString& aSource, uint32_t aSrcOffset, char16_t* aDest,
+              uint32_t aLength)
 {
   nsAString::const_iterator fromBegin, fromEnd;
   char16_t* toBegin = aDest;
-  copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ), toBegin);
+  copy_string(aSource.BeginReading(fromBegin).advance(int32_t(aSrcOffset)),
+              aSource.BeginReading(fromEnd).advance(int32_t(aSrcOffset + aLength)),
+              toBegin);
   return aDest;
 }
 
 void
-CopyUnicodeTo( const nsAString::const_iterator& aSrcStart,
-               const nsAString::const_iterator& aSrcEnd,
-               nsAString& aDest )
+CopyUnicodeTo(const nsAString::const_iterator& aSrcStart,
+              const nsAString::const_iterator& aSrcEnd,
+              nsAString& aDest)
 {
   nsAString::iterator writer;
   aDest.SetLength(Distance(aSrcStart, aSrcEnd));
 
   aDest.BeginWriting(writer);
   nsAString::const_iterator fromBegin(aSrcStart);
 
   copy_string(fromBegin, aSrcEnd, writer);
 }
 
 void
-AppendUnicodeTo( const nsAString::const_iterator& aSrcStart,
-                 const nsAString::const_iterator& aSrcEnd,
-                 nsAString& aDest )
+AppendUnicodeTo(const nsAString::const_iterator& aSrcStart,
+                const nsAString::const_iterator& aSrcEnd,
+                nsAString& aDest)
 {
   nsAString::iterator writer;
   uint32_t oldLength = aDest.Length();
   aDest.SetLength(oldLength + Distance(aSrcStart, aSrcEnd));
 
   aDest.BeginWriting(writer).advance(oldLength);
   nsAString::const_iterator fromBegin(aSrcStart);
 
   copy_string(fromBegin, aSrcEnd, writer);
 }
 
 bool
-IsASCII( const nsAString& aString )
+IsASCII(const nsAString& aString)
 {
   static const char16_t NOT_ASCII = char16_t(~0x007F);
 
 
   // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
 
   nsAString::const_iterator iter, done_reading;
   aString.BeginReading(iter);
   aString.EndReading(done_reading);
 
   const char16_t* c = iter.get();
   const char16_t* end = done_reading.get();
 
-  while ( c < end )
-  {
-    if ( *c++ & NOT_ASCII )
+  while (c < end) {
+    if (*c++ & NOT_ASCII) {
       return false;
+    }
   }
 
   return true;
 }
 
 bool
-IsASCII( const nsACString& aString )
+IsASCII(const nsACString& aString)
 {
   static const char NOT_ASCII = char(~0x7F);
 
 
   // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
 
   nsACString::const_iterator iter, done_reading;
   aString.BeginReading(iter);
   aString.EndReading(done_reading);
 
   const char* c = iter.get();
   const char* end = done_reading.get();
 
-  while ( c < end )
-  {
-    if ( *c++ & NOT_ASCII )
+  while (c < end) {
+    if (*c++ & NOT_ASCII) {
       return false;
+    }
   }
 
   return true;
 }
 
 bool
-IsUTF8( const nsACString& aString, bool aRejectNonChar )
+IsUTF8(const nsACString& aString, bool aRejectNonChar)
 {
   nsReadingIterator<char> done_reading;
   aString.EndReading(done_reading);
 
   int32_t state = 0;
   bool overlong = false;
   bool surrogate = false;
   bool nonchar = false;
   uint16_t olupper = 0; // overlong byte upper bound.
   uint16_t slower = 0;  // surrogate byte lower bound.
 
   nsReadingIterator<char> iter;
   aString.BeginReading(iter);
 
   const char* ptr = iter.get();
   const char* end = done_reading.get();
-  while ( ptr < end )
-  {
+  while (ptr < end) {
     uint8_t c;
 
-    if (0 == state)
-    {
+    if (0 == state) {
       c = *ptr++;
 
-      if ( UTF8traits::isASCII(c) )
+      if (UTF8traits::isASCII(c)) {
         continue;
+      }
 
-      if ( c <= 0xC1 ) // [80-BF] where not expected, [C0-C1] for overlong.
+      if (c <= 0xC1) { // [80-BF] where not expected, [C0-C1] for overlong.
         return false;
-      else if ( UTF8traits::is2byte(c) )
+      } else if (UTF8traits::is2byte(c)) {
         state = 1;
-      else if ( UTF8traits::is3byte(c) )
-      {
+      } else if (UTF8traits::is3byte(c)) {
         state = 2;
-        if ( c == 0xE0 ) // to exclude E0[80-9F][80-BF]
-        {
+        if (c == 0xE0) { // to exclude E0[80-9F][80-BF]
           overlong = true;
           olupper = 0x9F;
-        }
-        else if ( c == 0xED ) // ED[A0-BF][80-BF] : surrogate codepoint
-        {
+        } else if (c == 0xED) { // ED[A0-BF][80-BF] : surrogate codepoint
           surrogate = true;
           slower = 0xA0;
-        }
-        else if ( c == 0xEF ) // EF BF [BE-BF] : non-character
+        } else if (c == 0xEF) { // EF BF [BE-BF] : non-character
           nonchar = true;
-      }
-      else if ( c <= 0xF4 ) // XXX replace /w UTF8traits::is4byte when it's updated to exclude [F5-F7].(bug 199090)
-      {
+        }
+      } else if (c <= 0xF4) { // XXX replace /w UTF8traits::is4byte when it's updated to exclude [F5-F7].(bug 199090)
         state = 3;
         nonchar = true;
-        if ( c == 0xF0 ) // to exclude F0[80-8F][80-BF]{2}
-        {
+        if (c == 0xF0) { // to exclude F0[80-8F][80-BF]{2}
           overlong = true;
           olupper = 0x8F;
-        }
-        else if ( c == 0xF4 ) // to exclude F4[90-BF][80-BF]
-        {
+        } else if (c == 0xF4) { // to exclude F4[90-BF][80-BF]
           // actually not surrogates but codepoints beyond 0x10FFFF
           surrogate = true;
           slower = 0x90;
         }
+      } else {
+        return false;  // Not UTF-8 string
       }
-      else
-        return false; // Not UTF-8 string
     }
 
-    if (nonchar && !aRejectNonChar)
+    if (nonchar && !aRejectNonChar) {
       nonchar = false;
+    }
 
-    while ( ptr < end && state )
-    {
+    while (ptr < end && state) {
       c = *ptr++;
       --state;
 
       // non-character : EF BF [BE-BF] or F[0-7] [89AB]F BF [BE-BF]
-      if ( nonchar &&
-           ( ( !state && c < 0xBE ) ||
-             ( state == 1 && c != 0xBF )  ||
-             ( state == 2 && 0x0F != (0x0F & c) )))
+      if (nonchar &&
+          ((!state && c < 0xBE) ||
+           (state == 1 && c != 0xBF)  ||
+           (state == 2 && 0x0F != (0x0F & c)))) {
         nonchar = false;
+      }
 
-      if ( !UTF8traits::isInSeq(c) || ( overlong && c <= olupper ) ||
-           ( surrogate && slower <= c ) || ( nonchar && !state ))
-        return false; // Not UTF-8 string
+      if (!UTF8traits::isInSeq(c) || (overlong && c <= olupper) ||
+          (surrogate && slower <= c) || (nonchar && !state)) {
+        return false;  // Not UTF-8 string
+      }
 
       overlong = surrogate = false;
     }
   }
   return !state; // state != 0 at the end indicates an invalid UTF-8 seq.
 }
 
 /**
  * A character sink for in-place case conversion.
  */
 class ConvertToUpperCase
 {
 public:
   typedef char value_type;
 
   uint32_t
-  write( const char* aSource, uint32_t aSourceLength )
+  write(const char* aSource, uint32_t aSourceLength)
   {
     char* cp = const_cast<char*>(aSource);
     const char* end = aSource + aSourceLength;
     while (cp != end) {
       char ch = *cp;
-      if ((ch >= 'a') && (ch <= 'z'))
+      if (ch >= 'a' && ch <= 'z') {
         *cp = ch - ('a' - 'A');
+      }
       ++cp;
     }
     return aSourceLength;
   }
 };
 
 void
-ToUpperCase( nsCSubstring& aCString )
+ToUpperCase(nsCSubstring& aCString)
 {
   ConvertToUpperCase converter;
   char* start;
   converter.write(aCString.BeginWriting(start), aCString.Length());
 }
 
 /**
  * A character sink for copying with case conversion.
  */
 class CopyToUpperCase
 {
 public:
   typedef char value_type;
 
-  explicit CopyToUpperCase( nsACString::iterator& aDestIter )
+  explicit CopyToUpperCase(nsACString::iterator& aDestIter)
     : mIter(aDestIter)
   {
   }
 
   uint32_t
-  write( const char* aSource, uint32_t aSourceLength )
+  write(const char* aSource, uint32_t aSourceLength)
   {
     uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
     char* cp = mIter.get();
     const char* end = aSource + len;
     while (aSource != end) {
       char ch = *aSource;
-      if ((ch >= 'a') && (ch <= 'z'))
+      if ((ch >= 'a') && (ch <= 'z')) {
         *cp = ch - ('a' - 'A');
-      else
+      } else {
         *cp = ch;
+      }
       ++aSource;
       ++cp;
     }
     mIter.advance(len);
     return len;
   }
 
 protected:
   nsACString::iterator& mIter;
 };
 
 void
-ToUpperCase( const nsACString& aSource, nsACString& aDest )
+ToUpperCase(const nsACString& aSource, nsACString& aDest)
 {
   nsACString::const_iterator fromBegin, fromEnd;
   nsACString::iterator toBegin;
   aDest.SetLength(aSource.Length());
 
   CopyToUpperCase converter(aDest.BeginWriting(toBegin));
   copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
 }
@@ -644,76 +650,78 @@ ToUpperCase( const nsACString& aSource, 
  * A character sink for case conversion.
  */
 class ConvertToLowerCase
 {
 public:
   typedef char value_type;
 
   uint32_t
-  write( const char* aSource, uint32_t aSourceLength )
+  write(const char* aSource, uint32_t aSourceLength)
   {
     char* cp = const_cast<char*>(aSource);
     const char* end = aSource + aSourceLength;
     while (cp != end) {
       char ch = *cp;
-      if ((ch >= 'A') && (ch <= 'Z'))
+      if ((ch >= 'A') && (ch <= 'Z')) {
         *cp = ch + ('a' - 'A');
+      }
       ++cp;
     }
     return aSourceLength;
   }
 };
 
 void
-ToLowerCase( nsCSubstring& aCString )
+ToLowerCase(nsCSubstring& aCString)
 {
   ConvertToLowerCase converter;
   char* start;
   converter.write(aCString.BeginWriting(start), aCString.Length());
 }
 
 /**
  * A character sink for copying with case conversion.
  */
 class CopyToLowerCase
 {
 public:
   typedef char value_type;
 
-  explicit CopyToLowerCase( nsACString::iterator& aDestIter )
+  explicit CopyToLowerCase(nsACString::iterator& aDestIter)
     : mIter(aDestIter)
   {
   }
 
   uint32_t
-  write( const char* aSource, uint32_t aSourceLength )
+  write(const char* aSource, uint32_t aSourceLength)
   {
     uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
     char* cp = mIter.get();
     const char* end = aSource + len;
     while (aSource != end) {
       char ch = *aSource;
-      if ((ch >= 'A') && (ch <= 'Z'))
+      if ((ch >= 'A') && (ch <= 'Z')) {
         *cp = ch + ('a' - 'A');
-      else
+      } else {
         *cp = ch;
+      }
       ++aSource;
       ++cp;
     }
     mIter.advance(len);
     return len;
   }
 
 protected:
   nsACString::iterator& mIter;
 };
 
 void
-ToLowerCase( const nsACString& aSource, nsACString& aDest )
+ToLowerCase(const nsACString& aSource, nsACString& aDest)
 {
   nsACString::const_iterator fromBegin, fromEnd;
   nsACString::iterator toBegin;
   aDest.SetLength(aSource.Length());
 
   CopyToLowerCase converter(aDest.BeginWriting(toBegin));
   copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
 }
@@ -723,227 +731,236 @@ ParseString(const nsACString& aSource, c
             nsTArray<nsCString>& aArray)
 {
   nsACString::const_iterator start, end;
   aSource.BeginReading(start);
   aSource.EndReading(end);
 
   uint32_t oldLength = aArray.Length();
 
-  for (;;)
-  {
+  for (;;) {
     nsACString::const_iterator delimiter = start;
     FindCharInReadable(aDelimiter, delimiter, end);
 
-    if (delimiter != start)
-    {
-      if (!aArray.AppendElement(Substring(start, delimiter)))
-      {
+    if (delimiter != start) {
+      if (!aArray.AppendElement(Substring(start, delimiter))) {
         aArray.RemoveElementsAt(oldLength, aArray.Length() - oldLength);
         return false;
       }
     }
 
-    if (delimiter == end)
+    if (delimiter == end) {
       break;
+    }
     start = ++delimiter;
-    if (start == end)
+    if (start == end) {
       break;
+    }
   }
 
   return true;
 }
 
 template <class StringT, class IteratorT, class Comparator>
 bool
-FindInReadable_Impl( const StringT& aPattern, IteratorT& aSearchStart, IteratorT& aSearchEnd, const Comparator& compare )
+FindInReadable_Impl(const StringT& aPattern, IteratorT& aSearchStart,
+                    IteratorT& aSearchEnd, const Comparator& aCompare)
 {
   bool found_it = false;
 
   // only bother searching at all if we're given a non-empty range to search
-  if ( aSearchStart != aSearchEnd )
-  {
+  if (aSearchStart != aSearchEnd) {
     IteratorT aPatternStart, aPatternEnd;
     aPattern.BeginReading(aPatternStart);
     aPattern.EndReading(aPatternEnd);
 
     // outer loop keeps searching till we find it or run out of string to search
-    while ( !found_it )
-    {
+    while (!found_it) {
       // fast inner loop (that's what it's called, not what it is) looks for a potential match
-      while ( aSearchStart != aSearchEnd &&
-              compare(aPatternStart.get(), aSearchStart.get(), 1, 1) )
+      while (aSearchStart != aSearchEnd &&
+             aCompare(aPatternStart.get(), aSearchStart.get(), 1, 1)) {
         ++aSearchStart;
+      }
 
       // if we broke out of the `fast' loop because we're out of string ... we're done: no match
-      if ( aSearchStart == aSearchEnd )
+      if (aSearchStart == aSearchEnd) {
         break;
+      }
 
       // otherwise, we're at a potential match, let's see if we really hit one
       IteratorT testPattern(aPatternStart);
       IteratorT testSearch(aSearchStart);
 
       // slow inner loop verifies the potential match (found by the `fast' loop) at the current position
-      for(;;)
-      {
+      for (;;) {
         // we already compared the first character in the outer loop,
         //  so we'll advance before the next comparison
         ++testPattern;
         ++testSearch;
 
         // if we verified all the way to the end of the pattern, then we found it!
-        if ( testPattern == aPatternEnd )
-        {
+        if (testPattern == aPatternEnd) {
           found_it = true;
           aSearchEnd = testSearch; // return the exact found range through the parameters
           break;
         }
 
         // if we got to end of the string we're searching before we hit the end of the
         //  pattern, we'll never find what we're looking for
-        if ( testSearch == aSearchEnd )
-        {
+        if (testSearch == aSearchEnd) {
           aSearchStart = aSearchEnd;
           break;
         }
 
         // else if we mismatched ... it's time to advance to the next search position
         //  and get back into the `fast' loop
-        if ( compare(testPattern.get(), testSearch.get(), 1, 1) )
-        {
+        if (aCompare(testPattern.get(), testSearch.get(), 1, 1)) {
           ++aSearchStart;
           break;
         }
       }
     }
   }
 
   return found_it;
 }
 
 /**
  * This searches the entire string from right to left, and returns the first match found, if any.
  */
 template <class StringT, class IteratorT, class Comparator>
 bool
-RFindInReadable_Impl( const StringT& aPattern, IteratorT& aSearchStart, IteratorT& aSearchEnd, const Comparator& compare )
+RFindInReadable_Impl(const StringT& aPattern, IteratorT& aSearchStart,
+                     IteratorT& aSearchEnd, const Comparator& aCompare)
 {
   IteratorT patternStart, patternEnd, searchEnd = aSearchEnd;
   aPattern.BeginReading(patternStart);
   aPattern.EndReading(patternEnd);
 
   // Point to the last character in the pattern
   --patternEnd;
   // outer loop keeps searching till we run out of string to search
-  while ( aSearchStart != searchEnd )
-  {
+  while (aSearchStart != searchEnd) {
     // Point to the end position of the next possible match
     --searchEnd;
 
     // Check last character, if a match, explore further from here
-    if ( compare(patternEnd.get(), searchEnd.get(), 1, 1) == 0 )
-    {
+    if (aCompare(patternEnd.get(), searchEnd.get(), 1, 1) == 0) {
       // We're at a potential match, let's see if we really hit one
       IteratorT testPattern(patternEnd);
       IteratorT testSearch(searchEnd);
 
       // inner loop verifies the potential match at the current position
-      do
-      {
+      do {
         // if we verified all the way to the end of the pattern, then we found it!
-        if ( testPattern == patternStart )
-        {
+        if (testPattern == patternStart) {
           aSearchStart = testSearch;  // point to start of match
           aSearchEnd = ++searchEnd;   // point to end of match
           return true;
         }
 
         // if we got to end of the string we're searching before we hit the end of the
         //  pattern, we'll never find what we're looking for
-        if ( testSearch == aSearchStart )
-        {
+        if (testSearch == aSearchStart) {
           aSearchStart = aSearchEnd;
           return false;
         }
 
         // test previous character for a match
         --testPattern;
         --testSearch;
-      }
-      while ( compare(testPattern.get(), testSearch.get(), 1, 1) == 0 );
+      } while (aCompare(testPattern.get(), testSearch.get(), 1, 1) == 0);
     }
   }
 
   aSearchStart = aSearchEnd;
   return false;
 }
 
 bool
-FindInReadable( const nsAString& aPattern, nsAString::const_iterator& aSearchStart, nsAString::const_iterator& aSearchEnd, const nsStringComparator& aComparator )
+FindInReadable(const nsAString& aPattern,
+               nsAString::const_iterator& aSearchStart,
+               nsAString::const_iterator& aSearchEnd,
+               const nsStringComparator& aComparator)
 {
   return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
 }
 
 bool
-FindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd, const nsCStringComparator& aComparator)
+FindInReadable(const nsACString& aPattern,
+               nsACString::const_iterator& aSearchStart,
+               nsACString::const_iterator& aSearchEnd,
+               const nsCStringComparator& aComparator)
 {
   return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
 }
 
 bool
-CaseInsensitiveFindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd )
+CaseInsensitiveFindInReadable(const nsACString& aPattern,
+                              nsACString::const_iterator& aSearchStart,
+                              nsACString::const_iterator& aSearchEnd)
 {
-  return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, nsCaseInsensitiveCStringComparator());
+  return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd,
+                             nsCaseInsensitiveCStringComparator());
 }
 
 bool
-RFindInReadable( const nsAString& aPattern, nsAString::const_iterator& aSearchStart, nsAString::const_iterator& aSearchEnd, const nsStringComparator& aComparator)
+RFindInReadable(const nsAString& aPattern,
+                nsAString::const_iterator& aSearchStart,
+                nsAString::const_iterator& aSearchEnd,
+                const nsStringComparator& aComparator)
 {
   return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
 }
 
 bool
-RFindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd, const nsCStringComparator& aComparator)
+RFindInReadable(const nsACString& aPattern,
+                nsACString::const_iterator& aSearchStart,
+                nsACString::const_iterator& aSearchEnd,
+                const nsCStringComparator& aComparator)
 {
   return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
 }
 
 bool
-FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd )
+FindCharInReadable(char16_t aChar, nsAString::const_iterator& aSearchStart,
+                   const nsAString::const_iterator& aSearchEnd)
 {
   int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
 
-  const char16_t* charFoundAt = nsCharTraits<char16_t>::find(aSearchStart.get(), fragmentLength, aChar);
-  if ( charFoundAt ) {
-    aSearchStart.advance( charFoundAt - aSearchStart.get() );
+  const char16_t* charFoundAt =
+    nsCharTraits<char16_t>::find(aSearchStart.get(), fragmentLength, aChar);
+  if (charFoundAt) {
+    aSearchStart.advance(charFoundAt - aSearchStart.get());
     return true;
   }
 
   aSearchStart.advance(fragmentLength);
   return false;
 }
 
 bool
-FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const nsACString::const_iterator& aSearchEnd )
+FindCharInReadable(char aChar, nsACString::const_iterator& aSearchStart,
+                   const nsACString::const_iterator& aSearchEnd)
 {
   int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
 
-  const char* charFoundAt = nsCharTraits<char>::find(aSearchStart.get(), fragmentLength, aChar);
-  if ( charFoundAt ) {
-    aSearchStart.advance( charFoundAt - aSearchStart.get() );
+  const char* charFoundAt =
+    nsCharTraits<char>::find(aSearchStart.get(), fragmentLength, aChar);
+  if (charFoundAt) {
+    aSearchStart.advance(charFoundAt - aSearchStart.get());
     return true;
   }
 
   aSearchStart.advance(fragmentLength);
   return false;
 }
 
 uint32_t
-CountCharInReadable( const nsAString& aStr,
-                     char16_t aChar )
+CountCharInReadable(const nsAString& aStr, char16_t aChar)
 {
   uint32_t count = 0;
   nsAString::const_iterator begin, end;
 
   aStr.BeginReading(begin);
   aStr.EndReading(end);
 
   while (begin != end) {
@@ -952,18 +969,17 @@ CountCharInReadable( const nsAString& aS
     }
     ++begin;
   }
 
   return count;
 }
 
 uint32_t
-CountCharInReadable( const nsACString& aStr,
-                     char aChar )
+CountCharInReadable(const nsACString& aStr, char aChar)
 {
   uint32_t count = 0;
   nsACString::const_iterator begin, end;
 
   aStr.BeginReading(begin);
   aStr.EndReading(end);
 
   while (begin != end) {
@@ -972,57 +988,61 @@ CountCharInReadable( const nsACString& a
     }
     ++begin;
   }
 
   return count;
 }
 
 bool
-StringBeginsWith( const nsAString& aSource, const nsAString& aSubstring,
-                  const nsStringComparator& aComparator )
+StringBeginsWith(const nsAString& aSource, const nsAString& aSubstring,
+                 const nsStringComparator& aComparator)
 {
   nsAString::size_type src_len = aSource.Length(),
                        sub_len = aSubstring.Length();
-  if (sub_len > src_len)
+  if (sub_len > src_len) {
     return false;
+  }
   return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
 }
 
 bool
-StringBeginsWith( const nsACString& aSource, const nsACString& aSubstring,
-                  const nsCStringComparator& aComparator )
+StringBeginsWith(const nsACString& aSource, const nsACString& aSubstring,
+                 const nsCStringComparator& aComparator)
 {
   nsACString::size_type src_len = aSource.Length(),
                         sub_len = aSubstring.Length();
-  if (sub_len > src_len)
+  if (sub_len > src_len) {
     return false;
+  }
   return Substring(aSource, 0, sub_len).Equals(aSubstring, aComparator);
 }
 
 bool
-StringEndsWith( const nsAString& aSource, const nsAString& aSubstring,
-                const nsStringComparator& aComparator )
+StringEndsWith(const nsAString& aSource, const nsAString& aSubstring,
+               const nsStringComparator& aComparator)
 {
   nsAString::size_type src_len = aSource.Length(),
                        sub_len = aSubstring.Length();
-  if (sub_len > src_len)
+  if (sub_len > src_len) {
     return false;
+  }
   return Substring(aSource, src_len - sub_len, sub_len).Equals(aSubstring,
                                                                aComparator);
 }
 
 bool
-StringEndsWith( const nsACString& aSource, const nsACString& aSubstring,
-                const nsCStringComparator& aComparator )
+StringEndsWith(const nsACString& aSource, const nsACString& aSubstring,
+               const nsCStringComparator& aComparator)
 {
   nsACString::size_type src_len = aSource.Length(),
                         sub_len = aSubstring.Length();
-  if (sub_len > src_len)
+  if (sub_len > src_len) {
     return false;
+  }
   return Substring(aSource, src_len - sub_len, sub_len).Equals(aSubstring,
                                                                aComparator);
 }
 
 
 
 static const char16_t empty_buffer[1] = { '\0' };
 
@@ -1032,17 +1052,17 @@ EmptyString()
   static const nsDependentString sEmpty(empty_buffer);
 
   return sEmpty;
 }
 
 const nsAFlatCString&
 EmptyCString()
 {
-  static const nsDependentCString sEmpty((const char *)empty_buffer);
+  static const nsDependentCString sEmpty((const char*)empty_buffer);
 
   return sEmpty;
 }
 
 const nsAFlatString&
 NullString()
 {
   static const nsXPIDLString sNull;
@@ -1059,93 +1079,89 @@ NullCString()
 }
 
 int32_t
 CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
                    const nsASingleFragmentString& aUTF16String)
 {
   static const uint32_t NOT_ASCII = uint32_t(~0x7F);
 
-  const char *u8, *u8end;
+  const char* u8;
+  const char* u8end;
   aUTF8String.BeginReading(u8);
   aUTF8String.EndReading(u8end);
 
-  const char16_t *u16, *u16end;
+  const char16_t* u16;
+  const char16_t* u16end;
   aUTF16String.BeginReading(u16);
   aUTF16String.EndReading(u16end);
 
-  while (u8 != u8end && u16 != u16end)
-  {
+  while (u8 != u8end && u16 != u16end) {
     // Cast away the signedness of *u8 to prevent signextension when
     // converting to uint32_t
     uint32_t c8_32 = (uint8_t)*u8;
 
-    if (c8_32 & NOT_ASCII)
-    {
+    if (c8_32 & NOT_ASCII) {
       bool err;
       c8_32 = UTF8CharEnumerator::NextChar(&u8, u8end, &err);
-      if (err)
+      if (err) {
         return INT32_MIN;
+      }
 
       uint32_t c16_32 = UTF16CharEnumerator::NextChar(&u16, u16end);
       // The above UTF16CharEnumerator::NextChar() calls can
       // fail, but if it does for anything other than no data to
       // look at (which can't happen here), it returns the
       // Unicode replacement character 0xFFFD for the invalid
       // data they were fed. Ignore that error and treat invalid
       // UTF16 as 0xFFFD.
       //
       // This matches what our UTF16 to UTF8 conversion code
       // does, and thus a UTF8 string that came from an invalid
       // UTF16 string will compare equal to the invalid UTF16
       // string it came from. Same is true for any other UTF16
       // string differs only in the invalid part of the string.
 
-      if (c8_32 != c16_32)
+      if (c8_32 != c16_32) {
         return c8_32 < c16_32 ? -1 : 1;
-    }
-    else
-    {
-      if (c8_32 != *u16)
+      }
+    } else {
+      if (c8_32 != *u16) {
         return c8_32 > *u16 ? 1 : -1;
+      }
 
       ++u8;
       ++u16;
     }
   }
 
-  if (u8 != u8end)
-  {
+  if (u8 != u8end) {
     // We get to the end of the UTF16 string, but no to the end of
     // the UTF8 string. The UTF8 string is longer than the UTF16
     // string
 
     return 1;
   }
 
-  if (u16 != u16end)
-  {
+  if (u16 != u16end) {
     // We get to the end of the UTF8 string, but no to the end of
     // the UTF16 string. The UTF16 string is longer than the UTF8
     // string
 
     return -1;
   }
 
   // The two strings match.
 
   return 0;
 }
 
 void
 AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest)
 {
   NS_ASSERTION(IS_VALID_CHAR(aSource), "Invalid UCS4 char");
-  if (IS_IN_BMP(aSource))
-  {
+  if (IS_IN_BMP(aSource)) {
     aDest.Append(char16_t(aSource));
-  }
-  else
-  {
+  } else {
     aDest.Append(H_SURROGATE(aSource));
     aDest.Append(L_SURROGATE(aSource));
   }
 }
--- a/xpcom/string/src/nsStringComparator.cpp
+++ b/xpcom/string/src/nsStringComparator.cpp
@@ -16,22 +16,24 @@
 
 // define nsCStringComparator
 #include "string-template-def-char.h"
 #include "nsTStringComparator.cpp"
 #include "string-template-undef.h"
 
 
 int
-nsCaseInsensitiveCStringComparator::operator()( const char_type* lhs,
-                                                const char_type* rhs,
-                                                uint32_t lLength,
-                                                uint32_t rLength ) const
+nsCaseInsensitiveCStringComparator::operator()(const char_type* aLhs,
+                                               const char_type* aRhs,
+                                               uint32_t aLhsLength,
+                                               uint32_t aRhsLength) const
 {
-  if (lLength != rLength)
-    return (lLength > rLength) ? 1 : -1;
-  int32_t result=int32_t(PL_strncasecmp(lhs, rhs, lLength));
+  if (aLhsLength != aRhsLength) {
+    return (aLhsLength > aRhsLength) ? 1 : -1;
+  }
+  int32_t result = int32_t(PL_strncasecmp(aLhs, aRhs, aLhsLength));
   //Egads. PL_strncasecmp is returning *very* negative numbers.
   //Some folks expect -1,0,1, so let's temper its enthusiasm.
-  if (result<0)
-    result=-1;
+  if (result < 0) {
+    result = -1;
+  }
   return result;
 }
--- a/xpcom/string/src/nsSubstring.cpp
+++ b/xpcom/string/src/nsSubstring.cpp
@@ -38,52 +38,60 @@
 
 using mozilla::Atomic;
 
 // ---------------------------------------------------------------------------
 
 static const char16_t gNullChar = 0;
 
 char* const nsCharTraits<char>::sEmptyBuffer =
-  (char*) const_cast<char16_t*>(&gNullChar);
+  (char*)const_cast<char16_t*>(&gNullChar);
 char16_t* const nsCharTraits<char16_t>::sEmptyBuffer =
   const_cast<char16_t*>(&gNullChar);
 
 // ---------------------------------------------------------------------------
 
 #ifdef ENABLE_STRING_STATS
 class nsStringStats
 {
 public:
   nsStringStats()
-    : mAllocCount(0), mReallocCount(0), mFreeCount(0), mShareCount(0) {}
+    : mAllocCount(0)
+    , mReallocCount(0)
+    , mFreeCount(0)
+    , mShareCount(0)
+  {
+  }
 
   ~nsStringStats()
   {
     // this is a hack to suppress duplicate string stats printing
     // in seamonkey as a result of the string code being linked
     // into seamonkey and libxpcom! :-(
-    if (!mAllocCount && !mAdoptCount)
+    if (!mAllocCount && !mAdoptCount) {
       return;
+    }
 
     printf("nsStringStats\n");
     printf(" => mAllocCount:     % 10d\n", int(mAllocCount));
     printf(" => mReallocCount:   % 10d\n", int(mReallocCount));
     printf(" => mFreeCount:      % 10d", int(mFreeCount));
-    if (mAllocCount > mFreeCount)
+    if (mAllocCount > mFreeCount) {
       printf("  --  LEAKED %d !!!\n", mAllocCount - mFreeCount);
-    else
+    } else {
       printf("\n");
+    }
     printf(" => mShareCount:     % 10d\n", int(mShareCount));
     printf(" => mAdoptCount:     % 10d\n", int(mAdoptCount));
     printf(" => mAdoptFreeCount: % 10d", int(mAdoptFreeCount));
-    if (mAdoptCount > mAdoptFreeCount)
+    if (mAdoptCount > mAdoptFreeCount) {
       printf("  --  LEAKED %d !!!\n", mAdoptCount - mAdoptFreeCount);
-    else
+    } else {
       printf("\n");
+    }
     printf(" => Process ID: %" PRIuPTR ", Thread ID: %" PRIuPTR "\n",
            uintptr_t(getpid()), uintptr_t(pthread_self()));
   }
 
   Atomic<int32_t> mAllocCount;
   Atomic<int32_t> mReallocCount;
   Atomic<int32_t> mFreeCount;
   Atomic<int32_t> mShareCount;
@@ -94,74 +102,89 @@ static nsStringStats gStringStats;
 #define STRING_STAT_INCREMENT(_s) (gStringStats.m ## _s ## Count)++
 #else
 #define STRING_STAT_INCREMENT(_s)
 #endif
 
 // ---------------------------------------------------------------------------
 
 inline void
-ReleaseData( void* data, uint32_t flags )
+ReleaseData(void* aData, uint32_t aFlags)
 {
-  if (flags & nsSubstring::F_SHARED)
-  {
-    nsStringBuffer::FromData(data)->Release();
-  }
-  else if (flags & nsSubstring::F_OWNED)
-  {
-    nsMemory::Free(data);
+  if (aFlags & nsSubstring::F_SHARED) {
+    nsStringBuffer::FromData(aData)->Release();
+  } else if (aFlags & nsSubstring::F_OWNED) {
+    nsMemory::Free(aData);
     STRING_STAT_INCREMENT(AdoptFree);
 #ifdef NS_BUILD_REFCNT_LOGGING
     // Treat this as destruction of a "StringAdopt" object for leak
     // tracking purposes.
-    NS_LogDtor(data, "StringAdopt", 1);
+    NS_LogDtor(aData, "StringAdopt", 1);
 #endif // NS_BUILD_REFCNT_LOGGING
   }
   // otherwise, nothing to do.
 }
 
 // ---------------------------------------------------------------------------
 
 // XXX or we could make nsStringBuffer be a friend of nsTAString
 
 class nsAStringAccessor : public nsAString
 {
 private:
   nsAStringAccessor(); // NOT IMPLEMENTED
 
 public:
-  char_type  *data() const   { return mData; }
-  size_type   length() const { return mLength; }
-  uint32_t    flags() const  { return mFlags; }
+  char_type* data() const
+  {
+    return mData;
+  }
+  size_type length() const
+  {
+    return mLength;
+  }
+  uint32_t flags() const
+  {
+    return mFlags;
+  }
 
-  void set(char_type *data, size_type len, uint32_t flags)
+  void set(char_type* aData, size_type aLen, uint32_t aFlags)
   {
     ReleaseData(mData, mFlags);
-    mData = data;
-    mLength = len;
-    mFlags = flags;
+    mData = aData;
+    mLength = aLen;
+    mFlags = aFlags;
   }
 };
 
 class nsACStringAccessor : public nsACString
 {
 private:
   nsACStringAccessor(); // NOT IMPLEMENTED
 
 public:
-  char_type  *data() const   { return mData; }
-  size_type   length() const { return mLength; }
-  uint32_t    flags() const  { return mFlags; }
+  char_type* data() const
+  {
+    return mData;
+  }
+  size_type length() const
+  {
+    return mLength;
+  }
+  uint32_t flags() const
+  {
+    return mFlags;
+  }
 
-  void set(char_type *data, size_type len, uint32_t flags)
+  void set(char_type* aData, size_type aLen, uint32_t aFlags)
   {
     ReleaseData(mData, mFlags);
-    mData = data;
-    mLength = len;
-    mFlags = flags;
+    mData = aData;
+    mLength = aLen;
+    mFlags = aFlags;
   }
 };
 
 // ---------------------------------------------------------------------------
 
 void
 nsStringBuffer::AddRef()
 {
@@ -170,149 +193,148 @@ nsStringBuffer::AddRef()
   NS_LOG_ADDREF(this, mRefCount, "nsStringBuffer", sizeof(*this));
 }
 
 void
 nsStringBuffer::Release()
 {
   int32_t count = --mRefCount;
   NS_LOG_RELEASE(this, count, "nsStringBuffer");
-  if (count == 0)
-  {
+  if (count == 0) {
     STRING_STAT_INCREMENT(Free);
     free(this); // we were allocated with |malloc|
   }
 }
 
 /**
  * Alloc returns a pointer to a new string header with set capacity.
  */
 already_AddRefed<nsStringBuffer>
-nsStringBuffer::Alloc(size_t size)
+nsStringBuffer::Alloc(size_t aSize)
 {
-  NS_ASSERTION(size != 0, "zero capacity allocation not allowed");
-  NS_ASSERTION(sizeof(nsStringBuffer) + size <= size_t(uint32_t(-1)) &&
-               sizeof(nsStringBuffer) + size > size,
+  NS_ASSERTION(aSize != 0, "zero capacity allocation not allowed");
+  NS_ASSERTION(sizeof(nsStringBuffer) + aSize <= size_t(uint32_t(-1)) &&
+               sizeof(nsStringBuffer) + aSize > aSize,
                "mStorageSize will truncate");
 
-  nsStringBuffer *hdr =
-    (nsStringBuffer *) malloc(sizeof(nsStringBuffer) + size);
-  if (hdr)
-  {
+  nsStringBuffer* hdr =
+    (nsStringBuffer*)malloc(sizeof(nsStringBuffer) + aSize);
+  if (hdr) {
     STRING_STAT_INCREMENT(Alloc);
 
     hdr->mRefCount = 1;
-    hdr->mStorageSize = size;
+    hdr->mStorageSize = aSize;
     NS_LOG_ADDREF(hdr, 1, "nsStringBuffer", sizeof(*hdr));
   }
   return dont_AddRef(hdr);
 }
 
 nsStringBuffer*
-nsStringBuffer::Realloc(nsStringBuffer* hdr, size_t size)
+nsStringBuffer::Realloc(nsStringBuffer* aHdr, size_t aSize)
 {
   STRING_STAT_INCREMENT(Realloc);
 
-  NS_ASSERTION(size != 0, "zero capacity allocation not allowed");
-  NS_ASSERTION(sizeof(nsStringBuffer) + size <= size_t(uint32_t(-1)) &&
-               sizeof(nsStringBuffer) + size > size,
+  NS_ASSERTION(aSize != 0, "zero capacity allocation not allowed");
+  NS_ASSERTION(sizeof(nsStringBuffer) + aSize <= size_t(uint32_t(-1)) &&
+               sizeof(nsStringBuffer) + aSize > aSize,
                "mStorageSize will truncate");
 
   // no point in trying to save ourselves if we hit this assertion
-  NS_ASSERTION(!hdr->IsReadonly(), "|Realloc| attempted on readonly string");
+  NS_ASSERTION(!aHdr->IsReadonly(), "|Realloc| attempted on readonly string");
 
   // Treat this as a release and addref for refcounting purposes, since we
   // just asserted that the refcount is 1.  If we don't do that, refcount
   // logging will claim we've leaked all sorts of stuff.
-  NS_LOG_RELEASE(hdr, 0, "nsStringBuffer");
+  NS_LOG_RELEASE(aHdr, 0, "nsStringBuffer");
 
-  hdr = (nsStringBuffer*) realloc(hdr, sizeof(nsStringBuffer) + size);
-  if (hdr) {
-    NS_LOG_ADDREF(hdr, 1, "nsStringBuffer", sizeof(*hdr));
-    hdr->mStorageSize = size;
+  aHdr = (nsStringBuffer*)realloc(aHdr, sizeof(nsStringBuffer) + aSize);
+  if (aHdr) {
+    NS_LOG_ADDREF(aHdr, 1, "nsStringBuffer", sizeof(*aHdr));
+    aHdr->mStorageSize = aSize;
   }
 
-  return hdr;
+  return aHdr;
 }
 
 nsStringBuffer*
-nsStringBuffer::FromString(const nsAString& str)
+nsStringBuffer::FromString(const nsAString& aStr)
 {
   const nsAStringAccessor* accessor =
-    static_cast<const nsAStringAccessor*>(&str);
+    static_cast<const nsAStringAccessor*>(&aStr);
 
-  if (!(accessor->flags() & nsSubstring::F_SHARED))
+  if (!(accessor->flags() & nsSubstring::F_SHARED)) {
     return nullptr;
+  }
 
   return FromData(accessor->data());
 }
 
 nsStringBuffer*
-nsStringBuffer::FromString(const nsACString& str)
+nsStringBuffer::FromString(const nsACString& aStr)
 {
   const nsACStringAccessor* accessor =
-    static_cast<const nsACStringAccessor*>(&str);
+    static_cast<const nsACStringAccessor*>(&aStr);
 
-  if (!(accessor->flags() & nsCSubstring::F_SHARED))
+  if (!(accessor->flags() & nsCSubstring::F_SHARED)) {
     return nullptr;
+  }
 
   return FromData(accessor->data());
 }
 
 void
-nsStringBuffer::ToString(uint32_t len, nsAString &str,
+nsStringBuffer::ToString(uint32_t aLen, nsAString& aStr,
                          bool aMoveOwnership)
 {
   char16_t* data = static_cast<char16_t*>(Data());
 
-  nsAStringAccessor* accessor = static_cast<nsAStringAccessor*>(&str);
-  NS_ASSERTION(data[len] == char16_t(0), "data should be null terminated");
+  nsAStringAccessor* accessor = static_cast<nsAStringAccessor*>(&aStr);
+  NS_ASSERTION(data[aLen] == char16_t(0), "data should be null terminated");
 
   // preserve class flags
   uint32_t flags = accessor->flags();
   flags = (flags & 0xFFFF0000) | nsSubstring::F_SHARED | nsSubstring::F_TERMINATED;
 
   if (!aMoveOwnership) {
     AddRef();
   }
-  accessor->set(data, len, flags);
+  accessor->set(data, aLen, flags);
 }
 
 void
-nsStringBuffer::ToString(uint32_t len, nsACString &str,
+nsStringBuffer::ToString(uint32_t aLen, nsACString& aStr,
                          bool aMoveOwnership)
 {
   char* data = static_cast<char*>(Data());
 
-  nsACStringAccessor* accessor = static_cast<nsACStringAccessor*>(&str);
-  NS_ASSERTION(data[len] == char(0), "data should be null terminated");
+  nsACStringAccessor* accessor = static_cast<nsACStringAccessor*>(&aStr);
+  NS_ASSERTION(data[aLen] == char(0), "data should be null terminated");
 
   // preserve class flags
   uint32_t flags = accessor->flags();
   flags = (flags & 0xFFFF0000) | nsCSubstring::F_SHARED | nsCSubstring::F_TERMINATED;
 
   if (!aMoveOwnership) {
     AddRef();
   }
-  accessor->set(data, len, flags);
+  accessor->set(data, aLen, flags);
 }
 
 size_t
 nsStringBuffer::SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const
 {
   NS_ASSERTION(!IsReadonly(),
                "shared StringBuffer in SizeOfIncludingThisMustBeUnshared");
   return aMallocSizeOf(this);
 }
 
 size_t
 nsStringBuffer::SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const
 {
-  if (!IsReadonly())
-  {
+  if (!IsReadonly()) {
     return SizeOfIncludingThisMustBeUnshared(aMallocSizeOf);
   }
   return 0;
 }
 
 size_t
 nsStringBuffer::SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf) const
 {
--- a/xpcom/string/src/nsTDependentString.cpp
+++ b/xpcom/string/src/nsTDependentString.cpp
@@ -1,24 +1,25 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 void
-nsTDependentString_CharT::Rebind( const string_type& str, uint32_t startPos )
+nsTDependentString_CharT::Rebind(const string_type& str, uint32_t startPos)
 {
   NS_ABORT_IF_FALSE(str.Flags() & F_TERMINATED, "Unterminated flat string");
 
   // If we currently own a buffer, release it.
   Finalize();
 
   size_type strLength = str.Length();
 
-  if (startPos > strLength)
+  if (startPos > strLength) {
     startPos = strLength;
+  }
 
   mData = const_cast<char_type*>(static_cast<const char_type*>(str.Data())) + startPos;
   mLength = strLength - startPos;
 
   SetDataFlags(str.Flags() & (F_TERMINATED | F_LITERAL));
 }
--- a/xpcom/string/src/nsTDependentSubstring.cpp
+++ b/xpcom/string/src/nsTDependentSubstring.cpp
@@ -1,33 +1,35 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 void
-nsTDependentSubstring_CharT::Rebind( const substring_type& str, uint32_t startPos, uint32_t length )
+nsTDependentSubstring_CharT::Rebind(const substring_type& str,
+                                    uint32_t startPos, uint32_t length)
 {
   // If we currently own a buffer, release it.
   Finalize();
 
   size_type strLength = str.Length();
 
-  if (startPos > strLength)
+  if (startPos > strLength) {
     startPos = strLength;
+  }
 
   mData = const_cast<char_type*>(static_cast<const char_type*>(str.Data())) + startPos;
   mLength = XPCOM_MIN(length, strLength - startPos);
 
   SetDataFlags(F_NONE);
 }
 
 void
-nsTDependentSubstring_CharT::Rebind( const char_type* data, size_type length )
+nsTDependentSubstring_CharT::Rebind(const char_type* data, size_type length)
 {
   NS_ASSERTION(data, "nsTDependentSubstring must wrap a non-NULL buffer");
 
   // If we currently own a buffer, release it.
   Finalize();
 
   mData = const_cast<char_type*>(static_cast<const char_type*>(data));
   mLength = length;
--- a/xpcom/string/src/nsTPromiseFlatString.cpp
+++ b/xpcom/string/src/nsTPromiseFlatString.cpp
@@ -2,20 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 void
 nsTPromiseFlatString_CharT::Init(const substring_type& str)
 {
-  if (str.IsTerminated())
-  {
+  if (str.IsTerminated()) {
     mData = const_cast<char_type*>(static_cast<const char_type*>(str.Data()));
     mLength = str.Length();
     mFlags = str.mFlags & (F_TERMINATED | F_LITERAL);
-             // does not promote F_VOIDED
-  }
-  else
-  {
+    // does not promote F_VOIDED
+  } else {
     Assign(str);
   }
 }
--- a/xpcom/string/src/nsTString.cpp
+++ b/xpcom/string/src/nsTString.cpp
@@ -1,48 +1,45 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 nsTAdoptingString_CharT&
-nsTAdoptingString_CharT::operator=( const self_type& str )
+nsTAdoptingString_CharT::operator=(const self_type& str)
 {
   // This'll violate the constness of this argument, that's just
   // the nature of this class...
   self_type* mutable_str = const_cast<self_type*>(&str);
 
-  if (str.mFlags & F_OWNED)
-  {
+  if (str.mFlags & F_OWNED) {
     // We want to do what Adopt() does, but without actually incrementing
     // the Adopt count.  Note that we can be a little more straightforward
     // about this than Adopt() is, because we know that str.mData is
     // non-null.  Should we be able to assert that str is not void here?
     NS_ASSERTION(str.mData, "String with null mData?");
     Finalize();
     mData = str.mData;
     mLength = str.mLength;
     SetDataFlags(F_TERMINATED | F_OWNED);
 
     // Make str forget the buffer we just took ownership of.
-    new (mutable_str) self_type();
-  }
-  else
-  {
+    new(mutable_str) self_type();
+  } else {
     Assign(str);
 
     mutable_str->Truncate();
   }
 
   return *this;
 }
 
 void
-nsTString_CharT::Rebind( const char_type* data, size_type length )
+nsTString_CharT::Rebind(const char_type* data, size_type length)
 {
   // If we currently own a buffer, release it.
   Finalize();
 
   mData = const_cast<char_type*>(data);
   mLength = length;
   SetDataFlags(F_TERMINATED);
   AssertValidDepedentString();
--- a/xpcom/string/src/nsTStringComparator.cpp
+++ b/xpcom/string/src/nsTStringComparator.cpp
@@ -1,42 +1,50 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 int NS_FASTCALL
-Compare( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs, const nsTStringComparator_CharT& comp )
+Compare(const nsTSubstring_CharT::base_string_type& aLhs,
+        const nsTSubstring_CharT::base_string_type& aRhs,
+        const nsTStringComparator_CharT& comp)
 {
   typedef nsTSubstring_CharT::size_type size_type;
 
-  if ( &lhs == &rhs )
+  if (&aLhs == &aRhs) {
     return 0;
+  }
 
   nsTSubstring_CharT::const_iterator leftIter, rightIter;
-  lhs.BeginReading(leftIter);
-  rhs.BeginReading(rightIter);
+  aLhs.BeginReading(leftIter);
+  aRhs.BeginReading(rightIter);
 
   size_type lLength = leftIter.size_forward();
   size_type rLength = rightIter.size_forward();
   size_type lengthToCompare = XPCOM_MIN(lLength, rLength);
 
   int result;
-  if ( (result = comp(leftIter.get(), rightIter.get(), lengthToCompare, lengthToCompare)) == 0 )
-  {
-    if ( lLength < rLength )
+  if ((result = comp(leftIter.get(), rightIter.get(),
+                     lengthToCompare, lengthToCompare)) == 0) {
+    if (lLength < rLength) {
       result = -1;
-    else if ( rLength < lLength )
+    } else if (rLength < lLength) {
       result = 1;
-    else
+    } else {
       result = 0;
+    }
   }
 
   return result;
 }
 
 int
-nsTDefaultStringComparator_CharT::operator()( const char_type* lhs, const char_type* rhs, uint32_t lLength, uint32_t rLength) const
+nsTDefaultStringComparator_CharT::operator()(const char_type* aLhs,
+                                             const char_type* aRhs,
+                                             uint32_t aLLength,
+                                             uint32_t aRLength) const
 {
-  return (lLength == rLength) ? nsCharTraits<CharT>::compare(lhs, rhs, lLength) :
-         (lLength > rLength) ? 1 : -1;
+  return
+    aLLength == aRLength ? nsCharTraits<CharT>::compare(aLhs, aRhs, aLLength) :
+                            (aLLength > aRLength) ? 1 : -1;
 }
--- a/xpcom/string/src/nsTSubstring.cpp
+++ b/xpcom/string/src/nsTSubstring.cpp
@@ -4,149 +4,148 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "mozilla/MemoryReporting.h"
 #include "double-conversion.h"
 
 using double_conversion::DoubleToStringConverter;
 
 #ifdef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
-nsTSubstring_CharT::nsTSubstring_CharT( char_type *data, size_type length,
-                                        uint32_t flags)
-  : mData(data),
-    mLength(length),
-    mFlags(flags)
+nsTSubstring_CharT::nsTSubstring_CharT(char_type* aData, size_type aLength,
+                                       uint32_t aFlags)
+  : mData(aData),
+    mLength(aLength),
+    mFlags(aFlags)
 {
-  if (flags & F_OWNED) {
+  if (aFlags & F_OWNED) {
     STRING_STAT_INCREMENT(Adopt);
 #ifdef NS_BUILD_REFCNT_LOGGING
     NS_LogCtor(mData, "StringAdopt", 1);
 #endif
   }
 }
 #endif /* XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE */
 
 /**
  * helper function for down-casting a nsTSubstring to a nsTFixedString.
  */
 inline const nsTFixedString_CharT*
-AsFixedString( const nsTSubstring_CharT* s )
+AsFixedString(const nsTSubstring_CharT* aStr)
 {
-  return static_cast<const nsTFixedString_CharT*>(s);
+  return static_cast<const nsTFixedString_CharT*>(aStr);
 }
 
 
 /**
  * this function is called to prepare mData for writing.  the given capacity
  * indicates the required minimum storage size for mData, in sizeof(char_type)
  * increments.  this function returns true if the operation succeeds.  it also
  * returns the old data and old flags members if mData is newly allocated.
  * the old data must be released by the caller.
  */
 bool
-nsTSubstring_CharT::MutatePrep( size_type capacity, char_type** oldData, uint32_t* oldFlags )
+nsTSubstring_CharT::MutatePrep(size_type aCapacity, char_type** aOldData,
+                               uint32_t* aOldFlags)
 {
   // initialize to no old data
-  *oldData = nullptr;
-  *oldFlags = 0;
+  *aOldData = nullptr;
+  *aOldFlags = 0;
 
   size_type curCapacity = Capacity();
 
-  // If |capacity > kMaxCapacity|, then our doubling algorithm may not be
+  // If |aCapacity > kMaxCapacity|, then our doubling algorithm may not be
   // able to allocate it.  Just bail out in cases like that.  We don't want
   // to be allocating 2GB+ strings anyway.
   PR_STATIC_ASSERT((sizeof(nsStringBuffer) & 0x1) == 0);
   const size_type kMaxCapacity =
-    (size_type(-1)/2 - sizeof(nsStringBuffer)) / sizeof(char_type) - 2;
-  if (capacity > kMaxCapacity) {
-    // Also assert for |capacity| equal to |size_type(-1)|, since we used to
+    (size_type(-1) / 2 - sizeof(nsStringBuffer)) / sizeof(char_type) - 2;
+  if (aCapacity > kMaxCapacity) {
+    // Also assert for |aCapacity| equal to |size_type(-1)|, since we used to
     // use that value to flag immutability.
-    NS_ASSERTION(capacity != size_type(-1), "Bogus capacity");
+    NS_ASSERTION(aCapacity != size_type(-1), "Bogus capacity");
     return false;
   }
 
   // |curCapacity == 0| means that the buffer is immutable or 0-sized, so we
   // need to allocate a new buffer. We cannot use the existing buffer even
   // though it might be large enough.
 
-  if (curCapacity != 0)
-  {
-    if (capacity <= curCapacity) {
+  if (curCapacity != 0) {
+    if (aCapacity <= curCapacity) {
       mFlags &= ~F_VOIDED;  // mutation clears voided flag
       return true;
     }
 
     // Use doubling algorithm when forced to increase available capacity.
     size_type temp = curCapacity;
-    while (temp < capacity)
+    while (temp < aCapacity) {
       temp <<= 1;
-    NS_ASSERTION(XPCOM_MIN(temp, kMaxCapacity) >= capacity,
+    }
+    NS_ASSERTION(XPCOM_MIN(temp, kMaxCapacity) >= aCapacity,
                  "should have hit the early return at the top");
-    capacity = XPCOM_MIN(temp, kMaxCapacity);
+    aCapacity = XPCOM_MIN(temp, kMaxCapacity);
   }
 
   //
   // several cases:
   //
   //  (1) we have a shared buffer (mFlags & F_SHARED)
   //  (2) we have an owned buffer (mFlags & F_OWNED)
   //  (3) we have a fixed buffer (mFlags & F_FIXED)
   //  (4) we have a readonly buffer
   //
   // requiring that we in some cases preserve the data before creating
   // a new buffer complicates things just a bit ;-)
   //
 
-  size_type storageSize = (capacity + 1) * sizeof(char_type);
+  size_type storageSize = (aCapacity + 1) * sizeof(char_type);
 
   // case #1
-  if (mFlags & F_SHARED)
-  {
+  if (mFlags & F_SHARED) {
     nsStringBuffer* hdr = nsStringBuffer::FromData(mData);
-    if (!hdr->IsReadonly())
-    {
-      nsStringBuffer *newHdr = nsStringBuffer::Realloc(hdr, storageSize);
-      if (!newHdr)
-        return false; // out-of-memory (original header left intact)
+    if (!hdr->IsReadonly()) {
+      nsStringBuffer* newHdr = nsStringBuffer::Realloc(hdr, storageSize);
+      if (!newHdr) {
+        return false;  // out-of-memory (original header left intact)
+      }
 
       hdr = newHdr;
-      mData = (char_type*) hdr->Data();
+      mData = (char_type*)hdr->Data();
       mFlags &= ~F_VOIDED;  // mutation clears voided flag
       return true;
     }
   }
 
   char_type* newData;
   uint32_t newDataFlags;
 
   // if we have a fixed buffer of sufficient size, then use it.  this helps
   // avoid heap allocations.
-  if ((mFlags & F_CLASS_FIXED) && (capacity < AsFixedString(this)->mFixedCapacity))
-  {
+  if ((mFlags & F_CLASS_FIXED) &&
+      (aCapacity < AsFixedString(this)->mFixedCapacity)) {
     newData = AsFixedString(this)->mFixedBuf;
     newDataFlags = F_TERMINATED | F_FIXED;
-  }
-  else
-  {
+  } else {
     // if we reach here then, we must allocate a new buffer.  we cannot
     // make use of our F_OWNED or F_FIXED buffers because they are not
     // large enough.
 
     nsStringBuffer* newHdr =
       nsStringBuffer::Alloc(storageSize).take();
-    if (!newHdr)
-      return false; // we are still in a consistent state
+    if (!newHdr) {
+      return false;  // we are still in a consistent state
+    }
 
-    newData = (char_type*) newHdr->Data();
+    newData = (char_type*)newHdr->Data();
     newDataFlags = F_TERMINATED | F_SHARED;
   }
 
   // save old data and flags
-  *oldData = mData;
-  *oldFlags = mFlags;
+  *aOldData = mData;
+  *aOldFlags = mFlags;
 
   mData = newData;
   SetDataFlags(newDataFlags);
 
   // mLength does not change
 
   // though we are not necessarily terminated at the moment, now is probably
   // still the best time to set F_TERMINATED.
@@ -157,858 +156,883 @@ nsTSubstring_CharT::MutatePrep( size_typ
 void
 nsTSubstring_CharT::Finalize()
 {
   ::ReleaseData(mData, mFlags);
   // mData, mLength, and mFlags are purposefully left dangling
 }
 
 bool
-nsTSubstring_CharT::ReplacePrepInternal(index_type cutStart, size_type cutLen,
-                                        size_type fragLen, size_type newLen)
+nsTSubstring_CharT::ReplacePrepInternal(index_type aCutStart, size_type aCutLen,
+                                        size_type aFragLen, size_type aNewLen)
 {
   char_type* oldData;
   uint32_t oldFlags;
-  if (!MutatePrep(newLen, &oldData, &oldFlags))
-    return false; // out-of-memory
+  if (!MutatePrep(aNewLen, &oldData, &oldFlags)) {
+    return false;  // out-of-memory
+  }
 
-  if (oldData)
-  {
+  if (oldData) {
     // determine whether or not we need to copy part of the old string
     // over to the new string.
 
-    if (cutStart > 0)
-    {
+    if (aCutStart > 0) {
       // copy prefix from old string
-      char_traits::copy(mData, oldData, cutStart);
+      char_traits::copy(mData, oldData, aCutStart);
     }
 
-    if (cutStart + cutLen < mLength)
-    {
+    if (aCutStart + aCutLen < mLength) {
       // copy suffix from old string to new offset
-      size_type from = cutStart + cutLen;
+      size_type from = aCutStart + aCutLen;
       size_type fromLen = mLength - from;
-      uint32_t to = cutStart + fragLen;
+      uint32_t to = aCutStart + aFragLen;
       char_traits::copy(mData + to, oldData + from, fromLen);
     }
 
     ::ReleaseData(oldData, oldFlags);
-  }
-  else
-  {
+  } else {
     // original data remains intact
 
     // determine whether or not we need to move part of the existing string
     // to make room for the requested hole.
-    if (fragLen != cutLen && cutStart + cutLen < mLength)
-    {
-      uint32_t from = cutStart + cutLen;
+    if (aFragLen != aCutLen && aCutStart + aCutLen < mLength) {
+      uint32_t from = aCutStart + aCutLen;
       uint32_t fromLen = mLength - from;
-      uint32_t to = cutStart + fragLen;
+      uint32_t to = aCutStart + aFragLen;
       char_traits::move(mData + to, mData + from, fromLen);
     }
   }
 
   // add null terminator (mutable mData always has room for the null-
   // terminator).
-  mData[newLen] = char_type(0);
-  mLength = newLen;
+  mData[aNewLen] = char_type(0);
+  mLength = aNewLen;
 
   return true;
 }
 
 nsTSubstring_CharT::size_type
 nsTSubstring_CharT::Capacity() const
 {
   // return 0 to indicate an immutable or 0-sized buffer
 
   size_type capacity;
-  if (mFlags & F_SHARED)
-  {
+  if (mFlags & F_SHARED) {
     // if the string is readonly, then we pretend that it has no capacity.
     nsStringBuffer* hdr = nsStringBuffer::FromData(mData);
-    if (hdr->IsReadonly())
+    if (hdr->IsReadonly()) {
       capacity = 0;
-    else {
+    } else {
       capacity = (hdr->StorageSize() / sizeof(char_type)) - 1;
     }
-  }
-  else if (mFlags & F_FIXED)
-  {
+  } else if (mFlags & F_FIXED) {
     capacity = AsFixedString(this)->mFixedCapacity;
-  }
-  else if (mFlags & F_OWNED)
-  {
+  } else if (mFlags & F_OWNED) {
     // we don't store the capacity of an adopted buffer because that would
     // require an additional member field.  the best we can do is base the
     // capacity on our length.  remains to be seen if this is the right
     // trade-off.
     capacity = mLength;
-  }
-  else
-  {
+  } else {
     capacity = 0;
   }
 
   return capacity;
 }
 
 bool
-nsTSubstring_CharT::EnsureMutable( size_type newLen )
+nsTSubstring_CharT::EnsureMutable(size_type aNewLen)
 {
-  if (newLen == size_type(-1) || newLen == mLength)
-  {
-    if (mFlags & (F_FIXED | F_OWNED))
+  if (aNewLen == size_type(-1) || aNewLen == mLength) {
+    if (mFlags & (F_FIXED | F_OWNED)) {
       return true;
-    if ((mFlags & F_SHARED) && !nsStringBuffer::FromData(mData)->IsReadonly())
+    }
+    if ((mFlags & F_SHARED) &&
+        !nsStringBuffer::FromData(mData)->IsReadonly()) {
       return true;
+    }
 
-    newLen = mLength;
+    aNewLen = mLength;
   }
-  return SetLength(newLen, fallible_t());
+  return SetLength(aNewLen, fallible_t());
 }
 
 // ---------------------------------------------------------------------------
 
 // This version of Assign is optimized for single-character assignment.
 void
-nsTSubstring_CharT::Assign( char_type c )
+nsTSubstring_CharT::Assign(char_type aChar)
 {
-  if (!ReplacePrep(0, mLength, 1))
+  if (!ReplacePrep(0, mLength, 1)) {
     NS_ABORT_OOM(mLength);
+  }
 
-  *mData = c;
+  *mData = aChar;
 }
 
 bool
-nsTSubstring_CharT::Assign( char_type c, const fallible_t& )
+nsTSubstring_CharT::Assign(char_type aChar, const fallible_t&)
 {
-  if (!ReplacePrep(0, mLength, 1))
+  if (!ReplacePrep(0, mLength, 1)) {
     return false;
+  }
 
-  *mData = c;
+  *mData = aChar;
   return true;
 }
 
 void
-nsTSubstring_CharT::Assign( const char_type* data )
+nsTSubstring_CharT::Assign(const char_type* aData)
 {
-  if (!Assign(data, size_type(-1), fallible_t()))
-    NS_ABORT_OOM(char_traits::length(data));
+  if (!Assign(aData, size_type(-1), fallible_t())) {
+    NS_ABORT_OOM(char_traits::length(aData));
+  }
 }
 
 void
-nsTSubstring_CharT::Assign( const char_type* data, size_type length )
+nsTSubstring_CharT::Assign(const char_type* aData, size_type aLength)
 {
-  if (!Assign(data, length, fallible_t()))
-    NS_ABORT_OOM(length);
+  if (!Assign(aData, aLength, fallible_t())) {
+    NS_ABORT_OOM(aLength);
+  }
 }
 
 bool
-nsTSubstring_CharT::Assign( const char_type* data, size_type length, const fallible_t& )
+nsTSubstring_CharT::Assign(const char_type* aData, size_type aLength,
+                           const fallible_t&)
 {
-  if (!data || length == 0)
-  {
+  if (!aData || aLength == 0) {
     Truncate();
     return true;
   }
 
-  if (length == size_type(-1))
-    length = char_traits::length(data);
-
-  if (IsDependentOn(data, data + length))
-  {
-    return Assign(string_type(data, length), fallible_t());
+  if (aLength == size_type(-1)) {
+    aLength = char_traits::length(aData);
   }
 
-  if (!ReplacePrep(0, mLength, length))
+  if (IsDependentOn(aData, aData + aLength)) {
+    return Assign(string_type(aData, aLength), fallible_t());
+  }
+
+  if (!ReplacePrep(0, mLength, aLength)) {
     return false;
+  }
 
-  char_traits::copy(mData, data, length);
+  char_traits::copy(mData, aData, aLength);
   return true;
 }
 
 void
-nsTSubstring_CharT::AssignASCII( const char* data, size_type length )
+nsTSubstring_CharT::AssignASCII(const char* aData, size_type aLength)
 {
-  if (!AssignASCII(data, length, fallible_t()))
-    NS_ABORT_OOM(length);
+  if (!AssignASCII(aData, aLength, fallible_t())) {
+    NS_ABORT_OOM(aLength);
+  }
 }
 
 bool
-nsTSubstring_CharT::AssignASCII( const char* data, size_type length, const fallible_t& )
+nsTSubstring_CharT::AssignASCII(const char* aData, size_type aLength,
+                                const fallible_t&)
 {
   // A Unicode string can't depend on an ASCII string buffer,
   // so this dependence check only applies to CStrings.
 #ifdef CharT_is_char
-  if (IsDependentOn(data, data + length))
-  {
-    return Assign(string_type(data, length), fallible_t());
+  if (IsDependentOn(aData, aData + aLength)) {
+    return Assign(string_type(aData, aLength), fallible_t());
   }
 #endif
 
-  if (!ReplacePrep(0, mLength, length))
+  if (!ReplacePrep(0, mLength, aLength)) {
     return false;
+  }
 
-  char_traits::copyASCII(mData, data, length);
+  char_traits::copyASCII(mData, aData, aLength);
   return true;
 }
 
 void
-nsTSubstring_CharT::AssignLiteral( const char_type* data, size_type length )
+nsTSubstring_CharT::AssignLiteral(const char_type* aData, size_type aLength)
 {
   ::ReleaseData(mData, mFlags);
-  mData = const_cast<char_type*>(data);
-  mLength = length;
+  mData = const_cast<char_type*>(aData);
+  mLength = aLength;
   SetDataFlags(F_TERMINATED | F_LITERAL);
 }
 
 void
-nsTSubstring_CharT::Assign( const self_type& str )
+nsTSubstring_CharT::Assign(const self_type& aStr)
 {
-  if (!Assign(str, fallible_t()))
-    NS_ABORT_OOM(str.Length());
+  if (!Assign(aStr, fallible_t())) {
+    NS_ABORT_OOM(aStr.Length());
+  }
 }
 
 bool
-nsTSubstring_CharT::Assign( const self_type& str, const fallible_t& )
+nsTSubstring_CharT::Assign(const self_type& aStr, const fallible_t&)
 {
-  // |str| could be sharable.  we need to check its flags to know how to
+  // |aStr| could be sharable. We need to check its flags to know how to
   // deal with it.
 
-  if (&str == this)
-    return true;
-
-  if (!str.mLength)
-  {
-    Truncate();
-    mFlags |= str.mFlags & F_VOIDED;
+  if (&aStr == this) {
     return true;
   }
 
-  if (str.mFlags & F_SHARED)
-  {
+  if (!aStr.mLength) {
+    Truncate();
+    mFlags |= aStr.mFlags & F_VOIDED;
+    return true;
+  }
+
+  if (aStr.mFlags & F_SHARED) {
     // nice! we can avoid a string copy :-)
 
-    // |str| should be null-terminated
-    NS_ASSERTION(str.mFlags & F_TERMINATED, "shared, but not terminated");
+    // |aStr| should be null-terminated
+    NS_ASSERTION(aStr.mFlags & F_TERMINATED, "shared, but not terminated");
 
     ::ReleaseData(mData, mFlags);
 
-    mData = str.mData;
-    mLength = str.mLength;
+    mData = aStr.mData;
+    mLength = aStr.mLength;
     SetDataFlags(F_TERMINATED | F_SHARED);
 
     // get an owning reference to the mData
     nsStringBuffer::FromData(mData)->AddRef();
     return true;
-  }
-  else if (str.mFlags & F_LITERAL)
-  {
-    NS_ABORT_IF_FALSE(str.mFlags & F_TERMINATED, "Unterminated literal");
+  } else if (aStr.mFlags & F_LITERAL) {
+    NS_ABORT_IF_FALSE(aStr.mFlags & F_TERMINATED, "Unterminated literal");
 
-    AssignLiteral(str.mData, str.mLength);
+    AssignLiteral(aStr.mData, aStr.mLength);
     return true;
   }
 
   // else, treat this like an ordinary assignment.
-  return Assign(str.Data(), str.Length(), fallible_t());
+  return Assign(aStr.Data(), aStr.Length(), fallible_t());
 }
 
 void
-nsTSubstring_CharT::Assign( const substring_tuple_type& tuple )
+nsTSubstring_CharT::Assign(const substring_tuple_type& aTuple)
 {
-  if (!Assign(tuple, fallible_t()))
-    NS_ABORT_OOM(tuple.Length());
+  if (!Assign(aTuple, fallible_t())) {
+    NS_ABORT_OOM(aTuple.Length());
+  }
 }
 
 bool
-nsTSubstring_CharT::Assign( const substring_tuple_type& tuple, const fallible_t& )
+nsTSubstring_CharT::Assign(const substring_tuple_type& aTuple,
+                           const fallible_t&)
 {
-  if (tuple.IsDependentOn(mData, mData + mLength))
-  {
+  if (aTuple.IsDependentOn(mData, mData + mLength)) {
     // take advantage of sharing here...
-    return Assign(string_type(tuple), fallible_t());
+    return Assign(string_type(aTuple), fallible_t());
   }
 
-  size_type length = tuple.Length();
+  size_type length = aTuple.Length();
 
   // don't use ReplacePrep here because it changes the length
   char_type* oldData;
   uint32_t oldFlags;
-  if (!MutatePrep(length, &oldData, &oldFlags))
+  if (!MutatePrep(length, &oldData, &oldFlags)) {
     return false;
+  }
 
-  if (oldData)
+  if (oldData) {
     ::ReleaseData(oldData, oldFlags);
+  }
 
-  tuple.WriteTo(mData, length);
+  aTuple.WriteTo(mData, length);
   mData[length] = 0;
   mLength = length;
   return true;
 }
 
 void
-nsTSubstring_CharT::Adopt( char_type* data, size_type length )
+nsTSubstring_CharT::Adopt(char_type* aData, size_type aLength)
 {
-  if (data)
-  {
+  if (aData) {
     ::ReleaseData(mData, mFlags);
 
-    if (length == size_type(-1))
-      length = char_traits::length(data);
+    if (aLength == size_type(-1)) {
+      aLength = char_traits::length(aData);
+    }
 
-    mData = data;
-    mLength = length;
+    mData = aData;
+    mLength = aLength;
     SetDataFlags(F_TERMINATED | F_OWNED);
 
     STRING_STAT_INCREMENT(Adopt);
 #ifdef NS_BUILD_REFCNT_LOGGING
     // Treat this as construction of a "StringAdopt" object for leak
     // tracking purposes.
     NS_LogCtor(mData, "StringAdopt", 1);
 #endif // NS_BUILD_REFCNT_LOGGING
-  }
-  else
-  {
+  } else {
     SetIsVoid(true);
   }
 }
 
 
 // This version of Replace is optimized for single-character replacement.
 void
-nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, char_type c )
+nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
+                            char_type aChar)
 {
-  cutStart = XPCOM_MIN(cutStart, Length());
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  if (ReplacePrep(cutStart, cutLength, 1))
-    mData[cutStart] = c;
+  if (ReplacePrep(aCutStart, aCutLength, 1)) {
+    mData[aCutStart] = aChar;
+  }
 }
 
 bool
-nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, char_type c, const mozilla::fallible_t& )
+nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
+                            char_type aChar,
+                            const mozilla::fallible_t&)
 {
-  cutStart = XPCOM_MIN(cutStart, Length());
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  if (!ReplacePrep(cutStart, cutLength, 1))
+  if (!ReplacePrep(aCutStart, aCutLength, 1)) {
     return false;
+  }
 
-  mData[cutStart] = c;
+  mData[aCutStart] = aChar;
 
   return true;
 }
 
 void
-nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length )
+nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
+                            const char_type* aData, size_type aLength)
 {
-  if (!Replace(cutStart, cutLength, data, length, mozilla::fallible_t()))
-  {
-    NS_ABORT_OOM(Length() - cutLength + 1);
+  if (!Replace(aCutStart, aCutLength, aData, aLength,
+               mozilla::fallible_t())) {
+    NS_ABORT_OOM(Length() - aCutLength + 1);
   }
 }
 
 bool
-nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length, const mozilla::fallible_t& )
+nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
+                            const char_type* aData, size_type aLength,
+                            const mozilla::fallible_t&)
 {
   // unfortunately, some callers pass null :-(
-  if (!data)
-  {
-    length = 0;
-  }
-  else
-  {
-    if (length == size_type(-1))
-      length = char_traits::length(data);
+  if (!aData) {
+    aLength = 0;
+  } else {
+    if (aLength == size_type(-1)) {
+      aLength = char_traits::length(aData);
+    }
 
-    if (IsDependentOn(data, data + length))
-    {
-      nsTAutoString_CharT temp(data, length);
-      return Replace(cutStart, cutLength, temp, mozilla::fallible_t());
+    if (IsDependentOn(aData, aData + aLength)) {
+      nsTAutoString_CharT temp(aData, aLength);
+      return Replace(aCutStart, aCutLength, temp, mozilla::fallible_t());
     }
   }
 
-  cutStart = XPCOM_MIN(cutStart, Length());
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  bool ok = ReplacePrep(cutStart, cutLength, length);
-  if (!ok)
+  bool ok = ReplacePrep(aCutStart, aCutLength, aLength);
+  if (!ok) {
     return false;
+  }
 
-  if (length > 0)
-    char_traits::copy(mData + cutStart, data, length);
+  if (aLength > 0) {
+    char_traits::copy(mData + aCutStart, aData, aLength);
+  }
 
   return true;
 }
 
 void
-nsTSubstring_CharT::ReplaceASCII( index_type cutStart, size_type cutLength, const char* data, size_type length )
+nsTSubstring_CharT::ReplaceASCII(index_type aCutStart, size_type aCutLength,
+                                 const char* aData, size_type aLength)
 {
-  if (length == size_type(-1))
-    length = strlen(data);
+  if (aLength == size_type(-1)) {
+    aLength = strlen(aData);
+  }
 
   // A Unicode string can't depend on an ASCII string buffer,
   // so this dependence check only applies to CStrings.
 #ifdef CharT_is_char
-  if (IsDependentOn(data, data + length))
-  {
-    nsTAutoString_CharT temp(data, length);
-    Replace(cutStart, cutLength, temp);
+  if (IsDependentOn(aData, aData + aLength)) {
+    nsTAutoString_CharT temp(aData, aLength);
+    Replace(aCutStart, aCutLength, temp);
     return;
   }
 #endif
 
-  cutStart = XPCOM_MIN(cutStart, Length());
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  if (ReplacePrep(cutStart, cutLength, length) && length > 0)
-    char_traits::copyASCII(mData + cutStart, data, length);
+  if (ReplacePrep(aCutStart, aCutLength, aLength) && aLength > 0) {
+    char_traits::copyASCII(mData + aCutStart, aData, aLength);
+  }
 }
 
 void
-nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const substring_tuple_type& tuple )
+nsTSubstring_CharT::Replace(index_type aCutStart, size_type aCutLength,
+                            const substring_tuple_type& aTuple)
 {
-  if (tuple.IsDependentOn(mData, mData + mLength))
-  {
-    nsTAutoString_CharT temp(tuple);
-    Replace(cutStart, cutLength, temp);
+  if (aTuple.IsDependentOn(mData, mData + mLength)) {
+    nsTAutoString_CharT temp(aTuple);
+    Replace(aCutStart, aCutLength, temp);
     return;
   }
 
-  size_type length = tuple.Length();
+  size_type length = aTuple.Length();
+
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  cutStart = XPCOM_MIN(cutStart, Length());
-
-  if (ReplacePrep(cutStart, cutLength, length) && length > 0)
-    tuple.WriteTo(mData + cutStart, length);
+  if (ReplacePrep(aCutStart, aCutLength, length) && length > 0) {
+    aTuple.WriteTo(mData + aCutStart, length);
+  }
 }
 
 void
-nsTSubstring_CharT::ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type* data, size_type length )
+nsTSubstring_CharT::ReplaceLiteral(index_type aCutStart, size_type aCutLength,
+                                   const char_type* aData, size_type aLength)
 {
-  cutStart = XPCOM_MIN(cutStart, Length());
+  aCutStart = XPCOM_MIN(aCutStart, Length());
 
-  if (!cutStart && cutLength == Length())
-    AssignLiteral(data, length);
-  else if (ReplacePrep(cutStart, cutLength, length) && length > 0)
-    char_traits::copy(mData + cutStart, data, length);
+  if (!aCutStart && aCutLength == Length()) {
+    AssignLiteral(aData, aLength);
+  } else if (ReplacePrep(aCutStart, aCutLength, aLength) && aLength > 0) {
+    char_traits::copy(mData + aCutStart, aData, aLength);
+  }
 }
 
 void
-nsTSubstring_CharT::SetCapacity( size_type capacity )
+nsTSubstring_CharT::SetCapacity(size_type aCapacity)
 {
-  if (!SetCapacity(capacity, fallible_t()))
-    NS_ABORT_OOM(capacity);
+  if (!SetCapacity(aCapacity, fallible_t())) {
+    NS_ABORT_OOM(aCapacity);
+  }
 }
 
 bool
-nsTSubstring_CharT::SetCapacity( size_type capacity, const fallible_t& )
+nsTSubstring_CharT::SetCapacity(size_type aCapacity, const fallible_t&)
 {
   // capacity does not include room for the terminating null char
 
   // if our capacity is reduced to zero, then free our buffer.
-  if (capacity == 0)
-  {
+  if (aCapacity == 0) {
     ::ReleaseData(mData, mFlags);
     mData = char_traits::sEmptyBuffer;
     mLength = 0;
     SetDataFlags(F_TERMINATED);
     return true;
   }
 
   char_type* oldData;
   uint32_t oldFlags;
-  if (!MutatePrep(capacity, &oldData, &oldFlags))
-    return false; // out-of-memory
+  if (!MutatePrep(aCapacity, &oldData, &oldFlags)) {
+    return false;  // out-of-memory
+  }
 
   // compute new string length
-  size_type newLen = XPCOM_MIN(mLength, capacity);
+  size_type newLen = XPCOM_MIN(mLength, aCapacity);
 
-  if (oldData)
-  {
+  if (oldData) {
     // preserve old data
-    if (mLength > 0)
+    if (mLength > 0) {
       char_traits::copy(mData, oldData, newLen);
+    }
 
     ::ReleaseData(oldData, oldFlags);
   }
 
   // adjust mLength if our buffer shrunk down in size
-  if (newLen < mLength)
+  if (newLen < mLength) {
     mLength = newLen;
+  }
 
   // always null-terminate here, even if the buffer got longer.  this is
   // for backwards compat with the old string implementation.
-  mData[capacity] = char_type(0);
+  mData[aCapacity] = char_type(0);
 
   return true;
 }
 
 void
-nsTSubstring_CharT::SetLength( size_type length )
+nsTSubstring_CharT::SetLength(size_type aLength)
 {
-  SetCapacity(length);
-  mLength = length;
+  SetCapacity(aLength);
+  mLength = aLength;
 }
 
 bool
-nsTSubstring_CharT::SetLength( size_type length, const fallible_t& )
+nsTSubstring_CharT::SetLength(size_type aLength, const fallible_t&)
 {
-  if (!SetCapacity(length, fallible_t()))
+  if (!SetCapacity(aLength, fallible_t())) {
     return false;
+  }
 
-  mLength = length;
+  mLength = aLength;
   return true;
 }
 
 void
-nsTSubstring_CharT::SetIsVoid( bool val )
+nsTSubstring_CharT::SetIsVoid(bool aVal)
 {
-  if (val)
-  {
+  if (aVal) {
     Truncate();
     mFlags |= F_VOIDED;
-  }
-  else
-  {
+  } else {
     mFlags &= ~F_VOIDED;
   }
 }
 
 bool
-nsTSubstring_CharT::Equals( const self_type& str ) const
+nsTSubstring_CharT::Equals(const self_type& aStr) const
 {
-  return mLength == str.mLength && char_traits::compare(mData, str.mData, mLength) == 0;
+  return mLength == aStr.mLength &&
+         char_traits::compare(mData, aStr.mData, mLength) == 0;
 }
 
 bool
-nsTSubstring_CharT::Equals( const self_type& str, const comparator_type& comp ) const
+nsTSubstring_CharT::Equals(const self_type& aStr,
+                           const comparator_type& aComp) const
 {
-  return mLength == str.mLength && comp(mData, str.mData, mLength, str.mLength) == 0;
+  return mLength == aStr.mLength &&
+         aComp(mData, aStr.mData, mLength, aStr.mLength) == 0;
 }
 
 bool
-nsTSubstring_CharT::Equals( const char_type* data ) const
+nsTSubstring_CharT::Equals(const char_type* aData) const
 {
   // unfortunately, some callers pass null :-(
-  if (!data)
-  {
+  if (!aData) {
     NS_NOTREACHED("null data pointer");
     return mLength == 0;
   }
 
   // XXX avoid length calculation?
-  size_type length = char_traits::length(data);
-  return mLength == length && char_traits::compare(mData, data, mLength) == 0;
+  size_type length = char_traits::length(aData);
+  return mLength == length &&
+         char_traits::compare(mData, aData, mLength) == 0;
 }
 
 bool
-nsTSubstring_CharT::Equals( const char_type* data, const comparator_type& comp ) const
+nsTSubstring_CharT::Equals(const char_type* aData,
+                           const comparator_type& aComp) const
 {
   // unfortunately, some callers pass null :-(
-  if (!data)
-  {
+  if (!aData) {
     NS_NOTREACHED("null data pointer");
     return mLength == 0;
   }
 
   // XXX avoid length calculation?
-  size_type length = char_traits::length(data);
-  return mLength == length && comp(mData, data, mLength, length) == 0;
+  size_type length = char_traits::length(aData);
+  return mLength == length && aComp(mData, aData, mLength, length) == 0;
+}
+
+bool
+nsTSubstring_CharT::EqualsASCII(const char* aData, size_type aLen) const
+{
+  return mLength == aLen &&
+         char_traits::compareASCII(mData, aData, aLen) == 0;
 }
 
 bool
-nsTSubstring_CharT::EqualsASCII( const char* data, size_type len ) const
+nsTSubstring_CharT::EqualsASCII(const char* aData) const
 {
-  return mLength == len && char_traits::compareASCII(mData, data, len) == 0;
+  return char_traits::compareASCIINullTerminated(mData, mLength, aData) == 0;
 }
 
 bool
-nsTSubstring_CharT::EqualsASCII( const char* data ) const
+nsTSubstring_CharT::LowerCaseEqualsASCII(const char* aData,
+                                         size_type aLen) const
 {
-  return char_traits::compareASCIINullTerminated(mData, mLength, data) == 0;
-}
-
-bool
-nsTSubstring_CharT::LowerCaseEqualsASCII( const char* data, size_type len ) const
-{
-  return mLength == len && char_traits::compareLowerCaseToASCII(mData, data, len) == 0;
+  return mLength == aLen &&
+         char_traits::compareLowerCaseToASCII(mData, aData, aLen) == 0;
 }
 
 bool
-nsTSubstring_CharT::LowerCaseEqualsASCII( const char* data ) const
+nsTSubstring_CharT::LowerCaseEqualsASCII(const char* aData) const
 {
-  return char_traits::compareLowerCaseToASCIINullTerminated(mData, mLength, data) == 0;
+  return char_traits::compareLowerCaseToASCIINullTerminated(mData,
+                                                            mLength,
+                                                            aData) == 0;
 }
 
 nsTSubstring_CharT::size_type
-nsTSubstring_CharT::CountChar( char_type c ) const
+nsTSubstring_CharT::CountChar(char_type aChar) const
 {
-  const char_type *start = mData;
-  const char_type *end   = mData + mLength;
+  const char_type* start = mData;
+  const char_type* end   = mData + mLength;
 
-  return NS_COUNT(start, end, c);
+  return NS_COUNT(start, end, aChar);
 }
 
 int32_t
-nsTSubstring_CharT::FindChar( char_type c, index_type offset ) const
+nsTSubstring_CharT::FindChar(char_type aChar, index_type aOffset) const
 {
-  if (offset < mLength)
-  {
-    const char_type* result = char_traits::find(mData + offset, mLength - offset, c);
-    if (result)
+  if (aOffset < mLength) {
+    const char_type* result = char_traits::find(mData + aOffset,
+                                                mLength - aOffset, aChar);
+    if (result) {
       return result - mData;
+    }
   }
   return -1;
 }
 
 void
-nsTSubstring_CharT::StripChar( char_type aChar, int32_t aOffset )
+nsTSubstring_CharT::StripChar(char_type aChar, int32_t aOffset)
 {
-  if (mLength == 0 || aOffset >= int32_t(mLength))
+  if (mLength == 0 || aOffset >= int32_t(mLength)) {
     return;
+  }
 
-  if (!EnsureMutable()) // XXX do this lazily?
+  if (!EnsureMutable()) { // XXX do this lazily?
     NS_ABORT_OOM(mLength);
+  }
 
   // XXX(darin): this code should defer writing until necessary.
 
   char_type* to   = mData + aOffset;
   char_type* from = mData + aOffset;
   char_type* end  = mData + mLength;
 
-  while (from < end)
-  {
+  while (from < end) {
     char_type theChar = *from++;
-    if (aChar != theChar)
+    if (aChar != theChar) {
       *to++ = theChar;
+    }
   }
   *to = char_type(0); // add the null
   mLength = to - mData;
 }
 
 void
-nsTSubstring_CharT::StripChars( const char_type* aChars, uint32_t aOffset )
+nsTSubstring_CharT::StripChars(const char_type* aChars, uint32_t aOffset)
 {
-  if (aOffset >= uint32_t(mLength))
+  if (aOffset >= uint32_t(mLength)) {
     return;
+  }
 
-  if (!EnsureMutable()) // XXX do this lazily?
+  if (!EnsureMutable()) { // XXX do this lazily?
     NS_ABORT_OOM(mLength);
+  }
 
   // XXX(darin): this code should defer writing until necessary.
 
   char_type* to   = mData + aOffset;
   char_type* from = mData + aOffset;
   char_type* end  = mData + mLength;
 
-  while (from < end)
-  {
+  while (from < end) {
     char_type theChar = *from++;
     const char_type* test = aChars;
 
     for (; *test && *test != theChar; ++test);
 
     if (!*test) {
       // Not stripped, copy this char.
       *to++ = theChar;
     }
   }
   *to = char_type(0); // add the null
   mLength = to - mData;
 }
 
 int
-nsTSubstring_CharT::AppendFunc(void* arg, const char* s, uint32_t len)
+nsTSubstring_CharT::AppendFunc(void* aArg, const char* aStr, uint32_t aLen)
 {
-  self_type* self = static_cast<self_type*>(arg);
+  self_type* self = static_cast<self_type*>(aArg);
 
   // NSPR sends us the final null terminator even though we don't want it
-  if (len && s[len - 1] == '\0') {
-    --len;
+  if (aLen && aStr[aLen - 1] == '\0') {
+    --aLen;
   }
 
-  self->AppendASCII(s, len);
+  self->AppendASCII(aStr, aLen);
 
-  return len;
+  return aLen;
 }
 
-void nsTSubstring_CharT::AppendPrintf( const char* format, ...)
+void
+nsTSubstring_CharT::AppendPrintf(const char* aFormat, ...)
 {
   va_list ap;
-  va_start(ap, format);
-  uint32_t r = PR_vsxprintf(AppendFunc, this, format, ap);
-  if (r == (uint32_t) -1)
+  va_start(ap, aFormat);
+  uint32_t r = PR_vsxprintf(AppendFunc, this, aFormat, ap);
+  if (r == (uint32_t)-1) {
     NS_RUNTIMEABORT("Allocation or other failure in PR_vsxprintf");
+  }
   va_end(ap);
 }
 
-void nsTSubstring_CharT::AppendPrintf( const char* format, va_list ap )
+void
+nsTSubstring_CharT::AppendPrintf(const char* aFormat, va_list aAp)
 {
-  uint32_t r = PR_vsxprintf(AppendFunc, this, format, ap);
-  if (r == (uint32_t) -1)
+  uint32_t r = PR_vsxprintf(AppendFunc, this, aFormat, aAp);
+  if (r == (uint32_t)-1) {
     NS_RUNTIMEABORT("Allocation or other failure in PR_vsxprintf");
+  }
 }
 
 /* hack to make sure we define FormatWithoutTrailingZeros only once */
 #ifdef CharT_is_PRUnichar
-// Returns the length of the formatted aDouble in buf.
+// Returns the length of the formatted aDouble in aBuf.
 static int
-FormatWithoutTrailingZeros(char (& buf)[40], double aDouble,
-                           int precision)
+FormatWithoutTrailingZeros(char (&aBuf)[40], double aDouble,
+                           int aPrecision)
 {
   static const DoubleToStringConverter converter(DoubleToStringConverter::UNIQUE_ZERO |
                                                  DoubleToStringConverter::EMIT_POSITIVE_EXPONENT_SIGN,
                                                  "Infinity",
                                                  "NaN",
                                                  'e',
                                                  -6, 21,
                                                  6, 1);
-  double_conversion::StringBuilder builder(buf, sizeof(buf));
+  double_conversion::StringBuilder builder(aBuf, sizeof(aBuf));
   bool exponential_notation = false;
-  converter.ToPrecision(aDouble, precision, &exponential_notation, &builder);
+  converter.ToPrecision(aDouble, aPrecision, &exponential_notation, &builder);
   int length = builder.position();
   char* formattedDouble = builder.Finalize();
 
-  // If we have a shorter string than precision, it means we have a special
+  // If we have a shorter string than aPrecision, it means we have a special
   // value (NaN or Infinity).  All other numbers will be formatted with at
-  // least precision digits.
-  if (length <= precision) {
+  // least aPrecision digits.
+  if (length <= aPrecision) {
     return length;
   }
 
   char* end = formattedDouble + length;
-  char* decimalPoint = strchr(buf, '.');
+  char* decimalPoint = strchr(aBuf, '.');
   // No trailing zeros to remove.
-  if (decimalPoint == nullptr) {
+  if (!decimalPoint) {
     return length;
   }
 
   if (MOZ_UNLIKELY(exponential_notation)) {
     // We need to check for cases like 1.00000e-10 (yes, this is
     // disgusting).
     char* exponent = end - 1;
-    for ( ; ; --exponent) {
+    for (; ; --exponent) {
       if (*exponent == 'e') {
         break;
       }
     }
     char* zerosBeforeExponent = exponent - 1;
-    for ( ; zerosBeforeExponent != decimalPoint; --zerosBeforeExponent) {
+    for (; zerosBeforeExponent != decimalPoint; --zerosBeforeExponent) {
       if (*zerosBeforeExponent != '0') {
         break;
       }
     }
     if (zerosBeforeExponent == decimalPoint) {
       --zerosBeforeExponent;
     }
     // Slide the exponent to the left over the trailing zeros.  Don't
     // worry about copying the trailing NUL character.
     size_t exponentSize = end - exponent;
     memmove(zerosBeforeExponent + 1, exponent, exponentSize);
     length -= exponent - (zerosBeforeExponent + 1);
   } else {
     char* trailingZeros = end - 1;
-    for ( ; trailingZeros != decimalPoint; --trailingZeros) {
+    for (; trailingZeros != decimalPoint; --trailingZeros) {
       if (*trailingZeros != '0') {
         break;
       }
     }
     if (trailingZeros == decimalPoint) {
       --trailingZeros;
     }
     length -= end - (trailingZeros + 1);
   }
 
   return length;
 }
 #endif /* CharT_is_PRUnichar */
 
 void
-nsTSubstring_CharT::AppendFloat( float aFloat )
+nsTSubstring_CharT::AppendFloat(float aFloat)
 {
   char buf[40];
   int length = FormatWithoutTrailingZeros(buf, aFloat, 6);
   AppendASCII(buf, length);
 }
 
 void
-nsTSubstring_CharT::AppendFloat( double aFloat )
+nsTSubstring_CharT::AppendFloat(double aFloat)
 {
   char buf[40];
   int length = FormatWithoutTrailingZeros(buf, aFloat, 15);
   AppendASCII(buf, length);
 }
 
 size_t
 nsTSubstring_CharT::SizeOfExcludingThisMustBeUnshared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
   if (mFlags & F_SHARED) {
     return nsStringBuffer::FromData(mData)->
-      SizeOfIncludingThisMustBeUnshared(mallocSizeOf);
+      SizeOfIncludingThisMustBeUnshared(aMallocSizeOf);
   }
   if (mFlags & F_OWNED) {
-    return mallocSizeOf(mData);
+    return aMallocSizeOf(mData);
   }
 
   // If we reach here, exactly one of the following must be true:
   // - F_VOIDED is set, and mData points to sEmptyBuffer;
   // - F_FIXED is set, and mData points to a buffer within a string
   //   object (e.g. nsAutoString);
   // - None of F_SHARED, F_OWNED, F_FIXED is set, and mData points to a buffer
   //   owned by something else.
   //
   // In all three cases, we don't measure it.
   return 0;
 }
 
 size_t
 nsTSubstring_CharT::SizeOfExcludingThisIfUnshared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
   // This is identical to SizeOfExcludingThisMustBeUnshared except for the
   // F_SHARED case.
   if (mFlags & F_SHARED) {
     return nsStringBuffer::FromData(mData)->
-           SizeOfIncludingThisIfUnshared(mallocSizeOf);
+           SizeOfIncludingThisIfUnshared(aMallocSizeOf);
   }
   if (mFlags & F_OWNED) {
-    return mallocSizeOf(mData);
+    return aMallocSizeOf(mData);
   }
   return 0;
 }
 
 size_t
 nsTSubstring_CharT::SizeOfExcludingThisEvenIfShared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
   // This is identical to SizeOfExcludingThisMustBeUnshared except for the
   // F_SHARED case.
   if (mFlags & F_SHARED) {
     return nsStringBuffer::FromData(mData)->
-      SizeOfIncludingThisEvenIfShared(mallocSizeOf);
+      SizeOfIncludingThisEvenIfShared(aMallocSizeOf);
   }
   if (mFlags & F_OWNED) {
-    return mallocSizeOf(mData);
+    return aMallocSizeOf(mData);
   }
   return 0;
 }
 
 size_t
 nsTSubstring_CharT::SizeOfIncludingThisMustBeUnshared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
-  return mallocSizeOf(this) + SizeOfExcludingThisMustBeUnshared(mallocSizeOf);
+  return aMallocSizeOf(this) +
+         SizeOfExcludingThisMustBeUnshared(aMallocSizeOf);
 }
 
 size_t
 nsTSubstring_CharT::SizeOfIncludingThisIfUnshared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
-  return mallocSizeOf(this) + SizeOfExcludingThisIfUnshared(mallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThisIfUnshared(aMallocSizeOf);
 }
 
 size_t
 nsTSubstring_CharT::SizeOfIncludingThisEvenIfShared(
-    mozilla::MallocSizeOf mallocSizeOf) const
+    mozilla::MallocSizeOf aMallocSizeOf) const
 {
-  return mallocSizeOf(this) + SizeOfExcludingThisEvenIfShared(mallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThisEvenIfShared(aMallocSizeOf);
 }
 
--- a/xpcom/string/src/nsTSubstringTuple.cpp
+++ b/xpcom/string/src/nsTSubstringTuple.cpp
@@ -8,88 +8,85 @@
 /**
  * computes the aggregate string length
  */
 
 nsTSubstringTuple_CharT::size_type
 nsTSubstringTuple_CharT::Length() const
 {
   uint32_t len;
-  if (mHead)
+  if (mHead) {
     len = mHead->Length();
-  else
+  } else {
     len = TO_SUBSTRING(mFragA).Length();
+  }
 
   return len + TO_SUBSTRING(mFragB).Length();
 }
 
 
 /**
- * writes the aggregate string to the given buffer.  bufLen is assumed
+ * writes the aggregate string to the given buffer. aBufLen is assumed
  * to be equal to or greater than the value returned by the Length()
- * method.  the string written to |buf| is not null-terminated.
+ * method.  the string written to |aBuf| is not null-terminated.
  */
 
 void
-nsTSubstringTuple_CharT::WriteTo( char_type *buf, uint32_t bufLen ) const
+nsTSubstringTuple_CharT::WriteTo(char_type* aBuf, uint32_t aBufLen) const
 {
   const substring_type& b = TO_SUBSTRING(mFragB);
 
-  NS_ASSERTION(bufLen >= b.Length(), "buffer too small");
-  uint32_t headLen = bufLen - b.Length();
-  if (mHead)
-  {
-    mHead->WriteTo(buf, headLen);
-  }
-  else
-  {
+  NS_ASSERTION(aBufLen >= b.Length(), "buffer too small");
+  uint32_t headLen = aBufLen - b.Length();
+  if (mHead) {
+    mHead->WriteTo(aBuf, headLen);
+  } else {
     const substring_type& a = TO_SUBSTRING(mFragA);
 
     NS_ASSERTION(a.Length() == headLen, "buffer incorrectly sized");
-    char_traits::copy(buf, a.Data(), a.Length());
+    char_traits::copy(aBuf, a.Data(), a.Length());
   }
 
-  char_traits::copy(buf + headLen, b.Data(), b.Length());
+  char_traits::copy(aBuf + headLen, b.Data(), b.Length());
 
 #if 0
-  // we need to write out data into |buf|, ending at |buf+bufLen|.  so our
-  // data needs to precede |buf+bufLen| exactly.  we trust that the buffer
+  // we need to write out data into |aBuf|, ending at |aBuf + aBufLen|. So our
+  // data needs to precede |aBuf + aBufLen| exactly. We trust that the buffer
   // was properly sized!
 
   const substring_type& b = TO_SUBSTRING(mFragB);
 
-  NS_ASSERTION(bufLen >= b.Length(), "buffer is too small");
-  char_traits::copy(buf + bufLen - b.Length(), b.Data(), b.Length());
+  NS_ASSERTION(aBufLen >= b.Length(), "buffer is too small");
+  char_traits::copy(aBuf + aBufLen - b.Length(), b.Data(), b.Length());
 
-  bufLen -= b.Length();
+  aBufLen -= b.Length();
 
-  if (mHead)
-  {
-    mHead->WriteTo(buf, bufLen);
-  }
-  else
-  {
+  if (mHead) {
+    mHead->WriteTo(aBuf, aBufLen);
+  } else {
     const substring_type& a = TO_SUBSTRING(mFragA);
-    NS_ASSERTION(bufLen == a.Length(), "buffer is too small");
-    char_traits::copy(buf, a.Data(), a.Length());
+    NS_ASSERTION(aBufLen == a.Length(), "buffer is too small");
+    char_traits::copy(aBuf, a.Data(), a.Length());
   }
 #endif
 }
 
 
 /**
  * returns true if this tuple is dependent on (i.e., overlapping with)
  * the given char sequence.
  */
 
 bool
-nsTSubstringTuple_CharT::IsDependentOn( const char_type *start, const char_type *end ) const
+nsTSubstringTuple_CharT::IsDependentOn(const char_type* start, const char_type* end) const
 {
   // we start with the right-most fragment since it is faster to check.
 
-  if (TO_SUBSTRING(mFragB).IsDependentOn(start, end))
+  if (TO_SUBSTRING(mFragB).IsDependentOn(start, end)) {
     return true;
+  }
 
-  if (mHead)
+  if (mHead) {
     return mHead->IsDependentOn(start, end);
+  }
 
   return TO_SUBSTRING(mFragA).IsDependentOn(start, end);
 }
--- a/xpcom/string/src/nsUTF8UtilsSSE2.cpp
+++ b/xpcom/string/src/nsUTF8UtilsSSE2.cpp
@@ -12,17 +12,17 @@ LossyConvertEncoding16to8::write_sse2(co
                                       uint32_t aSourceLength)
 {
   char* dest = mDestination;
 
   // Align source to a 16-byte boundary.
   uint32_t i = 0;
   uint32_t alignLen =
     XPCOM_MIN<uint32_t>(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t));
-  for (; i < alignLen; i++) {
+  for (; i < alignLen; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   // Walk 64 bytes (four XMM registers) at a time.
   __m128i vectmask = _mm_set1_epi16(0x00ff);
   for (; aSourceLength - i > 31; i += 32) {
     __m128i source1 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i));
     source1 = _mm_and_si128(source1, vectmask);
@@ -46,36 +46,36 @@ LossyConvertEncoding16to8::write_sse2(co
 
     // This store needs to be unaligned since there's no guarantee that the
     // alignment we did above for the source will align the destination.
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i),      packed1);
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i + 16), packed2);
   }
 
   // Finish up the rest.
-  for (; i < aSourceLength; i++) {
+  for (; i < aSourceLength; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   mDestination += i;
 }
 
 void
 LossyConvertEncoding8to16::write_sse2(const char* aSource,
                                       uint32_t aSourceLength)
 {
-  char16_t *dest = mDestination;
+  char16_t* dest = mDestination;
 
   // Align source to a 16-byte boundary.  We choose to align source rather than
   // dest because we'd rather have our loads than our stores be fast. You have
   // to wait for a load to complete, but you can keep on moving after issuing a
   // store.
   uint32_t i = 0;
   uint32_t alignLen = XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf));
-  for (; i < alignLen; i++) {
+  for (; i < alignLen; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   // Walk 32 bytes (two XMM registers) at a time.
   for (; aSourceLength - i > 31; i += 32) {
     __m128i source1 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i));
     __m128i source2 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i + 16));
 
@@ -88,14 +88,14 @@ LossyConvertEncoding8to16::write_sse2(co
     // store lo and hi into dest.
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i),      lo1);
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i + 8),  hi1);
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i + 16), lo2);
     _mm_storeu_si128(reinterpret_cast<__m128i*>(dest + i + 24), hi2);
   }
 
   // Finish up whatever's left.
-  for (; i < aSourceLength; i++) {
+  for (; i < aSourceLength; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   mDestination += i;
 }