Bug 1166955 - Stop including nsAutoPtr.h from BasePin.cpp. r?jesup draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 03 Jun 2017 17:59:29 +0900
changeset 588585 5a82a02ec69cc2c12cdf5522c7e8813ff8b74de0
parent 588584 a09073e281bdf978e36275b1f373c3f70bbcc885
child 631627 490e4f7441f323b8b4fe541bcd47e522838d827c
push id62095
push userVYV03354@nifty.ne.jp
push dateSat, 03 Jun 2017 09:03:25 +0000
reviewersjesup
bugs1166955
milestone55.0a1
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*)