From 7ec2c79e86bd5de9d85c392d7fcb1971f61dff1d Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 22 Nov 2017 11:59:18 +0000 Subject: [PATCH] Fix conditional branches on 'constant' values * Reported by Coverity Scan --- .../Windows/PipelineState/VulkanPipelineStateViewer.cpp | 9 ++------- renderdoc/serialise/serialiser.h | 2 ++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 3567494be..a8718ed68 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -1476,7 +1476,6 @@ void VulkanPipelineStateViewer::setState() int i = 0; for(const VKPipe::VertexAttribute &a : state.VI.attrs) { - bool filledSlot = true; bool usedSlot = false; QString name = tr("Attribute %1").arg(i); @@ -1494,7 +1493,7 @@ void VulkanPipelineStateViewer::setState() } } - if(showNode(usedSlot, filledSlot)) + if(showNode(usedSlot, /*filledSlot*/ true)) { RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, name, a.location, a.binding, a.format.Name(), a.byteoffset, QString()}); @@ -1886,10 +1885,9 @@ void VulkanPipelineStateViewer::setState() int i = 0; for(const VKPipe::Blend &blend : state.CB.attachments) { - bool filledSlot = true; bool usedSlot = (targets[i]); - if(showNode(usedSlot, filledSlot)) + if(showNode(usedSlot, /*filledSlot*/ true)) { RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, blend.blendEnable ? tr("True") : tr("False"), @@ -1906,9 +1904,6 @@ void VulkanPipelineStateViewer::setState() .arg((blend.writeMask & 0x4) == 0 ? lit("_") : lit("B")) .arg((blend.writeMask & 0x8) == 0 ? lit("_") : lit("A"))}); - if(!filledSlot) - setEmptyRow(node); - if(!usedSlot) setInactiveRow(node); diff --git a/renderdoc/serialise/serialiser.h b/renderdoc/serialise/serialiser.h index e57deff1d..f8c3fcd2d 100644 --- a/renderdoc/serialise/serialiser.h +++ b/renderdoc/serialise/serialiser.h @@ -299,11 +299,13 @@ public: m_StructureStack.pop_back(); } +#if !defined(__COVERITY__) if(tempAlloc) { FreeAlignedBuffer(tempAlloc); el = NULL; } +#endif return *this; }