* Update meson.build
- add logic to loop over more lua names (in the future more names might be discovered)
- disable warnings and errors on dependencies

* adding missing includes and checks, correct data types, pointer mess […]
- various functions from string.h were used but never defined
- logic was done across multiple different data types with different signedness, got all of them up to snuff
- give 0 sized array size of 1 (array of size 0 is illegal, but rewriting the code is out of the scope of this commit)
- add preprocessor that marks possibly unused argument as such (does not mean they will get optimized out or anything)
- correctly initialize structs with all data needed

All these were found by generating the project using `meson -Dwarning_level=3 -Dwerror=true`

* remove undefined behavior, correct data types

* Comment manual bit manipulation to be investigated

* check for more edge cases, replace multiple cleanups with goto

* remove system specific includes
This commit is contained in:
Jan
2022-04-15 11:34:46 -04:00
committed by GitHub
parent d323917538
commit fff10a2612
10 changed files with 158 additions and 90 deletions
+5 -4
View File
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdalign.h>
#include <string.h>
#include <lauxlib.h>
#include "rencache.h"
@@ -28,7 +29,7 @@ typedef struct {
RenColor color;
RenFont *fonts[FONT_FALLBACK_MAX];
float text_x;
char text[0];
char text[];
} Command;
static unsigned cells_buf1[CELLS_X * CELLS_Y];
@@ -134,7 +135,7 @@ void rencache_draw_rect(RenRect rect, RenColor color) {
}
}
float rencache_draw_text(lua_State *L, RenFont **fonts, const char *text, float x, int y, RenColor color)
float rencache_draw_text(RenFont **fonts, const char *text, float x, int y, RenColor color)
{
float width = ren_font_group_get_width(fonts, text);
RenRect rect = { x, y, (int)width, ren_font_group_get_height(fonts) };
@@ -159,7 +160,7 @@ void rencache_invalidate(void) {
}
void rencache_begin_frame(lua_State *L) {
void rencache_begin_frame() {
/* reset all cells if the screen width/height has changed */
int w, h;
ren_get_size(&w, &h);
@@ -200,7 +201,7 @@ static void push_rect(RenRect r, int *count) {
}
void rencache_end_frame(lua_State *L) {
void rencache_end_frame() {
/* update cells from commands */
Command *cmd = NULL;
RenRect cr = screen_rect;