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