From 067ff3af899e42cfc33bad2c8928271e458bef72 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Tue, 10 Apr 2018 01:03:52 -0700 Subject: [PATCH] fix tab/spaces --- src/boot/loader.c | 4 ++-- src/boot/main.c | 4 ++-- src/boot/utility.c | 4 ++-- src/modules/main/font.cpp | 41 +++++++++++++++++-------------------- src/modules/main/font.h | 36 ++++++++++++++++---------------- src/modules/main/main.cpp | 4 ++-- src/modules/main/screen.cpp | 12 +++++------ src/modules/main/screen.h | 21 ++++++++++--------- 8 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/boot/loader.c b/src/boot/loader.c index 0952ac3..25402a8 100644 --- a/src/boot/loader.c +++ b/src/boot/loader.c @@ -28,8 +28,8 @@ loader_alloc_pages( bootsvc->AllocatePages(AllocateAnyPages, mem_type, page_count, &addr); } CHECK_EFI_STATUS_OR_RETURN(status, - L"Allocating %d kernel pages type %x", - page_count, mem_type); + L"Allocating %d kernel pages type %x", + page_count, mem_type); *length = page_count * PAGE_SIZE; *pages = (void *)addr; diff --git a/src/boot/main.c b/src/boot/main.c index 53cddd4..6d592a1 100644 --- a/src/boot/main.c +++ b/src/boot/main.c @@ -95,8 +95,8 @@ efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table) } con_printf(L" Kernel version %d.%d.%d %x%s\r\n", - version->major, version->minor, version->patch, version->gitsha & 0x0fffffff, - version->gitsha & 0xf0000000 ? "*" : ""); + version->major, version->minor, version->patch, version->gitsha & 0x0fffffff, + version->gitsha & 0xf0000000 ? "*" : ""); con_printf(L" Entrypoint 0x%x\r\n", version->entrypoint); void (*kernel_main)() = version->entrypoint; diff --git a/src/boot/utility.c b/src/boot/utility.c index 0757ef8..f1b26f9 100644 --- a/src/boot/utility.c +++ b/src/boot/utility.c @@ -1,8 +1,8 @@ #include "utility.h" struct error_code_desc { - EFI_STATUS code; - CHAR16 *name; + EFI_STATUS code; + CHAR16 *name; }; // Based off the gnu-efi table diff --git a/src/modules/main/font.cpp b/src/modules/main/font.cpp index 2248ee0..fe24501 100644 --- a/src/modules/main/font.cpp +++ b/src/modules/main/font.cpp @@ -19,10 +19,10 @@ enum psf2_flags { struct psf2_header { uint8_t magic[4]; uint32_t version; - uint32_t header_size; // offset of bitmaps in file + uint32_t header_size; // offset of bitmaps in file uint32_t flags; - uint32_t length; // number of glyphs - uint32_t charsize; // number of bytes for each character + uint32_t length; // number of glyphs + uint32_t charsize; // number of bytes for each character uint32_t height, width; // max dimensions of glyphs }; @@ -36,35 +36,32 @@ font::load(void const *data) } } - uint8_t const *font_data = static_cast(data) + psf2->header_size; - return font{ - psf2->height, - psf2->width, - psf2->length, - font_data}; + uint8_t const *font_data = static_cast(data) + psf2->header_size; + return font{ + psf2->height, + psf2->width, + psf2->length, + font_data}; } font::font() : - m_height(0), - m_width(0), - m_count(0), - m_data(nullptr) + m_count(0), + m_data(nullptr) {} font::font(unsigned height, unsigned width, unsigned count, uint8_t const *data) : - m_height(height), - m_width(width), - m_count(count), - m_data(data) + m_size(width, height), + m_count(count), + m_data(data) {} void font::draw_glyph( - screen &s, - uint32_t glyph, - screen::pixel_t color, - screen::coord_t x, - screen::coord_t y) const + screen &s, + uint32_t glyph, + screen::pixel_t color, + unsigned x, + unsigned y) const { unsigned bwidth = (m_width+7)/8; uint8_t const *data = m_data + (glyph * glyph_bytes()); diff --git a/src/modules/main/font.h b/src/modules/main/font.h index 44129ca..4447d1c 100644 --- a/src/modules/main/font.h +++ b/src/modules/main/font.h @@ -6,28 +6,28 @@ class font { public: - static font load(void const *data); + static font load(void const *data); - unsigned glyph_bytes() const { return m_height * ((m_width + 7) / 8); } - unsigned count() const { return m_count; } - unsigned width() const { return m_width; } - unsigned height() const { return m_height; } - bool valid() const { return m_count > 0; } + unsigned glyph_bytes() const { return m_height * ((m_width + 7) / 8); } + unsigned count() const { return m_count; } + unsigned width() const { return m_width; } + unsigned height() const { return m_height; } + bool valid() const { return m_count > 0; } - void draw_glyph( - screen &s, - uint32_t glyph, - screen::pixel_t color, - screen::coord_t x, - screen::coord_t y) const; + void draw_glyph( + screen &s, + uint32_t glyph, + screen::pixel_t color, + unsigned x, + unsigned y) const; private: - font(); - font(unsigned height, unsigned width, unsigned count, uint8_t const *data); + font(); + font(unsigned height, unsigned width, unsigned count, uint8_t const *data); - unsigned m_height; - unsigned m_width; - unsigned m_count; - uint8_t const *m_data; + unsigned m_height; + unsigned m_width; + unsigned m_count; + uint8_t const *m_data; }; diff --git a/src/modules/main/main.cpp b/src/modules/main/main.cpp index cad5d67..cccd8d8 100644 --- a/src/modules/main/main.cpp +++ b/src/modules/main/main.cpp @@ -6,8 +6,8 @@ #include "screen.h" extern "C" { - void do_the_set_registers(popcorn_data *header); - void kernel_main(popcorn_data *header); + void do_the_set_registers(popcorn_data *header); + void kernel_main(popcorn_data *header); } void diff --git a/src/modules/main/screen.cpp b/src/modules/main/screen.cpp index 3e9c7d8..2ad2362 100644 --- a/src/modules/main/screen.cpp +++ b/src/modules/main/screen.cpp @@ -4,12 +4,12 @@ screen::color_masks::color_masks(pixel_t r, pixel_t g, pixel_t b) : r(r), g(g), screen::resolution::resolution(coord_t w, coord_t h) : w(w), h(h) {} screen::screen( - void *framebuffer, - coord_t hres, coord_t vres, - pixel_t rmask, pixel_t gmask, pixel_t bmask) : - m_framebuffer(static_cast(framebuffer)), - m_masks(rmask, gmask, bmask), - m_resolution(hres, vres) + void *framebuffer, + coord_t hres, coord_t vres, + pixel_t rmask, pixel_t gmask, pixel_t bmask) : + m_framebuffer(static_cast(framebuffer)), + m_masks(rmask, gmask, bmask), + m_resolution(hres, vres) { } diff --git a/src/modules/main/screen.h b/src/modules/main/screen.h index f25eeeb..6284546 100644 --- a/src/modules/main/screen.h +++ b/src/modules/main/screen.h @@ -5,24 +5,25 @@ class screen { public: - using coord_t = uint32_t; - using pixel_t = uint32_t; + using coord_t = uint32_t; + using pixel_t = uint32_t; - screen( - void *framebuffer, - coord_t hres, coord_t vres, - pixel_t rmask, pixel_t gmask, pixel_t bmask); + screen( + void *framebuffer, + coord_t hres, coord_t vres, + pixel_t rmask, pixel_t gmask, pixel_t bmask); - void fill(pixel_t color); - void draw_pixel(coord_t x, coord_t y, pixel_t color); - screen() = delete; - screen(const screen &) = delete; + + void fill(pixel_t color); + void draw_pixel(unsigned x, unsigned y, pixel_t color); struct color_masks { pixel_t r, g, b; color_masks(pixel_t r, pixel_t g, pixel_t b); }; + screen() = delete; + screen(const screen &) = delete; struct resolution { coord_t w, h;