diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-31 21:44:05 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-01 18:06:14 +0200 |
commit | fee2a03ba908bcf7e3ffae0fafbd809257536c9d (patch) | |
tree | 7146db59ac45f8fca7dbf2c0521e2debf8fd3f00 /AK/String.h | |
parent | 8105d3f3d68e703e253182a8644ac3ce38bc66e9 (diff) | |
download | serenity-fee2a03ba908bcf7e3ffae0fafbd809257536c9d.zip |
AK: Pass AK::Format TypeErasedFormatParams by reference in AK::String
This silences a overeager warning in sonar cloud, warning that
slicing could occur with `VariadicFormatParams` which derives from
`TypeErasedFormatParams`.
Reference:
https://sonarcloud.io/project/issues?id=SerenityOS_serenity&issues=AXuVPBW3k92xXUF3qXTE&open=AXuVPBW3k92xXUF3qXTE
This is a continuation of f0b3aa033134b788a28fe8cf8ff6028d0e7941e8.
Diffstat (limited to 'AK/String.h')
-rw-r--r-- | AK/String.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/AK/String.h b/AK/String.h index 9bc3e5e2d1..f043729624 100644 --- a/AK/String.h +++ b/AK/String.h @@ -265,12 +265,13 @@ public: return String((const char*)buffer.data(), buffer.size(), should_chomp); } - [[nodiscard]] static String vformatted(StringView fmtstr, TypeErasedFormatParams); + [[nodiscard]] static String vformatted(StringView fmtstr, TypeErasedFormatParams&); template<typename... Parameters> [[nodiscard]] static String formatted(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { - return vformatted(fmtstr.view(), VariadicFormatParams { parameters... }); + VariadicFormatParams variadic_format_parameters { parameters... }; + return vformatted(fmtstr.view(), variadic_format_parameters); } template<typename T> |