[Analyzers][CPP]Turn on warning 26410 (#22744)

This commit is contained in:
sosssego 2022-12-18 11:46:06 +00:00 committed by GitHub
parent d1b55d9ff4
commit 617150cf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 20 deletions

View File

@ -20,7 +20,7 @@
<Rule Id="C26407" Action="Error" />
<Rule Id="C26408" Action="Info" />
<Rule Id="C26409" Action="Info" />
<Rule Id="C26410" Action="Info" />
<Rule Id="C26410" Action="Error" />
<Rule Id="C26411" Action="Error" />
<Rule Id="C26414" Action="Info" />
<Rule Id="C26415" Action="Info" />

View File

@ -212,7 +212,7 @@ namespace FancyZonesUnitTests
RECT{ .left = 0, .top = 0, .right = 1920, .bottom = 1080 }
};
void checkZones(const std::unique_ptr<Layout>& layout, ZoneSetLayoutType type, size_t expectedCount, RECT rect)
void checkZones(const Layout* layout, ZoneSetLayoutType type, size_t expectedCount, RECT rect)
{
const auto& zones = layout->Zones();
Assert::AreEqual(expectedCount, zones.size());
@ -259,7 +259,7 @@ namespace FancyZonesUnitTests
auto layout = std::make_unique<Layout>(data);
auto result = layout->Init(rect, Mocks::Monitor());
Assert::IsTrue(result);
checkZones(layout, static_cast<ZoneSetLayoutType>(type), zoneCount, rect);
checkZones(layout.get(), static_cast<ZoneSetLayoutType>(type), zoneCount, rect);
}
}
}
@ -294,7 +294,7 @@ namespace FancyZonesUnitTests
auto layout = std::make_unique<Layout>(data);
auto result = layout->Init(rect, Mocks::Monitor());
Assert::IsTrue(result);
checkZones(layout, static_cast<ZoneSetLayoutType>(type), data.zoneCount, rect);
checkZones(layout.get(), static_cast<ZoneSetLayoutType>(type), data.zoneCount, rect);
}
}
}
@ -413,7 +413,7 @@ namespace FancyZonesUnitTests
auto layout = std::make_unique<Layout>(data);
auto result = layout->Init(rect, Mocks::Monitor());
Assert::IsTrue(result);
checkZones(layout, static_cast<ZoneSetLayoutType>(type), zoneCount, rect);
checkZones(layout.get(), static_cast<ZoneSetLayoutType>(type), zoneCount, rect);
}
}
}

View File

@ -36,11 +36,6 @@ wil::com_ptr_nothrow<IMemAllocator> GetPinAllocator(wil::com_ptr_nothrow<IPin>&
return nullptr;
}
unique_media_type_ptr CopyMediaType(const unique_media_type_ptr& source)
{
return CopyMediaType(source.get());
}
void MyFreeMediaType(AM_MEDIA_TYPE& mt)
{
if (mt.cbFormat != 0)
@ -79,7 +74,7 @@ HRESULT MediaTypeEnumerator::Next(ULONG cObjects, AM_MEDIA_TYPE** outObjects, UL
ULONG toFetch = cObjects;
while (toFetch-- && _pos < _objects.size())
{
auto copy = CopyMediaType(_objects[_pos++]);
auto copy = CopyMediaType(_objects[_pos++].get());
outObjects[fetched++] = copy.release();
}
@ -109,7 +104,7 @@ HRESULT MediaTypeEnumerator::Clone(IEnumMediaTypes** ppEnum)
cloned->_objects.resize(_objects.size());
for (size_t i = 0; i < _objects.size(); ++i)
{
cloned->_objects[i] = CopyMediaType(_objects[i]);
cloned->_objects[i] = CopyMediaType(_objects[i].get());
}
cloned->_pos = _pos;

View File

@ -17,7 +17,6 @@ void MyDeleteMediaType(AM_MEDIA_TYPE* pmt);
using unique_media_type_ptr =
wistd::unique_ptr<AM_MEDIA_TYPE, wil::function_deleter<decltype(&MyDeleteMediaType), MyDeleteMediaType>>;
unique_media_type_ptr CopyMediaType(const unique_media_type_ptr& source);
unique_media_type_ptr CopyMediaType(const AM_MEDIA_TYPE* source);
template<typename ObjectInterface, typename EnumeratorInterface>

View File

@ -187,7 +187,7 @@ struct VideoCaptureReceiverPin : winrt::implements<VideoCaptureReceiverPin, IPin
return VFW_E_NOT_CONNECTED;
}
*pmt = *CopyMediaType(_inputCaptureMediaType).release();
*pmt = *CopyMediaType(_inputCaptureMediaType.get()).release();
return S_OK;
}
@ -261,7 +261,7 @@ struct VideoCaptureReceiverPin : winrt::implements<VideoCaptureReceiverPin, IPin
}
auto enumerator = winrt::make_self<MediaTypeEnumerator>();
enumerator->_objects.emplace_back(CopyMediaType(_expectedMediaType));
enumerator->_objects.emplace_back(CopyMediaType(_expectedMediaType.get()));
*ppEnum = enumerator.detach();
return S_OK;

View File

@ -128,7 +128,7 @@ HRESULT VideoCaptureProxyPin::ConnectionMediaType(AM_MEDIA_TYPE* pmt)
return VFW_E_NOT_CONNECTED;
}
*pmt = *CopyMediaType(_mediaFormat).release();
*pmt = *CopyMediaType(_mediaFormat.get()).release();
return S_OK;
}
@ -196,7 +196,7 @@ HRESULT VideoCaptureProxyPin::EnumMediaTypes(IEnumMediaTypes** ppEnum)
*ppEnum = nullptr;
auto enumerator = winrt::make_self<MediaTypeEnumerator>();
enumerator->_objects.emplace_back(CopyMediaType(_mediaFormat));
enumerator->_objects.emplace_back(CopyMediaType(_mediaFormat.get()));
*ppEnum = enumerator.detach();
return S_OK;
@ -251,7 +251,7 @@ HRESULT VideoCaptureProxyPin::GetFormat(AM_MEDIA_TYPE** ppmt)
LOG("VideoCaptureProxyPin::GetFormat FAILED ppmt");
return E_POINTER;
}
*ppmt = CopyMediaType(_mediaFormat).release();
*ppmt = CopyMediaType(_mediaFormat.get()).release();
return S_OK;
}
@ -299,7 +299,7 @@ HRESULT VideoCaptureProxyPin::GetStreamCaps(int iIndex, AM_MEDIA_TYPE** ppmt, BY
caps.MinBitsPerSecond = vih->dwBitRate;
caps.MaxBitsPerSecond = caps.MinBitsPerSecond;
*ppmt = CopyMediaType(_mediaFormat).release();
*ppmt = CopyMediaType(_mediaFormat.get()).release();
const auto caps_begin = reinterpret_cast<const char*>(&caps);
std::copy(caps_begin, caps_begin + sizeof(caps), pSCC);
@ -765,7 +765,7 @@ HRESULT VideoCaptureProxyFilter::EnumPins(IEnumPins** ppEnum)
auto& webcam = webcams[*selectedCamIdx];
auto pin = winrt::make_self<VideoCaptureProxyPin>();
pin->_mediaFormat = CopyMediaType(webcam.bestFormat.mediaType);
pin->_mediaFormat = CopyMediaType(webcam.bestFormat.mediaType.get());
pin->_owningFilter = this;
_outPin.attach(pin.detach());