From 24fce057730dd026f478ff99c298bc587bced217 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 21 Dec 2017 12:18:36 +0000 Subject: [PATCH] [Coverity] Initialise some uninitialised values --- renderdoc/driver/d3d12/d3d12_debug.h | 30 +++++++++++----------- renderdoc/driver/gl/gl_program_iterate.cpp | 9 +++++-- renderdoc/os/win32/win32_network.cpp | 2 +- renderdoc/replay/capture_file.cpp | 2 ++ 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_debug.h b/renderdoc/driver/d3d12/d3d12_debug.h index 9454610dd..756252c83 100644 --- a/renderdoc/driver/d3d12/d3d12_debug.h +++ b/renderdoc/driver/d3d12/d3d12_debug.h @@ -274,10 +274,10 @@ private: ID3D12RootSignature *m_HistogramRootSig = NULL; // one per texture type, one per int/uint/float - ID3D12PipelineState *m_TileMinMaxPipe[10][3]; - ID3D12PipelineState *m_HistogramPipe[10][3]; + ID3D12PipelineState *m_TileMinMaxPipe[10][3] = {}; + ID3D12PipelineState *m_HistogramPipe[10][3] = {}; // one per int/uint/float - ID3D12PipelineState *m_ResultMinMaxPipe[3]; + ID3D12PipelineState *m_ResultMinMaxPipe[3] = {}; ID3D12Resource *m_MinMaxResultBuffer = NULL; ID3D12Resource *m_MinMaxTileBuffer = NULL; @@ -387,9 +387,9 @@ private: map m_CachedMeshPipelines; static const uint32_t m_MaxMeshPicks = 500; - ID3D12Resource *m_PickVB; - uint32_t m_PickSize; - ID3D12Resource *m_PickResultBuf; + ID3D12Resource *m_PickVB = NULL; + uint32_t m_PickSize = 0; + ID3D12Resource *m_PickResultBuf = NULL; uint64_t m_SOBufferSize = 128; ID3D12Resource *m_SOBuffer = NULL; @@ -400,22 +400,22 @@ private: map m_PostVSData; map m_PostVSAlias; - ID3D12Resource *m_CustomShaderTex; + ID3D12Resource *m_CustomShaderTex = NULL; ResourceId m_CustomShaderResourceId; HighlightCache m_HighlightCache; - int m_width, m_height; + int m_width = 1, m_height = 1; - uint64_t m_OutputWindowID; - uint64_t m_DSVID; - uint64_t m_CurrentOutputWindow; + uint64_t m_OutputWindowID = 0; + uint64_t m_DSVID = 0; + uint64_t m_CurrentOutputWindow = 0; map m_OutputWindows; - WrappedID3D12Device *m_WrappedDevice; - ID3D12Device *m_Device; + WrappedID3D12Device *m_WrappedDevice = NULL; + ID3D12Device *m_Device = NULL; - IDXGIFactory4 *m_pFactory; + IDXGIFactory4 *m_pFactory = NULL; - D3D12ResourceManager *m_ResourceManager; + D3D12ResourceManager *m_ResourceManager = NULL; }; diff --git a/renderdoc/driver/gl/gl_program_iterate.cpp b/renderdoc/driver/gl/gl_program_iterate.cpp index 6e6be7d08..28cc1b9fa 100644 --- a/renderdoc/driver/gl/gl_program_iterate.cpp +++ b/renderdoc/driver/gl/gl_program_iterate.cpp @@ -29,7 +29,12 @@ struct ProgramUniformValue { - ProgramUniformValue() { RDCEraseEl(data); } + ProgramUniformValue() + { + Type = eGL_NONE; + Location = 0; + RDCEraseEl(data); + } GLenum Type; int32_t Location; @@ -47,7 +52,7 @@ DECLARE_REFLECTION_STRUCT(ProgramUniformValue); struct ProgramUniform { std::string Basename; - bool IsArray; + bool IsArray = false; std::vector Values; }; diff --git a/renderdoc/os/win32/win32_network.cpp b/renderdoc/os/win32/win32_network.cpp index d9b902203..f2456410a 100644 --- a/renderdoc/os/win32/win32_network.cpp +++ b/renderdoc/os/win32/win32_network.cpp @@ -393,7 +393,7 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS) int result = connect(s, ptr->ai_addr, (int)ptr->ai_addrlen); if(result == SOCKET_ERROR) { - fd_set setW, setE; + fd_set setW = {}, setE = {}; FD_ZERO(&setW); FD_ZERO(&setE); diff --git a/renderdoc/replay/capture_file.cpp b/renderdoc/replay/capture_file.cpp index 6f04b8f4e..96028d97d 100644 --- a/renderdoc/replay/capture_file.cpp +++ b/renderdoc/replay/capture_file.cpp @@ -590,6 +590,8 @@ Thumbnail CaptureFile::GetThumbnail(FileType type, uint32_t maxsize) { RDCERR("Unsupported file type %d in thumbnail fetch", type); free(thumbpixels); + ret.width = 0; + ret.height = 0; return ret; } }