1
0
Fork 0
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:
stelar7 2023-04-03 18:53:29 +02:00 committed by Ali Mohammad Pur
parent 8273fc230c
commit b1d80b35af
Notes: sideshowbarker 2024-07-17 00:47:29 +09:00

View file

@ -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())