Kernel: Add to_sv() helper for AML String
This commit is contained in:
parent
2259614640
commit
7eb186dad4
|
@ -72,6 +72,11 @@ namespace Kernel::ACPI::AML
|
|||
|
||||
struct Buffer
|
||||
{
|
||||
BAN::StringView as_sv() const
|
||||
{
|
||||
return BAN::StringView(reinterpret_cast<const char*>(bytes), size);
|
||||
}
|
||||
|
||||
uint64_t size;
|
||||
uint32_t ref_count;
|
||||
uint8_t bytes[];
|
||||
|
@ -335,12 +340,7 @@ namespace BAN::Formatter
|
|||
print(putc, "<integer 0x{H}>", node.as.integer.value);
|
||||
break;
|
||||
case Kernel::ACPI::AML::Node::Type::String:
|
||||
print(putc, "<string '{}'>",
|
||||
BAN::StringView(
|
||||
reinterpret_cast<const char*>(node.as.str_buf->bytes),
|
||||
node.as.str_buf->size
|
||||
)
|
||||
);
|
||||
print(putc, "<string '{}'>", node.as.str_buf->as_sv());
|
||||
break;
|
||||
case Kernel::ACPI::AML::Node::Type::Package:
|
||||
print(putc, "{}", *node.as.package);
|
||||
|
|
|
@ -1507,10 +1507,7 @@ namespace Kernel::ACPI::AML
|
|||
return {};
|
||||
};
|
||||
|
||||
auto source_sv = BAN::StringView(
|
||||
reinterpret_cast<const char*>(source.as.str_buf->bytes),
|
||||
source.as.str_buf->size
|
||||
);
|
||||
auto source_sv = source.as.str_buf->as_sv();
|
||||
|
||||
while (!source_sv.empty() && !isdigit(source_sv[0]) && source_sv[0] != '-' && source_sv[0] != '+')
|
||||
source_sv = source_sv.substring(1);
|
||||
|
|
Loading…
Reference in New Issue