diff --git a/DirectXTex/BC6HBC7.cpp b/DirectXTex/BC6HBC7.cpp index 11bd283..605e93a 100644 --- a/DirectXTex/BC6HBC7.cpp +++ b/DirectXTex/BC6HBC7.cpp @@ -367,7 +367,7 @@ namespace DirectX } } - LDRColorA LDRColorA::operator = (_In_ const HDRColorA& c) + LDRColorA operator = (_In_ const HDRColorA& c) { LDRColorA ret; HDRColorA tmp(c); diff --git a/DirectXTex/DirectXTexWIC.cpp b/DirectXTex/DirectXTexWIC.cpp index 28a1a9c..35da881 100644 --- a/DirectXTex/DirectXTexWIC.cpp +++ b/DirectXTex/DirectXTexWIC.cpp @@ -574,7 +574,7 @@ namespace bool sRGB = IsSRGB(format); value.vt = VT_LPSTR; - value.pszVal = "DirectXTex"; + value.pszVal = const_cast("DirectXTex"); if (memcmp(&containerFormat, &GUID_ContainerFormatPng, sizeof(GUID)) == 0) { @@ -781,7 +781,7 @@ namespace { // Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel PROPBAG2 option = { 0 }; - option.pstrName = L"EnableV5Header32bppBGRA"; + option.pstrName = const_cast(L"EnableV5Header32bppBGRA"); VARIANT varValue; varValue.vt = VT_BOOL; diff --git a/ScreenGrab/ScreenGrab.cpp b/ScreenGrab/ScreenGrab.cpp index 3dbf652..dcd30af 100644 --- a/ScreenGrab/ScreenGrab.cpp +++ b/ScreenGrab/ScreenGrab.cpp @@ -211,7 +211,7 @@ namespace { if (m_handle) { - FILE_DISPOSITION_INFO info = {0}; + FILE_DISPOSITION_INFO info = {}; info.DeleteFile = TRUE; (void)SetFileInformationByHandle(m_handle, FileDispositionInfo, &info, sizeof(info)); } @@ -602,8 +602,8 @@ namespace HRESULT CaptureTexture( _In_ ID3D11DeviceContext* pContext, _In_ ID3D11Resource* pSource, - _Inout_ D3D11_TEXTURE2D_DESC& desc, - _Inout_ ComPtr& pStaging ) + D3D11_TEXTURE2D_DESC& desc, + ComPtr& pStaging ) { if ( !pContext || !pSource ) return E_INVALIDARG; @@ -615,7 +615,7 @@ namespace return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); ComPtr pTexture; - HRESULT hr = pSource->QueryInterface( IID_PPV_ARGS( pTexture.GetAddressOf() ) ); + HRESULT hr = pSource->QueryInterface(IID_PPV_ARGS(pTexture.GetAddressOf())); if ( FAILED(hr) ) return hr; @@ -663,7 +663,7 @@ namespace desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; desc.Usage = D3D11_USAGE_STAGING; - hr = d3dDevice->CreateTexture2D( &desc, 0, pStaging.GetAddressOf() ); + hr = d3dDevice->CreateTexture2D(&desc, 0, pStaging.ReleaseAndGetAddressOf()); if ( FAILED(hr) ) return hr; @@ -684,7 +684,7 @@ namespace desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; desc.Usage = D3D11_USAGE_STAGING; - hr = d3dDevice->CreateTexture2D( &desc, 0, pStaging.GetAddressOf() ); + hr = d3dDevice->CreateTexture2D(&desc, 0, pStaging.ReleaseAndGetAddressOf()); if ( FAILED(hr) ) return hr; @@ -756,7 +756,7 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, if ( !fileName ) return E_INVALIDARG; - D3D11_TEXTURE2D_DESC desc = { 0 }; + D3D11_TEXTURE2D_DESC desc = {}; ComPtr pStaging; HRESULT hr = CaptureTexture( pContext, pSource, desc, pStaging ); if ( FAILED(hr) ) @@ -891,13 +891,13 @@ HRESULT DirectX::SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, // Write header & pixels DWORD bytesWritten; - if ( !WriteFile( hFile.get(), fileHeader, static_cast( headerSize ), &bytesWritten, 0 ) ) + if ( !WriteFile( hFile.get(), fileHeader, static_cast( headerSize ), &bytesWritten, nullptr ) ) return HRESULT_FROM_WIN32( GetLastError() ); if ( bytesWritten != headerSize ) return E_FAIL; - if ( !WriteFile( hFile.get(), pixels.get(), static_cast( slicePitch ), &bytesWritten, 0 ) ) + if ( !WriteFile( hFile.get(), pixels.get(), static_cast( slicePitch ), &bytesWritten, nullptr ) ) return HRESULT_FROM_WIN32( GetLastError() ); if ( bytesWritten != slicePitch ) @@ -919,7 +919,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, if ( !fileName ) return E_INVALIDARG; - D3D11_TEXTURE2D_DESC desc = { 0 }; + D3D11_TEXTURE2D_DESC desc = {}; ComPtr pStaging; HRESULT hr = CaptureTexture( pContext, pSource, desc, pStaging ); if ( FAILED(hr) ) @@ -974,7 +974,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED ); } - IWICImagingFactory* pWIC = _GetWIC(); + auto pWIC = _GetWIC(); if ( !pWIC ) return E_NOINTERFACE; @@ -1007,8 +1007,8 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, if ( targetFormat && memcmp( &guidContainerFormat, &GUID_ContainerFormatBmp, sizeof(WICPixelFormatGUID) ) == 0 && g_WIC2 ) { // Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel - PROPBAG2 option = { 0 }; - option.pstrName = L"EnableV5Header32bppBGRA"; + PROPBAG2 option = {}; + option.pstrName = const_cast(L"EnableV5Header32bppBGRA"); VARIANT varValue; varValue.vt = VT_BOOL; @@ -1094,7 +1094,7 @@ HRESULT DirectX::SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, PropVariantInit( &value ); value.vt = VT_LPSTR; - value.pszVal = "DirectXTK"; + value.pszVal = const_cast("DirectXTK"); if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 ) { diff --git a/ScreenGrab/ScreenGrab12.cpp b/ScreenGrab/ScreenGrab12.cpp index 52266e2..4b5dfef 100644 --- a/ScreenGrab/ScreenGrab12.cpp +++ b/ScreenGrab/ScreenGrab12.cpp @@ -738,7 +738,7 @@ namespace &bufferDesc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, - IID_PPV_ARGS(pStaging.GetAddressOf())); + IID_PPV_ARGS(pStaging.ReleaseAndGetAddressOf())); if (FAILED(hr)) return hr; @@ -1113,7 +1113,7 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ, { // Opt-in to the WIC2 support for writing 32-bit Windows BMP files with an alpha channel PROPBAG2 option = {}; - option.pstrName = L"EnableV5Header32bppBGRA"; + option.pstrName = const_cast(L"EnableV5Header32bppBGRA"); VARIANT varValue; varValue.vt = VT_BOOL; @@ -1190,7 +1190,7 @@ HRESULT DirectX::SaveWICTextureToFile( ID3D12CommandQueue* pCommandQ, PropVariantInit( &value ); value.vt = VT_LPSTR; - value.pszVal = "DirectXTK"; + value.pszVal = const_cast("DirectXTK"); if ( memcmp( &guidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID) ) == 0 ) { diff --git a/Texconv/texconv.cpp b/Texconv/texconv.cpp index 829deea..30d101b 100644 --- a/Texconv/texconv.cpp +++ b/Texconv/texconv.cpp @@ -2334,7 +2334,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) { PROPBAG2 options = {}; VARIANT varValues = {}; - options.pstrName = L"ImageQuality"; + options.pstrName = const_cast(L"ImageQuality"); varValues.vt = VT_R4; varValues.fltVal = (wicLossless) ? 1.f : wicQuality; (void)props->Write(1, &options, &varValues); @@ -2347,13 +2347,13 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) VARIANT varValues = {}; if (wicLossless) { - options.pstrName = L"TiffCompressionMethod"; + options.pstrName = const_cast(L"TiffCompressionMethod"); varValues.vt = VT_UI1; varValues.bVal = WICTiffCompressionNone; } else if (wicQuality >= 0.f) { - options.pstrName = L"CompressionQuality"; + options.pstrName = const_cast(L"CompressionQuality"); varValues.vt = VT_R4; varValues.fltVal = wicQuality; } @@ -2369,13 +2369,13 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) VARIANT varValues = {}; if (wicLossless) { - options.pstrName = L"Lossless"; + options.pstrName = const_cast(L"Lossless"); varValues.vt = VT_BOOL; varValues.bVal = TRUE; } else if (wicQuality >= 0.f) { - options.pstrName = L"ImageQuality"; + options.pstrName = const_cast(L"ImageQuality"); varValues.vt = VT_R4; varValues.fltVal = wicQuality; } diff --git a/WICTextureLoader/WICTextureLoader.cpp b/WICTextureLoader/WICTextureLoader.cpp index 7f3b465..f4977a2 100644 --- a/WICTextureLoader/WICTextureLoader.cpp +++ b/WICTextureLoader/WICTextureLoader.cpp @@ -888,7 +888,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(ID3D11Device* d3dDevice, { if (texture != 0 || textureView != 0) { - CHAR strFileA[MAX_PATH]; + char strFileA[MAX_PATH]; int result = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, fileName, @@ -900,7 +900,7 @@ HRESULT DirectX::CreateWICTextureFromFileEx(ID3D11Device* d3dDevice, ); if (result > 0) { - const CHAR* pstrName = strrchr(strFileA, '\\'); + const char* pstrName = strrchr(strFileA, '\\'); if (!pstrName) { pstrName = strFileA;