diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-11-08 09:28:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-11-09 07:36:06 +0100 |
commit | a116e4f1a7b9df4d9f67cdb146508abcfa5a25d5 (patch) | |
tree | 414bc9d0db65bc4fa7d58144b60a1fde285427d3 /setup_native/source/win32/customactions | |
parent | 3a21ea3548abc8ba18bc50ba3d9f646e92ae7d5e (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'setup_native/source/win32/customactions')
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/upgrade.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
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; |