From 9bf76a85c8bc41cef8438295042aba991ec42f90 Mon Sep 17 00:00:00 2001 From: Sahan Fernando Date: Tue, 12 Jan 2021 01:35:55 +1100 Subject: [PATCH] Everywhere: Fix incorrect uses of String::format and StringBuilder::appendf These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect. --- Kernel/ACPI/Parser.cpp | 4 ++-- Kernel/Thread.cpp | 2 +- Kernel/VM/MemoryManager.cpp | 2 +- Kernel/VM/Region.cpp | 2 +- Libraries/LibGfx/JPGLoader.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kernel/ACPI/Parser.cpp b/Kernel/ACPI/Parser.cpp index e30e2750e83..6a4c9884e48 100644 --- a/Kernel/ACPI/Parser.cpp +++ b/Kernel/ACPI/Parser.cpp @@ -280,7 +280,7 @@ void Parser::initialize_main_system_description_table() #endif for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u64)); i++) { #ifdef ACPI_DEBUG - dbg() << "ACPI: Found new table [" << i << "], @ V 0x" << String::format("%x", &xsdt.table_ptrs[i]) << " - P 0x" << String::format("%x", xsdt.table_ptrs[i]); + dbg() << "ACPI: Found new table [" << i << "], @ V " << String::format("%p", &xsdt.table_ptrs[i]) << " - P 0x" << String::format("%llx", xsdt.table_ptrs[i]); #endif m_sdt_pointers.append(PhysicalAddress(xsdt.table_ptrs[i])); } @@ -293,7 +293,7 @@ void Parser::initialize_main_system_description_table() #endif for (u32 i = 0; i < ((length - sizeof(Structures::SDTHeader)) / sizeof(u32)); i++) { #ifdef ACPI_DEBUG - dbg() << "ACPI: Found new table [" << i << "], @ V 0x" << String::format("%x", &rsdt.table_ptrs[i]) << " - P 0x" << String::format("%x", rsdt.table_ptrs[i]); + dbg() << "ACPI: Found new table [" << i << "], @ V " << String::format("%p", &rsdt.table_ptrs[i]) << " - P 0x" << String::format("%x", rsdt.table_ptrs[i]); #endif m_sdt_pointers.append(PhysicalAddress(rsdt.table_ptrs[i])); } diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 9ba54f4ef53..bf5922db44d 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -805,7 +805,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal) u32 ret_eflags = state.eflags; #ifdef SIGNAL_DEBUG - klog() << "signal: setting up user stack to return to eip: " << String::format("%p", ret_eip) << " esp: " << String::format("%p", old_esp); + klog() << "signal: setting up user stack to return to eip: " << String::format("%p", (void*)ret_eip) << " esp: " << String::format("%p", (void*)old_esp); #endif // Align the stack to 16 bytes. diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index f7d7298dbd1..742a267c1bd 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -160,7 +160,7 @@ void MemoryManager::parse_memory_map() } #ifdef MM_DEBUG - klog() << "MM: considering memory at " << String::format("%p", (FlatPtr)mmap->addr) << " - " << String::format("%p", (FlatPtr)(mmap->addr + mmap->len)); + klog() << "MM: considering memory at " << String::format("%p", (void*)mmap->addr) << " - " << String::format("%p", (void*)(mmap->addr + mmap->len)); #endif for (size_t page_base = mmap->addr; page_base <= (mmap->addr + mmap->len); page_base += PAGE_SIZE) { diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 2e5a67a92e7..119e02c8f4c 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -384,7 +384,7 @@ void Region::unmap(ShouldDeallocateVirtualMemoryRange deallocate_range) MM.release_pte(*m_page_directory, vaddr, i == count - 1); #ifdef MM_DEBUG auto* page = physical_page(i); - dbg() << "MM: >> Unmapped " << vaddr << " => P" << String::format("%p", page ? page->paddr().get() : 0) << " <<"; + dbg() << "MM: >> Unmapped " << vaddr << " => P" << String::format("%p", (void*)(page ? page->paddr().get() : 0)) << " <<"; #endif } MM.flush_tlb(m_page_directory, vaddr(), page_count()); diff --git a/Libraries/LibGfx/JPGLoader.cpp b/Libraries/LibGfx/JPGLoader.cpp index ded73a59fd2..5b521804f0b 100644 --- a/Libraries/LibGfx/JPGLoader.cpp +++ b/Libraries/LibGfx/JPGLoader.cpp @@ -232,7 +232,7 @@ static Optional read_huffman_bits(HuffmanStreamState& hstream, size_t co { if (count > (8 * sizeof(size_t))) { #ifdef JPG_DEBUG - dbg() << String::format("Can't read %i bits at once!", count); + dbg() << String::format("Can't read %zu bits at once!", count); #endif return {}; }