mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
AK: Deprecate the old AK::Stream
This also removes a few cases where the respective header wasn't actually required to be included.
This commit is contained in:
parent
230cb3b0cb
commit
ae64b68717
Notes:
sideshowbarker
2024-07-17 00:59:21 +09:00
Author: https://github.com/timschumi
Commit: ae64b68717
Pull-request: https://github.com/SerenityOS/serenity/pull/17173
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/alimpfard
38 changed files with 116 additions and 120 deletions
|
@ -119,7 +119,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename StreamType, size_t Size>
|
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);
|
AK_MAKE_NONCOPYABLE(Buffered);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
|
#include <AK/DeprecatedStream.h>
|
||||||
#include <AK/LEB128.h>
|
#include <AK/LEB128.h>
|
||||||
#include <AK/MemMem.h>
|
#include <AK/MemMem.h>
|
||||||
#include <AK/Stream.h>
|
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
class InputMemoryStream final : public InputStream {
|
class DeprecatedInputMemoryStream final : public DeprecatedInputStream {
|
||||||
public:
|
public:
|
||||||
explicit InputMemoryStream(ReadonlyBytes bytes)
|
explicit DeprecatedInputMemoryStream(ReadonlyBytes bytes)
|
||||||
: m_bytes(bytes)
|
: m_bytes(bytes)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ private:
|
||||||
size_t m_offset { 0 };
|
size_t m_offset { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutputMemoryStream final : public OutputStream {
|
class DeprecatedOutputMemoryStream final : public DeprecatedOutputStream {
|
||||||
public:
|
public:
|
||||||
explicit OutputMemoryStream(Bytes bytes)
|
explicit DeprecatedOutputMemoryStream(Bytes bytes)
|
||||||
: m_bytes(bytes)
|
: m_bytes(bytes)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,6 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USING_AK_GLOBALLY
|
#if USING_AK_GLOBALLY
|
||||||
using AK::InputMemoryStream;
|
using AK::DeprecatedInputMemoryStream;
|
||||||
using AK::InputStream;
|
using AK::DeprecatedOutputMemoryStream;
|
||||||
using AK::OutputMemoryStream;
|
|
||||||
#endif
|
#endif
|
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
namespace AK::Detail {
|
namespace AK::Detail {
|
||||||
|
|
||||||
class Stream {
|
class DeprecatedStream {
|
||||||
public:
|
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_recoverable_error() const { return m_recoverable_error; }
|
||||||
virtual bool has_fatal_error() const { return m_fatal_error; }
|
virtual bool has_fatal_error() const { return m_fatal_error; }
|
||||||
|
@ -60,7 +60,7 @@ private:
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
class InputStream : public virtual Detail::Stream {
|
class DeprecatedInputStream : public virtual Detail::DeprecatedStream {
|
||||||
public:
|
public:
|
||||||
// Reads at least one byte unless none are requested or none are available. Does nothing
|
// Reads at least one byte unless none are requested or none are available. Does nothing
|
||||||
// and returns zero if there is already an error.
|
// and returns zero if there is already an error.
|
||||||
|
@ -81,52 +81,52 @@ public:
|
||||||
virtual bool discard_or_error(size_t count) = 0;
|
virtual bool discard_or_error(size_t count) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutputStream : public virtual Detail::Stream {
|
class DeprecatedOutputStream : public virtual Detail::DeprecatedStream {
|
||||||
public:
|
public:
|
||||||
virtual size_t write(ReadonlyBytes) = 0;
|
virtual size_t write(ReadonlyBytes) = 0;
|
||||||
virtual bool write_or_error(ReadonlyBytes) = 0;
|
virtual bool write_or_error(ReadonlyBytes) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DuplexStream
|
class DeprecatedDuplexStream
|
||||||
: public InputStream
|
: public DeprecatedInputStream
|
||||||
, public OutputStream {
|
, public DeprecatedOutputStream {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline InputStream& operator>>(InputStream& stream, Bytes bytes)
|
inline DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, Bytes bytes)
|
||||||
{
|
{
|
||||||
stream.read_or_error(bytes);
|
stream.read_or_error(bytes);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
inline OutputStream& operator<<(OutputStream& stream, ReadonlyBytes bytes)
|
inline DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, ReadonlyBytes bytes)
|
||||||
{
|
{
|
||||||
stream.write_or_error(bytes);
|
stream.write_or_error(bytes);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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) };
|
return stream >> Bytes { &value.m_value, sizeof(value.m_value) };
|
||||||
}
|
}
|
||||||
template<typename T>
|
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) };
|
return stream << ReadonlyBytes { &value.m_value, sizeof(value.m_value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
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) };
|
return stream >> Bytes { &value.m_value, sizeof(value.m_value) };
|
||||||
}
|
}
|
||||||
template<typename T>
|
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) };
|
return stream << ReadonlyBytes { &value.m_value, sizeof(value.m_value) };
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
InputStream& operator>>(InputStream& stream, Optional<T>& value)
|
DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, Optional<T>& value)
|
||||||
{
|
{
|
||||||
T temporary;
|
T temporary;
|
||||||
stream >> temporary;
|
stream >> temporary;
|
||||||
|
@ -135,13 +135,13 @@ InputStream& operator>>(InputStream& stream, Optional<T>& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Integral I>
|
template<Integral I>
|
||||||
InputStream& operator>>(InputStream& stream, I& value)
|
DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, I& value)
|
||||||
{
|
{
|
||||||
stream.read_or_error({ &value, sizeof(value) });
|
stream.read_or_error({ &value, sizeof(value) });
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
template<Integral I>
|
template<Integral I>
|
||||||
OutputStream& operator<<(OutputStream& stream, I value)
|
DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, I value)
|
||||||
{
|
{
|
||||||
stream.write_or_error({ &value, sizeof(value) });
|
stream.write_or_error({ &value, sizeof(value) });
|
||||||
return stream;
|
return stream;
|
||||||
|
@ -150,13 +150,13 @@ OutputStream& operator<<(OutputStream& stream, I value)
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
|
|
||||||
template<FloatingPoint F>
|
template<FloatingPoint F>
|
||||||
InputStream& operator>>(InputStream& stream, F& value)
|
DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, F& value)
|
||||||
{
|
{
|
||||||
stream.read_or_error({ &value, sizeof(value) });
|
stream.read_or_error({ &value, sizeof(value) });
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
template<FloatingPoint F>
|
template<FloatingPoint F>
|
||||||
OutputStream& operator<<(OutputStream& stream, F value)
|
DeprecatedOutputStream& operator<<(DeprecatedOutputStream& stream, F value)
|
||||||
{
|
{
|
||||||
stream.write_or_error({ &value, sizeof(value) });
|
stream.write_or_error({ &value, sizeof(value) });
|
||||||
return stream;
|
return stream;
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/DeprecatedFlyString.h>
|
||||||
|
#include <AK/DeprecatedStream.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
|
@ -415,7 +416,7 @@ bool DeprecatedString::operator==(char const* cstring) const
|
||||||
return view() == cstring;
|
return view() == cstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream& operator>>(InputStream& stream, DeprecatedString& string)
|
DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, DeprecatedString& string)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/RefPtr.h>
|
#include <AK/RefPtr.h>
|
||||||
#include <AK/Stream.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/StringImpl.h>
|
#include <AK/StringImpl.h>
|
||||||
#include <AK/StringUtils.h>
|
#include <AK/StringUtils.h>
|
||||||
|
@ -339,7 +338,7 @@ struct CaseInsensitiveStringTraits : public Traits<DeprecatedString> {
|
||||||
|
|
||||||
DeprecatedString escape_html_entities(StringView html);
|
DeprecatedString escape_html_entities(StringView html);
|
||||||
|
|
||||||
InputStream& operator>>(InputStream& stream, DeprecatedString& string);
|
DeprecatedInputStream& operator>>(DeprecatedInputStream& stream, DeprecatedString& string);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
AK/Endian.h
16
AK/Endian.h
|
@ -80,16 +80,16 @@ template<typename T>
|
||||||
class LittleEndian;
|
class LittleEndian;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
InputStream& operator>>(InputStream&, LittleEndian<T>&);
|
DeprecatedInputStream& operator>>(DeprecatedInputStream&, LittleEndian<T>&);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
OutputStream& operator<<(OutputStream&, LittleEndian<T>);
|
DeprecatedOutputStream& operator<<(DeprecatedOutputStream&, LittleEndian<T>);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class [[gnu::packed]] LittleEndian {
|
class [[gnu::packed]] LittleEndian {
|
||||||
public:
|
public:
|
||||||
friend InputStream& operator>><T>(InputStream&, LittleEndian<T>&);
|
friend DeprecatedInputStream& operator>><T>(DeprecatedInputStream&, LittleEndian<T>&);
|
||||||
friend OutputStream& operator<< <T>(OutputStream&, LittleEndian<T>);
|
friend DeprecatedOutputStream& operator<< <T>(DeprecatedOutputStream&, LittleEndian<T>);
|
||||||
|
|
||||||
constexpr LittleEndian() = default;
|
constexpr LittleEndian() = default;
|
||||||
|
|
||||||
|
@ -112,16 +112,16 @@ template<typename T>
|
||||||
class BigEndian;
|
class BigEndian;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
InputStream& operator>>(InputStream&, BigEndian<T>&);
|
DeprecatedInputStream& operator>>(DeprecatedInputStream&, BigEndian<T>&);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
OutputStream& operator<<(OutputStream&, BigEndian<T>);
|
DeprecatedOutputStream& operator<<(DeprecatedOutputStream&, BigEndian<T>);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class [[gnu::packed]] BigEndian {
|
class [[gnu::packed]] BigEndian {
|
||||||
public:
|
public:
|
||||||
friend InputStream& operator>><T>(InputStream&, BigEndian<T>&);
|
friend DeprecatedInputStream& operator>><T>(DeprecatedInputStream&, BigEndian<T>&);
|
||||||
friend OutputStream& operator<< <T>(OutputStream&, BigEndian<T>);
|
friend DeprecatedOutputStream& operator<< <T>(DeprecatedOutputStream&, BigEndian<T>);
|
||||||
|
|
||||||
constexpr BigEndian() = default;
|
constexpr BigEndian() = default;
|
||||||
|
|
||||||
|
|
16
AK/Forward.h
16
AK/Forward.h
|
@ -20,6 +20,10 @@ class ByteBuffer;
|
||||||
class Bitmap;
|
class Bitmap;
|
||||||
using ByteBuffer = Detail::ByteBuffer<32>;
|
using ByteBuffer = Detail::ByteBuffer<32>;
|
||||||
class CircularBuffer;
|
class CircularBuffer;
|
||||||
|
class DeprecatedInputStream;
|
||||||
|
class DeprecatedInputMemoryStream;
|
||||||
|
class DeprecatedOutputStream;
|
||||||
|
class DeprecatedOutputMemoryStream;
|
||||||
class Error;
|
class Error;
|
||||||
class FlyString;
|
class FlyString;
|
||||||
class GenericLexer;
|
class GenericLexer;
|
||||||
|
@ -41,10 +45,6 @@ class Utf16View;
|
||||||
class Utf32View;
|
class Utf32View;
|
||||||
class Utf8CodePointIterator;
|
class Utf8CodePointIterator;
|
||||||
class Utf8View;
|
class Utf8View;
|
||||||
class InputStream;
|
|
||||||
class InputMemoryStream;
|
|
||||||
class OutputStream;
|
|
||||||
class OutputMemoryStream;
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Span;
|
class Span;
|
||||||
|
@ -156,6 +156,10 @@ using AK::Bytes;
|
||||||
using AK::CircularBuffer;
|
using AK::CircularBuffer;
|
||||||
using AK::CircularQueue;
|
using AK::CircularQueue;
|
||||||
using AK::DeprecatedFlyString;
|
using AK::DeprecatedFlyString;
|
||||||
|
using AK::DeprecatedInputMemoryStream;
|
||||||
|
using AK::DeprecatedInputStream;
|
||||||
|
using AK::DeprecatedOutputMemoryStream;
|
||||||
|
using AK::DeprecatedOutputStream;
|
||||||
using AK::DeprecatedString;
|
using AK::DeprecatedString;
|
||||||
using AK::DeprecatedStringCodePointIterator;
|
using AK::DeprecatedStringCodePointIterator;
|
||||||
using AK::DoublyLinkedList;
|
using AK::DoublyLinkedList;
|
||||||
|
@ -167,8 +171,6 @@ using AK::Function;
|
||||||
using AK::GenericLexer;
|
using AK::GenericLexer;
|
||||||
using AK::HashMap;
|
using AK::HashMap;
|
||||||
using AK::HashTable;
|
using AK::HashTable;
|
||||||
using AK::InputMemoryStream;
|
|
||||||
using AK::InputStream;
|
|
||||||
using AK::IPv4Address;
|
using AK::IPv4Address;
|
||||||
using AK::JsonArray;
|
using AK::JsonArray;
|
||||||
using AK::JsonObject;
|
using AK::JsonObject;
|
||||||
|
@ -178,8 +180,6 @@ using AK::NonnullOwnPtrVector;
|
||||||
using AK::NonnullRefPtr;
|
using AK::NonnullRefPtr;
|
||||||
using AK::NonnullRefPtrVector;
|
using AK::NonnullRefPtrVector;
|
||||||
using AK::Optional;
|
using AK::Optional;
|
||||||
using AK::OutputMemoryStream;
|
|
||||||
using AK::OutputStream;
|
|
||||||
using AK::OwnPtr;
|
using AK::OwnPtr;
|
||||||
using AK::ReadonlyBytes;
|
using AK::ReadonlyBytes;
|
||||||
using AK::RefPtr;
|
using AK::RefPtr;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/DeprecatedStream.h>
|
||||||
#include <AK/NumericLimits.h>
|
#include <AK/NumericLimits.h>
|
||||||
#include <AK/Stream.h>
|
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
@ -19,7 +19,7 @@ struct LEB128 {
|
||||||
[[maybe_unused]] size_t backup_offset = 0;
|
[[maybe_unused]] size_t backup_offset = 0;
|
||||||
if constexpr (requires { stream.offset(); })
|
if constexpr (requires { stream.offset(); })
|
||||||
backup_offset = stream.offset();
|
backup_offset = stream.offset();
|
||||||
InputStream& input_stream { stream };
|
DeprecatedInputStream& input_stream { stream };
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
size_t num_bytes = 0;
|
size_t num_bytes = 0;
|
||||||
|
@ -62,7 +62,7 @@ struct LEB128 {
|
||||||
[[maybe_unused]] size_t backup_offset = 0;
|
[[maybe_unused]] size_t backup_offset = 0;
|
||||||
if constexpr (requires { stream.offset(); })
|
if constexpr (requires { stream.offset(); })
|
||||||
backup_offset = stream.offset();
|
backup_offset = stream.offset();
|
||||||
InputStream& input_stream { stream };
|
DeprecatedInputStream& input_stream { stream };
|
||||||
|
|
||||||
i64 temp = 0;
|
i64 temp = 0;
|
||||||
size_t num_bytes = 0;
|
size_t num_bytes = 0;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <Kernel/API/POSIX/errno.h>
|
#include <Kernel/API/POSIX/errno.h>
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/FileSystem/Ext2FS/Inode.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);
|
VERIFY(blocks_indices.size() <= entries_per_block);
|
||||||
|
|
||||||
auto block_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size()));
|
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());
|
auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data());
|
||||||
|
|
||||||
VERIFY(blocks_indices.size() <= EXT2_ADDR_PER_BLOCK(&fs().super_block()));
|
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_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size()));
|
||||||
auto* block_as_pointers = (unsigned*)block_contents.data();
|
auto* block_as_pointers = (unsigned*)block_contents.data();
|
||||||
OutputMemoryStream stream { block_contents };
|
DeprecatedOutputMemoryStream stream { block_contents };
|
||||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data());
|
auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data());
|
||||||
|
|
||||||
if (old_blocks_length > 0) {
|
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_contents = TRY(ByteBuffer::create_uninitialized(fs().block_size()));
|
||||||
auto* block_as_pointers = (unsigned*)block_contents.data();
|
auto* block_as_pointers = (unsigned*)block_contents.data();
|
||||||
OutputMemoryStream stream { block_contents };
|
DeprecatedOutputMemoryStream stream { block_contents };
|
||||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data());
|
auto buffer = UserOrKernelBuffer::for_kernel_buffer(stream.data());
|
||||||
|
|
||||||
if (old_blocks_length > 0) {
|
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);
|
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));
|
auto directory_data = TRY(ByteBuffer::create_uninitialized(directory_size));
|
||||||
OutputMemoryStream stream { directory_data };
|
DeprecatedOutputMemoryStream stream { directory_data };
|
||||||
|
|
||||||
for (auto& entry : entries) {
|
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);
|
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);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <Kernel/API/POSIX/errno.h>
|
#include <Kernel/API/POSIX/errno.h>
|
||||||
#include <Kernel/Devices/BlockDevice.h>
|
#include <Kernel/Devices/BlockDevice.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
|
@ -223,7 +223,7 @@ ErrorOr<size_t> OpenFileDescription::get_dir_entries(UserOrKernelBuffer& output_
|
||||||
ErrorOr<void> error;
|
ErrorOr<void> error;
|
||||||
u8 stack_buffer[PAGE_SIZE];
|
u8 stack_buffer[PAGE_SIZE];
|
||||||
Bytes temp_buffer(stack_buffer, sizeof(stack_buffer));
|
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 {
|
auto flush_stream_to_output_buffer = [&error, &stream, &remaining, &output_buffer]() -> bool {
|
||||||
if (error.is_error())
|
if (error.is_error())
|
||||||
|
|
|
@ -18,6 +18,7 @@ set(AK_TEST_SOURCES
|
||||||
TestCircularDeque.cpp
|
TestCircularDeque.cpp
|
||||||
TestCircularQueue.cpp
|
TestCircularQueue.cpp
|
||||||
TestComplex.cpp
|
TestComplex.cpp
|
||||||
|
TestDeprecatedMemoryStream.cpp
|
||||||
TestDeprecatedString.cpp
|
TestDeprecatedString.cpp
|
||||||
TestDisjointChunks.cpp
|
TestDisjointChunks.cpp
|
||||||
TestDistinctNumeric.cpp
|
TestDistinctNumeric.cpp
|
||||||
|
@ -48,7 +49,6 @@ set(AK_TEST_SOURCES
|
||||||
TestLexicalPath.cpp
|
TestLexicalPath.cpp
|
||||||
TestMACAddress.cpp
|
TestMACAddress.cpp
|
||||||
TestMemory.cpp
|
TestMemory.cpp
|
||||||
TestMemoryStream.cpp
|
|
||||||
TestNeverDestroyed.cpp
|
TestNeverDestroyed.cpp
|
||||||
TestNonnullRefPtr.cpp
|
TestNonnullRefPtr.cpp
|
||||||
TestNumberFormat.cpp
|
TestNumberFormat.cpp
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
|
|
||||||
#include <AK/Array.h>
|
#include <AK/Array.h>
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
|
|
||||||
TEST_CASE(read_an_integer)
|
TEST_CASE(read_an_integer)
|
||||||
{
|
{
|
||||||
u32 expected = 0x01020304, actual;
|
u32 expected = 0x01020304, actual;
|
||||||
|
|
||||||
InputMemoryStream stream { { &expected, sizeof(expected) } };
|
DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } };
|
||||||
stream >> actual;
|
stream >> actual;
|
||||||
|
|
||||||
EXPECT(!stream.has_any_error() && stream.eof());
|
EXPECT(!stream.has_any_error() && stream.eof());
|
||||||
|
@ -24,7 +24,7 @@ TEST_CASE(read_a_bool)
|
||||||
{
|
{
|
||||||
bool expected = true, actual;
|
bool expected = true, actual;
|
||||||
|
|
||||||
InputMemoryStream stream { { &expected, sizeof(expected) } };
|
DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } };
|
||||||
stream >> actual;
|
stream >> actual;
|
||||||
|
|
||||||
EXPECT(!stream.has_any_error() && stream.eof());
|
EXPECT(!stream.has_any_error() && stream.eof());
|
||||||
|
@ -35,7 +35,7 @@ TEST_CASE(read_a_double)
|
||||||
{
|
{
|
||||||
double expected = 3.141592653589793, actual;
|
double expected = 3.141592653589793, actual;
|
||||||
|
|
||||||
InputMemoryStream stream { { &expected, sizeof(expected) } };
|
DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } };
|
||||||
stream >> actual;
|
stream >> actual;
|
||||||
|
|
||||||
EXPECT(!stream.has_any_error() && stream.eof());
|
EXPECT(!stream.has_any_error() && stream.eof());
|
||||||
|
@ -47,7 +47,7 @@ TEST_CASE(recoverable_error)
|
||||||
u32 expected = 0x01020304, actual = 0;
|
u32 expected = 0x01020304, actual = 0;
|
||||||
u64 to_large_value = 0;
|
u64 to_large_value = 0;
|
||||||
|
|
||||||
InputMemoryStream stream { { &expected, sizeof(expected) } };
|
DeprecatedInputMemoryStream stream { { &expected, sizeof(expected) } };
|
||||||
|
|
||||||
EXPECT(!stream.has_any_error() && !stream.eof());
|
EXPECT(!stream.has_any_error() && !stream.eof());
|
||||||
stream >> to_large_value;
|
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> const expected { 0, 1, 2, 3 };
|
||||||
Array<u8, 4> actual;
|
Array<u8, 4> actual;
|
||||||
|
|
||||||
InputMemoryStream stream { expected };
|
DeprecatedInputMemoryStream stream { expected };
|
||||||
|
|
||||||
stream >> actual[0] >> actual[1] >> actual[2] >> actual[3];
|
stream >> actual[0] >> actual[1] >> actual[2] >> actual[3];
|
||||||
EXPECT(!stream.has_any_error() && stream.eof());
|
EXPECT(!stream.has_any_error() && stream.eof());
|
||||||
|
@ -83,7 +83,7 @@ TEST_CASE(seeking_slicing_offset)
|
||||||
|
|
||||||
Array<u8, 4> actual0 {}, actual1 {}, actual2 {};
|
Array<u8, 4> actual0 {}, actual1 {}, actual2 {};
|
||||||
|
|
||||||
InputMemoryStream stream { input };
|
DeprecatedInputMemoryStream stream { input };
|
||||||
|
|
||||||
stream >> actual0;
|
stream >> actual0;
|
||||||
EXPECT(!stream.has_any_error() && !stream.eof());
|
EXPECT(!stream.has_any_error() && !stream.eof());
|
||||||
|
@ -103,7 +103,7 @@ TEST_CASE(seeking_slicing_offset)
|
||||||
TEST_CASE(read_endian_values)
|
TEST_CASE(read_endian_values)
|
||||||
{
|
{
|
||||||
Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 };
|
Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||||
InputMemoryStream stream { input };
|
DeprecatedInputMemoryStream stream { input };
|
||||||
|
|
||||||
LittleEndian<u32> value1;
|
LittleEndian<u32> value1;
|
||||||
BigEndian<u32> value2;
|
BigEndian<u32> value2;
|
||||||
|
@ -116,7 +116,7 @@ TEST_CASE(read_endian_values)
|
||||||
TEST_CASE(new_output_memory_stream)
|
TEST_CASE(new_output_memory_stream)
|
||||||
{
|
{
|
||||||
Array<u8, 16> buffer;
|
Array<u8, 16> buffer;
|
||||||
OutputMemoryStream stream { buffer };
|
DeprecatedOutputMemoryStream stream { buffer };
|
||||||
|
|
||||||
EXPECT_EQ(stream.size(), 0u);
|
EXPECT_EQ(stream.size(), 0u);
|
||||||
EXPECT_EQ(stream.remaining(), 16u);
|
EXPECT_EQ(stream.remaining(), 16u);
|
|
@ -4,8 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/LEB128.h>
|
#include <AK/LEB128.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/NumericLimits.h>
|
#include <AK/NumericLimits.h>
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ TEST_CASE(single_byte)
|
||||||
u32 output = {};
|
u32 output = {};
|
||||||
i32 output_signed = {};
|
i32 output_signed = {};
|
||||||
u8 buf[] = { 0x00 };
|
u8 buf[] = { 0x00 };
|
||||||
InputMemoryStream stream({ buf, sizeof(buf) });
|
DeprecatedInputMemoryStream stream({ buf, sizeof(buf) });
|
||||||
|
|
||||||
// less than/eq 0b0011_1111, signed == unsigned == raw byte
|
// less than/eq 0b0011_1111, signed == unsigned == raw byte
|
||||||
for (u8 i = 0u; i <= 0x3F; ++i) {
|
for (u8 i = 0u; i <= 0x3F; ++i) {
|
||||||
|
@ -64,7 +64,7 @@ TEST_CASE(two_bytes)
|
||||||
u32 output = {};
|
u32 output = {};
|
||||||
i32 output_signed = {};
|
i32 output_signed = {};
|
||||||
u8 buf[] = { 0x00, 0x1 };
|
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
|
// Only test with first byte expecting more, otherwise equivalent to single byte case
|
||||||
for (u16 i = 0x80; i <= 0xFF; ++i) {
|
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 };
|
u8 u32_max_plus_one[] = { 0x80, 0x80, 0x80, 0x80, 0x10 };
|
||||||
{
|
{
|
||||||
u32 out = 0;
|
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(!LEB128::read_unsigned(stream, out));
|
||||||
EXPECT_EQ(out, 0u);
|
EXPECT_EQ(out, 0u);
|
||||||
EXPECT(!stream.handle_any_error());
|
EXPECT(!stream.handle_any_error());
|
||||||
|
@ -135,7 +135,7 @@ TEST_CASE(overflow_sizeof_output_unsigned)
|
||||||
u8 u32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x0F };
|
u8 u32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x0F };
|
||||||
{
|
{
|
||||||
u32 out = 0;
|
u32 out = 0;
|
||||||
InputMemoryStream stream({ u32_max, sizeof(u32_max) });
|
DeprecatedInputMemoryStream stream({ u32_max, sizeof(u32_max) });
|
||||||
EXPECT(LEB128::read_unsigned(stream, out));
|
EXPECT(LEB128::read_unsigned(stream, out));
|
||||||
EXPECT_EQ(out, NumericLimits<u32>::max());
|
EXPECT_EQ(out, NumericLimits<u32>::max());
|
||||||
EXPECT(!stream.handle_any_error());
|
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 };
|
u8 i32_max_plus_one[] = { 0x80, 0x80, 0x80, 0x80, 0x08 };
|
||||||
{
|
{
|
||||||
i32 out = 0;
|
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(!LEB128::read_signed(stream, out));
|
||||||
EXPECT_EQ(out, 0);
|
EXPECT_EQ(out, 0);
|
||||||
EXPECT(!stream.handle_any_error());
|
EXPECT(!stream.handle_any_error());
|
||||||
|
@ -168,7 +168,7 @@ TEST_CASE(overflow_sizeof_output_signed)
|
||||||
u8 i32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x07 };
|
u8 i32_max[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x07 };
|
||||||
{
|
{
|
||||||
i32 out = 0;
|
i32 out = 0;
|
||||||
InputMemoryStream stream({ i32_max, sizeof(i32_max) });
|
DeprecatedInputMemoryStream stream({ i32_max, sizeof(i32_max) });
|
||||||
EXPECT(LEB128::read_signed(stream, out));
|
EXPECT(LEB128::read_signed(stream, out));
|
||||||
EXPECT_EQ(out, NumericLimits<i32>::max());
|
EXPECT_EQ(out, NumericLimits<i32>::max());
|
||||||
EXPECT(!stream.handle_any_error());
|
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 };
|
u8 i32_min_minus_one[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x77 };
|
||||||
{
|
{
|
||||||
i32 out = 0;
|
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(!LEB128::read_signed(stream, out));
|
||||||
EXPECT_EQ(out, 0);
|
EXPECT_EQ(out, 0);
|
||||||
EXPECT(!stream.handle_any_error());
|
EXPECT(!stream.handle_any_error());
|
||||||
|
@ -198,7 +198,7 @@ TEST_CASE(overflow_sizeof_output_signed)
|
||||||
u8 i32_min[] = { 0x80, 0x80, 0x80, 0x80, 0x78 };
|
u8 i32_min[] = { 0x80, 0x80, 0x80, 0x80, 0x78 };
|
||||||
{
|
{
|
||||||
i32 out = 0;
|
i32 out = 0;
|
||||||
InputMemoryStream stream({ i32_min, sizeof(i32_min) });
|
DeprecatedInputMemoryStream stream({ i32_min, sizeof(i32_min) });
|
||||||
EXPECT(LEB128::read_signed(stream, out));
|
EXPECT(LEB128::read_signed(stream, out));
|
||||||
EXPECT_EQ(out, NumericLimits<i32>::min());
|
EXPECT_EQ(out, NumericLimits<i32>::min());
|
||||||
EXPECT(!stream.handle_any_error());
|
EXPECT(!stream.handle_any_error());
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
|
|
||||||
#include <AK/Array.h>
|
#include <AK/Array.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/Random.h>
|
#include <AK/Random.h>
|
||||||
#include <LibCompress/Deflate.h>
|
#include <LibCompress/Deflate.h>
|
||||||
#include <LibCore/BitStream.h>
|
#include <LibCore/BitStream.h>
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include "Loader.h"
|
#include "Loader.h"
|
||||||
#include "MP3Types.h"
|
#include "MP3Types.h"
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/Tuple.h>
|
#include <AK/Tuple.h>
|
||||||
#include <LibCore/BitStream.h>
|
#include <LibCore/BitStream.h>
|
||||||
#include <LibCore/MemoryStream.h>
|
#include <LibCore/MemoryStream.h>
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/Stream.h>
|
|
||||||
#include <LibCore/Forward.h>
|
#include <LibCore/Forward.h>
|
||||||
#include <LibCore/Object.h>
|
#include <LibCore/Object.h>
|
||||||
#include <LibCore/Stream.h>
|
#include <LibCore/Stream.h>
|
||||||
|
|
|
@ -704,7 +704,7 @@ ErrorOr<int> LocalSocket::release_fd()
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
WrappedAKInputStream::WrappedAKInputStream(NonnullOwnPtr<InputStream> stream)
|
WrappedAKInputStream::WrappedAKInputStream(NonnullOwnPtr<DeprecatedInputStream> stream)
|
||||||
: m_stream(move(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))
|
: m_stream(move(stream))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <AK/Badge.h>
|
#include <AK/Badge.h>
|
||||||
#include <AK/CircularBuffer.h>
|
#include <AK/CircularBuffer.h>
|
||||||
|
#include <AK/DeprecatedStream.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/EnumBits.h>
|
#include <AK/EnumBits.h>
|
||||||
#include <AK/Function.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.
|
// 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 {
|
class WrappedAKInputStream final : public Stream {
|
||||||
public:
|
public:
|
||||||
WrappedAKInputStream(NonnullOwnPtr<InputStream> stream);
|
WrappedAKInputStream(NonnullOwnPtr<DeprecatedInputStream> stream);
|
||||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||||
virtual ErrorOr<void> discard(size_t discarded_bytes) override;
|
virtual ErrorOr<void> discard(size_t discarded_bytes) override;
|
||||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||||
|
@ -1080,13 +1081,13 @@ public:
|
||||||
virtual void close() override;
|
virtual void close() override;
|
||||||
|
|
||||||
private:
|
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.
|
// 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 {
|
class WrappedAKOutputStream final : public Stream {
|
||||||
public:
|
public:
|
||||||
WrappedAKOutputStream(NonnullOwnPtr<OutputStream> stream);
|
WrappedAKOutputStream(NonnullOwnPtr<DeprecatedOutputStream> stream);
|
||||||
virtual ErrorOr<Bytes> read(Bytes) override;
|
virtual ErrorOr<Bytes> read(Bytes) override;
|
||||||
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
virtual ErrorOr<size_t> write(ReadonlyBytes) override;
|
||||||
virtual bool is_eof() const override;
|
virtual bool is_eof() const override;
|
||||||
|
@ -1094,11 +1095,11 @@ public:
|
||||||
virtual void close() override;
|
virtual void close() override;
|
||||||
|
|
||||||
private:
|
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.
|
// 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:
|
public:
|
||||||
WrapInAKInputStream(Core::Stream::Stream& stream);
|
WrapInAKInputStream(Core::Stream::Stream& stream);
|
||||||
virtual size_t read(Bytes) override;
|
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.
|
// 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:
|
public:
|
||||||
WrapInAKOutputStream(Core::Stream::Stream& stream);
|
WrapInAKOutputStream(Core::Stream::Stream& stream);
|
||||||
virtual size_t write(ReadonlyBytes) override;
|
virtual size_t write(ReadonlyBytes) override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/DeprecatedStream.h>
|
||||||
#include <AK/Try.h>
|
#include <AK/Try.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibCrypto/ASN1/DER.h>
|
#include <LibCrypto/ASN1/DER.h>
|
||||||
|
@ -223,7 +224,7 @@ Optional<DecodeError> Decoder::leave()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void pretty_print(Decoder& decoder, OutputStream& stream, int indent)
|
void pretty_print(Decoder& decoder, DeprecatedOutputStream& stream, int indent)
|
||||||
{
|
{
|
||||||
while (!decoder.eof()) {
|
while (!decoder.eof()) {
|
||||||
auto tag = decoder.peek();
|
auto tag = decoder.peek();
|
||||||
|
|
|
@ -226,7 +226,7 @@ private:
|
||||||
Optional<Tag> m_current_tag;
|
Optional<Tag> m_current_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
void pretty_print(Decoder&, OutputStream&, int indent = 0);
|
void pretty_print(Decoder&, DeprecatedOutputStream&, int indent = 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <AK/ByteReader.h>
|
#include <AK/ByteReader.h>
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <LibCrypto/Authentication/GHash.h>
|
#include <LibCrypto/Authentication/GHash.h>
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher)
|
||||||
if (i > buf.size()) {
|
if (i > buf.size()) {
|
||||||
static u8 buffer[16];
|
static u8 buffer[16];
|
||||||
Bytes buffer_bytes { buffer, 16 };
|
Bytes buffer_bytes { buffer, 16 };
|
||||||
OutputMemoryStream stream { buffer_bytes };
|
DeprecatedOutputMemoryStream stream { buffer_bytes };
|
||||||
stream.write(buf.slice(i - 16));
|
stream.write(buf.slice(i - 16));
|
||||||
stream.fill_to_end(0);
|
stream.fill_to_end(0);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Answer.h"
|
#include "Answer.h"
|
||||||
#include <AK/Stream.h>
|
|
||||||
#include <LibIPC/Decoder.h>
|
#include <LibIPC/Decoder.h>
|
||||||
#include <LibIPC/Encoder.h>
|
#include <LibIPC/Encoder.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "Name.h"
|
#include "Name.h"
|
||||||
#include "PacketHeader.h"
|
#include "PacketHeader.h"
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/MemoryStream.h>
|
#include <LibCore/MemoryStream.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
#include <AK/Bitmap.h>
|
#include <AK/Bitmap.h>
|
||||||
#include <AK/Checked.h>
|
#include <AK/Checked.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/Queue.h>
|
#include <AK/Queue.h>
|
||||||
#include <AK/ScopeGuard.h>
|
#include <AK/ScopeGuard.h>
|
||||||
|
@ -212,7 +212,7 @@ ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_byte_buffer(ByteBu
|
||||||
/// - image data (= actual size * u8)
|
/// - image data (= actual size * u8)
|
||||||
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_bytes(ReadonlyBytes bytes)
|
ErrorOr<NonnullRefPtr<Bitmap>> Bitmap::create_from_serialized_bytes(ReadonlyBytes bytes)
|
||||||
{
|
{
|
||||||
InputMemoryStream stream { bytes };
|
DeprecatedInputMemoryStream stream { bytes };
|
||||||
size_t actual_size;
|
size_t actual_size;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
|
@ -260,7 +260,7 @@ ByteBuffer Bitmap::serialize_to_byte_buffer() const
|
||||||
{
|
{
|
||||||
// FIXME: Somehow handle possible OOM situation here.
|
// 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();
|
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) {
|
auto write = [&]<typename T>(T value) {
|
||||||
if (stream.write({ &value, sizeof(T) }) != sizeof(T))
|
if (stream.write({ &value, sizeof(T) }) != sizeof(T))
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Endian.h>
|
#include <AK/Endian.h>
|
||||||
#include <AK/Error.h>
|
#include <AK/Error.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Try.h>
|
#include <AK/Try.h>
|
||||||
#include <AK/Vector.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> color0 {}, color1 {};
|
||||||
LittleEndian<u8> code0 {}, code1 {}, code2 {}, code3 {}, code4 {}, code5 {};
|
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 {};
|
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;
|
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> c0_low {}, c0_high {}, c1_low {}, c1_high {};
|
||||||
LittleEndian<u8> codes_0 {}, codes_1 {}, codes_2 {}, codes_3 {};
|
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) {
|
if (format == DXGI_FORMAT_BC1_UNORM) {
|
||||||
for (size_t x = 0; x < width; x += 4) {
|
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 };
|
Vector<u32> dxt_formats = { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC3_UNORM };
|
||||||
if (dxt_formats.contains_slow(format)) {
|
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)
|
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.
|
// All valid DDS files are at least 128 bytes long.
|
||||||
if (stream.remaining() < 128) {
|
if (stream.remaining() < 128) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Endian.h>
|
||||||
#include <AK/Span.h>
|
#include <AK/Span.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibGfx/AffineTransform.h>
|
#include <LibGfx/AffineTransform.h>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <AK/Array.h>
|
#include <AK/Array.h>
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/Error.h>
|
#include <AK/Error.h>
|
||||||
#include <AK/IntegralMath.h>
|
#include <AK/IntegralMath.h>
|
||||||
#include <AK/Memory.h>
|
#include <AK/Memory.h>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/NonnullOwnPtrVector.h>
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <LibGfx/BMPLoader.h>
|
#include <LibGfx/BMPLoader.h>
|
||||||
|
@ -59,7 +59,7 @@ struct ICOLoadingContext {
|
||||||
size_t largest_index;
|
size_t largest_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Optional<size_t> decode_ico_header(InputMemoryStream& stream)
|
static Optional<size_t> decode_ico_header(DeprecatedInputMemoryStream& stream)
|
||||||
{
|
{
|
||||||
ICONDIR header;
|
ICONDIR header;
|
||||||
stream >> Bytes { &header, sizeof(header) };
|
stream >> Bytes { &header, sizeof(header) };
|
||||||
|
@ -71,7 +71,7 @@ static Optional<size_t> decode_ico_header(InputMemoryStream& stream)
|
||||||
return { header.image_count };
|
return { header.image_count };
|
||||||
}
|
}
|
||||||
|
|
||||||
static Optional<ICOImageDescriptor> decode_ico_direntry(InputMemoryStream& stream)
|
static Optional<ICOImageDescriptor> decode_ico_direntry(DeprecatedInputMemoryStream& stream)
|
||||||
{
|
{
|
||||||
ICONDIRENTRY entry;
|
ICONDIRENTRY entry;
|
||||||
stream >> Bytes { &entry, sizeof(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)
|
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);
|
auto image_count = decode_ico_header(stream);
|
||||||
if (!image_count.has_value() || image_count.value() == 0) {
|
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)
|
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();
|
return decode_ico_header(stream).has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ bool ICOImageDecoderPlugin::set_nonvolatile(bool& was_purged)
|
||||||
|
|
||||||
bool ICOImageDecoderPlugin::initialize()
|
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();
|
return decode_ico_header(stream).has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "QOIWriter.h"
|
#include "QOIWriter.h"
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
|
#include <AK/Endian.h>
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <AK/Concepts.h>
|
#include <AK/Concepts.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/NumericLimits.h>
|
#include <AK/NumericLimits.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/Try.h>
|
#include <AK/Try.h>
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/Tuple.h>
|
#include <AK/Tuple.h>
|
||||||
#include <LibCore/BitStream.h>
|
#include <LibCore/BitStream.h>
|
||||||
#include <LibCore/MemoryStream.h>
|
#include <LibCore/MemoryStream.h>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Endian.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibGfx/Forward.h>
|
#include <LibGfx/Forward.h>
|
||||||
#include <LibPDF/Encoding.h>
|
#include <LibPDF/Encoding.h>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
#include <AK/WeakPtr.h>
|
#include <AK/WeakPtr.h>
|
||||||
#include <LibCore/MemoryStream.h>
|
#include <LibCore/MemoryStream.h>
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/Endian.h>
|
#include <AK/Endian.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibCrypto/PK/Code/EMSA_PSS.h>
|
#include <LibCrypto/PK/Code/EMSA_PSS.h>
|
||||||
|
@ -141,7 +141,7 @@ void TLSv12::update_packet(ByteBuffer& packet)
|
||||||
// length (2)
|
// length (2)
|
||||||
u8 aad[13];
|
u8 aad[13];
|
||||||
Bytes aad_bytes { 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);
|
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));
|
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)
|
// length (2)
|
||||||
u8 aad[13];
|
u8 aad[13];
|
||||||
Bytes aad_bytes { 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);
|
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);
|
u16 len = AK::convert_between_host_and_network_endian((u16)packet_length);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <AK/Badge.h>
|
#include <AK/Badge.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/DistinctNumeric.h>
|
#include <AK/DistinctNumeric.h>
|
||||||
#include <AK/MemoryStream.h>
|
#include <AK/LEB128.h>
|
||||||
#include <AK/NonnullOwnPtrVector.h>
|
#include <AK/NonnullOwnPtrVector.h>
|
||||||
#include <AK/Result.h>
|
#include <AK/Result.h>
|
||||||
#include <AK/Variant.h>
|
#include <AK/Variant.h>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#include "Mixer.h"
|
#include "Mixer.h"
|
||||||
#include <AK/Array.h>
|
#include <AK/Array.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/NumericLimits.h>
|
#include <AK/NumericLimits.h>
|
||||||
#include <AudioServer/ConnectionFromClient.h>
|
#include <AudioServer/ConnectionFromClient.h>
|
||||||
#include <AudioServer/Mixer.h>
|
#include <AudioServer/Mixer.h>
|
||||||
|
@ -99,7 +99,7 @@ void Mixer::mix()
|
||||||
if (m_muted || m_main_volume < 0.01) {
|
if (m_muted || m_main_volume < 0.01) {
|
||||||
m_device->write(m_zero_filled_buffer.data(), static_cast<int>(m_zero_filled_buffer.size()));
|
m_device->write(m_zero_filled_buffer.data(), static_cast<int>(m_zero_filled_buffer.size()));
|
||||||
} else {
|
} else {
|
||||||
OutputMemoryStream stream { m_stream_buffer };
|
DeprecatedOutputMemoryStream stream { m_stream_buffer };
|
||||||
|
|
||||||
for (auto& mixed_sample : mixed_buffer) {
|
for (auto& mixed_sample : mixed_buffer) {
|
||||||
mixed_sample.log_multiply(static_cast<float>(m_main_volume));
|
mixed_sample.log_multiply(static_cast<float>(m_main_volume));
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
|
#include <AK/DeprecatedMemoryStream.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
@ -194,7 +194,7 @@ ErrorOr<void> Client::send_command(Command command)
|
||||||
ErrorOr<void> Client::send_commands(Vector<Command> commands)
|
ErrorOr<void> Client::send_commands(Vector<Command> commands)
|
||||||
{
|
{
|
||||||
auto buffer = TRY(ByteBuffer::create_uninitialized(commands.size() * 3));
|
auto buffer = TRY(ByteBuffer::create_uninitialized(commands.size() * 3));
|
||||||
OutputMemoryStream stream { buffer };
|
DeprecatedOutputMemoryStream stream { buffer };
|
||||||
|
|
||||||
for (auto& command : commands)
|
for (auto& command : commands)
|
||||||
stream << (u8)IAC << command.command << command.subcommand;
|
stream << (u8)IAC << command.command << command.subcommand;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <AK/Base64.h>
|
#include <AK/Base64.h>
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/MemoryStream.h>
|
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue