From 6b1d186e6febc7f79f9a05b224d08573be3a94db Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 21 Jan 2020 14:28:47 +0000 Subject: [PATCH] Collapse variable initialisation & assignment into just init * This doesn't make any difference but removes some warnings from PVS Studio and is slightly cleaner. --- qrenderdoc/Windows/MainWindow.cpp | 7 +++---- renderdoc/android/android_patch.cpp | 4 +--- renderdoc/driver/d3d11/d3d11_resources.cpp | 3 +-- renderdoc/os/win32/win32_hook.cpp | 7 ++----- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index cea243e31..dd14707c8 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -979,8 +979,6 @@ bool MainWindow::PromptCloseCapture() } else if(m_Ctx.GetCaptureModifications() != CaptureModifications::NoModifications) { - QMessageBox::StandardButton res = QMessageBox::No; - QString text = tr("This capture has the following modifications:\n\n"); CaptureModifications mods = m_Ctx.GetCaptureModifications(); @@ -1005,8 +1003,9 @@ bool MainWindow::PromptCloseCapture() tr("\nThe capture is on a remote host, would you like to save these changes locally?"); } - res = RDDialog::question(this, tr("Save changes to capture?"), text, - QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::StandardButton res = + RDDialog::question(this, tr("Save changes to capture?"), text, + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(res == QMessageBox::Cancel) return false; diff --git a/renderdoc/android/android_patch.cpp b/renderdoc/android/android_patch.cpp index 48e8533f0..0e1f01a97 100644 --- a/renderdoc/android/android_patch.cpp +++ b/renderdoc/android/android_patch.cpp @@ -447,13 +447,11 @@ bool HasRootAccess(const rdcstr &deviceID) { RDCLOG("Checking for root access on %s", deviceID.c_str()); - Process::ProcessResult result = {}; - // Try switching adb to root and check a few indicators for success // Nothing will fall over if we get a false positive here, it just enables // additional methods of getting things set up. - result = adbExecCommand(deviceID, "root"); + Process::ProcessResult result = adbExecCommand(deviceID, "root"); rdcstr whoami = adbExecCommand(deviceID, "shell whoami").strStdout.trimmed(); if(whoami == "root") diff --git a/renderdoc/driver/d3d11/d3d11_resources.cpp b/renderdoc/driver/d3d11/d3d11_resources.cpp index a44436099..b4caceed5 100644 --- a/renderdoc/driver/d3d11/d3d11_resources.cpp +++ b/renderdoc/driver/d3d11/d3d11_resources.cpp @@ -256,9 +256,8 @@ ResourcePitch GetResourcePitchForSubresource(ID3D11DeviceContext *ctx, ID3D11Res { ResourcePitch pitch = {}; D3D11_MAPPED_SUBRESOURCE mapped = {}; - HRESULT hr = E_INVALIDARG; - hr = ctx->Map(res, Subresource, D3D11_MAP_READ, 0, &mapped); + HRESULT hr = ctx->Map(res, Subresource, D3D11_MAP_READ, 0, &mapped); if(FAILED(hr)) { diff --git a/renderdoc/os/win32/win32_hook.cpp b/renderdoc/os/win32/win32_hook.cpp index f52533b3f..f23388b37 100644 --- a/renderdoc/os/win32/win32_hook.cpp +++ b/renderdoc/os/win32/win32_hook.cpp @@ -63,9 +63,7 @@ bool ApplyHook(FunctionHook &hook, void **IATentry, bool &already) s_InstalledHooks[IATentry] = *IATentry; } - BOOL success = TRUE; - - success = VirtualProtect(IATentry, sizeof(void *), PAGE_READWRITE, &oldProtection); + BOOL success = VirtualProtect(IATentry, sizeof(void *), PAGE_READWRITE, &oldProtection); if(!success) { RDCERR("Failed to make IAT entry writeable 0x%p", IATentry); @@ -918,11 +916,10 @@ void LibraryHooks::RemoveHooks() for(auto it = s_InstalledHooks.begin(); it != s_InstalledHooks.end(); ++it) { DWORD oldProtection = PAGE_EXECUTE; - BOOL success = TRUE; void **IATentry = it->first; - success = VirtualProtect(IATentry, sizeof(void *), PAGE_READWRITE, &oldProtection); + BOOL success = VirtualProtect(IATentry, sizeof(void *), PAGE_READWRITE, &oldProtection); if(!success) { RDCERR("Failed to make IAT entry writeable 0x%p", IATentry);