mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Everywhere: Remove the AK::
qualifier from Stream usages
This commit is contained in:
parent
874c7bba28
commit
43f98ac6e1
Notes:
sideshowbarker
2024-07-17 02:06:40 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/43f98ac6e1 Pull-request: https://github.com/SerenityOS/serenity/pull/17406 Reviewed-by: https://github.com/linusg
73 changed files with 275 additions and 278 deletions
|
@ -14,7 +14,7 @@
|
|||
namespace AK {
|
||||
|
||||
template<typename T>
|
||||
concept StreamLike = IsBaseOf<AK::Stream, T>;
|
||||
concept StreamLike = IsBaseOf<Stream, T>;
|
||||
template<typename T>
|
||||
concept SeekableStreamLike = IsBaseOf<SeekableStream, T>;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
constexpr operator ValueType() const { return m_value; }
|
||||
|
||||
static ErrorOr<LEB128<ValueType>> read_from_stream(AK::Stream& stream)
|
||||
static ErrorOr<LEB128<ValueType>> read_from_stream(Stream& stream)
|
||||
requires(Unsigned<ValueType>)
|
||||
{
|
||||
ValueType result {};
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
return LEB128<ValueType> { result };
|
||||
}
|
||||
|
||||
static ErrorOr<LEB128<ValueType>> read_from_stream(AK::Stream& stream)
|
||||
static ErrorOr<LEB128<ValueType>> read_from_stream(Stream& stream)
|
||||
requires(Signed<ValueType>)
|
||||
{
|
||||
// Note: We read into a u64 to simplify the parsing logic;
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
|
||||
virtual void set_should_buffer_all_input(bool) override { }
|
||||
virtual bool stop() override { return false; }
|
||||
virtual void stream_into(AK::Stream&) override { }
|
||||
virtual void stream_into(Stream&) override { }
|
||||
|
||||
void did_finish();
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ public:)~~~");
|
|||
static i32 static_message_id() { return (int)MessageID::@message.pascal_name@; }
|
||||
virtual const char* message_name() const override { return "@endpoint.name@::@message.pascal_name@"; }
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<@message.pascal_name@>> decode(AK::Stream& stream, Core::LocalSocket& socket)
|
||||
static ErrorOr<NonnullOwnPtr<@message.pascal_name@>> decode(Stream& stream, Core::LocalSocket& socket)
|
||||
{
|
||||
IPC::Decoder decoder { stream, socket };)~~~");
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ void displayln(CheckedFormatString<Args...> format_string, Args const&... args)
|
|||
|
||||
void displayln() { user_display("\n", 1); }
|
||||
|
||||
class UserDisplayStream final : public AK::Stream {
|
||||
class UserDisplayStream final : public Stream {
|
||||
virtual ErrorOr<Bytes> read(Bytes) override { return Error::from_string_view("Not readable"sv); };
|
||||
virtual ErrorOr<size_t> write(ReadonlyBytes bytes) override
|
||||
{
|
||||
|
|
|
@ -15,8 +15,8 @@ TEST_CASE(little_endian_bit_stream_input_output_match)
|
|||
|
||||
// Note: The bit stream only ever reads from/writes to the underlying stream in one byte chunks,
|
||||
// so testing with sizes that will not trigger a write will yield unexpected results.
|
||||
LittleEndianOutputBitStream bit_write_stream { MaybeOwned<AK::Stream>(*memory_stream) };
|
||||
LittleEndianInputBitStream bit_read_stream { MaybeOwned<AK::Stream>(*memory_stream) };
|
||||
LittleEndianOutputBitStream bit_write_stream { MaybeOwned<Stream>(*memory_stream) };
|
||||
LittleEndianInputBitStream bit_read_stream { MaybeOwned<Stream>(*memory_stream) };
|
||||
|
||||
// Test two mirrored chunks of a fully mirrored pattern to check that we are not dropping bits.
|
||||
{
|
||||
|
@ -71,8 +71,8 @@ TEST_CASE(big_endian_bit_stream_input_output_match)
|
|||
|
||||
// Note: The bit stream only ever reads from/writes to the underlying stream in one byte chunks,
|
||||
// so testing with sizes that will not trigger a write will yield unexpected results.
|
||||
BigEndianOutputBitStream bit_write_stream { MaybeOwned<AK::Stream>(*memory_stream) };
|
||||
BigEndianInputBitStream bit_read_stream { MaybeOwned<AK::Stream>(*memory_stream) };
|
||||
BigEndianOutputBitStream bit_write_stream { MaybeOwned<Stream>(*memory_stream) };
|
||||
BigEndianInputBitStream bit_read_stream { MaybeOwned<Stream>(*memory_stream) };
|
||||
|
||||
// Test two mirrored chunks of a fully mirrored pattern to check that we are not dropping bits.
|
||||
{
|
||||
|
|
|
@ -171,7 +171,7 @@ RefPtr<Gfx::Bitmap> Image::copy_bitmap(Selection const& selection) const
|
|||
return cropped_bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
ErrorOr<void> Image::export_bmp_to_file(NonnullOwnPtr<AK::Stream> stream, bool preserve_alpha_channel) const
|
||||
ErrorOr<void> Image::export_bmp_to_file(NonnullOwnPtr<Stream> stream, bool preserve_alpha_channel) const
|
||||
{
|
||||
auto bitmap_format = preserve_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888;
|
||||
auto bitmap = TRY(compose_bitmap(bitmap_format));
|
||||
|
@ -182,7 +182,7 @@ ErrorOr<void> Image::export_bmp_to_file(NonnullOwnPtr<AK::Stream> stream, bool p
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> Image::export_png_to_file(NonnullOwnPtr<AK::Stream> stream, bool preserve_alpha_channel) const
|
||||
ErrorOr<void> Image::export_png_to_file(NonnullOwnPtr<Stream> stream, bool preserve_alpha_channel) const
|
||||
{
|
||||
auto bitmap_format = preserve_alpha_channel ? Gfx::BitmapFormat::BGRA8888 : Gfx::BitmapFormat::BGRx8888;
|
||||
auto bitmap = TRY(compose_bitmap(bitmap_format));
|
||||
|
@ -192,7 +192,7 @@ ErrorOr<void> Image::export_png_to_file(NonnullOwnPtr<AK::Stream> stream, bool p
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> Image::export_qoi_to_file(NonnullOwnPtr<AK::Stream> stream) const
|
||||
ErrorOr<void> Image::export_qoi_to_file(NonnullOwnPtr<Stream> stream) const
|
||||
{
|
||||
auto bitmap = TRY(compose_bitmap(Gfx::BitmapFormat::BGRA8888));
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ public:
|
|||
void paint_into(GUI::Painter&, Gfx::IntRect const& dest_rect, float scale) const;
|
||||
|
||||
ErrorOr<void> serialize_as_json(JsonObjectSerializer<StringBuilder>& json) const;
|
||||
ErrorOr<void> export_bmp_to_file(NonnullOwnPtr<AK::Stream>, bool preserve_alpha_channel) const;
|
||||
ErrorOr<void> export_png_to_file(NonnullOwnPtr<AK::Stream>, bool preserve_alpha_channel) const;
|
||||
ErrorOr<void> export_qoi_to_file(NonnullOwnPtr<AK::Stream>) const;
|
||||
ErrorOr<void> export_bmp_to_file(NonnullOwnPtr<Stream>, bool preserve_alpha_channel) const;
|
||||
ErrorOr<void> export_png_to_file(NonnullOwnPtr<Stream>, bool preserve_alpha_channel) const;
|
||||
ErrorOr<void> export_qoi_to_file(NonnullOwnPtr<Stream>) const;
|
||||
|
||||
void move_layer_to_front(Layer&);
|
||||
void move_layer_to_back(Layer&);
|
||||
|
|
|
@ -88,7 +88,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet)
|
|||
update_preview();
|
||||
}
|
||||
|
||||
auto CSVExportDialogPage::generate(AK::Stream& stream, GenerationType type) -> ErrorOr<void>
|
||||
auto CSVExportDialogPage::generate(Stream& stream, GenerationType type) -> ErrorOr<void>
|
||||
{
|
||||
auto delimiter = TRY([this]() -> ErrorOr<DeprecatedString> {
|
||||
if (m_delimiter_other_radio->is_checked()) {
|
||||
|
|
|
@ -27,7 +27,7 @@ struct CSVExportDialogPage {
|
|||
Preview
|
||||
};
|
||||
|
||||
ErrorOr<void> generate(AK::Stream&, GenerationType);
|
||||
ErrorOr<void> generate(Stream&, GenerationType);
|
||||
|
||||
protected:
|
||||
void update_preview();
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace Writer {
|
|||
class CSV {
|
||||
public:
|
||||
template<typename ContainerType>
|
||||
static ErrorOr<void> generate(AK::Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
static ErrorOr<void> generate(Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
{
|
||||
return XSV<ContainerType>::generate(output, data, { ",", "\"", WriterTraits::Repeat }, move(headers), behaviors);
|
||||
}
|
||||
|
||||
template<typename ContainerType>
|
||||
static ErrorOr<void> generate_preview(AK::Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
static ErrorOr<void> generate_preview(Stream& output, ContainerType const& data, Vector<StringView> headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
{
|
||||
return XSV<ContainerType>::generate_preview(output, data, { ",", "\"", WriterTraits::Repeat }, move(headers), behaviors);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ constexpr WriterBehavior default_behaviors()
|
|||
template<typename ContainerType, typename HeaderType = Vector<StringView>>
|
||||
class XSV {
|
||||
public:
|
||||
static ErrorOr<void> generate(AK::Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
static ErrorOr<void> generate(Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
{
|
||||
auto writer = XSV(output, data, traits, headers, behaviors);
|
||||
auto with_headers = has_flag(writer.m_behaviors, WriterBehavior::WriteHeaders);
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> generate_preview(AK::Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
static ErrorOr<void> generate_preview(Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
{
|
||||
auto writer = XSV(output, data, traits, headers, behaviors);
|
||||
auto lines_written = 0;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
XSV(AK::Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
XSV(Stream& output, ContainerType const& data, WriterTraits traits, HeaderType headers = {}, WriterBehavior behaviors = default_behaviors())
|
||||
: m_data(data)
|
||||
, m_traits(move(traits))
|
||||
, m_behaviors(behaviors)
|
||||
|
@ -170,7 +170,7 @@ private:
|
|||
WriterTraits m_traits;
|
||||
WriterBehavior m_behaviors;
|
||||
HeaderType m_names;
|
||||
AK::Stream& m_output;
|
||||
Stream& m_output;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -499,7 +499,7 @@ void Emulator::dump_backtrace()
|
|||
dump_backtrace(raw_backtrace());
|
||||
}
|
||||
|
||||
void Emulator::emit_profile_sample(AK::Stream& output)
|
||||
void Emulator::emit_profile_sample(Stream& output)
|
||||
{
|
||||
if (!is_in_region_of_interest())
|
||||
return;
|
||||
|
@ -512,7 +512,7 @@ void Emulator::emit_profile_sample(AK::Stream& output)
|
|||
output.write_entire_buffer(builder.string_view().bytes()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
void Emulator::emit_profile_event(AK::Stream& output, StringView event_name, DeprecatedString const& contents)
|
||||
void Emulator::emit_profile_event(Stream& output, StringView event_name, DeprecatedString const& contents)
|
||||
{
|
||||
StringBuilder builder;
|
||||
timeval tv {};
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
Emulator(DeprecatedString const& executable_path, Vector<StringView> const& arguments, Vector<DeprecatedString> const& environment);
|
||||
|
||||
void set_profiling_details(bool should_dump_profile, size_t instruction_interval, AK::Stream* profile_stream, NonnullOwnPtrVector<DeprecatedString>* profiler_strings, Vector<int>* profiler_string_id_map)
|
||||
void set_profiling_details(bool should_dump_profile, size_t instruction_interval, Stream* profile_stream, NonnullOwnPtrVector<DeprecatedString>* profiler_strings, Vector<int>* profiler_string_id_map)
|
||||
{
|
||||
m_is_profiling = should_dump_profile;
|
||||
m_profile_instruction_interval = instruction_interval;
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
m_is_in_region_of_interest = value;
|
||||
}
|
||||
|
||||
AK::Stream& profile_stream() { return *m_profile_stream; }
|
||||
Stream& profile_stream() { return *m_profile_stream; }
|
||||
NonnullOwnPtrVector<DeprecatedString>& profiler_strings() { return *m_profiler_strings; }
|
||||
Vector<int>& profiler_string_id_map() { return *m_profiler_string_id_map; }
|
||||
|
||||
|
@ -139,8 +139,8 @@ private:
|
|||
|
||||
void send_signal(int);
|
||||
|
||||
void emit_profile_sample(AK::Stream&);
|
||||
void emit_profile_event(AK::Stream&, StringView event_name, DeprecatedString const& contents);
|
||||
void emit_profile_sample(Stream&);
|
||||
void emit_profile_event(Stream&, StringView event_name, DeprecatedString const& contents);
|
||||
|
||||
int virt$accept4(FlatPtr);
|
||||
u32 virt$allocate_tls(FlatPtr, size_t);
|
||||
|
@ -295,7 +295,7 @@ private:
|
|||
|
||||
RangeAllocator m_range_allocator;
|
||||
|
||||
AK::Stream* m_profile_stream { nullptr };
|
||||
Stream* m_profile_stream { nullptr };
|
||||
Vector<int>* m_profiler_string_id_map { nullptr };
|
||||
NonnullOwnPtrVector<DeprecatedString>* m_profiler_strings { nullptr };
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ int main(int argc, char** argv, char** env)
|
|||
if (dump_profile && profile_dump_path.is_empty())
|
||||
profile_dump_path = DeprecatedString::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid());
|
||||
|
||||
OwnPtr<AK::Stream> profile_stream;
|
||||
OwnPtr<Stream> profile_stream;
|
||||
OwnPtr<NonnullOwnPtrVector<DeprecatedString>> profile_strings;
|
||||
OwnPtr<Vector<int>> profile_string_id_map;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ErrorOr<size_t> TarFileStream::write(ReadonlyBytes)
|
|||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<TarInputStream>> TarInputStream::construct(NonnullOwnPtr<AK::Stream> stream)
|
||||
ErrorOr<NonnullOwnPtr<TarInputStream>> TarInputStream::construct(NonnullOwnPtr<Stream> stream)
|
||||
{
|
||||
auto tar_stream = TRY(adopt_nonnull_own_or_enomem(new (nothrow) TarInputStream(move(stream))));
|
||||
|
||||
|
@ -61,7 +61,7 @@ ErrorOr<NonnullOwnPtr<TarInputStream>> TarInputStream::construct(NonnullOwnPtr<A
|
|||
return tar_stream;
|
||||
}
|
||||
|
||||
TarInputStream::TarInputStream(NonnullOwnPtr<AK::Stream> stream)
|
||||
TarInputStream::TarInputStream(NonnullOwnPtr<Stream> stream)
|
||||
: m_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ TarFileStream TarInputStream::file_contents()
|
|||
return TarFileStream(*this);
|
||||
}
|
||||
|
||||
TarOutputStream::TarOutputStream(MaybeOwned<AK::Stream> stream)
|
||||
TarOutputStream::TarOutputStream(MaybeOwned<Stream> stream)
|
||||
: m_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Archive {
|
|||
|
||||
class TarInputStream;
|
||||
|
||||
class TarFileStream : public AK::Stream {
|
||||
class TarFileStream : public Stream {
|
||||
public:
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||
|
@ -34,7 +34,7 @@ private:
|
|||
|
||||
class TarInputStream {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<TarInputStream>> construct(NonnullOwnPtr<AK::Stream>);
|
||||
static ErrorOr<NonnullOwnPtr<TarInputStream>> construct(NonnullOwnPtr<Stream>);
|
||||
ErrorOr<void> advance();
|
||||
bool finished() const { return m_found_end_of_archive || m_stream->is_eof(); }
|
||||
ErrorOr<bool> valid() const;
|
||||
|
@ -45,11 +45,11 @@ public:
|
|||
ErrorOr<void> for_each_extended_header(F func);
|
||||
|
||||
private:
|
||||
TarInputStream(NonnullOwnPtr<AK::Stream>);
|
||||
TarInputStream(NonnullOwnPtr<Stream>);
|
||||
ErrorOr<void> load_next_header();
|
||||
|
||||
TarFileHeader m_header;
|
||||
NonnullOwnPtr<AK::Stream> m_stream;
|
||||
NonnullOwnPtr<Stream> m_stream;
|
||||
unsigned long m_file_offset { 0 };
|
||||
int m_generation { 0 };
|
||||
bool m_found_end_of_archive { false };
|
||||
|
@ -59,14 +59,14 @@ private:
|
|||
|
||||
class TarOutputStream {
|
||||
public:
|
||||
TarOutputStream(MaybeOwned<AK::Stream>);
|
||||
TarOutputStream(MaybeOwned<Stream>);
|
||||
ErrorOr<void> add_file(StringView path, mode_t, ReadonlyBytes);
|
||||
ErrorOr<void> add_link(StringView path, mode_t, StringView);
|
||||
ErrorOr<void> add_directory(StringView path, mode_t);
|
||||
ErrorOr<void> finish();
|
||||
|
||||
private:
|
||||
MaybeOwned<AK::Stream> m_stream;
|
||||
MaybeOwned<Stream> m_stream;
|
||||
bool m_finished { false };
|
||||
|
||||
friend class TarFileStream;
|
||||
|
|
|
@ -102,7 +102,7 @@ ErrorOr<bool> Zip::for_each_member(Function<IterationDecision(ZipMember const&)>
|
|||
return true;
|
||||
}
|
||||
|
||||
ZipOutputStream::ZipOutputStream(NonnullOwnPtr<AK::Stream> stream)
|
||||
ZipOutputStream::ZipOutputStream(NonnullOwnPtr<Stream> stream)
|
||||
: m_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ struct [[gnu::packed]] EndOfCentralDirectory {
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<void> write(AK::Stream& stream) const
|
||||
ErrorOr<void> write(Stream& stream) const
|
||||
{
|
||||
auto write_value = [&stream](auto value) {
|
||||
return stream.write_entire_buffer({ &value, sizeof(value) });
|
||||
|
@ -143,7 +143,7 @@ struct [[gnu::packed]] CentralDirectoryRecord {
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<void> write(AK::Stream& stream) const
|
||||
ErrorOr<void> write(Stream& stream) const
|
||||
{
|
||||
auto write_value = [&stream](auto value) {
|
||||
return stream.write_entire_buffer({ &value, sizeof(value) });
|
||||
|
@ -212,7 +212,7 @@ struct [[gnu::packed]] LocalFileHeader {
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<void> write(AK::Stream& stream) const
|
||||
ErrorOr<void> write(Stream& stream) const
|
||||
{
|
||||
auto write_value = [&stream](auto value) {
|
||||
return stream.write_entire_buffer({ &value, sizeof(value) });
|
||||
|
@ -271,13 +271,13 @@ private:
|
|||
|
||||
class ZipOutputStream {
|
||||
public:
|
||||
ZipOutputStream(NonnullOwnPtr<AK::Stream>);
|
||||
ZipOutputStream(NonnullOwnPtr<Stream>);
|
||||
|
||||
ErrorOr<void> add_member(ZipMember const&);
|
||||
ErrorOr<void> finish();
|
||||
|
||||
private:
|
||||
NonnullOwnPtr<AK::Stream> m_stream;
|
||||
NonnullOwnPtr<Stream> m_stream;
|
||||
Vector<ZipMember> m_members;
|
||||
|
||||
bool m_finished { false };
|
||||
|
|
|
@ -60,7 +60,7 @@ MaybeLoaderError FlacLoaderPlugin::initialize()
|
|||
// 11.5 STREAM
|
||||
MaybeLoaderError FlacLoaderPlugin::parse_header()
|
||||
{
|
||||
BigEndianInputBitStream bit_input { MaybeOwned<AK::Stream>(*m_stream) };
|
||||
BigEndianInputBitStream bit_input { MaybeOwned<Stream>(*m_stream) };
|
||||
|
||||
// A mixture of VERIFY and the non-crashing TRY().
|
||||
#define FLAC_VERIFY(check, category, msg) \
|
||||
|
@ -79,7 +79,7 @@ MaybeLoaderError FlacLoaderPlugin::parse_header()
|
|||
auto streaminfo = TRY(next_meta_block(bit_input));
|
||||
FLAC_VERIFY(streaminfo.type == FlacMetadataBlockType::STREAMINFO, LoaderError::Category::Format, "First block must be STREAMINFO");
|
||||
FixedMemoryStream streaminfo_data_memory { streaminfo.data.bytes() };
|
||||
BigEndianInputBitStream streaminfo_data { MaybeOwned<AK::Stream>(streaminfo_data_memory) };
|
||||
BigEndianInputBitStream streaminfo_data { MaybeOwned<Stream>(streaminfo_data_memory) };
|
||||
|
||||
// 11.10 METADATA_BLOCK_STREAMINFO
|
||||
m_min_block_size = LOADER_TRY(streaminfo_data.read_bits<u16>(16));
|
||||
|
@ -150,7 +150,7 @@ MaybeLoaderError FlacLoaderPlugin::parse_header()
|
|||
MaybeLoaderError FlacLoaderPlugin::load_picture(FlacRawMetadataBlock& block)
|
||||
{
|
||||
FixedMemoryStream memory_stream { block.data.bytes() };
|
||||
BigEndianInputBitStream picture_block_bytes { MaybeOwned<AK::Stream>(memory_stream) };
|
||||
BigEndianInputBitStream picture_block_bytes { MaybeOwned<Stream>(memory_stream) };
|
||||
|
||||
PictureData picture {};
|
||||
|
||||
|
@ -187,7 +187,7 @@ MaybeLoaderError FlacLoaderPlugin::load_picture(FlacRawMetadataBlock& block)
|
|||
MaybeLoaderError FlacLoaderPlugin::load_seektable(FlacRawMetadataBlock& block)
|
||||
{
|
||||
FixedMemoryStream memory_stream { block.data.bytes() };
|
||||
BigEndianInputBitStream seektable_bytes { MaybeOwned<AK::Stream>(memory_stream) };
|
||||
BigEndianInputBitStream seektable_bytes { MaybeOwned<Stream>(memory_stream) };
|
||||
for (size_t i = 0; i < block.length / 18; ++i) {
|
||||
// 11.14. SEEKPOINT
|
||||
FlacSeekPoint seekpoint {
|
||||
|
@ -333,7 +333,7 @@ MaybeLoaderError FlacLoaderPlugin::next_frame(Span<Sample> target_vector)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
BigEndianInputBitStream bit_stream { MaybeOwned<AK::Stream>(*m_stream) };
|
||||
BigEndianInputBitStream bit_stream { MaybeOwned<Stream>(*m_stream) };
|
||||
|
||||
// TODO: Check the CRC-16 checksum (and others) by keeping track of read data
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ Result<NonnullOwnPtr<MP3LoaderPlugin>, LoaderError> MP3LoaderPlugin::create(Byte
|
|||
|
||||
MaybeLoaderError MP3LoaderPlugin::initialize()
|
||||
{
|
||||
m_bitstream = LOADER_TRY(try_make<BigEndianInputBitStream>(MaybeOwned<AK::Stream>(*m_stream)));
|
||||
m_bitstream = LOADER_TRY(try_make<BigEndianInputBitStream>(MaybeOwned<Stream>(*m_stream)));
|
||||
|
||||
TRY(synchronize());
|
||||
|
||||
|
@ -243,7 +243,7 @@ ErrorOr<MP3::MP3Frame, LoaderError> MP3LoaderPlugin::read_frame_data(MP3::Header
|
|||
|
||||
TRY(m_bit_reservoir.discard(old_reservoir_size - frame.main_data_begin));
|
||||
|
||||
BigEndianInputBitStream reservoir_stream { MaybeOwned<AK::Stream>(m_bit_reservoir) };
|
||||
BigEndianInputBitStream reservoir_stream { MaybeOwned<Stream>(m_bit_reservoir) };
|
||||
|
||||
for (size_t granule_index = 0; granule_index < 2; granule_index++) {
|
||||
for (size_t channel_index = 0; channel_index < header.channel_count(); channel_index++) {
|
||||
|
|
|
@ -52,7 +52,7 @@ MaybeLoaderError WavLoaderPlugin::initialize()
|
|||
}
|
||||
|
||||
template<typename SampleReader>
|
||||
MaybeLoaderError WavLoaderPlugin::read_samples_from_stream(AK::Stream& stream, SampleReader read_sample, FixedArray<Sample>& samples) const
|
||||
MaybeLoaderError WavLoaderPlugin::read_samples_from_stream(Stream& stream, SampleReader read_sample, FixedArray<Sample>& samples) const
|
||||
{
|
||||
switch (m_num_channels) {
|
||||
case 1:
|
||||
|
@ -73,7 +73,7 @@ MaybeLoaderError WavLoaderPlugin::read_samples_from_stream(AK::Stream& stream, S
|
|||
}
|
||||
|
||||
// There's no i24 type + we need to do the endianness conversion manually anyways.
|
||||
static ErrorOr<double> read_sample_int24(AK::Stream& stream)
|
||||
static ErrorOr<double> read_sample_int24(Stream& stream)
|
||||
{
|
||||
u8 byte = 0;
|
||||
TRY(stream.read(Bytes { &byte, 1 }));
|
||||
|
@ -94,7 +94,7 @@ static ErrorOr<double> read_sample_int24(AK::Stream& stream)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
static ErrorOr<double> read_sample(AK::Stream& stream)
|
||||
static ErrorOr<double> read_sample(Stream& stream)
|
||||
{
|
||||
T sample { 0 };
|
||||
TRY(stream.read(Bytes { &sample, sizeof(T) }));
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
|
||||
LoaderSamples samples_from_pcm_data(Bytes const& data, size_t samples_to_read) const;
|
||||
template<typename SampleReader>
|
||||
MaybeLoaderError read_samples_from_stream(AK::Stream& stream, SampleReader read_sample, FixedArray<Sample>& samples) const;
|
||||
MaybeLoaderError read_samples_from_stream(Stream& stream, SampleReader read_sample, FixedArray<Sample>& samples) const;
|
||||
|
||||
u32 m_sample_rate { 0 };
|
||||
u16 m_num_channels { 0 };
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
|
||||
namespace Compress {
|
||||
|
||||
using AK::LittleEndianInputBitStream;
|
||||
using AK::Stream;
|
||||
|
||||
class BrotliDecompressionStream : public Stream {
|
||||
public:
|
||||
enum class State {
|
||||
|
|
|
@ -189,13 +189,13 @@ ErrorOr<bool> DeflateDecompressor::UncompressedBlock::try_read_more()
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<DeflateDecompressor>> DeflateDecompressor::construct(MaybeOwned<AK::Stream> stream)
|
||||
ErrorOr<NonnullOwnPtr<DeflateDecompressor>> DeflateDecompressor::construct(MaybeOwned<Stream> stream)
|
||||
{
|
||||
auto output_buffer = TRY(CircularBuffer::create_empty(32 * KiB));
|
||||
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) DeflateDecompressor(move(stream), move(output_buffer))));
|
||||
}
|
||||
|
||||
DeflateDecompressor::DeflateDecompressor(MaybeOwned<AK::Stream> stream, CircularBuffer output_buffer)
|
||||
DeflateDecompressor::DeflateDecompressor(MaybeOwned<Stream> stream, CircularBuffer output_buffer)
|
||||
: m_input_stream(make<LittleEndianInputBitStream>(move(stream)))
|
||||
, m_output_buffer(move(output_buffer))
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ ErrorOr<void> DeflateDecompressor::decode_codes(CanonicalCode& literal_code, Opt
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<DeflateCompressor>> DeflateCompressor::construct(MaybeOwned<AK::Stream> stream, CompressionLevel compression_level)
|
||||
ErrorOr<NonnullOwnPtr<DeflateCompressor>> DeflateCompressor::construct(MaybeOwned<Stream> stream, CompressionLevel compression_level)
|
||||
{
|
||||
auto bit_stream = TRY(try_make<LittleEndianOutputBitStream>(move(stream)));
|
||||
auto deflate_compressor = TRY(adopt_nonnull_own_or_enomem(new (nothrow) DeflateCompressor(move(bit_stream), compression_level)));
|
||||
|
@ -1018,7 +1018,7 @@ ErrorOr<void> DeflateCompressor::final_flush()
|
|||
ErrorOr<ByteBuffer> DeflateCompressor::compress_all(ReadonlyBytes bytes, CompressionLevel compression_level)
|
||||
{
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
auto deflate_stream = TRY(DeflateCompressor::construct(MaybeOwned<AK::Stream>(*output_stream), compression_level));
|
||||
auto deflate_stream = TRY(DeflateCompressor::construct(MaybeOwned<Stream>(*output_stream), compression_level));
|
||||
|
||||
TRY(deflate_stream->write_entire_buffer(bytes));
|
||||
TRY(deflate_stream->final_flush());
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
Array<u16, 288> m_bit_code_lengths {};
|
||||
};
|
||||
|
||||
class DeflateDecompressor final : public AK::Stream {
|
||||
class DeflateDecompressor final : public Stream {
|
||||
private:
|
||||
class CompressedBlock {
|
||||
public:
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
friend CompressedBlock;
|
||||
friend UncompressedBlock;
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<DeflateDecompressor>> construct(MaybeOwned<AK::Stream> stream);
|
||||
static ErrorOr<NonnullOwnPtr<DeflateDecompressor>> construct(MaybeOwned<Stream> stream);
|
||||
~DeflateDecompressor();
|
||||
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
static ErrorOr<ByteBuffer> decompress_all(ReadonlyBytes);
|
||||
|
||||
private:
|
||||
DeflateDecompressor(MaybeOwned<AK::Stream> stream, CircularBuffer buffer);
|
||||
DeflateDecompressor(MaybeOwned<Stream> stream, CircularBuffer buffer);
|
||||
|
||||
ErrorOr<u32> decode_length(u32);
|
||||
ErrorOr<u32> decode_distance(u32);
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
CircularBuffer m_output_buffer;
|
||||
};
|
||||
|
||||
class DeflateCompressor final : public AK::Stream {
|
||||
class DeflateCompressor final : public Stream {
|
||||
public:
|
||||
static constexpr size_t block_size = 32 * KiB - 1; // TODO: this can theoretically be increased to 64 KiB - 2
|
||||
static constexpr size_t window_size = block_size * 2;
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
BEST // WARNING: this one can take an unreasonable amount of time!
|
||||
};
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<DeflateCompressor>> construct(MaybeOwned<AK::Stream>, CompressionLevel = CompressionLevel::GOOD);
|
||||
static ErrorOr<NonnullOwnPtr<DeflateCompressor>> construct(MaybeOwned<Stream>, CompressionLevel = CompressionLevel::GOOD);
|
||||
~DeflateCompressor();
|
||||
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
|
|
|
@ -38,9 +38,9 @@ bool BlockHeader::supported_by_implementation() const
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<GzipDecompressor::Member>> GzipDecompressor::Member::construct(BlockHeader header, AK::Stream& stream)
|
||||
ErrorOr<NonnullOwnPtr<GzipDecompressor::Member>> GzipDecompressor::Member::construct(BlockHeader header, Stream& stream)
|
||||
{
|
||||
auto deflate_stream = TRY(DeflateDecompressor::construct(MaybeOwned<AK::Stream>(stream)));
|
||||
auto deflate_stream = TRY(DeflateDecompressor::construct(MaybeOwned<Stream>(stream)));
|
||||
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) Member(header, move(deflate_stream))));
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ GzipDecompressor::Member::Member(BlockHeader header, NonnullOwnPtr<DeflateDecomp
|
|||
{
|
||||
}
|
||||
|
||||
GzipDecompressor::GzipDecompressor(NonnullOwnPtr<AK::Stream> stream)
|
||||
GzipDecompressor::GzipDecompressor(NonnullOwnPtr<Stream> stream)
|
||||
: m_input_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ ErrorOr<size_t> GzipDecompressor::write(ReadonlyBytes)
|
|||
return Error::from_errno(EBADF);
|
||||
}
|
||||
|
||||
GzipCompressor::GzipCompressor(MaybeOwned<AK::Stream> stream)
|
||||
GzipCompressor::GzipCompressor(MaybeOwned<Stream> stream)
|
||||
: m_output_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ void GzipCompressor::close()
|
|||
ErrorOr<ByteBuffer> GzipCompressor::compress_all(ReadonlyBytes bytes)
|
||||
{
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
GzipCompressor gzip_stream { MaybeOwned<AK::Stream>(*output_stream) };
|
||||
GzipCompressor gzip_stream { MaybeOwned<Stream>(*output_stream) };
|
||||
|
||||
TRY(gzip_stream.write_entire_buffer(bytes));
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ struct Flags {
|
|||
static constexpr u8 MAX = FTEXT | FHCRC | FEXTRA | FNAME | FCOMMENT;
|
||||
};
|
||||
|
||||
class GzipDecompressor final : public AK::Stream {
|
||||
class GzipDecompressor final : public Stream {
|
||||
public:
|
||||
GzipDecompressor(NonnullOwnPtr<AK::Stream>);
|
||||
GzipDecompressor(NonnullOwnPtr<Stream>);
|
||||
~GzipDecompressor();
|
||||
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
private:
|
||||
class Member {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<Member>> construct(BlockHeader header, AK::Stream&);
|
||||
static ErrorOr<NonnullOwnPtr<Member>> construct(BlockHeader header, Stream&);
|
||||
|
||||
BlockHeader m_header;
|
||||
NonnullOwnPtr<DeflateDecompressor> m_stream;
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
Member const& current_member() const { return *m_current_member; }
|
||||
Member& current_member() { return *m_current_member; }
|
||||
|
||||
NonnullOwnPtr<AK::Stream> m_input_stream;
|
||||
NonnullOwnPtr<Stream> m_input_stream;
|
||||
u8 m_partial_header[sizeof(BlockHeader)];
|
||||
size_t m_partial_header_offset { 0 };
|
||||
OwnPtr<Member> m_current_member {};
|
||||
|
@ -80,9 +80,9 @@ private:
|
|||
bool m_eof { false };
|
||||
};
|
||||
|
||||
class GzipCompressor final : public AK::Stream {
|
||||
class GzipCompressor final : public Stream {
|
||||
public:
|
||||
GzipCompressor(MaybeOwned<AK::Stream>);
|
||||
GzipCompressor(MaybeOwned<Stream>);
|
||||
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
static ErrorOr<ByteBuffer> compress_all(ReadonlyBytes bytes);
|
||||
|
||||
private:
|
||||
MaybeOwned<AK::Stream> m_output_stream;
|
||||
MaybeOwned<Stream> m_output_stream;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ u32 ZlibDecompressor::checksum()
|
|||
return m_checksum;
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(MaybeOwned<AK::Stream> stream, ZlibCompressionLevel compression_level)
|
||||
ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(MaybeOwned<Stream> stream, ZlibCompressionLevel compression_level)
|
||||
{
|
||||
// Zlib only defines Deflate as a compression method.
|
||||
auto compression_method = ZlibCompressionMethod::Deflate;
|
||||
|
@ -83,7 +83,7 @@ ErrorOr<NonnullOwnPtr<ZlibCompressor>> ZlibCompressor::construct(MaybeOwned<AK::
|
|||
return zlib_compressor;
|
||||
}
|
||||
|
||||
ZlibCompressor::ZlibCompressor(MaybeOwned<AK::Stream> stream, NonnullOwnPtr<AK::Stream> compressor_stream)
|
||||
ZlibCompressor::ZlibCompressor(MaybeOwned<Stream> stream, NonnullOwnPtr<Stream> compressor_stream)
|
||||
: m_output_stream(move(stream))
|
||||
, m_compressor(move(compressor_stream))
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ ErrorOr<void> ZlibCompressor::finish()
|
|||
ErrorOr<ByteBuffer> ZlibCompressor::compress_all(ReadonlyBytes bytes, ZlibCompressionLevel compression_level)
|
||||
{
|
||||
auto output_stream = TRY(try_make<AllocatingMemoryStream>());
|
||||
auto zlib_stream = TRY(ZlibCompressor::construct(MaybeOwned<AK::Stream>(*output_stream), compression_level));
|
||||
auto zlib_stream = TRY(ZlibCompressor::construct(MaybeOwned<Stream>(*output_stream), compression_level));
|
||||
|
||||
TRY(zlib_stream->write_entire_buffer(bytes));
|
||||
|
||||
|
|
|
@ -62,9 +62,9 @@ private:
|
|||
ReadonlyBytes m_data_bytes;
|
||||
};
|
||||
|
||||
class ZlibCompressor : public AK::Stream {
|
||||
class ZlibCompressor : public Stream {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<ZlibCompressor>> construct(MaybeOwned<AK::Stream>, ZlibCompressionLevel = ZlibCompressionLevel::Default);
|
||||
static ErrorOr<NonnullOwnPtr<ZlibCompressor>> construct(MaybeOwned<Stream>, ZlibCompressionLevel = ZlibCompressionLevel::Default);
|
||||
~ZlibCompressor();
|
||||
|
||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||
|
@ -77,12 +77,12 @@ public:
|
|||
static ErrorOr<ByteBuffer> compress_all(ReadonlyBytes bytes, ZlibCompressionLevel = ZlibCompressionLevel::Default);
|
||||
|
||||
private:
|
||||
ZlibCompressor(MaybeOwned<AK::Stream> stream, NonnullOwnPtr<AK::Stream> compressor_stream);
|
||||
ZlibCompressor(MaybeOwned<Stream> stream, NonnullOwnPtr<Stream> compressor_stream);
|
||||
ErrorOr<void> write_header(ZlibCompressionMethod, ZlibCompressionLevel);
|
||||
|
||||
bool m_finished { false };
|
||||
MaybeOwned<AK::Stream> m_output_stream;
|
||||
NonnullOwnPtr<AK::Stream> m_compressor;
|
||||
MaybeOwned<Stream> m_output_stream;
|
||||
NonnullOwnPtr<Stream> m_compressor;
|
||||
Crypto::Checksum::Adler32 m_adler32_checksum;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
NetworkJob::NetworkJob(AK::Stream& output_stream)
|
||||
NetworkJob::NetworkJob(Stream& output_stream)
|
||||
: m_output_stream(output_stream)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
NetworkJob(AK::Stream&);
|
||||
NetworkJob(Stream&);
|
||||
void did_finish(NonnullRefPtr<NetworkResponse>&&);
|
||||
void did_fail(Error);
|
||||
void did_progress(Optional<u32> total_size, u32 downloaded);
|
||||
|
@ -61,7 +61,7 @@ protected:
|
|||
|
||||
private:
|
||||
RefPtr<NetworkResponse> m_response;
|
||||
AK::Stream& m_output_stream;
|
||||
Stream& m_output_stream;
|
||||
Error m_error { Error::None };
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Core {
|
|||
|
||||
/// The Socket class is the base class for all concrete BSD-style socket
|
||||
/// classes. Sockets are non-seekable streams which can be read byte-wise.
|
||||
class Socket : public AK::Stream {
|
||||
class Socket : public Stream {
|
||||
public:
|
||||
Socket(Socket&&) = default;
|
||||
Socket& operator=(Socket&&) = default;
|
||||
|
|
|
@ -224,7 +224,7 @@ ErrorOr<void> Decoder::leave()
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> pretty_print(Decoder& decoder, AK::Stream& stream, int indent)
|
||||
ErrorOr<void> pretty_print(Decoder& decoder, Stream& stream, int indent)
|
||||
{
|
||||
while (!decoder.eof()) {
|
||||
auto tag = TRY(decoder.peek());
|
||||
|
|
|
@ -211,6 +211,6 @@ private:
|
|||
Optional<Tag> m_current_tag;
|
||||
};
|
||||
|
||||
ErrorOr<void> pretty_print(Decoder&, AK::Stream&, int indent = 0);
|
||||
ErrorOr<void> pretty_print(Decoder&, Stream&, int indent = 0);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ void Name::randomize_case()
|
|||
m_name = builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<void> Name::write_to_stream(AK::Stream& stream) const
|
||||
ErrorOr<void> Name::write_to_stream(Stream& stream) const
|
||||
{
|
||||
auto parts = as_string().split_view('.');
|
||||
for (auto& part : parts) {
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
size_t serialized_size() const;
|
||||
DeprecatedString const& as_string() const { return m_name; }
|
||||
ErrorOr<void> write_to_stream(AK::Stream&) const;
|
||||
ErrorOr<void> write_to_stream(Stream&) const;
|
||||
|
||||
void randomize_case();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Debug::Dwarf {
|
||||
|
||||
AddressRangesV5::AddressRangesV5(NonnullOwnPtr<AK::Stream> range_lists_stream, CompilationUnit const& compilation_unit)
|
||||
AddressRangesV5::AddressRangesV5(NonnullOwnPtr<Stream> range_lists_stream, CompilationUnit const& compilation_unit)
|
||||
: m_range_lists_stream(move(range_lists_stream))
|
||||
, m_compilation_unit(compilation_unit)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ ErrorOr<void> AddressRangesV5::for_each_range(Function<void(Range)> callback)
|
|||
return {};
|
||||
}
|
||||
|
||||
AddressRangesV4::AddressRangesV4(NonnullOwnPtr<AK::Stream> ranges_stream, CompilationUnit const& compilation_unit)
|
||||
AddressRangesV4::AddressRangesV4(NonnullOwnPtr<Stream> ranges_stream, CompilationUnit const& compilation_unit)
|
||||
: m_ranges_stream(move(ranges_stream))
|
||||
, m_compilation_unit(compilation_unit)
|
||||
{
|
||||
|
|
|
@ -24,12 +24,12 @@ class AddressRangesV5 {
|
|||
|
||||
public:
|
||||
// FIXME: This should be fine with using a non-owned stream.
|
||||
AddressRangesV5(NonnullOwnPtr<AK::Stream> range_lists_stream, CompilationUnit const& compilation_unit);
|
||||
AddressRangesV5(NonnullOwnPtr<Stream> range_lists_stream, CompilationUnit const& compilation_unit);
|
||||
|
||||
ErrorOr<void> for_each_range(Function<void(Range)>);
|
||||
|
||||
private:
|
||||
NonnullOwnPtr<AK::Stream> m_range_lists_stream;
|
||||
NonnullOwnPtr<Stream> m_range_lists_stream;
|
||||
CompilationUnit const& m_compilation_unit;
|
||||
};
|
||||
|
||||
|
@ -38,12 +38,12 @@ class AddressRangesV4 {
|
|||
AK_MAKE_NONMOVABLE(AddressRangesV4);
|
||||
|
||||
public:
|
||||
AddressRangesV4(NonnullOwnPtr<AK::Stream> ranges_stream, CompilationUnit const&);
|
||||
AddressRangesV4(NonnullOwnPtr<Stream> ranges_stream, CompilationUnit const&);
|
||||
|
||||
ErrorOr<void> for_each_range(Function<void(Range)>);
|
||||
|
||||
private:
|
||||
NonnullOwnPtr<AK::Stream> m_ranges_stream;
|
||||
NonnullOwnPtr<Stream> m_ranges_stream;
|
||||
CompilationUnit const& m_compilation_unit;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ struct [[gnu::packed]] CompilationUnitHeader {
|
|||
u32 abbrev_offset() const { return (common.version <= 4) ? v4.abbrev_offset : v5.abbrev_offset; }
|
||||
u8 address_size() const { return (common.version <= 4) ? v4.address_size : v5.address_size; }
|
||||
|
||||
static ErrorOr<CompilationUnitHeader> read_from_stream(AK::Stream& stream)
|
||||
static ErrorOr<CompilationUnitHeader> read_from_stream(Stream& stream)
|
||||
{
|
||||
CompilationUnitHeader header;
|
||||
TRY(stream.read_entire_buffer(Bytes { &header.common, sizeof(header.common) }));
|
||||
|
|
|
@ -65,7 +65,7 @@ struct [[gnu::packed]] LineProgramUnitHeader32 {
|
|||
u8 line_range() const { return (common.version <= 4) ? v4.line_range : v5.line_range; }
|
||||
u8 opcode_base() const { return (common.version <= 4) ? v4.opcode_base : v5.opcode_base; }
|
||||
|
||||
static ErrorOr<LineProgramUnitHeader32> read_from_stream(AK::Stream& stream)
|
||||
static ErrorOr<LineProgramUnitHeader32> read_from_stream(Stream& stream)
|
||||
{
|
||||
LineProgramUnitHeader32 header;
|
||||
TRY(stream.read_entire_buffer(Bytes { &header.common, sizeof(header.common) }));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace Gemini {
|
||||
|
||||
Job::Job(GeminiRequest const& request, AK::Stream& output_stream)
|
||||
Job::Job(GeminiRequest const& request, Stream& output_stream)
|
||||
: Core::NetworkJob(output_stream)
|
||||
, m_request(request)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ class Job : public Core::NetworkJob {
|
|||
C_OBJECT(Job);
|
||||
|
||||
public:
|
||||
explicit Job(GeminiRequest const&, AK::Stream&);
|
||||
explicit Job(GeminiRequest const&, Stream&);
|
||||
virtual ~Job() override = default;
|
||||
|
||||
virtual void start(Core::Socket&) override;
|
||||
|
|
|
@ -202,7 +202,7 @@ static DXGIFormat get_format(DDSPixelFormat format)
|
|||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dx5_alpha_block(AK::Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_dx5_alpha_block(Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto color0 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto color1 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -265,7 +265,7 @@ static ErrorOr<void> decode_dx5_alpha_block(AK::Stream& stream, DDSLoadingContex
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dx3_alpha_block(AK::Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_dx3_alpha_block(Stream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto a0 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto a1 = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -313,7 +313,7 @@ static void unpack_rbg_565(u32 rgb, u8* output)
|
|||
output[3] = 255;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_color_block(AK::Stream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y)
|
||||
static ErrorOr<void> decode_color_block(Stream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y)
|
||||
{
|
||||
auto c0_low = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
auto c0_high = TRY(stream.read_value<LittleEndian<u8>>());
|
||||
|
@ -369,7 +369,7 @@ static ErrorOr<void> decode_color_block(AK::Stream& stream, DDSLoadingContext& c
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_dxt(AK::Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y)
|
||||
static ErrorOr<void> decode_dxt(Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y)
|
||||
{
|
||||
if (format == DXGI_FORMAT_BC1_UNORM) {
|
||||
for (size_t x = 0; x < width; x += 4) {
|
||||
|
@ -393,7 +393,7 @@ static ErrorOr<void> decode_dxt(AK::Stream& stream, DDSLoadingContext& context,
|
|||
|
||||
return {};
|
||||
}
|
||||
static ErrorOr<void> decode_bitmap(AK::Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 height)
|
||||
static ErrorOr<void> decode_bitmap(Stream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 height)
|
||||
{
|
||||
Vector<u32> dxt_formats = { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC3_UNORM };
|
||||
if (dxt_formats.contains_slow(format)) {
|
||||
|
|
|
@ -89,7 +89,7 @@ enum class GIFFormat {
|
|||
GIF89a,
|
||||
};
|
||||
|
||||
static ErrorOr<GIFFormat> decode_gif_header(AK::Stream& stream)
|
||||
static ErrorOr<GIFFormat> decode_gif_header(Stream& stream)
|
||||
{
|
||||
static auto valid_header_87 = "GIF87a"sv;
|
||||
static auto valid_header_89 = "GIF89a"sv;
|
||||
|
|
|
@ -75,7 +75,7 @@ struct ICOLoadingContext {
|
|||
size_t largest_index;
|
||||
};
|
||||
|
||||
static ErrorOr<size_t> decode_ico_header(AK::Stream& stream)
|
||||
static ErrorOr<size_t> decode_ico_header(Stream& stream)
|
||||
{
|
||||
auto header = TRY(stream.read_value<ICONDIR>());
|
||||
if (header.must_be_0 != 0 || header.must_be_1 != 1)
|
||||
|
@ -83,7 +83,7 @@ static ErrorOr<size_t> decode_ico_header(AK::Stream& stream)
|
|||
return { header.image_count };
|
||||
}
|
||||
|
||||
static ErrorOr<ICOImageDescriptor> decode_ico_direntry(AK::Stream& stream)
|
||||
static ErrorOr<ICOImageDescriptor> decode_ico_direntry(Stream& stream)
|
||||
{
|
||||
auto entry = TRY(stream.read_value<ICONDIRENTRY>());
|
||||
ICOImageDescriptor desc = { entry.width, entry.height, entry.bits_per_pixel, entry.offset, entry.size, nullptr };
|
||||
|
|
|
@ -460,7 +460,7 @@ static inline bool is_valid_marker(const Marker marker)
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline ErrorOr<Marker> read_marker_at_cursor(AK::Stream& stream)
|
||||
static inline ErrorOr<Marker> read_marker_at_cursor(Stream& stream)
|
||||
{
|
||||
u16 marker = TRY(stream.read_value<BigEndian<u16>>());
|
||||
if (is_valid_marker(marker))
|
||||
|
@ -839,7 +839,7 @@ static ErrorOr<void> read_quantization_table(AK::SeekableStream& stream, JPGLoad
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<void> skip_marker_with_length(AK::Stream& stream)
|
||||
static ErrorOr<void> skip_marker_with_length(Stream& stream)
|
||||
{
|
||||
u16 bytes_to_skip = TRY(stream.read_value<BigEndian<u16>>()) - 2;
|
||||
TRY(stream.discard(bytes_to_skip));
|
||||
|
|
|
@ -21,7 +21,7 @@ static constexpr u8 QOI_OP_RUN = 0b11000000;
|
|||
static constexpr u8 QOI_MASK_2 = 0b11000000;
|
||||
static constexpr u8 END_MARKER[] = { 0, 0, 0, 0, 0, 0, 0, 1 };
|
||||
|
||||
static ErrorOr<QOIHeader> decode_qoi_header(AK::Stream& stream)
|
||||
static ErrorOr<QOIHeader> decode_qoi_header(Stream& stream)
|
||||
{
|
||||
auto header = TRY(stream.read_value<QOIHeader>());
|
||||
if (StringView { header.magic, array_size(header.magic) } != QOI_MAGIC)
|
||||
|
@ -31,7 +31,7 @@ static ErrorOr<QOIHeader> decode_qoi_header(AK::Stream& stream)
|
|||
return header;
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_rgb(AK::Stream& stream, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_rgb(Stream& stream, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY(first_byte == QOI_OP_RGB);
|
||||
u8 bytes[3];
|
||||
|
@ -41,7 +41,7 @@ static ErrorOr<Color> decode_qoi_op_rgb(AK::Stream& stream, u8 first_byte, Color
|
|||
return Color { bytes[0], bytes[1], bytes[2], pixel.alpha() };
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_rgba(AK::Stream& stream, u8 first_byte)
|
||||
static ErrorOr<Color> decode_qoi_op_rgba(Stream& stream, u8 first_byte)
|
||||
{
|
||||
VERIFY(first_byte == QOI_OP_RGBA);
|
||||
u8 bytes[4];
|
||||
|
@ -49,7 +49,7 @@ static ErrorOr<Color> decode_qoi_op_rgba(AK::Stream& stream, u8 first_byte)
|
|||
return Color { bytes[0], bytes[1], bytes[2], bytes[3] };
|
||||
}
|
||||
|
||||
static ErrorOr<u8> decode_qoi_op_index(AK::Stream&, u8 first_byte)
|
||||
static ErrorOr<u8> decode_qoi_op_index(Stream&, u8 first_byte)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_INDEX);
|
||||
u8 index = first_byte & ~QOI_MASK_2;
|
||||
|
@ -57,7 +57,7 @@ static ErrorOr<u8> decode_qoi_op_index(AK::Stream&, u8 first_byte)
|
|||
return index;
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_diff(AK::Stream&, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_diff(Stream&, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_DIFF);
|
||||
u8 dr = (first_byte & 0b00110000) >> 4;
|
||||
|
@ -74,7 +74,7 @@ static ErrorOr<Color> decode_qoi_op_diff(AK::Stream&, u8 first_byte, Color pixel
|
|||
};
|
||||
}
|
||||
|
||||
static ErrorOr<Color> decode_qoi_op_luma(AK::Stream& stream, u8 first_byte, Color pixel)
|
||||
static ErrorOr<Color> decode_qoi_op_luma(Stream& stream, u8 first_byte, Color pixel)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_LUMA);
|
||||
auto byte = TRY(stream.read_value<u8>());
|
||||
|
@ -91,7 +91,7 @@ static ErrorOr<Color> decode_qoi_op_luma(AK::Stream& stream, u8 first_byte, Colo
|
|||
};
|
||||
}
|
||||
|
||||
static ErrorOr<u8> decode_qoi_op_run(AK::Stream&, u8 first_byte)
|
||||
static ErrorOr<u8> decode_qoi_op_run(Stream&, u8 first_byte)
|
||||
{
|
||||
VERIFY((first_byte & QOI_MASK_2) == QOI_OP_RUN);
|
||||
u8 run = first_byte & ~QOI_MASK_2;
|
||||
|
@ -107,7 +107,7 @@ static ErrorOr<u8> decode_qoi_op_run(AK::Stream&, u8 first_byte)
|
|||
return run;
|
||||
}
|
||||
|
||||
static ErrorOr<void> decode_qoi_end_marker(AK::Stream& stream)
|
||||
static ErrorOr<void> decode_qoi_end_marker(Stream& stream)
|
||||
{
|
||||
u8 bytes[array_size(END_MARKER)];
|
||||
TRY(stream.read_entire_buffer({ &bytes, array_size(bytes) }));
|
||||
|
@ -118,7 +118,7 @@ static ErrorOr<void> decode_qoi_end_marker(AK::Stream& stream)
|
|||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(AK::Stream& stream, u32 width, u32 height)
|
||||
static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(Stream& stream, u32 width, u32 height)
|
||||
{
|
||||
// FIXME: Why is Gfx::Bitmap's size signed? Makes no sense whatsoever.
|
||||
if (width > NumericLimits<int>::max())
|
||||
|
@ -162,7 +162,7 @@ static ErrorOr<NonnullRefPtr<Bitmap>> decode_qoi_image(AK::Stream& stream, u32 w
|
|||
return { move(bitmap) };
|
||||
}
|
||||
|
||||
QOIImageDecoderPlugin::QOIImageDecoderPlugin(NonnullOwnPtr<AK::Stream> stream)
|
||||
QOIImageDecoderPlugin::QOIImageDecoderPlugin(NonnullOwnPtr<Stream> stream)
|
||||
{
|
||||
m_context = make<QOILoadingContext>();
|
||||
m_context->stream = move(stream);
|
||||
|
@ -232,7 +232,7 @@ ErrorOr<ImageFrameDescriptor> QOIImageDecoderPlugin::frame(size_t index)
|
|||
return ImageFrameDescriptor { m_context->bitmap, 0 };
|
||||
}
|
||||
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(AK::Stream& stream)
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(Stream& stream)
|
||||
{
|
||||
VERIFY(m_context->state < QOILoadingContext::State::HeaderDecoded);
|
||||
auto error_or_header = decode_qoi_header(stream);
|
||||
|
@ -245,7 +245,7 @@ ErrorOr<void> QOIImageDecoderPlugin::decode_header_and_update_context(AK::Stream
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context(AK::Stream& stream)
|
||||
ErrorOr<void> QOIImageDecoderPlugin::decode_image_and_update_context(Stream& stream)
|
||||
{
|
||||
VERIFY(m_context->state < QOILoadingContext::State::ImageDecoded);
|
||||
auto error_or_bitmap = decode_qoi_image(stream, m_context->header.width, m_context->header.height);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct QOILoadingContext {
|
|||
Error,
|
||||
};
|
||||
State state { State::NotDecoded };
|
||||
OwnPtr<AK::Stream> stream {};
|
||||
OwnPtr<Stream> stream {};
|
||||
QOIHeader header {};
|
||||
RefPtr<Bitmap> bitmap;
|
||||
};
|
||||
|
@ -54,10 +54,10 @@ public:
|
|||
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
||||
|
||||
private:
|
||||
ErrorOr<void> decode_header_and_update_context(AK::Stream&);
|
||||
ErrorOr<void> decode_image_and_update_context(AK::Stream&);
|
||||
ErrorOr<void> decode_header_and_update_context(Stream&);
|
||||
ErrorOr<void> decode_image_and_update_context(Stream&);
|
||||
|
||||
QOIImageDecoderPlugin(NonnullOwnPtr<AK::Stream>);
|
||||
QOIImageDecoderPlugin(NonnullOwnPtr<Stream>);
|
||||
|
||||
OwnPtr<QOILoadingContext> m_context;
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
Function<Vector<TLS::Certificate>()> on_certificate_requested;
|
||||
|
||||
private:
|
||||
explicit HttpsJob(HttpRequest&& request, AK::Stream& output_stream)
|
||||
explicit HttpsJob(HttpRequest&& request, Stream& output_stream)
|
||||
: Job(move(request), output_stream)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ static ErrorOr<ByteBuffer> handle_content_encoding(ByteBuffer const& buf, Deprec
|
|||
|
||||
// FIXME: Actually do the decompression of the data using streams, instead of all at once when everything has been
|
||||
// received. This will require that some of the decompression algorithms are implemented in a streaming way.
|
||||
// Gzip and Deflate are implemented using AK::Stream, while Brotli uses the newer Core::Stream. The Gzip and
|
||||
// Gzip and Deflate are implemented using Stream, while Brotli uses the newer Core::Stream. The Gzip and
|
||||
// Deflate implementations will likely need to be changed to LibCore::Stream for this to work easily.
|
||||
|
||||
if (content_encoding == "gzip") {
|
||||
|
@ -86,7 +86,7 @@ static ErrorOr<ByteBuffer> handle_content_encoding(ByteBuffer const& buf, Deprec
|
|||
return buf;
|
||||
}
|
||||
|
||||
Job::Job(HttpRequest&& request, AK::Stream& output_stream)
|
||||
Job::Job(HttpRequest&& request, Stream& output_stream)
|
||||
: Core::NetworkJob(output_stream)
|
||||
, m_request(move(request))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ class Job : public Core::NetworkJob {
|
|||
C_OBJECT(Job);
|
||||
|
||||
public:
|
||||
explicit Job(HttpRequest&&, AK::Stream&);
|
||||
explicit Job(HttpRequest&&, Stream&);
|
||||
virtual ~Job() override = default;
|
||||
|
||||
virtual void start(Core::Socket&) override;
|
||||
|
|
|
@ -32,7 +32,7 @@ inline ErrorOr<T> decode(Decoder&)
|
|||
|
||||
class Decoder {
|
||||
public:
|
||||
Decoder(AK::Stream& stream, Core::LocalSocket& socket)
|
||||
Decoder(Stream& stream, Core::LocalSocket& socket)
|
||||
: m_stream(stream)
|
||||
, m_socket(socket)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
Core::LocalSocket& socket() { return m_socket; }
|
||||
|
||||
private:
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
Core::LocalSocket& m_socket;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace JS {
|
||||
struct PrintContext {
|
||||
JS::VM& vm;
|
||||
AK::Stream& stream;
|
||||
Stream& stream;
|
||||
bool strip_ansi { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -1582,7 +1582,7 @@ void Editor::strip_styles(bool strip_anchored)
|
|||
m_refresh_needed = true;
|
||||
}
|
||||
|
||||
ErrorOr<void> Editor::reposition_cursor(AK::Stream& stream, bool to_end)
|
||||
ErrorOr<void> Editor::reposition_cursor(Stream& stream, bool to_end)
|
||||
{
|
||||
auto cursor = m_cursor;
|
||||
auto saved_cursor = m_cursor;
|
||||
|
@ -1604,12 +1604,12 @@ ErrorOr<void> Editor::reposition_cursor(AK::Stream& stream, bool to_end)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::move_absolute(u32 row, u32 col, AK::Stream& stream)
|
||||
ErrorOr<void> VT::move_absolute(u32 row, u32 col, Stream& stream)
|
||||
{
|
||||
return stream.write_entire_buffer(DeprecatedString::formatted("\033[{};{}H", row, col).bytes());
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::move_relative(int row, int col, AK::Stream& stream)
|
||||
ErrorOr<void> VT::move_relative(int row, int col, Stream& stream)
|
||||
{
|
||||
char x_op = 'A', y_op = 'D';
|
||||
|
||||
|
@ -1761,7 +1761,7 @@ DeprecatedString Style::to_deprecated_string() const
|
|||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::apply_style(Style const& style, AK::Stream& stream, bool is_starting)
|
||||
ErrorOr<void> VT::apply_style(Style const& style, Stream& stream, bool is_starting)
|
||||
{
|
||||
if (is_starting) {
|
||||
TRY(stream.write_entire_buffer(DeprecatedString::formatted("\033[{};{};{}m{}{}{}",
|
||||
|
@ -1779,7 +1779,7 @@ ErrorOr<void> VT::apply_style(Style const& style, AK::Stream& stream, bool is_st
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::clear_lines(size_t count_above, size_t count_below, AK::Stream& stream)
|
||||
ErrorOr<void> VT::clear_lines(size_t count_above, size_t count_below, Stream& stream)
|
||||
{
|
||||
if (count_below + count_above == 0) {
|
||||
TRY(stream.write_entire_buffer("\033[2K"sv.bytes()));
|
||||
|
@ -1798,17 +1798,17 @@ ErrorOr<void> VT::clear_lines(size_t count_above, size_t count_below, AK::Stream
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::save_cursor(AK::Stream& stream)
|
||||
ErrorOr<void> VT::save_cursor(Stream& stream)
|
||||
{
|
||||
return stream.write_entire_buffer("\033[s"sv.bytes());
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::restore_cursor(AK::Stream& stream)
|
||||
ErrorOr<void> VT::restore_cursor(Stream& stream)
|
||||
{
|
||||
return stream.write_entire_buffer("\033[u"sv.bytes());
|
||||
}
|
||||
|
||||
ErrorOr<void> VT::clear_to_end_of_line(AK::Stream& stream)
|
||||
ErrorOr<void> VT::clear_to_end_of_line(Stream& stream)
|
||||
{
|
||||
return stream.write_entire_buffer("\033[K"sv.bytes());
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ private:
|
|||
}
|
||||
|
||||
void recalculate_origin();
|
||||
ErrorOr<void> reposition_cursor(AK::Stream&, bool to_end = false);
|
||||
ErrorOr<void> reposition_cursor(Stream&, bool to_end = false);
|
||||
|
||||
struct CodepointRange {
|
||||
size_t start { 0 };
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
namespace Line {
|
||||
namespace VT {
|
||||
|
||||
ErrorOr<void> save_cursor(AK::Stream&);
|
||||
ErrorOr<void> restore_cursor(AK::Stream&);
|
||||
ErrorOr<void> clear_to_end_of_line(AK::Stream&);
|
||||
ErrorOr<void> clear_lines(size_t count_above, size_t count_below, AK::Stream&);
|
||||
ErrorOr<void> move_relative(int x, int y, AK::Stream&);
|
||||
ErrorOr<void> move_absolute(u32 x, u32 y, AK::Stream&);
|
||||
ErrorOr<void> apply_style(Style const&, AK::Stream&, bool is_starting = true);
|
||||
ErrorOr<void> save_cursor(Stream&);
|
||||
ErrorOr<void> restore_cursor(Stream&);
|
||||
ErrorOr<void> clear_to_end_of_line(Stream&);
|
||||
ErrorOr<void> clear_lines(size_t count_above, size_t count_below, Stream&);
|
||||
ErrorOr<void> move_relative(int x, int y, Stream&);
|
||||
ErrorOr<void> move_absolute(u32 x, u32 y, Stream&);
|
||||
ErrorOr<void> apply_style(Style const&, Stream&, bool is_starting = true);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ bool Request::stop()
|
|||
return m_client->stop_request({}, *this);
|
||||
}
|
||||
|
||||
void Request::stream_into(AK::Stream& stream)
|
||||
void Request::stream_into(Stream& stream)
|
||||
{
|
||||
VERIFY(!m_internal_stream_data);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
int fd() const { return m_fd; }
|
||||
bool stop();
|
||||
|
||||
void stream_into(AK::Stream&);
|
||||
void stream_into(Stream&);
|
||||
|
||||
bool should_buffer_all_input() const { return m_should_buffer_all_input; }
|
||||
/// Note: Will override `on_finish', and `on_headers_received', and expects `on_buffered_request_finish' to be set!
|
||||
|
@ -73,12 +73,12 @@ private:
|
|||
};
|
||||
|
||||
struct InternalStreamData {
|
||||
InternalStreamData(NonnullOwnPtr<AK::Stream> stream)
|
||||
InternalStreamData(NonnullOwnPtr<Stream> stream)
|
||||
: read_stream(move(stream))
|
||||
{
|
||||
}
|
||||
|
||||
NonnullOwnPtr<AK::Stream> read_stream;
|
||||
NonnullOwnPtr<Stream> read_stream;
|
||||
RefPtr<Core::Notifier> read_notifier;
|
||||
bool success;
|
||||
u32 total_size { 0 };
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
namespace Wasm {
|
||||
|
||||
ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof)
|
||||
ParseError with_eof_check(Stream const& stream, ParseError error_if_not_eof)
|
||||
{
|
||||
if (stream.is_eof())
|
||||
return ParseError::UnexpectedEof;
|
||||
|
@ -22,7 +22,7 @@ ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof)
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
static auto parse_vector(AK::Stream& stream)
|
||||
static auto parse_vector(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
if constexpr (requires { T::parse(stream); }) {
|
||||
|
@ -73,7 +73,7 @@ static auto parse_vector(AK::Stream& stream)
|
|||
}
|
||||
}
|
||||
|
||||
static ParseResult<DeprecatedString> parse_name(AK::Stream& stream)
|
||||
static ParseResult<DeprecatedString> parse_name(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
auto data = parse_vector<u8>(stream);
|
||||
|
@ -89,8 +89,8 @@ struct ParseUntilAnyOfResult {
|
|||
Vector<T> values;
|
||||
};
|
||||
template<typename T, u8... terminators, typename... Args>
|
||||
static ParseResult<ParseUntilAnyOfResult<T>> parse_until_any_of(AK::Stream& stream, Args&... args)
|
||||
requires(requires(AK::Stream& stream, Args... args) { T::parse(stream, args...); })
|
||||
static ParseResult<ParseUntilAnyOfResult<T>> parse_until_any_of(Stream& stream, Args&... args)
|
||||
requires(requires(Stream& stream, Args... args) { T::parse(stream, args...); })
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger;
|
||||
ReconsumableStream new_stream { stream };
|
||||
|
@ -119,7 +119,7 @@ requires(requires(AK::Stream& stream, Args... args) { T::parse(stream, args...);
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ValueType> ValueType::parse(AK::Stream& stream)
|
||||
ParseResult<ValueType> ValueType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ValueType"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -146,7 +146,7 @@ ParseResult<ValueType> ValueType::parse(AK::Stream& stream)
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ResultType> ResultType::parse(AK::Stream& stream)
|
||||
ParseResult<ResultType> ResultType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ResultType"sv);
|
||||
auto types = parse_vector<ValueType>(stream);
|
||||
|
@ -155,7 +155,7 @@ ParseResult<ResultType> ResultType::parse(AK::Stream& stream)
|
|||
return ResultType { types.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<FunctionType> FunctionType::parse(AK::Stream& stream)
|
||||
ParseResult<FunctionType> FunctionType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("FunctionType"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -179,7 +179,7 @@ ParseResult<FunctionType> FunctionType::parse(AK::Stream& stream)
|
|||
return FunctionType { parameters_result.release_value(), results_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Limits> Limits::parse(AK::Stream& stream)
|
||||
ParseResult<Limits> Limits::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Limits"sv);
|
||||
auto flag_or_error = stream.read_value<u8>();
|
||||
|
@ -207,7 +207,7 @@ ParseResult<Limits> Limits::parse(AK::Stream& stream)
|
|||
return Limits { static_cast<u32>(min), move(max) };
|
||||
}
|
||||
|
||||
ParseResult<MemoryType> MemoryType::parse(AK::Stream& stream)
|
||||
ParseResult<MemoryType> MemoryType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("MemoryType"sv);
|
||||
auto limits_result = Limits::parse(stream);
|
||||
|
@ -216,7 +216,7 @@ ParseResult<MemoryType> MemoryType::parse(AK::Stream& stream)
|
|||
return MemoryType { limits_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<TableType> TableType::parse(AK::Stream& stream)
|
||||
ParseResult<TableType> TableType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TableType"sv);
|
||||
auto type_result = ValueType::parse(stream);
|
||||
|
@ -230,7 +230,7 @@ ParseResult<TableType> TableType::parse(AK::Stream& stream)
|
|||
return TableType { type_result.release_value(), limits_result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<GlobalType> GlobalType::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalType> GlobalType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("GlobalType"sv);
|
||||
auto type_result = ValueType::parse(stream);
|
||||
|
@ -249,7 +249,7 @@ ParseResult<GlobalType> GlobalType::parse(AK::Stream& stream)
|
|||
return GlobalType { type_result.release_value(), mutable_ == 0x01 };
|
||||
}
|
||||
|
||||
ParseResult<BlockType> BlockType::parse(AK::Stream& stream)
|
||||
ParseResult<BlockType> BlockType::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("BlockType"sv);
|
||||
auto kind_or_error = stream.read_value<u8>();
|
||||
|
@ -282,7 +282,7 @@ ParseResult<BlockType> BlockType::parse(AK::Stream& stream)
|
|||
return BlockType { TypeIndex(index_value) };
|
||||
}
|
||||
|
||||
ParseResult<Vector<Instruction>> Instruction::parse(AK::Stream& stream, InstructionPointer& ip)
|
||||
ParseResult<Vector<Instruction>> Instruction::parse(Stream& stream, InstructionPointer& ip)
|
||||
{
|
||||
struct NestedInstructionState {
|
||||
Vector<Instruction> prior_instructions;
|
||||
|
@ -782,7 +782,7 @@ ParseResult<Vector<Instruction>> Instruction::parse(AK::Stream& stream, Instruct
|
|||
return resulting_instructions;
|
||||
}
|
||||
|
||||
ParseResult<CustomSection> CustomSection::parse(AK::Stream& stream)
|
||||
ParseResult<CustomSection> CustomSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("CustomSection"sv);
|
||||
auto name = parse_name(stream);
|
||||
|
@ -808,7 +808,7 @@ ParseResult<CustomSection> CustomSection::parse(AK::Stream& stream)
|
|||
return CustomSection(name.release_value(), move(data_buffer));
|
||||
}
|
||||
|
||||
ParseResult<TypeSection> TypeSection::parse(AK::Stream& stream)
|
||||
ParseResult<TypeSection> TypeSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TypeSection"sv);
|
||||
auto types = parse_vector<FunctionType>(stream);
|
||||
|
@ -817,7 +817,7 @@ ParseResult<TypeSection> TypeSection::parse(AK::Stream& stream)
|
|||
return TypeSection { types.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ImportSection::Import> ImportSection::Import::parse(AK::Stream& stream)
|
||||
ParseResult<ImportSection::Import> ImportSection::Import::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Import"sv);
|
||||
auto module = parse_name(stream);
|
||||
|
@ -850,7 +850,7 @@ ParseResult<ImportSection::Import> ImportSection::Import::parse(AK::Stream& stre
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ImportSection> ImportSection::parse(AK::Stream& stream)
|
||||
ParseResult<ImportSection> ImportSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ImportSection"sv);
|
||||
auto imports = parse_vector<Import>(stream);
|
||||
|
@ -859,7 +859,7 @@ ParseResult<ImportSection> ImportSection::parse(AK::Stream& stream)
|
|||
return ImportSection { imports.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<FunctionSection> FunctionSection::parse(AK::Stream& stream)
|
||||
ParseResult<FunctionSection> FunctionSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("FunctionSection"sv);
|
||||
auto indices = parse_vector<size_t>(stream);
|
||||
|
@ -874,7 +874,7 @@ ParseResult<FunctionSection> FunctionSection::parse(AK::Stream& stream)
|
|||
return FunctionSection { move(typed_indices) };
|
||||
}
|
||||
|
||||
ParseResult<TableSection::Table> TableSection::Table::parse(AK::Stream& stream)
|
||||
ParseResult<TableSection::Table> TableSection::Table::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Table"sv);
|
||||
auto type = TableType::parse(stream);
|
||||
|
@ -883,7 +883,7 @@ ParseResult<TableSection::Table> TableSection::Table::parse(AK::Stream& stream)
|
|||
return Table { type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<TableSection> TableSection::parse(AK::Stream& stream)
|
||||
ParseResult<TableSection> TableSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("TableSection"sv);
|
||||
auto tables = parse_vector<Table>(stream);
|
||||
|
@ -892,7 +892,7 @@ ParseResult<TableSection> TableSection::parse(AK::Stream& stream)
|
|||
return TableSection { tables.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<MemorySection::Memory> MemorySection::Memory::parse(AK::Stream& stream)
|
||||
ParseResult<MemorySection::Memory> MemorySection::Memory::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Memory"sv);
|
||||
auto type = MemoryType::parse(stream);
|
||||
|
@ -901,7 +901,7 @@ ParseResult<MemorySection::Memory> MemorySection::Memory::parse(AK::Stream& stre
|
|||
return Memory { type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<MemorySection> MemorySection::parse(AK::Stream& stream)
|
||||
ParseResult<MemorySection> MemorySection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("MemorySection"sv);
|
||||
auto memories = parse_vector<Memory>(stream);
|
||||
|
@ -910,7 +910,7 @@ ParseResult<MemorySection> MemorySection::parse(AK::Stream& stream)
|
|||
return MemorySection { memories.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Expression> Expression::parse(AK::Stream& stream)
|
||||
ParseResult<Expression> Expression::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Expression"sv);
|
||||
InstructionPointer ip { 0 };
|
||||
|
@ -921,7 +921,7 @@ ParseResult<Expression> Expression::parse(AK::Stream& stream)
|
|||
return Expression { move(instructions.value().values) };
|
||||
}
|
||||
|
||||
ParseResult<GlobalSection::Global> GlobalSection::Global::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalSection::Global> GlobalSection::Global::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Global"sv);
|
||||
auto type = GlobalType::parse(stream);
|
||||
|
@ -933,7 +933,7 @@ ParseResult<GlobalSection::Global> GlobalSection::Global::parse(AK::Stream& stre
|
|||
return Global { type.release_value(), exprs.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<GlobalSection> GlobalSection::parse(AK::Stream& stream)
|
||||
ParseResult<GlobalSection> GlobalSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("GlobalSection"sv);
|
||||
auto result = parse_vector<Global>(stream);
|
||||
|
@ -942,7 +942,7 @@ ParseResult<GlobalSection> GlobalSection::parse(AK::Stream& stream)
|
|||
return GlobalSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ExportSection::Export> ExportSection::Export::parse(AK::Stream& stream)
|
||||
ParseResult<ExportSection::Export> ExportSection::Export::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Export"sv);
|
||||
auto name = parse_name(stream);
|
||||
|
@ -973,7 +973,7 @@ ParseResult<ExportSection::Export> ExportSection::Export::parse(AK::Stream& stre
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ExportSection> ExportSection::parse(AK::Stream& stream)
|
||||
ParseResult<ExportSection> ExportSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ExportSection"sv);
|
||||
auto result = parse_vector<Export>(stream);
|
||||
|
@ -982,7 +982,7 @@ ParseResult<ExportSection> ExportSection::parse(AK::Stream& stream)
|
|||
return ExportSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(AK::Stream& stream)
|
||||
ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("StartFunction"sv);
|
||||
auto index = GenericIndexParser<FunctionIndex>::parse(stream);
|
||||
|
@ -991,7 +991,7 @@ ParseResult<StartSection::StartFunction> StartSection::StartFunction::parse(AK::
|
|||
return StartFunction { index.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<StartSection> StartSection::parse(AK::Stream& stream)
|
||||
ParseResult<StartSection> StartSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("StartSection"sv);
|
||||
auto result = StartFunction::parse(stream);
|
||||
|
@ -1000,7 +1000,7 @@ ParseResult<StartSection> StartSection::parse(AK::Stream& stream)
|
|||
return StartSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(Stream& stream)
|
||||
{
|
||||
auto expression = Expression::parse(stream);
|
||||
if (expression.is_error())
|
||||
|
@ -1012,7 +1012,7 @@ ParseResult<ElementSection::SegmentType0> ElementSection::SegmentType0::parse(AK
|
|||
return SegmentType0 { indices.release_value(), Active { 0, expression.release_value() } };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(Stream& stream)
|
||||
{
|
||||
auto kind_or_error = stream.read_value<u8>();
|
||||
if (kind_or_error.is_error())
|
||||
|
@ -1028,49 +1028,49 @@ ParseResult<ElementSection::SegmentType1> ElementSection::SegmentType1::parse(AK
|
|||
return SegmentType1 { indices.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType2> ElementSection::SegmentType2::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType2> ElementSection::SegmentType2::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 2");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType3> ElementSection::SegmentType3::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType3> ElementSection::SegmentType3::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 3");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 4");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 5");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType6> ElementSection::SegmentType6::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType6> ElementSection::SegmentType6::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 6");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::SegmentType7> ElementSection::SegmentType7::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::SegmentType7> ElementSection::SegmentType7::parse(Stream& stream)
|
||||
{
|
||||
dbgln("Type 7");
|
||||
(void)stream;
|
||||
return ParseError::NotImplemented;
|
||||
}
|
||||
|
||||
ParseResult<ElementSection::Element> ElementSection::Element::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection::Element> ElementSection::Element::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Element"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -1139,7 +1139,7 @@ ParseResult<ElementSection::Element> ElementSection::Element::parse(AK::Stream&
|
|||
}
|
||||
}
|
||||
|
||||
ParseResult<ElementSection> ElementSection::parse(AK::Stream& stream)
|
||||
ParseResult<ElementSection> ElementSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("ElementSection"sv);
|
||||
auto result = parse_vector<Element>(stream);
|
||||
|
@ -1148,7 +1148,7 @@ ParseResult<ElementSection> ElementSection::parse(AK::Stream& stream)
|
|||
return ElementSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<Locals> Locals::parse(AK::Stream& stream)
|
||||
ParseResult<Locals> Locals::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Locals"sv);
|
||||
auto count_or_error = stream.read_value<LEB128<size_t>>();
|
||||
|
@ -1166,7 +1166,7 @@ ParseResult<Locals> Locals::parse(AK::Stream& stream)
|
|||
return Locals { static_cast<u32>(count), type.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection::Func> CodeSection::Func::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection::Func> CodeSection::Func::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Func"sv);
|
||||
auto locals = parse_vector<Locals>(stream);
|
||||
|
@ -1178,7 +1178,7 @@ ParseResult<CodeSection::Func> CodeSection::Func::parse(AK::Stream& stream)
|
|||
return Func { locals.release_value(), body.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection::Code> CodeSection::Code::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection::Code> CodeSection::Code::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Code"sv);
|
||||
auto size_or_error = stream.read_value<LEB128<size_t>>();
|
||||
|
@ -1195,7 +1195,7 @@ ParseResult<CodeSection::Code> CodeSection::Code::parse(AK::Stream& stream)
|
|||
return Code { static_cast<u32>(size), func.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<CodeSection> CodeSection::parse(AK::Stream& stream)
|
||||
ParseResult<CodeSection> CodeSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("CodeSection"sv);
|
||||
auto result = parse_vector<Code>(stream);
|
||||
|
@ -1204,7 +1204,7 @@ ParseResult<CodeSection> CodeSection::parse(AK::Stream& stream)
|
|||
return CodeSection { result.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<DataSection::Data> DataSection::Data::parse(AK::Stream& stream)
|
||||
ParseResult<DataSection::Data> DataSection::Data::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Data"sv);
|
||||
auto tag_or_error = stream.read_value<u8>();
|
||||
|
@ -1246,7 +1246,7 @@ ParseResult<DataSection::Data> DataSection::Data::parse(AK::Stream& stream)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ParseResult<DataSection> DataSection::parse(AK::Stream& stream)
|
||||
ParseResult<DataSection> DataSection::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("DataSection"sv);
|
||||
auto data = parse_vector<Data>(stream);
|
||||
|
@ -1256,7 +1256,7 @@ ParseResult<DataSection> DataSection::parse(AK::Stream& stream)
|
|||
return DataSection { data.release_value() };
|
||||
}
|
||||
|
||||
ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] AK::Stream& stream)
|
||||
ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("DataCountSection"sv);
|
||||
auto value_or_error = stream.read_value<LEB128<u32>>();
|
||||
|
@ -1272,7 +1272,7 @@ ParseResult<DataCountSection> DataCountSection::parse([[maybe_unused]] AK::Strea
|
|||
return DataCountSection { value };
|
||||
}
|
||||
|
||||
ParseResult<Module> Module::parse(AK::Stream& stream)
|
||||
ParseResult<Module> Module::parse(Stream& stream)
|
||||
{
|
||||
ScopeLogger<WASM_BINPARSER_DEBUG> logger("Module"sv);
|
||||
u8 buf[4];
|
||||
|
|
|
@ -17,7 +17,7 @@ DeprecatedString instruction_name(OpCode const& opcode);
|
|||
Optional<OpCode> instruction_from_name(StringView name);
|
||||
|
||||
struct Printer {
|
||||
explicit Printer(AK::Stream& stream, size_t initial_indent = 0)
|
||||
explicit Printer(Stream& stream, size_t initial_indent = 0)
|
||||
: m_stream(stream)
|
||||
, m_indent(initial_indent)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
m_stream.write_entire_buffer(builder.string_view().bytes()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
size_t m_indent { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, LabelIndex);
|
|||
AK_TYPEDEF_DISTINCT_ORDERED_ID(size_t, DataIndex);
|
||||
AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, InstructionPointer, Arithmetic, Comparison, Flags, Increment);
|
||||
|
||||
ParseError with_eof_check(AK::Stream const& stream, ParseError error_if_not_eof);
|
||||
ParseError with_eof_check(Stream const& stream, ParseError error_if_not_eof);
|
||||
|
||||
template<typename T>
|
||||
struct GenericIndexParser {
|
||||
static ParseResult<T> parse(AK::Stream& stream)
|
||||
static ParseResult<T> parse(Stream& stream)
|
||||
{
|
||||
auto value_or_error = stream.read_value<LEB128<size_t>>();
|
||||
if (value_or_error.is_error())
|
||||
|
@ -72,9 +72,9 @@ struct GenericIndexParser {
|
|||
}
|
||||
};
|
||||
|
||||
class ReconsumableStream : public AK::Stream {
|
||||
class ReconsumableStream : public Stream {
|
||||
public:
|
||||
explicit ReconsumableStream(AK::Stream& stream)
|
||||
explicit ReconsumableStream(Stream& stream)
|
||||
: m_stream(stream)
|
||||
{
|
||||
}
|
||||
|
@ -132,13 +132,13 @@ private:
|
|||
m_stream.close();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
Vector<u8, 8> m_buffer;
|
||||
};
|
||||
|
||||
class ConstrainedStream : public AK::Stream {
|
||||
class ConstrainedStream : public Stream {
|
||||
public:
|
||||
explicit ConstrainedStream(AK::Stream& stream, size_t size)
|
||||
explicit ConstrainedStream(Stream& stream, size_t size)
|
||||
: m_stream(stream)
|
||||
, m_bytes_left(size)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
m_stream.close();
|
||||
}
|
||||
|
||||
AK::Stream& m_stream;
|
||||
Stream& m_stream;
|
||||
size_t m_bytes_left { 0 };
|
||||
};
|
||||
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
auto is_numeric() const { return !is_reference(); }
|
||||
auto kind() const { return m_kind; }
|
||||
|
||||
static ParseResult<ValueType> parse(AK::Stream& stream);
|
||||
static ParseResult<ValueType> parse(Stream& stream);
|
||||
|
||||
static DeprecatedString kind_name(Kind kind)
|
||||
{
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
|
||||
auto const& types() const { return m_types; }
|
||||
|
||||
static ParseResult<ResultType> parse(AK::Stream& stream);
|
||||
static ParseResult<ResultType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<ValueType> m_types;
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
auto& parameters() const { return m_parameters; }
|
||||
auto& results() const { return m_results; }
|
||||
|
||||
static ParseResult<FunctionType> parse(AK::Stream& stream);
|
||||
static ParseResult<FunctionType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<ValueType> m_parameters;
|
||||
|
@ -286,7 +286,7 @@ public:
|
|||
auto min() const { return m_min; }
|
||||
auto& max() const { return m_max; }
|
||||
|
||||
static ParseResult<Limits> parse(AK::Stream& stream);
|
||||
static ParseResult<Limits> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_min { 0 };
|
||||
|
@ -303,7 +303,7 @@ public:
|
|||
|
||||
auto& limits() const { return m_limits; }
|
||||
|
||||
static ParseResult<MemoryType> parse(AK::Stream& stream);
|
||||
static ParseResult<MemoryType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Limits m_limits;
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
auto& limits() const { return m_limits; }
|
||||
auto& element_type() const { return m_element_type; }
|
||||
|
||||
static ParseResult<TableType> parse(AK::Stream& stream);
|
||||
static ParseResult<TableType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
ValueType m_element_type;
|
||||
|
@ -341,7 +341,7 @@ public:
|
|||
auto& type() const { return m_type; }
|
||||
auto is_mutable() const { return m_is_mutable; }
|
||||
|
||||
static ParseResult<GlobalType> parse(AK::Stream& stream);
|
||||
static ParseResult<GlobalType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
ValueType m_type;
|
||||
|
@ -387,7 +387,7 @@ public:
|
|||
return m_type_index;
|
||||
}
|
||||
|
||||
static ParseResult<BlockType> parse(AK::Stream& stream);
|
||||
static ParseResult<BlockType> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Kind m_kind { Empty };
|
||||
|
@ -451,7 +451,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
static ParseResult<Vector<Instruction>> parse(AK::Stream& stream, InstructionPointer& ip);
|
||||
static ParseResult<Vector<Instruction>> parse(Stream& stream, InstructionPointer& ip);
|
||||
|
||||
auto& opcode() const { return m_opcode; }
|
||||
auto& arguments() const { return m_arguments; }
|
||||
|
@ -498,7 +498,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& contents() const { return m_contents; }
|
||||
|
||||
static ParseResult<CustomSection> parse(AK::Stream& stream);
|
||||
static ParseResult<CustomSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
|
@ -516,7 +516,7 @@ public:
|
|||
|
||||
auto& types() const { return m_types; }
|
||||
|
||||
static ParseResult<TypeSection> parse(AK::Stream& stream);
|
||||
static ParseResult<TypeSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<FunctionType> m_types;
|
||||
|
@ -538,7 +538,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& description() const { return m_description; }
|
||||
|
||||
static ParseResult<Import> parse(AK::Stream& stream);
|
||||
static ParseResult<Import> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
|
@ -565,7 +565,7 @@ public:
|
|||
|
||||
auto& imports() const { return m_imports; }
|
||||
|
||||
static ParseResult<ImportSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ImportSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Import> m_imports;
|
||||
|
@ -582,7 +582,7 @@ public:
|
|||
|
||||
auto& types() const { return m_types; }
|
||||
|
||||
static ParseResult<FunctionSection> parse(AK::Stream& stream);
|
||||
static ParseResult<FunctionSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<TypeIndex> m_types;
|
||||
|
@ -599,7 +599,7 @@ public:
|
|||
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Table> parse(AK::Stream& stream);
|
||||
static ParseResult<Table> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
TableType m_type;
|
||||
|
@ -615,7 +615,7 @@ public:
|
|||
|
||||
auto& tables() const { return m_tables; };
|
||||
|
||||
static ParseResult<TableSection> parse(AK::Stream& stream);
|
||||
static ParseResult<TableSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Table> m_tables;
|
||||
|
@ -632,7 +632,7 @@ public:
|
|||
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Memory> parse(AK::Stream& stream);
|
||||
static ParseResult<Memory> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
MemoryType m_type;
|
||||
|
@ -648,7 +648,7 @@ public:
|
|||
|
||||
auto& memories() const { return m_memories; }
|
||||
|
||||
static ParseResult<MemorySection> parse(AK::Stream& stream);
|
||||
static ParseResult<MemorySection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Memory> m_memories;
|
||||
|
@ -663,7 +663,7 @@ public:
|
|||
|
||||
auto& instructions() const { return m_instructions; }
|
||||
|
||||
static ParseResult<Expression> parse(AK::Stream& stream);
|
||||
static ParseResult<Expression> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Instruction> m_instructions;
|
||||
|
@ -682,7 +682,7 @@ public:
|
|||
auto& type() const { return m_type; }
|
||||
auto& expression() const { return m_expression; }
|
||||
|
||||
static ParseResult<Global> parse(AK::Stream& stream);
|
||||
static ParseResult<Global> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
GlobalType m_type;
|
||||
|
@ -699,7 +699,7 @@ public:
|
|||
|
||||
auto& entries() const { return m_entries; }
|
||||
|
||||
static ParseResult<GlobalSection> parse(AK::Stream& stream);
|
||||
static ParseResult<GlobalSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Global> m_entries;
|
||||
|
@ -721,7 +721,7 @@ public:
|
|||
auto& name() const { return m_name; }
|
||||
auto& description() const { return m_description; }
|
||||
|
||||
static ParseResult<Export> parse(AK::Stream& stream);
|
||||
static ParseResult<Export> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
DeprecatedString m_name;
|
||||
|
@ -737,7 +737,7 @@ public:
|
|||
|
||||
auto& entries() const { return m_entries; }
|
||||
|
||||
static ParseResult<ExportSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ExportSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Export> m_entries;
|
||||
|
@ -754,7 +754,7 @@ public:
|
|||
|
||||
auto& index() const { return m_index; }
|
||||
|
||||
static ParseResult<StartFunction> parse(AK::Stream& stream);
|
||||
static ParseResult<StartFunction> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
FunctionIndex m_index;
|
||||
|
@ -769,7 +769,7 @@ public:
|
|||
|
||||
auto& function() const { return m_function; }
|
||||
|
||||
static ParseResult<StartSection> parse(AK::Stream& stream);
|
||||
static ParseResult<StartSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
StartFunction m_function;
|
||||
|
@ -788,43 +788,43 @@ public:
|
|||
|
||||
struct SegmentType0 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType0> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType0> parse(Stream& stream);
|
||||
|
||||
Vector<FunctionIndex> function_indices;
|
||||
Active mode;
|
||||
};
|
||||
struct SegmentType1 {
|
||||
static ParseResult<SegmentType1> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType1> parse(Stream& stream);
|
||||
|
||||
Vector<FunctionIndex> function_indices;
|
||||
};
|
||||
struct SegmentType2 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType2> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType2> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType3 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType3> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType3> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType4 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType4> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType4> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType5 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType5> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType5> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType6 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType6> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType6> parse(Stream& stream);
|
||||
};
|
||||
struct SegmentType7 {
|
||||
// FIXME: Implement me!
|
||||
static ParseResult<SegmentType7> parse(AK::Stream& stream);
|
||||
static ParseResult<SegmentType7> parse(Stream& stream);
|
||||
};
|
||||
|
||||
struct Element {
|
||||
static ParseResult<Element> parse(AK::Stream&);
|
||||
static ParseResult<Element> parse(Stream&);
|
||||
|
||||
ValueType type;
|
||||
Vector<Expression> init;
|
||||
|
@ -840,7 +840,7 @@ public:
|
|||
|
||||
auto& segments() const { return m_segments; }
|
||||
|
||||
static ParseResult<ElementSection> parse(AK::Stream& stream);
|
||||
static ParseResult<ElementSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Element> m_segments;
|
||||
|
@ -858,7 +858,7 @@ public:
|
|||
auto n() const { return m_n; }
|
||||
auto& type() const { return m_type; }
|
||||
|
||||
static ParseResult<Locals> parse(AK::Stream& stream);
|
||||
static ParseResult<Locals> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_n { 0 };
|
||||
|
@ -879,7 +879,7 @@ public:
|
|||
auto& locals() const { return m_locals; }
|
||||
auto& body() const { return m_body; }
|
||||
|
||||
static ParseResult<Func> parse(AK::Stream& stream);
|
||||
static ParseResult<Func> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Locals> m_locals;
|
||||
|
@ -896,7 +896,7 @@ public:
|
|||
auto size() const { return m_size; }
|
||||
auto& func() const { return m_func; }
|
||||
|
||||
static ParseResult<Code> parse(AK::Stream& stream);
|
||||
static ParseResult<Code> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
u32 m_size { 0 };
|
||||
|
@ -912,7 +912,7 @@ public:
|
|||
|
||||
auto& functions() const { return m_functions; }
|
||||
|
||||
static ParseResult<CodeSection> parse(AK::Stream& stream);
|
||||
static ParseResult<CodeSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Code> m_functions;
|
||||
|
@ -939,7 +939,7 @@ public:
|
|||
|
||||
auto& value() const { return m_value; }
|
||||
|
||||
static ParseResult<Data> parse(AK::Stream& stream);
|
||||
static ParseResult<Data> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Value m_value;
|
||||
|
@ -954,7 +954,7 @@ public:
|
|||
|
||||
auto& data() const { return m_data; }
|
||||
|
||||
static ParseResult<DataSection> parse(AK::Stream& stream);
|
||||
static ParseResult<DataSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Vector<Data> m_data;
|
||||
|
@ -971,7 +971,7 @@ public:
|
|||
|
||||
auto& count() const { return m_count; }
|
||||
|
||||
static ParseResult<DataCountSection> parse(AK::Stream& stream);
|
||||
static ParseResult<DataCountSection> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
Optional<u32> m_count;
|
||||
|
@ -1066,7 +1066,7 @@ public:
|
|||
StringView validation_error() const { return *m_validation_error; }
|
||||
void set_validation_error(DeprecatedString error) { m_validation_error = move(error); }
|
||||
|
||||
static ParseResult<Module> parse(AK::Stream& stream);
|
||||
static ParseResult<Module> parse(Stream& stream);
|
||||
|
||||
private:
|
||||
bool populate_sections();
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
virtual void set_should_buffer_all_input(bool) = 0;
|
||||
virtual bool stop() = 0;
|
||||
|
||||
virtual void stream_into(AK::Stream&) = 0;
|
||||
virtual void stream_into(Stream&) = 0;
|
||||
|
||||
Function<void(bool success, u32 total_size, HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> const& response_headers, Optional<u32> response_code, ReadonlyBytes payload)> on_buffered_request_finish;
|
||||
Function<void(bool success, u32 total_size)> on_finish;
|
||||
|
|
|
@ -63,7 +63,7 @@ bool RequestServerRequestAdapter::stop()
|
|||
return m_request->stop();
|
||||
}
|
||||
|
||||
void RequestServerRequestAdapter::stream_into(AK::Stream& stream)
|
||||
void RequestServerRequestAdapter::stream_into(Stream& stream)
|
||||
{
|
||||
m_request->stream_into(stream);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual void set_should_buffer_all_input(bool) override;
|
||||
virtual bool stop() override;
|
||||
|
||||
virtual void stream_into(AK::Stream&) override;
|
||||
virtual void stream_into(Stream&) override;
|
||||
|
||||
private:
|
||||
RequestServerRequestAdapter(NonnullRefPtr<Protocol::Request>);
|
||||
|
|
|
@ -176,7 +176,7 @@ ErrorOr<bool> Client::handle_request(ReadonlyBytes raw_request)
|
|||
return true;
|
||||
}
|
||||
|
||||
ErrorOr<void> Client::send_response(AK::Stream& response, HTTP::HttpRequest const& request, ContentInfo content_info)
|
||||
ErrorOr<void> Client::send_response(Stream& response, HTTP::HttpRequest const& request, ContentInfo content_info)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("HTTP/1.0 200 OK\r\n"sv);
|
||||
|
|
|
@ -30,7 +30,7 @@ private:
|
|||
};
|
||||
|
||||
ErrorOr<bool> handle_request(ReadonlyBytes);
|
||||
ErrorOr<void> send_response(AK::Stream&, HTTP::HttpRequest const&, ContentInfo);
|
||||
ErrorOr<void> send_response(Stream&, HTTP::HttpRequest const&, ContentInfo);
|
||||
ErrorOr<void> send_redirect(StringView redirect, HTTP::HttpRequest const&);
|
||||
ErrorOr<void> send_error_response(unsigned code, HTTP::HttpRequest const&, Vector<String> const& headers = {});
|
||||
void die();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <LibMain/Main.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static ErrorOr<void> decompress_file(NonnullOwnPtr<Core::File> input_stream, AK::Stream& output_stream)
|
||||
static ErrorOr<void> decompress_file(NonnullOwnPtr<Core::File> input_stream, Stream& output_stream)
|
||||
{
|
||||
auto gzip_stream = Compress::GzipDecompressor { move(input_stream) };
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void stream_into(AK::Stream&) override
|
||||
virtual void stream_into(Stream&) override
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void stream_into(AK::Stream&) override
|
||||
virtual void stream_into(Stream&) override
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void stream_into(AK::Stream&) override
|
||||
virtual void stream_into(Stream&) override
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ static String s_history_path = String {};
|
|||
static int s_repl_line_level = 0;
|
||||
static bool s_fail_repl = false;
|
||||
|
||||
static ErrorOr<void> print(JS::Value value, AK::Stream& stream)
|
||||
static ErrorOr<void> print(JS::Value value, Stream& stream)
|
||||
{
|
||||
JS::PrintContext print_context { .vm = *g_vm, .stream = stream, .strip_ansi = s_strip_ansi };
|
||||
return JS::print(value, print_context);
|
||||
|
|
|
@ -104,9 +104,9 @@ private:
|
|||
|
||||
/// Wraps a stream to silently ignore writes when the condition isn't true.
|
||||
template<typename ConditionT>
|
||||
class ConditionalOutputStream final : public AK::Stream {
|
||||
class ConditionalOutputStream final : public Stream {
|
||||
public:
|
||||
ConditionalOutputStream(ConditionT&& condition, MaybeOwned<AK::Stream> stream)
|
||||
ConditionalOutputStream(ConditionT&& condition, MaybeOwned<Stream> stream)
|
||||
: m_stream(move(stream))
|
||||
, m_condition(condition)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
MaybeOwned<AK::Stream> m_stream;
|
||||
MaybeOwned<Stream> m_stream;
|
||||
ConditionT m_condition;
|
||||
};
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (!directory.is_empty())
|
||||
TRY(Core::System::chdir(directory));
|
||||
|
||||
NonnullOwnPtr<AK::Stream> input_stream = TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read));
|
||||
NonnullOwnPtr<Stream> input_stream = TRY(Core::File::open_file_or_standard_stream(archive_file, Core::File::OpenMode::Read));
|
||||
|
||||
if (gzip)
|
||||
input_stream = make<Compress::GzipDecompressor>(move(input_stream));
|
||||
|
@ -205,7 +205,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
NonnullOwnPtr<AK::Stream> output_stream = TRY(Core::File::standard_output());
|
||||
NonnullOwnPtr<Stream> output_stream = TRY(Core::File::standard_output());
|
||||
|
||||
if (!archive_file.is_empty())
|
||||
output_stream = TRY(Core::File::open(archive_file, Core::File::OpenMode::Write));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
RefPtr<Line::Editor> g_line_editor;
|
||||
static OwnPtr<AK::Stream> g_stdout {};
|
||||
static OwnPtr<Stream> g_stdout {};
|
||||
static OwnPtr<Wasm::Printer> g_printer {};
|
||||
static bool g_continue { false };
|
||||
static void (*old_signal)(int);
|
||||
|
|
Loading…
Reference in a new issue