bug 1198656 remove unnecessary reinterpret_casts r=padenot
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 21 Aug 2015 16:44:04 +1200
changeset 294334 2b9a5c8a0a4a31cfdac12d053a6649f967d3d257
parent 294333 0f7315aa8f6b51c3cba4ce568b60c49170a58c03
child 294335 b27cf1d8880741a8cab12cd7be23b6a084e08e35
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1198656
milestone43.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 1198656 remove unnecessary reinterpret_casts r=padenot JS_StealArrayBufferContents() returns void*.
dom/media/webaudio/AudioBuffer.cpp
--- a/dom/media/webaudio/AudioBuffer.cpp
+++ b/dom/media/webaudio/AudioBuffer.cpp
@@ -222,21 +222,22 @@ StealJSArrayDataIntoThreadSharedFloatArr
                                                      const nsTArray<JSObject*>& aJSArrays)
 {
   nsRefPtr<ThreadSharedFloatArrayBufferList> result =
     new ThreadSharedFloatArrayBufferList(aJSArrays.Length());
   for (uint32_t i = 0; i < aJSArrays.Length(); ++i) {
     JS::Rooted<JSObject*> arrayBufferView(aJSContext, aJSArrays[i]);
     JS::Rooted<JSObject*> arrayBuffer(aJSContext,
                                       JS_GetArrayBufferViewBuffer(aJSContext, arrayBufferView));
-    uint8_t* stolenData = arrayBuffer
-                          ? (uint8_t*) JS_StealArrayBufferContents(aJSContext, arrayBuffer)
-                          : nullptr;
+    auto stolenData = arrayBuffer
+      ? static_cast<float*>(JS_StealArrayBufferContents(aJSContext,
+                                                        arrayBuffer))
+      : nullptr;
     if (stolenData) {
-      result->SetData(i, stolenData, js_free, reinterpret_cast<float*>(stolenData));
+      result->SetData(i, stolenData, js_free, stolenData);
     } else {
       return nullptr;
     }
   }
   return result.forget();
 }
 
 ThreadSharedFloatArrayBufferList*