diff options
author | Tim Schumacher <timschumi@gmx.de> | 2023-02-24 22:38:01 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-13 15:16:20 +0000 |
commit | d5871f5717579fab3c093537c44e3cd467560cdd (patch) | |
tree | 9e7e118ae5b7642f0168c5302ee74e9e483ae91c /Userland/Libraries/LibCompress/Zlib.cpp | |
parent | 1d5b45f7d938b15db9da9b12dc4d8b373abd6c7c (diff) | |
download | serenity-d5871f5717579fab3c093537c44e3cd467560cdd.zip |
AK: Rename Stream::{read,write} to Stream::{read_some,write_some}
Similar to POSIX read, the basic read and write functions of AK::Stream
do not have a lower limit of how much data they read or write (apart
from "none at all").
Rename the functions to "read some [data]" and "write some [data]" (with
"data" being omitted, since everything here is reading and writing data)
to make them sufficiently distinct from the functions that ensure to
use the entire buffer (which should be the go-to function for most
usages).
No functional changes, just a lot of new FIXMEs.
Diffstat (limited to 'Userland/Libraries/LibCompress/Zlib.cpp')
-rw-r--r-- | Userland/Libraries/LibCompress/Zlib.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Userland/Libraries/LibCompress/Zlib.cpp b/Userland/Libraries/LibCompress/Zlib.cpp index 04fa6be768..39df8779b6 100644 --- a/Userland/Libraries/LibCompress/Zlib.cpp +++ b/Userland/Libraries/LibCompress/Zlib.cpp @@ -113,21 +113,22 @@ ErrorOr<void> ZlibCompressor::write_header(ZlibCompressionMethod compression_met // FIXME: Support pre-defined dictionaries. - TRY(m_output_stream->write(header.as_u16.bytes())); + // FIXME: This should write the entire span. + TRY(m_output_stream->write_some(header.as_u16.bytes())); return {}; } -ErrorOr<Bytes> ZlibCompressor::read(Bytes) +ErrorOr<Bytes> ZlibCompressor::read_some(Bytes) { return Error::from_errno(EBADF); } -ErrorOr<size_t> ZlibCompressor::write(ReadonlyBytes bytes) +ErrorOr<size_t> ZlibCompressor::write_some(ReadonlyBytes bytes) { VERIFY(!m_finished); - size_t n_written = TRY(m_compressor->write(bytes)); + size_t n_written = TRY(m_compressor->write_some(bytes)); m_adler32_checksum.update(bytes.trim(n_written)); return n_written; } @@ -154,7 +155,8 @@ ErrorOr<void> ZlibCompressor::finish() TRY(static_cast<DeflateCompressor*>(m_compressor.ptr())->final_flush()); NetworkOrdered<u32> adler_sum = m_adler32_checksum.digest(); - TRY(m_output_stream->write(adler_sum.bytes())); + // FIXME: This should write the entire span. + TRY(m_output_stream->write_some(adler_sum.bytes())); m_finished = true; |