Author: LordOfTrident <lordoftrident@gmail.com>
Fix compiler warnings and some other stuff
Makefile | 4 ++-- source/event.c | 10 ++++------ source/interpreter/vt100.c | 4 ++-- source/main.c | 2 +- source/schrift.c | 1 - source/schrift.h | 6 ------ source/ttf.c | 14 +++++++++++--- source/ttf.h | 5 +++--
diff --git a/Makefile b/Makefile index a5ea18a5dd6246d77cbb7330d59e95141f1a9bfa..440261748df2f47ec17af8541eaf2e9deb4a9d1e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SOURCES := $(wildcard source/*.c) $(wildcard source/**/*.c) +SOURCES := $(wildcard source/*.c) $(wildcard source/**/*.c) OBJECTS := $(patsubst source/%.c,bin/%.o,$(SOURCES)) PLAT := $(shell uname -s) @@ -31,7 +31,7 @@ override CPPFLAGS += -DSDL_MAIN_HANDLED -D_POSIX_C_SOURCE=199309L ifeq ($(BUILD),release) override CFLAGS += -O3 - #override CPPFLAGS += -NDEBUG + override CPPFLAGS += -NDEBUG else override CFLAGS += -O0 -ggdb -fno-omit-frame-pointer override LDFLAGS += -O0 -ggdb -fno-omit-frame-pointer diff --git a/source/event.c b/source/event.c index dfacedccc56a9d2f35f845e5f0396ab6cc301f9a..69c261d08fc3731c738c25b1a9faeb1d40a55034 100644 --- a/source/event.c +++ b/source/event.c @@ -31,23 +31,21 @@ } } static Event* FindFree(void) { - int i; - - for (i = 0; i < eventsSize; ++ i) { + for (size_t i = 0; i < eventsSize; ++ i) { if (events[i].type == EVENT_NONE) { return &events[i]; } } - for (i = 0; i < eventsSize; ++ i) { - printf("Event %d: %d\n", i, (int) events[i].type); + for (size_t i = 0; i < eventsSize; ++ i) { + printf("Event %zu: %d\n", i, (int) events[i].type); } size_t old = eventsSize; events = SafeRealloc(events, eventsSize * 2 * sizeof(Event)); eventsSize *= 2; - for (int i = old; i < eventsSize; ++ i) { + for (size_t i = old; i < eventsSize; ++ i) { events[i].type = EVENT_NONE; } diff --git a/source/interpreter/vt100.c b/source/interpreter/vt100.c index f01ef58ecd75cb4297ab9f44642025b8a1cc3c4b..11c5dbb513e212e593b0eebddc0916f8f3f08bee 100644 --- a/source/interpreter/vt100.c +++ b/source/interpreter/vt100.c @@ -191,6 +191,7 @@ terminal->cursor.y -= by; } } +#ifndef NDEBUG static void PrintCSI(char** parts, size_t num, UChar ch) { printf("CSI "); @@ -200,6 +201,7 @@ } printf("%c\n", (char) ch); } +#endif static void ColourSeq(int part, Terminal* terminal) { switch (part) { @@ -628,10 +630,8 @@ static void HandleOSC(Vt100* this, Terminal* terminal) { // parse sequences const char* str = this->reading; - bool q = false; if (*str == '?') { - q = true; ++ str; } diff --git a/source/main.c b/source/main.c index 00de404068ffb890046e9a822813284e647fea25..e201fd4914dd976a80257e1e3cad977f1a004e1e 100644 --- a/source/main.c +++ b/source/main.c @@ -22,7 +22,7 @@ {"stub", Backend_Stub()} }; Log("Available backends:"); - for (int i = 0; i < sizeof(backends) / sizeof(*backends); ++ i) { + for (size_t i = 0; i < sizeof(backends) / sizeof(*backends); ++ i) { Log("- %s", backends[i].name); } Log("Selecting '%s'", backends[0].name); diff --git a/source/schrift.c b/source/schrift.c deleted file mode 100644 index 778ac42e05fa003d78fb917af0f503429ace0d4f..0000000000000000000000000000000000000000 --- a/source/schrift.c +++ /dev/null @@ -1 +0,0 @@ -#include <libschrift/schrift.c> diff --git a/source/schrift.h b/source/schrift.h deleted file mode 100644 index 56642647d9d5929a3ccb6172c6dd13e0020c9d21..0000000000000000000000000000000000000000 --- a/source/schrift.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef YT_SCHRIFT_H -#define YT_SCHRIFT_H - -#include <libschrift/schrift.h> - -#endif diff --git a/source/ttf.c b/source/ttf.c index c1525458f845dbc6bd112ba94e33497c490b9135..9d6390d8460c951857626f1fe445039e92f913d3 100644 --- a/source/ttf.c +++ b/source/ttf.c @@ -1,6 +1,14 @@ #include "ttf.h" -TTFont TTFont_Load(const char* path, bool* success) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcalloc-transposed-args" +#ifdef _POSIX_C_SOURCE +# undef _POSIX_C_SOURCE // Supress redefinition warning from inside libschrift +#endif +#include <libschrift/schrift.c> +#pragma GCC diagnostic pop + +TTFont TTFont_Load(const char* path, float size, bool* success) { *success = true; TTFont ret; @@ -11,8 +19,8 @@ *success = false; return ret; } - ret.sft.xScale = 1; - ret.sft.yScale = 1; + ret.sft.xScale = size; + ret.sft.yScale = size; ret.sft.xOffset = 0; ret.sft.yOffset = 0; ret.sft.flags = SFT_DOWNWARD_Y; diff --git a/source/ttf.h b/source/ttf.h index 9709f4f9301c4290db4016d24e89acc319d29d1c..f13882682b8da015cda859b96131bc26862d92c3 100644 --- a/source/ttf.h +++ b/source/ttf.h @@ -1,14 +1,15 @@ #ifndef YT_TTF_H #define YT_TTF_H +#include <libschrift/schrift.h> + #include "common.h" -#include "schrift.h" typedef struct { SFT sft; } TTFont; -TTFont TTFont_Load(const char* path, bool* success); +TTFont TTFont_Load(const char* path, float size, bool* success); void TTFont_Free(TTFont* font); #endif