Bug 1499212 - suggest non-ASCII Assign for non-static-const same-char_type array parameters r=dbaron
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 18 Oct 2018 21:53:33 +0000
changeset 500521 9469c37cc124badf9e8cfd29be4469f50a9c2c47
parent 500520 386c46fc6e8dce5760f74427c125a63261c4b908
child 500522 19e29511c546e968d4d0ef6469a114267f1fa415
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1499212
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499212 - suggest non-ASCII Assign for non-static-const same-char_type array parameters r=dbaron There is no advantage in AssignASCII() for char, and AssignASCII() does not exist for char16_t array and char_type. Similarly for ReplaceASCII and AppendASCII. This AssignLiteral() overload already says it is not only for ASCII. Depends on D8771 Differential Revision: https://phabricator.services.mozilla.com/D8773
xpcom/string/nsTSubstring.h
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -471,18 +471,18 @@ public:
     return AssignASCII(aData,
                        mozilla::AssertedCast<size_type, size_t>(strlen(aData)),
                        aFallible);
   }
 
   // AssignLiteral must ONLY be applied to an actual literal string, or
   // a character array *constant* declared without an explicit size.
   // Do not attempt to use it with a character array variable that is not
-  // constant or does not have static storage duration. Use AssignASCII for
-  // those.
+  // constant or does not have static storage duration. Use Assign or
+  // AssignASCII for those.
   //
   // This method does not need a fallible version, because it uses the
   // POD buffer of the literal as the string's buffer without allocating.
   // The literal does not need to be ASCII. If this a 16-bit string, this
   // method takes a u"" literal. (The overload on 16-bit strings that takes
   // a "" literal takes only ASCII.)
   template<int N>
   void AssignLiteral(const char_type (&aStr)[N])