https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a58aee5f5b673e5e44985df30d9ed892a216edf4

commit a58aee5f5b673e5e44985df30d9ed892a216edf4
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Sat Nov 18 11:23:13 2023 +0900
Commit:     Katayama Hirofumi MZ <[email protected]>
CommitDate: Sat Nov 18 11:23:13 2023 +0900

    [MSPAINT] Use Swap in RegistrySettings::SetMostRecentFile
    
    CORE-19237
---
 base/applications/mspaint/common.h     | 2 +-
 base/applications/mspaint/registry.cpp | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/base/applications/mspaint/common.h 
b/base/applications/mspaint/common.h
index e15297e115b..7f640110806 100644
--- a/base/applications/mspaint/common.h
+++ b/base/applications/mspaint/common.h
@@ -51,7 +51,7 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName);
 #define RAD2DEG(radian) ((LONG)(((radian) * 180) / M_PI))
 
 template <typename T>
-void Swap(T& a, T& b)
+inline void Swap(T& a, T& b)
 {
     T tmp = a;
     a = b;
diff --git a/base/applications/mspaint/registry.cpp 
b/base/applications/mspaint/registry.cpp
index 68c54f5201c..6302555c41b 100644
--- a/base/applications/mspaint/registry.cpp
+++ b/base/applications/mspaint/registry.cpp
@@ -264,11 +264,7 @@ void RegistrySettings::SetMostRecentFile(LPCWSTR 
szPathName)
             iFound = i;
 
         if (iFound >= 0)
-        {
-            CStringW tmp = strFiles[i];
-            strFiles[i] = strFiles[i - 1];
-            strFiles[i - 1] = tmp;
-        }
+            Swap(strFiles[i], strFiles[i - 1]);
     }
 
     // If szPathName is not the first item in strFiles, insert it at the top 
of the list

Reply via email to