mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:27:35 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -141,7 +141,7 @@ ErrorOr<void, ValidationError> AbstractMachine::validate(Module& module)
|
|||
InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<ExternValue> externs)
|
||||
{
|
||||
if (auto result = validate(const_cast<Module&>(module)); result.is_error())
|
||||
return InstantiationError { DeprecatedString::formatted("Validation failed: {}", result.error()) };
|
||||
return InstantiationError { ByteString::formatted("Validation failed: {}", result.error()) };
|
||||
|
||||
auto main_module_instance_pointer = make<ModuleInstance>();
|
||||
auto& main_module_instance = *main_module_instance_pointer;
|
||||
|
@ -187,7 +187,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
});
|
||||
auto result = config.execute(interpreter).assert_wasm_result();
|
||||
if (result.is_trap())
|
||||
instantiation_result = InstantiationError { DeprecatedString::formatted("Global value construction trapped: {}", result.trap().reason) };
|
||||
instantiation_result = InstantiationError { ByteString::formatted("Global value construction trapped: {}", result.trap().reason) };
|
||||
else
|
||||
global_values.append(result.values().first());
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
});
|
||||
auto result = config.execute(interpreter).assert_wasm_result();
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { DeprecatedString::formatted("Element construction trapped: {}", result.trap().reason) };
|
||||
instantiation_result = InstantiationError { ByteString::formatted("Element construction trapped: {}", result.trap().reason) };
|
||||
return IterationDecision::Continue;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
});
|
||||
auto result = config.execute(interpreter).assert_wasm_result();
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { DeprecatedString::formatted("Element section initialisation trapped: {}", result.trap().reason) };
|
||||
instantiation_result = InstantiationError { ByteString::formatted("Element section initialisation trapped: {}", result.trap().reason) };
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
auto d = result.values().first().to<i32>();
|
||||
|
@ -327,7 +327,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
});
|
||||
auto result = config.execute(interpreter).assert_wasm_result();
|
||||
if (result.is_trap()) {
|
||||
instantiation_result = InstantiationError { DeprecatedString::formatted("Data section initialisation trapped: {}", result.trap().reason) };
|
||||
instantiation_result = InstantiationError { ByteString::formatted("Data section initialisation trapped: {}", result.trap().reason) };
|
||||
return;
|
||||
}
|
||||
size_t offset = 0;
|
||||
|
@ -339,7 +339,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
return;
|
||||
if (main_module_instance.memories().size() <= data.index.value()) {
|
||||
instantiation_result = InstantiationError {
|
||||
DeprecatedString::formatted("Data segment referenced out-of-bounds memory ({}) of max {} entries",
|
||||
ByteString::formatted("Data segment referenced out-of-bounds memory ({}) of max {} entries",
|
||||
data.index.value(), main_module_instance.memories().size())
|
||||
};
|
||||
return;
|
||||
|
@ -358,7 +358,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
if (auto max = instance->type().limits().max(); max.has_value()) {
|
||||
if (*max * Constants::page_size < data.init.size() + offset) {
|
||||
instantiation_result = InstantiationError {
|
||||
DeprecatedString::formatted("Data segment attempted to write to out-of-bounds memory ({}) of max {} bytes",
|
||||
ByteString::formatted("Data segment attempted to write to out-of-bounds memory ({}) of max {} bytes",
|
||||
data.init.size() + offset, instance->type().limits().max().value())
|
||||
};
|
||||
return;
|
||||
|
@ -384,7 +384,7 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
auto& functions = main_module_instance.functions();
|
||||
auto index = section.function().index();
|
||||
if (functions.size() <= index.value()) {
|
||||
instantiation_result = InstantiationError { DeprecatedString::formatted("Start section function referenced invalid index {} of max {} entries", index.value(), functions.size()) };
|
||||
instantiation_result = InstantiationError { ByteString::formatted("Start section function referenced invalid index {} of max {} entries", index.value(), functions.size()) };
|
||||
return;
|
||||
}
|
||||
invoke(functions[index.value()], {});
|
||||
|
|
|
@ -24,13 +24,13 @@ class Configuration;
|
|||
struct Interpreter;
|
||||
|
||||
struct InstantiationError {
|
||||
DeprecatedString error { "Unknown error" };
|
||||
ByteString error { "Unknown error" };
|
||||
};
|
||||
struct LinkError {
|
||||
enum OtherErrors {
|
||||
InvalidImportedModule,
|
||||
};
|
||||
Vector<DeprecatedString> missing_imports;
|
||||
Vector<ByteString> missing_imports;
|
||||
Vector<OtherErrors> other_errors;
|
||||
};
|
||||
|
||||
|
@ -192,7 +192,7 @@ private:
|
|||
};
|
||||
|
||||
struct Trap {
|
||||
DeprecatedString reason;
|
||||
ByteString reason;
|
||||
};
|
||||
|
||||
// A variant of Result that does not include external reasons for error (JS::Completion, for now).
|
||||
|
@ -270,7 +270,7 @@ using ExternValue = Variant<FunctionAddress, TableAddress, MemoryAddress, Global
|
|||
|
||||
class ExportInstance {
|
||||
public:
|
||||
explicit ExportInstance(DeprecatedString name, ExternValue value)
|
||||
explicit ExportInstance(ByteString name, ExternValue value)
|
||||
: m_name(move(name))
|
||||
, m_value(move(value))
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ public:
|
|||
auto& value() const { return m_value; }
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
ByteString m_name;
|
||||
ExternValue m_value;
|
||||
};
|
||||
|
||||
|
@ -633,8 +633,8 @@ private:
|
|||
class Linker {
|
||||
public:
|
||||
struct Name {
|
||||
DeprecatedString module;
|
||||
DeprecatedString name;
|
||||
ByteString module;
|
||||
ByteString name;
|
||||
ImportSection::Import::ImportDesc type;
|
||||
};
|
||||
|
||||
|
|
|
@ -1250,7 +1250,7 @@ void BytecodeInterpreter::interpret(Configuration& configuration, InstructionPoi
|
|||
default:
|
||||
unimplemented:;
|
||||
dbgln_if(WASM_TRACE_DEBUG, "Instruction '{}' not implemented", instruction_name(instruction.opcode()));
|
||||
m_trap = Trap { DeprecatedString::formatted("Unimplemented instruction {}", instruction_name(instruction.opcode())) };
|
||||
m_trap = Trap { ByteString::formatted("Unimplemented instruction {}", instruction_name(instruction.opcode())) };
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,12 @@ struct BytecodeInterpreter : public Interpreter {
|
|||
virtual void interpret(Configuration&) override;
|
||||
virtual ~BytecodeInterpreter() override = default;
|
||||
virtual bool did_trap() const override { return !m_trap.has<Empty>(); }
|
||||
virtual DeprecatedString trap_reason() const override
|
||||
virtual ByteString trap_reason() const override
|
||||
{
|
||||
return m_trap.visit(
|
||||
[](Empty) -> DeprecatedString { VERIFY_NOT_REACHED(); },
|
||||
[](Empty) -> ByteString { VERIFY_NOT_REACHED(); },
|
||||
[](Trap const& trap) { return trap.reason; },
|
||||
[](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().to_deprecated_string(); });
|
||||
[](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().to_byte_string(); });
|
||||
}
|
||||
virtual void clear_trap() override { m_trap = Empty {}; }
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ struct Interpreter {
|
|||
virtual ~Interpreter() = default;
|
||||
virtual void interpret(Configuration&) = 0;
|
||||
virtual bool did_trap() const = 0;
|
||||
virtual DeprecatedString trap_reason() const = 0;
|
||||
virtual ByteString trap_reason() const = 0;
|
||||
virtual void clear_trap() = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ ErrorOr<void, ValidationError> Validator::validate(Limits const& limits, size_t
|
|||
template<u64 opcode>
|
||||
ErrorOr<void, ValidationError> Validator::validate_instruction(Instruction const& instruction, Stack&, bool&)
|
||||
{
|
||||
return Errors::invalid(DeprecatedString::formatted("instruction opcode (0x{:x}) (missing validation!)", instruction.opcode().value()));
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode (0x{:x}) (missing validation!)", instruction.opcode().value()));
|
||||
}
|
||||
|
||||
#define VALIDATE_INSTRUCTION(name) \
|
||||
|
@ -3774,7 +3774,7 @@ ErrorOr<void, ValidationError> Validator::validate(Instruction const& instructio
|
|||
#undef M
|
||||
default:
|
||||
is_constant = false;
|
||||
return Errors::invalid(DeprecatedString::formatted("instruction opcode (0x{:x})", instruction.opcode().value()));
|
||||
return Errors::invalid(ByteString::formatted("instruction opcode (0x{:x})", instruction.opcode().value()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3851,16 +3851,16 @@ bool Validator::Stack::operator==(Stack const& other) const
|
|||
return true;
|
||||
}
|
||||
|
||||
DeprecatedString Validator::Errors::find_instruction_name(SourceLocation const& location)
|
||||
ByteString Validator::Errors::find_instruction_name(SourceLocation const& location)
|
||||
{
|
||||
auto index = location.function_name().find('<');
|
||||
auto end_index = location.function_name().find('>');
|
||||
if (!index.has_value() || !end_index.has_value())
|
||||
return DeprecatedString::formatted("{}", location);
|
||||
return ByteString::formatted("{}", location);
|
||||
|
||||
auto opcode = location.function_name().substring_view(index.value() + 1, end_index.value() - index.value() - 1).to_uint();
|
||||
if (!opcode.has_value())
|
||||
return DeprecatedString::formatted("{}", location);
|
||||
return ByteString::formatted("{}", location);
|
||||
|
||||
return instruction_name(OpCode { *opcode });
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ struct Context {
|
|||
};
|
||||
|
||||
struct ValidationError : public Error {
|
||||
ValidationError(DeprecatedString error)
|
||||
ValidationError(ByteString error)
|
||||
: Error(Error::from_string_view(error.view()))
|
||||
, error_string(move(error))
|
||||
{
|
||||
}
|
||||
|
||||
DeprecatedString error_string;
|
||||
ByteString error_string;
|
||||
};
|
||||
|
||||
class Validator {
|
||||
|
@ -267,27 +267,27 @@ private:
|
|||
}
|
||||
|
||||
struct Errors {
|
||||
static ValidationError invalid(StringView name) { return DeprecatedString::formatted("Invalid {}", name); }
|
||||
static ValidationError invalid(StringView name) { return ByteString::formatted("Invalid {}", name); }
|
||||
|
||||
template<typename Expected, typename Given>
|
||||
static ValidationError invalid(StringView name, Expected expected, Given given, SourceLocation location = SourceLocation::current())
|
||||
{
|
||||
if constexpr (WASM_VALIDATOR_DEBUG)
|
||||
return DeprecatedString::formatted("Invalid {} in {}, expected {} but got {}", name, find_instruction_name(location), expected, given);
|
||||
return ByteString::formatted("Invalid {} in {}, expected {} but got {}", name, find_instruction_name(location), expected, given);
|
||||
else
|
||||
return DeprecatedString::formatted("Invalid {}, expected {} but got {}", name, expected, given);
|
||||
return ByteString::formatted("Invalid {}, expected {} but got {}", name, expected, given);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
static ValidationError non_conforming_types(StringView name, Args... args)
|
||||
{
|
||||
return DeprecatedString::formatted("Non-conforming types for {}: {}", name, Vector { args... });
|
||||
return ByteString::formatted("Non-conforming types for {}: {}", name, Vector { args... });
|
||||
}
|
||||
|
||||
static ValidationError duplicate_export_name(StringView name) { return DeprecatedString::formatted("Duplicate exported name '{}'", name); }
|
||||
static ValidationError duplicate_export_name(StringView name) { return ByteString::formatted("Duplicate exported name '{}'", name); }
|
||||
|
||||
template<typename T, typename U, typename V>
|
||||
static ValidationError out_of_bounds(StringView name, V value, T min, U max) { return DeprecatedString::formatted("Value {} for {} is out of bounds ({},{})", value, name, min, max); }
|
||||
static ValidationError out_of_bounds(StringView name, V value, T min, U max) { return ByteString::formatted("Value {} for {} is out of bounds ({},{})", value, name, min, max); }
|
||||
|
||||
template<typename... Expected>
|
||||
static ValidationError invalid_stack_state(Stack const& stack, Tuple<Expected...> expected, SourceLocation location = SourceLocation::current())
|
||||
|
@ -318,11 +318,11 @@ private:
|
|||
}
|
||||
}
|
||||
builder.append(']');
|
||||
return { builder.to_deprecated_string() };
|
||||
return { builder.to_byte_string() };
|
||||
}
|
||||
|
||||
private:
|
||||
static DeprecatedString find_instruction_name(SourceLocation const&);
|
||||
static ByteString find_instruction_name(SourceLocation const&);
|
||||
};
|
||||
|
||||
enum class ChildScopeKind {
|
||||
|
|
|
@ -75,14 +75,14 @@ static auto parse_vector(Stream& stream)
|
|||
}
|
||||
}
|
||||
|
||||
static ParseResult<DeprecatedString> parse_name(Stream& stream)
|
||||
static ParseResult<ByteString> parse_name(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
auto data = parse_vector<u8>(stream);
|
||||
if (data.is_error())
|
||||
return data.error();
|
||||
|
||||
return DeprecatedString::copy(data.value());
|
||||
return ByteString::copy(data.value());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
@ -1725,7 +1725,7 @@ bool Module::populate_sections()
|
|||
return is_ok;
|
||||
}
|
||||
|
||||
DeprecatedString parse_error_to_deprecated_string(ParseError error)
|
||||
ByteString parse_error_to_byte_string(ParseError error)
|
||||
{
|
||||
switch (error) {
|
||||
case ParseError::UnexpectedEof:
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
namespace Wasm {
|
||||
|
||||
struct Names {
|
||||
static HashMap<OpCode, DeprecatedString> instruction_names;
|
||||
static HashMap<DeprecatedString, OpCode> instructions_by_name;
|
||||
static HashMap<OpCode, ByteString> instruction_names;
|
||||
static HashMap<ByteString, OpCode> instructions_by_name;
|
||||
};
|
||||
|
||||
DeprecatedString instruction_name(OpCode const& opcode)
|
||||
ByteString instruction_name(OpCode const& opcode)
|
||||
{
|
||||
return Names::instruction_names.get(opcode).value_or("<unknown>");
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ void Printer::print(Wasm::DataSection::Data const& data)
|
|||
[this](DataSection::Data::Passive const& value) {
|
||||
print_indent();
|
||||
print("(passive init {}xu8 (", value.init.size());
|
||||
print(DeprecatedString::join(' ', value.init, "{:x}"sv));
|
||||
print(ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print(")\n");
|
||||
},
|
||||
[this](DataSection::Data::Active const& value) {
|
||||
print_indent();
|
||||
print("(active init {}xu8 (", value.init.size());
|
||||
print(DeprecatedString::join(' ', value.init, "{:x}"sv));
|
||||
print(ByteString::join(' ', value.init, "{:x}"sv));
|
||||
print("\n");
|
||||
{
|
||||
TemporaryChange change { m_indent, m_indent + 1 };
|
||||
|
@ -450,7 +450,7 @@ void Printer::print(Wasm::Instruction const& instruction)
|
|||
TemporaryChange change { m_indent, m_indent + 1 };
|
||||
print(args.block_type);
|
||||
print_indent();
|
||||
print("(else {}) (end {}))", args.else_ip.has_value() ? DeprecatedString::number(args.else_ip->value()) : "(none)", args.end_ip.value());
|
||||
print("(else {}) (end {}))", args.else_ip.has_value() ? ByteString::number(args.else_ip->value()) : "(none)", args.end_ip.value());
|
||||
},
|
||||
[&](Instruction::TableBranchArgs const& args) {
|
||||
print("(table_branch");
|
||||
|
@ -650,15 +650,15 @@ void Printer::print(Wasm::Value const& value)
|
|||
print_indent();
|
||||
print("{} ", value.value().visit([&]<typename T>(T const& value) {
|
||||
if constexpr (IsSame<Wasm::Reference, T>) {
|
||||
return DeprecatedString::formatted(
|
||||
return ByteString::formatted(
|
||||
"addr({})",
|
||||
value.ref().visit(
|
||||
[](Wasm::Reference::Null const&) { return DeprecatedString("null"); },
|
||||
[](auto const& ref) { return DeprecatedString::number(ref.address.value()); }));
|
||||
[](Wasm::Reference::Null const&) { return ByteString("null"); },
|
||||
[](auto const& ref) { return ByteString::number(ref.address.value()); }));
|
||||
} else if constexpr (IsSame<u128, T>) {
|
||||
return DeprecatedString::formatted("v128({:x})", value);
|
||||
return ByteString::formatted("v128({:x})", value);
|
||||
} else {
|
||||
return DeprecatedString::formatted("{}", value);
|
||||
return ByteString::formatted("{}", value);
|
||||
}
|
||||
}));
|
||||
TemporaryChange<size_t> change { m_indent, 0 };
|
||||
|
@ -671,12 +671,12 @@ void Printer::print(Wasm::Reference const& value)
|
|||
print(
|
||||
"addr({})\n",
|
||||
value.ref().visit(
|
||||
[](Wasm::Reference::Null const&) { return DeprecatedString("null"); },
|
||||
[](auto const& ref) { return DeprecatedString::number(ref.address.value()); }));
|
||||
[](Wasm::Reference::Null const&) { return ByteString("null"); },
|
||||
[](auto const& ref) { return ByteString::number(ref.address.value()); }));
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<Wasm::OpCode, DeprecatedString> Wasm::Names::instruction_names {
|
||||
HashMap<Wasm::OpCode, ByteString> Wasm::Names::instruction_names {
|
||||
{ Instructions::unreachable, "unreachable" },
|
||||
{ Instructions::nop, "nop" },
|
||||
{ Instructions::block, "block" },
|
||||
|
@ -1115,4 +1115,4 @@ HashMap<Wasm::OpCode, DeprecatedString> Wasm::Names::instruction_names {
|
|||
{ Instructions::structured_else, "synthetic:else" },
|
||||
{ Instructions::structured_end, "synthetic:end" },
|
||||
};
|
||||
HashMap<DeprecatedString, Wasm::OpCode> Wasm::Names::instructions_by_name;
|
||||
HashMap<ByteString, Wasm::OpCode> Wasm::Names::instructions_by_name;
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Wasm {
|
|||
class Reference;
|
||||
class Value;
|
||||
|
||||
DeprecatedString instruction_name(OpCode const& opcode);
|
||||
ByteString instruction_name(OpCode const& opcode);
|
||||
Optional<OpCode> instruction_from_name(StringView name);
|
||||
|
||||
struct Printer {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/DistinctNumeric.h>
|
||||
#include <AK/LEB128.h>
|
||||
#include <AK/Result.h>
|
||||
|
@ -55,7 +55,7 @@ enum class ParseError {
|
|||
NotImplemented,
|
||||
};
|
||||
|
||||
DeprecatedString parse_error_to_deprecated_string(ParseError);
|
||||
ByteString parse_error_to_byte_string(ParseError);
|
||||
|
||||
template<typename T>
|
||||
using ParseResult = Result<T, ParseError>;
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
|
||||
static ParseResult<ValueType> parse(Stream& stream);
|
||||
|
||||
static DeprecatedString kind_name(Kind kind)
|
||||
static ByteString kind_name(Kind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case I32:
|
||||
|
@ -501,7 +501,7 @@ class CustomSection {
|
|||
public:
|
||||
static constexpr u8 section_id = 0;
|
||||
|
||||
CustomSection(DeprecatedString name, ByteBuffer contents)
|
||||
CustomSection(ByteString name, ByteBuffer contents)
|
||||
: m_name(move(name))
|
||||
, m_contents(move(contents))
|
||||
{
|
||||
|
@ -513,7 +513,7 @@ public:
|
|||
static ParseResult<CustomSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
ByteString m_name;
|
||||
ByteBuffer m_contents;
|
||||
};
|
||||
|
||||
|
@ -539,7 +539,7 @@ public:
|
|||
class Import {
|
||||
public:
|
||||
using ImportDesc = Variant<TypeIndex, TableType, MemoryType, GlobalType, FunctionType>;
|
||||
Import(DeprecatedString module, DeprecatedString name, ImportDesc description)
|
||||
Import(ByteString module, ByteString name, ImportDesc description)
|
||||
: m_module(move(module))
|
||||
, m_name(move(name))
|
||||
, m_description(move(description))
|
||||
|
@ -562,8 +562,8 @@ public:
|
|||
return Import { module.release_value(), name.release_value(), result.release_value() };
|
||||
}
|
||||
|
||||
DeprecatedString m_module;
|
||||
DeprecatedString m_name;
|
||||
ByteString m_module;
|
||||
ByteString m_name;
|
||||
ImportDesc m_description;
|
||||
};
|
||||
|
||||
|
@ -724,7 +724,7 @@ private:
|
|||
public:
|
||||
class Export {
|
||||
public:
|
||||
explicit Export(DeprecatedString name, ExportDesc description)
|
||||
explicit Export(ByteString name, ExportDesc description)
|
||||
: m_name(move(name))
|
||||
, m_description(move(description))
|
||||
{
|
||||
|
@ -736,7 +736,7 @@ public:
|
|||
static ParseResult<Export> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
ByteString m_name;
|
||||
ExportDesc m_description;
|
||||
};
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ public:
|
|||
void set_validation_status(ValidationStatus status, Badge<Validator>) { set_validation_status(status); }
|
||||
ValidationStatus validation_status() const { return m_validation_status; }
|
||||
StringView validation_error() const { return *m_validation_error; }
|
||||
void set_validation_error(DeprecatedString error) { m_validation_error = move(error); }
|
||||
void set_validation_error(ByteString error) { m_validation_error = move(error); }
|
||||
|
||||
static ParseResult<Module> parse(Stream& stream);
|
||||
|
||||
|
@ -1088,6 +1088,6 @@ private:
|
|||
Vector<AnySection> m_sections;
|
||||
Vector<Function> m_functions;
|
||||
ValidationStatus m_validation_status { ValidationStatus::Unchecked };
|
||||
Optional<DeprecatedString> m_validation_error;
|
||||
Optional<ByteString> m_validation_error;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -519,7 +519,7 @@ ErrorOr<Result<FileStat>> Implementation::impl$path_filestat_get(Configuration&
|
|||
[&](PreopenedDirectoryDescriptor descriptor) {
|
||||
auto& entry = preopened_directories()[descriptor.value()];
|
||||
dir_fd = entry.opened_fd.value_or_lazy_evaluated([&] {
|
||||
DeprecatedString path = entry.host_path.string();
|
||||
ByteString path = entry.host_path.string();
|
||||
return open(path.characters(), O_DIRECTORY, 0);
|
||||
});
|
||||
entry.opened_fd = dir_fd;
|
||||
|
@ -537,7 +537,7 @@ ErrorOr<Result<FileStat>> Implementation::impl$path_filestat_get(Configuration&
|
|||
options |= AT_SYMLINK_NOFOLLOW;
|
||||
|
||||
auto slice = TRY(slice_typed_memory(configuration, path, path_len));
|
||||
auto null_terminated_string = DeprecatedString::copy(slice);
|
||||
auto null_terminated_string = ByteString::copy(slice);
|
||||
|
||||
struct stat stat_buf;
|
||||
if (fstatat(dir_fd, null_terminated_string.characters(), &stat_buf, options) < 0)
|
||||
|
@ -582,7 +582,7 @@ ErrorOr<Result<void>> Implementation::impl$path_create_directory(Configuration&
|
|||
[&](PreopenedDirectoryDescriptor descriptor) {
|
||||
auto& entry = preopened_directories()[descriptor.value()];
|
||||
dir_fd = entry.opened_fd.value_or_lazy_evaluated([&] {
|
||||
DeprecatedString path = entry.host_path.string();
|
||||
ByteString path = entry.host_path.string();
|
||||
return open(path.characters(), O_DIRECTORY, 0);
|
||||
});
|
||||
entry.opened_fd = dir_fd;
|
||||
|
@ -596,7 +596,7 @@ ErrorOr<Result<void>> Implementation::impl$path_create_directory(Configuration&
|
|||
return errno_value_from_errno(errno);
|
||||
|
||||
auto slice = TRY(slice_typed_memory(configuration, path, path_len));
|
||||
auto null_terminated_string = DeprecatedString::copy(slice);
|
||||
auto null_terminated_string = ByteString::copy(slice);
|
||||
|
||||
if (mkdirat(dir_fd, null_terminated_string.characters(), 0755) < 0)
|
||||
return errno_value_from_errno(errno);
|
||||
|
@ -613,7 +613,7 @@ ErrorOr<Result<FD>> Implementation::impl$path_open(Configuration& configuration,
|
|||
[&](PreopenedDirectoryDescriptor descriptor) {
|
||||
auto& entry = preopened_directories()[descriptor.value()];
|
||||
dir_fd = entry.opened_fd.value_or_lazy_evaluated([&] {
|
||||
DeprecatedString path = entry.host_path.string();
|
||||
ByteString path = entry.host_path.string();
|
||||
return open(path.characters(), O_DIRECTORY, 0);
|
||||
});
|
||||
entry.opened_fd = dir_fd;
|
||||
|
@ -649,7 +649,7 @@ ErrorOr<Result<FD>> Implementation::impl$path_open(Configuration& configuration,
|
|||
open_flags |= O_NOFOLLOW;
|
||||
|
||||
auto path_data = TRY(slice_typed_memory(configuration, path, path_len));
|
||||
auto path_string = DeprecatedString::copy(path_data);
|
||||
auto path_string = ByteString::copy(path_data);
|
||||
|
||||
dbgln_if(WASI_FINE_GRAINED_DEBUG, "path_open: dir_fd={}, path={}, open_flags={}", dir_fd, path_string, open_flags);
|
||||
|
||||
|
@ -705,7 +705,7 @@ ErrorOr<Result<FileStat>> Implementation::impl$fd_filestat_get(Configuration&, F
|
|||
[&](PreopenedDirectoryDescriptor descriptor) {
|
||||
auto& entry = preopened_directories()[descriptor.value()];
|
||||
resolved_fd = entry.opened_fd.value_or_lazy_evaluated([&] {
|
||||
DeprecatedString path = entry.host_path.string();
|
||||
ByteString path = entry.host_path.string();
|
||||
return open(path.characters(), O_DIRECTORY, 0);
|
||||
});
|
||||
entry.opened_fd = resolved_fd;
|
||||
|
@ -937,7 +937,7 @@ struct InvocationOf<impl> {
|
|||
auto result = args.apply_as_args([&](auto&&... impl_args) { return (self.*impl)(configuration, impl_args...); });
|
||||
dbgln_if(WASI_DEBUG, "WASI: {}({}) = {}", function_name, arguments, result);
|
||||
if (result.is_error())
|
||||
return Wasm::Trap { DeprecatedString::formatted("Invalid call to {}() = {}", function_name, result.error()) };
|
||||
return Wasm::Trap { ByteString::formatted("Invalid call to {}() = {}", function_name, result.error()) };
|
||||
|
||||
auto value = result.release_value();
|
||||
if (value.is_error())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue