Collapse variable initialisation & assignment into just init

* This doesn't make any difference but removes some warnings from PVS Studio and
  is slightly cleaner.
This commit is contained in:
baldurk
2020-01-21 18:28:56 +00:00
parent 4a779e371b
commit 6b1d186e6f
4 changed files with 7 additions and 14 deletions
+3 -4
View File
@@ -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;
+1 -3
View File
@@ -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")
+1 -2
View File
@@ -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))
{
+2 -5
View File
@@ -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);