Bug 1166955 - Stop including nsAutoPtr.h from BasePin.cpp. r=jesup
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 03 Jun 2017 17:59:29 +0900
changeset 412676 ae2ff08a40b08c7d4712d22b6d830439ed1058a7
parent 412675 a570baba745802f0c028e035bda9d5cb0a7f8e0c
child 412677 78450dd743b92638cdcf70b16c0850214782eff4
child 412689 350993973191e37ef5d4da63ebf9bfa1ab726759
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1166955
milestone55.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 1166955 - Stop including nsAutoPtr.h from BasePin.cpp. r=jesup MozReview-Commit-ID: CCvJyVmH1JI
media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp
--- a/media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
 #include <assert.h>
-#include "nsAutoPtr.h"
+#include <algorithm>
 #include "BasePin.h"
 
 namespace mozilla {
 namespace media {
 
 // Implements IEnumMediaTypes for nsBasePin::EnumMediaTypes().
 // Does not support dynamic media types.
 //
@@ -209,17 +209,17 @@ BasePin::QueryPinInfo(PIN_INFO * aInfo)
   aInfo->pFilter = mFilter;
   if (mFilter) {
     mFilter->AddRef();
   }
 
   if (!mName.empty()) {
     // Copy at most (max_buffer_size - sizeof(WCHAR)). The -1 is there to
     // ensure we always have a null terminator.
-    unsigned int len = PR_MIN((MAX_PIN_NAME-1)*sizeof(WCHAR), (sizeof(WCHAR)*mName.length()));
+    size_t len = std::min<size_t>(MAX_PIN_NAME - 1, mName.length()) * sizeof(WCHAR);
     memcpy(aInfo->achName, mName.data(), len);
   }
 
   aInfo->dir = mDirection;
 
   return NOERROR;
 }
 
@@ -271,17 +271,17 @@ BasePin::EnumMediaTypes(IEnumMediaTypes 
     return E_POINTER;
 
   *aEnum = new mozilla::media::EnumMediaTypes(this);
 
   if (*aEnum == NULL)
     return E_OUTOFMEMORY;
 
   // Must addref, caller's responsibility to release.
-  NS_ADDREF(*aEnum);
+  (*aEnum)->AddRef();
 
   return S_OK;
 }
 
 
 // Base class returns an error; we expect sub-classes to override this.
 HRESULT
 BasePin::GetMediaType(int, MediaType*)