mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:17:44 +00:00
LibCore: Take StringViews by value in Stream::* function arguments
This commit is contained in:
parent
8a1dfbd484
commit
07f444439c
2 changed files with 8 additions and 8 deletions
|
@ -91,7 +91,7 @@ ErrorOr<off_t> SeekableStream::size()
|
|||
return seek_result.value();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<File>> File::open(StringView const& filename, OpenMode mode, mode_t permissions)
|
||||
ErrorOr<NonnullOwnPtr<File>> File::open(StringView filename, OpenMode mode, mode_t permissions)
|
||||
{
|
||||
auto file = TRY(adopt_nonnull_own_or_enomem(new (nothrow) File(mode)));
|
||||
TRY(file->open_path(filename, permissions));
|
||||
|
@ -114,7 +114,7 @@ ErrorOr<NonnullOwnPtr<File>> File::adopt_fd(int fd, OpenMode mode)
|
|||
return file;
|
||||
}
|
||||
|
||||
ErrorOr<void> File::open_path(StringView const& filename, mode_t permissions)
|
||||
ErrorOr<void> File::open_path(StringView filename, mode_t permissions)
|
||||
{
|
||||
VERIFY(m_fd == -1);
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ class File final : public SeekableStream {
|
|||
AK_MAKE_NONCOPYABLE(File);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<File>> open(StringView const& filename, OpenMode, mode_t = 0644);
|
||||
static ErrorOr<NonnullOwnPtr<File>> open(StringView filename, OpenMode, mode_t = 0644);
|
||||
static ErrorOr<NonnullOwnPtr<File>> adopt_fd(int fd, OpenMode);
|
||||
|
||||
File(File&& other) { operator=(move(other)); }
|
||||
|
@ -199,7 +199,7 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
ErrorOr<void> open_path(StringView const& filename, mode_t);
|
||||
ErrorOr<void> open_path(StringView filename, mode_t);
|
||||
|
||||
OpenMode m_mode { OpenMode::NotOpen };
|
||||
int m_fd { -1 };
|
||||
|
@ -542,7 +542,7 @@ public:
|
|||
return read_until(buffer, "\n"sv);
|
||||
}
|
||||
|
||||
ErrorOr<size_t> read_until(Bytes buffer, StringView const& candidate)
|
||||
ErrorOr<size_t> read_until(Bytes buffer, StringView candidate)
|
||||
{
|
||||
return read_until_any_of(buffer, Array { candidate });
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ public:
|
|||
}
|
||||
|
||||
ErrorOr<size_t> read_line(Bytes buffer) { return m_helper.read_line(move(buffer)); }
|
||||
ErrorOr<size_t> read_until(Bytes buffer, StringView const& candidate) { return m_helper.read_until(move(buffer), move(candidate)); }
|
||||
ErrorOr<size_t> read_until(Bytes buffer, StringView candidate) { return m_helper.read_until(move(buffer), move(candidate)); }
|
||||
template<size_t N>
|
||||
ErrorOr<size_t> read_until_any_of(Bytes buffer, Array<StringView, N> candidates) { return m_helper.read_until_any_of(move(buffer), move(candidates)); }
|
||||
ErrorOr<bool> can_read_line() { return m_helper.can_read_line(); }
|
||||
|
@ -745,7 +745,7 @@ private:
|
|||
class BufferedSocketBase : public Socket {
|
||||
public:
|
||||
virtual ErrorOr<size_t> read_line(Bytes buffer) = 0;
|
||||
virtual ErrorOr<size_t> read_until(Bytes buffer, StringView const& candidate) = 0;
|
||||
virtual ErrorOr<size_t> read_until(Bytes buffer, StringView candidate) = 0;
|
||||
virtual ErrorOr<bool> can_read_line() = 0;
|
||||
virtual size_t buffer_size() const = 0;
|
||||
};
|
||||
|
@ -789,7 +789,7 @@ public:
|
|||
virtual ErrorOr<void> set_close_on_exec(bool enabled) override { return m_helper.stream().set_close_on_exec(enabled); }
|
||||
|
||||
virtual ErrorOr<size_t> read_line(Bytes buffer) override { return m_helper.read_line(move(buffer)); }
|
||||
virtual ErrorOr<size_t> read_until(Bytes buffer, StringView const& candidate) override { return m_helper.read_until(move(buffer), move(candidate)); }
|
||||
virtual ErrorOr<size_t> read_until(Bytes buffer, StringView candidate) override { return m_helper.read_until(move(buffer), move(candidate)); }
|
||||
template<size_t N>
|
||||
ErrorOr<size_t> read_until_any_of(Bytes buffer, Array<StringView, N> candidates) { return m_helper.read_until_any_of(move(buffer), move(candidates)); }
|
||||
virtual ErrorOr<bool> can_read_line() override { return m_helper.can_read_line(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue