diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-01-20 14:07:24 +0100 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-01-29 19:16:44 -0700 |
commit | ae64b68717c02b902721e861dbf51c5d32950193 (patch) | |
tree | 74e7205b629f9a51d0af3103ce9fabca1aeefe23 | |
parent | 230cb3b0cb9664839c56f80d6dff3706fffc2243 (diff) | |
download | serenity-ae64b68717c02b902721e861dbf51c5d32950193.zip |
AK: Deprecate the old `AK::Stream`
This also removes a few cases where the respective header wasn't
actually required to be included.
38 files changed, 116 insertions, 120 deletions
diff --git a/AK/Buffered.h b/AK/Buffered.h index dbd446713e..c8651ec253 100644 --- a/AK/Buffered.h +++ b/AK/Buffered.h @@ -119,7 +119,7 @@ private: }; template<typename StreamType, size_t Size> -requires(IsBaseOf<OutputStream, StreamType>) class Buffered<StreamType, Size> : public OutputStream { +requires(IsBaseOf<DeprecatedOutputStream, StreamType>) class Buffered<StreamType, Size> : public DeprecatedOutputStream { AK_MAKE_NONCOPYABLE(Buffered); public: diff --git a/AK/MemoryStream.h b/AK/DeprecatedMemoryStream.h index 93a3c17566..055c0be8ce 100644 --- a/AK/MemoryStream.h +++ b/AK/DeprecatedMemoryStream.h @@ -7,16 +7,16 @@ #pragma once #include <AK/ByteBuffer.h> +#include <AK/DeprecatedStream.h> #include <AK/LEB128.h> #include <AK/MemMem.h> -#include <AK/Stream.h> #include <AK/Vector.h> namespace AK { -class InputMemoryStream final : public InputStream { +class DeprecatedInputMemoryStream final : public DeprecatedInputStream { public: - explicit InputMemoryStream(ReadonlyBytes bytes) + explicit DeprecatedInputMemoryStream(ReadonlyBytes bytes) : m_bytes(bytes) { } @@ -89,9 +89,9 @@ private: size_t m_offset { 0 }; }; -class OutputMemoryStream final : public OutputStream { +class DeprecatedOutputMemoryStream final : public DeprecatedOutputStream { public: - explicit OutputMemoryStream(Bytes bytes) + explicit DeprecatedOutputMemoryStream(Bytes bytes) : m_bytes(bytes) { } @@ -141,7 +141,6 @@ private: } #if USING_AK_GLOBALLY -using AK::InputMemoryStream; -using AK::InputStream; -using AK::OutputMemoryStream; +using AK::DeprecatedInputMemoryStream; +using AK::DeprecatedOutputMemoryStream; #endif diff --git a/AK/Stream.h b/AK/DeprecatedStream.h index c4269da90e..694ed16e3f 100644 --- a/AK/Stream.h +++ b/AK/DeprecatedStream.h @@ -15,9 +15,9 @@ namespace AK::Detail { -class Stream { +class DeprecatedStream { public: - virtual ~Stream() { VERIFY(!has_any_error()); } + virtual ~DeprecatedStream() { VERIFY(!has_any_error()); } virtual bool has_recoverable_error() const { return m_recoverable_error; } virtual bool has_fatal_error() const { return m_fatal_error; } @@ -60,7 +60,7 @@ private: namespace AK { -class InputStream : public virtual Detail::Stream { +class DeprecatedInputStream : public virtual Detail::DeprecatedStream { public: // Reads at least one byte unless none are requested or none are available. Does nothing // and returns zero if there is already an error. @@ -81,52 +81,52 @@ public: virtual bool discard_or_error(size_t count) = 0; }; -class OutputStream : public virtual Detail::Stream { +class DeprecatedOutputStream : public virtual Detail::DeprecatedStream { public: virtual size_t write(ReadonlyBytes) = 0; virtual bool write_or_error(ReadonlyBytes) = 0; }; -class DuplexStream - : public InputStream - , public OutputStream { +class DeprecatedDuplexStream + : public DeprecatedInputStream + , public DeprecatedOutputStream { }; -inline InputStream& operator>>(InputStream& stream, Bytes bytes) +inline DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, Bytes bytes) { stream.read_or_error(bytes); return stream; } -inline OutputStream& operator<<(OutputStream& stream, ReadonlyBytes bytes) +inline DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, ReadonlyBytes bytes) { stream.write_or_error(bytes); return stream; } template<typename T> -InputStream& operator>>(InputStream& stream, LittleEndian<T>& value) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, LittleEndian<T>& value) { return stream >> Bytes { &value.m_value, sizeof(value.m_value) }; } template<typename T> -OutputStream& operator<<(OutputStream& stream, LittleEndian<T> value) +DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, LittleEndian<T> value) { return stream << ReadonlyBytes { &value.m_value, sizeof(value.m_value) }; } template<typename T> -InputStream& operator>>(InputStream& stream, BigEndian<T>& value) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, BigEndian<T>& value) { return stream >> Bytes { &value.m_value, sizeof(value.m_value) }; } template<typename T> -OutputStream& operator<<(OutputStream& stream, BigEndian<T> value) +DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, BigEndian<T> value) { return stream << ReadonlyBytes { &value.m_value, sizeof(value.m_value) }; } template<typename T> -InputStream& operator>>(InputStream& stream, Optional<T>& value) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, Optional<T>& value) { T temporary; stream >> temporary; @@ -135,13 +135,13 @@ InputStream& operator>>(InputStream& stream, Optional<T>& value) } template<Integral I> -InputStream& operator>>(InputStream& stream, I& value) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, I& value) { stream.read_or_error({ &value, sizeof(value) }); return stream; } template<Integral I> -OutputStream& operator<<(OutputStream& stream, I value) +DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, I value) { stream.write_or_error({ &value, sizeof(value) }); return stream; @@ -150,13 +150,13 @@ OutputStream& operator<<(OutputStream& stream, I value) #ifndef KERNEL template<FloatingPoint F> -InputStream& operator>>(InputStream& stream, F& value) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, F& value) { stream.read_or_error({ &value, sizeof(value) }); return stream; } template<FloatingPoint F> -OutputStream& operator<<(OutputStream& stream, F value) +DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, F value) { stream.write_or_error({ &value, sizeof(value) }); return stream; diff --git a/AK/DeprecatedString.cpp b/AK/DeprecatedString.cpp index 9c45cced07..cd5da89d83 100644 --- a/AK/DeprecatedString.cpp +++ b/AK/DeprecatedString.cpp @@ -6,6 +6,7 @@ #include <AK/ByteBuffer.h> #include <AK/DeprecatedFlyString.h> +#include <AK/DeprecatedStream.h> #include <AK/DeprecatedString.h> #include <AK/Format.h> #include <AK/Function.h> @@ -415,7 +416,7 @@ bool DeprecatedString::operator==(char const* cstring) const return view() == cstring; } -InputStream& operator>>(InputStream& stream, DeprecatedString& string) +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, DeprecatedString& string) { StringBuilder builder; diff --git a/AK/DeprecatedString.h b/AK/DeprecatedString.h index 35474f9bff..011dd45703 100644 --- a/AK/DeprecatedString.h +++ b/AK/DeprecatedString.h @@ -9,7 +9,6 @@ #include <AK/Format.h> #include <AK/Forward.h> #include <AK/RefPtr.h> -#include <AK/Stream.h> #include <AK/StringBuilder.h> #include <AK/StringImpl.h> #include <AK/StringUtils.h> @@ -339,7 +338,7 @@ struct CaseInsensitiveStringTraits : public Traits<DeprecatedString> { DeprecatedString escape_html_entities(StringView html); -InputStream& operator>>(InputStream& stream, DeprecatedString& string); +DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, DeprecatedString& string); } diff --git a/AK/Endian.h b/AK/Endian.h index bfa64b9777..92bf739ceb 100644 --- a/AK/Endian.h +++ b/AK/Endian.h @@ -80,16 +80,16 @@ template<typename T> class LittleEndian; template<typename T> -InputStream& operator>>(InputStream&, LittleEndian<T>&); +DeprecatedInputStream& operator>>(DeprecatedInputStream&, LittleEndian<T>&); template<typename T> -OutputStream& operator<<(OutputStream&, LittleEndian<T>); +DeprecatedOutputStream& operator<<(DeprecatedOutputStream&, LittleEndian<T>); template<typename T> class [[gnu::packed]] LittleEndian { public: - friend InputStream& operator>><T>(InputStream&, LittleEndian<T>&); - friend OutputStream& operator<< <T>(OutputStream&, LittleEndian<T>); + friend DeprecatedInputStream& operator>><T>(DeprecatedInputStream&, LittleEndian<T>&); + friend DeprecatedOutputStream& operator<< <T>(DeprecatedOutputStream&, LittleEndian<T>); constexpr LittleEndian() = default; @@ -112,16 +112,16 @@ template<typename T> class BigEndian; template<typename T> -InputStream& operator>>(InputStream&, BigEndian<T>&); +DeprecatedInputStream& operator>>(DeprecatedInputStream&, BigEndian<T>&); template<typename T> -OutputStream& operator<<(OutputStream&, BigEndian<T>); +DeprecatedOutputStream& operator<<(DeprecatedOutputStream&, BigEndian<T>); template<typename T> class [[gnu::packed]] BigEndian { public: - friend InputStream& operator>><T>(InputStream&, BigEndian<T>&); - friend OutputStream& operator<< <T>(OutputStream&, BigEndian<T>); + friend DeprecatedInputStream& operator>><T>(DeprecatedInputStream&, BigEndian<T>&); + friend DeprecatedOutputStream& operator<< <T>(DeprecatedOutputStream&, BigEndian<T>); constexpr BigEndian() = default; diff --git a/AK/Forward.h b/AK/Forward.h index 786ab02f6c..b0d7815298 100644 --- a/AK/Forward.h +++ b/AK/Forward.h @@ -20,6 +20,10 @@ class ByteBuffer; class Bitmap; using ByteBuffer = Detail::ByteBuffer<32>; class CircularBuffer; +class DeprecatedInputStream; +class DeprecatedInputMemoryStream; +class DeprecatedOutputStream; +class DeprecatedOutputMemoryStream; class Error; class FlyString; class GenericLexer; @@ -41,10 +45,6 @@ class Utf16View; class Utf32View; class Utf8CodePointIterator; class Utf8View; -class InputStream; -class InputMemoryStream; -class OutputStream; -class OutputMemoryStream; template<typename T> class Span; @@ -156,6 +156,10 @@ using AK::Bytes; using AK::CircularBuffer; using AK::CircularQueue; using AK::DeprecatedFlyString; +using AK::DeprecatedInputMemoryStream; +using AK::DeprecatedInputStream; +using AK::DeprecatedOutputMemoryStream; +using AK::DeprecatedOutputStream; using AK::DeprecatedString; using AK::DeprecatedStringCodePointIterator; using AK::DoublyLinkedList; @@ -167,8 +171,6 @@ using AK::Function; using AK::GenericLexer; using AK::HashMap; using AK::HashTable; -using AK::InputMemoryStream; -using AK::InputStream; using AK::IPv4Address; using AK::JsonArray; using AK::JsonObject; @@ -178,8 +180,6 @@ using AK::NonnullOwnPtrVector; using AK::NonnullRefPtr; using AK::NonnullRefPtrVector; using AK::Optional; -using AK::OutputMemoryStream; -using AK::OutputStream; using AK::OwnPtr; using AK::ReadonlyBytes; using AK::RefPtr; diff --git a/AK/LEB128.h b/AK/LEB128.h index 47b29f584d..f9258fd866 100644 --- a/AK/LEB128.h +++ b/AK/LEB128.h @@ -6,8 +6,8 @@ #pragma once +#include <AK/DeprecatedStream.h> #include <AK/NumericLimits.h> -#include <AK/Stream.h> #include <AK/Types.h> namespace AK { @@ -19,7 +19,7 @@ struct LEB128 { [[maybe_unused]] size_t backup_offset = 0; if constexpr (requires { stream.offset(); }) backup_offset = stream.offset(); - InputStream& input_stream { stream }; + DeprecatedInputStream& input_stream { stream }; result = 0; size_t num_bytes = 0; @@ -62,7 +62,7 @@ struct LEB128 { [[maybe_unused]] size_t backup_offset = 0; if constexpr (requires { stream.offset(); }) backup_offset = stream.offset(); - InputStream& input_stream { stream }; + DeprecatedInputStream& input_stream { stream }; i64 temp = 0; size_t num_bytes = 0; diff --git a/Kernel/FileSystem/Ext2FS/Inode.cpp b/Kernel/FileSystem/Ext2FS/Inode.cpp index 29436f1821..5540b1b2b0 100644 --- a/Kernel/FileSystem/Ext2FS/Inode.cpp +++ b/Kernel/FileSystem/Ext2FS/Inode.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/MemoryStream.h> +#include <AK/DeprecatedMemoryStream.h> #include <Kernel/API/POSIX/errno.h> #include <Kernel/Debug.h> #include <Kernel/FileSystem/Ext2FS/Inode.h> @@ -41,7 +41,7 @@ ErrorOr<void> Ext2FSInode::write_indirect_block(BlockBasedFileSystem::BlockIndex VERIFY(blocks_indices.size() <= entries_per_block); auto block_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size())); - OutputMemoryStream stream { block_contents }; + DeprecatedOutputMemoryStream stream { block_contents }; auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data()); VERIFY(blocks_indices.size() <= EXT2_ADDR_PER_BLOCK(&fs().super_block())); @@ -64,7 +64,7 @@ ErrorOr<void> Ext2FSInode::grow_doubly_indirect_block(BlockBasedFileSystem::Bloc auto block_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size())); auto* block_as_pointers = (unsigned*)block_contents.data(); - OutputMemoryStream stream { block_contents }; + DeprecatedOutputMemoryStream stream { block_contents }; auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data()); if (old_blocks_length > 0) { @@ -137,7 +137,7 @@ ErrorOr<void> Ext2FSInode::grow_triply_indirect_block(BlockBasedFileSystem::Bloc auto block_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size())); auto* block_as_pointers = (unsigned*)block_contents.data(); - OutputMemoryStream stream { block_contents }; + DeprecatedOutputMemoryStream stream { block_contents }; auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data()); if (old_blocks_length > 0) { @@ -790,7 +790,7 @@ ErrorOr<void> Ext2FSInode::write_directory(Vector<Ext2FSDirectoryEntry>& entries dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::write_directory(): New directory contents to write (size {}):", identifier(), directory_size); auto directory_data = TRY(ByteBuffer::create_uninitialized(directory_size)); - OutputMemoryStream stream { directory_data }; + DeprecatedOutputMemoryStream stream { directory_data }; for (auto& entry : entries) { dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::write_directory(): Writing inode: {}, name_len: {}, rec_len: {}, file_type: {}, name: {}", identifier(), entry.inode_index, u16(entry.name->length()), u16(entry.record_length), u8(entry.file_type), entry.name); diff --git a/Kernel/FileSystem/OpenFileDescription.cpp b/Kernel/FileSystem/OpenFileDescription.cpp index 0a17c3062b..360270fe5a 100644 --- a/Kernel/FileSystem/OpenFileDescription.cpp +++ b/Kernel/FileSystem/OpenFileDescription.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/MemoryStream.h> +#include <AK/DeprecatedMemoryStream.h> #include <Kernel/API/POSIX/errno.h> #include <Kernel/Devices/BlockDevice.h> #include <Kernel/FileSystem/Custody.h> @@ -223,7 +223,7 @@ ErrorOr<size_t> OpenFileDescription::get_dir_entries(UserOrKernelBuffer& output_ ErrorOr<void> error; u8 stack_buffer[PAGE_SIZE]; Bytes temp_buffer(stack_buffer, sizeof(stack_buffer)); - OutputMemoryStream stream { temp_buffer }; + DeprecatedOutputMemoryStream stream { temp_buffer }; auto flush_stream_to_output_buffer = [&error, &stream, &remaining, &output_buffer]() -> bool { if (error.is_error()) diff --git a/Tests/AK/CMakeLists.txt b/Tests/AK/CMakeLists.txt index 6158570698..588997d53b 100644 --- a/Tests/AK/CMakeLists.txt +++ b/Tests/AK/CMakeLists.txt @@ -18,6 +18,7 @@ set(AK_TEST_SOURCES TestCircularDeque.cpp TestCircularQueue.cpp TestComplex.cpp + TestDeprecatedMemoryStream.cpp TestDeprecatedString.cpp TestDisjointChunks.cpp TestDistinctNumeric.cpp @@ -48,7 +49,6 @@ set(AK_TEST_SOURCES TestLexicalPath.cpp TestMACAddress.cpp TestMemory.cpp - TestMemoryStream.cpp TestNeverDestroyed.cpp TestNonnullRefPtr.cpp TestNumberFormat.cpp diff --git a/Tests/AK/TestMemoryStream.cpp b/Tests/AK/TestDeprecatedMemoryStream.cpp index f46db2b2d5..18dc3bb9f4 100644 --- a/Tests/AK/TestMemoryStream.cpp +++ b/Tests/AK/TestDeprecatedMemoryStream.cpp @@ -7,13 +7,13 @@ #include <LibTest/TestCase.h> #include <AK/Array.h> -#include <AK/MemoryStream.h> +#include <AK/DeprecatedMemoryStream.h> TEST_CASE(read_an_integer) { u32 expected = 0x01020304, actual; - InputMemoryStream stream { { &expected, sizeof(expected) } }; + DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } }; stream >> actual; EXPECT(!stream.has_any_error() && stream.eof()); @@ -24,7 +24,7 @@ TEST_CASE(read_a_bool) { bool expected = true, actual; - InputMemoryStream stream { { &expected, sizeof(expected) } }; + DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } }; stream >> actual; EXPECT(!stream.has_any_error() && stream.eof()); @@ -35,7 +35,7 @@ TEST_CASE(read_a_double) { double expected = 3.141592653589793, actual; - InputMemoryStream stream { { &expected, sizeof(expected) } }; + DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } }; stream >> actual; EXPECT(!stream.has_any_error() && stream.eof()); @@ -47,7 +47,7 @@ TEST_CASE(recoverable_error) u32 expected = 0x01020304, actual = 0; u64 to_large_value = 0; - InputMemoryStream stream { { &expected, sizeof(expected) } }; + DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } }; EXPECT(!stream.has_any_error() && !stream.eof()); stream >> to_large_value; @@ -66,7 +66,7 @@ TEST_CASE(chain_stream_operator) Array<u8, 4> const expected { 0, 1, 2, 3 }; Array<u8, 4> actual; - InputMemoryStream stream { expected }; + DeprecatedInputMemoryStream stream { expected }; stream >> actual[0] >> actual[1] >> actual[2] >> actual[3]; EXPECT(!stream.has_any_error() && stream.eof()); @@ -83,7 +83,7 @@ TEST_CASE(seeking_slicing_offset) Array<u8, 4> actual0 {}, actual1 {}, actual2 {}; - InputMemoryStream stream { input }; + DeprecatedInputMemoryStream stream { input }; stream >> actual0; EXPECT(!stream.has_any_error() && !stream.eof()); @@ -103,7 +103,7 @@ TEST_CASE(seeking_slicing_offset) TEST_CASE(read_endian_values) { Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 }; - InputMemoryStream stream { input }; + DeprecatedInputMemoryStream stream { input }; LittleEndian<u32> value1; BigEndian<u32> value2; @@ -116,7 +116,7 @@ TEST_CASE(read_endian_values) TEST_CASE(new_output_memory_stream) { Array<u8, 16> buffer; - OutputMemoryStream stream { buffer }; + DeprecatedOutputMemoryStream stream { buffer }; EXPECT_EQ(stream.size(), 0u); EXPECT_EQ(stream.remaining(), 16u); diff --git a/Tests/AK/TestLEB128.cpp b/Tests/AK/TestLEB128.cpp index ce5ee65cde..d7502afcf1 100644 --- a/Tests/AK/TestLEB128.cpp +++ b/Tests/AK/TestLEB128.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/DeprecatedMemoryStream.h> #include <AK/LEB128.h> -#include <AK/MemoryStream.h> #include <AK/NumericLimits.h> #include <LibTest/TestCase.h> @@ -14,7 +14,7 @@ TEST_CASE(single_byte) u32 output = {}; i32 output_signed = {}; u8 buf[] = { 0x00 }; - InputMemoryStream stream({ buf, sizeof(buf) }); + DeprecatedInputMemoryStream stream({ buf, sizeof(buf) }); // less than/eq 0b0011_1111, signed == unsigned == raw byte for (u8 i = 0u; i <= 0x3F; ++i) { @@ -64,7 +64,7 @@ TEST_CASE(two_bytes) u32 output = {}; i32 output_signed = {}; u8 buf[] = { 0x00, 0x1 }; - InputMemoryStream stream({ buf, sizeof(buf) }); + DeprecatedInputMemoryStream stream({ buf, sizeof(buf) }); // Only test with first byte expecting more, otherwise equivalent to single byte case for (u16 i = 0x80; i <= 0xFF; ++i) { @@ -120,7 +120,7 @@ TEST_CASE(overflow_sizeof_output_unsigned) u8 u32_max_plus_one[] = { 0x80, 0x80, 0x80, 0x80, 0x10 }; { u32 out = 0; - InputMemoryStream stream({ u32_max_plus_one, sizeof(u32_max_plus_one) }); + DeprecatedInputMemoryStream stream({ u32_max_plus_one, sizeof(u32_max_plus_one) }); EXPECT(!LEB128::read_unsigned(stream, out)); EXPECT_EQ(out, 0u); EXPECT(!stream.handle_any_error()); @@ -135,7 +135,7 @@ TEST_CASE(overflow_sizeof_output_unsigned) u8 u32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x0F }; { u32 out = 0; - InputMemoryStream stream({ u32_max, sizeof(u32_max) }); + DeprecatedInputMemoryStream stream({ u32_max, sizeof(u32_max) }); EXPECT(LEB128::read_unsigned(stream, out)); EXPECT_EQ(out, NumericLimits<u32>::max()); EXPECT(!stream.handle_any_error()); @@ -153,7 +153,7 @@ TEST_CASE(overflow_sizeof_output_signed) u8 i32_max_plus_one[] = { 0x80, 0x80, 0x80, 0x80, 0x08 }; { i32 out = 0; - InputMemoryStream stream({ i32_max_plus_one, sizeof(i32_max_plus_one) }); + DeprecatedInputMemoryStream stream({ i32_max_plus_one, sizeof(i32_max_plus_one) }); EXPECT(!LEB128::read_signed(stream, out)); EXPECT_EQ(out, 0); EXPECT(!stream.handle_any_error()); @@ -168,7 +168,7 @@ TEST_CASE(overflow_sizeof_output_signed) u8 i32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x07 }; { i32 out = 0; - InputMemoryStream stream({ i32_max, sizeof(i32_max) }); + DeprecatedInputMemoryStream stream({ i32_max, sizeof(i32_max) }); EXPECT(LEB128::read_signed(stream, out)); EXPECT_EQ(out, NumericLimits<i32>::max()); EXPECT(!stream.handle_any_error()); @@ -183,7 +183,7 @@ TEST_CASE(overflow_sizeof_output_signed) u8 i32_min_minus_one[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x77 }; { i32 out = 0; - InputMemoryStream stream({ i32_min_minus_one, sizeof(i32_min_minus_one) }); + DeprecatedInputMemoryStream stream({ i32_min_minus_one, sizeof(i32_min_minus_one) }); EXPECT(!LEB128::read_signed(stream, out)); EXPECT_EQ(out, 0); EXPECT(!stream.handle_any_error()); @@ -198,7 +198,7 @@ TEST_CASE(overflow_sizeof_output_signed) u8 i32_min[] = { 0x80, 0x80, 0x80, 0x80, 0x78 }; { i32 out = 0; - InputMemoryStream stream({ i32_min, sizeof(i32_min) }); + DeprecatedInputMemoryStream stream({ i32_min, sizeof(i32_min) }); EXPECT(LEB128::read_signed(stream, out)); EXPECT_EQ(out, NumericLimits<i32>::min()); EXPECT(!stream.handle_any_error()); diff --git a/Tests/LibCompress/TestDeflate.cpp b/Tests/LibCompress/TestDeflate.cpp index 8c96024aff..56fd34b733 100644 --- a/Tests/LibCompress/TestDeflate.cpp +++ b/Tests/LibCompress/TestDeflate.cpp @@ -7,7 +7,6 @@ #include <LibTest/TestCase.h> #include <AK/Array.h> -#include <AK/MemoryStream.h> #include <AK/Random.h> #include <LibCompress/Deflate.h> #include <LibCore/BitStream.h> diff --git a/Userland/Libraries/LibAudio/MP3Loader.h b/Userland/Libraries/LibAudio/MP3Loader.h index 9fcd2a51f4..de00366087 100644 --- a/Userland/Libraries/LibAudio/MP3Loader.h +++ b/Userland/Libraries/LibAudio/MP3Loader.h @@ -8,7 +8,6 @@ #include "Loader.h" #include "MP3Types.h" -#include <AK/MemoryStream.h> #include <AK/Tuple.h> #include <LibCore/BitStream.h> #include <LibCore/MemoryStream.h> diff --git a/Userland/Libraries/LibCore/NetworkJob.h b/Userland/Libraries/LibCore/NetworkJob.h index 17babf4d8b..24c8f9044a 100644 --- a/Userland/Libraries/LibCore/NetworkJob.h +++ b/Userland/Libraries/LibCore/NetworkJob.h @@ -8,7 +8,6 @@ #pragma once #include <AK/Function.h> -#include <AK/Stream.h> #include <LibCore/Forward.h> #include <LibCore/Object.h> #include <LibCore/Stream.h> diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index 022535a6f6..c54b8891a4 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -704,7 +704,7 @@ ErrorOr<int> LocalSocket::release_fd() return fd; } -WrappedAKInputStream::WrappedAKInputStream(NonnullOwnPtr<InputStream> stream) +WrappedAKInputStream::WrappedAKInputStream(NonnullOwnPtr<DeprecatedInputStream> stream) : m_stream(move(stream)) { } @@ -746,7 +746,7 @@ void WrappedAKInputStream::close() { } -WrappedAKOutputStream::WrappedAKOutputStream(NonnullOwnPtr<OutputStream> stream) +WrappedAKOutputStream::WrappedAKOutputStream(NonnullOwnPtr<DeprecatedOutputStream> stream) : m_stream(move(stream)) { } diff --git a/Userland/Libraries/LibCore/Stream.h b/Userland/Libraries/LibCore/Stream.h index 1351a41a8a..556c90ee12 100644 --- a/Userland/Libraries/LibCore/Stream.h +++ b/Userland/Libraries/LibCore/Stream.h @@ -9,6 +9,7 @@ #include <AK/Badge.h> #include <AK/CircularBuffer.h> +#include <AK/DeprecatedStream.h> #include <AK/DeprecatedString.h> #include <AK/EnumBits.h> #include <AK/Function.h> @@ -1071,7 +1072,7 @@ using ReusableUDPSocket = BasicReusableSocket<UDPSocket>; // Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts. class WrappedAKInputStream final : public Stream { public: - WrappedAKInputStream(NonnullOwnPtr<InputStream> stream); + WrappedAKInputStream(NonnullOwnPtr<DeprecatedInputStream> stream); virtual ErrorOr<Bytes> read(Bytes) override; virtual ErrorOr<void> discard(size_t discarded_bytes) override; virtual ErrorOr<size_t> write(ReadonlyBytes) override; @@ -1080,13 +1081,13 @@ public: virtual void close() override; private: - NonnullOwnPtr<InputStream> m_stream; + NonnullOwnPtr<DeprecatedInputStream> m_stream; }; // Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts. class WrappedAKOutputStream final : public Stream { public: - WrappedAKOutputStream(NonnullOwnPtr<OutputStream> stream); + WrappedAKOutputStream(NonnullOwnPtr<DeprecatedOutputStream> stream); virtual ErrorOr<Bytes> read(Bytes) override; virtual ErrorOr<size_t> write(ReadonlyBytes) override; virtual bool is_eof() const override; @@ -1094,11 +1095,11 @@ public: virtual void close() override; private: - NonnullOwnPtr<OutputStream> m_stream; + NonnullOwnPtr<DeprecatedOutputStream> m_stream; }; // Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts. -class WrapInAKInputStream final : public InputStream { +class WrapInAKInputStream final : public DeprecatedInputStream { public: WrapInAKInputStream(Core::Stream::Stream& stream); virtual size_t read(Bytes) override; @@ -1111,7 +1112,7 @@ private: }; // Note: This is only a temporary hack, to break up the task of moving away from AK::Stream into smaller parts. -class WrapInAKOutputStream final : public OutputStream { +class WrapInAKOutputStream final : public DeprecatedOutputStream { public: WrapInAKOutputStream(Core::Stream::Stream& stream); virtual size_t write(ReadonlyBytes) override; diff --git a/Userland/Libraries/LibCrypto/ASN1/DER.cpp b/Userland/Libraries/LibCrypto/ASN1/DER.cpp index 194ab661fa..7b366e9463 100644 --- a/Userland/Libraries/LibCrypto/ASN1/DER.cpp +++ b/Userland/Libraries/LibCrypto/ASN1/DER.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/DeprecatedStream.h> #include <AK/Try.h> #include <AK/Utf8View.h> #include <LibCrypto/ASN1/DER.h> @@ -223,7 +224,7 @@ Optional<DecodeError> Decoder::leave() return {}; } -void pretty_print(Decoder& decoder, OutputStream& stream, int indent) +void pretty_print(Decoder& decoder, DeprecatedOutputStream& stream, int indent) { while (!decoder.eof()) { auto tag = decoder.peek(); diff --git a/Userland/Libraries/LibCrypto/ASN1/DER.h b/Userland/Libraries/LibCrypto/ASN1/DER.h index e3c3f46778..fead60158b 100644 --- a/Userland/Libraries/LibCrypto/ASN1/DER.h +++ b/Userland/Libraries/LibCrypto/ASN1/DER.h @@ -226,7 +226,7 @@ private: Optional<Tag> m_current_tag; }; -void pretty_print(Decoder&, OutputStream&, int indent = 0); +void pretty_print(Decoder&, DeprecatedOutputStream&, int indent = 0); } diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp index 396da9b53f..253c138f6d 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp @@ -6,7 +6,7 @@ #include <AK/ByteReader.h> #include <AK/Debug.h> -#include <AK/MemoryStream.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/Types.h> #include <LibCrypto/Authentication/GHash.h> @@ -47,7 +47,7 @@ GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher) if (i > buf.size()) { static u8 buffer[16]; Bytes buffer_bytes { buffer, 16 }; - OutputMemoryStream stream { buffer_bytes }; + DeprecatedOutputMemoryStream stream { buffer_bytes }; stream.write(buf.slice(i - 16)); stream.fill_to_end(0); diff --git a/Userland/Libraries/LibDNS/Answer.cpp b/Userland/Libraries/LibDNS/Answer.cpp index 62d8d19950..33471068ba 100644 --- a/Userland/Libraries/LibDNS/Answer.cpp +++ b/Userland/Libraries/LibDNS/Answer.cpp @@ -5,7 +5,6 @@ */ #include "Answer.h" -#include <AK/Stream.h> #include <LibIPC/Decoder.h> #include <LibIPC/Encoder.h> #include <time.h> diff --git a/Userland/Libraries/LibDNS/Packet.cpp b/Userland/Libraries/LibDNS/Packet.cpp index b79fc7b2f1..211ef36892 100644 --- a/Userland/Libraries/LibDNS/Packet.cpp +++ b/Userland/Libraries/LibDNS/Packet.cpp @@ -9,7 +9,6 @@ #include "Name.h" #include "PacketHeader.h" #include <AK/Debug.h> -#include <AK/MemoryStream.h> #include <AK/StringBuilder.h> #include <LibCore/MemoryStream.h> #include <arpa/inet.h> diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp index e5dcb609d8..f8bd838b22 100644 --- a/Userland/Libraries/LibGfx/Bitmap.cpp +++ b/Userland/Libraries/LibGfx/Bitmap.cpp @@ -7,10 +7,10 @@ #include <AK/Bitmap.h> #include <AK/Checked.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/DeprecatedString.h> #include <AK/LexicalPath.h> #include <AK/Memory.h> -#include <AK/MemoryStream.h> #include <AK/Optional.h> #include <AK/Queue.h> #include <AK/ScopeGuard.h> @@ -212,7 +212,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_byte_buffer(ByteBu /// - image data (= actual size * u8) ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_bytes(ReadonlyBytes bytes) { - InputMemoryStream stream { bytes }; + DeprecatedInputMemoryStream stream { bytes }; size_t actual_size; unsigned width; unsigned height; @@ -260,7 +260,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const { // FIXME: Somehow handle possible OOM situation here. auto buffer = ByteBuffer::create_uninitialized(sizeof(size_t) + 4 * sizeof(unsigned) + sizeof(BitmapFormat) + sizeof(ARGB32) * palette_size(m_format) + size_in_bytes()).release_value_but_fixme_should_propagate_errors(); - OutputMemoryStream stream { buffer }; + DeprecatedOutputMemoryStream stream { buffer }; auto write = [&]<typename T>(T value) { if (stream.write({ &value, sizeof(T) }) != sizeof(T)) diff --git a/Userland/Libraries/LibGfx/DDSLoader.cpp b/Userland/Libraries/LibGfx/DDSLoader.cpp index 80233d86aa..e0765c0549 100644 --- a/Userland/Libraries/LibGfx/DDSLoader.cpp +++ b/Userland/Libraries/LibGfx/DDSLoader.cpp @@ -5,10 +5,10 @@ */ #include <AK/Debug.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/DeprecatedString.h> #include <AK/Endian.h> #include <AK/Error.h> -#include <AK/MemoryStream.h> #include <AK/StringBuilder.h> #include <AK/Try.h> #include <AK/Vector.h> @@ -454,7 +454,7 @@ static size_t bits_per_pixel(DXGIFormat format) } } -static void decode_dx5_alpha_block(InputMemoryStream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y) +static void decode_dx5_alpha_block(DeprecatedInputMemoryStream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y) { LittleEndian<u8> color0 {}, color1 {}; LittleEndian<u8> code0 {}, code1 {}, code2 {}, code3 {}, code4 {}, code5 {}; @@ -517,7 +517,7 @@ static void decode_dx5_alpha_block(InputMemoryStream& stream, DDSLoadingContext& } } -static void decode_dx3_alpha_block(InputMemoryStream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y) +static void decode_dx3_alpha_block(DeprecatedInputMemoryStream& stream, DDSLoadingContext& context, u64 bitmap_x, u64 bitmap_y) { LittleEndian<u8> a0 {}, a1 {}, a2 {}, a3 {}, a4 {}, a5 {}, a6 {}, a7 {}; @@ -565,7 +565,7 @@ static void unpack_rbg_565(u32 rgb, u8* output) output[3] = 255; } -static void decode_color_block(InputMemoryStream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y) +static void decode_color_block(DeprecatedInputMemoryStream& stream, DDSLoadingContext& context, bool dxt1, u64 bitmap_x, u64 bitmap_y) { LittleEndian<u8> c0_low {}, c0_high {}, c1_low {}, c1_high {}; LittleEndian<u8> codes_0 {}, codes_1 {}, codes_2 {}, codes_3 {}; @@ -621,7 +621,7 @@ static void decode_color_block(InputMemoryStream& stream, DDSLoadingContext& con } } -static void decode_dxt(InputMemoryStream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y) +static void decode_dxt(DeprecatedInputMemoryStream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 y) { if (format == DXGI_FORMAT_BC1_UNORM) { for (size_t x = 0; x < width; x += 4) { @@ -643,7 +643,7 @@ static void decode_dxt(InputMemoryStream& stream, DDSLoadingContext& context, DX } } } -static void decode_bitmap(InputMemoryStream& stream, DDSLoadingContext& context, DXGIFormat format, u64 width, u64 height) +static void decode_bitmap(DeprecatedInputMemoryStream& 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)) { @@ -698,7 +698,7 @@ static size_t get_minimum_bytes_for_mipmap(DXGIFormat format, u64 width, u64 hei static ErrorOr<void> decode_dds(DDSLoadingContext& context) { - InputMemoryStream stream({ context.data, context.data_size }); + DeprecatedInputMemoryStream stream({ context.data, context.data_size }); // All valid DDS files are at least 128 bytes long. if (stream.remaining() < 128) { diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Glyf.h b/Userland/Libraries/LibGfx/Font/OpenType/Glyf.h index 8ac4b53d24..d9001f8fd8 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Glyf.h +++ b/Userland/Libraries/LibGfx/Font/OpenType/Glyf.h @@ -6,6 +6,7 @@ #pragma once +#include <AK/Endian.h> #include <AK/Span.h> #include <AK/Vector.h> #include <LibGfx/AffineTransform.h> diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp index ca9369c5da..9f8d236efc 100644 --- a/Userland/Libraries/LibGfx/GIFLoader.cpp +++ b/Userland/Libraries/LibGfx/GIFLoader.cpp @@ -7,6 +7,7 @@ #include <AK/Array.h> #include <AK/Debug.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/Error.h> #include <AK/IntegralMath.h> #include <AK/Memory.h> diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index ba27bc67cf..05b8b2f3e6 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -6,7 +6,7 @@ #include <AK/ByteBuffer.h> #include <AK/Debug.h> -#include <AK/MemoryStream.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/NonnullOwnPtrVector.h> #include <AK/Types.h> #include <LibGfx/BMPLoader.h> @@ -59,7 +59,7 @@ struct ICOLoadingContext { size_t largest_index; }; -static Optional<size_t> decode_ico_header(InputMemoryStream& stream) +static Optional<size_t> decode_ico_header(DeprecatedInputMemoryStream& stream) { ICONDIR header; stream >> Bytes { &header, sizeof(header) }; @@ -71,7 +71,7 @@ static Optional<size_t> decode_ico_header(InputMemoryStream& stream) return { header.image_count }; } -static Optional<ICOImageDescriptor> decode_ico_direntry(InputMemoryStream& stream) +static Optional<ICOImageDescriptor> decode_ico_direntry(DeprecatedInputMemoryStream& stream) { ICONDIRENTRY entry; stream >> Bytes { &entry, sizeof(entry) }; @@ -108,7 +108,7 @@ static size_t find_largest_image(ICOLoadingContext const& context) static bool load_ico_directory(ICOLoadingContext& context) { - InputMemoryStream stream { { context.data, context.data_size } }; + DeprecatedInputMemoryStream stream { { context.data, context.data_size } }; auto image_count = decode_ico_header(stream); if (!image_count.has_value() || image_count.value() == 0) { @@ -187,7 +187,7 @@ bool ICOImageDecoderPlugin::load_ico_bitmap(ICOLoadingContext& context, Optional ErrorOr<bool> ICOImageDecoderPlugin::sniff(ReadonlyBytes data) { - InputMemoryStream stream { { data.data(), data.size() } }; + DeprecatedInputMemoryStream stream { { data.data(), data.size() } }; return decode_ico_header(stream).has_value(); } @@ -237,7 +237,7 @@ bool ICOImageDecoderPlugin::set_nonvolatile(bool& was_purged) bool ICOImageDecoderPlugin::initialize() { - InputMemoryStream stream { { m_context->data, m_context->data_size } }; + DeprecatedInputMemoryStream stream { { m_context->data, m_context->data_size } }; return decode_ico_header(stream).has_value(); } diff --git a/Userland/Libraries/LibGfx/QOIWriter.cpp b/Userland/Libraries/LibGfx/QOIWriter.cpp index 77a1db8e14..56faf6042d 100644 --- a/Userland/Libraries/LibGfx/QOIWriter.cpp +++ b/Userland/Libraries/LibGfx/QOIWriter.cpp @@ -6,6 +6,7 @@ #include "QOIWriter.h" #include <AK/DeprecatedString.h> +#include <AK/Endian.h> namespace Gfx { diff --git a/Userland/Libraries/LibIPC/Decoder.h b/Userland/Libraries/LibIPC/Decoder.h index 2bd1283576..b47edb5e99 100644 --- a/Userland/Libraries/LibIPC/Decoder.h +++ b/Userland/Libraries/LibIPC/Decoder.h @@ -9,7 +9,6 @@ #include <AK/Concepts.h> #include <AK/DeprecatedString.h> #include <AK/Forward.h> -#include <AK/MemoryStream.h> #include <AK/NumericLimits.h> #include <AK/StdLibExtras.h> #include <AK/Try.h> diff --git a/Userland/Libraries/LibPDF/DocumentParser.cpp b/Userland/Libraries/LibPDF/DocumentParser.cpp index 39dfee8c70..3f592cf4a1 100644 --- a/Userland/Libraries/LibPDF/DocumentParser.cpp +++ b/Userland/Libraries/LibPDF/DocumentParser.cpp @@ -5,7 +5,6 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <AK/MemoryStream.h> #include <AK/Tuple.h> #include <LibCore/BitStream.h> #include <LibCore/MemoryStream.h> diff --git a/Userland/Libraries/LibPDF/Fonts/CFF.cpp b/Userland/Libraries/LibPDF/Fonts/CFF.cpp index db7dce8343..18e2290787 100644 --- a/Userland/Libraries/LibPDF/Fonts/CFF.cpp +++ b/Userland/Libraries/LibPDF/Fonts/CFF.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <AK/Endian.h> #include <AK/String.h> #include <LibGfx/Forward.h> #include <LibPDF/Encoding.h> diff --git a/Userland/Libraries/LibProtocol/Request.h b/Userland/Libraries/LibProtocol/Request.h index d3cd12953c..4275d198cc 100644 --- a/Userland/Libraries/LibProtocol/Request.h +++ b/Userland/Libraries/LibProtocol/Request.h @@ -10,7 +10,6 @@ #include <AK/ByteBuffer.h> #include <AK/DeprecatedString.h> #include <AK/Function.h> -#include <AK/MemoryStream.h> #include <AK/RefCounted.h> #include <AK/WeakPtr.h> #include <LibCore/MemoryStream.h> diff --git a/Userland/Libraries/LibTLS/Record.cpp b/Userland/Libraries/LibTLS/Record.cpp index 00c63b38e9..3496ab1a57 100644 --- a/Userland/Libraries/LibTLS/Record.cpp +++ b/Userland/Libraries/LibTLS/Record.cpp @@ -5,8 +5,8 @@ */ #include <AK/Debug.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/Endian.h> -#include <AK/MemoryStream.h> #include <LibCore/EventLoop.h> #include <LibCore/Timer.h> #include <LibCrypto/PK/Code/EMSA_PSS.h> @@ -141,7 +141,7 @@ void TLSv12::update_packet(ByteBuffer& packet) // length (2) u8 aad[13]; Bytes aad_bytes { aad, 13 }; - OutputMemoryStream aad_stream { aad_bytes }; + DeprecatedOutputMemoryStream aad_stream { aad_bytes }; u64 seq_no = AK::convert_between_host_and_network_endian(m_context.local_sequence_number); u16 len = AK::convert_between_host_and_network_endian((u16)(packet.size() - header_size)); @@ -382,7 +382,7 @@ ssize_t TLSv12::handle_message(ReadonlyBytes buffer) // length (2) u8 aad[13]; Bytes aad_bytes { aad, 13 }; - OutputMemoryStream aad_stream { aad_bytes }; + DeprecatedOutputMemoryStream aad_stream { aad_bytes }; u64 seq_no = AK::convert_between_host_and_network_endian(m_context.remote_sequence_number); u16 len = AK::convert_between_host_and_network_endian((u16)packet_length); diff --git a/Userland/Libraries/LibWasm/Types.h b/Userland/Libraries/LibWasm/Types.h index f221e84750..05e8c814b0 100644 --- a/Userland/Libraries/LibWasm/Types.h +++ b/Userland/Libraries/LibWasm/Types.h @@ -9,7 +9,7 @@ #include <AK/Badge.h> #include <AK/DeprecatedString.h> #include <AK/DistinctNumeric.h> -#include <AK/MemoryStream.h> +#include <AK/LEB128.h> #include <AK/NonnullOwnPtrVector.h> #include <AK/Result.h> #include <AK/Variant.h> diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index a865e5012d..d0b1e3354c 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -7,8 +7,8 @@ #include "Mixer.h" #include <AK/Array.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/Format.h> -#include <AK/MemoryStream.h> #include <AK/NumericLimits.h> #include <AudioServer/ConnectionFromClient.h> #include <AudioServer/Mixer.h> @@ -99,7 +99,7 @@ void Mixer::mix() if (m_muted || m_main_volume < 0.01) { m_device->write(m_zero_filled_buffer.data(), static_cast<int>(m_zero_filled_buffer.size())); } else { - OutputMemoryStream stream { m_stream_buffer }; + DeprecatedOutputMemoryStream stream { m_stream_buffer }; for (auto& mixed_sample : mixed_buffer) { mixed_sample.log_multiply(static_cast<float>(m_main_volume)); diff --git a/Userland/Services/TelnetServer/Client.cpp b/Userland/Services/TelnetServer/Client.cpp index 77ff237762..e55484e4c7 100644 --- a/Userland/Services/TelnetServer/Client.cpp +++ b/Userland/Services/TelnetServer/Client.cpp @@ -7,8 +7,8 @@ #include "Client.h" #include <AK/ByteBuffer.h> +#include <AK/DeprecatedMemoryStream.h> #include <AK/DeprecatedString.h> -#include <AK/MemoryStream.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <AK/Types.h> @@ -194,7 +194,7 @@ ErrorOr<void> Client::send_command(Command command) ErrorOr<void> Client::send_commands(Vector<Command> commands) { auto buffer = TRY(ByteBuffer::create_uninitialized(commands.size() * 3)); - OutputMemoryStream stream { buffer }; + DeprecatedOutputMemoryStream stream { buffer }; for (auto& command : commands) stream << (u8)IAC << command.command << command.subcommand; diff --git a/Userland/Services/WebServer/Client.cpp b/Userland/Services/WebServer/Client.cpp index 672339c6c8..33a8eb3b8e 100644 --- a/Userland/Services/WebServer/Client.cpp +++ b/Userland/Services/WebServer/Client.cpp @@ -9,7 +9,6 @@ #include <AK/Base64.h> #include <AK/Debug.h> #include <AK/LexicalPath.h> -#include <AK/MemoryStream.h> #include <AK/QuickSort.h> #include <AK/StringBuilder.h> #include <AK/URL.h> |