Address code analysis warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-06-14 14:51:26 +02:00
parent 1ba18f48c6
commit 33e2ac3da4
2 changed files with 9 additions and 8 deletions

View File

@ -345,6 +345,7 @@ namespace winstd
/// ///
/// Moves VARIANT from another /// Moves VARIANT from another
/// ///
#pragma warning(suppress: 26495) // vt member is initialized as a result of memcpy()
inline variant(_Inout_ VARIANT&& varSrc) inline variant(_Inout_ VARIANT&& varSrc)
{ {
memcpy(this, &varSrc, sizeof(VARIANT)); memcpy(this, &varSrc, sizeof(VARIANT));
@ -532,13 +533,13 @@ namespace winstd
assert(pSrc != NULL); assert(pSrc != NULL);
LPSAFEARRAY pCopy; LPSAFEARRAY pCopy;
HRESULT hRes = SafeArrayCopy((LPSAFEARRAY)pSrc, &pCopy); HRESULT hr = SafeArrayCopy((LPSAFEARRAY)pSrc, &pCopy);
if (SUCCEEDED(hRes)) { if (FAILED(hr))
SafeArrayGetVartype((LPSAFEARRAY)pSrc, &vt); throw winstd::com_runtime_error(hr, "SafeArrayCopy failed.");
vt |= VT_ARRAY;
parray = pCopy; SafeArrayGetVartype((LPSAFEARRAY)pSrc, &vt);
} else vt |= VT_ARRAY;
assert(0); parray = pCopy;
} }
/// ///

View File

@ -496,7 +496,7 @@ namespace winstd
/// ///
/// Delete a pointer /// Delete a pointer
/// ///
void operator()(_Ty *_Ptr) const void operator()(_Frees_ptr_opt_ _Ty *_Ptr) const
{ {
LocalFree(_Ptr); LocalFree(_Ptr);
} }