From 4be5fbc996a104b1ec99327a2e46f45d1aaeb58f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Aug 2020 21:26:06 +0300 Subject: Plugin Updater: more code cleaning --- plugins/PluginUpdater/pu_stub/src/pu_stub.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins/PluginUpdater/pu_stub/src') diff --git a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp index cca42b5c10..f93a07484d 100644 --- a/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp +++ b/plugins/PluginUpdater/pu_stub/src/pu_stub.cpp @@ -85,13 +85,15 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) case 2: // move if (!DeleteFileW(ptszFile2)) { - dwError = GetLastError(); - if (dwError != ERROR_ACCESS_DENIED && dwError != ERROR_FILE_NOT_FOUND) + DWORD err = GetLastError(); + if (err != ERROR_ACCESS_DENIED && err != ERROR_FILE_NOT_FOUND) { + dwError = err; break; + } } if (!MoveFileW(ptszFile1, ptszFile2)) { // use copy on error - switch (dwError = GetLastError()) { + switch (DWORD err = GetLastError()) { case ERROR_ALREADY_EXISTS: dwError = 0; break; // this file was included into many archives, so Miranda tries to move it again & again @@ -106,8 +108,10 @@ int APIENTRY wWinMain(HINSTANCE /*hInstance*/, HINSTANCE, LPTSTR lpCmdLine, int) if (!DeleteFileW(ptszFile1)) dwError = GetLastError(); + break; - dwError = 0; + default: + dwError = err; break; } } -- cgit v1.2.3