mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
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 f0b3aa0331
.
This commit is contained in:
parent
8105d3f3d6
commit
fee2a03ba9
Notes:
sideshowbarker
2024-07-18 04:56:36 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/fee2a03ba90 Pull-request: https://github.com/SerenityOS/serenity/pull/9720
2 changed files with 4 additions and 3 deletions
|
@ -515,7 +515,7 @@ InputStream& operator>>(InputStream& stream, String& string)
|
|||
}
|
||||
}
|
||||
|
||||
String String::vformatted(StringView fmtstr, TypeErasedFormatParams params)
|
||||
String String::vformatted(StringView fmtstr, TypeErasedFormatParams& params)
|
||||
{
|
||||
StringBuilder builder;
|
||||
vformat(builder, fmtstr, params);
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue