From ec1c487dcd7de331d17d9c9ccc21dfbfa00dd4c8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 21 Dec 2018 02:10:45 +0100 Subject: [PATCH] Yet another pass of style fixes. --- AK/AKString.h | 16 +++--- AK/Buffer.h | 12 ++--- AK/ByteBuffer.h | 21 ++++---- AK/DoublyLinkedList.h | 2 +- AK/FileSystemPath.cpp | 6 +-- AK/HashMap.h | 2 +- AK/HashTable.h | 18 +++---- AK/InlineLinkedList.h | 61 +++++++++++----------- AK/SinglyLinkedList.h | 2 +- AK/String.cpp | 12 ++--- AK/StringBuilder.cpp | 4 +- AK/StringImpl.cpp | 30 +++++------ AK/StringImpl.h | 18 +++---- AK/Vector.h | 4 +- AK/WeakPtr.h | 2 +- AK/test.cpp | 14 ++--- Kernel/DoubleBuffer.cpp | 2 +- Kernel/DoubleBuffer.h | 2 +- Kernel/IDEDiskDevice.cpp | 4 +- Kernel/ProcFileSystem.cpp | 30 +++++------ Kernel/Process.cpp | 10 ++-- Kernel/Scheduler.cpp | 2 +- Kernel/i386.cpp | 2 +- Kernel/init.cpp | 4 +- LibC/entry.cpp | 2 +- Userland/kill.cpp | 2 +- VirtualFileSystem/DiskBackedFileSystem.cpp | 4 +- VirtualFileSystem/Ext2FileSystem.cpp | 28 +++++----- VirtualFileSystem/FileDescriptor.cpp | 4 +- VirtualFileSystem/FileSystem.cpp | 6 +-- VirtualFileSystem/FileSystem.h | 2 +- VirtualFileSystem/VirtualFileSystem.cpp | 10 ++-- VirtualFileSystem/test.cpp | 2 +- Widgets/Button.cpp | 2 +- Widgets/CheckBox.cpp | 2 +- Widgets/EventLoop.cpp | 2 +- Widgets/Label.cpp | 2 +- Widgets/Rect.h | 2 +- Widgets/Size.h | 2 +- Widgets/TerminalWidget.cpp | 2 +- Widgets/TextBox.cpp | 6 +-- Widgets/Window.cpp | 2 +- Widgets/WindowManager.cpp | 6 +-- 43 files changed, 183 insertions(+), 185 deletions(-) diff --git a/AK/AKString.h b/AK/AKString.h index a8e7e078187..2f0a3e4b7ad 100644 --- a/AK/AKString.h +++ b/AK/AKString.h @@ -46,25 +46,25 @@ public: unsigned toUInt(bool& ok) const; - String toLowercase() const + String to_lowercase() const { if (!m_impl) return String(); - return m_impl->toLowercase(); + return m_impl->to_lowercase(); } - String toUppercase() const + String to_uppercase() const { if (!m_impl) return String(); - return m_impl->toUppercase(); + return m_impl->to_uppercase(); } Vector split(char separator) const; String substring(size_t start, size_t length) const; - bool isNull() const { return !m_impl; } - bool isEmpty() const { return length() == 0; } + bool is_null() const { return !m_impl; } + bool is_empty() const { return length() == 0; } unsigned length() const { return m_impl ? m_impl->length() : 0; } const char* characters() const { return m_impl ? m_impl->characters() : nullptr; } char operator[](unsigned i) const { ASSERT(m_impl); return (*m_impl)[i]; } @@ -72,7 +72,7 @@ public: bool operator==(const String&) const; bool operator!=(const String& other) const { return !(*this == other); } - String isolatedCopy() const; + String isolated_copy() const; static String empty(); @@ -93,7 +93,7 @@ public: return *this; } - ByteBuffer toByteBuffer() const; + ByteBuffer to_byte_buffer() const; private: RetainPtr m_impl; diff --git a/AK/Buffer.h b/AK/Buffer.h index 2010bf16136..3c1feb34c55 100644 --- a/AK/Buffer.h +++ b/AK/Buffer.h @@ -11,7 +11,7 @@ namespace AK { template class Buffer : public Retainable> { public: - static RetainPtr createUninitialized(size_t count); + static RetainPtr create_uninitialized(size_t count); static RetainPtr copy(const T*, size_t count); static RetainPtr wrap(T*, size_t count); static RetainPtr adopt(T*, size_t count); @@ -29,16 +29,16 @@ public: T& operator[](size_t i) { ASSERT(i < m_size); return m_elements[i]; } const T& operator[](size_t i) const { ASSERT(i < m_size); return m_elements[i]; } - bool isEmpty() const { return !m_size; } + bool is_empty() const { return !m_size; } size_t size() const { return m_size; } T* pointer() { return m_elements; } const T* pointer() const { return m_elements; } - T* offsetPointer(size_t offset) { return m_elements + offset; } - const T* offsetPointer(size_t offset) const { return m_elements + offset; } + T* offset_pointer(size_t offset) { return m_elements + offset; } + const T* offset_pointer(size_t offset) const { return m_elements + offset; } - const void* endPointer() const { return m_elements + m_size; } + const void* end_pointer() const { return m_elements + m_size; } // NOTE: trim() does not reallocate. void trim(size_t size) @@ -91,7 +91,7 @@ inline Buffer::Buffer(T* elements, size_t size, ConstructionMode mode) } template -inline RetainPtr> Buffer::createUninitialized(size_t size) +inline RetainPtr> Buffer::create_uninitialized(size_t size) { return ::adopt(*new Buffer(size)); } diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h index b005deefe77..62075563e68 100644 --- a/AK/ByteBuffer.h +++ b/AK/ByteBuffer.h @@ -30,8 +30,7 @@ public: return *this; } - static ByteBuffer createEmpty() { return ByteBuffer(Buffer::createUninitialized(0)); } - static ByteBuffer createUninitialized(size_t size) { return ByteBuffer(Buffer::createUninitialized(size)); } + static ByteBuffer create_uninitialized(size_t size) { return ByteBuffer(Buffer::create_uninitialized(size)); } static ByteBuffer copy(const byte* data, size_t size) { return ByteBuffer(Buffer::copy(data, size)); } static ByteBuffer wrap(byte* data, size_t size) { return ByteBuffer(Buffer::wrap(data, size)); } static ByteBuffer adopt(byte* data, size_t size) { return ByteBuffer(Buffer::adopt(data, size)); } @@ -39,22 +38,22 @@ public: ~ByteBuffer() { clear(); } void clear() { m_impl = nullptr; } - operator bool() const { return !isNull(); } - bool operator!() const { return isNull(); } - bool isNull() const { return m_impl == nullptr; } + operator bool() const { return !is_null(); } + bool operator!() const { return is_null(); } + bool is_null() const { return m_impl == nullptr; } byte& operator[](size_t i) { ASSERT(m_impl); return (*m_impl)[i]; } byte operator[](size_t i) const { ASSERT(m_impl); return (*m_impl)[i]; } - bool isEmpty() const { return !m_impl || m_impl->isEmpty(); } + bool is_empty() const { return !m_impl || m_impl->is_empty(); } size_t size() const { return m_impl ? m_impl->size() : 0; } byte* pointer() { return m_impl ? m_impl->pointer() : nullptr; } const byte* pointer() const { return m_impl ? m_impl->pointer() : nullptr; } - byte* offsetPointer(size_t offset) { return m_impl ? m_impl->offsetPointer(offset) : nullptr; } - const byte* offsetPointer(size_t offset) const { return m_impl ? m_impl->offsetPointer(offset) : nullptr; } + byte* offset_pointer(size_t offset) { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } + const byte* offset_pointer(size_t offset) const { return m_impl ? m_impl->offset_pointer(offset) : nullptr; } - const void* endPointer() const { return m_impl ? m_impl->endPointer() : nullptr; } + const void* end_pointer() const { return m_impl ? m_impl->end_pointer() : nullptr; } // NOTE: trim() does not reallocate. void trim(size_t size) @@ -65,13 +64,13 @@ public: ByteBuffer slice(size_t offset, size_t size) const { - if (isNull()) + if (is_null()) return { }; if (offset >= this->size()) return { }; if (offset + size >= this->size()) size = this->size() - offset; - return copy(offsetPointer(offset), size); + return copy(offset_pointer(offset), size); } private: diff --git a/AK/DoublyLinkedList.h b/AK/DoublyLinkedList.h index 6c7f8dd6b53..822374ca64d 100644 --- a/AK/DoublyLinkedList.h +++ b/AK/DoublyLinkedList.h @@ -19,7 +19,7 @@ public: DoublyLinkedList() { } ~DoublyLinkedList() { clear(); } - bool isEmpty() const { return !head(); } + bool is_empty() const { return !head(); } void clear() { diff --git a/AK/FileSystemPath.cpp b/AK/FileSystemPath.cpp index e30df5d5895..d52bd49e267 100644 --- a/AK/FileSystemPath.cpp +++ b/AK/FileSystemPath.cpp @@ -22,14 +22,14 @@ bool FileSystemPath::canonicalize(bool resolve_symbolic_links) if (part == ".") continue; if (part == "..") { - if (!canonical_parts.isEmpty()) + if (!canonical_parts.is_empty()) canonical_parts.takeLast(); continue; } - if (!part.isEmpty()) + if (!part.is_empty()) canonical_parts.append(part); } - if (canonical_parts.isEmpty()) { + if (canonical_parts.is_empty()) { m_string = m_basename = "/"; return true; } diff --git a/AK/HashMap.h b/AK/HashMap.h index b1a68abb5b7..211618bcbe4 100644 --- a/AK/HashMap.h +++ b/AK/HashMap.h @@ -46,7 +46,7 @@ public: return *this; } - bool isEmpty() const { return m_table.isEmpty(); } + bool is_empty() const { return m_table.is_empty(); } unsigned size() const { return m_table.size(); } unsigned capacity() const { return m_table.capacity(); } void clear() { m_table.clear(); } diff --git a/AK/HashTable.h b/AK/HashTable.h index 68e2c164a2f..079df8402e2 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -44,7 +44,7 @@ public: } ~HashTable() { clear(); } - bool isEmpty() const { return !m_size; } + bool is_empty() const { return !m_size; } unsigned size() const { return m_size; } unsigned capacity() const { return m_capacity; } @@ -112,7 +112,7 @@ public: , m_isEnd(isEnd) , m_bucketIterator(bucketIterator) { - if (!isEnd && !m_table.isEmpty() && !(m_bucketIterator != DoublyLinkedList::Iterator::universalEnd())) { + if (!isEnd && !m_table.is_empty() && !(m_bucketIterator != DoublyLinkedList::Iterator::universalEnd())) { #ifdef HASHTABLE_DEBUG kprintf("bucket iterator init!\n"); #endif @@ -128,7 +128,7 @@ public: typename DoublyLinkedList::Iterator m_bucketIterator; }; - Iterator begin() { return Iterator(*this, isEmpty()); } + Iterator begin() { return Iterator(*this, is_empty()); } Iterator end() { return Iterator(*this, true); } class ConstIterator { @@ -189,7 +189,7 @@ public: , m_isEnd(isEnd) , m_bucketIterator(bucketIterator) { - if (!isEnd && !m_table.isEmpty() && !(m_bucketIterator != DoublyLinkedList::ConstIterator::universalEnd())) { + if (!isEnd && !m_table.is_empty() && !(m_bucketIterator != DoublyLinkedList::ConstIterator::universalEnd())) { #ifdef HASHTABLE_DEBUG kprintf("const bucket iterator init!\n"); #endif @@ -206,7 +206,7 @@ public: typename DoublyLinkedList::ConstIterator m_bucketIterator; }; - ConstIterator begin() const { return ConstIterator(*this, isEmpty()); } + ConstIterator begin() const { return ConstIterator(*this, is_empty()); } ConstIterator end() const { return ConstIterator(*this, true); } Iterator find(const T&); @@ -323,7 +323,7 @@ void HashTable::insert(const T& value) template bool HashTable::contains(const T& value) const { - if (isEmpty()) + if (is_empty()) return false; auto& bucket = lookup(value); for (auto& e : bucket.chain) { @@ -336,7 +336,7 @@ bool HashTable::contains(const T& value) const template auto HashTable::find(const T& value) -> Iterator { - if (isEmpty()) + if (is_empty()) return end(); unsigned bucketIndex; auto& bucket = lookup(value, &bucketIndex); @@ -349,7 +349,7 @@ auto HashTable::find(const T& value) -> Iterator template auto HashTable::find(const T& value) const -> ConstIterator { - if (isEmpty()) + if (is_empty()) return end(); unsigned bucketIndex; auto& bucket = lookup(value, &bucketIndex); @@ -362,7 +362,7 @@ auto HashTable::find(const T& value) const -> ConstIterator template void HashTable::remove(Iterator it) { - ASSERT(!isEmpty()); + ASSERT(!is_empty()); m_buckets[it.m_bucketIndex].chain.remove(it.m_bucketIterator); --m_size; } diff --git a/AK/InlineLinkedList.h b/AK/InlineLinkedList.h index 210c7439ab1..5773e922327 100644 --- a/AK/InlineLinkedList.h +++ b/AK/InlineLinkedList.h @@ -9,8 +9,8 @@ template class InlineLinkedListNode { public: InlineLinkedListNode(); - void setPrev(T*); - void setNext(T*); + void set_prev(T*); + void set_next(T*); T* prev() const; T* next() const; @@ -18,16 +18,16 @@ public: template inline InlineLinkedListNode::InlineLinkedListNode() { - setPrev(0); - setNext(0); + set_prev(0); + set_next(0); } -template inline void InlineLinkedListNode::setPrev(T* prev) +template inline void InlineLinkedListNode::set_prev(T* prev) { static_cast(this)->m_prev = prev; } -template inline void InlineLinkedListNode::setNext(T* next) +template inline void InlineLinkedListNode::set_next(T* next) { static_cast(this)->m_next = next; } @@ -46,12 +46,12 @@ template class InlineLinkedList { public: InlineLinkedList() { } - bool isEmpty() const { return !m_head; } - size_t sizeSlow() const; + bool is_empty() const { return !m_head; } + size_t size_slow() const; void clear(); T* head() const { return m_head; } - T* removeHead(); + T* remove_head(); T* tail() const { return m_tail; } @@ -60,7 +60,7 @@ public: void remove(T*); void append(InlineLinkedList&); - bool containsSlow(T* value) const + bool contains_slow(T* value) const { for (T* node = m_head; node; node = node->next()) { if (node == value) @@ -74,7 +74,7 @@ private: T* m_tail { nullptr }; }; -template inline size_t InlineLinkedList::sizeSlow() const +template inline size_t InlineLinkedList::size_slow() const { size_t size = 0; for (T* node = m_head; node; node = node->next()) @@ -94,15 +94,15 @@ template inline void InlineLinkedList::prepend(T* node) ASSERT(!m_tail); m_head = node; m_tail = node; - node->setPrev(0); - node->setNext(0); + node->set_prev(0); + node->set_next(0); return; } ASSERT(m_tail); - m_head->setPrev(node); - node->setNext(m_head); - node->setPrev(0); + m_head->set_prev(node); + node->set_next(m_head); + node->set_prev(0); m_head = node; } @@ -112,15 +112,15 @@ template inline void InlineLinkedList::append(T* node) ASSERT(!m_head); m_head = node; m_tail = node; - node->setPrev(0); - node->setNext(0); + node->set_prev(0); + node->set_next(0); return; } ASSERT(m_head); - m_tail->setNext(node); - node->setPrev(m_tail); - node->setNext(0); + m_tail->set_next(node); + node->set_prev(m_tail); + node->set_next(0); m_tail = node; } @@ -128,7 +128,7 @@ template inline void InlineLinkedList::remove(T* node) { if (node->prev()) { ASSERT(node != m_head); - node->prev()->setNext(node->next()); + node->prev()->set_next(node->next()); } else { ASSERT(node == m_head); m_head = node->next(); @@ -136,14 +136,14 @@ template inline void InlineLinkedList::remove(T* node) if (node->next()) { ASSERT(node != m_tail); - node->next()->setPrev(node->prev()); + node->next()->set_prev(node->prev()); } else { ASSERT(node == m_tail); m_tail = node->prev(); } } -template inline T* InlineLinkedList::removeHead() +template inline T* InlineLinkedList::remove_head() { T* node = head(); if (node) @@ -165,19 +165,18 @@ template inline void InlineLinkedList::append(InlineLinkedList ASSERT(tail()); ASSERT(other.head()); - T* otherHead = other.head(); - T* otherTail = other.tail(); + T* other_head = other.head(); + T* other_tail = other.tail(); other.clear(); ASSERT(!m_tail->next()); - m_tail->setNext(otherHead); - ASSERT(!otherHead->prev()); - otherHead->setPrev(m_tail); - m_tail = otherTail; + m_tail->set_next(other_head); + ASSERT(!other_head->prev()); + other_head->set_prev(m_tail); + m_tail = other_tail; } } using AK::InlineLinkedList; using AK::InlineLinkedListNode; - diff --git a/AK/SinglyLinkedList.h b/AK/SinglyLinkedList.h index 68f87e32762..ab552c46647 100644 --- a/AK/SinglyLinkedList.h +++ b/AK/SinglyLinkedList.h @@ -17,7 +17,7 @@ public: SinglyLinkedList() { } ~SinglyLinkedList() { clear(); } - bool isEmpty() const { return !head(); } + bool is_empty() const { return !head(); } void clear() { diff --git a/AK/String.cpp b/AK/String.cpp index fd4b34f06ed..3da0ab6b994 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -19,17 +19,17 @@ bool String::operator==(const String& other) const String String::empty() { - return StringImpl::theEmptyStringImpl(); + return StringImpl::the_empty_stringimpl(); } -String String::isolatedCopy() const +String String::isolated_copy() const { if (!m_impl) return { }; if (!m_impl->length()) return empty(); char* buffer; - auto impl = StringImpl::createUninitialized(length(), buffer); + auto impl = StringImpl::create_uninitialized(length(), buffer); memcpy(buffer, m_impl->characters(), m_impl->length()); return String(move(*impl)); } @@ -40,7 +40,7 @@ String String::substring(size_t start, size_t length) const ASSERT(start + length <= m_impl->length()); // FIXME: This needs some input bounds checking. char* buffer; - auto newImpl = StringImpl::createUninitialized(length, buffer); + auto newImpl = StringImpl::create_uninitialized(length, buffer); memcpy(buffer, characters() + start, length); buffer[length] = '\0'; return newImpl; @@ -48,7 +48,7 @@ String String::substring(size_t start, size_t length) const Vector String::split(const char separator) const { - if (isEmpty()) + if (is_empty()) return { }; Vector v; @@ -70,7 +70,7 @@ Vector String::split(const char separator) const return v; } -ByteBuffer String::toByteBuffer() const +ByteBuffer String::to_byte_buffer() const { if (!m_impl) return nullptr; diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index fec2b7e3e87..f3766cc250b 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -20,7 +20,7 @@ void StringBuilder::append(char ch) String StringBuilder::build() { auto strings = move(m_strings); - if (strings.isEmpty()) + if (strings.is_empty()) return String::empty(); size_t sizeNeeded = 0; @@ -28,7 +28,7 @@ String StringBuilder::build() sizeNeeded += string.length(); char* buffer; - auto impl = StringImpl::createUninitialized(sizeNeeded, buffer); + auto impl = StringImpl::create_uninitialized(sizeNeeded, buffer); if (!impl) return String(); diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp index 53719e35496..12eceeeef7e 100644 --- a/AK/StringImpl.cpp +++ b/AK/StringImpl.cpp @@ -4,18 +4,18 @@ namespace AK { -static StringImpl* s_theEmptyStringImpl = nullptr; +static StringImpl* s_the_empty_stringimpl = nullptr; -void StringImpl::initializeGlobals() +void StringImpl::initialize_globals() { - s_theEmptyStringImpl = nullptr; + s_the_empty_stringimpl = nullptr; } -StringImpl& StringImpl::theEmptyStringImpl() +StringImpl& StringImpl::the_empty_stringimpl() { - if (!s_theEmptyStringImpl) - s_theEmptyStringImpl = new StringImpl(ConstructTheEmptyStringImpl);; - return *s_theEmptyStringImpl; + if (!s_the_empty_stringimpl) + s_the_empty_stringimpl = new StringImpl(ConstructTheEmptyStringImpl);; + return *s_the_empty_stringimpl; } StringImpl::~StringImpl() @@ -27,7 +27,7 @@ static inline size_t allocationSizeForStringImpl(size_t length) return sizeof(StringImpl) + (sizeof(char) * length) + sizeof(char); } -RetainPtr StringImpl::createUninitialized(size_t length, char*& buffer) +RetainPtr StringImpl::create_uninitialized(size_t length, char*& buffer) { ASSERT(length); void* slot = kmalloc(allocationSizeForStringImpl(length)); @@ -46,10 +46,10 @@ RetainPtr StringImpl::create(const char* cstring, size_t length, Sho return nullptr; if (!*cstring) - return theEmptyStringImpl(); + return the_empty_stringimpl(); char* buffer; - auto newStringImpl = createUninitialized(length, buffer); + auto newStringImpl = create_uninitialized(length, buffer); if (!newStringImpl) return nullptr; memcpy(buffer, cstring, length * sizeof(char)); @@ -94,7 +94,7 @@ static inline char toASCIIUppercase(char c) return c; } -RetainPtr StringImpl::toLowercase() const +RetainPtr StringImpl::to_lowercase() const { if (!m_length) return const_cast(this); @@ -107,7 +107,7 @@ RetainPtr StringImpl::toLowercase() const slowPath: char* buffer; - auto lowercased = createUninitialized(m_length, buffer); + auto lowercased = create_uninitialized(m_length, buffer); if (!lowercased) return nullptr; for (size_t i = 0; i < m_length; ++i) @@ -116,7 +116,7 @@ slowPath: return lowercased; } -RetainPtr StringImpl::toUppercase() const +RetainPtr StringImpl::to_uppercase() const { if (!m_length) return const_cast(this); @@ -129,7 +129,7 @@ RetainPtr StringImpl::toUppercase() const slowPath: char* buffer; - auto uppercased = createUninitialized(m_length, buffer); + auto uppercased = create_uninitialized(m_length, buffer); if (!uppercased) return nullptr; for (size_t i = 0; i < m_length; ++i) @@ -138,7 +138,7 @@ slowPath: return uppercased; } -void StringImpl::computeHash() const +void StringImpl::compute_hash() const { if (!length()) { m_hash = 0; diff --git a/AK/StringImpl.h b/AK/StringImpl.h index 6d3419e8af8..6a92856a9aa 100644 --- a/AK/StringImpl.h +++ b/AK/StringImpl.h @@ -10,14 +10,14 @@ enum ShouldChomp { NoChomp, Chomp }; class StringImpl : public Retainable { public: - static RetainPtr createUninitialized(size_t length, char*& buffer); + static RetainPtr create_uninitialized(size_t length, char*& buffer); static RetainPtr create(const char* cstring, ShouldChomp = NoChomp); static RetainPtr create(const char* cstring, size_t length, ShouldChomp = NoChomp); - RetainPtr toLowercase() const; - RetainPtr toUppercase() const; + RetainPtr to_lowercase() const; + RetainPtr to_uppercase() const; - static StringImpl& theEmptyStringImpl(); - static void initializeGlobals(); + static StringImpl& the_empty_stringimpl(); + static void initialize_globals(); ~StringImpl(); @@ -28,7 +28,7 @@ public: unsigned hash() const { if (!m_hasHash) - computeHash(); + compute_hash(); return m_hash; } @@ -37,15 +37,15 @@ private: explicit StringImpl(ConstructTheEmptyStringImplTag) : m_characters("") { } enum ConstructWithInlineBufferTag { ConstructWithInlineBuffer }; - explicit StringImpl(ConstructWithInlineBufferTag, size_t length) : m_length(length), m_characters(m_inlineBuffer) { } + explicit StringImpl(ConstructWithInlineBufferTag, size_t length) : m_length(length), m_characters(m_inline_buffer) { } - void computeHash() const; + void compute_hash() const; size_t m_length { 0 }; mutable bool m_hasHash { false }; const char* m_characters { nullptr }; mutable unsigned m_hash { 0 }; - char m_inlineBuffer[0]; + char m_inline_buffer[0]; }; } diff --git a/AK/Vector.h b/AK/Vector.h index d52cea64e22..568da8ae865 100644 --- a/AK/Vector.h +++ b/AK/Vector.h @@ -109,7 +109,7 @@ public: return false; } - bool isEmpty() const { return size() == 0; } + bool is_empty() const { return size() == 0; } size_t size() const { return m_impl ? m_impl->size() : 0; } size_t capacity() const { return m_impl ? m_impl->capacity() : 0; } @@ -130,7 +130,7 @@ public: T takeLast() { - ASSERT(!isEmpty()); + ASSERT(!is_empty()); T value = move(last()); last().~T(); --m_impl->m_size; diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index 137bb066324..e3c5e4b96b9 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -29,7 +29,7 @@ public: T& operator*() { return *ptr(); } const T& operator*() const { return *ptr(); } - bool isNull() const { return !m_link || !m_link->ptr(); } + bool is_null() const { return !m_link || !m_link->ptr(); } void clear() { m_link = nullptr; } WeakLink* leakLink() { return m_link.leakRef(); } diff --git a/AK/test.cpp b/AK/test.cpp index 49f057c7603..8945eb599a0 100644 --- a/AK/test.cpp +++ b/AK/test.cpp @@ -20,7 +20,7 @@ void log_unlocked() { } int main(int c, char** v) { - StringImpl::initializeGlobals(); + StringImpl::initialize_globals(); { SpinLock lock; @@ -32,7 +32,7 @@ int main(int c, char** v) if (c == 2) testpath = v[1]; FileSystemPath p(testpath); - if (p.string().isNull()) + if (p.string().is_null()) printf("canonicalized path is null\n"); else printf("%s\n", p.string().characters()); @@ -108,14 +108,14 @@ int main(int c, char** v) String empty = ""; char* buffer; - auto test = StringImpl::createUninitialized(3, buffer); + auto test = StringImpl::create_uninitialized(3, buffer); auto hello = String("hello"); auto Hello = String("Hello"); printf("hello: '%s'\n", hello.characters()); printf("Hello: '%s'\n", Hello.characters()); - printf("'Hello'.lower(): '%s'\n", Hello.toLowercase().characters()); - printf("'hello'.upper(): '%s'\n", Hello.toUppercase().characters()); + printf("'Hello'.lower(): '%s'\n", Hello.to_lowercase().characters()); + printf("'hello'.upper(): '%s'\n", Hello.to_uppercase().characters()); Vector strings; strings.append("a"); @@ -188,7 +188,7 @@ int main(int c, char** v) list.append(3); list.append(6); list.append(9); - ASSERT(!list.isEmpty()); + ASSERT(!list.is_empty()); ASSERT(list.first() == 3); ASSERT(list.last() == 9); @@ -213,7 +213,7 @@ int main(int c, char** v) printf("not found\n"); } - auto charbuf = Buffer::createUninitialized(1024); + auto charbuf = Buffer::create_uninitialized(1024); printf("charbuf.size() = %zu\n", charbuf->size()); { diff --git a/Kernel/DoubleBuffer.cpp b/Kernel/DoubleBuffer.cpp index 3937ed27408..30c125bd229 100644 --- a/Kernel/DoubleBuffer.cpp +++ b/Kernel/DoubleBuffer.cpp @@ -16,7 +16,7 @@ ssize_t DoubleBuffer::write(const byte* data, size_t size) ssize_t DoubleBuffer::read(byte* data, size_t size) { - if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->isEmpty()) + if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->is_empty()) flip(); if (m_read_buffer_index >= m_read_buffer->size()) return 0; diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h index 46e0e56da3a..b14b9431ce3 100644 --- a/Kernel/DoubleBuffer.h +++ b/Kernel/DoubleBuffer.h @@ -14,7 +14,7 @@ public: ssize_t write(const byte*, size_t); ssize_t read(byte*, size_t); - bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->isEmpty(); } + bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->is_empty(); } private: void flip(); diff --git a/Kernel/IDEDiskDevice.cpp b/Kernel/IDEDiskDevice.cpp index 1e3a0257ddb..f1fcc533936 100644 --- a/Kernel/IDEDiskDevice.cpp +++ b/Kernel/IDEDiskDevice.cpp @@ -132,8 +132,8 @@ void IDEDiskDevice::initialize() enable_irq(); wait_for_irq(); - ByteBuffer wbuf = ByteBuffer::createUninitialized(512); - ByteBuffer bbuf = ByteBuffer::createUninitialized(512); + ByteBuffer wbuf = ByteBuffer::create_uninitialized(512); + ByteBuffer bbuf = ByteBuffer::create_uninitialized(512); byte* b = bbuf.pointer(); word* w = (word*)wbuf.pointer(); const word* wbufbase = (word*)wbuf.pointer(); diff --git a/Kernel/ProcFileSystem.cpp b/Kernel/ProcFileSystem.cpp index 7ea66052e59..aa691af8c51 100644 --- a/Kernel/ProcFileSystem.cpp +++ b/Kernel/ProcFileSystem.cpp @@ -32,7 +32,7 @@ ByteBuffer procfs$pid_fds(Process& process) { ProcessInspectionHandle handle(process); char* buffer; - auto stringImpl = StringImpl::createUninitialized(process.number_of_open_file_descriptors() * 80, buffer); + auto stringImpl = StringImpl::create_uninitialized(process.number_of_open_file_descriptors() * 80, buffer); memset(buffer, 0, stringImpl->length()); char* ptr = buffer; for (size_t i = 0; i < process.max_open_file_descriptors(); ++i) { @@ -49,7 +49,7 @@ ByteBuffer procfs$pid_vm(Process& process) { ProcessInspectionHandle handle(process); char* buffer; - auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 160 + 4096, buffer); + auto stringImpl = StringImpl::create_uninitialized(80 + process.regionCount() * 160 + 4096, buffer); memset(buffer, 0, stringImpl->length()); char* ptr = buffer; ptr += ksprintf(ptr, "BEGIN END SIZE COMMIT NAME\n"); @@ -69,7 +69,7 @@ ByteBuffer procfs$pid_vmo(Process& process) { ProcessInspectionHandle handle(process); char* buffer; - auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 160 + 4096, buffer); + auto stringImpl = StringImpl::create_uninitialized(80 + process.regionCount() * 160 + 4096, buffer); memset(buffer, 0, stringImpl->length()); char* ptr = buffer; ptr += ksprintf(ptr, "BEGIN END SIZE NAME\n"); @@ -118,7 +118,7 @@ ByteBuffer procfs$pid_stack(Process& process) for (auto& symbol : recognizedSymbols) { bytesNeeded += symbol.ksym->name.length() + 8 + 16; } - auto buffer = ByteBuffer::createUninitialized(bytesNeeded); + auto buffer = ByteBuffer::create_uninitialized(bytesNeeded); char* bufptr = (char*)buffer.pointer(); for (auto& symbol : recognizedSymbols) { @@ -134,7 +134,7 @@ ByteBuffer procfs$pid_regs(Process& process) { ProcessInspectionHandle handle(process); auto& tss = process.tss(); - auto buffer = ByteBuffer::createUninitialized(1024); + auto buffer = ByteBuffer::create_uninitialized(1024); char* ptr = (char*)buffer.pointer(); ptr += ksprintf(ptr, "eax: %x\n", tss.eax); ptr += ksprintf(ptr, "ebx: %x\n", tss.ebx); @@ -156,7 +156,7 @@ ByteBuffer procfs$pid_exe(Process& process) ProcessInspectionHandle handle(process); auto inode = process.executable_inode(); ASSERT(inode); - return VFS::the().absolute_path(*inode).toByteBuffer(); + return VFS::the().absolute_path(*inode).to_byte_buffer(); } ByteBuffer procfs$pid_cwd(Process& process) @@ -164,7 +164,7 @@ ByteBuffer procfs$pid_cwd(Process& process) ProcessInspectionHandle handle(process); auto inode = process.cwd_inode(); ASSERT(inode); - return VFS::the().absolute_path(*inode).toByteBuffer(); + return VFS::the().absolute_path(*inode).to_byte_buffer(); } void ProcFS::add_process(Process& process) @@ -199,7 +199,7 @@ ByteBuffer procfs$mm() { // FIXME: Implement InterruptDisabler disabler; - auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_vmos.size()); + auto buffer = ByteBuffer::create_uninitialized(1024 + 80 * MM.m_vmos.size()); char* ptr = (char*)buffer.pointer(); for (auto* vmo : MM.m_vmos) { ptr += ksprintf(ptr, "VMO: %p %s(%u): p:%4u %s\n", @@ -219,7 +219,7 @@ ByteBuffer procfs$regions() { // FIXME: Implement InterruptDisabler disabler; - auto buffer = ByteBuffer::createUninitialized(1024 + 80 * MM.m_regions.size()); + auto buffer = ByteBuffer::create_uninitialized(1024 + 80 * MM.m_regions.size()); char* ptr = (char*)buffer.pointer(); for (auto* region : MM.m_regions) { ptr += ksprintf(ptr, "Region: %p VMO=%p %s\n", @@ -235,7 +235,7 @@ ByteBuffer procfs$regions() ByteBuffer procfs$mounts() { InterruptDisabler disabler; - auto buffer = ByteBuffer::createUninitialized(VFS::the().mount_count() * 80); + auto buffer = ByteBuffer::create_uninitialized(VFS::the().mount_count() * 80); char* ptr = (char*)buffer.pointer(); VFS::the().for_each_mount([&ptr] (auto& mount) { auto& fs = mount.guest_fs(); @@ -251,7 +251,7 @@ ByteBuffer procfs$mounts() ByteBuffer procfs$cpuinfo() { - auto buffer = ByteBuffer::createUninitialized(256); + auto buffer = ByteBuffer::create_uninitialized(256); char* ptr = (char*)buffer.pointer(); { CPUID cpuid(0); @@ -316,7 +316,7 @@ ByteBuffer procfs$cpuinfo() ByteBuffer procfs$kmalloc() { - auto buffer = ByteBuffer::createUninitialized(256); + auto buffer = ByteBuffer::create_uninitialized(256); char* ptr = (char*)buffer.pointer(); ptr += ksprintf(ptr, "eternal: %u\npage-aligned: %u\nallocated: %u\nfree: %u\n", kmalloc_sum_eternal, sum_alloc, sum_free); buffer.trim(ptr - (char*)buffer.pointer()); @@ -327,7 +327,7 @@ ByteBuffer procfs$summary() { InterruptDisabler disabler; auto processes = Process::allProcesses(); - auto buffer = ByteBuffer::createUninitialized(processes.size() * 256); + auto buffer = ByteBuffer::create_uninitialized(processes.size() * 256); char* ptr = (char*)buffer.pointer(); ptr += ksprintf(ptr, "PID TPG PGP SID OWNER STATE PPID NSCHED FDS TTY NAME\n"); for (auto* process : processes) { @@ -352,7 +352,7 @@ ByteBuffer procfs$summary() ByteBuffer procfs$vnodes() { auto& vfs = VFS::the(); - auto buffer = ByteBuffer::createUninitialized(vfs.m_max_vnode_count * 256); + auto buffer = ByteBuffer::create_uninitialized(vfs.m_max_vnode_count * 256); char* ptr = (char*)buffer.pointer(); for (size_t i = 0; i < vfs.m_max_vnode_count; ++i) { auto& vnode = vfs.m_nodes[i]; @@ -362,7 +362,7 @@ ByteBuffer procfs$vnodes() String path; if (vnode.core_inode()) path = vfs.absolute_path(*vnode.core_inode()); - if (path.isEmpty()) { + if (path.is_empty()) { if (auto* dev = vnode.characterDevice()) { if (dev->is_tty()) path = static_cast(dev)->tty_name(); diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index f9b13b06556..45f5b001ae5 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -39,7 +39,7 @@ static String& hostnameStorage(InterruptDisabler&) static String getHostname() { InterruptDisabler disabler; - return hostnameStorage(disabler).isolatedCopy(); + return hostnameStorage(disabler).isolated_copy(); } CoolGlobals* g_cool_globals; @@ -59,7 +59,7 @@ Vector Process::allProcesses() { InterruptDisabler disabler; Vector processes; - processes.ensureCapacity(g_processes->sizeSlow()); + processes.ensureCapacity(g_processes->size_slow()); for (auto* process = g_processes->head(); process; process = process->next()) processes.append(process); return processes; @@ -278,7 +278,7 @@ pid_t Process::sys$fork(RegisterDump& regs) int Process::do_exec(const String& path, Vector&& arguments, Vector&& environment) { auto parts = path.split('/'); - if (parts.isEmpty()) + if (parts.is_empty()) return -ENOENT; int error; @@ -473,7 +473,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid, { // FIXME: Don't split() the path twice (sys$spawn also does it...) auto parts = path.split('/'); - if (arguments.isEmpty()) { + if (arguments.is_empty()) { arguments.append(parts.last()); } RetainPtr cwd; @@ -1239,7 +1239,7 @@ int Process::sys$getcwd(char* buffer, size_t size) return -EFAULT; ASSERT(cwd_inode()); auto path = VFS::the().absolute_path(*cwd_inode()); - if (path.isNull()) + if (path.is_null()) return -EINVAL; if (size < path.length() + 1) return -ERANGE; diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 88156eb9bbc..b3bb7060889 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -123,7 +123,7 @@ bool Scheduler::pick_next() auto* prevHead = g_processes->head(); for (;;) { // Move head to tail. - g_processes->append(g_processes->removeHead()); + g_processes->append(g_processes->remove_head()); auto* process = g_processes->head(); if (process->state() == Process::Runnable || process->state() == Process::Running) { diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index 8f5c2326971..0410c26afbf 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -28,7 +28,7 @@ static word s_gdtLength; word gdt_alloc_entry() { ASSERT(s_gdt_freelist); - ASSERT(!s_gdt_freelist->isEmpty()); + ASSERT(!s_gdt_freelist->is_empty()); return s_gdt_freelist->takeLast(); } diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 9f15b5df887..5890580c2cd 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -87,7 +87,7 @@ static void loadKsyms(const ByteBuffer& buffer) kprintf("Loading ksyms: \033[s"); - while (bufptr < buffer.endPointer()) { + while (bufptr < buffer.end_pointer()) { for (unsigned i = 0; i < 8; ++i) address = (address << 4) | parseHexDigit(*(bufptr++)); bufptr += 3; @@ -276,7 +276,7 @@ void init() MemoryManager::initialize(); VFS::initialize_globals(); - StringImpl::initializeGlobals(); + StringImpl::initialize_globals(); PIT::initialize(); diff --git a/LibC/entry.cpp b/LibC/entry.cpp index 5a54b85f591..c99f699f93f 100644 --- a/LibC/entry.cpp +++ b/LibC/entry.cpp @@ -18,7 +18,7 @@ extern "C" int _start() __stdio_init(); __malloc_init(); - StringImpl::initializeGlobals(); + StringImpl::initialize_globals(); int status = 254; int argc; diff --git a/Userland/kill.cpp b/Userland/kill.cpp index 5708c7a8d05..96d2cd8efcb 100644 --- a/Userland/kill.cpp +++ b/Userland/kill.cpp @@ -6,7 +6,7 @@ static unsigned parseUInt(const String& str, bool& ok) { - if (str.isEmpty()) { + if (str.is_empty()) { ok = false; return 0; } diff --git a/VirtualFileSystem/DiskBackedFileSystem.cpp b/VirtualFileSystem/DiskBackedFileSystem.cpp index ac776267afc..b0c9998e686 100644 --- a/VirtualFileSystem/DiskBackedFileSystem.cpp +++ b/VirtualFileSystem/DiskBackedFileSystem.cpp @@ -55,7 +55,7 @@ ByteBuffer DiskBackedFS::readBlock(unsigned index) const } #endif - auto buffer = ByteBuffer::createUninitialized(blockSize()); + auto buffer = ByteBuffer::create_uninitialized(blockSize()); //kprintf("created block buffer with size %u\n", blockSize()); DiskOffset baseOffset = static_cast(index) * static_cast(blockSize()); auto* bufferPointer = buffer.pointer(); @@ -81,7 +81,7 @@ ByteBuffer DiskBackedFS::readBlocks(unsigned index, unsigned count) const return nullptr; if (count == 1) return readBlock(index); - auto blocks = ByteBuffer::createUninitialized(count * blockSize()); + auto blocks = ByteBuffer::create_uninitialized(count * blockSize()); byte* out = blocks.pointer(); for (unsigned i = 0; i < count; ++i) { diff --git a/VirtualFileSystem/Ext2FileSystem.cpp b/VirtualFileSystem/Ext2FileSystem.cpp index 6c4284e9422..f428820a75e 100644 --- a/VirtualFileSystem/Ext2FileSystem.cpp +++ b/VirtualFileSystem/Ext2FileSystem.cpp @@ -27,9 +27,9 @@ Ext2FS::~Ext2FS() ByteBuffer Ext2FS::read_super_block() const { - auto buffer = ByteBuffer::createUninitialized(1024); + auto buffer = ByteBuffer::create_uninitialized(1024); device().read_block(2, buffer.pointer()); - device().read_block(3, buffer.offsetPointer(512)); + device().read_block(3, buffer.offset_pointer(512)); return buffer; } @@ -172,7 +172,7 @@ OwnPtr Ext2FS::lookup_ext2_inode(unsigned inode) const return { }; auto* e2inode = reinterpret_cast(kmalloc(inode_size())); - memcpy(e2inode, reinterpret_cast(block.offsetPointer(offset)), inode_size()); + memcpy(e2inode, reinterpret_cast(block.offset_pointer(offset)), inode_size()); #ifdef EXT2_DEBUG dumpExt2Inode(*e2inode); #endif @@ -357,14 +357,14 @@ ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, size_t count, byte* buffer, return nread; } - if (m_block_list.isEmpty()) { + if (m_block_list.is_empty()) { auto block_list = fs().block_list_for_inode(m_raw_inode); LOCKER(m_lock); if (m_block_list.size() != block_list.size()) m_block_list = move(block_list); } - if (m_block_list.isEmpty()) { + if (m_block_list.is_empty()) { kprintf("ext2fs: read_bytes: empty block list for inode %u\n", index()); return -EIO; } @@ -436,7 +436,7 @@ ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, size // FIXME: It's grossly inefficient to fetch the blocklist on every call to readInodeBytes(). // It needs to be cached! auto list = block_list_for_inode(*e2inode); - if (list.isEmpty()) { + if (list.is_empty()) { kprintf("ext2fs: readInodeBytes: empty block list for inode %u\n", inode.index()); return -EIO; } @@ -500,7 +500,7 @@ bool Ext2FS::write_inode(InodeIdentifier inode, const ByteBuffer& data) ASSERT(blocksNeededBefore == blocksNeededAfter); auto list = block_list_for_inode(*e2inode); - if (list.isEmpty()) { + if (list.is_empty()) { kprintf("ext2fs: writeInode: empty block list for inode %u\n", inode.index()); return false; } @@ -527,7 +527,7 @@ bool Ext2FSInode::traverse_as_directory(Function(buffer.pointer()); - while (entry < buffer.endPointer()) { + while (entry < buffer.end_pointer()) { if (entry->inode != 0) { #ifdef EXT2_DEBUG kprintf("Ext2Inode::traverse_as_directory: %u, name_len: %u, rec_len: %u, file_type: %u, name: %s\n", entry->inode, entry->name_len, entry->rec_len, entry->file_type, namebuf); @@ -586,7 +586,7 @@ bool Ext2FS::write_directory_inode(unsigned directoryInode, Vector(block.offsetPointer(offset)), &e2inode, inode_size()); + memcpy(reinterpret_cast(block.offset_pointer(offset)), &e2inode, inode_size()); writeBlock(blockIndex, block); return true; } @@ -1000,7 +1000,7 @@ InodeIdentifier Ext2FS::create_inode(InodeIdentifier parentInode, const String& } auto blocks = allocate_blocks(group_index_from_inode(inode), ceilDiv(size, blockSize())); - if (blocks.isEmpty()) { + if (blocks.is_empty()) { kprintf("Ext2FS: createInode: allocateBlocks failed\n"); error = -ENOSPC; return { }; @@ -1091,7 +1091,7 @@ InodeIdentifier Ext2FS::find_parent_of_inode(InodeIdentifier inode_id) const InodeIdentifier foundParent; for (auto& directory : directories_in_group) { - if (!directory->reverse_lookup(inode->identifier()).isNull()) { + if (!directory->reverse_lookup(inode->identifier()).is_null()) { foundParent = directory->identifier(); break; } @@ -1104,7 +1104,7 @@ void Ext2FSInode::populate_lookup_cache() { { LOCKER(m_lock); - if (!m_lookup_cache.isEmpty()) + if (!m_lookup_cache.is_empty()) return; } HashMap children; @@ -1115,7 +1115,7 @@ void Ext2FSInode::populate_lookup_cache() }); LOCKER(m_lock); - if (!m_lookup_cache.isEmpty()) + if (!m_lookup_cache.is_empty()) return; m_lookup_cache = move(children); } diff --git a/VirtualFileSystem/FileDescriptor.cpp b/VirtualFileSystem/FileDescriptor.cpp index 8bfeefa6b43..4014a253103 100644 --- a/VirtualFileSystem/FileDescriptor.cpp +++ b/VirtualFileSystem/FileDescriptor.cpp @@ -188,7 +188,7 @@ ByteBuffer FileDescriptor::read_entire_file() ASSERT(!is_fifo()); if (m_vnode->isCharacterDevice()) { - auto buffer = ByteBuffer::createUninitialized(1024); + auto buffer = ByteBuffer::create_uninitialized(1024); ssize_t nread = m_vnode->characterDevice()->read(buffer.pointer(), buffer.size()); buffer.trim(nread); return buffer; @@ -214,7 +214,7 @@ ssize_t FileDescriptor::get_dir_entries(byte* buffer, size_t size) return -ENOTDIR; // FIXME: Compute the actual size needed. - auto tempBuffer = ByteBuffer::createUninitialized(2048); + auto tempBuffer = ByteBuffer::create_uninitialized(2048); BufferStream stream(tempBuffer); m_vnode->vfs()->traverse_directory_inode(*m_vnode->core_inode(), [&stream] (auto& entry) { stream << (dword)entry.inode.index(); diff --git a/VirtualFileSystem/FileSystem.cpp b/VirtualFileSystem/FileSystem.cpp index 62fbfe58808..0bb254096d9 100644 --- a/VirtualFileSystem/FileSystem.cpp +++ b/VirtualFileSystem/FileSystem.cpp @@ -21,7 +21,7 @@ static HashTable& all_inodes() return *s_inode_set; } -void FS::initializeGlobals() +void FS::initialize_globals() { s_lastFileSystemID = 0; s_fs_map = nullptr; @@ -52,7 +52,7 @@ ByteBuffer Inode::read_entire(FileDescriptor* descriptor) return fs().read_entire_inode(identifier(), descriptor); /* size_t initial_size = metadata().size ? metadata().size : 4096; - auto contents = ByteBuffer::createUninitialized(initial_size); + auto contents = ByteBuffer::create_uninitialized(initial_size); ssize_t nread; byte buffer[4096]; @@ -90,7 +90,7 @@ ByteBuffer FS::read_entire_inode(InodeIdentifier inode, FileDescriptor* handle) } size_t initialSize = metadata.size ? metadata.size : 4096; - auto contents = ByteBuffer::createUninitialized(initialSize); + auto contents = ByteBuffer::create_uninitialized(initialSize); ssize_t nread; byte buffer[4096]; diff --git a/VirtualFileSystem/FileSystem.h b/VirtualFileSystem/FileSystem.h index 8215ac41d3e..1eb107996db 100644 --- a/VirtualFileSystem/FileSystem.h +++ b/VirtualFileSystem/FileSystem.h @@ -21,7 +21,7 @@ class FileDescriptor; class FS : public Retainable { public: - static void initializeGlobals(); + static void initialize_globals(); virtual ~FS(); dword id() const { return m_fsid; } diff --git a/VirtualFileSystem/VirtualFileSystem.cpp b/VirtualFileSystem/VirtualFileSystem.cpp index 5c711df21ad..717a2d29117 100644 --- a/VirtualFileSystem/VirtualFileSystem.cpp +++ b/VirtualFileSystem/VirtualFileSystem.cpp @@ -22,7 +22,7 @@ VFS& VFS::the() void VFS::initialize_globals() { s_the = nullptr; - FS::initializeGlobals(); + FS::initialize_globals(); } VFS::VFS() @@ -177,7 +177,7 @@ bool VFS::mount_root(RetainPtr&& fileSystem) auto VFS::allocateNode() -> RetainPtr { - if (m_vnode_freelist.isEmpty()) { + if (m_vnode_freelist.is_empty()) { kprintf("VFS: allocateNode has no nodes left\n"); return nullptr; } @@ -351,7 +351,7 @@ String VFS::absolute_path(Inode& core_inode) ASSERT(parent_id.is_valid()); inode = get_inode(parent_id); } - if (lineage.isEmpty()) + if (lineage.is_empty()) return "/"; lineage.append(m_root_vnode->inode); StringBuilder builder; @@ -369,7 +369,7 @@ String VFS::absolute_path(Inode& core_inode) InodeIdentifier VFS::resolve_path(const String& path, InodeIdentifier base, int& error, int options, InodeIdentifier* deepest_dir) { - if (path.isEmpty()) { + if (path.is_empty()) { error = -EINVAL; return { }; } @@ -388,7 +388,7 @@ InodeIdentifier VFS::resolve_path(const String& path, InodeIdentifier base, int& for (unsigned i = 0; i < parts.size(); ++i) { bool inode_was_root_at_head_of_loop = crumb_id.is_root_inode(); auto& part = parts[i]; - if (part.isEmpty()) + if (part.is_empty()) break; auto metadata = crumb_id.metadata(); if (!metadata.isValid()) { diff --git a/VirtualFileSystem/test.cpp b/VirtualFileSystem/test.cpp index 9a11a44960e..f24a302eee9 100644 --- a/VirtualFileSystem/test.cpp +++ b/VirtualFileSystem/test.cpp @@ -109,7 +109,7 @@ int main(int c, char** v) String command = cmdbuf; auto parts = command.split(' '); - if (parts.isEmpty()) + if (parts.is_empty()) continue; String cmd = parts[0]; diff --git a/Widgets/Button.cpp b/Widgets/Button.cpp index 10ec97aa505..5429ad88547 100644 --- a/Widgets/Button.cpp +++ b/Widgets/Button.cpp @@ -61,7 +61,7 @@ void Button::paintEvent(PaintEvent&) painter.drawLine({ 2, height() - 3 }, { width() - 2, height() - 3 }, shadowColor); } - if (!caption().isEmpty()) { + if (!caption().is_empty()) { auto textRect = rect(); if (m_beingPressed) textRect.moveBy(1, 1); diff --git a/Widgets/CheckBox.cpp b/Widgets/CheckBox.cpp index 0a2a34a24e7..6fb7f766e14 100644 --- a/Widgets/CheckBox.cpp +++ b/Widgets/CheckBox.cpp @@ -89,7 +89,7 @@ void CheckBox::paintEvent(PaintEvent&) painter.fillRect(rect(), backgroundColor()); painter.drawBitmap(bitmapPosition, *bitmap, foregroundColor()); - if (!caption().isEmpty()) { + if (!caption().is_empty()) { painter.drawText(textRect, caption(), Painter::TextAlignment::TopLeft, foregroundColor()); } } diff --git a/Widgets/EventLoop.cpp b/Widgets/EventLoop.cpp index c396c149038..5c4d5b7ec7c 100644 --- a/Widgets/EventLoop.cpp +++ b/Widgets/EventLoop.cpp @@ -23,7 +23,7 @@ EventLoop& EventLoop::main() int EventLoop::exec() { for (;;) { - if (m_queuedEvents.isEmpty()) + if (m_queuedEvents.is_empty()) waitForEvent(); auto events = std::move(m_queuedEvents); for (auto& queuedEvent : events) { diff --git a/Widgets/Label.cpp b/Widgets/Label.cpp index 98937d62a1c..7e33147d0c6 100644 --- a/Widgets/Label.cpp +++ b/Widgets/Label.cpp @@ -23,7 +23,7 @@ void Label::paintEvent(PaintEvent&) { Painter painter(*this); painter.fillRect({ 0, 0, width(), height() }, backgroundColor()); - if (!text().isEmpty()) + if (!text().is_empty()) painter.drawText({ 4, 4, width(), height() }, text(), Painter::TextAlignment::TopLeft, foregroundColor()); } diff --git a/Widgets/Rect.h b/Widgets/Rect.h index fe954c524c4..cd3fbc5411b 100644 --- a/Widgets/Rect.h +++ b/Widgets/Rect.h @@ -12,7 +12,7 @@ public: { } - bool isEmpty() const + bool is_empty() const { return width() == 0 || height() == 0; } diff --git a/Widgets/Size.h b/Widgets/Size.h index a50e7b30864..9a86829639f 100644 --- a/Widgets/Size.h +++ b/Widgets/Size.h @@ -5,7 +5,7 @@ public: Size() { } Size(int w, int h) : m_width(w), m_height(h) { } - bool isEmpty() const { return !m_width || !m_height; } + bool is_empty() const { return !m_width || !m_height; } int width() const { return m_width; } int height() const { return m_height; } diff --git a/Widgets/TerminalWidget.cpp b/Widgets/TerminalWidget.cpp index 51544ab37a3..02f3187aa1d 100644 --- a/Widgets/TerminalWidget.cpp +++ b/Widgets/TerminalWidget.cpp @@ -148,7 +148,7 @@ void TerminalWidget::onReceive(byte ch) void TerminalWidget::keyDownEvent(KeyEvent& event) { - if (event.text().isEmpty()) + if (event.text().is_empty()) return; write(g_fd, event.text().characters(), event.text().length()); } diff --git a/Widgets/TextBox.cpp b/Widgets/TextBox.cpp index 291ff83175b..075812cb627 100644 --- a/Widgets/TextBox.cpp +++ b/Widgets/TextBox.cpp @@ -78,7 +78,7 @@ void TextBox::handleBackspace() } char* buffer; - auto newText = StringImpl::createUninitialized(m_text.length() - 1, buffer); + auto newText = StringImpl::create_uninitialized(m_text.length() - 1, buffer); memcpy(buffer, m_text.characters(), m_cursorPosition - 1); memcpy(buffer + m_cursorPosition - 1, m_text.characters() + m_cursorPosition, m_text.length() - (m_cursorPosition - 1)); @@ -111,11 +111,11 @@ void TextBox::keyDownEvent(KeyEvent& event) return; } - if (!event.text().isEmpty()) { + if (!event.text().is_empty()) { ASSERT(event.text().length() == 1); char* buffer; - auto newText = StringImpl::createUninitialized(m_text.length() + 1, buffer); + auto newText = StringImpl::create_uninitialized(m_text.length() + 1, buffer); memcpy(buffer, m_text.characters(), m_cursorPosition); buffer[m_cursorPosition] = event.text()[0]; diff --git a/Widgets/Window.cpp b/Widgets/Window.cpp index 7c1e30ef83c..2aa53b4b1d1 100644 --- a/Widgets/Window.cpp +++ b/Widgets/Window.cpp @@ -78,7 +78,7 @@ void Window::event(Event& event) return; } if (m_mainWidget) { - if (pe.rect().isEmpty()) + if (pe.rect().is_empty()) return m_mainWidget->event(*make(m_mainWidget->rect())); else return m_mainWidget->event(event); diff --git a/Widgets/WindowManager.cpp b/Widgets/WindowManager.cpp index c2d32ef7f04..f91983b1299 100644 --- a/Widgets/WindowManager.cpp +++ b/Widgets/WindowManager.cpp @@ -94,7 +94,7 @@ void WindowManager::paintWindowFrame(Window& window) }; - if (!m_lastDragRect.isEmpty()) { + if (!m_lastDragRect.is_empty()) { p.xorRect(m_lastDragRect, Color::Red); m_lastDragRect = Rect(); } @@ -137,7 +137,7 @@ void WindowManager::removeWindow(Window& window) return; m_windows.remove(&window); - if (!activeWindow() && !m_windows.isEmpty()) + if (!activeWindow() && !m_windows.is_empty()) setActiveWindow(*m_windows.begin()); repaint(); @@ -245,7 +245,7 @@ void WindowManager::processMouseEvent(MouseEvent& event) void WindowManager::handlePaintEvent(PaintEvent& event) { //printf("[WM] paint event\n"); - if (event.rect().isEmpty()) { + if (event.rect().is_empty()) { event.m_rect.setWidth(AbstractScreen::the().width()); event.m_rect.setHeight(AbstractScreen::the().height()); }