summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-13 18:27:10 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-13 23:27:20 -0700
commit3e3032cfa044268cee76735823755db274025021 (patch)
treeead68726685be0e1b6fdccd5c78f132dfb093517 /src/libs
parent2825d01bf16f8b22f8eb9b92b2c21a654c13e563 (diff)
*: smattering of random small fixes to silence -Wall
I thought the build was already using -Wall but that seems to not be the case, maybe got lost somewhere along the line or messed up in configure.ac After forcing a build with -Wall -Werror, these showed up. Fixed up in the obvious way, nothing too scary.
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/din/din.c2
-rw-r--r--src/libs/ray/ray_light_emitter.h1
-rw-r--r--src/libs/ray/ray_render_object_point.h2
-rw-r--r--src/libs/txt/txt.c4
4 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/din/din.c b/src/libs/din/din.c
index 4290d41..b2c2823 100644
--- a/src/libs/din/din.c
+++ b/src/libs/din/din.c
@@ -18,7 +18,7 @@ typedef struct din_t {
/* return random number between -1 and +1 */
static inline float randf(unsigned *seed)
{
- return 2.f / RAND_MAX * rand_r(seed) - 1.f;
+ return 2.f / ((float)RAND_MAX) * rand_r(seed) - 1.f;
}
diff --git a/src/libs/ray/ray_light_emitter.h b/src/libs/ray/ray_light_emitter.h
index 3b5509e..4a1dce5 100644
--- a/src/libs/ray/ray_light_emitter.h
+++ b/src/libs/ray/ray_light_emitter.h
@@ -5,6 +5,7 @@
#include "ray_object_sphere.h"
typedef enum ray_light_emitter_type_t {
+ RAY_LIGHT_EMITTER_TYPE_SENTINEL, /* TODO: this is fragile, the enum values align with ray_object_type_t so the object-specific .type can be assigned as object types to silence compiler warnings, without producing wrong type values in the ray_light_emitter_t.type. What should probably be done is splitting out the rudimentary objects into even simpler structs without a type member so we can have light variants and object variants each with their own enum typed type members... not now. */
RAY_LIGHT_EMITTER_TYPE_SPHERE,
RAY_LIGHT_EMITTER_TYPE_POINT,
} ray_light_emitter_type_t;
diff --git a/src/libs/ray/ray_render_object_point.h b/src/libs/ray/ray_render_object_point.h
index 52c6fd6..3479c22 100644
--- a/src/libs/ray/ray_render_object_point.h
+++ b/src/libs/ray/ray_render_object_point.h
@@ -31,7 +31,7 @@ static inline int ray_render_object_point_intersects_ray(ray_render_object_point
static inline ray_3f_t ray_render_object_point_normal(ray_render_object_point_t *point, ray_3f_t *_point)
{
- ray_3f_t normal;
+ ray_3f_t normal = {};
return normal;
}
diff --git a/src/libs/txt/txt.c b/src/libs/txt/txt.c
index e5eeec6..f087aeb 100644
--- a/src/libs/txt/txt.c
+++ b/src/libs/txt/txt.c
@@ -153,7 +153,7 @@ static int overlaps(int x1, int y1, unsigned w1, unsigned h1, int x2, int y2, un
}
-static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x, int y, char c)
+static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x, int y, unsigned char c)
{
/* TODO: this could be optimized to skip characters with no overlap */
for (int i = 0; i < ASCII_HEIGHT; i++) {
@@ -168,7 +168,7 @@ static inline void draw_char(til_fb_fragment_t *fragment, uint32_t color, int x,
void txt_render_fragment(txt_t *txt, til_fb_fragment_t *fragment, uint32_t color, int x, int y, txt_align_t alignment)
{
int jx, jy, col, row;
- char c, *str;
+ char *str;
assert(txt);
assert(fragment);
© All Rights Reserved