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 490417 9469c37cc124badf9e8cfd29be4469f50a9c2c47
parent 490416 386c46fc6e8dce5760f74427c125a63261c4b908
child 490418 19e29511c546e968d4d0ef6469a114267f1fa415
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersdbaron
bugs1499212
milestone64.0a1
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])