mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
AK: Stop using DeprecatedString
in UUID
This commit is contained in:
parent
f050a426f5
commit
99c1b634fc
Notes:
sideshowbarker
2024-07-17 08:25:15 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/99c1b634fc Pull-request: https://github.com/SerenityOS/serenity/pull/16580 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Hendiadyoin1
23
AK/UUID.cpp
23
AK/UUID.cpp
@ -97,19 +97,20 @@ ErrorOr<NonnullOwnPtr<Kernel::KString>> UUID::to_string() const
|
||||
return Kernel::KString::try_create(builder.string_view());
|
||||
}
|
||||
#else
|
||||
DeprecatedString UUID::to_deprecated_string() const
|
||||
ErrorOr<String> UUID::to_string() const
|
||||
{
|
||||
auto buffer_span = m_uuid_buffer.span();
|
||||
StringBuilder builder(36);
|
||||
builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(4).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(6).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(8).trim(2)).view());
|
||||
builder.append('-');
|
||||
builder.append(encode_hex(m_uuid_buffer.span().slice(10).trim(6)).view());
|
||||
return builder.to_deprecated_string();
|
||||
TRY(builder.try_append(encode_hex(buffer_span.trim(4)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(4, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(6, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(8, 2)).view()));
|
||||
TRY(builder.try_append('-'));
|
||||
TRY(builder.try_append(encode_hex(buffer_span.slice(10, 6)).view()));
|
||||
return builder.to_string();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/KString.h>
|
||||
#else
|
||||
# include <AK/DeprecatedString.h>
|
||||
# include <AK/String.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
@ -36,7 +36,7 @@ public:
|
||||
#ifdef KERNEL
|
||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> to_string() const;
|
||||
#else
|
||||
DeprecatedString to_deprecated_string() const;
|
||||
ErrorOr<String> to_string() const;
|
||||
#endif
|
||||
bool is_zero() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user