summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-07 11:46:37 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-07 11:46:37 +0200
commit7770d6a09d8e6d4a5fb1f380fb1b0afc97c765fb (patch)
tree6b90da7b303c797a1c9149921b452cad9902480c
parentb34b084619879111b9811d9334462d85272f3586 (diff)
downloadserenity-7770d6a09d8e6d4a5fb1f380fb1b0afc97c765fb.zip
LibCore: Run clang-format on everything.
-rw-r--r--LibCore/CIODevice.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/LibCore/CIODevice.cpp b/LibCore/CIODevice.cpp
index cc2599c609..ff46374d2d 100644
--- a/LibCore/CIODevice.cpp
+++ b/LibCore/CIODevice.cpp
@@ -22,9 +22,9 @@ const char* CIODevice::error_string() const
ByteBuffer CIODevice::read(int max_size)
{
if (m_fd < 0)
- return { };
+ return {};
if (!max_size)
- return { };
+ return {};
auto buffer = ByteBuffer::create_uninitialized(max_size);
auto* buffer_ptr = (char*)buffer.pointer();
int remaining_buffer_space = buffer.size();
@@ -42,11 +42,11 @@ ByteBuffer CIODevice::read(int max_size)
int nread = ::read(m_fd, buffer_ptr, remaining_buffer_space);
if (nread < 0) {
set_error(errno);
- return { };
+ return {};
}
if (nread == 0) {
set_eof(true);
- return { };
+ return {};
}
buffer.trim(nread);
return buffer;
@@ -58,7 +58,9 @@ bool CIODevice::can_read_from_fd() const
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(m_fd, &rfds);
- struct timeval timeout { 0, 0 };
+ struct timeval timeout {
+ 0, 0
+ };
int rc = select(m_fd + 1, &rfds, nullptr, nullptr, &timeout);
if (rc < 0) {
// NOTE: We don't set m_error here.
@@ -112,15 +114,15 @@ ByteBuffer CIODevice::read_all()
ByteBuffer CIODevice::read_line(int max_size)
{
if (m_fd < 0)
- return { };
+ return {};
if (!max_size)
- return { };
+ return {};
if (!can_read_line())
- return { };
+ return {};
if (m_eof) {
if (m_buffered_data.size() > max_size) {
dbgprintf("CIODevice::read_line: At EOF but there's more than max_size(%d) buffered\n", max_size);
- return { };
+ return {};
}
auto buffer = ByteBuffer::copy(m_buffered_data.data(), m_buffered_data.size());
m_buffered_data.clear();
@@ -140,7 +142,7 @@ ByteBuffer CIODevice::read_line(int max_size)
return line;
}
}
- return { };
+ return {};
}
bool CIODevice::populate_read_buffer()
@@ -175,7 +177,7 @@ bool CIODevice::close()
return true;
}
-bool CIODevice::seek(signed_qword offset, SeekMode mode, off_t *pos)
+bool CIODevice::seek(signed_qword offset, SeekMode mode, off_t* pos)
{
int m = SEEK_SET;
switch (mode) {
@@ -219,11 +221,12 @@ int CIODevice::printf(const char* format, ...)
va_list ap;
va_start(ap, format);
// FIXME: We're not propagating write() failures to client here!
- int ret = printf_internal([this] (char*&, char ch) {
+ int ret = printf_internal([this](char*&, char ch) {
int rc = write((const byte*)&ch, 1);
if (rc < 0)
dbgprintf("CIODevice::printf: write: %s\n", strerror(errno));
- }, nullptr, format, ap);
+ },
+ nullptr, format, ap);
va_end(ap);
return ret;
}