зеркало из https://github.com/microsoft/DirectXTK.git
Additional C++ Core Checker cleanup
This commit is contained in:
Родитель
0f7afb3337
Коммит
a0dfe4d697
|
@ -77,20 +77,20 @@ namespace DirectX
|
|||
|
||||
uint8_t* get() const
|
||||
{
|
||||
return reinterpret_cast<uint8_t*>(pData);
|
||||
return static_cast<uint8_t*>(pData);
|
||||
}
|
||||
uint8_t* get(size_t slice) const
|
||||
{
|
||||
return reinterpret_cast<uint8_t*>(pData) + (slice * DepthPitch);
|
||||
return static_cast<uint8_t*>(pData) + (slice * DepthPitch);
|
||||
}
|
||||
|
||||
uint8_t* scanline(size_t row) const
|
||||
{
|
||||
return reinterpret_cast<uint8_t*>(pData) + (row * RowPitch);
|
||||
return static_cast<uint8_t*>(pData) + (row * RowPitch);
|
||||
}
|
||||
uint8_t* scanline(size_t slice, size_t row) const
|
||||
{
|
||||
return reinterpret_cast<uint8_t*>(pData) + (slice * DepthPitch) + (row * RowPitch);
|
||||
return static_cast<uint8_t*>(pData) + (slice * DepthPitch) + (row * RowPitch);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace DirectX
|
|||
deviceContext->Map(mConstantBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)
|
||||
);
|
||||
|
||||
*(T*)mappedResource.pData = value;
|
||||
*static_cast<T*>(mappedResource.pData) = value;
|
||||
|
||||
deviceContext->Unmap(mConstantBuffer.Get(), 0);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace
|
|||
|
||||
assert(index < mipCount * arraySize);
|
||||
_Analysis_assume_(index < mipCount * arraySize);
|
||||
initData[index].pSysMem = reinterpret_cast<const void*>(pSrcBits);
|
||||
initData[index].pSysMem = pSrcBits;
|
||||
initData[index].SysMemPitch = static_cast<UINT>(RowBytes);
|
||||
initData[index].SysMemSlicePitch = static_cast<UINT>(NumBytes);
|
||||
++index;
|
||||
|
@ -402,7 +402,7 @@ namespace
|
|||
if ((header->ddspf.flags & DDS_FOURCC) &&
|
||||
(MAKEFOURCC('D', 'X', '1', '0') == header->ddspf.fourCC))
|
||||
{
|
||||
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>((const char*)header + sizeof(DDS_HEADER));
|
||||
auto d3d10ext = reinterpret_cast<const DDS_HEADER_DXT10*>(reinterpret_cast<const char*>(header) + sizeof(DDS_HEADER));
|
||||
|
||||
arraySize = d3d10ext->arraySize;
|
||||
if (arraySize == 0)
|
||||
|
|
|
@ -779,7 +779,7 @@ void DGSLEffect::SetLightEnabled(int whichLight, bool value)
|
|||
|
||||
if (value)
|
||||
{
|
||||
if (whichLight >= (int)pImpl->constants.light.ActiveLights)
|
||||
if (whichLight >= static_cast<int>(pImpl->constants.light.ActiveLights))
|
||||
pImpl->constants.light.ActiveLights = static_cast<UINT>(whichLight + 1);
|
||||
|
||||
pImpl->constants.light.LightColor[whichLight] = pImpl->lightDiffuseColor[whichLight];
|
||||
|
|
|
@ -371,7 +371,7 @@ std::unique_ptr<Model> DirectX::Model::CreateFromCMO(ID3D11Device* d3dDevice, co
|
|||
}
|
||||
|
||||
// Skeletal data?
|
||||
auto bSkeleton = reinterpret_cast<const BYTE*>(meshData + usedSize);
|
||||
const BYTE* bSkeleton = meshData + usedSize;
|
||||
usedSize += sizeof(BYTE);
|
||||
if (dataSize < usedSize)
|
||||
throw std::exception("End of file");
|
||||
|
|
|
@ -440,7 +440,7 @@ std::unique_ptr<Model> DirectX::Model::CreateFromSDKMESH(ID3D11Device* d3dDevice
|
|||
|
||||
materialFlags[j] = flags;
|
||||
|
||||
auto verts = reinterpret_cast<const uint8_t*>(bufferData + (vh.DataOffset - bufferDataOffset));
|
||||
auto verts = bufferData + (vh.DataOffset - bufferDataOffset);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
|
@ -472,7 +472,7 @@ std::unique_ptr<Model> DirectX::Model::CreateFromSDKMESH(ID3D11Device* d3dDevice
|
|||
if (ih.IndexType != DXUT::IT_16BIT && ih.IndexType != DXUT::IT_32BIT)
|
||||
throw std::exception("Invalid index buffer type found");
|
||||
|
||||
auto indices = reinterpret_cast<const uint8_t*>(bufferData + (ih.DataOffset - bufferDataOffset));
|
||||
auto indices = bufferData + (ih.DataOffset - bufferDataOffset);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
|
|
|
@ -332,7 +332,7 @@ void PrimitiveBatchBase::Impl::Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIn
|
|||
// Copy over the index data.
|
||||
if (isIndexed)
|
||||
{
|
||||
auto outputIndices = reinterpret_cast<uint16_t*>(mMappedIndices.pData) + mCurrentIndex;
|
||||
auto outputIndices = static_cast<uint16_t*>(mMappedIndices.pData) + mCurrentIndex;
|
||||
|
||||
for (size_t i = 0; i < indexCount; i++)
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ void PrimitiveBatchBase::Impl::Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIn
|
|||
}
|
||||
|
||||
// Return the output vertex data location.
|
||||
*pMappedVertices = reinterpret_cast<uint8_t*>(mMappedVertices.pData) + (mCurrentVertex * mVertexSize);
|
||||
*pMappedVertices = static_cast<uint8_t*>(mMappedVertices.pData) + (mCurrentVertex * mVertexSize);
|
||||
|
||||
mCurrentVertex += vertexCount;
|
||||
#endif
|
||||
|
|
|
@ -252,7 +252,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
|
|||
memcpy_s(&header->ddspf, sizeof(header->ddspf), &DDSPF_DX10, sizeof(DDS_PIXELFORMAT));
|
||||
|
||||
headerSize += sizeof(DDS_HEADER_DXT10);
|
||||
extHeader = reinterpret_cast<DDS_HEADER_DXT10*>(reinterpret_cast<uint8_t*>(&fileHeader[0]) + sizeof(uint32_t) + sizeof(DDS_HEADER));
|
||||
extHeader = reinterpret_cast<DDS_HEADER_DXT10*>(fileHeader + sizeof(uint32_t) + sizeof(DDS_HEADER));
|
||||
memset(extHeader, 0, sizeof(DDS_HEADER_DXT10));
|
||||
extHeader->dxgiFormat = desc.Format;
|
||||
extHeader->resourceDimension = D3D11_RESOURCE_DIMENSION_TEXTURE2D;
|
||||
|
@ -284,7 +284,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
auto sptr = reinterpret_cast<const uint8_t*>(mapped.pData);
|
||||
auto sptr = static_cast<const uint8_t*>(mapped.pData);
|
||||
if (!sptr)
|
||||
{
|
||||
pContext->Unmap(pStaging.Get(), 0);
|
||||
|
@ -596,7 +596,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||
ComPtr<IWICBitmap> source;
|
||||
hr = pWIC->CreateBitmapFromMemory(desc.Width, desc.Height, pfGuid,
|
||||
mapped.RowPitch, mapped.RowPitch * desc.Height,
|
||||
reinterpret_cast<BYTE*>(mapped.pData), source.GetAddressOf());
|
||||
static_cast<BYTE*>(mapped.pData), source.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pContext->Unmap(pStaging.Get(), 0);
|
||||
|
@ -636,7 +636,7 @@ HRESULT DirectX::SaveWICTextureToFile(
|
|||
else
|
||||
{
|
||||
// No conversion required
|
||||
hr = frame->WritePixels(desc.Height, mapped.RowPitch, mapped.RowPitch * desc.Height, reinterpret_cast<BYTE*>(mapped.pData));
|
||||
hr = frame->WritePixels(desc.Height, mapped.RowPitch, mapped.RowPitch * desc.Height, static_cast<BYTE*>(mapped.pData));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче