This commit is contained in:
parent
96135ff808
commit
a3595e71a9
@ -10,3 +10,5 @@ AllowShortIfStatementsOnASingleLine: Always
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: 'true'
|
||||
PointerAlignment: Left
|
||||
Cpp11BracedListStyle: 'false'
|
||||
SpaceBeforeCpp11BracedList: 'true'
|
@ -14,8 +14,8 @@ static constexpr u32 WHITE = 0xffffffff;
|
||||
static constexpr u32 YELLOW = 0xffffff00;
|
||||
static constexpr u32 RED = 0xffff0000;
|
||||
|
||||
static char log_level_letters[] = {'D', 'I', 'W', 'E'}; // D for debug, I for info, W for warning, E for error
|
||||
static const char* ansi_color_codes_per_log_level[] = {"37", "37", "33", "31"}; // 37 is white, 33 yellow, 31 red
|
||||
static char log_level_letters[] = { 'D', 'I', 'W', 'E' }; // D for debug, I for info, W for warning, E for error
|
||||
static const char* ansi_color_codes_per_log_level[] = { "37", "37", "33", "31" }; // 37 is white, 33 yellow, 31 red
|
||||
|
||||
static void log_serial(LogLevel level, const char* format, va_list origin)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ static inline constexpr bool isleap(u32 year)
|
||||
|
||||
static constexpr u32 make_yday(u32 year, u32 month)
|
||||
{
|
||||
constexpr u16 upto[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
|
||||
constexpr u16 upto[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
|
||||
u32 yd = upto[month - 1];
|
||||
if (month > 2 && isleap(year)) yd++;
|
||||
|
@ -44,13 +44,13 @@ struct [[gnu::packed]] alignas(4096) GlobalDescriptorTable
|
||||
|
||||
TSS task_state_segment;
|
||||
|
||||
static GlobalDescriptorTable gdt = {{0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xffff, 0x0000, 0x00, 0x9a, 0xaf, 0x00},
|
||||
{0xffff, 0x0000, 0x00, 0x92, 0xcf, 0x00},
|
||||
{0xffff, 0x0000, 0x00, 0xfa, 0xaf, 0x00},
|
||||
{0xffff, 0x0000, 0x00, 0xf2, 0xcf, 0x00},
|
||||
{0x0000, 0x0000, 0x00, 0xe9, 0x0f, 0x00},
|
||||
{0x00000000, 0x00000000}};
|
||||
static GlobalDescriptorTable gdt = { { 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0xffff, 0x0000, 0x00, 0x9a, 0xaf, 0x00 },
|
||||
{ 0xffff, 0x0000, 0x00, 0x92, 0xcf, 0x00 },
|
||||
{ 0xffff, 0x0000, 0x00, 0xfa, 0xaf, 0x00 },
|
||||
{ 0xffff, 0x0000, 0x00, 0xf2, 0xcf, 0x00 },
|
||||
{ 0x0000, 0x0000, 0x00, 0xe9, 0x0f, 0x00 },
|
||||
{ 0x00000000, 0x00000000 } };
|
||||
|
||||
extern "C" void load_gdt(GDTR* gdtr);
|
||||
extern "C" void load_tr(int segment);
|
||||
|
@ -22,7 +22,7 @@ MemoryMapEntry& MemoryMapEntry::operator=(const MemoryMapEntry& other)
|
||||
|
||||
static MemoryMapEntry memory_map_entry_from_mmapent(const MMapEnt* ent)
|
||||
{
|
||||
return {MMapEnt_Ptr(ent), MMapEnt_Size(ent), MMapEnt_IsFree(ent)};
|
||||
return { MMapEnt_Ptr(ent), MMapEnt_Size(ent), MMapEnt_IsFree(ent) };
|
||||
}
|
||||
|
||||
MemoryMapIterator::MemoryMapIterator() : m_mmap_entries((bootboot.size - 128) / 16), m_base_ent(&bootboot.mmap)
|
||||
|
@ -26,7 +26,7 @@ namespace Scheduler
|
||||
u64 idle_stack_vm = MemoryManager::alloc_for_kernel(1, MMU::NoExecute | MMU::ReadWrite)
|
||||
.expect_value("Error while setting up the idle task, cannot continue");
|
||||
|
||||
Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE};
|
||||
Stack idle_stack { idle_stack_vm, ARCH_PAGE_SIZE };
|
||||
g_idle.set_sp(idle_stack.top());
|
||||
|
||||
g_idle.stack = idle_stack;
|
||||
@ -55,7 +55,7 @@ namespace Scheduler
|
||||
|
||||
guard.deactivate();
|
||||
|
||||
Stack thread_stack{thread_stack_vm, ARCH_PAGE_SIZE * 4};
|
||||
Stack thread_stack { thread_stack_vm, ARCH_PAGE_SIZE * 4 };
|
||||
thread->set_sp(thread_stack.top());
|
||||
|
||||
thread->stack = thread_stack;
|
||||
|
@ -16,7 +16,7 @@ class Spinlock
|
||||
}
|
||||
|
||||
private:
|
||||
Atomic<int> m_lock{0};
|
||||
Atomic<int> m_lock { 0 };
|
||||
};
|
||||
|
||||
template <typename T> class LockedValue
|
||||
@ -76,12 +76,12 @@ template <typename T> class LockedValue
|
||||
LockedValueGuard lock()
|
||||
{
|
||||
m_lock.lock();
|
||||
return {*this};
|
||||
return { *this };
|
||||
}
|
||||
|
||||
Option<LockedValueGuard> try_lock()
|
||||
{
|
||||
if (m_lock.try_lock()) { return {*this}; }
|
||||
if (m_lock.try_lock()) { return { *this }; }
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
// FIXME: Load a font from disk/initrd.
|
||||
|
||||
u8 font[] = {0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42,
|
||||
u8 font[] = { 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42,
|
||||
0x42, 0x42, 0x42, 0x7e, 0x00, 0x00, 0x00, 0x00, /* 0 */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1 */
|
||||
@ -516,4 +516,4 @@ u8 font[] = {0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42,
|
||||
0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42,
|
||||
0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, /* 255 */
|
||||
0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
|
||||
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00 /* Special box character, 256 */};
|
||||
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00 /* Special box character, 256 */ };
|
@ -83,7 +83,7 @@ template <typename T> class Option
|
||||
ErrorHandle release_error()
|
||||
{
|
||||
expect(!has_value(), "Option::release_error called on a non-empty Option");
|
||||
return ErrorHandle{};
|
||||
return ErrorHandle {};
|
||||
}
|
||||
|
||||
private:
|
||||
@ -127,5 +127,5 @@ template <typename T> class Option
|
||||
}
|
||||
};
|
||||
Storage m_storage;
|
||||
bool m_has_value{false};
|
||||
bool m_has_value { false };
|
||||
};
|
@ -27,6 +27,6 @@ class OwnedStringView
|
||||
const char& operator[](usize) const;
|
||||
|
||||
private:
|
||||
char* m_string{nullptr};
|
||||
usize m_length{0};
|
||||
char* m_string { nullptr };
|
||||
usize m_length { 0 };
|
||||
};
|
@ -60,7 +60,7 @@ template <typename T> class Result
|
||||
Error release_error() const
|
||||
{
|
||||
expect(has_error(), "Result::release_error() called on a Result that holds a value");
|
||||
return {m_error};
|
||||
return { m_error };
|
||||
}
|
||||
|
||||
const char* error_string() const
|
||||
@ -154,7 +154,7 @@ template <> class Result<void>
|
||||
Error release_error() const
|
||||
{
|
||||
expect(has_error(), "Result::release_error() called on a Result that holds a value");
|
||||
return {m_error};
|
||||
return { m_error };
|
||||
}
|
||||
|
||||
const char* error_string() const
|
||||
|
@ -18,11 +18,11 @@ template <typename Callback> class ScopeGuard
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_activated{true};
|
||||
bool m_activated { true };
|
||||
Callback m_callback;
|
||||
};
|
||||
|
||||
template <typename Callback> [[nodiscard]] ScopeGuard<Callback> make_scope_guard(const Callback& callback)
|
||||
{
|
||||
return {callback};
|
||||
return { callback };
|
||||
}
|
@ -487,7 +487,7 @@ Result<usize> cstyle_format(const char* format, callback_t callback, void* arg,
|
||||
usize precision = parse_precision(&format, flags, ap);
|
||||
parse_length(&format, flags);
|
||||
|
||||
conv_state vstate = {flags, width, precision};
|
||||
conv_state vstate = { flags, width, precision };
|
||||
|
||||
const char specifier = *format;
|
||||
format++;
|
||||
@ -587,7 +587,7 @@ usize pure_cstyle_format(const char* format, pure_callback_t callback, void* arg
|
||||
usize precision = parse_precision(&format, flags, ap);
|
||||
parse_length(&format, flags);
|
||||
|
||||
conv_state vstate = {flags, width, precision};
|
||||
conv_state vstate = { flags, width, precision };
|
||||
|
||||
const char specifier = *format;
|
||||
format++;
|
||||
@ -664,7 +664,7 @@ struct StringFormatInfo
|
||||
|
||||
usize vstring_format(char* buf, usize max, const char* format, va_list ap)
|
||||
{
|
||||
StringFormatInfo info = {.buffer = buf, .remaining = max - 1};
|
||||
StringFormatInfo info = { .buffer = buf, .remaining = max - 1 };
|
||||
|
||||
usize result = pure_cstyle_format(
|
||||
format,
|
||||
|
@ -32,7 +32,7 @@ Result<OwnedStringView> OwnedStringView::clone() const
|
||||
|
||||
if (!c_str) return err(ENOMEM);
|
||||
|
||||
return OwnedStringView{c_str};
|
||||
return OwnedStringView { c_str };
|
||||
}
|
||||
|
||||
const char& OwnedStringView::operator[](usize index) const
|
||||
@ -45,5 +45,5 @@ Result<OwnedStringView> OwnedStringView::from_string_literal(const char* str)
|
||||
{
|
||||
char* dup = strdup(str);
|
||||
if (!dup) return err(ENOMEM);
|
||||
return OwnedStringView{dup};
|
||||
return OwnedStringView { dup };
|
||||
}
|
@ -105,5 +105,5 @@ Result<OwnedStringView> TarStream::read_contents_as_string(const Entry& entry, u
|
||||
|
||||
buf[nread] = 0;
|
||||
|
||||
return OwnedStringView{buf};
|
||||
return OwnedStringView { buf };
|
||||
}
|
@ -24,5 +24,5 @@ Result<OwnedStringView> to_dynamic_unit(usize value)
|
||||
|
||||
to_dynamic_unit_cstr(value, buf, 64);
|
||||
|
||||
return OwnedStringView{buf};
|
||||
return OwnedStringView { buf };
|
||||
}
|
@ -208,11 +208,11 @@ Result<Option<wchar_t>> Utf8StateDecoder::feed(char c)
|
||||
if (m_state_len == 1)
|
||||
{
|
||||
m_state_len = 0;
|
||||
return Option<wchar_t>{c & 0x7f};
|
||||
return Option<wchar_t> { c & 0x7f };
|
||||
}
|
||||
m_state_index = 0;
|
||||
m_state[m_state_index] = c;
|
||||
return {{}};
|
||||
return { {} };
|
||||
}
|
||||
|
||||
m_state_index++;
|
||||
@ -223,10 +223,10 @@ Result<Option<wchar_t>> Utf8StateDecoder::feed(char c)
|
||||
usize len = m_state_len;
|
||||
wchar_t wc = TRY(encode_utf8_as_wide_char(m_state, len));
|
||||
m_state_len = 0;
|
||||
return Option<wchar_t>{wc};
|
||||
return Option<wchar_t> { wc };
|
||||
}
|
||||
|
||||
return {{}};
|
||||
return { {} };
|
||||
}
|
||||
|
||||
void Utf8StateDecoder::reset()
|
||||
|
Loading…
Reference in New Issue
Block a user