diff --git a/DDSTextureLoader/DDSTextureLoader12.cpp b/DDSTextureLoader/DDSTextureLoader12.cpp index 26b49d7..4d2a3a5 100644 --- a/DDSTextureLoader/DDSTextureLoader12.cpp +++ b/DDSTextureLoader/DDSTextureLoader12.cpp @@ -1035,7 +1035,7 @@ namespace D3D12_SUBRESOURCE_DATA res = { - reinterpret_cast(pSrcBits), + pSrcBits, static_cast(RowBytes), static_cast(NumBytes) }; @@ -1126,7 +1126,8 @@ namespace IID_ID3D12Resource, reinterpret_cast(texture)); if (SUCCEEDED(hr)) { - _Analysis_assume_(*texture != nullptr); + assert(texture != nullptr && *texture != nullptr); + _Analysis_assume_(texture != nullptr && *texture != nullptr); SetDebugObjectName(*texture, L"DDSTextureLoader"); } @@ -1166,7 +1167,7 @@ namespace if ((header->ddspf.flags & DDS_FOURCC) && (MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC)) { - auto d3d10ext = reinterpret_cast(reinterpret_cast(header) + sizeof(DDS_HEADER)); + auto d3d10ext = reinterpret_cast(reinterpret_cast(header) + sizeof(DDS_HEADER)); arraySize = d3d10ext->arraySize; if (arraySize == 0) @@ -1427,7 +1428,7 @@ namespace _In_ ID3D12Resource** texture) noexcept { #if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) ) - if (texture) + if (texture && *texture) { const wchar_t* pstrName = wcsrchr(fileName, '\\'); if (!pstrName) @@ -1439,10 +1440,7 @@ namespace pstrName++; } - if (texture && *texture) - { - (*texture)->SetName(pstrName); - } + (*texture)->SetName(pstrName); } #else UNREFERENCED_PARAMETER(fileName); diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 3b5b4a3..2f50209 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -952,7 +952,7 @@ HRESULT DirectX::SaveWICTextureToFile( return hr; // Determine source format's WIC equivalent - WICPixelFormatGUID pfGuid; + WICPixelFormatGUID pfGuid = {}; bool sRGB = forceSRGB; switch ( desc.Format ) { @@ -1060,7 +1060,7 @@ HRESULT DirectX::SaveWICTextureToFile( return hr; // Pick a target format - WICPixelFormatGUID targetGuid; + WICPixelFormatGUID targetGuid = {}; if ( targetFormat ) { targetGuid = *targetFormat; diff --git a/ScreenGrab/ScreenGrab12.cpp b/ScreenGrab/ScreenGrab12.cpp index b2604b6..c51c5a6 100644 --- a/ScreenGrab/ScreenGrab12.cpp +++ b/ScreenGrab/ScreenGrab12.cpp @@ -1094,7 +1094,7 @@ HRESULT DirectX::SaveWICTextureToFile( return hr; // Determine source format's WIC equivalent - WICPixelFormatGUID pfGuid; + WICPixelFormatGUID pfGuid = {}; bool sRGB = forceSRGB; switch ( desc.Format ) { @@ -1202,7 +1202,7 @@ HRESULT DirectX::SaveWICTextureToFile( return hr; // Pick a target format - WICPixelFormatGUID targetGuid; + WICPixelFormatGUID targetGuid = {}; if ( targetFormat ) { targetGuid = *targetFormat;