From 8428ce1a2e25409b45319a00096ff1698f414c55 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Thu, 19 May 2022 15:06:37 +0300 Subject: [PATCH] hekate/nyx: gfx: changes to putn --- bootloader/gfx/gfx.c | 11 ++++++----- bootloader/gfx/gfx.h | 2 +- nyx/nyx_gui/gfx/gfx.c | 9 +++++---- nyx/nyx_gui/gfx/gfx.h | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bootloader/gfx/gfx.c b/bootloader/gfx/gfx.c index 66133e0..b46cb29 100644 --- a/bootloader/gfx/gfx.c +++ b/bootloader/gfx/gfx.c @@ -276,13 +276,14 @@ void gfx_puts(char *s) static void _gfx_putn(u32 v, int base, char fill, int fcnt) { - char buf[65]; - static const char digits[] = "0123456789ABCDEFghijklmnopqrstuvwxyz"; + static const char digits[] = "0123456789ABCDEF"; + char *p; + char buf[65]; int c = fcnt; bool negative = false; - if (base > 36) + if (base != 10 && base != 16) return; // Account for negative numbers. @@ -342,9 +343,9 @@ void gfx_printf(const char *fmt, ...) int fill, fcnt; va_start(ap, fmt); - while(*fmt) + while (*fmt) { - if(*fmt == '%') + if (*fmt == '%') { fmt++; fill = 0; diff --git a/bootloader/gfx/gfx.h b/bootloader/gfx/gfx.h index ef7f490..2af7692 100644 --- a/bootloader/gfx/gfx.h +++ b/bootloader/gfx/gfx.h @@ -62,7 +62,7 @@ void gfx_con_getpos(u32 *x, u32 *y); void gfx_con_setpos(u32 x, u32 y); void gfx_putc(char c); void gfx_puts(char *s); -void gfx_printf(const char *fmt, ...); +void gfx_printf(const char *fmt, ...) /* __attribute__((format(printf, 1, 2))) */; void gfx_hexdump(u32 base, const void *buf, u32 len); void gfx_set_pixel(u32 x, u32 y, u32 color); diff --git a/nyx/nyx_gui/gfx/gfx.c b/nyx/nyx_gui/gfx/gfx.c index 61098b7..23e8970 100644 --- a/nyx/nyx_gui/gfx/gfx.c +++ b/nyx/nyx_gui/gfx/gfx.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2018 naehrwert - * Copyright (c) 2018-2021 CTCaer + * Copyright (c) 2018-2022 CTCaer * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -308,13 +308,14 @@ void gfx_puts(char *s) static void _gfx_putn(u32 v, int base, char fill, int fcnt) { - char buf[65]; - static const char digits[] = "0123456789ABCDEFghijklmnopqrstuvwxyz"; + static const char digits[] = "0123456789ABCDEF"; + char *p; + char buf[65]; int c = fcnt; bool negative = false; - if (base > 36) + if (base != 10 && base != 16) return; // Account for negative numbers. diff --git a/nyx/nyx_gui/gfx/gfx.h b/nyx/nyx_gui/gfx/gfx.h index 405f743..e41e382 100644 --- a/nyx/nyx_gui/gfx/gfx.h +++ b/nyx/nyx_gui/gfx/gfx.h @@ -61,7 +61,7 @@ void gfx_con_getpos(u32 *x, u32 *y); void gfx_con_setpos(u32 x, u32 y); void gfx_putc(char c); void gfx_puts(char *s); -void gfx_printf(const char *fmt, ...); +void gfx_printf(const char *fmt, ...) /* __attribute__((format(printf, 1, 2))) */; void gfx_hexdump(u32 base, const void *buf, u32 len); void gfx_set_pixel(u32 x, u32 y, u32 color);