mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibCrypto: Add ability to rewrite current tag kind
This is used for IMPLICIT tags where the expected kind is overriden by the encoding instructions.
This commit is contained in:
parent
8273fc230c
commit
b1d80b35af
Notes:
sideshowbarker
2024-07-17 00:47:29 +09:00
Author: https://github.com/stelar7
Commit: b1d80b35af
Pull-request: https://github.com/SerenityOS/serenity/pull/18166
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/fdellwing ✅
1 changed files with 19 additions and 0 deletions
|
@ -58,6 +58,25 @@ public:
|
|||
ValueType value;
|
||||
};
|
||||
|
||||
ErrorOr<void> rewrite_tag(Kind kind)
|
||||
{
|
||||
if (m_stack.is_empty())
|
||||
return Error::from_string_view("Nothing on stack to rewrite"sv);
|
||||
|
||||
if (eof())
|
||||
return Error::from_string_view("Stream is empty"sv);
|
||||
|
||||
if (m_current_tag.has_value()) {
|
||||
m_current_tag->kind = kind;
|
||||
return {};
|
||||
}
|
||||
|
||||
auto tag = TRY(read_tag());
|
||||
m_current_tag = tag;
|
||||
m_current_tag->kind = kind;
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> drop()
|
||||
{
|
||||
if (m_stack.is_empty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue