Bug 1305422 - part 11 - don't call size_forward in nsXPCOMStrings.cpp; r=erahm
authorNathan Froyd <froydnj@mozilla.com>
Thu, 29 Sep 2016 22:33:57 -0400
changeset 315882 088bfcd8f3cb583e0357c73b8ce03b8bea95df3d
parent 315881 32b8ba9f7a51219440ba512f2a120d0d85e139e5
child 315883 17a8607397e55ea4ea383beddc8969e0f5b78511
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1305422
milestone52.0a1
Bug 1305422 - part 11 - don't call size_forward in nsXPCOMStrings.cpp; r=erahm
xpcom/build/nsXPCOMStrings.cpp
--- a/xpcom/build/nsXPCOMStrings.cpp
+++ b/xpcom/build/nsXPCOMStrings.cpp
@@ -78,38 +78,34 @@ NS_StringContainerFinish(nsStringContain
 XPCOM_API(uint32_t)
 NS_StringGetData(const nsAString& aStr, const char16_t** aData,
                  bool* aTerminated)
 {
   if (aTerminated) {
     *aTerminated = aStr.IsTerminated();
   }
 
-  nsAString::const_iterator begin;
-  aStr.BeginReading(begin);
-  *aData = begin.get();
-  return begin.size_forward();
+  *aData = aStr.BeginReading();
+  return aStr.Length();
 }
 
 XPCOM_API(uint32_t)
 NS_StringGetMutableData(nsAString& aStr, uint32_t aDataLength,
                         char16_t** aData)
 {
   if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
-  nsAString::iterator begin;
-  aStr.BeginWriting(begin);
-  *aData = begin.get();
-  return begin.size_forward();
+  *aData = aStr.BeginWriting();
+  return aStr.Length();
 }
 
 XPCOM_API(char16_t*)
 NS_StringCloneData(const nsAString& aStr)
 {
   return ToNewUnicode(aStr);
 }
 
@@ -237,37 +233,33 @@ NS_CStringContainerFinish(nsCStringConta
 XPCOM_API(uint32_t)
 NS_CStringGetData(const nsACString& aStr, const char** aData,
                   bool* aTerminated)
 {
   if (aTerminated) {
     *aTerminated = aStr.IsTerminated();
   }
 
-  nsACString::const_iterator begin;
-  aStr.BeginReading(begin);
-  *aData = begin.get();
-  return begin.size_forward();
+  *aData = aStr.BeginReading();
+  return aStr.Length();
 }
 
 XPCOM_API(uint32_t)
 NS_CStringGetMutableData(nsACString& aStr, uint32_t aDataLength, char** aData)
 {
   if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
-  nsACString::iterator begin;
-  aStr.BeginWriting(begin);
-  *aData = begin.get();
-  return begin.size_forward();
+  *aData = aStr.BeginWriting();
+  return aStr.Length();
 }
 
 XPCOM_API(char*)
 NS_CStringCloneData(const nsACString& aStr)
 {
   return ToNewCString(aStr);
 }