setup_native/source/win32/customactions/shellextensions/upgrade.cxx |   14 
+++++-----
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit a116e4f1a7b9df4d9f67cdb146508abcfa5a25d5
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Nov 8 09:28:49 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Nov 9 07:36:06 2023 +0100

    loplugin:unnecessarygetstr (clang-cl)
    
    (Thanks to Mike Kaganski for noticing the gotcha here that a naive 
replacement
    with
    
    > std::wstring(const wstring& str, size_type pos)
    
    would do something rather different than
    
    > std::wstring(const wchar_t* s, size_type n)
    
    does.)
    
    Change-Id: I78837c014cdc154f276db1a11a87aaf74319a9fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159114
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git 
a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx 
b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
index 494cfaedad91..c06eb7a05bdd 100644
--- a/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/upgrade.cxx
@@ -30,11 +30,11 @@ namespace
         assert((guid.length() == 36) && "No GUID or wrong format!");
         assert(((index > -1) && (index < 5)) && "Out of range!");
 
-        if (index == 0) return std::wstring(guid.c_str(), 8);
-        if (index == 1) return std::wstring(guid.c_str() + 9, 4);
-        if (index == 2) return std::wstring(guid.c_str() + 14, 4);
-        if (index == 3) return std::wstring(guid.c_str() + 19, 4);
-        if (index == 4) return std::wstring(guid.c_str() + 24, 12);
+        if (index == 0) return guid.substr(0, 8);
+        if (index == 1) return guid.substr(9, 4);
+        if (index == 2) return guid.substr(14, 4);
+        if (index == 3) return guid.substr(19, 4);
+        if (index == 4) return guid.substr(24, 12);
 
         return std::wstring();
     }
@@ -80,8 +80,8 @@ namespace
         convertedGuid += Invert(part);
 
         part = GetGuidPart(guid, 3);
-        convertedGuid += Invert(std::wstring(part.c_str(), 2));
-        convertedGuid += Invert(std::wstring(part.c_str() + 2, 2));
+        convertedGuid += Invert(part.substr(0, 2));
+        convertedGuid += Invert(part.substr(2, 2));
 
         part = GetGuidPart(guid, 4);
         int pos = 0;

Reply via email to