From d2d9fd69451275ea89fb27b333fc588a5b988621 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 10 Apr 2018 14:42:49 +0300 Subject: [PATCH] build: fix MSVS build problems with 'CL=/permissive-' --- modules/imgproc/src/color_lab.cpp | 2 +- modules/videoio/src/cap_msmf.cpp | 15 +++++++++++---- modules/videoio/src/cap_msmf.hpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/imgproc/src/color_lab.cpp b/modules/imgproc/src/color_lab.cpp index a61a116775..61e30a9dac 100644 --- a/modules/imgproc/src/color_lab.cpp +++ b/modules/imgproc/src/color_lab.cpp @@ -700,7 +700,7 @@ struct XYZ2RGB_f : dstcn(_dstcn), blueIdx(_blueIdx) { for(int i = 0; i < 9; i++) - coeffs[i] = _coeffs ? _coeffs[i] : XYZ2sRGB_D65[i]; + coeffs[i] = _coeffs ? _coeffs[i] : (float)XYZ2sRGB_D65[i]; if(blueIdx == 0) { std::swap(coeffs[0], coeffs[6]); diff --git a/modules/videoio/src/cap_msmf.cpp b/modules/videoio/src/cap_msmf.cpp index 8533bab81e..d4582d6f5e 100644 --- a/modules/videoio/src/cap_msmf.cpp +++ b/modules/videoio/src/cap_msmf.cpp @@ -543,7 +543,7 @@ public: // Getting frame rate, which is getting from videodevice with deviceID unsigned int getFrameRate(int deviceID) const; // Getting name of videodevice with deviceID - wchar_t *getNameVideoDevice(int deviceID); + const wchar_t *getNameVideoDevice(int deviceID); // Getting interface MediaSource for Media Foundation from videodevice with deviceID IMFMediaSource *getMediaSource(int deviceID); // Getting format with id, which is supported by videodevice with deviceID @@ -1371,8 +1371,10 @@ void ImageGrabberCallback::resumeGrabbing() HRESULT ImageGrabber::CreateTopology(IMFMediaSource *pSource, IMFActivate *pSinkActivate, IMFTopology **ppTopo) { + HRESULT hr = S_OK; + { // "done:" scope _ComPtr pPD = NULL; - HRESULT hr = !pSource ? E_POINTER : S_OK; CHECK_HR(hr); + hr = !pSource ? E_POINTER : S_OK; CHECK_HR(hr); CHECK_HR(hr = pSource->CreatePresentationDescriptor(pPD.GetAddressOf())); DWORD cStreams = 0; @@ -1455,6 +1457,7 @@ HRESULT ImageGrabber::CreateTopology(IMFMediaSource *pSource, IMFActivate *pSink else hr = E_INVALIDARG; + } // "done:" scope done: return hr; } @@ -2613,11 +2616,14 @@ HRESULT videoDevice::enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource HRESULT videoDevice::enumerateCaptureFormats(IMFMediaSource *pSource) { + HRESULT hr = S_OK; + { // "done:" scope + _ComPtr pPD = NULL; _ComPtr pSD = NULL; _ComPtr pHandler = NULL; _ComPtr pType = NULL; - HRESULT hr = !pSource ? E_POINTER : S_OK; + hr = !pSource ? E_POINTER : S_OK; if (FAILED(hr)) { goto done; @@ -2655,6 +2661,7 @@ HRESULT videoDevice::enumerateCaptureFormats(IMFMediaSource *pSource) vd_CurrentFormats.push_back(MT); } + } // "done:" scope done: return hr; } @@ -3234,7 +3241,7 @@ unsigned int videoInput::getFrameRate(int deviceID) const return 0; } -wchar_t *videoInput::getNameVideoDevice(int deviceID) +const wchar_t *videoInput::getNameVideoDevice(int deviceID) { if (deviceID < 0) { diff --git a/modules/videoio/src/cap_msmf.hpp b/modules/videoio/src/cap_msmf.hpp index cb0514f4af..2d48f86d94 100644 --- a/modules/videoio/src/cap_msmf.hpp +++ b/modules/videoio/src/cap_msmf.hpp @@ -2088,7 +2088,7 @@ template class ComPtrList : public List { public: - + typedef typename List::Node Node; typedef T* Ptr; void Clear()