Bug 1166955 - Stop including nsAutoPtr.h from BasePin.cpp. r?jesup
MozReview-Commit-ID: CCvJyVmH1JI
--- 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*)